]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/dialoged/src/winprop.cpp
old makefiles removed
[wxWidgets.git] / utils / dialoged / src / winprop.cpp
index 4f3a64b6f5752348cfe0ad5c15cd59ae8d8028e4..afebc0f554a874003b72b1fc33d9de6626012d02 100644 (file)
@@ -857,12 +857,11 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
     {
-      s = copystring(s);
-      wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
+      wxString str(s);
+      wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP);
       if (!bitmap->Ok())
       {
         delete bitmap;
-        delete[] s;
         return FALSE;
       }
       else
@@ -871,7 +870,7 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
@@ -879,7 +878,6 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         }
 
         button->SetLabel(* bitmap);
-        delete[] s;
         return TRUE;
       }
     }
@@ -956,13 +954,12 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
     {
-      s = copystring(s);
+      wxString str(s);
       
-      wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
+      wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP);
       if (!bitmap->Ok())
       {
         delete bitmap;
-        delete[] s;
         return FALSE;
       }
       else
@@ -971,7 +968,7 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
@@ -979,7 +976,6 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         }
 
         message->SetBitmap(* bitmap);
-        delete[] s;
         return TRUE;
       }
     }
@@ -1047,7 +1043,7 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else if (name == "readonly")
@@ -1066,7 +1062,7 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else
@@ -1162,7 +1158,7 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
     if (resource)
       resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
     return TRUE;
   }
   else
@@ -1326,7 +1322,7 @@ bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
     return TRUE;
   }
   else if (name == "style")
@@ -1347,7 +1343,7 @@ bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
 
     return TRUE;
   }
@@ -1422,7 +1418,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   if (name == "numberRowsOrCols")
   {
     radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "orientation")
@@ -1445,7 +1441,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox);
     resource->SetStyle(windowStyle);
     
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "values")
@@ -1467,7 +1463,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       expr = expr->GetNext();
     }
     resource->SetStringValues(stringList);
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   return wxItemPropertyInfo::SetProperty(name, property);
@@ -1673,6 +1669,7 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     
     slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this);
     slider->SetSize(-1, -1, h, w);
+    m_propertyWindow = slider;
     
     return TRUE;
   }
@@ -1838,6 +1835,7 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
        } /* IF */
 
     scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this);
+    m_propertyWindow = scrollBar;
 
     return TRUE;
   }
@@ -2035,6 +2033,7 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxColour col(r,g,b);
     panelWindow->SetBackgroundColour(col);
     panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+    m_propertyWindow = panelWindow;
    return TRUE;
   }
   else if (name == "title")
@@ -2114,6 +2113,7 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     }
     resource->SetResourceStyle(style);
     panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+    m_propertyWindow = panelWindow;
     // TODO: need to regenerate the width and height properties else they'll be inconsistent.
     return TRUE;
   }
@@ -2361,7 +2361,6 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
   {
     wxString symbolName(dialog->GetSymbol());
     long id = dialog->GetId();
-    dialog->Destroy();
 
     wxString str;
     str.Printf("%d", id);
@@ -2371,6 +2370,8 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
     view->UpdatePropertyDisplayInList(property);
     view->OnPropertyChanged(property);
   }
+  // Moved from the 'if' branch on suggestion of Roman Pavlov
+  dialog->Destroy();
 }
 
 BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog)