Patch #2794 2009-07-23 05:45

stahta01

Patch to upgrade wxSmith to work with wxPropertyGrid 1.46
Download
2794-Patch_to_upgra.patch (29.3 KB)
Category
Plugin::Refinement
Status
Accepted
Close date
2009-10-26 10:26
Assigned to
mortenmacfly
Index: src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp
===================================================================
--- src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp    (revision 5693)
+++ src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp    (working copy)
@@ -195,9 +211,18 @@
 
 void wxsChart::OnAddExtraProperties(wxsPropertyGridManager* Grid)
 {
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    Grid->SelectPage(0);
+    #else
     Grid->SetTargetPage(0);
+    #endif
 
+
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    m_ChartPointsCountId = Grid->Append(new wxIntProperty(_("Number of data sets"),wxPG_LABEL,
+    #else
     m_ChartPointsCountId = Grid->Append(wxIntProperty(_("Number of data sets"),wxPG_LABEL,
+    #endif
                                                       (int)m_ChartPointsDesc.Count()));
 
     for ( int i=0; i<(int)m_ChartPointsDesc.Count(); i++ )
@@ -210,7 +235,11 @@
 
 void wxsChart::OnExtraPropertyChanged(wxsPropertyGridManager* Grid,wxPGId Id)
 {
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    Grid->SelectPage(0);
+    #else
     Grid->SetTargetPage(0);
+    #endif
 
     if ( Id == m_ChartPointsCountId )
     {
@@ -237,7 +266,11 @@
             // We have to remove some entries
             for ( int i=NewValue; i<OldValue; i++ )
             {
+                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+                Grid->DeleteProperty(m_ChartPointsDesc[i]->Id);
+                #else
                 Grid->Delete(m_ChartPointsDesc[i]->Id);
+                #endif
                 delete m_ChartPointsDesc[i];
             }
 
@@ -344,7 +348,11 @@
     ChartPointsDesc* Desc = m_ChartPointsDesc[Position];
     wxString SetName = wxString::Format(_("Set %d"),Position+1);
 
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    Desc->Id = Grid->Append(new wxParentProperty(SetName,wxPG_LABEL));
+    #else
     Desc->Id = Grid->Append(wxParentProperty(SetName,wxPG_LABEL));
+    #endif
 
     static const wxChar* Types[] =
     {
@@ -359,9 +367,15 @@
         Bar, Bar3D, Pie, Pie3D, Points, Points3D, Line, Line3D, Area, Area3D
     };
 
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    Desc->TypeId = Grid->AppendIn(Desc->Id,new wxEnumProperty(_("Type"),wxPG_LABEL,Types,Values,Desc->Type));
+    Desc->NameId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
+    Desc->PointsCountId = Grid->AppendIn(Desc->Id,new wxIntProperty(_("Number of points"),wxPG_LABEL,(int)Desc->Points.Count()));
+    #else
     Desc->TypeId = Grid->AppendIn(Desc->Id,wxEnumProperty(_("Type"),wxPG_LABEL,Types,Values,Desc->Type));
     Desc->NameId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
     Desc->PointsCountId = Grid->AppendIn(Desc->Id,wxIntProperty(_("Number of points"),wxPG_LABEL,(int)Desc->Points.Count()));
+    #endif
 
     for ( int i=0; i<(int)Desc->Points.Count(); i++ )
     {
@@ -415,7 +458,11 @@
         {
             for ( int i=NewValue; i<OldValue; i++ )
             {
+                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+                Grid->DeleteProperty((Desc->Points[i])->Id);
+                #else
                 Grid->Delete((Desc->Points[i])->Id);
+                #endif
                 delete Desc->Points[i];
             }
 
@@ -451,10 +465,17 @@
     PointDesc* Desc = SetDesc->Points[Position];
     wxString Name = wxString::Format(_("Point %d"),Position+1);
 
+    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
+    Desc->Id = Grid->AppendIn(SetDesc->Id,new wxParentProperty(Name,wxPG_LABEL));
+    Desc->NameId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
+    Desc->XId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("X"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->X)));
+    Desc->YId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Y"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->Y)));
+    #else
     Desc->Id = Grid->AppendIn(SetDesc->Id,wxParentProperty(Name,wxPG_LABEL));
     Desc->NameId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
     Desc->XId = Grid->AppendIn(Desc->Id,wxStringProperty(_("X"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->X)));
     Desc->YId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Y"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->Y)));
+    #endif
 }
 
 bool wxsChart::HandleChangeInPoint(wxsPropertyGridManager* Grid,wxPGId Id,ChartPointsDesc* SetDesc,int Position,bool Global)
Index: src/plugins/contrib/wxSmithAui/wxAuiManager/wxsAuiPaneInfoProperty.cpp
===================================================================
--- src/plugins/contrib/wxSmithAui/wxAuiManager/wxsAuiPaneInfoProperty.cpp    (revision 5693)
+++ src/plugins/contrib/wxSmithAui/wxAuiManager/wxsAuiPaneInfoProp
download for full patch...
stahta01 2009-07-23 05:46

Note: Does NOT include patch to upgrade wxPropertyGrid

Major changes are:

Changed wxPropertyGridManager::SetTargetPage to wxPropertyGridManager::SelectPage.

Changed method Delete to wxPropertyGridInterface::DeleteProperty.

Changed wxEnumPropertyClass::DoSetValue to wxEnumProperty::SetValue

Changed method wxPGVariantCreator to wxVariant.

Added Macro NEW_IN_WXPG14X which is defines as the keyword "new" or nothing see header wxsproperty.h

Many other changes needed because 1.4 uses classes instead of macro see header wxsproperty.h

Note, if you want me to I can rewrite patch to use guards instead of NEW_IN_WXPG14X macro.

mortenmacfly 2009-10-26 10:26

Applied in the wxpropgrid / debugger branch