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 "wx/treectrl.h"
35 #include "wx/treebase.h"
36 #include "wx/tooltip.h"
37 #include "CDMUtilities.h"
39 #include "creaDevManagerIds.h"
40 #include "wxCDMMainDescriptionPanel.h"
41 #include "wxCDMProjectDescriptionPanel.h"
42 #include "wxCDMAppliDescriptionPanel.h"
43 #include "wxCDMApplicationDescriptionPanel.h"
44 #include "wxCDMLibDescriptionPanel.h"
45 #include "wxCDMLibraryDescriptionPanel.h"
46 #include "wxCDMPackageDescriptionPanel.h"
47 #include "wxCDMBlackBoxDescriptionPanel.h"
48 #include "wxCDMCMakeListsDescriptionPanel.h"
49 #include "wxCDMFolderDescriptionPanel.h"
50 #include "wxCDMFileDescriptionPanel.h"
51 #include "wxCDMPackageManagerPanel.h"
53 #include "wxCDMProjectActionsPanel.h"
54 #include "wxCDMNewProjectDialog.h"
58 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
59 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
60 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
61 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
62 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
63 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
64 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
65 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
66 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
67 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
68 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
69 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
70 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
71 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
72 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
73 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
74 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
75 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
76 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
77 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
78 EVT_MENU(ID_MENU_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp)
79 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
80 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
81 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
82 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
84 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
85 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
87 EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
89 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
90 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
91 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
94 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp)
97 wxCDMMainFrame::wxCDMMainFrame(
100 const wxString& caption,
106 Create(parent, id, caption, pos, size, style);
109 wxCDMMainFrame::~wxCDMMainFrame()
114 bool wxCDMMainFrame::Create(
117 const wxString& caption,
123 wxFrame::Create(parent, id, caption, pos, size, style);
124 this->model = new modelCDMMain();
131 modelCDMMain* wxCDMMainFrame::GetModel() const
136 wxPanel* wxCDMMainFrame::GetPropertiesPanel() const
138 return this->panel_Properties;
141 bool wxCDMMainFrame::isHelp() const
146 void wxCDMMainFrame::RefreshProject()
149 std::cout << "refreshing project" << std::endl;
150 this->model->RefreshProject(result);
151 std::cout << "rebuilding project tree" << std::endl;
152 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
155 void wxCDMMainFrame::CreateMenus()
157 wxMenuBar* menuBar = new wxMenuBar;
160 menu_File = new wxMenu();
161 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
162 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
163 menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
164 menu_File->AppendSeparator();
165 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
166 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
167 menu_File->AppendSeparator();
168 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
169 menu_File->AppendSeparator();
170 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
172 menuBar->Append(menu_File, wxT("&File"));
175 menu_Edit = new wxMenu();
176 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
177 menu_Edit->AppendSeparator();
178 menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
179 menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
180 menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
181 menu_Edit->AppendSeparator();
182 menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
183 menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
184 menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
186 menuBar->Append(menu_Edit, wxT("&Edit"));
189 menu_Tools = new wxMenu();
190 menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
191 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
192 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
193 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
194 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
196 menuBar->Append(menu_Tools, wxT("&Tools"));
199 menu_Help = new wxMenu();
200 menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs"));
201 menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
202 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
203 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
204 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
205 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
207 menuBar->Append(menu_Help, wxT("&Help"));
212 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
213 statusBar->SetFieldsCount(1);
214 SetStatusBar(statusBar);
218 void wxCDMMainFrame::CreateControls()
221 auiManager.SetManagedWindow(this);
224 tree_Projects = new wxCDMProjectsTreeCtrl(
229 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
232 panel_Properties = new wxCDMMainDescriptionPanel(
234 ID_WINDOW_PROPERTIES,
235 wxT("Description Panel"),
247 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
248 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
250 wxString pers = auiManager.SavePerspective();
253 auiManager.LoadPerspective(pers,true);
254 wxToolTip::Enable(true);
255 wxToolTip::SetDelay(0);
260 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
264 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
266 userResponse = dialog->ShowModal();
268 if(userResponse == wxID_FORWARD)
271 if(this->model->GetProject() != NULL)
273 if(!this->model->CloseProject(result))
275 std::cout << "error closing project: " << *result << std::endl;
276 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
282 if(!this->model->CreateProject(
283 crea::wx2std(dialog->GetProjectName()),
284 crea::wx2std(dialog->GetProjectLocation()),
286 crea::wx2std(dialog->GetPackageAuthor()),
287 crea::wx2std(dialog->GetPackageDescription())
290 std::cout << "error opening project: " << *result << std::endl;
291 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
296 //populate tree control
297 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
298 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
299 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
302 //show project actions panel
303 if(this->panel_ProjectActions != NULL)
305 auiManager.DetachPane(this->panel_Properties);
306 this->panel_ProjectActions->Destroy();
307 this->panel_ProjectActions = NULL;
310 panel_ProjectActions = new wxCDMProjectActionsPanel(
312 this->model->GetProject(),
313 ID_WINDOW_PROJ_ACTIONS,
314 wxT("Project Actions Panel"),
319 panel_ProjectActions->SetMinSize(wxSize(500, 100));
322 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
326 //wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
332 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
336 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
337 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
338 long userResponse = FD->ShowModal();
339 if(userResponse == wxID_OK)
341 std::string path = crea::wx2std (FD->GetPath());
345 std::cout << "Selection to open: " << path << std::endl;
349 if(this->model->GetProject() != NULL)
351 std::cout << "Project not null, closing it" << std::endl;
352 if(!this->model->CloseProject(result))
354 std::cout << "error closing project: " << *result << std::endl;
355 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
361 if (!this->model->OpenProject(path, result))
363 std::cout << "error opening project: " << *result << std::endl;
364 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
369 std::cout << "building ui" << std::endl;
372 //populate tree control
373 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
374 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
375 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
378 //change project's actions panel
379 if(this->panel_ProjectActions!= NULL)
381 auiManager.DetachPane(this->panel_ProjectActions);
382 this->panel_ProjectActions->Destroy();
383 this->panel_ProjectActions = NULL;
385 panel_ProjectActions = new wxCDMProjectActionsPanel(
387 this->model->GetProject(),
388 ID_WINDOW_PROJ_ACTIONS,
389 wxT("Project Actions Panel"),
394 panel_ProjectActions->SetMinSize(wxSize(500, 100));
397 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
406 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
408 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
411 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
413 std::cout << "closing project" << std::endl;
415 if(!this->model->CloseProject(result))
417 std::cout << "error closing project: " << *result << std::endl;
418 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
421 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
423 if(this->panel_Properties != NULL)
425 auiManager.DetachPane(this->panel_Properties);
426 this->panel_Properties->Destroy();
427 this->panel_Properties = NULL;
429 if(this->panel_ProjectActions != NULL)
431 auiManager.DetachPane(this->panel_ProjectActions);
432 this->panel_ProjectActions->Destroy();
433 this->panel_ProjectActions = NULL;
436 this->panel_Properties = new wxCDMMainDescriptionPanel(
438 ID_WINDOW_PROPERTIES,
439 wxT("Description Panel"),
445 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
450 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
452 std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
454 if(!this->model->CloseProject(result))
456 std::cout << "error closing project: " << *result << std::endl;
457 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
459 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
461 if(this->panel_Properties != NULL)
463 auiManager.DetachPane(this->panel_Properties);
464 this->panel_Properties->Destroy();
465 this->panel_Properties = NULL;
467 if(this->panel_ProjectActions != NULL)
469 auiManager.DetachPane(this->panel_ProjectActions);
470 this->panel_ProjectActions->Destroy();
471 this->panel_ProjectActions = NULL;
474 this->panel_Properties = new wxCDMMainDescriptionPanel(
476 ID_WINDOW_PROPERTIES,
477 wxT("Description Panel"),
483 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
488 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
490 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
493 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
495 std::cout << "Closing CreaDevManager..." << std::endl;
497 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
499 std::cout << "error closing project: " << *result << std::endl;
500 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
502 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
504 if(this->panel_Properties != NULL)
506 auiManager.DetachPane(this->panel_Properties);
507 this->panel_Properties->Destroy();
508 this->panel_Properties = NULL;
511 if(this->panel_ProjectActions != NULL)
513 auiManager.DetachPane(this->panel_ProjectActions);
514 this->panel_ProjectActions->Destroy();
515 this->panel_ProjectActions = NULL;
523 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
526 if(!model->RefreshProject(result))
528 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
530 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
532 this->auiManager.Update();
534 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
535 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
537 //TODO: Show possible problems in CMakeLists files
540 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
542 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
545 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
547 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
550 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
552 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
555 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
557 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
560 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
562 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
565 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
567 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
572 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
574 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
577 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
579 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
581 if(CDMUtilities::openBBEditor())
583 wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
586 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
588 if(CDMUtilities::openCreaToolsTools())
590 wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
593 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
595 if(CDMUtilities::openTextEditor())
597 wxMessageBox( wxT("Can't open the Text Editor. Please check the default text editor command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR);
600 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
602 if(CDMUtilities::openTerminal())
604 wxMessageBox( wxT("Can't open Terminal. Please check the default terminal command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR);
609 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
611 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
614 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
616 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
619 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
621 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
624 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
626 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
630 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
633 //get selected element
634 wxTreeItemId elementId = event.GetItem();
635 if(this->tree_Projects->IsSelected(elementId))
637 std::cout << "Tree Selection id: " << elementId << std::endl;
638 //get element from model
639 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
640 std::cout << "Tree Selection: " << element->GetName() << std::endl;
642 //TODO get element type
644 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
645 wxPanel* description;
646 if(elementProject != NULL)
648 //create element description
649 description = new wxCDMProjectDescriptionPanel(
652 ID_WINDOW_PROPERTIES,
653 wxT("Description Panel"),
663 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
664 if(elementAppli != NULL)
666 //create element description
667 description = new wxCDMAppliDescriptionPanel(
670 ID_WINDOW_PROPERTIES,
671 wxT("Description Panel"),
681 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
682 if(elementApplication != NULL)
684 //create element description
685 description = new wxCDMApplicationDescriptionPanel(
688 ID_WINDOW_PROPERTIES,
689 wxT("Description Panel"),
698 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
699 if(elementLib != NULL)
701 //create element description
702 description = new wxCDMLibDescriptionPanel(
705 ID_WINDOW_PROPERTIES,
706 wxT("Description Panel"),
715 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
716 if(elementLibrary != NULL)
718 //create element description
719 description = new wxCDMLibraryDescriptionPanel(
722 ID_WINDOW_PROPERTIES,
723 wxT("Description Panel"),
732 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
733 if(elementPackage != NULL)
735 //create element description
736 description = new wxCDMPackageDescriptionPanel(
739 ID_WINDOW_PROPERTIES,
740 wxT("Description Panel"),
749 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
750 if(elementBlackBox != NULL)
752 //create element description
753 description = new wxCDMBlackBoxDescriptionPanel(
756 ID_WINDOW_PROPERTIES,
757 wxT("Description Panel"),
766 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
767 if(elementCMakeLists != NULL)
769 //create element description
770 description = new wxCDMCMakeListsDescriptionPanel(
773 ID_WINDOW_PROPERTIES,
774 wxT("Description Panel"),
783 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
784 if(elementFolder != NULL)
786 //create element description
787 description = new wxCDMFolderDescriptionPanel(
790 ID_WINDOW_PROPERTIES,
791 wxT("Description Panel"),
800 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
801 if(elementFile != NULL)
803 //create element description
804 description = new wxCDMFileDescriptionPanel(
807 ID_WINDOW_PROPERTIES,
808 wxT("Description Panel"),
818 //create element description
819 description = new wxCDMMainDescriptionPanel(
821 ID_WINDOW_PROPERTIES,
822 wxT("Description Panel"),
838 if(this->panel_Properties!= NULL)
839 this->panel_Properties->Hide();
841 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
845 if(this->panel_Properties!= NULL)
847 auiManager.DetachPane(this->panel_Properties);
848 this->panel_Properties->Destroy();
849 this->panel_Properties = NULL;
853 this->panel_Properties = description;
855 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
864 void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
866 switch(event.GetId() != 0)
869 //select out old one to generate selection event
870 this->tree_Projects->SelectItem(event.GetInt(), true);
871 this->tree_Projects->Expand(event.GetInt());
874 wxPanel* description = NULL;
875 if(event.GetString() == wxT("manage_packages"))
877 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
878 this->tree_Projects->Expand(this->model->GetProject()->GetId());
879 description = new wxCDMPackageManagerPanel(
881 this->model->GetProject(),
882 ID_WINDOW_PROPERTIES,
883 wxT("Description Panel"),
889 else if(event.GetString() == wxT("manage_libraries"))
891 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
892 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
895 else if(event.GetString() == wxT("manage_applications"))
897 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
898 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
901 else if(event.GetString() == wxT("blackbox"))
903 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
904 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
905 description = new wxCDMBlackBoxDescriptionPanel(
908 ID_WINDOW_PROPERTIES,
909 wxT("Description Panel"),
916 if(this->panel_Properties!= NULL)
917 this->panel_Properties->Hide();
919 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
923 if(this->panel_Properties!= NULL)
925 auiManager.DetachPane(this->panel_Properties);
926 this->panel_Properties->Destroy();
927 this->panel_Properties = NULL;
931 this->panel_Properties = description;
938 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
940 //std::cout << "element " << event.GetInt() << std::endl;
941 this->tree_Projects->EnsureVisible(event.GetInt());
942 this->tree_Projects->SetItemBold(event.GetInt(), true);
943 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
944 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
948 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
950 this->tree_Projects->SetItemBold(event.GetInt(), false);
951 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
952 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
956 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
958 this->help = !this->help;
959 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
962 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
969 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);