]> Creatis software - bbtkGEditor.git/commitdiff
Feature #1665 . RaC - New dialog to set diagrams properties and decide diagram type.
authorcorredor <>
Wed, 10 Oct 2012 13:24:24 +0000 (13:24 +0000)
committercorredor <>
Wed, 10 Oct 2012 13:24:24 +0000 (13:24 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index b21f7abf18dc82dc31f1e0ee003e3752c1e4c707..add1719f4bfe753f51afc4a923a93201b0eebfb2 100644 (file)
@@ -198,7 +198,7 @@ namespace bbtk {
        const int ID_REDO                                                                       =       1025;  // FCY
        const int ID_CHANGENAME                                                         =   1026;
 
-       const int ID_EDIT                                                                       =       1027;  // RaC
+       const int ID_EDITPROPERTIES                                                                     =       1027;  // RaC 2nd HackFest
 }
 // namespace bbtk
 #endif
index cdbb0e8644c7d96e041b7bd3b9fd9bb982a7f16f..b7fb989f9145d65c2075d126c8b34d9c5de0dd95 100644 (file)
@@ -139,9 +139,14 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        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"),
+
+       //toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"),
+       //              bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
+       //              _T("Add input to Complex box"), _T("Add input to Complex box"));
+       toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add external input (Complex box or console app)"),
                        bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
-                       _T("Add input to Complex box"), _T("Add input to Complex box"));
+                       _T("Add external input (Complex box or console app)"), _T("Add external input (Complex box or console app)"));
+
        toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT, _T("Add output to Complex box"),
                        bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,
                        _T("Add output Complex box"), _T("Add output Complex box"));
@@ -151,7 +156,8 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        toolbar->AddTool(ID_UNDO, _T("Undo"),bmp_undo, wxNullBitmap, wxITEM_NORMAL,     _T("Undo"), _T("Undo"));
        toolbar->AddTool(ID_REDO, _T("Redo"),bmp_redo, wxNullBitmap, wxITEM_NORMAL,     _T("Redo"), _T("Redo"));
        toolbar->AddSeparator();
-       toolbar->AddTool(ID_EDIT, _T("Edit diagram properties"),bmp_editProperties, wxNullBitmap, wxITEM_NORMAL,        _T("Edit diagram properties"), _T("Edit diagram properties"));
+       toolbar->AddTool(ID_EDITPROPERTIES, _T("Edit diagram properties"),bmp_editProperties, wxNullBitmap, wxITEM_NORMAL,      _T("Edit diagram properties"), _T("Edit diagram properties"));
+       toolbar->EnableTool(ID_EDITPROPERTIES, false);
        
        toolbar->EnableTool(ID_UNDO, false);
        toolbar->EnableTool(ID_REDO, false);
@@ -197,7 +203,7 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        Connect(ID_UNDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnUndo));
        Connect(ID_REDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnRedo));
        Connect(ID_CHANGENAME, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnChangeName));
-       Connect(ID_EDIT,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
+       Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
 
 }
 //=========================================================================
