Source cleaning: -1/wxID_ANY/wxDefaultCoord, !!/!IsEmpty(), TRUE/true, FALSE/false, whitespaces, tabs.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -85,14 +85,14 @@ public:
|
|||||||
virtual int GetCount() const;
|
virtual int GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& label);
|
virtual void SetString(int n, const wxString& label);
|
||||||
virtual void Enable(int n, bool enable = TRUE);
|
virtual void Enable(int n, bool enable = true);
|
||||||
virtual void Show(int n, bool show = TRUE);
|
virtual void Show(int n, bool show = true);
|
||||||
virtual int GetColumnCount() const;
|
virtual int GetColumnCount() const;
|
||||||
virtual int GetRowCount() const;
|
virtual int GetRowCount() const;
|
||||||
|
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = true);
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = true);
|
||||||
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
||||||
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||||
|
|
||||||
|
@@ -62,17 +62,17 @@ public:
|
|||||||
|
|
||||||
// get number of entries/subgroups in the current group, with or without
|
// get number of entries/subgroups in the current group, with or without
|
||||||
// it's subgroups
|
// it's subgroups
|
||||||
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
|
virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
|
||||||
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
|
virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
|
||||||
|
|
||||||
virtual bool Flush(bool WXUNUSED(bCurrentOnly) = FALSE) { return TRUE; }
|
virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
|
||||||
|
|
||||||
// rename
|
// rename
|
||||||
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
||||||
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = TRUE);
|
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
|
||||||
virtual bool DeleteGroup(const wxString& key);
|
virtual bool DeleteGroup(const wxString& key);
|
||||||
virtual bool DeleteAll();
|
virtual bool DeleteAll();
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
// get infomation about the key
|
// get infomation about the key
|
||||||
// get the (full) key name. Abbreviate std root keys if bShortPrefix.
|
// get the (full) key name. Abbreviate std root keys if bShortPrefix.
|
||||||
wxString GetName(bool bShortPrefix = TRUE) const;
|
wxString GetName(bool bShortPrefix = true) const;
|
||||||
// return true if the key exists
|
// return true if the key exists
|
||||||
bool Exists() const;
|
bool Exists() const;
|
||||||
// get the info about key (any number of these pointers may be NULL)
|
// get the info about key (any number of these pointers may be NULL)
|
||||||
@@ -139,7 +139,7 @@ public:
|
|||||||
// which need the key to be opened if the key is not opened yet)
|
// which need the key to be opened if the key is not opened yet)
|
||||||
bool Open(AccessMode mode = Write);
|
bool Open(AccessMode mode = Write);
|
||||||
// create the key: will fail if the key already exists and !bOkIfExists
|
// create the key: will fail if the key already exists and !bOkIfExists
|
||||||
bool Create(bool bOkIfExists = TRUE);
|
bool Create(bool bOkIfExists = true);
|
||||||
// rename a value from old name to new one
|
// rename a value from old name to new one
|
||||||
bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew);
|
bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew);
|
||||||
// rename the key
|
// rename the key
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
// access to values and subkeys
|
// access to values and subkeys
|
||||||
// get value type
|
// get value type
|
||||||
ValueType GetValueType(const wxChar *szValue) const;
|
ValueType GetValueType(const wxChar *szValue) const;
|
||||||
// returns TRUE if the value contains a number (else it's some string)
|
// returns true if the value contains a number (else it's some string)
|
||||||
bool IsNumericValue(const wxChar *szValue) const;
|
bool IsNumericValue(const wxChar *szValue) const;
|
||||||
|
|
||||||
// assignment operators set the default value of the key
|
// assignment operators set the default value of the key
|
||||||
@@ -185,10 +185,10 @@ public:
|
|||||||
bool SetValue(const wxChar *szValue, const wxString& strValue);
|
bool SetValue(const wxChar *szValue, const wxString& strValue);
|
||||||
// retrieve the string value
|
// retrieve the string value
|
||||||
bool QueryValue(const wxChar *szValue, wxString& strValue) const
|
bool QueryValue(const wxChar *szValue, wxString& strValue) const
|
||||||
{ return QueryValue(szValue, strValue, FALSE); }
|
{ return QueryValue(szValue, strValue, false); }
|
||||||
// retrieve raw string value
|
// retrieve raw string value
|
||||||
bool QueryRawValue(const wxChar *szValue, wxString& strValue) const
|
bool QueryRawValue(const wxChar *szValue, wxString& strValue) const
|
||||||
{ return QueryValue(szValue, strValue, TRUE); }
|
{ return QueryValue(szValue, strValue, true); }
|
||||||
// retrieve either raw or expanded string value
|
// retrieve either raw or expanded string value
|
||||||
bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const;
|
bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const;
|
||||||
|
|
||||||
|
@@ -202,9 +202,9 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
if ( cmd == BN_CLICKED )
|
if ( cmd == BN_CLICKED )
|
||||||
{
|
{
|
||||||
if (id == GetId())
|
if (id == GetId())
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
int selectedButton = -1;
|
int selectedButton = wxID_ANY;
|
||||||
|
|
||||||
for ( int i = 0; i < m_noItems; i++ )
|
for ( int i = 0; i < m_noItems; i++ )
|
||||||
{
|
{
|
||||||
@@ -216,13 +216,13 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selectedButton == -1 )
|
if ( selectedButton == wxID_ANY )
|
||||||
{
|
{
|
||||||
// just ignore it - due to a hack with WM_NCHITTEST handling in our
|
// just ignore it - due to a hack with WM_NCHITTEST handling in our
|
||||||
// wnd proc, we can receive dummy click messages when we click near
|
// wnd proc, we can receive dummy click messages when we click near
|
||||||
// the radiobox edge (this is ugly but Julian wouldn't let me get
|
// the radiobox edge (this is ugly but Julian wouldn't let me get
|
||||||
// rid of this...)
|
// rid of this...)
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selectedButton != m_selectedButton )
|
if ( selectedButton != m_selectedButton )
|
||||||
@@ -233,16 +233,16 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
}
|
}
|
||||||
//else: don't generate events when the selection doesn't change
|
//else: don't generate events when the selection doesn't change
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Radio box item
|
// Radio box item
|
||||||
wxRadioBox::wxRadioBox()
|
wxRadioBox::wxRadioBox()
|
||||||
{
|
{
|
||||||
m_selectedButton = -1;
|
m_selectedButton = wxID_ANY;
|
||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
m_noRowsOrCols = 0;
|
m_noRowsOrCols = 0;
|
||||||
m_radioButtons = NULL;
|
m_radioButtons = NULL;
|
||||||
@@ -264,7 +264,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
// initialize members
|
// initialize members
|
||||||
m_selectedButton = -1;
|
m_selectedButton = wxID_ANY;
|
||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
|
|
||||||
m_majorDim = majorDim == 0 ? n : majorDim;
|
m_majorDim = majorDim == 0 ? n : majorDim;
|
||||||
@@ -272,12 +272,12 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
// common initialization
|
// common initialization
|
||||||
if ( !CreateControl(parent, id, pos, size, style, val, name) )
|
if ( !CreateControl(parent, id, pos, size, style, val, name) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// create the static box
|
// create the static box
|
||||||
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
|
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
|
||||||
pos, size, title, 0) )
|
pos, size, title, 0) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// and now create the buttons
|
// and now create the buttons
|
||||||
m_noItems = n;
|
m_noItems = n;
|
||||||
@@ -303,7 +303,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
for ( int i = 0; i < n; i++ )
|
for ( int i = 0; i < n; i++ )
|
||||||
{
|
{
|
||||||
m_radioWidth[i] =
|
m_radioWidth[i] =
|
||||||
m_radioHeight[i] = -1;
|
m_radioHeight[i] = wxDefaultCoord;
|
||||||
long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
|
long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
|
||||||
if ( i == 0 && style == 0 )
|
if ( i == 0 && style == 0 )
|
||||||
styleBtn |= WS_GROUP;
|
styleBtn |= WS_GROUP;
|
||||||
@@ -323,7 +323,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
wxLogLastError(wxT("CreateWindow(radio btn)"));
|
wxLogLastError(wxT("CreateWindow(radio btn)"));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_radioButtons[i] = (WXHWND)hwndBtn;
|
m_radioButtons[i] = (WXHWND)hwndBtn;
|
||||||
@@ -356,7 +356,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
// Now that we have items determine what is the best size and set it.
|
// Now that we have items determine what is the best size and set it.
|
||||||
SetBestSize(size);
|
SetBestSize(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRadioBox::Create(wxWindow *parent,
|
bool wxRadioBox::Create(wxWindow *parent,
|
||||||
@@ -377,7 +377,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxRadioBox::~wxRadioBox()
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
if (m_radioButtons)
|
if (m_radioButtons)
|
||||||
{
|
{
|
||||||
@@ -398,7 +398,7 @@ void wxRadioBox::SetString(int item, const wxString& label)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
|
wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
|
||||||
|
|
||||||
m_radioWidth[item] = m_radioHeight[item] = -1;
|
m_radioWidth[item] = m_radioHeight[item] = wxDefaultCoord;
|
||||||
SetWindowText((HWND)m_radioButtons[item], label.c_str());
|
SetWindowText((HWND)m_radioButtons[item], label.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,9 +516,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
int xx = x;
|
int xx = x;
|
||||||
int yy = y;
|
int yy = y;
|
||||||
|
|
||||||
if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
xx = currentX;
|
xx = currentX;
|
||||||
if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
yy = currentY;
|
yy = currentY;
|
||||||
|
|
||||||
#if RADIOBTN_PARENT_IS_RADIOBOX
|
#if RADIOBTN_PARENT_IS_RADIOBOX
|
||||||
@@ -543,7 +543,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
totHeight = totSize.y;
|
totHeight = totSize.y;
|
||||||
|
|
||||||
// only change our width/height if asked for
|
// only change our width/height if asked for
|
||||||
if ( width == -1 )
|
if ( width == wxDefaultCoord )
|
||||||
{
|
{
|
||||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||||
width = totWidth;
|
width = totWidth;
|
||||||
@@ -551,7 +551,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
width = widthOld;
|
width = widthOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( height == -1 )
|
if ( height == wxDefaultCoord )
|
||||||
{
|
{
|
||||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||||
height = totHeight;
|
height = totHeight;
|
||||||
@@ -659,8 +659,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
void wxRadioBox::GetSize(int *width, int *height) const
|
void wxRadioBox::GetSize(int *width, int *height) const
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect = { -1, -1, -1, -1 };
|
||||||
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
|
||||||
|
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
wxFindMaxSize(m_hWnd, &rect);
|
wxFindMaxSize(m_hWnd, &rect);
|
||||||
@@ -712,7 +711,7 @@ void wxRadioBox::SetFocus()
|
|||||||
{
|
{
|
||||||
if (m_noItems > 0)
|
if (m_noItems > 0)
|
||||||
{
|
{
|
||||||
::SetFocus((HWND)m_radioButtons[m_selectedButton == -1
|
::SetFocus((HWND)m_radioButtons[m_selectedButton == wxID_ANY
|
||||||
? 0
|
? 0
|
||||||
: m_selectedButton]);
|
: m_selectedButton]);
|
||||||
}
|
}
|
||||||
@@ -722,7 +721,7 @@ void wxRadioBox::SetFocus()
|
|||||||
bool wxRadioBox::Show(bool show)
|
bool wxRadioBox::Show(bool show)
|
||||||
{
|
{
|
||||||
if ( !wxControl::Show(show) )
|
if ( !wxControl::Show(show) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
int nCmdShow = show ? SW_SHOW : SW_HIDE;
|
int nCmdShow = show ? SW_SHOW : SW_HIDE;
|
||||||
for ( int i = 0; i < m_noItems; i++ )
|
for ( int i = 0; i < m_noItems; i++ )
|
||||||
@@ -730,7 +729,7 @@ bool wxRadioBox::Show(bool show)
|
|||||||
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
|
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable a specific button
|
// Enable a specific button
|
||||||
@@ -746,12 +745,12 @@ void wxRadioBox::Enable(int item, bool enable)
|
|||||||
bool wxRadioBox::Enable(bool enable)
|
bool wxRadioBox::Enable(bool enable)
|
||||||
{
|
{
|
||||||
if ( !wxControl::Enable(enable) )
|
if ( !wxControl::Enable(enable) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; i < m_noItems; i++)
|
for (int i = 0; i < m_noItems; i++)
|
||||||
::EnableWindow((HWND) m_radioButtons[i], enable);
|
::EnableWindow((HWND) m_radioButtons[i], enable);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show a specific button
|
// Show a specific button
|
||||||
@@ -769,10 +768,10 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
|
|||||||
for ( size_t i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( GetRadioButtons()[i] == hWnd )
|
if ( GetRadioButtons()[i] == hWnd )
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::Command(wxCommandEvent & event)
|
void wxRadioBox::Command(wxCommandEvent & event)
|
||||||
@@ -809,7 +808,7 @@ bool wxRadioBox::SetFont(const wxFont& font)
|
|||||||
if ( !wxControl::SetFont(font) )
|
if ( !wxControl::SetFont(font) )
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// also set the font of our radio buttons
|
// also set the font of our radio buttons
|
||||||
@@ -823,7 +822,7 @@ bool wxRadioBox::SetFont(const wxFont& font)
|
|||||||
::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */);
|
::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -963,7 +962,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
|||||||
|
|
||||||
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
|
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
|
||||||
|
|
||||||
bool processed = TRUE;
|
bool processed = true;
|
||||||
|
|
||||||
wxDirection dir;
|
wxDirection dir;
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
@@ -985,7 +984,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
processed = FALSE;
|
processed = false;
|
||||||
|
|
||||||
// just to suppress the compiler warning
|
// just to suppress the compiler warning
|
||||||
dir = wxALL;
|
dir = wxALL;
|
||||||
@@ -1050,7 +1049,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxWindow* subjectOfHelp = radiobox;
|
wxWindow* subjectOfHelp = radiobox;
|
||||||
bool eventProcessed = FALSE;
|
bool eventProcessed = false;
|
||||||
while (subjectOfHelp && !eventProcessed)
|
while (subjectOfHelp && !eventProcessed)
|
||||||
{
|
{
|
||||||
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(),
|
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(),
|
||||||
|
@@ -423,7 +423,7 @@ bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const
|
|||||||
while ( m_keyGlobal.GetNextKey(str, lIndex) ) {
|
while ( m_keyGlobal.GetNextKey(str, lIndex) ) {
|
||||||
if ( !m_keyLocal.Exists() || !LocalKey().HasSubKey(str) ) {
|
if ( !m_keyLocal.Exists() || !LocalKey().HasSubKey(str) ) {
|
||||||
// ok, found one - return it
|
// ok, found one - return it
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const
|
|||||||
|
|
||||||
// if we don't have the key at all, don't try to enumerate anything under it
|
// if we don't have the key at all, don't try to enumerate anything under it
|
||||||
if ( !m_keyLocal.Exists() )
|
if ( !m_keyLocal.Exists() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// much easier with local entries: get the next one we find
|
// much easier with local entries: get the next one we find
|
||||||
// (don't forget to clear our flag bit and set it again later)
|
// (don't forget to clear our flag bit and set it again later)
|
||||||
@@ -458,7 +458,7 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const
|
|||||||
while ( m_keyGlobal.GetNextValue(str, lIndex) ) {
|
while ( m_keyGlobal.GetNextValue(str, lIndex) ) {
|
||||||
if ( !m_keyLocal.Exists() || !LocalKey().HasValue(str) ) {
|
if ( !m_keyLocal.Exists() || !LocalKey().HasValue(str) ) {
|
||||||
// ok, found one - return it
|
// ok, found one - return it
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,7 +468,7 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const
|
|||||||
|
|
||||||
// if we don't have the key at all, don't try to enumerate anything under it
|
// if we don't have the key at all, don't try to enumerate anything under it
|
||||||
if ( !m_keyLocal.Exists() )
|
if ( !m_keyLocal.Exists() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// much easier with local entries: get the next one we find
|
// much easier with local entries: get the next one we find
|
||||||
// (don't forget to clear our flag bit and set it again later)
|
// (don't forget to clear our flag bit and set it again later)
|
||||||
@@ -560,11 +560,11 @@ wxConfigBase::EntryType wxRegConfig::GetEntryType(const wxString& key) const
|
|||||||
|
|
||||||
bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
|
bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( pStr, FALSE, _T("wxRegConfig::Read(): NULL param") );
|
wxCHECK_MSG( pStr, false, _T("wxRegConfig::Read(): NULL param") );
|
||||||
|
|
||||||
wxConfigPathChanger path(this, key);
|
wxConfigPathChanger path(this, key);
|
||||||
|
|
||||||
bool bQueryGlobal = TRUE;
|
bool bQueryGlobal = true;
|
||||||
|
|
||||||
// if immutable key exists in global key we must check that it's not
|
// if immutable key exists in global key we must check that it's not
|
||||||
// overriden by the local key with the same name
|
// overriden by the local key with the same name
|
||||||
@@ -575,21 +575,21 @@ bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
|
|||||||
path.Name().c_str());
|
path.Name().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// don't waste time - it's not there anyhow
|
// don't waste time - it's not there anyhow
|
||||||
bQueryGlobal = FALSE;
|
bQueryGlobal = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first try local key
|
// first try local key
|
||||||
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), *pStr)) ||
|
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), *pStr)) ||
|
||||||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), *pStr)) ) {
|
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), *pStr)) ) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this exactly reproduces the string version above except for ExpandEnvVars(),
|
// this exactly reproduces the string version above except for ExpandEnvVars(),
|
||||||
@@ -597,11 +597,11 @@ bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
|
|||||||
|
|
||||||
bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const
|
bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( plResult, FALSE, _T("wxRegConfig::Read(): NULL param") );
|
wxCHECK_MSG( plResult, false, _T("wxRegConfig::Read(): NULL param") );
|
||||||
|
|
||||||
wxConfigPathChanger path(this, key);
|
wxConfigPathChanger path(this, key);
|
||||||
|
|
||||||
bool bQueryGlobal = TRUE;
|
bool bQueryGlobal = true;
|
||||||
|
|
||||||
// if immutable key exists in global key we must check that it's not
|
// if immutable key exists in global key we must check that it's not
|
||||||
// overriden by the local key with the same name
|
// overriden by the local key with the same name
|
||||||
@@ -612,21 +612,21 @@ bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const
|
|||||||
path.Name().c_str());
|
path.Name().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// don't waste time - it's not there anyhow
|
// don't waste time - it's not there anyhow
|
||||||
bQueryGlobal = FALSE;
|
bQueryGlobal = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first try local key
|
// first try local key
|
||||||
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), plResult)) ||
|
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), plResult)) ||
|
||||||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), plResult)) ) {
|
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), plResult)) ) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
||||||
@@ -635,7 +635,7 @@ bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
|||||||
|
|
||||||
if ( IsImmutable(path.Name()) ) {
|
if ( IsImmutable(path.Name()) ) {
|
||||||
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalKey().SetValue(path.Name(), szValue);
|
return LocalKey().SetValue(path.Name(), szValue);
|
||||||
@@ -647,7 +647,7 @@ bool wxRegConfig::DoWriteLong(const wxString& key, long lValue)
|
|||||||
|
|
||||||
if ( IsImmutable(path.Name()) ) {
|
if ( IsImmutable(path.Name()) ) {
|
||||||
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalKey().SetValue(path.Name(), lValue);
|
return LocalKey().SetValue(path.Name(), lValue);
|
||||||
@@ -661,11 +661,11 @@ bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName)
|
|||||||
{
|
{
|
||||||
// check that the old entry exists...
|
// check that the old entry exists...
|
||||||
if ( !HasEntry(oldName) )
|
if ( !HasEntry(oldName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// and that the new one doesn't
|
// and that the new one doesn't
|
||||||
if ( HasEntry(newName) )
|
if ( HasEntry(newName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return m_keyLocal.RenameValue(oldName, newName);
|
return m_keyLocal.RenameValue(oldName, newName);
|
||||||
}
|
}
|
||||||
@@ -674,11 +674,11 @@ bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName)
|
|||||||
{
|
{
|
||||||
// check that the old group exists...
|
// check that the old group exists...
|
||||||
if ( !HasGroup(oldName) )
|
if ( !HasGroup(oldName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// and that the new one doesn't
|
// and that the new one doesn't
|
||||||
if ( HasGroup(newName) )
|
if ( HasGroup(newName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return wxRegKey(m_keyLocal, oldName).Rename(newName);
|
return wxRegKey(m_keyLocal, oldName).Rename(newName);
|
||||||
}
|
}
|
||||||
@@ -693,7 +693,7 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
|
|||||||
|
|
||||||
if ( m_keyLocal.Exists() ) {
|
if ( m_keyLocal.Exists() ) {
|
||||||
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) {
|
if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) {
|
||||||
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
|
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
|
||||||
@@ -702,14 +702,14 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::DeleteGroup(const wxString& key)
|
bool wxRegConfig::DeleteGroup(const wxString& key)
|
||||||
{
|
{
|
||||||
wxConfigPathChanger path(this, key);
|
wxConfigPathChanger path(this, key);
|
||||||
|
|
||||||
return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : TRUE;
|
return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::DeleteAll()
|
bool wxRegConfig::DeleteAll()
|
||||||
|
@@ -166,12 +166,12 @@ void wxRegion::Clear()
|
|||||||
|
|
||||||
bool wxRegion::Offset(wxCoord x, wxCoord y)
|
bool wxRegion::Offset(wxCoord x, wxCoord y)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( M_REGION, FALSE, _T("invalid wxRegion") );
|
wxCHECK_MSG( M_REGION, false, _T("invalid wxRegion") );
|
||||||
|
|
||||||
if ( !x && !y )
|
if ( !x && !y )
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
@@ -180,10 +180,10 @@ bool wxRegion::Offset(wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
wxLogLastError(_T("OffsetRgn"));
|
wxLogLastError(_T("OffsetRgn"));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// combine another region with this one
|
// combine another region with this one
|
||||||
@@ -209,7 +209,7 @@ bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op)
|
|||||||
case wxRGN_AND:
|
case wxRGN_AND:
|
||||||
case wxRGN_DIFF:
|
case wxRGN_DIFF:
|
||||||
// leave empty/invalid
|
// leave empty/invalid
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // we have a valid region
|
else // we have a valid region
|
||||||
@@ -248,11 +248,11 @@ bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op)
|
|||||||
{
|
{
|
||||||
wxLogLastError(_T("CombineRgn"));
|
wxLogLastError(_T("CombineRgn"));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine rectangle (x, y, w, h) with this.
|
// Combine rectangle (x, y, w, h) with this.
|
||||||
|
@@ -112,7 +112,7 @@ aStdKeys[] =
|
|||||||
// removes the trailing backslash from the string if it has one
|
// removes the trailing backslash from the string if it has one
|
||||||
static inline void RemoveTrailingSeparator(wxString& str);
|
static inline void RemoveTrailingSeparator(wxString& str);
|
||||||
|
|
||||||
// returns TRUE if given registry key exists
|
// returns true if given registry key exists
|
||||||
static bool KeyExists(WXHKEY hRootKey, const wxChar *szKey);
|
static bool KeyExists(WXHKEY hRootKey, const wxChar *szKey);
|
||||||
|
|
||||||
// combines value and key name (uses static buffer!)
|
// combines value and key name (uses static buffer!)
|
||||||
@@ -296,11 +296,11 @@ void wxRegKey::SetHkey(WXHKEY hKey)
|
|||||||
// info about the key
|
// info about the key
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// returns TRUE if the key exists
|
// returns true if the key exists
|
||||||
bool wxRegKey::Exists() const
|
bool wxRegKey::Exists() const
|
||||||
{
|
{
|
||||||
// opened key has to exist, try to open it if not done yet
|
// opened key has to exist, try to open it if not done yet
|
||||||
return IsOpened() ? TRUE : KeyExists(m_hRootKey, m_strKey);
|
return IsOpened() ? true : KeyExists(m_hRootKey, m_strKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the full name of the key (prefix is abbreviated if bShortPrefix)
|
// returns the full name of the key (prefix is abbreviated if bShortPrefix)
|
||||||
@@ -355,10 +355,10 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't get info about registry key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't get info about registry key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -369,7 +369,7 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
|
|||||||
bool wxRegKey::Open(AccessMode mode)
|
bool wxRegKey::Open(AccessMode mode)
|
||||||
{
|
{
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
HKEY tmpKey;
|
HKEY tmpKey;
|
||||||
m_dwLastError = ::RegOpenKeyEx
|
m_dwLastError = ::RegOpenKeyEx
|
||||||
@@ -385,11 +385,11 @@ bool wxRegKey::Open(AccessMode mode)
|
|||||||
{
|
{
|
||||||
wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hKey = (WXHKEY) tmpKey;
|
m_hKey = (WXHKEY) tmpKey;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates key, failing if it exists and !bOkIfExists
|
// creates key, failing if it exists and !bOkIfExists
|
||||||
@@ -397,10 +397,10 @@ bool wxRegKey::Create(bool bOkIfExists)
|
|||||||
{
|
{
|
||||||
// check for existence only if asked (i.e. order is important!)
|
// check for existence only if asked (i.e. order is important!)
|
||||||
if ( !bOkIfExists && Exists() )
|
if ( !bOkIfExists && Exists() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
HKEY tmpKey;
|
HKEY tmpKey;
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
@@ -419,12 +419,12 @@ bool wxRegKey::Create(bool bOkIfExists)
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_hKey = (WXHKEY) tmpKey;
|
m_hKey = (WXHKEY) tmpKey;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,20 +439,20 @@ bool wxRegKey::Close()
|
|||||||
wxLogSysError(m_dwLastError, _("Can't close registry key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't close registry key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
|
bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = true;
|
||||||
if ( HasValue(szValueNew) ) {
|
if ( HasValue(szValueNew) ) {
|
||||||
wxLogError(_("Registry value '%s' already exists."), szValueNew);
|
wxLogError(_("Registry value '%s' already exists."), szValueNew);
|
||||||
|
|
||||||
ok = FALSE;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ok ||
|
if ( !ok ||
|
||||||
@@ -461,10 +461,10 @@ bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
|
|||||||
wxLogError(_("Failed to rename registry value '%s' to '%s'."),
|
wxLogError(_("Failed to rename registry value '%s' to '%s'."),
|
||||||
szValueOld, szValueNew);
|
szValueOld, szValueNew);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::CopyValue(const wxChar *szValue,
|
bool wxRegKey::CopyValue(const wxChar *szValue,
|
||||||
@@ -515,19 +515,19 @@ bool wxRegKey::CopyValue(const wxChar *szValue,
|
|||||||
default:
|
default:
|
||||||
wxLogError(_("Can't copy values of unsupported type %d."),
|
wxLogError(_("Can't copy values of unsupported type %d."),
|
||||||
GetValueType(szValue));
|
GetValueType(szValue));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::Rename(const wxChar *szNewName)
|
bool wxRegKey::Rename(const wxChar *szNewName)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( !!m_strKey, FALSE, _T("registry hives can't be renamed") );
|
wxCHECK_MSG( !m_strKey.IsEmpty(), false, _T("registry hives can't be renamed") );
|
||||||
|
|
||||||
if ( !Exists() ) {
|
if ( !Exists() ) {
|
||||||
wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
|
wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
|
||||||
GetFullName(this));
|
GetFullName(this));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we stay in the same hive?
|
// do we stay in the same hive?
|
||||||
@@ -539,7 +539,7 @@ bool wxRegKey::Rename(const wxChar *szNewName)
|
|||||||
if ( inSameHive ) {
|
if ( inSameHive ) {
|
||||||
// rename the key to the new name under the same parent
|
// rename the key to the new name under the same parent
|
||||||
wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
|
wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
|
||||||
if ( !!strKey ) {
|
if ( !strKey.IsEmpty() ) {
|
||||||
// don't add '\\' in the start if strFullNewName is empty
|
// don't add '\\' in the start if strFullNewName is empty
|
||||||
strKey += REG_SEPARATOR;
|
strKey += REG_SEPARATOR;
|
||||||
}
|
}
|
||||||
@@ -553,7 +553,7 @@ bool wxRegKey::Rename(const wxChar *szNewName)
|
|||||||
keyDst.SetName(szNewName);
|
keyDst.SetName(szNewName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
|
bool ok = keyDst.Create(false /* fail if alredy exists */);
|
||||||
if ( !ok ) {
|
if ( !ok ) {
|
||||||
wxLogError(_("Registry key '%s' already exists."),
|
wxLogError(_("Registry key '%s' already exists."),
|
||||||
GetFullName(&keyDst));
|
GetFullName(&keyDst));
|
||||||
@@ -578,7 +578,7 @@ bool wxRegKey::Copy(const wxChar *szNewName)
|
|||||||
{
|
{
|
||||||
// create the new key first
|
// create the new key first
|
||||||
wxRegKey keyDst(szNewName);
|
wxRegKey keyDst(szNewName);
|
||||||
bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
|
bool ok = keyDst.Create(false /* fail if alredy exists */);
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
ok = Copy(keyDst);
|
ok = Copy(keyDst);
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ bool wxRegKey::Copy(const wxChar *szNewName)
|
|||||||
|
|
||||||
bool wxRegKey::Copy(wxRegKey& keyDst)
|
bool wxRegKey::Copy(wxRegKey& keyDst)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = true;
|
||||||
|
|
||||||
// copy all sub keys to the new location
|
// copy all sub keys to the new location
|
||||||
wxString strKey;
|
wxString strKey;
|
||||||
@@ -646,7 +646,7 @@ bool wxRegKey::DeleteSelf()
|
|||||||
wxLogNull nolog;
|
wxLogNull nolog;
|
||||||
if ( !Open() ) {
|
if ( !Open() ) {
|
||||||
// it already doesn't exist - ok!
|
// it already doesn't exist - ok!
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ bool wxRegKey::DeleteSelf()
|
|||||||
wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."),
|
wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."),
|
||||||
GetFullName(this));
|
GetFullName(this));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can't delete keys while enumerating because it confuses GetNextKey, so
|
// we can't delete keys while enumerating because it confuses GetNextKey, so
|
||||||
@@ -679,7 +679,7 @@ bool wxRegKey::DeleteSelf()
|
|||||||
for ( size_t nKey = 0; nKey < nKeyCount; nKey++ ) {
|
for ( size_t nKey = 0; nKey < nKeyCount; nKey++ ) {
|
||||||
wxRegKey key(*this, astrSubkeys[nKey]);
|
wxRegKey key(*this, astrSubkeys[nKey]);
|
||||||
if ( !key.DeleteSelf() )
|
if ( !key.DeleteSelf() )
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now delete this key itself
|
// now delete this key itself
|
||||||
@@ -691,16 +691,16 @@ bool wxRegKey::DeleteSelf()
|
|||||||
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
|
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't delete key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't delete key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::DeleteKey(const wxChar *szKey)
|
bool wxRegKey::DeleteKey(const wxChar *szKey)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxRegKey key(*this, szKey);
|
wxRegKey key(*this, szKey);
|
||||||
return key.DeleteSelf();
|
return key.DeleteSelf();
|
||||||
@@ -709,7 +709,7 @@ bool wxRegKey::DeleteKey(const wxChar *szKey)
|
|||||||
bool wxRegKey::DeleteValue(const wxChar *szValue)
|
bool wxRegKey::DeleteValue(const wxChar *szValue)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue);
|
m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue);
|
||||||
|
|
||||||
@@ -718,24 +718,24 @@ bool wxRegKey::DeleteValue(const wxChar *szValue)
|
|||||||
(m_dwLastError != ERROR_FILE_NOT_FOUND) ) {
|
(m_dwLastError != ERROR_FILE_NOT_FOUND) ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't delete value '%s' from key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't delete value '%s' from key '%s'"),
|
||||||
szValue, GetName().c_str());
|
szValue, GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// access to values and subkeys
|
// access to values and subkeys
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// return TRUE if value exists
|
// return true if value exists
|
||||||
bool wxRegKey::HasValue(const wxChar *szValue) const
|
bool wxRegKey::HasValue(const wxChar *szValue) const
|
||||||
{
|
{
|
||||||
// this function should be silent, so suppress possible messages from Open()
|
// this function should be silent, so suppress possible messages from Open()
|
||||||
wxLogNull nolog;
|
wxLogNull nolog;
|
||||||
|
|
||||||
if ( !CONST_CAST Open(Read) )
|
if ( !CONST_CAST Open(Read) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
|
LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
|
||||||
WXSTRINGCAST szValue,
|
WXSTRINGCAST szValue,
|
||||||
@@ -744,7 +744,7 @@ bool wxRegKey::HasValue(const wxChar *szValue) const
|
|||||||
return dwRet == ERROR_SUCCESS;
|
return dwRet == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns TRUE if this key has any values
|
// returns true if this key has any values
|
||||||
bool wxRegKey::HasValues() const
|
bool wxRegKey::HasValues() const
|
||||||
{
|
{
|
||||||
// suppress possible messages from GetFirstValue()
|
// suppress possible messages from GetFirstValue()
|
||||||
@@ -756,7 +756,7 @@ bool wxRegKey::HasValues() const
|
|||||||
return CONST_CAST GetFirstValue(str, l);
|
return CONST_CAST GetFirstValue(str, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns TRUE if this key has any subkeys
|
// returns true if this key has any subkeys
|
||||||
bool wxRegKey::HasSubkeys() const
|
bool wxRegKey::HasSubkeys() const
|
||||||
{
|
{
|
||||||
// suppress possible messages from GetFirstKey()
|
// suppress possible messages from GetFirstKey()
|
||||||
@@ -768,14 +768,14 @@ bool wxRegKey::HasSubkeys() const
|
|||||||
return CONST_CAST GetFirstKey(str, l);
|
return CONST_CAST GetFirstKey(str, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns TRUE if given subkey exists
|
// returns true if given subkey exists
|
||||||
bool wxRegKey::HasSubKey(const wxChar *szKey) const
|
bool wxRegKey::HasSubKey(const wxChar *szKey) const
|
||||||
{
|
{
|
||||||
// this function should be silent, so suppress possible messages from Open()
|
// this function should be silent, so suppress possible messages from Open()
|
||||||
wxLogNull nolog;
|
wxLogNull nolog;
|
||||||
|
|
||||||
if ( !CONST_CAST Open(Read) )
|
if ( !CONST_CAST Open(Read) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return KeyExists(m_hKey, szKey);
|
return KeyExists(m_hKey, szKey);
|
||||||
}
|
}
|
||||||
@@ -804,12 +804,12 @@ bool wxRegKey::SetValue(const wxChar *szValue, long lValue)
|
|||||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD,
|
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD,
|
||||||
(RegString)&lValue, sizeof(lValue));
|
(RegString)&lValue, sizeof(lValue));
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const
|
bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const
|
||||||
@@ -822,36 +822,36 @@ bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// check that we read the value of right type
|
// check that we read the value of right type
|
||||||
wxASSERT_MSG( IsNumericValue(szValue),
|
wxASSERT_MSG( IsNumericValue(szValue),
|
||||||
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::SetValue(const wxChar *szValue,const wxMemoryBuffer& buffer)
|
bool wxRegKey::SetValue(const wxChar *szValue,const wxMemoryBuffer& buffer)
|
||||||
{
|
{
|
||||||
#ifdef __TWIN32__
|
#ifdef __TWIN32__
|
||||||
wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
|
wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
|
||||||
return FALSE;
|
return false;
|
||||||
#else
|
#else
|
||||||
if ( CONST_CAST Open() ) {
|
if ( CONST_CAST Open() ) {
|
||||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_BINARY,
|
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_BINARY,
|
||||||
(RegBinary)buffer.GetData(),buffer.GetDataLen());
|
(RegBinary)buffer.GetData(),buffer.GetDataLen());
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return FALSE;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,11 +882,11 @@ bool wxRegKey::QueryValue(const wxChar *szValue, wxMemoryBuffer& buffer) const
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -951,14 +951,14 @@ bool wxRegKey::QueryValue(const wxChar *szValue,
|
|||||||
wxASSERT_MSG( !IsNumericValue(szValue),
|
wxASSERT_MSG( !IsNumericValue(szValue),
|
||||||
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, _("Can't read value of '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't read value of '%s'"),
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue)
|
bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue)
|
||||||
@@ -968,12 +968,12 @@ bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue)
|
|||||||
(RegString)strValue.c_str(),
|
(RegString)strValue.c_str(),
|
||||||
(strValue.Len() + 1)*sizeof(wxChar));
|
(strValue.Len() + 1)*sizeof(wxChar));
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxRegKey::QueryDefaultValue() const
|
wxString wxRegKey::QueryDefaultValue() const
|
||||||
@@ -992,7 +992,7 @@ wxString wxRegKey::QueryDefaultValue() const
|
|||||||
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
|
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
|
||||||
{
|
{
|
||||||
if ( !Open(Read) )
|
if ( !Open(Read) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextValue(strValueName, lIndex);
|
return GetNextValue(strValueName, lIndex);
|
||||||
@@ -1004,7 +1004,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
|
|
||||||
// are we already at the end of enumeration?
|
// are we already at the end of enumeration?
|
||||||
if ( lIndex == -1 )
|
if ( lIndex == -1 )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
|
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
|
||||||
DWORD dwValueLen = WXSIZEOF(szValueName);
|
DWORD dwValueLen = WXSIZEOF(szValueName);
|
||||||
@@ -1026,18 +1026,18 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strValueName = szValueName;
|
strValueName = szValueName;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
|
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
|
||||||
{
|
{
|
||||||
if ( !Open(Read) )
|
if ( !Open(Read) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextKey(strKeyName, lIndex);
|
return GetNextKey(strKeyName, lIndex);
|
||||||
@@ -1049,7 +1049,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
|||||||
|
|
||||||
// are we already at the end of enumeration?
|
// are we already at the end of enumeration?
|
||||||
if ( lIndex == -1 )
|
if ( lIndex == -1 )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxChar szKeyName[_MAX_PATH + 1];
|
wxChar szKeyName[_MAX_PATH + 1];
|
||||||
|
|
||||||
@@ -1071,14 +1071,14 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
|||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strKeyName = szKeyName;
|
strKeyName = szKeyName;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns TRUE if the value contains a number (else it's some string)
|
// returns true if the value contains a number (else it's some string)
|
||||||
bool wxRegKey::IsNumericValue(const wxChar *szValue) const
|
bool wxRegKey::IsNumericValue(const wxChar *szValue) const
|
||||||
{
|
{
|
||||||
ValueType type = GetValueType(szValue);
|
ValueType type = GetValueType(szValue);
|
||||||
@@ -1086,10 +1086,10 @@ bool wxRegKey::IsNumericValue(const wxChar *szValue) const
|
|||||||
case Type_Dword:
|
case Type_Dword:
|
||||||
/* case Type_Dword_little_endian: == Type_Dword */
|
/* case Type_Dword_little_endian: == Type_Dword */
|
||||||
case Type_Dword_big_endian:
|
case Type_Dword_big_endian:
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1101,7 +1101,7 @@ bool KeyExists(WXHKEY hRootKey, const wxChar *szKey)
|
|||||||
{
|
{
|
||||||
// don't close this key itself for the case of empty szKey!
|
// don't close this key itself for the case of empty szKey!
|
||||||
if ( wxIsEmpty(szKey) )
|
if ( wxIsEmpty(szKey) )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
HKEY hkeyDummy;
|
HKEY hkeyDummy;
|
||||||
if ( ::RegOpenKeyEx
|
if ( ::RegOpenKeyEx
|
||||||
@@ -1115,10 +1115,10 @@ bool KeyExists(WXHKEY hRootKey, const wxChar *szKey)
|
|||||||
{
|
{
|
||||||
::RegCloseKey(hkeyDummy);
|
::RegCloseKey(hkeyDummy);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
|
const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
|
||||||
|
Reference in New Issue
Block a user