]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbi/bbi.cxx
#3465 Spin in combobox Box and FilterString (find strings)
[bbtk.git] / kernel / appli / bbi / bbi.cxx
index ea8dd6cc5f504360e72013197270ecd90c7bc932..c4729fc90b52f4e7fb261368c7f2a2a601a08eb0 100644 (file)
  #  knowledge of the CeCILL-B license and that you accept its terms.
  # ------------------------------------------------------------------------ */
 
+//__asm__(".symver fcntl64,fcntl64@GLIBC_2.27");
 
 #ifdef _USE_WXWIDGETS_
 
+
+#include <exception>
+
 //==========================================================================
 // WITH WX
 //==========================================================================
@@ -111,13 +115,20 @@ void WxProcessCmdLine::Process(wxCmdLineParser& parser)
       bbtk::StaticInitTime::PrintObjectListInfo = true;
     }
   
-  debug = ( parser.Found(_T("d")) );  
-  quiet = ( parser.Found(_T("q")) );
-  help = ( parser.Found(_T("h")) );
-  graphical_dialog = ( parser.Found(_T("wxcommandlineg")) );
-  text_dialog = ( parser.Found(_T("t")) );
-  no_console = ( parser.Found(_T("N")) );
-  
+  debug                        = ( parser.Found(_T("d")) );  
+  quiet                        = ( parser.Found(_T("q")) );
+  help                         = ( parser.Found(_T("h")) );
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+  graphical_dialog     = ( parser.Found(_T("wxcommandlineg")) );
+#else
+  printf("EED Warnning. WxProcessCmdLine::Process  g  wxcommandlineg \n");
+  graphical_dialog     = ( parser.Found(_T("g")) );
+#endif
+
+  text_dialog          = ( parser.Found(_T("t")) );
+  no_console           = ( parser.Found(_T("N")) );
   if (quiet) bbtk::MessageManager::SetMessageLevel("max",0);
   if (debug) bbtk::MessageManager::SetMessageLevel("all",9);
 
@@ -153,7 +164,7 @@ void WxProcessCmdLine::Process(wxCmdLineParser& parser)
              ((input_file.size() == 0) && 
               (!no_console) &&
               (!usage) ) );
-  
+
 }
 //==========================================================================
 
@@ -193,14 +204,12 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
 
 
 
-
-
-
 //==========================================================================
 // The `main program' equivalent, creating the windows and returning the
 // main frame
 bool wxBBIApp::OnInit( )
 {
+
 //Borrame
 //FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED wxBBIApp::OnInit\n"); fclose(ff);
 
@@ -211,7 +220,6 @@ bool wxBBIApp::OnInit( )
   setlocale(LC_NUMERIC, "C");
 #endif
   
-
   if (cmd.quiet) bbtk::MessageManager::SetMessageLevel("max",0);
   if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9);
   
@@ -220,7 +228,6 @@ bool wxBBIApp::OnInit( )
 //printf ("EED bbi wxBBIApp::OnInit .....................\n");
 //cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
 
-
   bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
   SetTopWindow(I);  
   if (cmd.console) I->Show(true);
@@ -236,6 +243,7 @@ bool wxBBIApp::OnInit( )
   std::vector<std::string>::const_iterator i;
   bool error = false;
 
+
   for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i) 
     {
       error = ! I->InterpretFile(*i);
@@ -252,6 +260,7 @@ bool wxBBIApp::OnInit( )
       I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false);
     }
 
+
   /*
   std::cout << "soe="<<show_on_error <<std::endl;
   std::cout << "con="<<console<<std::endl;
@@ -288,13 +297,17 @@ IMPLEMENT_APP(wxBBIApp);
 //  you need to use the linker option "/subsystem:console" and the following code:
 int main(int argc, char* argv[])
 {
-
 //Borrame
 //FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main C\n"); fclose(ff);
 
-    return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
+       // EED 2018-07-16
+       char buffer[1500];
+       wcstombs(buffer , ::GetCommandLine() , 1500 );
+    return WinMain(::GetModuleHandle(NULL), NULL, buffer , SW_SHOWNORMAL);
+       //    return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
 }
 
+
 #else 
 //==========================================================================
 // OTHER ( Linux... )
@@ -305,7 +318,6 @@ IMPLEMENT_APP_NO_MAIN(wxBBIApp);
 
 int main(int argc, char* argv[])
 {      
-
 //Borrame
 //FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main A\n"); fclose(ff);
 
@@ -323,7 +335,7 @@ int main(int argc, char* argv[])
 
   if (!cmdline.proceed) return 0;
 
-  if (cmdline.no_console) 
+       if (cmdline.no_console) 
     {
       //      std::cout << "main NC"<<std::endl;
       // Interpreter 
@@ -336,27 +348,26 @@ int main(int argc, char* argv[])
       bool error = false;
       for (i=cmdline.input_file.begin(); 
           i!=cmdline.input_file.end(); ++i) 
-       {
-         error = ! I->InterpretFile(*i);
-         if (error) break;
-       }
-      if (help_on_script) 
-       {
-         I->SetNoExecMode(false);
-         std::string package; 
-         I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",
+               {
+                       error = ! I->InterpretFile(*i);
+                       if (error) break;
+               }
+       if (help_on_script) 
+               {
+                       I->SetNoExecMode(false);
+                       std::string package; 
+                       I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",
                                                              package,
                                                              false);
-       }
-      if (cmdline.input_file.size()==0)
-       I->CommandLineInterpreter();
-
+               }
+       if (cmdline.input_file.size()==0)
+               {
+                       I->CommandLineInterpreter();
+               } // if cmdline.input_file.size
       //
-    }
-  else 
-    {
+    } else {
       wxEntry(argc, argv);
-    }
+    } // if cmdline.no_console
 
 }