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"
57 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
58 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
59 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
60 EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
61 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
62 EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
63 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
64 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
65 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
66 EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
67 EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
68 EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
69 EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
70 EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
71 EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
72 EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
73 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
74 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
75 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
76 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
77 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
78 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
79 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
80 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
81 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
82 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
83 EVT_TREE_SEL_CHANGING(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
84 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
85 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
86 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
89 wxCDMMainFrame::wxCDMMainFrame(
92 const wxString& caption,
98 Create(parent, id, caption, pos, size, style);
101 wxCDMMainFrame::~wxCDMMainFrame()
106 bool wxCDMMainFrame::Create(
109 const wxString& caption,
115 wxFrame::Create(parent, id, caption, pos, size, style);
116 this->model = new modelCDMMain();
122 modelCDMMain* wxCDMMainFrame::GetModel() const
127 void wxCDMMainFrame::RefreshProject()
130 std::cout << "refreshing project" << std::endl;
131 this->model->RefreshProject(result);
132 std::cout << "rebuilding project tree" << std::endl;
133 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
136 void wxCDMMainFrame::CreateMenus()
138 wxMenuBar* menuBar = new wxMenuBar;
141 menu_File = new wxMenu();
142 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
143 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
144 menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
145 menu_File->AppendSeparator();
146 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
147 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
148 menu_File->AppendSeparator();
149 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
150 menu_File->AppendSeparator();
151 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
153 menuBar->Append(menu_File, wxT("&File"));
156 menu_Edit = new wxMenu();
157 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
158 menu_Edit->AppendSeparator();
159 menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
160 menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
161 menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
162 menu_Edit->AppendSeparator();
163 menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
164 menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
165 menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
167 menuBar->Append(menu_Edit, wxT("&Edit"));
170 menu_Tools = new wxMenu();
171 menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
172 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
173 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
174 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
175 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
177 menuBar->Append(menu_Tools, wxT("&Tools"));
180 menu_Help = new wxMenu();
181 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
182 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
183 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
184 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
186 menuBar->Append(menu_Help, wxT("&Help"));
191 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
192 statusBar->SetFieldsCount(1);
193 SetStatusBar(statusBar);
197 void wxCDMMainFrame::CreateControls()
200 auiManager.SetManagedWindow(this);
203 tree_Projects = new wxCDMProjectsTreeCtrl(
208 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
211 panel_Properties = new wxCDMMainDescriptionPanel(
213 ID_WINDOW_PROPERTIES,
214 wxT("Description Panel"),
226 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
227 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
229 wxString pers = auiManager.SavePerspective();
232 auiManager.LoadPerspective(pers,true);
233 wxToolTip::Enable(true);
234 wxToolTip::SetDelay(0);
239 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
243 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
245 userResponse = dialog->ShowModal();
247 if(userResponse == wxID_FORWARD)
250 if(this->model->GetProject() != NULL)
252 if(!this->model->CloseProject(result))
254 std::cout << "error closing project: " << *result << std::endl;
255 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
261 if(!this->model->CreateProject(
262 crea::wx2std(dialog->GetProjectName()),
263 crea::wx2std(dialog->GetProjectLocation()),
265 crea::wx2std(dialog->GetPackageAuthor()),
266 crea::wx2std(dialog->GetPackageDescription())
269 std::cout << "error opening project: " << *result << std::endl;
270 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
275 //populate tree control
276 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
277 tree_Projects->SelectItem(this->model->GetProject()->GetId());
279 //change description panel
280 if(this->panel_Properties != NULL)
282 auiManager.DetachPane(this->panel_Properties);
283 this->panel_Properties->Destroy();
284 this->panel_Properties = NULL;
287 this->panel_Properties = new wxCDMProjectDescriptionPanel(
289 this->model->GetProject(),
290 ID_WINDOW_PROPERTIES,
291 wxT("Description Panel"),
295 //show projectactions panel
296 if(this->panel_ProjectActions != NULL)
298 auiManager.DetachPane(this->panel_Properties);
299 this->panel_ProjectActions->Destroy();
300 this->panel_ProjectActions = NULL;
303 panel_ProjectActions = new wxCDMProjectActionsPanel(
305 ID_WINDOW_PROJ_ACTIONS,
306 wxT("Project Actions Panel"),
311 panel_ProjectActions->SetMinSize(wxSize(500, 100));
314 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
315 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
319 wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
324 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
328 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
329 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
330 long userResponse = FD->ShowModal();
331 if(userResponse == wxID_OK)
333 std::string path = crea::wx2std (FD->GetPath());
337 std::cout << "Selection to open: " << path << std::endl;
341 if(this->model->GetProject() != NULL)
343 std::cout << "Project not null, closing it" << std::endl;
344 if(!this->model->CloseProject(result))
346 std::cout << "error closing project: " << *result << std::endl;
347 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
353 if (!this->model->OpenProject(path, result))
355 std::cout << "error opening project: " << *result << std::endl;
356 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
361 std::cout << "building ui" << std::endl;
364 //populate tree control
365 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
366 tree_Projects->SelectItem(this->model->GetProject()->GetId());
368 //change description panel
369 if(this->panel_Properties != NULL)
371 auiManager.DetachPane(this->panel_Properties);
372 this->panel_Properties->Destroy();
373 this->panel_Properties = NULL;
376 this->panel_Properties = new wxCDMProjectDescriptionPanel(
378 this->model->GetProject(),
379 ID_WINDOW_PROPERTIES,
380 wxT("Description Panel"),
386 //change project's actions panel
387 if(this->panel_ProjectActions!= NULL)
389 auiManager.DetachPane(this->panel_ProjectActions);
390 this->panel_ProjectActions->Destroy();
391 this->panel_ProjectActions = NULL;
393 panel_ProjectActions = new wxCDMProjectActionsPanel(
395 ID_WINDOW_PROJ_ACTIONS,
396 wxT("Project Actions Panel"),
401 panel_ProjectActions->SetMinSize(wxSize(500, 100));
404 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
405 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
412 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
414 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
417 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
419 std::cout << "closing project" << std::endl;
421 if(!this->model->CloseProject(result))
423 std::cout << "error closing project: " << *result << std::endl;
424 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
427 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
429 if(this->panel_Properties != NULL)
431 auiManager.DetachPane(this->panel_Properties);
432 this->panel_Properties->Destroy();
433 this->panel_Properties = NULL;
435 if(this->panel_ProjectActions != NULL)
437 auiManager.DetachPane(this->panel_ProjectActions);
438 this->panel_ProjectActions->Destroy();
439 this->panel_ProjectActions = NULL;
442 this->panel_Properties = new wxCDMMainDescriptionPanel(
444 ID_WINDOW_PROPERTIES,
445 wxT("Description Panel"),
451 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
456 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
458 std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
460 if(!this->model->CloseProject(result))
462 std::cout << "error closing project: " << *result << std::endl;
463 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
465 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
467 if(this->panel_Properties != NULL)
469 auiManager.DetachPane(this->panel_Properties);
470 this->panel_Properties->Destroy();
471 this->panel_Properties = NULL;
473 if(this->panel_ProjectActions != NULL)
475 auiManager.DetachPane(this->panel_ProjectActions);
476 this->panel_ProjectActions->Destroy();
477 this->panel_ProjectActions = NULL;
480 this->panel_Properties = new wxCDMMainDescriptionPanel(
482 ID_WINDOW_PROPERTIES,
483 wxT("Description Panel"),
489 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
494 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
496 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
499 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
501 std::cout << "Closing CreaDevManager..." << std::endl;
503 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
505 std::cout << "error closing project: " << *result << std::endl;
506 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
508 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
510 if(this->panel_Properties != NULL)
512 auiManager.DetachPane(this->panel_Properties);
513 this->panel_Properties->Destroy();
514 this->panel_Properties = NULL;
517 if(this->panel_ProjectActions != NULL)
519 auiManager.DetachPane(this->panel_ProjectActions);
520 this->panel_ProjectActions->Destroy();
521 this->panel_ProjectActions = NULL;
529 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
532 if(!model->RefreshProject(result))
534 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
536 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
537 this->auiManager.Update();
538 //TODO: Show possible problems in CMakeLists files
541 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
543 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
546 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
548 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
551 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
553 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
556 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
558 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
561 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
563 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
566 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
568 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
573 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
575 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
578 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
580 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
583 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
585 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
588 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
590 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
593 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
595 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
600 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
602 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
605 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
607 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
610 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
612 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
615 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
617 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
621 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
623 //get selected element
624 wxTreeItemId elementId = event.GetItem();
626 //get element from model
627 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
628 std::cout << "Tree Selection: " << element->GetName() << std::endl;
630 //TODO get element type
632 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
633 wxPanel* description;
634 if(elementProject != NULL)
636 //create element description
637 description = new wxCDMProjectDescriptionPanel(
640 ID_WINDOW_PROPERTIES,
641 wxT("Description Panel"),
651 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
652 if(elementAppli != NULL)
654 //create element description
655 description = new wxCDMAppliDescriptionPanel(
658 ID_WINDOW_PROPERTIES,
659 wxT("Description Panel"),
668 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
669 if(elementApplication != NULL)
671 //create element description
672 description = new wxCDMApplicationDescriptionPanel(
675 ID_WINDOW_PROPERTIES,
676 wxT("Description Panel"),
685 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
686 if(elementLib != NULL)
688 //create element description
689 description = new wxCDMLibDescriptionPanel(
692 ID_WINDOW_PROPERTIES,
693 wxT("Description Panel"),
702 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
703 if(elementLibrary != NULL)
705 //create element description
706 description = new wxCDMLibraryDescriptionPanel(
709 ID_WINDOW_PROPERTIES,
710 wxT("Description Panel"),
719 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
720 if(elementPackage != NULL)
722 //create element description
723 description = new wxCDMPackageDescriptionPanel(
726 ID_WINDOW_PROPERTIES,
727 wxT("Description Panel"),
736 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
737 if(elementBlackBox != NULL)
739 //create element description
740 description = new wxCDMBlackBoxDescriptionPanel(
743 ID_WINDOW_PROPERTIES,
744 wxT("Description Panel"),
753 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
754 if(elementCMakeLists != NULL)
756 //create element description
757 description = new wxCDMCMakeListsDescriptionPanel(
760 ID_WINDOW_PROPERTIES,
761 wxT("Description Panel"),
770 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
771 if(elementFolder != NULL)
773 //create element description
774 description = new wxCDMFolderDescriptionPanel(
777 ID_WINDOW_PROPERTIES,
778 wxT("Description Panel"),
787 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
788 if(elementFile != NULL)
790 //create element description
791 description = new wxCDMFileDescriptionPanel(
794 ID_WINDOW_PROPERTIES,
795 wxT("Description Panel"),
805 //create element description
806 description = new wxCDMMainDescriptionPanel(
808 ID_WINDOW_PROPERTIES,
809 wxT("Description Panel"),
825 if(this->panel_Properties!= NULL)
826 this->panel_Properties->Hide();
828 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
832 if(this->panel_Properties!= NULL)
834 auiManager.DetachPane(this->panel_Properties);
835 this->panel_Properties->Destroy();
836 this->panel_Properties = NULL;
840 this->panel_Properties = description;
841 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
848 void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
850 switch(event.GetId() != 0)
853 //select out old one to generate selection event
854 this->tree_Projects->SelectItem(event.GetInt(), true);
855 this->tree_Projects->Expand(event.GetInt());
858 wxPanel* description = NULL;
859 if(event.GetString() == wxT("manage_packages"))
861 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
862 this->tree_Projects->Expand(this->model->GetProject()->GetId());
863 description = new wxCDMPackageManagerPanel(
865 this->model->GetProject(),
866 ID_WINDOW_PROPERTIES,
867 wxT("Description Panel"),
873 else if(event.GetString() == wxT("manage_libraries"))
875 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
876 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
879 else if(event.GetString() == wxT("manage_applications"))
881 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
882 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
886 if(this->panel_Properties!= NULL)
887 this->panel_Properties->Hide();
889 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
893 if(this->panel_Properties!= NULL)
895 auiManager.DetachPane(this->panel_Properties);
896 this->panel_Properties->Destroy();
897 this->panel_Properties = NULL;
901 this->panel_Properties = description;
908 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
910 //std::cout << "element " << event.GetInt() << std::endl;
911 this->tree_Projects->SetItemBold(event.GetInt(), true);
912 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
913 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
917 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
919 this->tree_Projects->SetItemBold(event.GetInt(), false);
920 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
921 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);