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)
87 wxCDMMainFrame::wxCDMMainFrame(
90 const wxString& caption,
96 Create(parent, id, caption, pos, size, style);
99 wxCDMMainFrame::~wxCDMMainFrame()
104 bool wxCDMMainFrame::Create(
107 const wxString& caption,
113 wxFrame::Create(parent, id, caption, pos, size, style);
114 this->model = new modelCDMMain();
120 modelCDMMain* wxCDMMainFrame::GetModel() const
125 void wxCDMMainFrame::RefreshProject()
128 std::cout << "refreshing project" << std::endl;
129 this->model->RefreshProject(result);
130 std::cout << "rebuilding project tree" << std::endl;
131 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
134 void wxCDMMainFrame::CreateMenus()
136 wxMenuBar* menuBar = new wxMenuBar;
139 menu_File = new wxMenu();
140 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
141 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
142 menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
143 menu_File->AppendSeparator();
144 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
145 menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
146 menu_File->AppendSeparator();
147 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
148 menu_File->AppendSeparator();
149 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
151 menuBar->Append(menu_File, wxT("&File"));
154 menu_Edit = new wxMenu();
155 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
156 menu_Edit->AppendSeparator();
157 menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
158 menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
159 menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
160 menu_Edit->AppendSeparator();
161 menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
162 menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
163 menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
165 menuBar->Append(menu_Edit, wxT("&Edit"));
168 menu_Tools = new wxMenu();
169 menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
170 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
171 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
172 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
173 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
175 menuBar->Append(menu_Tools, wxT("&Tools"));
178 menu_Help = new wxMenu();
179 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
180 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
181 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
182 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
184 menuBar->Append(menu_Help, wxT("&Help"));
189 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
190 statusBar->SetFieldsCount(1);
191 SetStatusBar(statusBar);
195 void wxCDMMainFrame::CreateControls()
198 auiManager.SetManagedWindow(this);
201 tree_Projects = new wxCDMProjectsTreeCtrl(
206 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
209 panel_Properties = new wxCDMMainDescriptionPanel(
211 ID_WINDOW_PROPERTIES,
212 wxT("Description Panel"),
224 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
225 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Left().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
227 wxString pers = auiManager.SavePerspective();
230 auiManager.LoadPerspective(pers,true);
231 wxToolTip::Enable(true);
232 wxToolTip::SetDelay(0);
237 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
241 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
243 userResponse = dialog->ShowModal();
245 if(userResponse == wxID_FORWARD)
248 if(this->model->GetProject() != NULL)
250 if(!this->model->CloseProject(result))
252 std::cout << "error closing project: " << *result << std::endl;
253 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
259 if(!this->model->CreateProject(
260 crea::wx2std(dialog->GetProjectName()),
261 crea::wx2std(dialog->GetProjectLocation()),
263 crea::wx2std(dialog->GetPackageAuthor()),
264 crea::wx2std(dialog->GetPackageDescription())
267 std::cout << "error opening project: " << *result << std::endl;
268 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
273 //populate tree control
274 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
275 tree_Projects->SelectItem(this->model->GetProject()->GetId());
277 //change description panel
278 if(this->panel_Properties != NULL)
280 auiManager.DetachPane(this->panel_Properties);
281 this->panel_Properties->Destroy();
284 this->panel_Properties = new wxCDMProjectDescriptionPanel(
286 this->model->GetProject(),
287 ID_WINDOW_PROPERTIES,
288 wxT("Description Panel"),
292 //show projectactions panel
293 if(this->panel_ProjectActions != NULL)
295 auiManager.DetachPane(this->panel_Properties);
296 this->panel_ProjectActions->Destroy();
299 panel_ProjectActions = new wxCDMProjectActionsPanel(
301 ID_WINDOW_PROJ_ACTIONS,
302 wxT("Project Actions Panel"),
307 panel_ProjectActions->SetMinSize(wxSize(500, 100));
310 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
311 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
315 wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
320 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
324 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
325 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
326 long userResponse = FD->ShowModal();
327 if(userResponse == wxID_OK)
329 std::string path = crea::wx2std (FD->GetPath());
333 std::cout << "Selection to open: " << path << std::endl;
337 if(this->model->GetProject() != NULL)
339 std::cout << "Project not null, closing it" << std::endl;
340 if(!this->model->CloseProject(result))
342 std::cout << "error closing project: " << *result << std::endl;
343 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
349 if (!this->model->OpenProject(path, result))
351 std::cout << "error opening project: " << *result << std::endl;
352 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
357 std::cout << "building ui" << std::endl;
360 //populate tree control
361 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
362 tree_Projects->SelectItem(this->model->GetProject()->GetId());
364 //change description panel
365 if(this->panel_Properties != NULL)
367 auiManager.DetachPane(this->panel_Properties);
368 this->panel_Properties->Destroy();
371 this->panel_Properties = new wxCDMProjectDescriptionPanel(
373 this->model->GetProject(),
374 ID_WINDOW_PROPERTIES,
375 wxT("Description Panel"),
381 //change project's actions panel
382 if(this->panel_ProjectActions!= NULL)
384 auiManager.DetachPane(this->panel_ProjectActions);
385 this->panel_ProjectActions->Destroy();
387 panel_ProjectActions = new wxCDMProjectActionsPanel(
389 ID_WINDOW_PROJ_ACTIONS,
390 wxT("Project Actions Panel"),
395 panel_ProjectActions->SetMinSize(wxSize(500, 100));
398 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
399 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();
428 if(this->panel_ProjectActions != NULL)
430 auiManager.DetachPane(this->panel_ProjectActions);
431 this->panel_ProjectActions->Destroy();
434 this->panel_Properties = new wxCDMMainDescriptionPanel(
436 ID_WINDOW_PROPERTIES,
437 wxT("Description Panel"),
443 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
448 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
450 std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
452 if(!this->model->CloseProject(result))
454 std::cout << "error closing project: " << *result << std::endl;
455 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
457 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
459 if(this->panel_Properties != NULL)
461 auiManager.DetachPane(this->panel_Properties);
462 this->panel_Properties->Destroy();
464 if(this->panel_ProjectActions != NULL)
466 auiManager.DetachPane(this->panel_ProjectActions);
467 this->panel_ProjectActions->Destroy();
470 this->panel_Properties = new wxCDMMainDescriptionPanel(
472 ID_WINDOW_PROPERTIES,
473 wxT("Description Panel"),
479 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
484 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
486 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
489 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
491 std::cout << "Closing CreaDevManager..." << std::endl;
493 if(!this->model->CloseProject(result))
495 std::cout << "error closing project: " << *result << std::endl;
496 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
498 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
500 if(this->panel_Properties != NULL)
502 auiManager.DetachPane(this->panel_Properties);
503 this->panel_Properties->Destroy();
505 if(this->panel_ProjectActions != NULL)
507 auiManager.DetachPane(this->panel_ProjectActions);
508 this->panel_ProjectActions->Destroy();
511 this->panel_Properties = new wxCDMMainDescriptionPanel(
513 ID_WINDOW_PROPERTIES,
514 wxT("Description Panel"),
524 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
527 if(!model->RefreshProject(result))
529 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
531 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
532 this->auiManager.Update();
533 //TODO: Show possible problems in CMakeLists files
536 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
538 std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
541 void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
543 std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
546 void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
548 std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
551 void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
553 std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
556 void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
558 std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
561 void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
563 std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
568 void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
570 std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
573 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
575 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
578 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
580 std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
583 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
585 std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
588 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
590 std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
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)
618 std::cout << "New Tree Selection" << std::endl;
620 if(event.GetId() != 0)
626 //get selected element
627 wxTreeItemId elementId = event.GetItem();
629 //get element from model
630 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
631 std::cout << "Tree Selection: " << element->GetName() << std::endl;
633 //TODO get element type
635 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
636 wxPanel* description;
637 if(elementProject != NULL)
639 //create element description
640 description = new wxCDMProjectDescriptionPanel(
643 ID_WINDOW_PROPERTIES,
644 wxT("Description Panel"),
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 this->panel_Properties->Destroy();
838 auiManager.DetachPane(this->panel_Properties);
842 this->panel_Properties = description;
843 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
850 void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
852 std::cout << "inMainFrame id: " << event.GetId() << ", tree element: "<< event.GetInt() << std::endl;
853 switch(event.GetId() != 0)
856 //select out old one to generate selection event
857 this->tree_Projects->SelectItem(event.GetInt(), false);
858 this->tree_Projects->SelectItem(event.GetInt(), true);
861 wxPanel* description = NULL;
862 if(event.GetString() == wxT("manage_packages"))
864 description = new wxCDMPackageManagerPanel(
866 this->model->GetProject(),
867 ID_WINDOW_PROPERTIES,
868 wxT("Description Panel"),
874 else if(event.GetString() == wxT("manage_libraries"))
876 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), false);
877 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
880 else if(event.GetString() == wxT("manage_applications"))
882 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), false);
883 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
887 if(this->panel_Properties!= NULL)
888 this->panel_Properties->Hide();
890 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
894 if(this->panel_Properties!= NULL)
896 this->panel_Properties->Destroy();
897 auiManager.DetachPane(this->panel_Properties);
901 this->panel_Properties = description;