2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------ */
26 #include "wxCDMMainFrame.h"
28 #include "creaDevManagerIds.h"
29 #include "wxCDMMainDescriptionPanel.h"
30 #include "wxCDMProjectActionsPanel.h"
31 #include "wxCDMNewProjectDialog.h"
38 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
39 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
40 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
41 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
42 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
43 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
44 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
45 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
46 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
47 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
48 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
49 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
50 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
51 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
52 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
53 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
54 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
55 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
56 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
57 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
58 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
59 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
60 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
61 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
62 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
63 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
66 wxCDMMainFrame::wxCDMMainFrame(
69 const wxString& caption,
75 Create(parent, id, caption, pos, size, style);
78 wxCDMMainFrame::~wxCDMMainFrame()
83 bool wxCDMMainFrame::Create(
86 const wxString& caption,
92 wxFrame::Create(parent, id, caption, pos, size, style);
93 this->model = new modelCDMMain();
99 void wxCDMMainFrame::CreateMenus()
101 wxMenuBar* menuBar = new wxMenuBar;
104 menu_File = new wxMenu();
105 menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project..."));
106 menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project..."));
107 menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent"));
108 menu_File->AppendSeparator();
109 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project"));
110 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects"));
111 menu_File->AppendSeparator();
112 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy..."));
113 menu_File->AppendSeparator();
114 menu_File->Append(ID_MENU_EXIT, wxString("E&xit"));
116 menuBar->Append(menu_File, wxString("&File"));
119 menu_Edit = new wxMenu();
120 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project"));
121 menu_Edit->AppendSeparator();
122 menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t"));
123 menu_Edit->Append(ID_MENU_COPY, wxString("&Copy"));
124 menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste"));
125 menu_Edit->AppendSeparator();
126 menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete"));
127 menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All"));
128 menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection"));
130 menuBar->Append(menu_Edit, wxString("&Edit"));
133 menu_Tools = new wxMenu();
134 menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log"));
135 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor"));
136 menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools"));
137 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor"));
138 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line"));
140 menuBar->Append(menu_Tools, wxString("&Tools"));
143 menu_Help = new wxMenu();
144 menu_Help->Append(ID_MENU_HELP, wxString("&Help"));
145 menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug"));
146 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager"));
147 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS"));
149 menuBar->Append(menu_Help, wxString("&Help"));
154 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
155 statusBar->SetFieldsCount(1);
156 SetStatusBar(statusBar);
160 void wxCDMMainFrame::CreateControls()
163 auiManager.SetManagedWindow(this);
166 tree_Projects = new wxCDMProjectsTreeCtrl(
171 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
173 tree_Projects->SetMinSize(wxSize(200,200));
175 panel_Properties = new wxCDMMainDescriptionPanel(
177 ID_WINDOW_PROPERTIES,
178 wxString("Description Panel"),
186 panel_ProjectActions = new wxCDMProjectActionsPanel(
188 ID_WINDOW_PROJ_ACTIONS,
189 wxString("Project Actions Panel"),
194 panel_ProjectActions->SetMinSize(wxSize(500, 100));
196 auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree"));
197 auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions"));
198 auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties"));
201 auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
202 auiManager.GetPane(panel_Properties).CloseButton(false);
207 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
209 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
211 userResponse = dialog->ShowModal();
213 if(userResponse == wxID_FORWARD)
216 std::cerr << "should create Project here" << std::endl;
217 //tree_Projects->BuildTree(this->model->GetActiveProjects());
222 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
225 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
226 wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style);
228 userResponse = FD->ShowModal();
229 if(userResponse == wxID_OK)
231 switch(this->controller->OpenProject(crea::wx2std (FD->GetPath())))
234 wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR);
238 wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR);
245 ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
252 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
254 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
257 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
259 std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
262 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
264 std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl;
267 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
269 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
272 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
274 std::cout << "Closing CreaDevManager..." << std::endl;
280 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
282 std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
285 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
287 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
290 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
292 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
295 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
297 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
300 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
302 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
305 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
307 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
310 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
312 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
317 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
319 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
322 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
324 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
327 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
329 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
332 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
334 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
337 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
339 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
344 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
346 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
349 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
351 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
354 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
356 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
359 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
361 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;