2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
29 #include "wxCDMMainFrame.h"
34 #include "CDMUtilities.h"
36 #include "creaDevManagerIds.h"
37 #include "wxCDMMainDescriptionPanel.h"
38 #include "wxCDMProjectActionsPanel.h"
39 #include "wxCDMNewProjectDialog.h"
42 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
43 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
44 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
45 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
46 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
47 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
48 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
49 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
50 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
51 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
52 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
53 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
54 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
55 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
56 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
57 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
58 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
59 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
60 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
61 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
62 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
63 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
64 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
65 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
66 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
67 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
70 wxCDMMainFrame::wxCDMMainFrame(
73 const wxString& caption,
79 Create(parent, id, caption, pos, size, style);
82 wxCDMMainFrame::~wxCDMMainFrame()
87 bool wxCDMMainFrame::Create(
90 const wxString& caption,
96 wxFrame::Create(parent, id, caption, pos, size, style);
97 this->model = new modelCDMMain();
103 void wxCDMMainFrame::CreateMenus()
105 wxMenuBar* menuBar = new wxMenuBar;
108 menu_File = new wxMenu();
109 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
110 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
111 menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
112 menu_File->AppendSeparator();
113 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
114 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
115 menu_File->AppendSeparator();
116 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
117 menu_File->AppendSeparator();
118 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
120 menuBar->Append(menu_File, wxT("&File"));
123 menu_Edit = new wxMenu();
124 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
125 menu_Edit->AppendSeparator();
126 menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
127 menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
128 menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
129 menu_Edit->AppendSeparator();
130 menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
131 menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
132 menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
134 menuBar->Append(menu_Edit, wxT("&Edit"));
137 menu_Tools = new wxMenu();
138 menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
139 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
140 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
141 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
142 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
144 menuBar->Append(menu_Tools, wxT("&Tools"));
147 menu_Help = new wxMenu();
148 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
149 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
150 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
151 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
153 menuBar->Append(menu_Help, wxT("&Help"));
158 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
159 statusBar->SetFieldsCount(1);
160 SetStatusBar(statusBar);
164 void wxCDMMainFrame::CreateControls()
167 auiManager.SetManagedWindow(this);
170 tree_Projects = new wxCDMProjectsTreeCtrl(
175 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
177 tree_Projects->SetMinSize(wxSize(200,200));
179 panel_Properties = new wxCDMMainDescriptionPanel(
181 ID_WINDOW_PROPERTIES,
182 wxT("Description Panel"),
190 panel_ProjectActions = new wxCDMProjectActionsPanel(
192 ID_WINDOW_PROJ_ACTIONS,
193 wxT("Project Actions Panel"),
198 panel_ProjectActions->SetMinSize(wxSize(500, 100));
200 auiManager.AddPane(tree_Projects, wxLEFT, wxT("Projects Tree"));
201 auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
202 auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
205 auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
206 auiManager.GetPane(panel_Properties).CloseButton(false);
211 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
213 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
215 userResponse = dialog->ShowModal();
217 if(userResponse == wxID_FORWARD)
220 std::cerr << "should create Project here" << std::endl;
221 //tree_Projects->BuildTree(this->model->GetActiveProjects());
226 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
228 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
229 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
231 userResponse = FD->ShowModal();
232 if(userResponse == wxID_OK)
234 std::cout << "selection: " << crea::wx2std (FD->GetPath()) << std::endl;
235 std::string path = CDMUtilities::fixPath(crea::wx2std (FD->GetPath()));
236 std::cout << "fixed selection: " << path << std::endl;
238 if (!this->model->OpenProject(path, result))
240 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
243 //TODO: Create tree control
244 //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
251 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
253 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
256 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
258 std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
261 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
263 std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl;
266 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
268 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
271 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
273 std::cout << "Closing CreaDevManager..." << std::endl;
279 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
281 std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
284 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
286 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
289 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
291 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
294 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
296 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
299 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
301 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
304 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
306 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
309 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
311 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
316 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
318 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
321 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
323 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
326 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
328 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
331 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
333 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
336 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
338 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
343 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
345 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
348 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
350 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
353 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
355 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
358 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
360 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;