Cured Dialog Editor position/size setting problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-01-10 20:29:17 +00:00
parent c06a465c52
commit 7978fe62dd

View File

@@ -389,9 +389,11 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
else if (name == "x") else if (name == "x")
{ {
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
int x, y; int x, y;
m_propertyWindow->GetPosition(&x, &y); m_propertyWindow->GetPosition(&x, &y);
int newX = (int)property->GetValue().IntegerValue(); int newX = (int)property->GetValue().IntegerValue();
int pixelX = newX;
// We need to convert to pixels if this is not a dialog or panel, but // We need to convert to pixels if this is not a dialog or panel, but
// the parent resource specifies dialog units. // the parent resource specifies dialog units.
@@ -401,7 +403,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y)); wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y));
newX = pt.x; pixelX = pt.x;
} }
} }
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
@@ -410,19 +412,24 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y)); wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y));
newX = pt.x; pixelX = pt.x;
} }
} }
if (x != newX) if (x != newX)
m_propertyWindow->Move(newX, y); {
m_propertyWindow->Move(pixelX, y);
resource->SetSize(newX, resource->GetY(), resource->GetWidth(), resource->GetHeight());
}
return TRUE; return TRUE;
} }
else if (name == "y") else if (name == "y")
{ {
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
int x, y; int x, y;
m_propertyWindow->GetPosition(&x, &y); m_propertyWindow->GetPosition(&x, &y);
int newY = (int)property->GetValue().IntegerValue(); int newY = (int)property->GetValue().IntegerValue();
int pixelY = newY;
// We need to convert to pixels if this is not a dialog or panel, but // We need to convert to pixels if this is not a dialog or panel, but
// the parent resource specifies dialog units. // the parent resource specifies dialog units.
@@ -432,7 +439,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY)); wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY));
newY = pt.y; pixelY = pt.y;
} }
} }
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
@@ -441,19 +448,24 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY)); wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY));
newY = pt.y; pixelY = pt.y;
} }
} }
if (y != newY) if (y != newY)
m_propertyWindow->Move(x, newY); {
m_propertyWindow->Move(x, pixelY);
resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight());
}
return TRUE; return TRUE;
} }
else if (name == "width") else if (name == "width")
{ {
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
int width, height; int width, height;
m_propertyWindow->GetSize(&width, &height); m_propertyWindow->GetSize(&width, &height);
int newWidth = (int)property->GetValue().IntegerValue(); int newWidth = (int)property->GetValue().IntegerValue();
int pixelWidth = newWidth;
// We need to convert to pixels if this is not a dialog or panel, but // We need to convert to pixels if this is not a dialog or panel, but
// the parent resource specifies dialog units. // the parent resource specifies dialog units.
@@ -463,7 +475,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height)); wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height));
newWidth = sz.x; pixelWidth = sz.x;
} }
} }
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
@@ -472,21 +484,24 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height)); wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height));
newWidth = sz.x; pixelWidth = sz.x;
} }
} }
if (width != newWidth) if (width != newWidth)
{ {
m_propertyWindow->SetSize(newWidth, height); m_propertyWindow->SetSize(pixelWidth, height);
resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight());
} }
return TRUE; return TRUE;
} }
else if (name == "height") else if (name == "height")
{ {
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
int width, height; int width, height;
m_propertyWindow->GetSize(&width, &height); m_propertyWindow->GetSize(&width, &height);
int newHeight = (int)property->GetValue().IntegerValue(); int newHeight = (int)property->GetValue().IntegerValue();
int pixelHeight = newHeight;
// We need to convert to pixels if this is not a dialog or panel, but // We need to convert to pixels if this is not a dialog or panel, but
// the parent resource specifies dialog units. // the parent resource specifies dialog units.
@@ -496,7 +511,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight)); wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight));
newHeight = sz.y; pixelHeight = sz.y;
} }
} }
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
@@ -505,13 +520,14 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight)); wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight));
newHeight = sz.y; pixelHeight = sz.y;
} }
} }
if (height != newHeight) if (height != newHeight)
{ {
m_propertyWindow->SetSize(width, newHeight); m_propertyWindow->SetSize(width, newHeight);
resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight);
} }
return TRUE; return TRUE;
} }