]> Creatis software - bbtkGEditor.git/commitdiff
Added the possibility to delete all the boxes in the scene
authorcorredor <>
Wed, 5 May 2010 09:02:19 +0000 (09:02 +0000)
committercorredor <>
Wed, 5 May 2010 09:02:19 +0000 (09:02 +0000)
data/icons/wxart_delete.xpm [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h

diff --git a/data/icons/wxart_delete.xpm b/data/icons/wxart_delete.xpm
new file mode 100644 (file)
index 0000000..c2e7ca3
--- /dev/null
@@ -0,0 +1,42 @@
+/* XPM */
+static const char *delete_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 21 1",
+"2 c #A5AEBD",
+"* c #5478B4",
+"< c #95A3BB",
+"O c #9AA7BC",
+"; c #758EB7",
+"$ c #6986B6",
+"# c #4971B2",
+"& c #8A9CBA",
+"X c #8598B9",
+"  c None",
+"o c #ABB2BE",
+"- c #7F95B9",
+"= c #4E74B3",
+"1 c #A0ABBC",
+"+ c #6F8AB7",
+". c #B5B9BF",
+"@ c #3E69B1",
+", c #90A0BA",
+": c #6483B5",
+"> c #5A7BB4",
+"% c #5F7FB5",
+/* pixels */
+"                ",
+"    .Xo      OO ",
+"    +@#.    $@% ",
+"    &@@X  .*@*o ",
+"     =@= .*@*.  ",
+"     -@@X*@*.   ",
+"     .#@@@$.    ",
+"      ;@@:      ",
+"     ;@@@+      ",
+"   .>@#%@@.     ",
+"  o*@*oO@@,     ",
+" <#@*. .@@=     ",
+"&@@$    :@@1    ",
+";#&     2#>.    ",
+"                "
+};
index 3a5c196f86eb0e1a9a71079362edcb506d19dffa..1e325329ed126f41586323d971cd538c3ca15307 100644 (file)
@@ -688,7 +688,7 @@ namespace bbtk
                                for(int i=0;i<_selectedObjects.size();i++)
                                {
                                        int id = _selectedObjects[i];
-                                       removeObject(id);
+                                       deleteObject(id);
                                }
                                _selectedObjects.clear();
                        }
@@ -699,7 +699,7 @@ namespace bbtk
 
        //=========================================================================
 
