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
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"));
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);
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));
}
//=========================================================================
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);
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));
wxToolBar* toolbar = GetToolBar();
bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
if (temp) {
- _tabsMgr->setActualDiagramComplexBox(true);
+ enableComplexBox();
} else {
- _tabsMgr->setActualDiagramComplexBox(false);
+ disableComplexBox();
}
- refreshGUIControls();
}
//=========================================================================
//=========================================================================
+void wxGUIEditorGraphicBBS::enableComplexBox() {
+ _tabsMgr->setActualDiagramComplexBox(true);
+ refreshGUIControls();
+}
+
+//=========================================================================
+
+void wxGUIEditorGraphicBBS::disableComplexBox() {
+ _tabsMgr->setActualDiagramComplexBox(false);
+ refreshGUIControls();
+}
+
+//=========================================================================
void wxGUIEditorGraphicBBS::setCurrentDiagramDescription(std::string description)
{
return _tabsMgr->GetCategory();
}
+//=========================================================================
+
+bool wxGUIEditorGraphicBBS::isCurrentDiagramComplexBox()
+{
+ return _tabsMgr->isActualDiagramComplexBox();
+}
+
} // EO 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);
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);
{
//=========================================================================
- 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();
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"));
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);
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);
Destroy();
// Assign loaded values
-
_txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
_txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
_txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
_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);
}
//=========================================================================
+ void wxDiagramPropertiesEditionDialog::OnComboBoxSelected(wxCommandEvent& event)
+ {
+ // TODO Show info to edit complex boxes
+ }
+
//=========================================================================
//Includes wxWidgets
#include <wx/wx.h>
#include <wx/aui/aui.h>
+#include <wx/combobox.h>
//Includes creaMaracasVisu
void onClickOk(wxCommandEvent& event);
void onClickClose(wxCommandEvent& event);
+ void OnComboBoxSelected(wxCommandEvent& event);
private:
wxAuiManager *_dialogAUIMgr;
wxTextCtrl *_txtAuthor;
wxTextCtrl *_txtCategory;
wxTextCtrl *_txtDescription;
-
+ wxComboBox *_diagramType;
protected:
//=========================================================================
void wxVtkSceneManager::SetDescription(std::string description) {
_Description = description;
+ std::cout<<"Description:"<<_Description<<std::endl;
if (_Description == "") {
_Description = "<description of the box>";
}