From: corredor <> Date: Wed, 10 Oct 2012 13:24:24 +0000 (+0000) Subject: Feature #1665 . RaC - New dialog to set diagrams properties and decide diagram type. X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=40f10d74bf1374ff15b4c70409616ea4ee9564c7;p=bbtkGEditor.git Feature #1665 . RaC - New dialog to set diagrams properties and decide diagram type. --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index b21f7ab..add1719 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index cdbb0e8..b7fb989 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 3095472..35d2f56 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -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); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.cxx index c9479f1..4351e4a 100755 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.cxx @@ -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 + } + //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.h index 4e2008e..daa9447 100755 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxDiagramPropertiesEditionDialog.h @@ -51,6 +51,7 @@ Version: $Revision$ //Includes wxWidgets #include #include +#include //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: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index afaa01b..bc9e4b5 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -2705,6 +2705,7 @@ std::string wxVtkSceneManager::GetCategory() { //========================================================================= void wxVtkSceneManager::SetDescription(std::string description) { _Description = description; + std::cout<<"Description:"<<_Description<