-       void wxVtkSceneManager::removeObject(int id)
+       void wxVtkSceneManager::deleteObject(int id)
        {
                GObjectController *control = _controllers[id];
                std::vector<int> controllersToRemove;
@@ -920,6 +920,29 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxVtkSceneManager::deleteAllBoxes()
+       {
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;           
+                       cont->removeFromScene();
+                       unregisterController((InteractorStyleMaracas*)cont);
+               }
+               _selectedObjects.clear();
+               _controllers.clear();   
+               refreshScene();
+       }
+
+       //=========================================================================
+
+       void wxVtkSceneManager::refreshScene()
+       {
+               _baseView->RefreshView();
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index 172aaf75a54f55e7c2d31519828e73f5407d670c..0f795e8d6eb42163d2573940f32dc23e26aef9ec 100644 (file)
@@ -115,7 +115,10 @@ namespace bbtk
                void displayBlackBoxInfo(std::string packageName, std::string boxName);
                void updateStatusBar(std::string textStatus);
                std::string getDiagramScript();
-               void removeObject(int id);
+               void deleteObject(int id);
+               void deleteAllBoxes();
+
+               void refreshScene();
 
                
        private:
index 71ae3dff5a6a99083420aa90ed5c5971e20cbf4c..7f8e8ac21699f6c4af3470e4cc5d588aacf1f4fd 100644 (file)
@@ -84,24 +84,26 @@ namespace bbtk
 
        //=========================================================================
        void wxGUIEditorGraphicBBS::initToolbar()
-       {       
-               //std::string filename= _dataDir + "/data/icons/wxart_new.xpm";   
+       {        
                wxBitmap bmp_new(new_xpm);
                wxBitmap bmp_run(run_xpm);
+               wxBitmap bmp_delete(delete_xpm);
 
                wxToolBar  *_toolbar = new wxToolBar(this, wxID_ANY);
 
                //Adds a tool btn to the toolbar
                _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_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
+               _toolbar->AddTool(1002,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
 
                _toolbar->SetMargins( 2, 2 );
                _toolbar->Realize();
                SetToolBar(_toolbar);
 
                // connect command event handlers
-               Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
-               Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
+               Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+               Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
+               Connect(1002,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
 
        }
        //=========================================================================
@@ -294,13 +296,8 @@ namespace bbtk
 
        //=========================================================================
 
-       void wxGUIEditorGraphicBBS::executeActualDiagram()
+       void wxGUIEditorGraphicBBS::executeScript(std::string script)
        {
-               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";
@@ -332,30 +329,39 @@ namespace bbtk
 
                command += " & ";
                  
-               printf ("RaC wxGUIEditorGraphicBBS::executeActualDiagram %s \n" , command.c_str() );
+               printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() );
                system( command.c_str() );
        }
 
+       //=========================================================================
+       // EVENT HANDLERS 
        //=========================================================================
 
-       /*****************************************************
-       /* HANDLERS 
-       /*****************************************************/
+       void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event)
+       {
+               _tabsMgr->addNewTab();          
+       }
 
-       void wxGUIEditorGraphicBBS::OnToolLeftClick(wxCommandEvent& event)
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event)
        {
-               switch (event.GetId())
-               {
-                       case 1000 :
-                               _tabsMgr->addNewTab();
-                       break;  
+               std::string script = _tabsMgr->getActualDiagramScript();
+               cout<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<<endl;
+               cout<<script<<endl;
 
-                       case 1001 :
-                               executeActualDiagram();
-                       break;  
-               }
+               executeScript(script);          
        }
 
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event)
+       {
+               _tabsMgr->deleteAllBoxesActualDiagram();
+       }
+
+       //=========================================================================
+
        void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
        {
                Close(true);
index 80d02cb452a70e7968cfe7477dd81b03525e7922..2994c616890919fd9a0b1c5ccb76a3695c9b97cd 100644 (file)
@@ -50,6 +50,7 @@
 //#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm" // JPR
 #include "wxart_new.xpm" // JPR
 #include "wxart_run.xpm"
+#include "wxart_delete.xpm"
 
 //Includes creaMaracasVisu
 
@@ -97,7 +98,7 @@ namespace bbtk
                wxAuiNotebook* getAuiNotebook();
                void displayBlackBoxInfo(std::string packageName, std::string boxName);
                void updateStatusBar(std::string textStatus);
-               void executeActualDiagram();
+               void executeScript(std::string script);
 
                void editBlackBox(GBlackBoxModel *bbmodel);
                void editDiagramParameters(wxVtkSceneManager* scene);
@@ -106,7 +107,9 @@ namespace bbtk
                void DoRegeneratePackageDoc(const std::string& pack);   
                void DoRegenerateBoxesLists();
 
-               void OnToolLeftClick(wxCommandEvent& event);
+               void OnCreateNewTab(wxCommandEvent& event);
+               void OnExecuteActualDiagram(wxCommandEvent& event);
+               void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
                void OnExit(wxCommandEvent& event);
 
 
index e2ead8fd058d6000e8d2c7a4a59b798da965e550..66dd7b04f70c1ffedcf999c7ed50f8a47a92ad9f 100644 (file)
@@ -140,6 +140,13 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGEditorTabPanel::deleteAllBoxes()
+       {
+               _sceneManager->deleteAllBoxes();
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index 6d6c39a3c0730c3119814ee2f0c2924e1107f508..a50bda3d0f2a42503f97f2c98488c1d44ea88cd0 100644 (file)
@@ -84,6 +84,7 @@ namespace bbtk
                std::string getDiagramScript();
                void editBlackBox(GBlackBoxModel *bbmodel);
                void editDiagramParameters(wxVtkSceneManager* scene);
+               void deleteAllBoxes();
                
        private:
 
index 1e9061e1dc7176d68addc78334b0eed71c43373e..6f6b9e94458a9883dd73f216d58653ebf5e2b2a2 100644 (file)
@@ -117,7 +117,12 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxTabPanelsManager::deleteAllBoxesActualDiagram()
+       {
+               _actual->deleteAllBoxes();
+       }
 
+       //=========================================================================
 
 }  // EO namespace bbtk
 
index 556a504cfc07c6cdfde8ef6dce36dd2e63b28f98..b41f027d32c0a0b45749fe9125a064125828c383 100644 (file)
@@ -77,6 +77,7 @@ namespace bbtk
                std::string getActualDiagramScript();
                void editBlackBox(GBlackBoxModel *bbmodel);
                void editDiagramParameters(wxVtkSceneManager* scene);
+               void deleteAllBoxesActualDiagram();
 
        private: