X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FbbEditor%2FbbEditor.cxx;h=affb5a2462caa6ee0cfe6506646dc9e6757cd8c3;hb=f20bb1e48e93bb31c27fe3e610046c06333c8484;hp=517b72de9cb1c0d6271d07bae66da72a81a74906;hpb=36a0d24cb1d01a0f0c6010a18ec09874e6331fd5;p=bbtkGEditor.git diff --git a/appli/bbEditor/bbEditor.cxx b/appli/bbEditor/bbEditor.cxx index 517b72d..affb5a2 100644 --- a/appli/bbEditor/bbEditor.cxx +++ b/appli/bbEditor/bbEditor.cxx @@ -35,8 +35,8 @@ #include #include - #include "vtkOutputWindow.h" +#include "vtkRenderWindow.h" class vtkOutputWindowbbGEditor : public vtkOutputWindow { @@ -54,13 +54,27 @@ protected: -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 } -}; + +//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 @@ -109,19 +123,39 @@ bool wxBBEditorApp::OnCmdLineParsed(wxCmdLineParser& parser) } - - // ---------------------------------------------------------------------------- // The `main program' equivalent, creating the windows and returning the // main frame -bool wxBBEditorApp::OnInit( ) -{ +#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: \\CreaTools\\crea_TPdlls-4.0.0\\bin\\opengl-mesa the file: opengl32.dll\n to\n \\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); @@ -134,6 +168,7 @@ bool wxBBEditorApp::OnInit( ) #endif bbtk::wxGUIEditorGraphicBBS *iegbbs; + iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL); SetTopWindow(iegbbs); iegbbs->Show(true); @@ -156,8 +191,6 @@ bool wxBBEditorApp::OnInit( ) iegbbs->OpenBBS(input_file[i], input_file[i]); } } - - return true; } @@ -171,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)