+ // connect command event handlers
+
+ Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+ Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
+ Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
+ Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram)); //DFCH
+ 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_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
+ Connect(
+ ID_BTEXECUTABLEBOX,
+ wxEVT_COMMAND_TOOL_CLICKED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnExecutableBox));
+ 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));
+ 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_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
+ Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree));
+
+
+}
+//=========================================================================
+void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() {
+ // JGRR & CM
+ _helpHtmlBrowser = new WxGUIHtmlBrowser(this, wxSize(200, 0));
+
+ // EO JGRR & CM
+
+}
+
+//=========================================================================
+void wxGUIEditorGraphicBBS::initMenu() {
+ // Create File menu and its items
+ wxMenu *fileMenu = new wxMenu();
+ fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
+ fileMenu->Append(ID_SAVE_DIAGRAM, _T("Save Diagram"), _T("Save Diagram")); //DFCH
+ fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save Diagram As"),
+ _T("Save Diagram As")); //DFCH
+ fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
+ // CM
+ fileMenu->Append(ID_OPEN, _T("Open a diagram"), _T("Open a diagram"));
+ fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
+ fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"),
+ _T("Save complex box"));
+ fileMenu->Append(ID_EXPORT_CONSOLEAPP, _T("Export console commands"),
+ _T("Export console execution commands"));
+ fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
+
+ Connect(ID_NEW, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+ Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
+ Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram));
+ Connect(ID_OPEN_BBS, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
+ Connect(ID_SAVE_AS_BBS, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
+ Connect( ID_SAVE_AS_COMPLEXBOX, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
+ Connect( ID_EXPORT_CONSOLEAPP, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExportConsoleExecCommand));
+ Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
+
+ // Create Edit menu and its items
+ wxMenu *editMenu = new wxMenu;
+ editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes"));
+ editMenu->Append(ID_EDIT_COMPLEXBOX_SCRIPT, _T("Edit Complex Box"), _T("Edit Complex Box"));
+ Connect( ID_COPY_TO_COMPLEXDIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
+ Connect( ID_EDIT_COMPLEXBOX_SCRIPT, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditComplexBoxScript));
+
+ // Create Help menu and its items
+ wxMenu *helpMenu = new wxMenu;
+ helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
+ helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
+ Connect(ID_HELP_BBEDITOR, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
+
+ // Create Tool menu
+ wxMenu *menuTools = new wxMenu;
+ menuTools->Append(ID_bbEditor_Tool_Menu_CreatePackage,
+ _T("Create &package") );
+ menuTools->Append(ID_bbEditor_Tool_Menu_CreateBlackBox,
+ _T("Create &blackbox") );
+ menuTools->Append(ID_bbEditor_Tool_Menu_PlugPackage, _T("Plug package") );
+ menuTools->Append(ID_bbEditor_Tool_Menu_EditConfig, _T("&Edit bbtk config") );
+ menuTools->Append(ID_bbEditor_Tool_Menu_ShowHTMLDoc,
+ _T("Show &HTML documentation") );
+ menuTools->Append(ID_bbEditor_Tool_Menu_CreateIndex, _T("&Generate index") );
+
+ Connect(ID_bbEditor_Tool_Menu_CreatePackage, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreatePackage));
+ Connect(ID_bbEditor_Tool_Menu_CreateBlackBox, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateBlackBox));
+ Connect(ID_bbEditor_Tool_Menu_PlugPackage, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnPlugPackage));
+ Connect(ID_bbEditor_Tool_Menu_EditConfig, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditConfig));
+ Connect(ID_bbEditor_Tool_Menu_ShowHTMLDoc, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowHTMLDoc));
+ Connect(ID_bbEditor_Tool_Menu_CreateIndex, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateIndex));
+
+ // Append the created menu to the menu bar
+ wxMenuBar *menuBar = new wxMenuBar();
+ menuBar->Append(fileMenu, _T("&File") );
+ menuBar->Append(editMenu, _T("&Edit") );
+ menuBar->Append(menuTools, _T("&Tool") );
+ menuBar->Append(helpMenu, _T("&Help") );
+
+ // Attach this menu bar to the frame
+ SetMenuBar(menuBar);
+}
+
+//=========================================================================
+void wxGUIEditorGraphicBBS::initTabPanelsManager()
+{
+ _notebook = new wxAuiNotebook(this, wxID_NOTEBOOK, wxDefaultPosition,
+ wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE
+ | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_FIXED_WIDTH
+ | wxAUI_NB_WINDOWLIST_BUTTON);
+ _tabsMgr = new wxTabPanelsManager(this);
+ _frameAUIMgr->AddPane(_notebook, wxAuiPaneInfo().CenterPane());
+}
+
+//=========================================================================
+void wxGUIEditorGraphicBBS::initPackageBrowser()
+{
+ _pkgBrowser = new WxGUIPackageBrowser2(this);
+ _pkgBrowser->IncludeAll();
+ _frameAUIMgr->AddPane(_pkgBrowser, wxAuiPaneInfo().Left().MinSize(30, 500).BestSize(750,500).CloseButton(false));
+}
+
+//================================================================
+
+void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc(const std::string& pack)
+{
+ std::string mess("Regenerating doc for package '");
+ if (pack != "-a") {
+ mess += pack + "'";
+ } else {
+ mess = "Regenerating doc for all packages";
+ }
+
+ mess += " ... please wait";
+
+ SetStatusText(std2wx(mess));
+
+ //BBTK_BUSY_CURSOR;
+
+ std::string command;
+#if defined(WIN32)
+ command = "\"";
+#endif
+ command += ConfigurationFile::GetInstance().Get_bin_path();
+ command += ConfigurationFile::GetInstance().Get_file_separator();
+ command += "bbRegeneratePackageDoc";
+#if defined(WIN32)
+ command += "\"";
+#endif
+
+ command += " " + pack + " -q";
+ bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+ if (!system(command.c_str())) {
+ SetStatusText(_T("Done !"));
+ /*
+ wxMessageBox(_T("Done !"),_T("Regenerate package '")
+ +std2wx(pack)+_T("' doc"),
+ wxOK | wxICON_INFORMATION);
+ */
+ } else {
+ SetStatusText(_T("Done !"));
+ wxString err(_T("An error occured while running '"));
+ err += bbtk::std2wx(command) + _T("'");
+ wxMessageBox(err, _T("Regenerate package doc"), wxOK | wxICON_ERROR);