@@ -791,6 +797,7 @@ void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) {
 void wxGUIEditorGraphicBBS::refreshGUIControls() {
        std::string stundo;
        std::string stredo;
+       //RaC2012 2ndHackFest Next line seems weird ... To keep in mind for other devels
        wxToolBar* toolbar = GetToolBar();
        if (_tabsMgr->isActualDiagramComplexBox()) {
                toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
@@ -808,6 +815,9 @@ void wxGUIEditorGraphicBBS::refreshGUIControls() {
                GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true);
        }
 
+       //RaC2012 2ndHackFest
+       GetToolBar()->EnableTool(ID_EDITPROPERTIES,true);
+
        GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
        GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
        GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
@@ -909,11 +919,10 @@ void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) {
        wxToolBar* toolbar = GetToolBar();
        bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
        if (temp) {
-               _tabsMgr->setActualDiagramComplexBox(true);
+               enableComplexBox();
        } else {
-               _tabsMgr->setActualDiagramComplexBox(false);
+               disableComplexBox();
        }
-       refreshGUIControls();
 }
 
 //=========================================================================
@@ -1050,6 +1059,19 @@ void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) {
 
 //=========================================================================
 
+void wxGUIEditorGraphicBBS::enableComplexBox() {
+       _tabsMgr->setActualDiagramComplexBox(true);
+       refreshGUIControls();
+}
+
+//=========================================================================
+
+void wxGUIEditorGraphicBBS::disableComplexBox() {
+       _tabsMgr->setActualDiagramComplexBox(false);
+       refreshGUIControls();
+}
+
+//=========================================================================
 
 void wxGUIEditorGraphicBBS::setCurrentDiagramDescription(std::string description)
 {
@@ -1092,6 +1114,13 @@ std::string wxGUIEditorGraphicBBS::getCurrentDiagramCategory()
        return _tabsMgr->GetCategory();
 }
 
+//=========================================================================
+
+bool wxGUIEditorGraphicBBS::isCurrentDiagramComplexBox()
+{
+       return _tabsMgr->isActualDiagramComplexBox();
+}
+
 
 } // EO namespace bbtk
 
index 3095472384d836174ff197575401b14668e1c497..35d2f56985b82e0fa0f14b43a7d51081739c8bd2 100644 (file)
@@ -127,6 +127,7 @@ namespace bbtk
                        void editBlackBox(GBlackBoxModel *bbmodel);
 
                        bool boxNameExists(std::string boxname);
+                       bool isCurrentDiagramComplexBox();
 
                        // Checks and adds if necessary the .bbg/.bbs extensions
                        std::string CheckExtension (std::string filename, std::string extension);                       
@@ -182,8 +183,12 @@ namespace bbtk
                        void OnShowHTMLDoc(wxCommandEvent& event);
                        void OnCreateIndex(wxCommandEvent& event);
                
-                       // Getters and Setters of current diagram properties
                        // RaC-2012
+                       void enableComplexBox();
+                       void disableComplexBox();
+
+                       // Getters and Setters of current diagram properties
+
                        void setCurrentDiagramDescription(std::string description);
                        void setCurrentDiagramAuthor(std::string author);
                        void setCurrentDiagramCategory(std::string category);
