X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbi%2Fbbi.cxx;h=89a3daa305de477cb5ad38f819a1875e7758de05;hb=87efce51877a540d943b1aa26307994b38bba55b;hp=86952f5632ec0b33e23f72010eca28c04f2f500c;hpb=2d2fc4c6349d5040a9f13a240f079e7a1c6687dd;p=bbtk.git diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 86952f5..89a3daa 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -1,3 +1,30 @@ +/* + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la SantÈ) + # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton + # Previous Authors : Laurent Guigues, Jean-Pierre Roux + # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil + # + # This software is governed by the CeCILL-B license under French law and + # abiding by the rules of distribution of free software. You can use, + # modify and/ or redistribute the software under the terms of the CeCILL-B + # license as circulated by CEA, CNRS and INRIA at the following URL + # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + # or in the file LICENSE.txt. + # + # As a counterpart to the access to the source code and rights to copy, + # modify and redistribute granted by the license, users are provided only + # with a limited warranty and the software's author, the holder of the + # economic rights, and the successive licensors have only limited + # liability. + # + # The fact that you are presently reading this means that you have had + # knowledge of the CeCILL-B license and that you accept its terms. + # ------------------------------------------------------------------------ */ + + #ifdef _USE_WXWIDGETS_ //========================================================================== @@ -31,9 +58,9 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = //========================================================================== // Processes the command line parsing result -struct ProcessCmdLine +struct WxProcessCmdLine { - ProcessCmdLine() {} + WxProcessCmdLine() {} void Process(wxCmdLineParser& parser); // int argc; @@ -53,7 +80,7 @@ struct ProcessCmdLine //========================================================================== //========================================================================== -void ProcessCmdLine::Process(wxCmdLineParser& parser) +void WxProcessCmdLine::Process(wxCmdLineParser& parser) { proceed = true; if (parser.Found(_T("D"))) @@ -64,7 +91,7 @@ void ProcessCmdLine::Process(wxCmdLineParser& parser) debug = ( parser.Found(_T("d")) ); quiet = ( parser.Found(_T("q")) ); help = ( parser.Found(_T("h")) ); - graphical_dialog = ( parser.Found(_T("g")) ); + graphical_dialog = ( parser.Found(_T("wxcommandlineg")) ); text_dialog = ( parser.Found(_T("t")) ); no_console = ( parser.Found(_T("N")) ); @@ -120,7 +147,7 @@ public: void OnInitCmdLine(wxCmdLineParser& parser); bool OnCmdLineParsed(wxCmdLineParser& parser); - ProcessCmdLine cmd; + WxProcessCmdLine cmd; }; //========================================================================== @@ -151,7 +178,10 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser) // main frame bool wxBBIApp::OnInit( ) { - std::cout << "OnInit"<Show(true); @@ -171,12 +206,9 @@ bool wxBBIApp::OnInit( ) I->SetInputs(cmd.param_map); bool help_on_script = cmd.help && (cmd.input_file.size() > 0); - if (help_on_script) - I->SetNoExecMode(true); - if (cmd.graphical_dialog) - I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog); - if (cmd.text_dialog) - I->SetDialogMode(bbtk::VirtualExec::TextDialog); + if (help_on_script) I->SetNoExecMode(true); + if (cmd.graphical_dialog) I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog); + if (cmd.text_dialog) I->SetDialogMode(bbtk::VirtualExec::TextDialog); std::vector::const_iterator i; bool error = false; @@ -194,7 +226,7 @@ bool wxBBIApp::OnInit( ) if (help_on_script) { std::string package; - I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false); + I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false); } /* @@ -202,7 +234,7 @@ bool wxBBIApp::OnInit( ) std::cout << "con="<Close"<Close"<SetNoExecMode(false); std::string package; - I->GetExecuter()->GetFactory()->HelpBlackBox("workspace", - package, - false); + I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace", + package, + false); } if (cmdline.input_file.size()==0) I->CommandLineInterpreter(); @@ -314,32 +355,133 @@ int main(int argc, char* argv[]) #include "bbtkInterpreter.h" -int main(int argc, char* argv[]) -{ +// Processes the command line parsing result +struct ProcessCmdLine +{ + ProcessCmdLine() {} + void Process(int argc_, char *argv_[]); + bool Found(std::string value); + + int argc; + std::vector argv; + bool console; + bool debug; + bool quiet; + bool help; + bool graphical_dialog; + bool text_dialog; + bool no_console; + bool proceed; + std::map param_map; + std::vector input_file; + +}; - if (argc>2) +bool ProcessCmdLine::Found(std::string value) +{ + bool result=false; + for (int i=1; i2) +// { +// std::cout << "usage : "<CommandLineInterpreter(); - } - else - - { - std::string f(argv[1]); - I->InterpretFile(f); - } + { + I->CommandLineInterpreter(); + } else { + + ProcessCmdLine cmd; + cmd.Process(argc,argv); + I->SetInputs(cmd.param_map); + + std::string f(argv[1]); + I->InterpretFile(f); + } - bbtk::Wx::LoopUntilAllWindowsClose(); + // bbtk::Wx::LoopUntilAllWindowsClose(); return 0;