1 #include "wxCreaDevManagerMainFrame.h"
2 #include "creaDevManagerIds.h"
4 #include "wxCreaDevManagerTreeCtrl.h"
6 #include "wxCreaDevManagerDescriptionPanel.h"
7 #include "wxCreaDevManagerProjectActionsPanel.h"
19 BEGIN_EVENT_TABLE(wxCreaDevManagerMainFrame, wxFrame)
20 EVT_MENU(ID_MENU_NEW_PROJECT, wxCreaDevManagerMainFrame::OnMenuNewProject)
21 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCreaDevManagerMainFrame::OnMenuOpenProject)
22 EVT_MENU(ID_MENU_OPEN_RECENT, wxCreaDevManagerMainFrame::OnMenuOpenRecent)
23 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCreaDevManagerMainFrame::OnMenuCloseProject)
24 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCreaDevManagerMainFrame::OnMenuCloseAllProjects)
25 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCreaDevManagerMainFrame::OnMenuExportHierarchy)
26 EVT_MENU(ID_MENU_EXIT, wxCreaDevManagerMainFrame::OnMenuExit)
27 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCreaDevManagerMainFrame::OnMenuRefreshProject)
28 EVT_MENU(ID_MENU_CUT, wxCreaDevManagerMainFrame::OnMenuMenuCut)
29 EVT_MENU(ID_MENU_COPY, wxCreaDevManagerMainFrame::OnMenuMenuCopy)
30 EVT_MENU(ID_MENU_PASTE, wxCreaDevManagerMainFrame::OnMenuMenuPaste)
31 EVT_MENU(ID_MENU_DELETE, wxCreaDevManagerMainFrame::OnMenuMenuDelete)
32 EVT_MENU(ID_MENU_SELECT_ALL, wxCreaDevManagerMainFrame::OnMenuSelectAll)
33 EVT_MENU(ID_MENU_SELECT_NONE, wxCreaDevManagerMainFrame::OnMenuSelectNone)
34 EVT_MENU(ID_MENU_EVENT_LOG, wxCreaDevManagerMainFrame::OnMenuEventLog)
35 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCreaDevManagerMainFrame::OnMenuBBTKGraphicalEditor)
36 EVT_MENU(ID_MENU_MINITOOLS, wxCreaDevManagerMainFrame::OnMenuMiniTools)
37 EVT_MENU(ID_MENU_CODE_EDITOR, wxCreaDevManagerMainFrame::OnMenuCodeEditor)
38 EVT_MENU(ID_MENU_COMMAND_LINE, wxCreaDevManagerMainFrame::OnMenuCommandLine)
39 EVT_MENU(ID_MENU_HELP, wxCreaDevManagerMainFrame::OnMenuHelp)
40 EVT_MENU(ID_MENU_REPORT_BUG, wxCreaDevManagerMainFrame::OnMenuReportBug)
41 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCreaDevManagerMainFrame::OnMenuAboutCreaDevManager)
42 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCreaDevManagerMainFrame::OnMenuAboutCreatis)
45 wxCreaDevManagerMainFrame::wxCreaDevManagerMainFrame(
48 const wxString& caption,
54 Create(parent, id, caption, pos, size, style);
57 wxCreaDevManagerMainFrame::~wxCreaDevManagerMainFrame()
62 bool wxCreaDevManagerMainFrame::Create(
65 const wxString& caption,
71 wxFrame::Create(parent, id, caption, pos, size, style);
77 void wxCreaDevManagerMainFrame::CreateMenus()
79 wxMenuBar* menuBar = new wxMenuBar;
82 menu_File = new wxMenu();
83 menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project..."));
84 menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project..."));
85 menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent"));
86 menu_File->AppendSeparator();
87 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project"));
88 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects"));
89 menu_File->AppendSeparator();
90 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy..."));
91 menu_File->AppendSeparator();
92 menu_File->Append(ID_MENU_EXIT, wxString("E&xit"));
94 menuBar->Append(menu_File, wxString("&File"));
97 menu_Edit = new wxMenu();
98 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project"));
99 menu_Edit->AppendSeparator();
100 menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t"));
101 menu_Edit->Append(ID_MENU_COPY, wxString("&Copy"));
102 menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste"));
103 menu_Edit->AppendSeparator();
104 menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete"));
105 menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All"));
106 menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection"));
108 menuBar->Append(menu_Edit, wxString("&Edit"));
111 menu_Tools = new wxMenu();
112 menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log"));
113 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor"));
114 menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools"));
115 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor"));
116 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line"));
118 menuBar->Append(menu_Tools, wxString("&Tools"));
121 menu_Help = new wxMenu();
122 menu_Help->Append(ID_MENU_HELP, wxString("&Help"));
123 menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug"));
124 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager"));
125 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS"));
127 menuBar->Append(menu_Help, wxString("&Help"));
132 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
133 statusBar->SetFieldsCount(1);
134 SetStatusBar(statusBar);
138 void wxCreaDevManagerMainFrame::CreateControls()
141 auiManager.SetManagedWindow(this);
144 tree_Projects = new wxCreaDevManagerTreeCtrl(
149 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
151 tree_Projects->SetSize(400,100);
152 tree_Projects->SetMinSize(wxSize(300,100));
154 panel_Properties = new wxCreaDevManagerDescriptionPanel(
156 ID_WINDOW_PROPERTIES,
157 wxString("Description Panel"),
165 panel_ProjectActions = new wxCreaDevManagerProjectActionsPanel(
167 ID_WINDOW_PROJ_ACTIONS,
168 wxString("Project Actions Panel"),
173 panel_ProjectActions->SetMinSize(wxSize(500, 150));
175 auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree"));
176 auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions"));
177 auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties"));
180 auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
181 auiManager.GetPane(panel_Properties).CloseButton(false);
186 void wxCreaDevManagerMainFrame::OnMenuNewProject(wxCommandEvent& event)
188 std::cerr << "Event OnMenuNewProject not implemented yet" << std::endl;
191 void wxCreaDevManagerMainFrame::OnMenuOpenProject(wxCommandEvent& event)
193 //std::cerr << "Event OnMenuOpenProject not implemented" << std::endl;
195 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
196 wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style);
198 userResponse = FD->ShowModal();
199 if(userResponse == wxID_OK)
201 std::string path = crea::wx2std (FD->GetPath());
202 std::cout << "selection path: "<< path << std::endl;
203 std::string path1 = path + "/Makefile";
205 FILE* pFile = fopen(path1.c_str(), "r");
206 if(pFile == NULL) // not the binary folder
208 std::cerr << path1 << ": file not found..." << std::endl;
209 path1 = path + "/CMakeLists.txt";
210 pFile = fopen(path1.c_str(), "r");
211 if(pFile == NULL) //not the source folder
213 std::cerr << path1 << ": file not found..." << std::endl;
214 wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR);
217 }else{//source folder
218 std::cout << "sources folder found..." << std::endl;
221 }else{//binary folder
222 std::cout << "binary folder found..." << std::endl;
225 std::ifstream readFile;
226 readFile.open(path1.c_str());
229 while(!found && readFile >> word)
231 //cout << word << endl;
232 if(word == "CMAKE_SOURCE_DIR")
236 getline(readFile, word, '\n');
245 std::cerr << "sources not found..." << std::endl;
246 wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR);
250 pFile = fopen(path.c_str(), "r");
251 std::cout << "sources at " << path << " open = " << (pFile != NULL) << std::endl;
257 this->projectTree.addRoot(path);
258 this->projectTree.populateNode(path);
260 ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(this->projectTree);
266 void wxCreaDevManagerMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
268 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
271 void wxCreaDevManagerMainFrame::OnMenuCloseProject(wxCommandEvent& event)
273 std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
276 void wxCreaDevManagerMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
278 std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl;
281 void wxCreaDevManagerMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
283 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
286 void wxCreaDevManagerMainFrame::OnMenuExit(wxCommandEvent& event)
288 std::cout << "Closing CreaDevManager..." << std::endl;
294 void wxCreaDevManagerMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
296 std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
299 void wxCreaDevManagerMainFrame::OnMenuMenuCut(wxCommandEvent& event)
301 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
304 void wxCreaDevManagerMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
306 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
309 void wxCreaDevManagerMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
311 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
314 void wxCreaDevManagerMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
316 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
319 void wxCreaDevManagerMainFrame::OnMenuSelectAll(wxCommandEvent& event)
321 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
324 void wxCreaDevManagerMainFrame::OnMenuSelectNone(wxCommandEvent& event)
326 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
331 void wxCreaDevManagerMainFrame::OnMenuEventLog(wxCommandEvent& event)
333 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
336 void wxCreaDevManagerMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
338 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
341 void wxCreaDevManagerMainFrame::OnMenuMiniTools(wxCommandEvent& event)
343 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
346 void wxCreaDevManagerMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
348 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
351 void wxCreaDevManagerMainFrame::OnMenuCommandLine(wxCommandEvent& event)
353 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
358 void wxCreaDevManagerMainFrame::OnMenuHelp(wxCommandEvent& event)
360 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
363 void wxCreaDevManagerMainFrame::OnMenuReportBug(wxCommandEvent& event)
365 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
368 void wxCreaDevManagerMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
370 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
373 void wxCreaDevManagerMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
375 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;