1. serious bug in wxRegConfig corrected - deleting a value would delete the
key containing it if it didn't have any subkeys (i.e. would delete the sibling values) 2. wxRegKey::GetFirstValue() starts with first value, not the second one 3. typo in wxStaticText::DoSetSize() which prevented width.AsIs() from working fixed 4. adjustment for the parent client area offset not done for the top level windows (dialogs and frames) any more git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -192,6 +192,10 @@ public:
|
|||||||
bool HasSubKey(const wxChar *szKey) const;
|
bool HasSubKey(const wxChar *szKey) const;
|
||||||
// return true if any subkeys exist
|
// return true if any subkeys exist
|
||||||
bool HasSubkeys() const;
|
bool HasSubkeys() const;
|
||||||
|
// return true if any values exist
|
||||||
|
bool HasValues() const;
|
||||||
|
// return true if the key is empty (nothing under this key)
|
||||||
|
bool IsEmpty() const { return !HasSubkeys() && !HasValues(); }
|
||||||
|
|
||||||
// enumerate values and subkeys
|
// enumerate values and subkeys
|
||||||
bool GetFirstValue(wxString& strValueName, long& lIndex);
|
bool GetFirstValue(wxString& strValueName, long& lIndex);
|
||||||
|
@@ -531,7 +531,7 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
|
|||||||
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( !m_keyLocal.HasSubkeys() ) {
|
if ( m_keyLocal.IsEmpty() ) {
|
||||||
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
|
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
|
||||||
SetPath(".."); // changes m_keyLocal
|
SetPath(".."); // changes m_keyLocal
|
||||||
return m_keyLocal.DeleteKey(strKey);
|
return m_keyLocal.DeleteKey(strKey);
|
||||||
|
@@ -532,6 +532,18 @@ bool wxRegKey::HasValue(const wxChar *szValue) const
|
|||||||
#endif // WIN16/32
|
#endif // WIN16/32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns TRUE if this key has any values
|
||||||
|
bool wxRegKey::HasValues() const
|
||||||
|
{
|
||||||
|
// suppress possible messages from GetFirstValue()
|
||||||
|
wxLogNull nolog;
|
||||||
|
|
||||||
|
// just call GetFirstValue with dummy parameters
|
||||||
|
wxString str;
|
||||||
|
long 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
|
||||||
{
|
{
|
||||||
@@ -718,8 +730,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
|
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
|
||||||
DWORD dwValueLen = WXSIZEOF(szValueName);
|
DWORD dwValueLen = WXSIZEOF(szValueName);
|
||||||
|
|
||||||
lIndex++;
|
m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex++,
|
||||||
m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex,
|
|
||||||
szValueName, &dwValueLen,
|
szValueName, &dwValueLen,
|
||||||
RESERVED,
|
RESERVED,
|
||||||
NULL, // [out] type
|
NULL, // [out] type
|
||||||
|
@@ -121,7 +121,7 @@ void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
for ( const char *pc = text; ; pc++ ) {
|
for ( const char *pc = text; ; pc++ ) {
|
||||||
if ( *pc == '\n' || *pc == '\0' ) {
|
if ( *pc == '\n' || *pc == '\0' ) {
|
||||||
GetTextExtent(curLine, &widthLine, &heightLine);
|
GetTextExtent(curLine, &widthLine, &heightLine);
|
||||||
if ( width > widthTextMax )
|
if ( widthLine > widthTextMax )
|
||||||
widthTextMax = widthLine;
|
widthTextMax = widthLine;
|
||||||
heightTextTotal += heightLine;
|
heightTextTotal += heightLine;
|
||||||
|
|
||||||
|
@@ -1082,18 +1082,25 @@ void wxWindow::DoGetSize(int *x, int *y) const
|
|||||||
void wxWindow::DoGetPosition(int *x, int *y) const
|
void wxWindow::DoGetPosition(int *x, int *y) const
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
HWND hParentWnd = 0;
|
|
||||||
if ( GetParent() )
|
|
||||||
hParentWnd = (HWND) GetParent()->GetHWND();
|
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect(hWnd, &rect);
|
GetWindowRect(hWnd, &rect);
|
||||||
|
|
||||||
// Since we now have the absolute screen coords, if there's a parent we
|
|
||||||
// must subtract its top left corner
|
|
||||||
POINT point;
|
POINT point;
|
||||||
point.x = rect.left;
|
point.x = rect.left;
|
||||||
point.y = rect.top;
|
point.y = rect.top;
|
||||||
|
|
||||||
|
// we do the adjustments with respect to the parent only for the "real"
|
||||||
|
// children, not for the dialogs/frames
|
||||||
|
if ( !IsTopLevel() )
|
||||||
|
{
|
||||||
|
HWND hParentWnd = 0;
|
||||||
|
wxWindow *parent = GetParent();
|
||||||
|
if ( parent )
|
||||||
|
hParentWnd = GetWinHwnd(parent);
|
||||||
|
|
||||||
|
// Since we now have the absolute screen coords, if there's a parent we
|
||||||
|
// must subtract its top left corner
|
||||||
if ( hParentWnd )
|
if ( hParentWnd )
|
||||||
{
|
{
|
||||||
::ScreenToClient(hParentWnd, &point);
|
::ScreenToClient(hParentWnd, &point);
|
||||||
@@ -1101,12 +1108,13 @@ void wxWindow::DoGetPosition(int *x, int *y) const
|
|||||||
|
|
||||||
// We may be faking the client origin. So a window that's really at (0,
|
// We may be faking the client origin. So a window that's really at (0,
|
||||||
// 30) may appear (to wxWin apps) to be at (0, 0).
|
// 30) may appear (to wxWin apps) to be at (0, 0).
|
||||||
if ( GetParent() )
|
if ( parent )
|
||||||
{
|
{
|
||||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
wxPoint pt(parent->GetClientAreaOrigin());
|
||||||
point.x -= pt.x;
|
point.x -= pt.x;
|
||||||
point.y -= pt.y;
|
point.y -= pt.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( x )
|
if ( x )
|
||||||
*x = point.x;
|
*x = point.x;
|
||||||
@@ -1240,11 +1248,17 @@ wxPoint wxWindow::GetClientAreaOrigin() const
|
|||||||
// a toolbar that it manages itself).
|
// a toolbar that it manages itself).
|
||||||
void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
|
void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
|
||||||
{
|
{
|
||||||
if ( ((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent() )
|
// don't do it for the dialogs/frames - they float independently of their
|
||||||
|
// parent
|
||||||
|
if ( !IsTopLevel() )
|
||||||
{
|
{
|
||||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
wxWindow *parent = GetParent();
|
||||||
|
if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent )
|
||||||
|
{
|
||||||
|
wxPoint pt(parent->GetClientAreaOrigin());
|
||||||
x += pt.x; y += pt.y;
|
x += pt.x; y += pt.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user