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 wxString GetString(int n) const;
|
||||
virtual void SetString(int n, const wxString& label);
|
||||
virtual void Enable(int n, bool enable = TRUE);
|
||||
virtual void Show(int n, bool show = TRUE);
|
||||
virtual void Enable(int n, bool enable = true);
|
||||
virtual void Show(int n, bool show = true);
|
||||
virtual int GetColumnCount() const;
|
||||
virtual int GetRowCount() const;
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
virtual bool Show(bool show = true);
|
||||
void SetFocus();
|
||||
virtual bool Enable(bool enable = TRUE);
|
||||
virtual bool Enable(bool enable = true);
|
||||
void SetLabelFont(const wxFont& WXUNUSED(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
|
||||
// it's subgroups
|
||||
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
|
||||
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
|
||||
virtual size_t GetNumberOfEntries(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
|
||||
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
||||
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
||||
|
||||
// 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 DeleteAll();
|
||||
|
||||
|
@@ -121,7 +121,7 @@ public:
|
||||
|
||||
// get infomation about the key
|
||||
// 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
|
||||
bool Exists() const;
|
||||
// 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)
|
||||
bool Open(AccessMode mode = Write);
|
||||
// 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
|
||||
bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew);
|
||||
// rename the key
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
// access to values and subkeys
|
||||
// get value type
|
||||
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;
|
||||
|
||||
// assignment operators set the default value of the key
|
||||
@@ -185,10 +185,10 @@ public:
|
||||
bool SetValue(const wxChar *szValue, const wxString& strValue);
|
||||
// retrieve the string value
|
||||
bool QueryValue(const wxChar *szValue, wxString& strValue) const
|
||||
{ return QueryValue(szValue, strValue, FALSE); }
|
||||
{ return QueryValue(szValue, strValue, false); }
|
||||
// retrieve raw string value
|
||||
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
|
||||
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 (id == GetId())
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
int selectedButton = -1;
|
||||
int selectedButton = wxID_ANY;
|
||||
|
||||
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
|
||||
// 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
|
||||
// rid of this...)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Radio box item
|
||||
wxRadioBox::wxRadioBox()
|
||||
{
|
||||
m_selectedButton = -1;
|
||||
m_selectedButton = wxID_ANY;
|
||||
m_noItems = 0;
|
||||
m_noRowsOrCols = 0;
|
||||
m_radioButtons = NULL;
|
||||
@@ -264,7 +264,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
const wxString& name)
|
||||
{
|
||||
// initialize members
|
||||
m_selectedButton = -1;
|
||||
m_selectedButton = wxID_ANY;
|
||||
m_noItems = 0;
|
||||
|
||||
m_majorDim = majorDim == 0 ? n : majorDim;
|
||||
@@ -272,12 +272,12 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
|
||||
// common initialization
|
||||
if ( !CreateControl(parent, id, pos, size, style, val, name) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// create the static box
|
||||
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
|
||||
pos, size, title, 0) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// and now create the buttons
|
||||
m_noItems = n;
|
||||
@@ -303,7 +303,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
for ( int i = 0; i < n; i++ )
|
||||
{
|
||||
m_radioWidth[i] =
|
||||
m_radioHeight[i] = -1;
|
||||
m_radioHeight[i] = wxDefaultCoord;
|
||||
long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
|
||||
if ( i == 0 && style == 0 )
|
||||
styleBtn |= WS_GROUP;
|
||||
@@ -323,7 +323,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
{
|
||||
wxLogLastError(wxT("CreateWindow(radio btn)"));
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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.
|
||||
SetBestSize(size);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRadioBox::Create(wxWindow *parent,
|
||||
@@ -377,7 +377,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
|
||||
wxRadioBox::~wxRadioBox()
|
||||
{
|
||||
m_isBeingDeleted = TRUE;
|
||||
m_isBeingDeleted = true;
|
||||
|
||||
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") );
|
||||
|
||||
m_radioWidth[item] = m_radioHeight[item] = -1;
|
||||
m_radioWidth[item] = m_radioHeight[item] = wxDefaultCoord;
|
||||
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 yy = y;
|
||||
|
||||
if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
if (x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
xx = currentX;
|
||||
if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
if (y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
yy = currentY;
|
||||
|
||||
#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;
|
||||
|
||||
// only change our width/height if asked for
|
||||
if ( width == -1 )
|
||||
if ( width == wxDefaultCoord )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||
width = totWidth;
|
||||
@@ -551,7 +551,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
width = widthOld;
|
||||
}
|
||||
|
||||
if ( height == -1 )
|
||||
if ( height == wxDefaultCoord )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||
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
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
||||
RECT rect = { -1, -1, -1, -1 };
|
||||
|
||||
if (m_hWnd)
|
||||
wxFindMaxSize(m_hWnd, &rect);
|
||||
@@ -712,7 +711,7 @@ void wxRadioBox::SetFocus()
|
||||
{
|
||||
if (m_noItems > 0)
|
||||
{
|
||||
::SetFocus((HWND)m_radioButtons[m_selectedButton == -1
|
||||
::SetFocus((HWND)m_radioButtons[m_selectedButton == wxID_ANY
|
||||
? 0
|
||||
: m_selectedButton]);
|
||||
}
|
||||
@@ -722,7 +721,7 @@ void wxRadioBox::SetFocus()
|
||||
bool wxRadioBox::Show(bool show)
|
||||
{
|
||||
if ( !wxControl::Show(show) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
int nCmdShow = show ? SW_SHOW : SW_HIDE;
|
||||
for ( int i = 0; i < m_noItems; i++ )
|
||||
@@ -730,7 +729,7 @@ bool wxRadioBox::Show(bool show)
|
||||
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Enable a specific button
|
||||
@@ -746,12 +745,12 @@ void wxRadioBox::Enable(int item, bool enable)
|
||||
bool wxRadioBox::Enable(bool enable)
|
||||
{
|
||||
if ( !wxControl::Enable(enable) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < m_noItems; i++)
|
||||
::EnableWindow((HWND) m_radioButtons[i], enable);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Show a specific button
|
||||
@@ -769,10 +768,10 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
|
||||
for ( size_t i = 0; i < count; i++ )
|
||||
{
|
||||
if ( GetRadioButtons()[i] == hWnd )
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxRadioBox::Command(wxCommandEvent & event)
|
||||
@@ -809,7 +808,7 @@ bool wxRadioBox::SetFont(const wxFont& font)
|
||||
if ( !wxControl::SetFont(font) )
|
||||
{
|
||||
// nothing to do
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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 */);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -963,7 +962,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
||||
|
||||
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
|
||||
|
||||
bool processed = TRUE;
|
||||
bool processed = true;
|
||||
|
||||
wxDirection dir;
|
||||
switch ( wParam )
|
||||
@@ -985,7 +984,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
||||
break;
|
||||
|
||||
default:
|
||||
processed = FALSE;
|
||||
processed = false;
|
||||
|
||||
// just to suppress the compiler warning
|
||||
dir = wxALL;
|
||||
@@ -1050,7 +1049,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
||||
#endif
|
||||
{
|
||||
wxWindow* subjectOfHelp = radiobox;
|
||||
bool eventProcessed = FALSE;
|
||||
bool eventProcessed = false;
|
||||
while (subjectOfHelp && !eventProcessed)
|
||||
{
|
||||
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(),
|
||||
|
@@ -423,7 +423,7 @@ bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const
|
||||
while ( m_keyGlobal.GetNextKey(str, lIndex) ) {
|
||||
if ( !m_keyLocal.Exists() || !LocalKey().HasSubKey(str) ) {
|
||||
// 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 ( !m_keyLocal.Exists() )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// much easier with local entries: get the next one we find
|
||||
// (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) ) {
|
||||
if ( !m_keyLocal.Exists() || !LocalKey().HasValue(str) ) {
|
||||
// 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 ( !m_keyLocal.Exists() )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// much easier with local entries: get the next one we find
|
||||
// (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
|
||||
{
|
||||
wxCHECK_MSG( pStr, FALSE, _T("wxRegConfig::Read(): NULL param") );
|
||||
wxCHECK_MSG( pStr, false, _T("wxRegConfig::Read(): NULL param") );
|
||||
|
||||
wxConfigPathChanger path(this, key);
|
||||
|
||||
bool bQueryGlobal = TRUE;
|
||||
bool bQueryGlobal = true;
|
||||
|
||||
// if immutable key exists in global key we must check that it's not
|
||||
// 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());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// don't waste time - it's not there anyhow
|
||||
bQueryGlobal = FALSE;
|
||||
bQueryGlobal = false;
|
||||
}
|
||||
}
|
||||
|
||||
// first try local key
|
||||
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), 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(),
|
||||
@@ -597,11 +597,11 @@ bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) 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);
|
||||
|
||||
bool bQueryGlobal = TRUE;
|
||||
bool bQueryGlobal = true;
|
||||
|
||||
// if immutable key exists in global key we must check that it's not
|
||||
// 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());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// don't waste time - it's not there anyhow
|
||||
bQueryGlobal = FALSE;
|
||||
bQueryGlobal = false;
|
||||
}
|
||||
}
|
||||
|
||||
// first try local key
|
||||
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), 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)
|
||||
@@ -635,7 +635,7 @@ bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
||||
|
||||
if ( IsImmutable(path.Name()) ) {
|
||||
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return LocalKey().SetValue(path.Name(), szValue);
|
||||
@@ -647,7 +647,7 @@ bool wxRegConfig::DoWriteLong(const wxString& key, long lValue)
|
||||
|
||||
if ( IsImmutable(path.Name()) ) {
|
||||
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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...
|
||||
if ( !HasEntry(oldName) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// and that the new one doesn't
|
||||
if ( HasEntry(newName) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
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...
|
||||
if ( !HasGroup(oldName) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// and that the new one doesn't
|
||||
if ( HasGroup(newName) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
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.DeleteValue(path.Name()) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) {
|
||||
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)
|
||||
{
|
||||
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()
|
||||
|
@@ -166,12 +166,12 @@ void wxRegion::Clear()
|
||||
|
||||
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 )
|
||||
{
|
||||
// nothing to do
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
AllocExclusive();
|
||||
@@ -180,10 +180,10 @@ bool wxRegion::Offset(wxCoord x, wxCoord y)
|
||||
{
|
||||
wxLogLastError(_T("OffsetRgn"));
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// combine another region with this one
|
||||
@@ -209,7 +209,7 @@ bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op)
|
||||
case wxRGN_AND:
|
||||
case wxRGN_DIFF:
|
||||
// leave empty/invalid
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else // we have a valid region
|
||||
@@ -248,11 +248,11 @@ bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op)
|
||||
{
|
||||
wxLogLastError(_T("CombineRgn"));
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Combine rectangle (x, y, w, h) with this.
|
||||
|
@@ -112,7 +112,7 @@ aStdKeys[] =
|
||||
// removes the trailing backslash from the string if it has one
|
||||
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);
|
||||
|
||||
// combines value and key name (uses static buffer!)
|
||||
@@ -296,11 +296,11 @@ void wxRegKey::SetHkey(WXHKEY hKey)
|
||||
// info about the key
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// returns TRUE if the key exists
|
||||
// returns true if the key exists
|
||||
bool wxRegKey::Exists() const
|
||||
{
|
||||
// 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)
|
||||
@@ -355,10 +355,10 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
|
||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't get info about registry key '%s'"),
|
||||
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)
|
||||
{
|
||||
if ( IsOpened() )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
HKEY tmpKey;
|
||||
m_dwLastError = ::RegOpenKeyEx
|
||||
@@ -385,11 +385,11 @@ bool wxRegKey::Open(AccessMode mode)
|
||||
{
|
||||
wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
|
||||
GetName().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hKey = (WXHKEY) tmpKey;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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!)
|
||||
if ( !bOkIfExists && Exists() )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if ( IsOpened() )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
HKEY tmpKey;
|
||||
#ifdef __WXWINCE__
|
||||
@@ -419,12 +419,12 @@ bool wxRegKey::Create(bool bOkIfExists)
|
||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
|
||||
GetName().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hKey = (WXHKEY) tmpKey;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,20 +439,20 @@ bool wxRegKey::Close()
|
||||
wxLogSysError(m_dwLastError, _("Can't close registry key '%s'"),
|
||||
GetName().c_str());
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
if ( HasValue(szValueNew) ) {
|
||||
wxLogError(_("Registry value '%s' already exists."), szValueNew);
|
||||
|
||||
ok = FALSE;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if ( !ok ||
|
||||
@@ -461,10 +461,10 @@ bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
|
||||
wxLogError(_("Failed to rename registry value '%s' to '%s'."),
|
||||
szValueOld, szValueNew);
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRegKey::CopyValue(const wxChar *szValue,
|
||||
@@ -515,19 +515,19 @@ bool wxRegKey::CopyValue(const wxChar *szValue,
|
||||
default:
|
||||
wxLogError(_("Can't copy values of unsupported type %d."),
|
||||
GetValueType(szValue));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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() ) {
|
||||
wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
|
||||
GetFullName(this));
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// do we stay in the same hive?
|
||||
@@ -539,7 +539,7 @@ bool wxRegKey::Rename(const wxChar *szNewName)
|
||||
if ( inSameHive ) {
|
||||
// rename the key to the new name under the same parent
|
||||
wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
|
||||
if ( !!strKey ) {
|
||||
if ( !strKey.IsEmpty() ) {
|
||||
// don't add '\\' in the start if strFullNewName is empty
|
||||
strKey += REG_SEPARATOR;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ bool wxRegKey::Rename(const wxChar *szNewName)
|
||||
keyDst.SetName(szNewName);
|
||||
}
|
||||
|
||||
bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
|
||||
bool ok = keyDst.Create(false /* fail if alredy exists */);
|
||||
if ( !ok ) {
|
||||
wxLogError(_("Registry key '%s' already exists."),
|
||||
GetFullName(&keyDst));
|
||||
@@ -578,7 +578,7 @@ bool wxRegKey::Copy(const wxChar *szNewName)
|
||||
{
|
||||
// create the new key first
|
||||
wxRegKey keyDst(szNewName);
|
||||
bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
|
||||
bool ok = keyDst.Create(false /* fail if alredy exists */);
|
||||
if ( ok ) {
|
||||
ok = Copy(keyDst);
|
||||
|
||||
@@ -593,7 +593,7 @@ bool wxRegKey::Copy(const wxChar *szNewName)
|
||||
|
||||
bool wxRegKey::Copy(wxRegKey& keyDst)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
|
||||
// copy all sub keys to the new location
|
||||
wxString strKey;
|
||||
@@ -646,7 +646,7 @@ bool wxRegKey::DeleteSelf()
|
||||
wxLogNull nolog;
|
||||
if ( !Open() ) {
|
||||
// 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."),
|
||||
GetFullName(this));
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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++ ) {
|
||||
wxRegKey key(*this, astrSubkeys[nKey]);
|
||||
if ( !key.DeleteSelf() )
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// now delete this key itself
|
||||
@@ -691,16 +691,16 @@ bool wxRegKey::DeleteSelf()
|
||||
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't delete key '%s'"),
|
||||
GetName().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRegKey::DeleteKey(const wxChar *szKey)
|
||||
{
|
||||
if ( !Open() )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
wxRegKey key(*this, szKey);
|
||||
return key.DeleteSelf();
|
||||
@@ -709,7 +709,7 @@ bool wxRegKey::DeleteKey(const wxChar *szKey)
|
||||
bool wxRegKey::DeleteValue(const wxChar *szValue)
|
||||
{
|
||||
if ( !Open() )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue);
|
||||
|
||||
@@ -718,24 +718,24 @@ bool wxRegKey::DeleteValue(const wxChar *szValue)
|
||||
(m_dwLastError != ERROR_FILE_NOT_FOUND) ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't delete value '%s' from key '%s'"),
|
||||
szValue, GetName().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// access to values and subkeys
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// return TRUE if value exists
|
||||
// return true if value exists
|
||||
bool wxRegKey::HasValue(const wxChar *szValue) const
|
||||
{
|
||||
// this function should be silent, so suppress possible messages from Open()
|
||||
wxLogNull nolog;
|
||||
|
||||
if ( !CONST_CAST Open(Read) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
|
||||
WXSTRINGCAST szValue,
|
||||
@@ -744,7 +744,7 @@ bool wxRegKey::HasValue(const wxChar *szValue) const
|
||||
return dwRet == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// returns TRUE if this key has any values
|
||||
// returns true if this key has any values
|
||||
bool wxRegKey::HasValues() const
|
||||
{
|
||||
// suppress possible messages from GetFirstValue()
|
||||
@@ -756,7 +756,7 @@ bool wxRegKey::HasValues() const
|
||||
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
|
||||
{
|
||||
// suppress possible messages from GetFirstKey()
|
||||
@@ -768,14 +768,14 @@ bool wxRegKey::HasSubkeys() const
|
||||
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
|
||||
{
|
||||
// this function should be silent, so suppress possible messages from Open()
|
||||
wxLogNull nolog;
|
||||
|
||||
if ( !CONST_CAST Open(Read) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
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,
|
||||
(RegString)&lValue, sizeof(lValue));
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||
GetFullName(this, szValue));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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 ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||
GetName().c_str());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// check that we read the value of right type
|
||||
wxASSERT_MSG( IsNumericValue(szValue),
|
||||
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxRegKey::SetValue(const wxChar *szValue,const wxMemoryBuffer& buffer)
|
||||
{
|
||||
#ifdef __TWIN32__
|
||||
wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
|
||||
return FALSE;
|
||||
return false;
|
||||
#else
|
||||
if ( CONST_CAST Open() ) {
|
||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_BINARY,
|
||||
(RegBinary)buffer.GetData(),buffer.GetDataLen());
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||
GetFullName(this, szValue));
|
||||
return FALSE;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -882,11 +882,11 @@ bool wxRegKey::QueryValue(const wxChar *szValue, wxMemoryBuffer& buffer) const
|
||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||
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),
|
||||
wxT("Type mismatch in wxRegKey::QueryValue().") );
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxLogSysError(m_dwLastError, _("Can't read value of '%s'"),
|
||||
GetFullName(this, szValue));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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(),
|
||||
(strValue.Len() + 1)*sizeof(wxChar));
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
|
||||
GetFullName(this, szValue));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
wxString wxRegKey::QueryDefaultValue() const
|
||||
@@ -992,7 +992,7 @@ wxString wxRegKey::QueryDefaultValue() const
|
||||
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
|
||||
{
|
||||
if ( !Open(Read) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
lIndex = 0;
|
||||
return GetNextValue(strValueName, lIndex);
|
||||
@@ -1004,7 +1004,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
||||
|
||||
// are we already at the end of enumeration?
|
||||
if ( lIndex == -1 )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
|
||||
DWORD dwValueLen = WXSIZEOF(szValueName);
|
||||
@@ -1026,18 +1026,18 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
||||
GetName().c_str());
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
strValueName = szValueName;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
|
||||
{
|
||||
if ( !Open(Read) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
lIndex = 0;
|
||||
return GetNextKey(strKeyName, lIndex);
|
||||
@@ -1049,7 +1049,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
||||
|
||||
// are we already at the end of enumeration?
|
||||
if ( lIndex == -1 )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
wxChar szKeyName[_MAX_PATH + 1];
|
||||
|
||||
@@ -1071,14 +1071,14 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
||||
GetName().c_str());
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
ValueType type = GetValueType(szValue);
|
||||
@@ -1086,10 +1086,10 @@ bool wxRegKey::IsNumericValue(const wxChar *szValue) const
|
||||
case Type_Dword:
|
||||
/* case Type_Dword_little_endian: == Type_Dword */
|
||||
case Type_Dword_big_endian:
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
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!
|
||||
if ( wxIsEmpty(szKey) )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
HKEY hkeyDummy;
|
||||
if ( ::RegOpenKeyEx
|
||||
@@ -1115,10 +1115,10 @@ bool KeyExists(WXHKEY hRootKey, const wxChar *szKey)
|
||||
{
|
||||
::RegCloseKey(hkeyDummy);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
|
||||
|
Reference in New Issue
Block a user