index c9479f19d4fe4d8bbb54e39977dfc83a5669c314..4351e4a9eae357f568b33e5e2ee25ac10f5ab4da 100755 (executable)
@@ -40,7 +40,7 @@ namespace bbtk
 {
        //=========================================================================
 
-       wxDiagramPropertiesEditionDialog::wxDiagramPropertiesEditionDialog(wxGUIEditorGraphicBBS *parent):wxDialog(parent,wxID_ANY,_T("Diagram Properties"), wxDefaultPosition, wxSize(520, 640),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+       wxDiagramPropertiesEditionDialog::wxDiagramPropertiesEditionDialog(wxGUIEditorGraphicBBS *parent):wxDialog(parent,wxID_ANY,_T("Diagram Properties"), wxDefaultPosition, wxSize(420, 340),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
        {
                _parent = parent;
                constructDiagramPropertiesEditionDialog();
@@ -58,11 +58,28 @@ namespace bbtk
 
        void wxDiagramPropertiesEditionDialog::constructDiagramPropertiesEditionDialog()
        {
-
+               const int ID_COMBO = 1;
                wxPanel *panel = new wxPanel(this, -1);
                wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
-               wxFlexGridSizer *fgsizer = new wxFlexGridSizer(4, 2, 9, 25);
+               wxFlexGridSizer *fgsizer = new wxFlexGridSizer(5, 2, 9, 25);
+
+
+               // SELECTION CONSTANTS
+               // 0 - Application
+               // 1 - Complex box
+               _diagramType = new wxComboBox(panel, -1, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
+               _diagramType->Append (wxT("Application"));
+               _diagramType->Append (wxT("Complex box"));
+               _diagramType->SetEditable(false);
+               //_diagramType->Enable(false);
+
+               Connect(ID_COMBO, wxEVT_COMMAND_COMBOBOX_SELECTED,
+                                       wxCommandEventHandler(wxDiagramPropertiesEditionDialog::OnComboBoxSelected));
 
+               int currentType = (_parent->isCurrentDiagramComplexBox()==false)? 0 : 1;
+               _diagramType->Select(currentType);
+
+               wxStaticText *type = new wxStaticText(panel, -1, wxT("Type"));
                wxStaticText *author = new wxStaticText(panel, -1, wxT("Author"));
                wxStaticText *category = new wxStaticText(panel, -1, wxT("Category"));
                wxStaticText *description = new wxStaticText(panel, -1, wxT("Description"));
@@ -77,7 +94,14 @@ namespace bbtk
                Connect(okButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickOk));
                Connect(closeButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickClose));
 
+               // Assign loaded values
+               _txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
+               _txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
+               _txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
+
 
+               fgsizer->Add(type);
+               fgsizer->Add(_diagramType, 1, wxEXPAND);
                fgsizer->Add(author);
                fgsizer->Add(_txtAuthor, 1, wxEXPAND);
                fgsizer->Add(category);
@@ -87,7 +111,7 @@ namespace bbtk
                fgsizer->Add(okButton, 1, wxEXPAND);
                fgsizer->Add(closeButton, 1, wxEXPAND);
 
-               fgsizer->AddGrowableRow(2, 1);
+               fgsizer->AddGrowableRow(3, 1);
                fgsizer->AddGrowableCol(1, 1);
 
                hbox->Add(fgsizer, 1, wxALL | wxEXPAND, 15);
@@ -98,7 +122,6 @@ namespace bbtk
                Destroy();
 
                // Assign loaded values
-
                _txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
                _txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
                _txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
@@ -115,6 +138,16 @@ namespace bbtk
                _parent->setCurrentDiagramAuthor(txtAuthor);
                _parent->setCurrentDiagramCategory(txtCategory);
                _parent->setCurrentDiagramDescription(txtDescription);
+
+               // SELECTION CONSTANTS
+               // 0 - Application
+               // 1 - Complex box
+               int selection = _diagramType->GetSelection();
+               if(selection == 0)
+                       _parent->disableComplexBox();
+               else if (selection == 1)
+                       _parent->enableComplexBox();
+
                Close(true);
        }
 
@@ -128,6 +161,11 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxDiagramPropertiesEditionDialog::OnComboBoxSelected(wxCommandEvent& event)
+       {
+               // TODO Show info to edit complex boxes
+       }
+
        //=========================================================================
        
 
index 4e2008e4bd270e7f4bac436c4e8eec82af19f3c9..daa9447a2ff951488cb635c2d912657bde655be3 100755 (executable)
@@ -51,6 +51,7 @@ Version:   $Revision$
 //Includes wxWidgets
 #include <wx/wx.h>
 #include <wx/aui/aui.h>
+#include <wx/combobox.h>
 
 //Includes creaMaracasVisu
 
@@ -76,6 +77,7 @@ namespace bbtk
 
                void onClickOk(wxCommandEvent& event);
                void onClickClose(wxCommandEvent& event);
+               void OnComboBoxSelected(wxCommandEvent& event);
                
        private:
                wxAuiManager *_dialogAUIMgr;
@@ -84,7 +86,7 @@ namespace bbtk
                wxTextCtrl *_txtAuthor;
                wxTextCtrl *_txtCategory;
                wxTextCtrl *_txtDescription;
-               
+               wxComboBox *_diagramType;
 
        
        protected:
index afaa01b68be3a006d4ae539e6be8285583ec1239..bc9e4b53033c649d7a2ce7250bfdd11ae6e4487f 100644 (file)
@@ -2705,6 +2705,7 @@ std::string wxVtkSceneManager::GetCategory() {
 //=========================================================================
 void wxVtkSceneManager::SetDescription(std::string description) {
        _Description = description;
+       std::cout<<"Description:"<<_Description<<std::endl;
        if (_Description == "") {
                _Description = "<description of the box>";
        }