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"
31 #include "creaDevManagerIds.h"
32 #include "wxCDMMainDescriptionPanel.h"
33 #include "wxCDMProjectActionsPanel.h"
34 #include "wxCDMNewProjectDialog.h"
41 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
42 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
43 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
44 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
45 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
46 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
47 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
48 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
49 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
50 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
51 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
52 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
53 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
54 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
55 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
56 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
57 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
58 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
59 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
60 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
61 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
62 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
63 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
64 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
65 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
66 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
69 wxCDMMainFrame::wxCDMMainFrame(
72 const wxString& caption,
78 Create(parent, id, caption, pos, size, style);
81 wxCDMMainFrame::~wxCDMMainFrame()
86 bool wxCDMMainFrame::Create(
89 const wxString& caption,
95 wxFrame::Create(parent, id, caption, pos, size, style);
96 this->model = new modelCDMMain();
102 void wxCDMMainFrame::CreateMenus()
104 wxMenuBar* menuBar = new wxMenuBar;
107 menu_File = new wxMenu();
108 menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project..."));
109 menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project..."));
110 menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent"));
111 menu_File->AppendSeparator();
112 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project"));
113 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects"));
114 menu_File->AppendSeparator();
115 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy..."));
116 menu_File->AppendSeparator();
117 menu_File->Append(ID_MENU_EXIT, wxString("E&xit"));
119 menuBar->Append(menu_File, wxString("&File"));
122 menu_Edit = new wxMenu();
123 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project"));
124 menu_Edit->AppendSeparator();
125 menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t"));
126 menu_Edit->Append(ID_MENU_COPY, wxString("&Copy"));
127 menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste"));
128 menu_Edit->AppendSeparator();
129 menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete"));
130 menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All"));
131 menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection"));
133 menuBar->Append(menu_Edit, wxString("&Edit"));
136 menu_Tools = new wxMenu();
137 menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log"));
138 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor"));
139 menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools"));
140 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor"));
141 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line"));
143 menuBar->Append(menu_Tools, wxString("&Tools"));
146 menu_Help = new wxMenu();
147 menu_Help->Append(ID_MENU_HELP, wxString("&Help"));
148 menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug"));
149 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager"));
150 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS"));
152 menuBar->Append(menu_Help, wxString("&Help"));
157 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
158 statusBar->SetFieldsCount(1);
159 SetStatusBar(statusBar);
163 void wxCDMMainFrame::CreateControls()
166 auiManager.SetManagedWindow(this);
169 tree_Projects = new wxCDMProjectsTreeCtrl(
174 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
176 tree_Projects->SetMinSize(wxSize(200,200));
178 panel_Properties = new wxCDMMainDescriptionPanel(
180 ID_WINDOW_PROPERTIES,
181 wxString("Description Panel"),
189 panel_ProjectActions = new wxCDMProjectActionsPanel(
191 ID_WINDOW_PROJ_ACTIONS,
192 wxString("Project Actions Panel"),
197 panel_ProjectActions->SetMinSize(wxSize(500, 100));
199 auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree"));
200 auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions"));
201 auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties"));
204 auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
205 auiManager.GetPane(panel_Properties).CloseButton(false);
210 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
212 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
214 userResponse = dialog->ShowModal();
216 if(userResponse == wxID_FORWARD)
219 std::cerr << "should create Project here" << std::endl;
220 //tree_Projects->BuildTree(this->model->GetActiveProjects());
225 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
228 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
229 wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style);
231 userResponse = FD->ShowModal();
232 if(userResponse == wxID_OK)
234 switch(this->controller->OpenProject(crea::wx2std (FD->GetPath())))
237 wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR);
241 wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR);
248 ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
255 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
257 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
260 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
262 std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
265 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
267 std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl;
270 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
272 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
275 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
277 std::cout << "Closing CreaDevManager..." << std::endl;
283 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
285 std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
288 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
290 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
293 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
295 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
298 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
300 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
303 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
305 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
308 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
310 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
313 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
315 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
320 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
322 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
325 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
327 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
330 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
332 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
335 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
337 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
340 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
342 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
347 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
349 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
352 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
354 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
357 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
359 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
362 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
364 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;