/* # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Santé) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ #include "wxCDMMainFrame.h" #include "creaDevManagerIds.h" #include "wxCDMMainDescriptionPanel.h" #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" #include BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame) EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject) EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject) EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent) EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject) EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects) EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy) EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit) EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject) EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut) EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy) EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste) EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete) EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll) EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone) EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog) EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor) EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools) EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor) EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine) EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp) EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug) EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager) EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis) EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject) EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject) END_EVENT_TABLE() wxCDMMainFrame::wxCDMMainFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { Create(parent, id, caption, pos, size, style); } wxCDMMainFrame::~wxCDMMainFrame() { auiManager.UnInit(); } bool wxCDMMainFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { wxFrame::Create(parent, id, caption, pos, size, style); this->model = new modelCDMMain(); CreateMenus(); CreateControls(); return TRUE; } void wxCDMMainFrame::CreateMenus() { wxMenuBar* menuBar = new wxMenuBar; //FileMenu menu_File = new wxMenu(); menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project...")); menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project...")); menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent")); menu_File->AppendSeparator(); menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project")); menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects")); menu_File->AppendSeparator(); menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy...")); menu_File->AppendSeparator(); menu_File->Append(ID_MENU_EXIT, wxString("E&xit")); menuBar->Append(menu_File, wxString("&File")); //EditMenu menu_Edit = new wxMenu(); menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project")); menu_Edit->AppendSeparator(); menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t")); menu_Edit->Append(ID_MENU_COPY, wxString("&Copy")); menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste")); menu_Edit->AppendSeparator(); menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete")); menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All")); menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection")); menuBar->Append(menu_Edit, wxString("&Edit")); //ToolsMenu menu_Tools = new wxMenu(); menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log")); menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor")); menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools")); menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor")); menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line")); menuBar->Append(menu_Tools, wxString("&Tools")); //HelpMenu menu_Help = new wxMenu(); menu_Help->Append(ID_MENU_HELP, wxString("&Help")); menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug")); menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager")); menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS")); menuBar->Append(menu_Help, wxString("&Help")); //Set Bar SetMenuBar(menuBar); wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP); statusBar->SetFieldsCount(1); SetStatusBar(statusBar); } void wxCDMMainFrame::CreateControls() { auiManager.SetManagedWindow(this); tree_Projects = new wxCDMProjectsTreeCtrl( this, ID_TREE_PROJECTS, wxDefaultPosition, wxSize(300,400), wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS ); tree_Projects->SetMinSize(wxSize(200,200)); panel_Properties = new wxCDMMainDescriptionPanel( this, ID_WINDOW_PROPERTIES, wxString("Description Panel"), wxDefaultPosition, wxSize(300, 400), 0 ); panel_ProjectActions = new wxCDMProjectActionsPanel( this, ID_WINDOW_PROJ_ACTIONS, wxString("Project Actions Panel"), wxDefaultPosition, wxSize(600,200), 0 ); panel_ProjectActions->SetMinSize(wxSize(500, 100)); auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree")); auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions")); auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties")); auiManager.Update(); auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true); auiManager.GetPane(panel_Properties).CloseButton(false); } //Event Handlers //File menu void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) { wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this); long userResponse; userResponse = dialog->ShowModal(); if(userResponse == wxID_FORWARD) { //TODO createProject std::cerr << "should create Project here" << std::endl; //tree_Projects->BuildTree(this->model->GetActiveProjects()); } event.Skip(); } void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) { /* long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST; wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style); long userResponse; userResponse = FD->ShowModal(); if(userResponse == wxID_OK) { switch(this->controller->OpenProject(crea::wx2std (FD->GetPath()))) { case 1: wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR); event.Skip(); break; case 2: wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR); event.Skip(); break; case 0: break; }; ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects()); auiManager.Update(); } */ event.Skip(); } void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event) { std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event) { std::cerr << "Event OnMenuCloseProject not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event) { std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event) { std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event) { std::cout << "Closing CreaDevManager..." << std::endl; Close(); event.Skip(); } //Edit Menu void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event) { std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event) { std::cerr << "Event OnMenuMenuCut not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event) { std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event) { std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event) { std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event) { std::cerr << "Event OnMenuSelectAll not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event) { std::cerr << "Event OnMenuSelectNone not implemented" << std::endl; event.Skip(); } //Tools Menu void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event) { std::cerr << "Event OnMenuEventLog not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event) { std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event) { std::cerr << "Event OnMenuMiniTools not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event) { std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event) { std::cerr << "Event OnMenuCommandLine not implemented" << std::endl; event.Skip(); } //Help Menu void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event) { std::cerr << "Event OnMenuHelp not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event) { std::cerr << "Event OnMenuReportBug not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event) { std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl; event.Skip(); } void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event) { std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl; event.Skip(); }