From e84f23420375acf1dda8fe99cb08b1733c49b996 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 19 Sep 2017 16:41:20 +0200 Subject: [PATCH] #3125 crea Feature New Normal - branch changeWx28to30 compilation with wxWidgets3 --- cmake/CREAMacro_FindAndUseWxWidgets.cmake | 20 +++++--- lib/creaDevManagerLib/wxCDMMainFrame.cpp | 15 +++++- .../creaSample_preprocessor/CMakeLists.txt | 2 +- samples/creaSample_preprocessor/main.cxx | 3 +- src/creawxVTKRenderWindowInteractor.cxx | 49 +++++++++++++------ 5 files changed, 64 insertions(+), 25 deletions(-) diff --git a/cmake/CREAMacro_FindAndUseWxWidgets.cmake b/cmake/CREAMacro_FindAndUseWxWidgets.cmake index 969300c..1ef548c 100644 --- a/cmake/CREAMacro_FindAndUseWxWidgets.cmake +++ b/cmake/CREAMacro_FindAndUseWxWidgets.cmake @@ -58,8 +58,12 @@ MACRO(CREA_FIND_WXWIDGETS) # CMake 2.6: # technically those packages are not required # since one can still use the Motif/X11 version and not the gtk one: - FIND_PACKAGE(PkgConfig) - pkg_check_modules (GTK2 gtk+-2.0) + FIND_PACKAGE(PkgConfig REQUIRED) + +## pkg_check_modules (GTK2 gtk+-2.0) +## pkg_check_modules (GTK322 gtk+-3.0) + pkg_check_modules (GTK3 REQUIRED gtk+-3.0) + #MESSAGE("${GTK2_INCLUDE_DIRS}") # Can I require all my user to have the gl lib on linux, even if they do not really need it... #EED SET(WXGLCANVASLIBS "gl") @@ -108,10 +112,14 @@ MACRO(CREA_USE_WXWIDGETS) optimized msvcprt ) ELSE(WIN32) - # GTK2 - INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) - LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS}) - LINK_LIBRARIES(${GTK2_LIBRARIES}) +## # GTK2 +## INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) +## LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS}) +## LINK_LIBRARIES(${GTK2_LIBRARIES}) + # GTK3 + INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS}) + LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS}) + LINK_LIBRARIES(${GTK3_LIBRARIES}) # WX diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 41052d4..5664c50 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -271,14 +271,25 @@ void wxCDMMainFrame::CreateControls() auiManager.SetManagedWindow(this); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 tree_Projects = new wxCDMProjectsTreeCtrl( this, ID_TREE_PROJECTS, wxDefaultPosition, wxSize(200,400), - wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS - ); + wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS ); + this->actualTreeItem.Unset(); +#else + tree_Projects = new wxCDMProjectsTreeCtrl( + this, + ID_TREE_PROJECTS, + wxDefaultPosition, + wxSize(200,400), + wxTR_HAS_BUTTONS ); this->actualTreeItem.Unset(); +#endif + panel_Properties = new wxCDMMainDescriptionPanel( this, diff --git a/samples/creaSample_preprocessor/CMakeLists.txt b/samples/creaSample_preprocessor/CMakeLists.txt index 61e80bc..835705b 100644 --- a/samples/creaSample_preprocessor/CMakeLists.txt +++ b/samples/creaSample_preprocessor/CMakeLists.txt @@ -25,7 +25,7 @@ # ------------------------------------------------------------------------ */ crea_DEFINE(DEF1) -crea_DEFINE_WITH_VAL(DEF2 "This is the value of DEF2") +#crea_DEFINE_WITH_VAL(DEF2 "This is the value of DEF2") crea_DEFINE_WITH_VAL(DEF3 10) ADD_EXECUTABLE(creaSample_preprocessor main) diff --git a/samples/creaSample_preprocessor/main.cxx b/samples/creaSample_preprocessor/main.cxx index 5da1eda..6496c7e 100644 --- a/samples/creaSample_preprocessor/main.cxx +++ b/samples/creaSample_preprocessor/main.cxx @@ -28,7 +28,7 @@ #include int main(int argc, char* argv[]) -{ +{ std::cout << "** creaSample_preprocessor : begin of main "< // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0 -# include "gdk/gdkprivate.h" -#if wxCHECK_VERSION(2, 8, 0) -#ifdef __WXGTK20__ -#include -#else -#include -#endif + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 + #ifdef __WXGTK__ + #include // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0 + #include "gdk/gdkprivate.h" + #if wxCHECK_VERSION(2, 8, 0) + #ifdef __WXGTK20__ + #include + #else + #include + #endif + #else + #include + #endif + #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \ + GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \ + GDK_WINDOW_XWINDOW((wxwin)->m_widget->window) + #endif #else -#include -#endif -#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \ - GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \ - GDK_WINDOW_XWINDOW((wxwin)->m_widget->window) + #ifdef __WXGTK__ + #include + #include + #endif #endif + + #ifdef __WXX11__ #include "wx/x11/privx.h" #define GetXWindow(wxwin) ((Window)(wxwin)->GetHandle()) @@ -376,7 +387,15 @@ long creawxVTKRenderWindowInteractor::GetHandleHack() // Find and return the actual X-Window. #if defined(__WXGTK__) || defined(__WXX11__) - return (long)GetXWindow(this); + + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 + #if wxMAJOR_VERSION <= 2 + return (long)GetXWindow(this); + #else + GdkWindow* Win = gtk_widget_get_window( (GtkWidget *) GetHandle() ); + return (long int)GDK_WINDOW_XDISPLAY(Win); + #endif + #endif //#ifdef __WXMOTIF__ -- 2.45.1