X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=2cec64923f836782efeb7a91f01a5cf07acb1266;hb=a45d2dc35562aad94f11ce0c82dfe5f53155462e;hp=b5355ea108a2b0c4456c7b1e938f5ddcb078174a;hpb=646777bc9d888b3bbd295758266d9096818bfccc;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index b5355ea..2cec649 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -122,7 +122,8 @@ wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() } //========================================================================= -void wxGUIEditorGraphicBBS::initToolbar() { +void wxGUIEditorGraphicBBS::initToolbar() +{ wxBitmap bmp_new(new_xpm); wxBitmap bmp_open(open_xpm); wxBitmap bmp_save(save_xpm); @@ -138,13 +139,17 @@ void wxGUIEditorGraphicBBS::initToolbar() { wxBitmap bmp_redo(redo_xpm); wxBitmap bmp_editProperties(editProperties_xpm); wxBitmap bmp_showTree(showTree_xpm); - wxToolBar *toolbar = new wxToolBar(this, wxID_ANY); + +// wxToolBar *toolbar = new wxToolBar(this, wxID_ANY); + wxToolBar *toolbar = CreateToolBar(); //Adds a tool btn to the toolbar toolbar->AddTool(ID_NEW, _T("New"), bmp_new, wxNullBitmap, wxITEM_NORMAL, _T("New tab"), _T("Create a new panel tab")); + toolbar->AddTool(ID_OPEN, _T("Open diagram"), bmp_open, wxNullBitmap, wxITEM_NORMAL, _T("Open a diagram"), _T("Open a diagram")); + toolbar->AddTool(ID_SAVE_DIAGRAM, _T("Save Diagram"), bmp_save, wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH @@ -165,7 +170,14 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->AddSeparator(); toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm, wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box")); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 toolbar->SetToggle(ID_BTNCOMPLEXBOX, true); +#else + printf ("EED Warnning. wxGUIEditorGraphicBBS::initToolbar >>> toolbar->SetToggle \n "); + // .. +#endif // RaC 2012 2nd HackFest - Now Complex inputs are any external input // toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"), @@ -191,6 +203,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->EnableTool(ID_EDITPROPERTIES, false); toolbar->AddTool(ID_SHOWTREE, _T("Show tree"),bmp_showTree, wxNullBitmap, wxITEM_NORMAL, _T("Show tree"), _T("Show tree")); + toolbar->EnableTool(ID_UNDO, false); toolbar->EnableTool(ID_REDO, false); @@ -198,6 +211,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->Realize(); SetToolBar(toolbar); + // connect command event handlers @@ -239,6 +253,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties)); Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree)); + } //========================================================================= void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() { @@ -553,6 +568,11 @@ void wxGUIEditorGraphicBBS::executeScript(std::string script) { command += " & "; #endif +#ifndef APPLE + command = "source ~/.profile; "+command; +#endif + + printf("RaC wxGUIEditorGraphicBBS::executeScript %s \n", command.c_str()); system(command.c_str()); } @@ -1537,24 +1557,41 @@ bool wxGUIEditorGraphicBBS::TryToOpenScriptComplexBox(std::string packageName ,s //========================================================================= bool wxGUIEditorGraphicBBS::TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox) { + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript Start\n "); Package::Pointer k; std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc; BlackBoxDescriptor::Pointer descriptor; + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 1\n "); k = GetBBTKFactory()->GetPackage(packageName); + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 2\n "); mapDesc = k->GetDescriptorMap(); + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 3\n "); descriptor = mapDesc[boxType]; + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 3.1 packageName:%s boxType:%s \n",packageName.c_str(), boxType.c_str() ); + + if (descriptor==NULL) printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 3.2\n AUUCHH "); + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 3.2\n "); bool result=false; - - if ( - ((descriptor->IsTypeOfScript_Application()==true) && (scriptApplication==true)) - || - ((descriptor->IsTypeOfScript_ComplexBox()==true) && (scriptComplexBox==true)) - ) +descriptor->IsTypeOfScript_Application(); + if (descriptor!=NULL) { - result=true; - OpenScript(descriptor->GetScriptFileName(),boxType); - } + if ( + ((descriptor->IsTypeOfScript_Application()==true) && (scriptApplication==true)) + || + ((descriptor->IsTypeOfScript_ComplexBox()==true) && (scriptComplexBox==true)) + ) + { + result=true; + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 4\n "); + OpenScript(descriptor->GetScriptFileName(),boxType); + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript 5\n "); + } // if descriptor Type + } else { + printf("EED ERROR wxGUIEditorGraphicBBS::TryToOpenScript >> The descriptor of this box not exists (packageName:%s boxType:%s) this is not normal\n",packageName.c_str(), boxType.c_str() ); + } // if descriptor NULL + + printf("EED wxGUIEditorGraphicBBS::TryToOpenScript END\n "); return result; }