]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbi/bbi.cxx
*** empty log message ***
[bbtk.git] / kernel / appli / bbi / bbi.cxx
index 3c00bb8db477d4ed45b9990f03cd761bb9b87951..42d5ec54c25d2310b3aab45f5f92d610512bfebe 100644 (file)
 
 static const wxCmdLineEntryDesc cmdLineDesc[] =
 {
-  { wxCMD_LINE_SWITCH, _T("M"), _T("Memory debug"), _T("Display memory debug message on exit") },
-  { wxCMD_LINE_SWITCH, _T("d"), _T("debug"), _T("Debug messages on (message All 9)") },
-  { wxCMD_LINE_SWITCH, _T("c"), _T("command"), _T("turn to command line mode after file(s) processing") },
-  { wxCMD_LINE_SWITCH, _T("q"), _T("quiet"),   _T("be quiet") },
-  { wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("print help") },
-  { wxCMD_LINE_SWITCH, _T("g"), _T("graphical-dialog"),   _T("prompts the user for the parameters values using dialog boxes") },
-  { wxCMD_LINE_SWITCH, _T("t"), _T("text-dialog"),   _T("prompts the user for the parameters values in text mode") },
-  { wxCMD_LINE_SWITCH, _T("n"), _T("no-command"),   _T("do not show command window except on error") },
-  { wxCMD_LINE_SWITCH, _T("N"), _T("no-command-at-all"),   _T("do not show command window even on error") },
+  { wxCMD_LINE_SWITCH, _T("M"), _T("Memory debug"), _T("Display memory debug message on exit ('object -S')") },
+  { wxCMD_LINE_SWITCH, _T("d"), _T("debug"), _T("all messages on ('message all 9')") },
+  { wxCMD_LINE_SWITCH, _T("c"), _T("console"), _T("open a console") },
+  { wxCMD_LINE_SWITCH, _T("q"), _T("quiet"),   _T("be quiet ('message max 0')") },
+  { wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("print help on bbi or on workspace defined if any") },
+  { wxCMD_LINE_SWITCH, _T("g"), _T("graphical-dialog"),   _T("prompts the user for the parameter values using graphical dialog") },
+  { wxCMD_LINE_SWITCH, _T("t"), _T("text-dialog"),   _T("prompts the user for the parameter values in text mode") },
+  { wxCMD_LINE_SWITCH, _T("N"), _T("no-console"),   _T("do not show console (even on error)") },
   { wxCMD_LINE_PARAM,  NULL, NULL, _T("input_file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
   { wxCMD_LINE_NONE }
 };
@@ -45,14 +44,13 @@ public:
   bbtk::Interpreter* I;
   int argc;
   std::vector<std::string> argv;
-  bool command;
+  bool console;
   bool debug;
   bool quiet;
   bool help;
   bool graphical_dialog;
   bool text_dialog;
-  bool no_command;
-  bool no_command_at_all;
+  bool no_console;
 
   std::map<std::string,std::string> param_map;
   std::vector<std::string> input_file;
@@ -79,9 +77,7 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
   help = ( parser.Found(_T("h")) );
   graphical_dialog = ( parser.Found(_T("g")) );
   text_dialog = ( parser.Found(_T("t")) );
-  no_command_at_all = ( parser.Found(_T("N")) );
-  no_command = ( parser.Found(_T("n")) || no_command_at_all );
-
+  no_console = ( parser.Found(_T("N")) );
 
   // parse the arguments and consider those which contain a "=" 
   // as set input commands, other as files
@@ -112,9 +108,9 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
     parser.Usage();
   }
 
-  command = ( parser.Found(_T("c")) || 
+  console = ( parser.Found(_T("c")) || 
              ((input_file.size() == 0) && 
-              (!no_command) &&
+              (!no_console) &&
               (!usage) ) );
 
 
@@ -124,6 +120,9 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
 
 
 
+
+
+
 // ----------------------------------------------------------------------------
 // The `main program' equivalent, creating the windows and returning the
 // main frame
@@ -136,13 +135,15 @@ bool wxBBIApp::OnInit( )
   setlocale(LC_NUMERIC, "C");
 #endif
   
-  if (quiet) bbtk::MessageManager::SetMessageLevel("All",0);
-  if (debug) bbtk::MessageManager::SetMessageLevel("All",9);
+
+  if (quiet) bbtk::MessageManager::SetMessageLevel("max",0);
+  if (debug) bbtk::MessageManager::SetMessageLevel("all",9);
   
 
   bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
   SetTopWindow(I);  
-  if (!no_command) I->Show(true);
+  if (console) I->Show(true);
+
 
   I->SetInputs(param_map);
 
@@ -160,7 +161,7 @@ bool wxBBIApp::OnInit( )
       error = ! I->InterpretFile(*i);
       if (error) break;
     }
-  bool show_on_error = error && ! no_command_at_all;
+  bool show_on_error = error && ! no_console;
   if (show_on_error) I->Show();
 
   I->SetNoExecMode(false);
@@ -171,7 +172,7 @@ bool wxBBIApp::OnInit( )
       I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false);
     }
 
-  if (!(show_on_error || command || bbtk::Wx::IsSomeWindowShown() ))
+  if (!(show_on_error || console || bbtk::Wx::IsSomeWindowShown() ))
     {
       I->Close();
     }