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 "creaSystem.h"
35 #include "wx/treectrl.h"
36 #include "wx/treebase.h"
37 #include "wx/tooltip.h"
38 #include "wx/wxhtml.h"
39 #include "wx/statline.h"
40 #include "CDMUtilities.h"
42 #include "creaDevManagerIds.h"
43 #include "wxCDMMainDescriptionPanel.h"
44 #include "wxCDMProjectDescriptionPanel.h"
45 #include "wxCDMAppliDescriptionPanel.h"
46 #include "wxCDMApplicationDescriptionPanel.h"
47 #include "wxCDMLibDescriptionPanel.h"
48 #include "wxCDMLibraryDescriptionPanel.h"
49 #include "wxCDMPackageDescriptionPanel.h"
50 #include "wxCDMBlackBoxDescriptionPanel.h"
51 #include "wxCDMCMakeListsDescriptionPanel.h"
52 #include "wxCDMFolderDescriptionPanel.h"
53 #include "wxCDMFileDescriptionPanel.h"
54 #include "wxCDMPackageManagerPanel.h"
56 #include "wxCDMProjectActionsPanel.h"
57 #include "wxCDMNewProjectDialog.h"
61 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
62 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
63 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
64 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
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_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
69 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
70 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
71 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
72 EVT_MENU(ID_MENU_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp)
73 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
74 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
75 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
76 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
78 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
79 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
81 EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
83 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnChangeView)
84 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCDMMainFrame::OnElementSelected)
85 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, wxCDMMainFrame::OnElementDeselected)
88 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp)
91 wxCDMMainFrame::wxCDMMainFrame(
94 const wxString& caption,
100 this->menu_File = NULL;
101 this->menu_Edit = NULL;
102 this->menu_Tools = NULL;
103 this->menu_Help = NULL;
104 this->panel_Properties = NULL;
105 this->panel_ProjectActions = NULL;
106 this->tree_Projects = NULL;
107 Create(parent, id, caption, pos, size, style);
110 wxCDMMainFrame::~wxCDMMainFrame()
115 bool wxCDMMainFrame::Create(
118 const wxString& caption,
124 wxFrame::Create(parent, id, caption, pos, size, style);
125 this->model = new modelCDMMain();
132 modelCDMMain* wxCDMMainFrame::GetModel() const
137 wxPanel* wxCDMMainFrame::GetPropertiesPanel() const
139 return this->panel_Properties;
142 bool wxCDMMainFrame::isHelp() const
147 void wxCDMMainFrame::RefreshProject()
150 std::cout << "refreshing project" << std::endl;
151 this->model->RefreshProject(result);
152 std::cout << "rebuilding project tree" << std::endl;
153 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
156 void wxCDMMainFrame::CreateMenus()
158 wxMenuBar* menuBar = new wxMenuBar;
161 menu_File = new wxMenu();
162 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
163 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
164 menu_File->AppendSeparator();
165 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
166 menu_File->AppendSeparator();
167 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
168 menu_File->AppendSeparator();
169 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
171 menuBar->Append(menu_File, wxT("&File"));
174 menu_Edit = new wxMenu();
175 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
177 menuBar->Append(menu_Edit, wxT("&Edit"));
180 menu_Tools = new wxMenu();
181 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
182 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
183 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
184 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
186 menuBar->Append(menu_Tools, wxT("&Tools"));
189 menu_Help = new wxMenu();
190 menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs"));
191 menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
192 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
193 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
194 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
195 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
197 menuBar->Append(menu_Help, wxT("&Help"));
202 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
203 statusBar->SetFieldsCount(1);
204 SetStatusBar(statusBar);
208 void wxCDMMainFrame::CreateControls()
211 auiManager.SetManagedWindow(this);
214 tree_Projects = new wxCDMProjectsTreeCtrl(
219 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
222 panel_Properties = new wxCDMMainDescriptionPanel(
224 ID_WINDOW_PROPERTIES,
225 wxT("Description Panel"),
231 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
232 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
234 //auiManager.LoadPerspective(pers,true);
235 wxToolTip::Enable(true);
236 wxToolTip::SetDelay(0);
241 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
245 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
247 userResponse = dialog->ShowModal();
249 if(userResponse == wxID_FORWARD)
252 if(this->model->GetProject() != NULL)
254 if(!this->model->CloseProject(result))
256 std::cout << "error closing project: " << *result << std::endl;
257 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
264 if(!this->model->CreateProject(
265 crea::wx2std(dialog->GetProjectName()),
266 crea::wx2std(dialog->GetProjectLocation()),
268 crea::wx2std(dialog->GetPackageAuthor()),
269 crea::wx2std(dialog->GetPackageDescription())
272 std::cout << "error opening project: " << *result << std::endl;
273 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
278 //populate tree control
279 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
280 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
281 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
284 //show project actions panel
285 if(this->panel_ProjectActions != NULL)
287 auiManager.DetachPane(this->panel_Properties);
288 this->panel_ProjectActions->Destroy();
289 this->panel_ProjectActions = NULL;
292 panel_ProjectActions = new wxCDMProjectActionsPanel(
294 this->model->GetProject(),
295 ID_WINDOW_PROJ_ACTIONS,
296 wxT("Project Actions Panel"),
301 panel_ProjectActions->SetMinSize(wxSize(500, 100));
304 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
308 //wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
314 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
318 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
319 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
320 long userResponse = FD->ShowModal();
321 if(userResponse == wxID_OK)
323 std::string path = crea::wx2std (FD->GetPath());
327 std::cout << "Selection to open: " << path << std::endl;
331 if(this->model->GetProject() != NULL)
333 std::cout << "Project not null, closing it" << std::endl;
334 if(!this->model->CloseProject(result))
336 std::cout << "error closing project: " << *result << std::endl;
337 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
343 if (!this->model->OpenProject(path, result))
345 std::cout << "error opening project: " << *result << std::endl;
346 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
351 std::cout << "building ui" << std::endl;
353 //populate tree control
354 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
355 tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
356 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
360 //change project's actions panel
361 if(this->panel_ProjectActions!= NULL)
363 auiManager.DetachPane(this->panel_ProjectActions);
364 this->panel_ProjectActions->Destroy();
365 this->panel_ProjectActions = NULL;
367 panel_ProjectActions = new wxCDMProjectActionsPanel(
369 this->model->GetProject(),
370 ID_WINDOW_PROJ_ACTIONS,
371 wxT("Project Actions Panel"),
376 panel_ProjectActions->SetMinSize(wxSize(500, 100));
379 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
388 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
390 std::cout << "closing project" << std::endl;
392 if(!this->model->CloseProject(result))
394 std::cout << "error closing project: " << *result << std::endl;
395 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
398 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
400 if(this->panel_Properties != NULL)
402 auiManager.DetachPane(this->panel_Properties);
403 this->panel_Properties->Destroy();
404 this->panel_Properties = NULL;
406 if(this->panel_ProjectActions != NULL)
408 auiManager.DetachPane(this->panel_ProjectActions);
409 this->panel_ProjectActions->Destroy();
410 this->panel_ProjectActions = NULL;
413 this->panel_Properties = new wxCDMMainDescriptionPanel(
415 ID_WINDOW_PROPERTIES,
416 wxT("Description Panel"),
422 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
428 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
430 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
433 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
435 std::cout << "Closing CreaDevManager..." << std::endl;
437 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
439 std::cout << "error closing project: " << *result << std::endl;
441 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
442 if(this->panel_Properties != NULL)
444 auiManager.DetachPane(this->panel_Properties);
445 this->panel_Properties->Destroy();
446 this->panel_Properties = NULL;
449 if(this->panel_ProjectActions != NULL)
451 auiManager.DetachPane(this->panel_ProjectActions);
452 this->panel_ProjectActions->Destroy();
453 this->panel_ProjectActions = NULL;
460 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
463 if(!model->RefreshProject(result))
465 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
467 if(this->model->GetProject() != NULL)
469 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
470 this->auiManager.Update();
472 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
473 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
478 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
480 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
482 if(CDMUtilities::openBBEditor())
484 wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
487 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
489 if(CDMUtilities::openCreaToolsTools())
491 wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
494 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
496 if(CDMUtilities::openTextEditor())
498 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);
501 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
503 if(CDMUtilities::openTerminal())
505 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);
510 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
512 wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en/CreatoolsDocumentation"), 0);
514 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
516 wxLaunchDefaultBrowser(_T("http://vip.creatis.insa-lyon.fr:9002/projects/crea"), 0);
518 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
520 wxBoxSizer *topsizer;
522 wxDialog dlg(this, wxID_ANY, wxString(_("About")));
524 topsizer = new wxBoxSizer(wxVERTICAL);
526 html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
527 html -> SetBorders(0);
528 html -> LoadPage(wxT("about.html"));
529 html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
530 html -> GetInternalRepresentation() -> GetHeight());
532 topsizer -> Add(html, 1, wxALL, 10);
535 topsizer -> Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
536 #endif // wxUSE_STATLINE
538 wxButton *bu1 = new wxButton(&dlg, wxID_OK, _("OK"));
541 topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
543 dlg.SetSizer(topsizer);
544 topsizer -> Fit(&dlg);
548 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
550 wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en"), 0);
553 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
556 //get selected element
557 wxTreeItemId elementId = event.GetItem();
558 if(this->tree_Projects->IsSelected(elementId))
560 std::cout << "Tree Selection id: " << elementId << std::endl;
561 //get element from model
562 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
565 std::cout << "Tree Selection: " << element->GetName() << std::endl;
567 //TODO get element type
569 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
570 wxPanel* description;
571 if(elementProject != NULL)
573 //create element description
574 description = new wxCDMProjectDescriptionPanel(
577 ID_WINDOW_PROPERTIES,
578 wxT("Description Panel"),
588 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
589 if(elementAppli != NULL)
591 //create element description
592 description = new wxCDMAppliDescriptionPanel(
595 ID_WINDOW_PROPERTIES,
596 wxT("Description Panel"),
606 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
607 if(elementApplication != NULL)
609 //create element description
610 description = new wxCDMApplicationDescriptionPanel(
613 ID_WINDOW_PROPERTIES,
614 wxT("Description Panel"),
623 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
624 if(elementLib != NULL)
626 //create element description
627 description = new wxCDMLibDescriptionPanel(
630 ID_WINDOW_PROPERTIES,
631 wxT("Description Panel"),
640 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
641 if(elementLibrary != NULL)
643 //create element description
644 description = new wxCDMLibraryDescriptionPanel(
647 ID_WINDOW_PROPERTIES,
648 wxT("Description Panel"),
657 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
658 if(elementPackage != NULL)
660 //create element description
661 description = new wxCDMPackageDescriptionPanel(
664 ID_WINDOW_PROPERTIES,
665 wxT("Description Panel"),
674 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
675 if(elementBlackBox != NULL)
677 //create element description
678 description = new wxCDMBlackBoxDescriptionPanel(
681 ID_WINDOW_PROPERTIES,
682 wxT("Description Panel"),
691 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
692 if(elementCMakeLists != NULL)
694 //create element description
695 description = new wxCDMCMakeListsDescriptionPanel(
698 ID_WINDOW_PROPERTIES,
699 wxT("Description Panel"),
708 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
709 if(elementFolder != NULL)
711 //create element description
712 description = new wxCDMFolderDescriptionPanel(
715 ID_WINDOW_PROPERTIES,
716 wxT("Description Panel"),
725 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
726 if(elementFile != NULL)
728 //create element description
729 description = new wxCDMFileDescriptionPanel(
732 ID_WINDOW_PROPERTIES,
733 wxT("Description Panel"),
743 //create element description
744 description = new wxCDMMainDescriptionPanel(
746 ID_WINDOW_PROPERTIES,
747 wxT("Description Panel"),
763 if(this->panel_Properties!= NULL)
764 this->panel_Properties->Hide();
766 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
770 if(this->panel_Properties!= NULL)
772 auiManager.DetachPane(this->panel_Properties);
773 this->panel_Properties->Destroy();
774 this->panel_Properties = NULL;
778 this->panel_Properties = description;
780 //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
789 void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
791 modelCDMIProjectTreeNode* myItem = NULL;
792 switch(event.GetId())
795 myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
796 //select out old one to generate selection event
797 this->tree_Projects->SelectItem(myItem->GetId(), false);
798 this->tree_Projects->SelectItem(myItem->GetId(), true);
799 this->tree_Projects->Expand(myItem->GetId());
802 wxPanel* description = NULL;
803 if(event.GetString() == wxT("manage_packages"))
805 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
806 this->tree_Projects->Expand(this->model->GetProject()->GetId());
807 description = new wxCDMPackageManagerPanel(
809 this->model->GetProject(),
810 ID_WINDOW_PROPERTIES,
811 wxT("Description Panel"),
817 else if(event.GetString() == wxT("manage_libraries"))
819 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
820 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
823 else if(event.GetString() == wxT("manage_applications"))
825 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
826 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
829 else if(event.GetString() == wxT("blackbox"))
831 this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
832 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
833 description = new wxCDMBlackBoxDescriptionPanel(
836 ID_WINDOW_PROPERTIES,
837 wxT("Description Panel"),
844 if(this->panel_Properties!= NULL)
845 this->panel_Properties->Hide();
847 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
851 if(this->panel_Properties!= NULL)
853 auiManager.DetachPane(this->panel_Properties);
854 this->panel_Properties->Destroy();
855 this->panel_Properties = NULL;
859 this->panel_Properties = description;
866 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
868 //std::cout << "element " << event.GetInt() << std::endl;
869 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
870 this->tree_Projects->EnsureVisible(item->GetId());
871 this->tree_Projects->SetItemBold(item->GetId(), true);
872 this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,255));
873 this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(230,230,255));
874 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
878 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
880 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
881 this->tree_Projects->SetItemBold(item->GetId(), false);
882 this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,0));
883 this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(255,255,255));
884 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
888 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
890 this->help = !this->help;
891 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
894 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
901 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);