]> Creatis software - bbtkGEditor.git/blobdiff - appli/bbEditor/bbEditor.cxx
#3254 Bug windows select manual box
[bbtkGEditor.git] / appli / bbEditor / bbEditor.cxx
index a54c317866873917dfa1a4c35694517103c7271a..affb5a2462caa6ee0cfe6506646dc9e6757cd8c3 100644 (file)
 #include <wx/app.h>
 #include <wx/sysopt.h>
 
+#include "vtkOutputWindow.h"
+#include "vtkRenderWindow.h"
 
-static const wxCmdLineEntryDesc cmdLineDesc[] =
+class vtkOutputWindowbbGEditor : public vtkOutputWindow
 {
-{ wxCMD_LINE_PARAM,  NULL, NULL, _T("file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, 
-{ wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("Prints this help") },
-//{ wxCMD_LINE_SWITCH, _T("d"), _T("debug"),   _T("Message all 9") },
-{ wxCMD_LINE_NONE }
+public:
+       vtkOutputWindowbbGEditor() {}
+       static vtkOutputWindowbbGEditor* New() { return new vtkOutputWindowbbGEditor;}
+       virtual void    DisplayDebugText (const char *) {}
+       virtual void    DisplayText (const char *) {}
+       virtual void    DisplayErrorText (const char *) {}
+       virtual void    DisplayWarningText (const char *) {}
+       virtual void    DisplayGenericWarningText (const char *) {}
+protected:
 };
 
 
+
+
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+       static const wxCmdLineEntryDesc cmdLineDesc[] =
+       {
+       { wxCMD_LINE_PARAM,  NULL, NULL, _T("file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, 
+       { wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("Prints this help") },
+       //{ wxCMD_LINE_SWITCH, _T("d"), _T("debug"),   _T("Message all 9") },
+       { wxCMD_LINE_NONE }
+       };
+#else
+       static const wxCmdLineEntryDesc cmdLineDesc[] =
+       {
+       { wxCMD_LINE_PARAM,  NULL, NULL, "file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, 
+       { wxCMD_LINE_SWITCH, "h", "help",   "Prints this help" },
+       //{ wxCMD_LINE_SWITCH, _T("d"), _T("debug"),   _T("Message all 9") },
+       { wxCMD_LINE_NONE }
+       };
+#endif
+
+
+
+
 class wxBBEditorApp : public wxApp
 {
 public:
@@ -91,13 +123,39 @@ bool wxBBEditorApp::OnCmdLineParsed(wxCmdLineParser& parser)
 }
 
 
-
-
 // ----------------------------------------------------------------------------
 // The `main program' equivalent, creating the windows and returning the
 // main frame
+
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+
 bool wxBBEditorApp::OnInit( )
-{
+{      
+       vtkRenderWindow *renWin = vtkRenderWindow::New();
+    
+    printf("EED wxBBEditorApp::OnInit >>>>> vtkRenderWindow IsDirect       %d\n", renWin->IsDirect() );
+
+/* EED  2022-07-26 Segmentation fault with VTK9.2 in MacOs
+       int supportopengl=renWin->SupportsOpenGL();
+       printf("EED wxBBEditorApp::OnInit >>>>> vtkRenderWindow SupportsOpenGL %d\n", supportopengl );
+       renWin->Delete();
+       if (supportopengl==0)
+       {
+#if defined(_WIN32)
+               wxString message=wxT("OpenGL 3>= not detected.\n Try to install opengl drivers or use de opengl-mesa version.\n Copy from: <ProgramsFiles>\\CreaTools\\crea_TPdlls-4.0.0\\bin\\opengl-mesa the file: opengl32.dll\n to\n <ProgramsFiles>\\CreaTools\\CreaTools-3.0.0\\bin ");
+#else
+               wxString message=wxT("OpenGL 3>= not detected.\n Try to install opengl drivers or use de opengl-mesa version.\n ");     
+#endif
+               wxMessageBox(message);
+               exit(0);
+       }
+*/
+       
+       vtkOutputWindowbbGEditor *vtkoutputwindowbbgeditor= vtkOutputWindowbbGEditor::New();
+       vtkOutputWindow::SetInstance( vtkoutputwindowbbgeditor );
+       vtkoutputwindowbbgeditor->Delete();
+
 #ifdef MACOSX
        /* assume this is OSX */
        wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1);
@@ -110,6 +168,7 @@ bool wxBBEditorApp::OnInit( )
 #endif
 
        bbtk::wxGUIEditorGraphicBBS *iegbbs;
+
        iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL);
        SetTopWindow(iegbbs);
        iegbbs->Show(true);
@@ -132,8 +191,6 @@ bool wxBBEditorApp::OnInit( )
                        iegbbs->OpenBBS(input_file[i], input_file[i]); 
                } 
        }
-
-
        return true;
 }
 
@@ -147,7 +204,10 @@ bool wxBBEditorApp::OnInit( )
 //  you need to use the linker option "/subsystem:console" and the following code:
 int main(int argc, char* argv[])
 {
-       return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
+       char buffer[500];
+       wcstombs(buffer, ::GetCommandLine(), 500);
+       return WinMain(::GetModuleHandle(NULL), NULL, buffer, SW_SHOWNORMAL);
+//     return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
 }
 
 #endif // defined(_WIN32)