]> Creatis software - bbtkGEditor.git/commitdiff
Buttons to define a complexbox
authorcorredor <>
Fri, 14 May 2010 11:41:04 +0000 (11:41 +0000)
committercorredor <>
Fri, 14 May 2010 11:41:04 +0000 (11:41 +0000)
data/icons/wxart_complexbox.xpm [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
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_complexbox.xpm b/data/icons/wxart_complexbox.xpm
new file mode 100644 (file)
index 0000000..6f0d5e3
--- /dev/null
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * complexbox_xpm[] = {
+"17 15 3 1",
+"      c None",
+".     c #101010",
+"+     c #404040",
+" ............... ",
+" .             . ",
+" .             . ",
+" .  +++++++++  . ",
+" .  +++++++++  . ",
+" .  ++         . ",
+" .  ++         . ",
+" .  ++         . ",
+" .  ++         . ",
+" .  ++         . ",
+" .  +++++++++  . ",
+" .  +++++++++  . ",
+" .             . ",
+" .             . ",
+" ............... ",
+};
index 7b539777420bbc7e70f2178227826a5988db5801..7405a962b928b1d00d4a1fe10d8e4369d4d6d991 100644 (file)
@@ -139,6 +139,8 @@ namespace bbtk
        const int ID_DELETEALL = 1004;
        const int ID_CENTERVIEW = 1005;
        const int ID_BTNCOMPLEXBOX = 1006;
+       const int ID_ADDCOMPLEXBOXINPUT = 1007;
+       const int ID_ADDCOMPLEXBOXOUTPUT = 1008;
 
        const int wxID_NOTEBOOK = 1010;
 }
index 2b081d8f4b49c45b1c4f9acb7b3d4c1d44a56859..39f1237a99d7524167b9a6bff1e686a87ec91ffb 100644 (file)
@@ -48,6 +48,7 @@ namespace bbtk
                _idManager=idManager;
                _baseView=baseView;
                _startDragging=false;
+               _isComplexBox=false;
 
                if( _baseView!=NULL )
                {
@@ -1233,6 +1234,20 @@ namespace bbtk
        }
 
        //=========================================================================
+       
+       bool wxVtkSceneManager::isComplexBox()
+       {
+               return _isComplexBox;
+       }
+
+       //=========================================================================
+
+       void wxVtkSceneManager::setComplexBox(bool val)
+       {
+               _isComplexBox=val;
+       }
+
+       //=========================================================================
 
 }  // EO namespace bbtk
 
index 36a2168b5fb62139c311b7c5328d3066886bf6b1..3479c2a72356e5cb4eedcb9e62e9a127f7c2be6f 100644 (file)
@@ -125,6 +125,9 @@ namespace bbtk
                std::vector<int> getBoxes();
                std::vector<int> getConnections();
 
+               bool isComplexBox();
+               void setComplexBox(bool val);
+
                
        private:
 
@@ -148,6 +151,8 @@ namespace bbtk
                //Saves the id's of the selected objects in the controllers map
                std::vector<int> _selectedObjects;
 
+               bool _isComplexBox;
+
        protected:
 
        };
index 5a7d8311bb0f1f956b185f8d5e5c7c772ad9c385..871160ae384f3a609817531b5307619f227e105a 100644 (file)
@@ -91,6 +91,7 @@ namespace bbtk
                wxBitmap bmp_run(run_xpm);
                wxBitmap bmp_delete(delete_xpm);
                wxBitmap bmp_centerview(centerview_xpm);
+               wxBitmap bmp_complexbox(complexbox_xpm);
 
                wxToolBar  *toolbar = new wxToolBar(this, wxID_ANY);
 
@@ -102,8 +103,12 @@ namespace bbtk
                toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
                toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
                toolbar->AddSeparator();
-               toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
+               toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
                toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
+               toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
+               toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT,_T("Add output to Complex box"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Add output Complex box"), _T("Add output Complex box"));
+               toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+               toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
                
                toolbar->SetMargins( 2, 2 );
                toolbar->Realize();
@@ -116,7 +121,9 @@ namespace bbtk
                Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
                Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
                Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
-               Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnActivateComplexBox));
+               Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
+               Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
+               Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
 
        }
        //=========================================================================
@@ -352,7 +359,8 @@ namespace bbtk
 
        void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event)
        {
-               _tabsMgr->addNewTab();          
+               _tabsMgr->addNewTab();  
+               refreshToolbar();
        }
 
        //=========================================================================
