Patch #1696 2006-12-07 10:44

stahta01

patch to the old wxSmith to use wxPropertyGrid version 1.2.x
Download
1696-patch_to_the_o.patch (13.7 KB)
Category
Plugin::Refinement
Status
Closed
Close date
2007-02-19 03:53
Assigned to
 
Index: src/plugins/contrib/wxSmith/properties/wxsenumproperty.cpp
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsenumproperty.cpp    (revision 3349)
+++ src/plugins/contrib/wxSmith/properties/wxsenumproperty.cpp    (working copy)
@@ -15,7 +15,12 @@
 
 void wxsEnumProperty::AddToPropGrid(wxPropertyGrid* Grid,const wxString& Name)
 {
+// TODO: Verify version number 1099
+#if defined(wxPG_VERSION) && wxPG_VERSION > 1099
+    PGId = Grid->Append( wxEnumProperty(Name,wxPG_LABEL,Names,Values,Value) );
+#else
     PGId = Grid->Append( wxEnumProperty(Name,wxPG_LABEL,Names,Values,0,Value) );
+#endif
 }
 
 bool wxsEnumProperty::PropGridChanged(wxPropertyGrid* Grid,wxPGId Id)
Index: src/plugins/contrib/wxSmith/properties/wxsplacementproperty.cpp
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsplacementproperty.cpp    (revision 3349)
+++ src/plugins/contrib/wxSmith/properties/wxsplacementproperty.cpp    (working copy)
@@ -53,8 +53,12 @@
         wxsSizerExtraParams::LeftCenter,
         wxsSizerExtraParams::Center
     };
-
+// TODO: Verify version number 1099
+#if defined(wxPG_VERSION) && wxPG_VERSION > 1099
+    PGId = Grid->Append( wxEnumProperty(Name,wxPG_LABEL,Placements,Values,PlacementType) );
+#else
     PGId = Grid->Append( wxEnumProperty(Name,wxPG_LABEL,Placements,Values,0,PlacementType) );
+#endif
     ExpandId = Grid->Append( wxBoolProperty(ExpandName, wxPG_LABEL, Expand ) );
     ShapedId = Grid->Append( wxBoolProperty(ShapedName, wxPG_LABEL, Shaped ) );
     Grid->SetPropertyAttribute(ExpandId,wxPG_BOOL_USE_CHECKBOX,(long)1,wxRECURSE);
Index: src/plugins/contrib/wxSmith/properties/wxsborderproperty.cpp
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsborderproperty.cpp    (revision 3349)
+++ src/plugins/contrib/wxSmith/properties/wxsborderproperty.cpp    (working copy)
@@ -32,7 +32,12 @@
         wxsSizerExtraParams::Bottom
     };
 
+// TODO: Verify version number 1099
+#if defined(wxPG_VERSION) && wxPG_VERSION > 1099
+    PGId = Grid->Append(wxFlagsProperty(Name,wxPG_LABEL,Borders,Values,BorderFlags));
+#else
     PGId = Grid->Append(wxFlagsProperty(Name,wxPG_LABEL,Borders,Values,0,BorderFlags));
+#endif
     Grid->SetPropertyAttribute(PGId,wxPG_BOOL_USE_CHECKBOX,(long)1,wxRECURSE);
 }
 
Index: src/plugins/contrib/wxSmith/properties/wxsadvimageproperty.cpp
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsadvimageproperty.cpp    (revision 3349)
+++ src/plugins/contrib/wxSmith/properties/wxsadvimageproperty.cpp    (working copy)
@@ -1,3 +1,15 @@
+// -----------------------------------------------------------------------
+// Name:        wxsadvimageproperty.cpp
+// Purpose:     wxSmith support code
+// Author:      byo
+// Modified by:
+// Created:
+// Copyright:
+// Licence:
+//
+// -----------------------------------------------------------------------
+
+
 //#include "../wxsheaders.h"
 #include "wxsadvimageproperty.h"
 
@@ -4,6 +16,280 @@
 #include <wx/intl.h>
 
 #ifndef __NO_PROPGRGID
+
+#if defined(wxPG_VERSION)
+// Assume using new wxPropertyGrid that does NOT contain wxAdvImageFileProperty
+
+// -----------------------------------------------------------------------
+// wxAdvImageFilePropertyClass was snipped from code in propgridsample.cpp
+//
+// Purpose:     Sample Code
+// Author:      Jaakko Salli
+// Modified by:
+// Created:     Sep-25-2004
+// RCS-ID:      $Id:
+// Copyright:   (c) Jaakko Salli
+// Licence:     wxWindows license
+//
+// -----------------------------------------------------------------------
+
+class wxMyImageInfo;
+
+WX_DECLARE_OBJARRAY(wxMyImageInfo, wxArrayMyImageInfo);
+
+#include <wx/arrimpl.cpp>
+WX_DEFINE_OBJARRAY(wxArrayMyImageInfo);
+
+wxArrayString       g_myImageNames;
+wxArrayMyImageInfo  g_myImageArray;
+
+WX_PG_IMPLEMENT_PROPERTY_CLASS(wxAdvImageFileProperty,wxFileProperty,
+                               wxString,const wxString&,ChoiceAndButton)
+
+wxAdvImageFilePropertyClass::wxAdvImageFilePropertyClass ( const wxString& label,
+    const wxString& name, const wxString& value)
+    : wxFilePropertyClass(label,name,value)
+{
+    m_wildcard = wxPGGetDefaultImageWildcard();
+
+    m_index = -1;
+
+    m_pImage = (wxImage*) NULL;
+
+    m_flags &= ~(wxPG_PROP_SHOW_FULL_FILENAME);
+
+}
+
+wxAdvImageFilePropertyClass::~wxAdvImageFilePropertyClass ()
+{
+    // Delete old image
+    if ( m_pImage )
+    {
+        delete m_pImage;
+        m_pImage = (wxImage*) NULL;
+    }
+}
+
+void wxAdvImageFilePropertyClass::DoSetValue ( wxPGVariant value )
+{
+    wxFilePropertyClass::DoSetValue(value);
+
+    // Delete old image
+    if ( m_pImage )
+    {
+        delete m_pImage;
+        m_pImage = (wxImage*) NULL;
+    }
+
+   // Customized by cyberkoa to get the value as full path
+     wxString imagename = GetVa
download for full patch...
stahta01 2006-12-07 11:34

I am working on patch to upgrade wxPropertyGrid to version 1.2.x; likely version 1.2.5 when it is finished.

See CodeBlocks forum thread http://forums.codeblocks.org/index.php?topic=4638.0

Tim S

Note: forgot to patch unix cbp files.

WXMAKINGLIB_PROPGRID makes wxPropertyGrid into static library

wxPG_USE_WXMODULE=0 turns off the use of wxWidgets wxModule; the use wxModule was causing wxSmith to crash.

wxPG_COMPATIBILITY_1_0_0 turns on 1.0.0 compatibility mode; this should be removed and the errors fixed.

#defines needed in target wxPropertyGrid

WXMAKINGLIB_PROPGRID

wxPG_USE_WXMODULE=0

wxPG_COMPATIBILITY_1_0_0

#defines needed in project wxSmith (old)

WXMAKINGLIB_PROPGRID

wxPG_COMPATIBILITY_1_0_0

stahta01 2007-01-30 00:45

This patch can be closed since the old wxSmith is no longer being used. Tim S