]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
std::string vs wxString
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index 12708e34400425a58447bfa5a7e9e2f95dca78a3..f4e7fddcad34b474c2176e1aa557e24d9a52ec83 100644 (file)
@@ -34,6 +34,7 @@ Version:   $Revision$
 */
 
 #include "bbtkwxGUIEditorGraphicBBS.h"
+#include "creaWx.h"
 
 namespace bbtk
 {
@@ -91,14 +92,16 @@ namespace bbtk
                wxToolBar  *_toolbar = new wxToolBar(this, wxID_ANY);
 
                //Adds a tool btn to the toolbar
-               _toolbar->AddTool(wxID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
+               _toolbar->AddTool(1000,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
+               _toolbar->AddTool(1001,_T("Execute"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
 
                _toolbar->SetMargins( 2, 2 );
                _toolbar->Realize();
                SetToolBar(_toolbar);
 
                // connect command event handlers
-               Connect(wxID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
+               Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
+               Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
 
        }
        //=========================================================================
@@ -154,7 +157,7 @@ namespace bbtk
        void wxGUIEditorGraphicBBS::initPropertiesPanel()
        {
                _propertiesPanel = new wxPropertiesPanel(this);
-               _frameAUIMgr->AddPane(_propertiesPanel,wxAuiPaneInfo().Right().MinSize(200,200).CloseButton(false).Floatable(false));
+               //_frameAUIMgr->AddPane(_propertiesPanel,wxAuiPaneInfo().Right().MinSize(200,200).CloseButton(false).Floatable(false));
        }
 
        //================================================================
@@ -276,6 +279,73 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel)
+       {
+               wxEditionDialog* dialog = new wxEditionDialog(this,bbmodel);
+               dialog->Show();
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::editDiagramParameters(wxVtkSceneManager* scene)
+       {
+               wxEditionDialog* dialog = new wxEditionDialog(this,scene);
+               dialog->Show();
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
+       {
+               SetStatusText(crea::std2wx(textStatus));
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::executeActualDiagram()
+       {
+               std::string script = _tabsMgr->getActualDiagramScript();
+               cout<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<<endl;
+               cout<<script<<endl;
+
+
+               std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
+               std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
+               std::string filename = dir + separator + "tmp_bbtk.bbs";
+               
+               ofstream tempFile;
+               tempFile.open(filename.c_str());
+               tempFile << script;
+               tempFile.close();
+               
+               std::string command = "\"";
+
+               #ifdef WIN32
+                       command += "\"";
+               #endif
+
+               //command += ConfigurationFile::GetInstance().Get_bin_path();
+               command +="C:/RaC/CREATIS/bbtkBIN/RelWithDebInfo//";
+
+               #ifdef MACOSX
+                       command += separator + "bbi.app/Contents/MacOS/bbi\" ";
+               #else 
+                       command += separator + "bbi\" ";
+               #endif
+               command += "\""+filename + "\"";
+
+               #ifdef WIN32
+                       command += "\"";
+               #endif
+
+               command += " & ";
+                 
+               printf ("RaC wxGUIEditorGraphicBBS::executeActualDiagram %s \n" , command.c_str() );
+               system( command.c_str() );
+       }
+
+       //=========================================================================
+
        /*****************************************************
        /* HANDLERS 
        /*****************************************************/
@@ -284,9 +354,13 @@ namespace bbtk
        {
                switch (event.GetId())
                {
-               case wxID_NEW :
-                       _tabsMgr->addNewTab();
-                       break;                  
+                       case 1000 :
+                               _tabsMgr->addNewTab();
+                       break;  
+
+                       case 1001 :
+                               executeActualDiagram();
+                       break;  
                }
        }