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 this->model->GetProject(),
306 ID_WINDOW_PROJ_ACTIONS,
307 wxT("Project Actions Panel"),
312 panel_ProjectActions->SetMinSize(wxSize(500, 100));
315 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
316 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
320 wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
325 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
329 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
330 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
331 long userResponse = FD->ShowModal();
332 if(userResponse == wxID_OK)
334 std::string path = crea::wx2std (FD->GetPath());
338 std::cout << "Selection to open: " << path << std::endl;
342 if(this->model->GetProject() != NULL)
344 std::cout << "Project not null, closing it" << std::endl;
345 if(!this->model->CloseProject(result))
347 std::cout << "error closing project: " << *result << std::endl;
348 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
354 if (!this->model->OpenProject(path, result))
356 std::cout << "error opening project: " << *result << std::endl;
357 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
362 std::cout << "building ui" << std::endl;
365 //populate tree control
366 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
367 tree_Projects->SelectItem(this->model->GetProject()->GetId());
369 //change description panel
370 if(this->panel_Properties != NULL)
372 auiManager.DetachPane(this->panel_Properties);
373 this->panel_Properties->Destroy();
374 this->panel_Properties = NULL;
377 this->panel_Properties = new wxCDMProjectDescriptionPanel(
379 this->model->GetProject(),
380 ID_WINDOW_PROPERTIES,
381 wxT("Description Panel"),
387 //change project's actions panel
388 if(this->panel_ProjectActions!= NULL)
390 auiManager.DetachPane(this->panel_ProjectActions);
391 this->panel_ProjectActions->Destroy();
392 this->panel_ProjectActions = NULL;
394 panel_ProjectActions = new wxCDMProjectActionsPanel(
396 this->model->GetProject(),
397 ID_WINDOW_PROJ_ACTIONS,
398 wxT("Project Actions Panel"),
403 panel_ProjectActions->SetMinSize(wxSize(500, 100));
406 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
407 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
414 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
416 std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
419 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
421 std::cout << "closing project" << std::endl;
423 if(!this->model->CloseProject(result))
425 std::cout << "error closing project: " << *result << std::endl;
426 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
429 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
431 if(this->panel_Properties != NULL)
433 auiManager.DetachPane(this->panel_Properties);
434 this->panel_Properties->Destroy();
435 this->panel_Properties = NULL;
437 if(this->panel_ProjectActions != NULL)
439 auiManager.DetachPane(this->panel_ProjectActions);
440 this->panel_ProjectActions->Destroy();
441 this->panel_ProjectActions = NULL;
444 this->panel_Properties = new wxCDMMainDescriptionPanel(
446 ID_WINDOW_PROPERTIES,
447 wxT("Description Panel"),
453 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
458 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
460 std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
462 if(!this->model->CloseProject(result))
464 std::cout << "error closing project: " << *result << std::endl;
465 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
467 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
469 if(this->panel_Properties != NULL)
471 auiManager.DetachPane(this->panel_Properties);
472 this->panel_Properties->Destroy();
473 this->panel_Properties = NULL;
475 if(this->panel_ProjectActions != NULL)
477 auiManager.DetachPane(this->panel_ProjectActions);
478 this->panel_ProjectActions->Destroy();
479 this->panel_ProjectActions = NULL;
482 this->panel_Properties = new wxCDMMainDescriptionPanel(
484 ID_WINDOW_PROPERTIES,
485 wxT("Description Panel"),
491 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
496 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
498 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
501 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
503 std::cout << "Closing CreaDevManager..." << std::endl;
505 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
507 std::cout << "error closing project: " << *result << std::endl;
508 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
510 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
512 if(this->panel_Properties != NULL)
514 auiManager.DetachPane(this->panel_Properties);
515 this->panel_Properties->Destroy();
516 this->panel_Properties = NULL;
519 if(this->panel_ProjectActions != NULL)
521 auiManager.DetachPane(this->panel_ProjectActions);
522 this->panel_ProjectActions->Destroy();
523 this->panel_ProjectActions = NULL;
531 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
534 if(!model->RefreshProject(result))
536 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
538 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
540 this->auiManager.Update();
542 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
543 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
545 //TODO: Show possible problems in CMakeLists files
548 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
550 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
553 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
555 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
558 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
560 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
563 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
565 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
568 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
570 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
573 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
575 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
580 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
582 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
585 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
587 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
589 if(CDMUtilities::openBBEditor())
591 wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
594 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
596 if(CDMUtilities::openCreaToolsTools())
598 wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
601 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
603 if(CDMUtilities::openTextEditor())
605 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);
608 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
610 if(CDMUtilities::openTerminal())
612 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);
617 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
619 std::cerr << "Event OnMenuHelp not implemented" << std::endl;
622 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
624 std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
627 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
629 std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
632 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
634 std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
638 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
640 //get selected element
641 wxTreeItemId elementId = event.GetItem();
643 //get element from model
644 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
645 std::cout << "Tree Selection: " << element->GetName() << std::endl;
647 //TODO get element type
649 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
650 wxPanel* description;
651 if(elementProject != NULL)
653 //create element description
654 description = new wxCDMProjectDescriptionPanel(
657 ID_WINDOW_PROPERTIES,
658 wxT("Description Panel"),
668 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
669 if(elementAppli != NULL)
671 //create element description
672 description = new wxCDMAppliDescriptionPanel(
675 ID_WINDOW_PROPERTIES,
676 wxT("Description Panel"),
685 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
686 if(elementApplication != NULL)
688 //create element description
689 description = new wxCDMApplicationDescriptionPanel(
692 ID_WINDOW_PROPERTIES,
693 wxT("Description Panel"),
702 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
703 if(elementLib != NULL)
705 //create element description
706 description = new wxCDMLibDescriptionPanel(
709 ID_WINDOW_PROPERTIES,
710 wxT("Description Panel"),
719 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
720 if(elementLibrary != NULL)
722 //create element description
723 description = new wxCDMLibraryDescriptionPanel(
726 ID_WINDOW_PROPERTIES,
727 wxT("Description Panel"),
736 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
737 if(elementPackage != NULL)
739 //create element description
740 description = new wxCDMPackageDescriptionPanel(
743 ID_WINDOW_PROPERTIES,
744 wxT("Description Panel"),
753 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
754 if(elementBlackBox != NULL)
756 //create element description
757 description = new wxCDMBlackBoxDescriptionPanel(
760 ID_WINDOW_PROPERTIES,
761 wxT("Description Panel"),
770 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
771 if(elementCMakeLists != NULL)
773 //create element description
774 description = new wxCDMCMakeListsDescriptionPanel(
777 ID_WINDOW_PROPERTIES,
778 wxT("Description Panel"),
787 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
788 if(elementFolder != NULL)
790 //create element description
791 description = new wxCDMFolderDescriptionPanel(
794 ID_WINDOW_PROPERTIES,
795 wxT("Description Panel"),
804 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
805 if(elementFile != NULL)
807 //create element description
808 description = new wxCDMFileDescriptionPanel(
811 ID_WINDOW_PROPERTIES,
812 wxT("Description Panel"),
822 //create element description
823 description = new wxCDMMainDescriptionPanel(
825 ID_WINDOW_PROPERTIES,
826 wxT("Description Panel"),
842 if(this->panel_Properties!= NULL)
843 this->panel_Properties->Hide();
845 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
849 if(this->panel_Properties!= NULL)
851 auiManager.DetachPane(this->panel_Properties);
852 this->panel_Properties->Destroy();
853 this->panel_Properties = NULL;
857 this->panel_Properties = description;
858 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
865 void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
867 switch(event.GetId() != 0)
870 //select out old one to generate selection event
871 this->tree_Projects->SelectItem(event.GetInt(), true);
872 this->tree_Projects->Expand(event.GetInt());
875 wxPanel* description = NULL;
876 if(event.GetString() == wxT("manage_packages"))
878 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
879 this->tree_Projects->Expand(this->model->GetProject()->GetId());
880 description = new wxCDMPackageManagerPanel(
882 this->model->GetProject(),
883 ID_WINDOW_PROPERTIES,
884 wxT("Description Panel"),
890 else if(event.GetString() == wxT("manage_libraries"))
892 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
893 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
896 else if(event.GetString() == wxT("manage_applications"))
898 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
899 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
902 else if(event.GetString() == wxT("blackbox"))
904 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
905 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
906 description = new wxCDMBlackBoxDescriptionPanel(
909 ID_WINDOW_PROPERTIES,
910 wxT("Description Panel"),
917 if(this->panel_Properties!= NULL)
918 this->panel_Properties->Hide();
920 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
924 if(this->panel_Properties!= NULL)
926 auiManager.DetachPane(this->panel_Properties);
927 this->panel_Properties->Destroy();
928 this->panel_Properties = NULL;
932 this->panel_Properties = description;
939 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
941 //std::cout << "element " << event.GetInt() << std::endl;
942 this->tree_Projects->EnsureVisible(event.GetInt());
943 this->tree_Projects->SetItemBold(event.GetInt(), true);
944 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
945 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
949 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
951 this->tree_Projects->SetItemBold(event.GetInt(), false);
952 this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
953 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);