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"
56 #include "wxCDMProjectHelpDialog.h"
59 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
60 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
61 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
62 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
63 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
64 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
65 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
66 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
67 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
68 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
69 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
70 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
71 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
72 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
73 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
74 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
75 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
76 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
77 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
78 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
79 EVT_MENU(ID_MENU_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp)
80 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
81 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
82 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
83 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
84 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
85 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
86 EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
87 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
88 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
89 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
90 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp)
93 wxCDMMainFrame::wxCDMMainFrame(
96 const wxString& caption,
102 Create(parent, id, caption, pos, size, style);
105 wxCDMMainFrame::~wxCDMMainFrame()
110 bool wxCDMMainFrame::Create(
113 const wxString& caption,
119 wxFrame::Create(parent, id, caption, pos, size, style);
120 this->model = new modelCDMMain();
127 modelCDMMain* wxCDMMainFrame::GetModel() const
132 void wxCDMMainFrame::RefreshProject()
135 std::cout << "refreshing project" << std::endl;
136 this->model->RefreshProject(result);
137 std::cout << "rebuilding project tree" << std::endl;
138 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
141 void wxCDMMainFrame::CreateMenus()
143 wxMenuBar* menuBar = new wxMenuBar;
146 menu_File = new wxMenu();
147 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
148 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
149 menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
150 menu_File->AppendSeparator();
151 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
152 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
153 menu_File->AppendSeparator();
154 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
155 menu_File->AppendSeparator();
156 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
158 menuBar->Append(menu_File, wxT("&File"));
161 menu_Edit = new wxMenu();
162 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
163 menu_Edit->AppendSeparator();
164 menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
165 menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
166 menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
167 menu_Edit->AppendSeparator();
168 menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
169 menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
170 menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
172 menuBar->Append(menu_Edit, wxT("&Edit"));
175 menu_Tools = new wxMenu();
176 menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
177 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
178 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
179 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
180 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
182 menuBar->Append(menu_Tools, wxT("&Tools"));
185 menu_Help = new wxMenu();
186 menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs"));
187 menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
188 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
189 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
190 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
191 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
193 menuBar->Append(menu_Help, wxT("&Help"));
198 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
199 statusBar->SetFieldsCount(1);
200 SetStatusBar(statusBar);
204 void wxCDMMainFrame::CreateControls()
207 auiManager.SetManagedWindow(this);
210 tree_Projects = new wxCDMProjectsTreeCtrl(
215 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
218 panel_Properties = new wxCDMMainDescriptionPanel(
220 ID_WINDOW_PROPERTIES,
221 wxT("Description Panel"),
233 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
234 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
236 wxString pers = auiManager.SavePerspective();
239 auiManager.LoadPerspective(pers,true);
240 wxToolTip::Enable(true);
241 wxToolTip::SetDelay(0);
246 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
250 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
252 userResponse = dialog->ShowModal();
254 if(userResponse == wxID_FORWARD)
257 if(this->model->GetProject() != NULL)
259 if(!this->model->CloseProject(result))
261 std::cout << "error closing project: " << *result << std::endl;
262 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
268 if(!this->model->CreateProject(
269 crea::wx2std(dialog->GetProjectName()),
270 crea::wx2std(dialog->GetProjectLocation()),
272 crea::wx2std(dialog->GetPackageAuthor()),
273 crea::wx2std(dialog->GetPackageDescription())
276 std::cout << "error opening project: " << *result << std::endl;
277 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
282 //populate tree control
283 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
284 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
285 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
288 //show project actions panel
289 if(this->panel_ProjectActions != NULL)
291 auiManager.DetachPane(this->panel_Properties);
292 this->panel_ProjectActions->Destroy();
293 this->panel_ProjectActions = NULL;
296 panel_ProjectActions = new wxCDMProjectActionsPanel(
298 this->model->GetProject(),
299 ID_WINDOW_PROJ_ACTIONS,
300 wxT("Project Actions Panel"),
305 panel_ProjectActions->SetMinSize(wxSize(500, 100));
308 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
312 //wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
318 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
322 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
323 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
324 long userResponse = FD->ShowModal();
325 if(userResponse == wxID_OK)
327 std::string path = crea::wx2std (FD->GetPath());
331 std::cout << "Selection to open: " << path << std::endl;
335 if(this->model->GetProject() != NULL)
337 std::cout << "Project not null, closing it" << std::endl;
338 if(!this->model->CloseProject(result))
340 std::cout << "error closing project: " << *result << std::endl;
341 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
347 if (!this->model->OpenProject(path, result))
349 std::cout << "error opening project: " << *result << std::endl;
350 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
355 std::cout << "building ui" << std::endl;
358 //populate tree control
359 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
360 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
361 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
364 //change project's actions panel
365 if(this->panel_ProjectActions!= NULL)
367 auiManager.DetachPane(this->panel_ProjectActions);
368 this->panel_ProjectActions->Destroy();
369 this->panel_ProjectActions = NULL;
371 panel_ProjectActions = new wxCDMProjectActionsPanel(
373 this->model->GetProject(),
374 ID_WINDOW_PROJ_ACTIONS,
375 wxT("Project Actions Panel"),
380 panel_ProjectActions->SetMinSize(wxSize(500, 100));
383 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
392 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
394 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
397 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
399 std::cout << "closing project" << std::endl;
401 if(!this->model->CloseProject(result))
403 std::cout << "error closing project: " << *result << std::endl;
404 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
407 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
409 if(this->panel_Properties != NULL)
411 auiManager.DetachPane(this->panel_Properties);
412 this->panel_Properties->Destroy();
413 this->panel_Properties = NULL;
415 if(this->panel_ProjectActions != NULL)
417 auiManager.DetachPane(this->panel_ProjectActions);
418 this->panel_ProjectActions->Destroy();
419 this->panel_ProjectActions = NULL;
422 this->panel_Properties = new wxCDMMainDescriptionPanel(
424 ID_WINDOW_PROPERTIES,
425 wxT("Description Panel"),
431 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
436 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
438 std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
440 if(!this->model->CloseProject(result))
442 std::cout << "error closing project: " << *result << std::endl;
443 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
445 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
447 if(this->panel_Properties != NULL)
449 auiManager.DetachPane(this->panel_Properties);
450 this->panel_Properties->Destroy();
451 this->panel_Properties = NULL;
453 if(this->panel_ProjectActions != NULL)
455 auiManager.DetachPane(this->panel_ProjectActions);
456 this->panel_ProjectActions->Destroy();
457 this->panel_ProjectActions = NULL;
460 this->panel_Properties = new wxCDMMainDescriptionPanel(
462 ID_WINDOW_PROPERTIES,
463 wxT("Description Panel"),
469 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
474 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
476 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
479 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
481 std::cout << "Closing CreaDevManager..." << std::endl;
483 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
485 std::cout << "error closing project: " << *result << std::endl;
486 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
488 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
490 if(this->panel_Properties != NULL)
492 auiManager.DetachPane(this->panel_Properties);
493 this->panel_Properties->Destroy();
494 this->panel_Properties = NULL;
497 if(this->panel_ProjectActions != NULL)
499 auiManager.DetachPane(this->panel_ProjectActions);
500 this->panel_ProjectActions->Destroy();
501 this->panel_ProjectActions = NULL;
509 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
512 if(!model->RefreshProject(result))
514 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
516 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
518 this->auiManager.Update();
520 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
521 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
523 //TODO: Show possible problems in CMakeLists files
526 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
528 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
531 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
533 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
536 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
538 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
541 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
543 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
546 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
548 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
551 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
553 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
558 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
560 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
563 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
565 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
567 if(CDMUtilities::openBBEditor())
569 wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
572 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
574 if(CDMUtilities::openCreaToolsTools())
576 wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
579 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
581 if(CDMUtilities::openTextEditor())
583 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);
586 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
588 if(CDMUtilities::openTerminal())
590 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);
595 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
597 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
600 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
602 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
605 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
607 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
610 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
612 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
616 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
619 //get selected element
620 wxTreeItemId elementId = event.GetItem();
621 if(this->tree_Projects->IsSelected(elementId))
623 std::cout << "Tree Selection id: " << elementId << std::endl;
624 //get element from model
625 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
626 std::cout << "Tree Selection: " << element->GetName() << std::endl;
628 //TODO get element type
630 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
631 wxPanel* description;
632 wxDialog* helpDialog = NULL;
633 if(elementProject != NULL)
635 //create element description
636 description = new wxCDMProjectDescriptionPanel(
639 ID_WINDOW_PROPERTIES,
640 wxT("Description Panel"),
648 helpDialog = new wxCDMProjectHelpDialog(this, wxID_ANY);
654 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
655 if(elementAppli != NULL)
657 //create element description
658 description = new wxCDMAppliDescriptionPanel(
661 ID_WINDOW_PROPERTIES,
662 wxT("Description Panel"),
671 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
672 if(elementApplication != NULL)
674 //create element description
675 description = new wxCDMApplicationDescriptionPanel(
678 ID_WINDOW_PROPERTIES,
679 wxT("Description Panel"),
688 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
689 if(elementLib != NULL)
691 //create element description
692 description = new wxCDMLibDescriptionPanel(
695 ID_WINDOW_PROPERTIES,
696 wxT("Description Panel"),
705 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
706 if(elementLibrary != NULL)
708 //create element description
709 description = new wxCDMLibraryDescriptionPanel(
712 ID_WINDOW_PROPERTIES,
713 wxT("Description Panel"),
722 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
723 if(elementPackage != NULL)
725 //create element description
726 description = new wxCDMPackageDescriptionPanel(
729 ID_WINDOW_PROPERTIES,
730 wxT("Description Panel"),
739 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
740 if(elementBlackBox != NULL)
742 //create element description
743 description = new wxCDMBlackBoxDescriptionPanel(
746 ID_WINDOW_PROPERTIES,
747 wxT("Description Panel"),
756 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
757 if(elementCMakeLists != NULL)
759 //create element description
760 description = new wxCDMCMakeListsDescriptionPanel(
763 ID_WINDOW_PROPERTIES,
764 wxT("Description Panel"),
773 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
774 if(elementFolder != NULL)
776 //create element description
777 description = new wxCDMFolderDescriptionPanel(
780 ID_WINDOW_PROPERTIES,
781 wxT("Description Panel"),
790 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
791 if(elementFile != NULL)
793 //create element description
794 description = new wxCDMFileDescriptionPanel(
797 ID_WINDOW_PROPERTIES,
798 wxT("Description Panel"),
808 //create element description
809 description = new wxCDMMainDescriptionPanel(
811 ID_WINDOW_PROPERTIES,
812 wxT("Description Panel"),
828 if(this->panel_Properties!= NULL)
829 this->panel_Properties->Hide();
831 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
835 if(this->panel_Properties!= NULL)
837 auiManager.DetachPane(this->panel_Properties);
838 this->panel_Properties->Destroy();
839 this->panel_Properties = NULL;
843 this->panel_Properties = description;
844 if(this->help && helpDialog != NULL)
846 helpDialog->Show(true);
848 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
857 void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
859 switch(event.GetId() != 0)
862 //select out old one to generate selection event
863 this->tree_Projects->SelectItem(event.GetInt(), true);
864 this->tree_Projects->Expand(event.GetInt());
867 wxPanel* description = NULL;
868 if(event.GetString() == wxT("manage_packages"))
870 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
871 this->tree_Projects->Expand(this->model->GetProject()->GetId());
872 description = new wxCDMPackageManagerPanel(
874 this->model->GetProject(),
875 ID_WINDOW_PROPERTIES,
876 wxT("Description Panel"),
882 else if(event.GetString() == wxT("manage_libraries"))
884 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
885 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
888 else if(event.GetString() == wxT("manage_applications"))
890 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
891 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
894 else if(event.GetString() == wxT("blackbox"))
896 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
897 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
898 description = new wxCDMBlackBoxDescriptionPanel(
901 ID_WINDOW_PROPERTIES,
902 wxT("Description Panel"),
909 if(this->panel_Properties!= NULL)
910 this->panel_Properties->Hide();
912 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
916 if(this->panel_Properties!= NULL)
918 auiManager.DetachPane(this->panel_Properties);
919 this->panel_Properties->Destroy();
920 this->panel_Properties = NULL;
924 this->panel_Properties = description;
931 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
933 //std::cout << "element " << event.GetInt() << std::endl;
934 this->tree_Projects->EnsureVisible(event.GetInt());
935 this->tree_Projects->SetItemBold(event.GetInt(), true);
936 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
937 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
941 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
943 this->tree_Projects->SetItemBold(event.GetInt(), false);
944 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
945 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
949 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
951 this->help = !this->help;
952 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
955 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
962 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);