+ wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY));
+ pixelY = pt.y;
+ }
+ }
+
+ if (y != pixelY)
+ {
+ m_propertyWindow->Move(x, pixelY);
+ resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight());
+ }
+ return TRUE;
+ }
+ else if (name == "width")
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ int width, height;
+ m_propertyWindow->GetSize(&width, &height);
+ int newWidth = (int)property->GetValue().IntegerValue();
+ int pixelWidth = newWidth;
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height));
+ pixelWidth = sz.x;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height));
+ pixelWidth = sz.x;
+ }
+ }
+
+ if (width != pixelWidth)
+ {
+ m_propertyWindow->SetSize(pixelWidth, height);
+ resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight());
+ }
+ return TRUE;
+ }
+ else if (name == "height")
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ int width, height;
+ m_propertyWindow->GetSize(&width, &height);
+ int newHeight = (int)property->GetValue().IntegerValue();
+ int pixelHeight = newHeight;
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight));
+ pixelHeight = sz.y;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight));
+ pixelHeight = sz.y;
+ }
+ }
+
+ if (height != pixelHeight)
+ {
+ m_propertyWindow->SetSize(width, pixelHeight);
+ resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight);
+ }
+ return TRUE;
+ }
+ else if (name == "id")
+ {
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource)
+ {
+ wxString value = property->GetValue().StringValue();
+
+ wxString strName = value.Before('=');
+ wxString strId = value.After('=');
+ int id = atoi(strId);
+
+ wxString oldSymbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(resource->GetId());
+ int oldSymbolId = resource->GetId();
+
+ if (strName != "")
+ {
+ // If we change the id for an existing symbol, we need to:
+ // 1) Check if there are any other resources currently using the original id.
+ // If so, will need to change their id to the new id.
+ // 2) Remove the old symbol, add the new symbol.
+ // In this check, we don't have to do this, but we need to do it in SetProperty.
+
+ if (strName == oldSymbolName && id != oldSymbolId)