Patch #1766 2006-12-27 19:06

stahta01

NEW (experimental) wxSmith patch for wxWidgets 2.8
Download
1766-NEW_experiment.patch (4.5 KB)
Category
Plugin::Refinement
Status
Closed
Close date
2007-02-25 22:00
Assigned to
 
Index: src/plugins/contrib/wxSmith/wxwidgets/wxwidgetsguiconfigpanel.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/wxwidgetsguiconfigpanel.cpp    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/wxwidgetsguiconfigpanel.cpp    (working copy)
@@ -128,7 +128,11 @@
         _("XRC files (*.xrc)|*.xrc|"
           "Zipped files (*.zip)|*.zip|"
           "All files (*)|*"),
-        wxOPEN|wxFILE_MUST_EXIST|wxHIDE_READONLY);
+        wxOPEN|wxFILE_MUST_EXIST
+#if (WXWIN_COMPATIBILITY_2_4)
+        |wxHIDE_READONLY
+#endif
+        );
 
     if ( !FileName.empty() )
     {
Index: src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp    (working copy)
@@ -21,6 +21,10 @@
 * $HeadURL$
 */
 
+#ifndef CB_PRECOMP
+    #include <wx/notebook.h>
+#endif
+
 #include "wxsnotebook.h"
 #include "../../wxsadvqppchild.h"
 
Index: src/plugins/contrib/wxSmith/wxwidgets/wxsevents.h
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/wxsevents.h    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/wxsevents.h    (working copy)
@@ -1,6 +1,10 @@
 #ifndef WXSEVENTS_H
 #define WXSEVENTS_H
 
+#ifndef WX_PRECOMP
+    #include <wx/arrstr.h>
+#endif
+
 #include <tinyxml/tinyxml.h>
 
 #include "../wxscodinglang.h"
Index: src/plugins/contrib/wxSmith/wxwidgets/wxsstyle.h
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/wxsstyle.h    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/wxsstyle.h    (working copy)
@@ -1,6 +1,10 @@
 #ifndef __WXSSTYLE_H
 #define __WXSSTYLE_H
 
+#ifndef WX_PRECOMP
+    #include <wx/arrstr.h>
+#endif
+
 #include "../wxscodinglang.h"
 #include <wx/dynarray.h>
 
Index: src/plugins/contrib/wxSmith/wxwidgets/properties/wxsfontproperty.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/properties/wxsfontproperty.cpp    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/properties/wxsfontproperty.cpp    (working copy)
@@ -39,10 +39,15 @@
     wxString Face;
     wxFontEnumerator Enumer;
     Enumer.EnumerateFacenames();
+#if wxCHECK_VERSION(2, 8, 0)
+        wxArrayString faceNames = Enumer.GetFacenames();
+#else
+        wxArrayString& faceNames = *Enumer.GetFacenames();
+#endif
     size_t Count = Faces.Count();
     for ( size_t i = 0; i<Count; i++ )
     {
-        if ( Enumer.GetFacenames()->Index(Faces[i]) != wxNOT_FOUND )
+        if ( faceNames.Index(Faces[i]) != wxNOT_FOUND )
         {
             Face = Faces[i];
             break;
Index: src/plugins/contrib/wxSmith/wxwidgets/properties/wxsarraystringcheckproperty.h
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/properties/wxsarraystringcheckproperty.h    (revision 3526)
+++ src/plugins/contrib/wxSmith/wxwidgets/properties/wxsarraystringcheckproperty.h    (working copy)
@@ -3,7 +3,11 @@
 
 #include "../../properties/wxsproperties.h"
 
-WX_DEFINE_ARRAY(bool,wxArrayBool);
+#if wxCHECK_VERSION(2, 8, 0)
+    WX_DEFINE_ARRAY_INT(bool,wxArrayBool);
+#else
+    WX_DEFINE_ARRAY(bool,wxArrayBool);
+#endif
 
 /** \brief Property for editing arrays of strings with checked option
  *
Index: src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.cpp
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.cpp    (revision 3526)
+++ src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.cpp    (working copy)
@@ -88,3 +88,9 @@
 
     EndModal(wxID_OK);
 }
+#if wxCHECK_VERSION(2, 8, 0)
+void wxsArrayStringEditorDlg::OnCancel(wxCommandEvent& event)
+{
+    EndModal(wxID_CANCEL);
+}
+#endif
Index: src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.h
===================================================================
--- src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.h    (revision 3526)
+++ src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.h    (working copy)
@@ -27,6 +27,9 @@
 
         //(*Handlers(wxsArrayStringEditorDlg)
         void OnOK(wxCommandEvent& event);
+#if wxCHECK_VERSION(2, 8, 0)
+        void wxsArrayStringEditorDlg::OnCancel(wxCommandEvent& event);
+#endif
         //*)
 
         //(*Declarations(wxsArrayStringEditorDlg)
stahta01 2006-12-27 19:10

This patch is NOT for the wxSmith contained in the nightly builds. Tim S

stahta01 2006-12-27 19:19
Change 1: WXWIN_COMPATIBILITY_2_4 is turn off by default under wxWidgets 2.8
Problem 1: This makes wxHIDE_READONLY undefined.
Solution 1: Added #if (WXWIN_COMPATIBILITY_2_4) blocks around wxHIDE_READONLY.

Change 2: wxFontEnumerator::GetFacenames returns wxArrayString instead of wxArrayString*

Solution 2: Added code
#if wxCHECK_VERSION(2, 8, 0)
        wxArrayString faceNames = Enumer.GetFacenames();
#else
        wxArrayString& faceNames = *Enumer.GetFacenames();
#endif

And use faceNames where GetFacenames was used.

Problem 3: wxWidgets 2.8 does NOT like WX_DEFINE_ARRAY(bool,wxArrayBool)
Solution 3: Replaced it with WX_DEFINE_ARRAY_INT(bool,wxArrayBool)

Change 4: OnCancel method removed from wxDialog.
Problem 4: wxsArrayStringEditorDlg was using it.
Solution 4: Created wxsArrayStringEditorDlg::OnCancel method, note I am not sure if my code in the OnCancel method is correct.
Tim S
stahta01 2007-01-14 08:55

Updated patch because of Linux compile errors do to changes to wxSmith and use of wxWidgets 2.8.1.

stahta01 2007-01-21 03:39

Changed patch to work with current wxSmith in SVN 3526

Tim S

horakdan 2007-01-26 11:55
I had to update the patch when compiling CB revision 3540

- removed the qualifier from the OnCancel method
--- src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.h	(revision 3526)

+++ src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.h	(working copy)

@@ -27,6 +27,9 @@


 		//(*Handlers(wxsArrayStringEditorDlg)
 		void OnOK(wxCommandEvent& event);
+#if wxCHECK_VERSION(2, 8, 0)
+        void OnCancel(wxCommandEvent& event);
+#endif
 		//*)

 		//(*Declarations(wxsArrayStringEditorDlg)

- no guard when including wx/notebook.h
Index: src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp

===================================================================

--- src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp	(revision 3526)

+++ src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsnotebook.cpp	(working copy)

@@ -21,6 +21,7 @@

 * $HeadURL$
 */

+#include <wx/notebook.h>
+
 #include "wxsnotebook.h"
 #include "../../wxsadvqppchild.h"