1 #include "wxCreaDevManagerMainFrame.h"
2 #include "creaDevManagerIds.h"
4 #include "wxCreaDevManagerTreeCtrl.h"
6 #include "wxCreaDevManagerDescriptionPanel.h"
7 #include "wxCreaDevManagerProjectActionsPanel.h"
8 #include "wxCreaDevManagerNewProjectDialog.h"
9 #include "ControlCreaDevManagerMain.h"
11 #include <wx/dirdlg.h>
21 BEGIN_EVENT_TABLE(wxCreaDevManagerMainFrame, wxFrame)
22 EVT_MENU(ID_MENU_NEW_PROJECT, wxCreaDevManagerMainFrame::OnMenuNewProject)
23 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCreaDevManagerMainFrame::OnMenuOpenProject)
24 EVT_MENU(ID_MENU_OPEN_RECENT, wxCreaDevManagerMainFrame::OnMenuOpenRecent)
25 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCreaDevManagerMainFrame::OnMenuCloseProject)
26 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCreaDevManagerMainFrame::OnMenuCloseAllProjects)
27 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCreaDevManagerMainFrame::OnMenuExportHierarchy)
28 EVT_MENU(ID_MENU_EXIT, wxCreaDevManagerMainFrame::OnMenuExit)
29 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCreaDevManagerMainFrame::OnMenuRefreshProject)
30 EVT_MENU(ID_MENU_CUT, wxCreaDevManagerMainFrame::OnMenuMenuCut)
31 EVT_MENU(ID_MENU_COPY, wxCreaDevManagerMainFrame::OnMenuMenuCopy)
32 EVT_MENU(ID_MENU_PASTE, wxCreaDevManagerMainFrame::OnMenuMenuPaste)
33 EVT_MENU(ID_MENU_DELETE, wxCreaDevManagerMainFrame::OnMenuMenuDelete)
34 EVT_MENU(ID_MENU_SELECT_ALL, wxCreaDevManagerMainFrame::OnMenuSelectAll)
35 EVT_MENU(ID_MENU_SELECT_NONE, wxCreaDevManagerMainFrame::OnMenuSelectNone)
36 EVT_MENU(ID_MENU_EVENT_LOG, wxCreaDevManagerMainFrame::OnMenuEventLog)
37 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCreaDevManagerMainFrame::OnMenuBBTKGraphicalEditor)
38 EVT_MENU(ID_MENU_MINITOOLS, wxCreaDevManagerMainFrame::OnMenuMiniTools)
39 EVT_MENU(ID_MENU_CODE_EDITOR, wxCreaDevManagerMainFrame::OnMenuCodeEditor)
40 EVT_MENU(ID_MENU_COMMAND_LINE, wxCreaDevManagerMainFrame::OnMenuCommandLine)
41 EVT_MENU(ID_MENU_HELP, wxCreaDevManagerMainFrame::OnMenuHelp)
42 EVT_MENU(ID_MENU_REPORT_BUG, wxCreaDevManagerMainFrame::OnMenuReportBug)
43 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCreaDevManagerMainFrame::OnMenuAboutCreaDevManager)
44 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCreaDevManagerMainFrame::OnMenuAboutCreatis)
47 wxCreaDevManagerMainFrame::wxCreaDevManagerMainFrame(
50 const wxString& caption,
56 Create(parent, id, caption, pos, size, style);
59 wxCreaDevManagerMainFrame::~wxCreaDevManagerMainFrame()
64 void wxCreaDevManagerMainFrame::UpdateVisual()
70 bool wxCreaDevManagerMainFrame::Create(
73 const wxString& caption,
79 wxFrame::Create(parent, id, caption, pos, size, style);
80 this->controller = new ControlCreaDevManagerMain();
81 this->controller->LoadActiveProjects();
87 void wxCreaDevManagerMainFrame::CreateMenus()
89 wxMenuBar* menuBar = new wxMenuBar;
92 menu_File = new wxMenu();
93 menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project..."));
94 menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project..."));
95 menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent"));
96 menu_File->AppendSeparator();
97 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project"));
98 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects"));
99 menu_File->AppendSeparator();
100 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy..."));
101 menu_File->AppendSeparator();
102 menu_File->Append(ID_MENU_EXIT, wxString("E&xit"));
104 menuBar->Append(menu_File, wxString("&File"));
107 menu_Edit = new wxMenu();
108 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project"));
109 menu_Edit->AppendSeparator();
110 menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t"));
111 menu_Edit->Append(ID_MENU_COPY, wxString("&Copy"));
112 menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste"));
113 menu_Edit->AppendSeparator();
114 menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete"));
115 menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All"));
116 menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection"));
118 menuBar->Append(menu_Edit, wxString("&Edit"));
121 menu_Tools = new wxMenu();
122 menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log"));
123 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor"));
124 menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools"));
125 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor"));
126 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line"));
128 menuBar->Append(menu_Tools, wxString("&Tools"));
131 menu_Help = new wxMenu();
132 menu_Help->Append(ID_MENU_HELP, wxString("&Help"));
133 menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug"));
134 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager"));
135 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS"));
137 menuBar->Append(menu_Help, wxString("&Help"));
142 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
143 statusBar->SetFieldsCount(1);
144 SetStatusBar(statusBar);
148 void wxCreaDevManagerMainFrame::CreateControls()
151 auiManager.SetManagedWindow(this);
154 tree_Projects = new wxCreaDevManagerTreeCtrl(
159 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
161 tree_Projects->SetSize(400,100);
162 tree_Projects->SetMinSize(wxSize(300,100));
164 panel_Properties = new wxCreaDevManagerDescriptionPanel(
166 ID_WINDOW_PROPERTIES,
167 wxString("Description Panel"),
175 panel_ProjectActions = new wxCreaDevManagerProjectActionsPanel(
177 ID_WINDOW_PROJ_ACTIONS,
178 wxString("Project Actions Panel"),
183 panel_ProjectActions->SetMinSize(wxSize(500, 150));
185 auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree"));
186 auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions"));
187 auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties"));
190 auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
191 auiManager.GetPane(panel_Properties).CloseButton(false);
196 void wxCreaDevManagerMainFrame::OnMenuNewProject(wxCommandEvent& event)
198 wxCreaDevManagerNewProjectDialog* dialog = new wxCreaDevManagerNewProjectDialog(this, this->controller);
200 userResponse = dialog->ShowModal();
202 ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(this->controller->GetActiveProjects());
204 this->UpdateVisual();
208 void wxCreaDevManagerMainFrame::OnMenuOpenProject(wxCommandEvent& event)
210 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
211 wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style);
213 userResponse = FD->ShowModal();
214 if(userResponse == wxID_OK)
216 switch(this->controller->OpenProject(crea::wx2std (FD->GetPath())))
219 wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR);
223 wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR);
230 ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(this->controller->GetActiveProjects());
236 void wxCreaDevManagerMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
238 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
241 void wxCreaDevManagerMainFrame::OnMenuCloseProject(wxCommandEvent& event)
243 std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
246 void wxCreaDevManagerMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
248 std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl;
251 void wxCreaDevManagerMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
253 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
256 void wxCreaDevManagerMainFrame::OnMenuExit(wxCommandEvent& event)
258 std::cout << "Closing CreaDevManager..." << std::endl;
264 void wxCreaDevManagerMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
266 std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
269 void wxCreaDevManagerMainFrame::OnMenuMenuCut(wxCommandEvent& event)
271 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
274 void wxCreaDevManagerMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
276 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
279 void wxCreaDevManagerMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
281 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
284 void wxCreaDevManagerMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
286 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
289 void wxCreaDevManagerMainFrame::OnMenuSelectAll(wxCommandEvent& event)
291 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
294 void wxCreaDevManagerMainFrame::OnMenuSelectNone(wxCommandEvent& event)
296 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
301 void wxCreaDevManagerMainFrame::OnMenuEventLog(wxCommandEvent& event)
303 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
306 void wxCreaDevManagerMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
308 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
311 void wxCreaDevManagerMainFrame::OnMenuMiniTools(wxCommandEvent& event)
313 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
316 void wxCreaDevManagerMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
318 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
321 void wxCreaDevManagerMainFrame::OnMenuCommandLine(wxCommandEvent& event)
323 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
328 void wxCreaDevManagerMainFrame::OnMenuHelp(wxCommandEvent& event)
330 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
333 void wxCreaDevManagerMainFrame::OnMenuReportBug(wxCommandEvent& event)
335 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
338 void wxCreaDevManagerMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
340 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
343 void wxCreaDevManagerMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
345 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;