@@ -402,6 +410,33 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::refreshToolbar()
+       {
+               wxToolBar* toolbar = GetToolBar();
+               if(_tabsMgr->isActualDiagramComplexBox())
+               {
+                       toolbar->ToggleTool(ID_BTNCOMPLEXBOX,true);
+               }
+               else
+               {
+                       toolbar->ToggleTool(ID_BTNCOMPLEXBOX,false);
+               }
+
+               bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
+               if(temp)
+               {
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true);
+               }
+               else
+               {
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
+               }
+       }
+
+       //=========================================================================
+
        void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event)
        {
                wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Are you sure to delete all boxes of the diagram?"), wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
@@ -442,10 +477,36 @@ namespace bbtk
 
        //=========================================================================
 
-       void wxGUIEditorGraphicBBS::OnActivateComplexBox(wxCommandEvent& event)
-       {               
+       void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
+       {
+               wxToolBar* toolbar = GetToolBar();
+               bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
+               if(temp)
+               {
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true);
+                       _tabsMgr->setActualDiagramComplexBox(true);
+               }
+               else
+               {
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
+                       _tabsMgr->setActualDiagramComplexBox(false);
+               }
+               
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event)
+       {
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event)
+       {
        }
-       
 
        //=========================================================================
 
index aa8ad2a54109681ae3a6d5b9745bf0459f4f9f94..1e472adb7e927f5d23a87854c6a71d8c283c4a36 100644 (file)
@@ -56,6 +56,7 @@
 #include "wxart_run.xpm"
 #include "wxart_delete.xpm"
 #include "wxart_centerview.xpm"
+#include "wxart_complexbox.xpm"
 
 //Includes creaMaracasVisu
 
@@ -112,13 +113,17 @@ namespace bbtk
                void DoRegeneratePackageDoc(const std::string& pack);   
                void DoRegenerateBoxesLists();
 
+               void refreshToolbar();
+
                void OnCreateNewTab(wxCommandEvent& event);
                void OnOpenDiagram(wxCommandEvent& event);
                void OnSaveActualDiagram(wxCommandEvent& event);
                void OnExecuteActualDiagram(wxCommandEvent& event);
                void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
                void OnCenterViewActualDiagram(wxCommandEvent& event);
-               void OnActivateComplexBox(wxCommandEvent& event);
+               void OnClickBtnComplexBox(wxCommandEvent& event);
+               void OnAddComplexBoxInput(wxCommandEvent& event);
+               void OnAddComplexBoxOutput(wxCommandEvent& event);
                void OnExit(wxCommandEvent& event);
 
 
index 4cfa95df5f445f23c3379582cb2023b7ecfc111a..3c4081eddfb66648908924312f469b0178838c55 100644 (file)
@@ -175,6 +175,20 @@ namespace bbtk
 
        //=========================================================================
 
+       bool wxGEditorTabPanel::isComplexBox()
+       {
+               return _sceneManager->isComplexBox();
+       }
+
+       //=========================================================================
+
+       void wxGEditorTabPanel::setComplexBox(bool val)
+       {
+               _sceneManager->setComplexBox(val);
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index c3a9a771ec3d0af6a9f893caddbd32bfbb1e4e78..af9897ae856080663beeacf5aac6a80261c817f6 100644 (file)
@@ -89,6 +89,8 @@ namespace bbtk
                void saveDiagram(std::string &content);
                void loadDiagram(ifstream &inputStream);
                int getPanelId();
+               bool isComplexBox();
+               void setComplexBox(bool val);
 
        //=========================================================================
                
index 97fa011480421f0d31f0e5f11119b49694f60e8a..4b064566ba64e08b698c6d5466bef9d89c5b277c 100644 (file)
@@ -144,12 +144,27 @@ namespace bbtk
 
        //=========================================================================
 
+       bool wxTabPanelsManager::isActualDiagramComplexBox()
+       {
+               return _actual->isComplexBox();
+       }
+
+       //=========================================================================
+
+       void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
+       {
+               _actual->setComplexBox(val);    
+       }
+
+       //=========================================================================
+
        void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
        {
                int index = event.GetSelection();
                wxGEditorTabPanel* tab =(wxGEditorTabPanel*)_notebook->GetPage(index);          
                int id = tab->getPanelId();
-               _actual = _panels[id];  
+               _actual = _panels[id];
+               _parent->refreshToolbar();
        }
 
        //=========================================================================
index 3cdfcdeb33a1ea24eb81bcd9e090a4b9d9069bd3..5ac62f4d60a1d75a65a5f19adbf9b032707a723a 100644 (file)
@@ -81,6 +81,8 @@ namespace bbtk
                void centerViewActualDiagram();
                void saveActualDiagram(std::string &content);
                void loadDiagram(ifstream &inputStream);
+               bool isActualDiagramComplexBox();
+               void setActualDiagramComplexBox(bool val);
                
                void OnTabChanged(wxAuiNotebookEvent& event);