News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

[Work In Progress] Patches to Compile C::B against wxWidgets 2.9.0

Started by stahta01, May 03, 2009, 03:46:32 AM

Previous topic - Next topic

stahta01

@Biplab:

Ok, Will do the rest of C::B Plugins using wxCHECK_VERSION() around wx_str() and C_str().

My Method is to use wxWidgets version of wxPropertyGrid; which will need OK from wxSmith maintainer.
Will submit the wxSmith patch as separate file from rest. And, I am not sure how to do this using wxCHECK_VERSION() so will likely take time to work on some parts of wxSmith patch.

Note: I am currently getting new error, less that two months old, on shutting in down Code::Blocks.
I plan to work on finding this error before doing the wxSmith patch.

Tim S

PS: Waiting for a rebuild of wxWidgets 2.9.0 RC2 to finish patches.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patch to Contrib envvars attached to message.
Deleted patch to save space.

Not had time to test under wxWidgets 2.8, but compiles under wxWidgets 2.9.0 RC2.

Tim S


Note: The file also contains patch to devpak_plugin
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patch to Contrib ThreadSearch
Tim S


Index: src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp
===================================================================
--- src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp (revision 5585)
+++ src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp (working copy)
@@ -491,7 +491,11 @@

wxFocusEvent ev(wxEVT_SET_FOCUS);
ev.SetWindow(this);
+ #if wxCHECK_VERSION(2, 9, 0)
+ control->GetEventHandler()->AddPendingEvent(ev);
+ #else
control->AddPendingEvent(ev);
+ #endif
}
}

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patch to lib_finder attached to this message.

Deleted Patch to save website resources

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patches Still Needed for
  Profiler
  Exporter
  Games
  Code Snippets
  DragScroll
  wxSmith
  wxSmith - Contrib Items


Note: I am working currently on a very large patch for wxSmith
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patch to Contrib DragScroll
Tim S


Index: src/plugins/contrib/dragscroll/dragscroll.cpp
===================================================================
--- src/plugins/contrib/dragscroll/dragscroll.cpp (revision 5585)
+++ src/plugins/contrib/dragscroll/dragscroll.cpp (working copy)
@@ -977,7 +977,11 @@
         wheelEvt.SetEventObject(pWindow);
         wheelEvt.m_controlDown = true;
         wheelEvt.m_wheelRotation = 0;
+        #if wxCHECK_VERSION(2, 9, 0)
+        pWindow->GetEventHandler()->AddPendingEvent(wheelEvt);
+        #else
         pWindow->AddPendingEvent(wheelEvt);
+        #endif
     }while(0);

     // Issue SetFont() for saved font sizes on our monitored windows
@@ -1006,7 +1010,11 @@
                 wheelEvt.SetEventObject(pWindow);
                 wheelEvt.m_controlDown = true;
                 wheelEvt.m_wheelRotation = 0;
+                #if wxCHECK_VERSION(2, 9, 0)
+                pWindow->GetEventHandler()->AddPendingEvent(wheelEvt);
+                #else
                 pWindow->AddPendingEvent(wheelEvt);
+                #endif
                 #if defined(LOGGING)
                 //LOGIT( _T("OnAppStartupDoneInit Issued Wheel Zoom event 0[%p]size[%d]"),pWindow, fontSize);
                 #endif
@@ -1143,7 +1151,11 @@
                     wheelEvt.SetEventObject(pWindow);
                     wheelEvt.m_controlDown = true;
                     wheelEvt.m_wheelRotation = 0; //set user font
+                    #if wxCHECK_VERSION(2, 9, 0)
+                    pWindow->GetEventHandler()->AddPendingEvent(wheelEvt);
+                    #else
                     pWindow->AddPendingEvent(wheelEvt);
+                    #endif
                     #if defined(LOGGING)
                     //LOGIT( _T("OnWindowOpen Issued htmlWindow Zoom event"));
                     #endif
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Got to do School Work Now; be a week before I can do any major work.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Biplab

Quote from: stahta01 on May 03, 2009, 08:15:03 PM
My Method is to use wxWidgets version of wxPropertyGrid; which will need OK from wxSmith maintainer.
Will submit the wxSmith patch as separate file from rest. And, I am not sure how to do this using wxCHECK_VERSION() so will likely take time to work on some parts of wxSmith patch.

Please go ahead with the patch. No objections to that.

I didn't read the code; but you can do it like-
#if wxCHECK_VERSION(2, 9, 0)
#include <wx/propgrid/propgrid.h>
#else
#include "propgrid/propgrid.h"
#endif


As long as the API remain unchanged, this should do. I'll commit rest of your patches tonight. :)
Be a part of the solution, not a part of the problem.

stahta01

Quote from: Biplab on May 04, 2009, 02:34:10 AM
As long as the API remain unchanged, this should do. I'll commit rest of your patches tonight. :)

There was a change in wxPropertyGrid API.

Three clear and separate ways to proceed.
1. Wait till wxWidgets 3.0 is released before doing wxSmith
2. Upgrade wxSmith to using a newer wxPropertyGrid more compatible with wxWidgets 2.9 wxPropertyGrid
3. Add Patches to wxSmith guarded by both wxCHECK_VERSION and wxPropertyGrid version guard.

I plan to do option 3 add guards based on wxPropertyGrid version and wxWidgets version.
Edit: I am going to try with just wxCHECK_VERSION for now.
If option 2 is taken will likely need to use wxCHECK_PROPGRID_VERSION in addition.

Option 3 Failed with about 6 API changes where I could not determine the correct action.

Planning on doing a very limited patch of current wxPropertyGrid.
Will try to use the below to make wxPropertyGrid more like wxWidgets 2.9 version
#define wxPG_PGVARIANT_IS_VARIANT
#define wxPG_ID_IS_PTR 1




Tim S

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

MortenMacFly

Quote from: Biplab on May 04, 2009, 02:34:10 AM
Please go ahead with the patch. No objections to that.
Careful!!! This won't easily work. The wxPropgrid of wxWidgets has heavily changed its API. I once tried to port wxSmith but unfortunately this got lost on the way. If you really want to try make sure you *remove* the old propgrid sources from C::B, including the compiled library.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

stahta01

Quote from: MortenMacFly on May 04, 2009, 09:23:48 AM
Quote from: Biplab on May 04, 2009, 02:34:10 AM
Please go ahead with the patch. No objections to that.
Careful!!! This won't easily work. The wxPropgrid of wxWidgets has heavily changed its API. I once tried to port wxSmith but unfortunately this got lost on the way. If you really want to try make sure you *remove* the old propgrid sources from C::B, including the compiled library.

I have three separate patches for wxSmith. Rewriting with guards takes time.
1. Normal wxWidgets 2.9 changes
2. wxPropertyGrid API changes
No idea of best way to do the below, I am thinking make separate CB Project to
build/not build wxPropertyGrid.
3. Build changes (remove wxPropertyGrid code from Code::Blocks to test wxWidgets 2.9)
Write patch to do step 4.
4. Upgrade CB wxPropertyGrid to newer API used by wxWidgets 2.9 to support CB with wxWidgets 2.8

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Biplab

Quote from: MortenMacFly on May 04, 2009, 09:23:48 AM
Quote from: Biplab on May 04, 2009, 02:34:10 AM
Please go ahead with the patch. No objections to that.
Careful!!! This won't easily work. The wxPropgrid of wxWidgets has heavily changed its API. I once tried to port wxSmith but unfortunately this got lost on the way. If you really want to try make sure you *remove* the old propgrid sources from C::B, including the compiled library.

I don't want to remove wxpropgrid sources now. Rather I want to make wxsmith ready to work with wxWidgets 2.9. As I've been doing so far, all wx-2.9 migration patches are to be guarded by wxCHECK_VERSION to avoid breaking present compatibility with wx-2.8.x. As long as we support wx-2.8.x we can't remove wxpropgrid from trunk.
Be a part of the solution, not a part of the problem.

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Guarded Patch to devpak. Tim S


Index: src/plugins/contrib/devpak_plugin/mytar.cpp
===================================================================
--- src/plugins/contrib/devpak_plugin/mytar.cpp (revision 5588)
+++ src/plugins/contrib/devpak_plugin/mytar.cpp (working copy)
@@ -19,7 +19,11 @@
     m_SkipBytes(0),
     m_Size(0)
{
+    #if wxCHECK_VERSION(2, 9, 0)
+    if (!filename.IsEmpty())
+    #else
     if (filename)
+    #endif
         Open(filename);
}

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Patch to Games


Index: src/plugins/contrib/byogames/byosnake.cpp
===================================================================
--- src/plugins/contrib/byogames/byosnake.cpp (revision 5588)
+++ src/plugins/contrib/byogames/byosnake.cpp (working copy)
@@ -300,7 +300,11 @@
     DC->SetTextBackground(*wxBLACK);
     DC->SetFont(m_Font);
     wxString Line1 = wxString::Format(_("Lives: %d    Score: %d   Length: %d"),m_Lives,m_Score,m_SnakeLen);
+    #if wxCHECK_VERSION(2, 9, 0)
+    wxString Line2 = IsPaused() ? wxString(_("Paused")) : wxString(wxEmptyString);
+    #else
     wxString Line2 = IsPaused() ? _("Paused") : wxEmptyString;
+    #endif
     wxString Line3 = GetBackToWorkString();
     DC->DrawText(Line1,5,5);
     int xs, ys;
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]