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"
35 #include "creaSystem.h"
36 #include "wx/treectrl.h"
37 #include "wx/treebase.h"
38 #include "wx/tooltip.h"
39 #include "wx/wxhtml.h"
40 #include "wx/statline.h"
41 #include "CDMUtilities.h"
43 #include "creaDevManagerIds.h"
44 #include "wxCDMMainDescriptionPanel.h"
45 #include "wxCDMProjectDescriptionPanel.h"
46 #include "wxCDMAppliDescriptionPanel.h"
47 #include "wxCDMApplicationDescriptionPanel.h"
48 #include "wxCDMLibDescriptionPanel.h"
49 #include "wxCDMLibraryDescriptionPanel.h"
50 #include "wxCDMPackageDescriptionPanel.h"
51 #include "wxCDMBlackBoxDescriptionPanel.h"
52 #include "wxCDMCMakeListsDescriptionPanel.h"
53 #include "wxCDMFolderDescriptionPanel.h"
54 #include "wxCDMFileDescriptionPanel.h"
55 #include "wxCDMPackageManagerPanel.h"
57 #include "wxCDMProjectActionsPanel.h"
58 #include "wxCDMNewProjectDialog.h"
62 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
63 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
64 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
65 EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
66 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
67 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
68 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
69 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
70 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
71 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
72 EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
73 EVT_MENU(ID_MENU_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp)
74 EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
75 EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
76 EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
77 EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
79 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
80 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
82 EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
84 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnChangeView)
85 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCDMMainFrame::OnElementSelected)
86 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, wxCDMMainFrame::OnElementDeselected)
89 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp)
92 wxCDMMainFrame::wxCDMMainFrame(
95 const wxString& caption,
101 this->menu_File = NULL;
102 this->menu_Edit = NULL;
103 this->menu_Tools = NULL;
104 this->menu_Help = NULL;
105 this->panel_Properties = NULL;
106 this->panel_ProjectActions = NULL;
107 this->tree_Projects = NULL;
108 Create(parent, id, caption, pos, size, style);
111 wxCDMMainFrame::~wxCDMMainFrame()
116 bool wxCDMMainFrame::Create(
119 const wxString& caption,
125 wxFrame::Create(parent, id, caption, pos, size, style);
126 this->model = new modelCDMMain();
133 modelCDMMain* wxCDMMainFrame::GetModel() const
138 wxPanel* wxCDMMainFrame::GetPropertiesPanel() const
140 return this->panel_Properties;
143 bool wxCDMMainFrame::isHelp() const
148 void wxCDMMainFrame::RefreshProject()
151 std::cout << "refreshing project" << std::endl;
152 this->model->RefreshProject(result);
153 std::cout << "rebuilding project tree" << std::endl;
154 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
157 void wxCDMMainFrame::CreateMenus()
159 wxMenuBar* menuBar = new wxMenuBar;
162 menu_File = new wxMenu();
163 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
164 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
165 menu_File->AppendSeparator();
166 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
167 menu_File->AppendSeparator();
168 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
169 menu_File->AppendSeparator();
170 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
172 menuBar->Append(menu_File, wxT("&File"));
175 menu_Edit = new wxMenu();
176 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
178 menuBar->Append(menu_Edit, wxT("&Edit"));
181 menu_Tools = new wxMenu();
182 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
183 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
184 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
185 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
187 menuBar->Append(menu_Tools, wxT("&Tools"));
190 menu_Help = new wxMenu();
191 menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs"));
192 menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
193 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
194 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
195 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
196 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
198 menuBar->Append(menu_Help, wxT("&Help"));
203 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
204 statusBar->SetFieldsCount(1);
205 SetStatusBar(statusBar);
209 void wxCDMMainFrame::CreateControls()
212 auiManager.SetManagedWindow(this);
215 tree_Projects = new wxCDMProjectsTreeCtrl(
220 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
223 panel_Properties = new wxCDMMainDescriptionPanel(
225 ID_WINDOW_PROPERTIES,
226 wxT("Description Panel"),
232 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
233 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
235 //auiManager.LoadPerspective(pers,true);
236 wxToolTip::Enable(true);
237 wxToolTip::SetDelay(0);
242 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
246 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
248 userResponse = dialog->ShowModal();
250 if(userResponse == wxID_FORWARD)
253 if(this->model->GetProject() != NULL)
255 if(!this->model->CloseProject(result))
257 std::cout << "error closing project: " << *result << std::endl;
258 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
265 if(!this->model->CreateProject(
266 crea::wx2std(dialog->GetProjectName()),
267 crea::wx2std(dialog->GetProjectLocation()),
269 crea::wx2std(dialog->GetPackageAuthor()),
270 crea::wx2std(dialog->GetPackageDescription())
273 std::cout << "error opening project: " << *result << std::endl;
274 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
279 //show project actions panel
280 if(this->panel_ProjectActions != NULL)
282 auiManager.DetachPane(this->panel_Properties);
283 this->panel_ProjectActions->Destroy();
284 this->panel_ProjectActions = NULL;
287 panel_ProjectActions = new wxCDMProjectActionsPanel(
289 this->model->GetProject(),
290 ID_WINDOW_PROJ_ACTIONS,
291 wxT("Project Actions Panel"),
297 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
300 //populate tree control
301 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
302 tree_Projects->Unselect();
303 tree_Projects->SelectItem(this->model->GetProject()->GetId());
304 wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR);
307 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
311 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
312 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
313 long userResponse = FD->ShowModal();
314 if(userResponse == wxID_OK)
316 std::string path = crea::wx2std (FD->GetPath());
320 std::cout << "Selection to open: " << path << std::endl;
324 if(this->model->GetProject() != NULL)
326 std::cout << "Project not null, closing it" << std::endl;
327 if(!this->model->CloseProject(result))
329 std::cout << "error closing project: " << *result << std::endl;
330 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
336 if (!this->model->OpenProject(path, result))
338 std::cout << "error opening project: " << *result << std::endl;
339 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
344 std::cout << "building ui" << std::endl;
346 //populate tree control
347 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
348 tree_Projects->Unselect();
349 tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
353 //change project's actions panel
354 if(this->panel_ProjectActions!= NULL)
356 auiManager.DetachPane(this->panel_ProjectActions);
357 this->panel_ProjectActions->Destroy();
358 this->panel_ProjectActions = NULL;
360 panel_ProjectActions = new wxCDMProjectActionsPanel(
362 this->model->GetProject(),
363 ID_WINDOW_PROJ_ACTIONS,
364 wxT("Project Actions Panel"),
369 panel_ProjectActions->SetMinSize(wxSize(500, 100));
372 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
381 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
383 std::cout << "closing project" << std::endl;
385 if(!this->model->CloseProject(result))
387 std::cout << "error closing project: " << *result << std::endl;
388 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
391 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
393 if(this->panel_Properties != NULL)
395 auiManager.DetachPane(this->panel_Properties);
396 this->panel_Properties->Destroy();
397 this->panel_Properties = NULL;
399 if(this->panel_ProjectActions != NULL)
401 auiManager.DetachPane(this->panel_ProjectActions);
402 this->panel_ProjectActions->Destroy();
403 this->panel_ProjectActions = NULL;
406 this->panel_Properties = new wxCDMMainDescriptionPanel(
408 ID_WINDOW_PROPERTIES,
409 wxT("Description Panel"),
415 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
421 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
423 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
426 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
428 std::cout << "Closing CreaDevManager..." << std::endl;
430 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
432 std::cout << "error closing project: " << *result << std::endl;
435 if(this->panel_Properties != NULL)
437 auiManager.DetachPane(this->panel_Properties);
438 this->panel_Properties->Destroy();
439 this->panel_Properties = NULL;
442 if(this->tree_Projects != NULL)
444 auiManager.DetachPane(this->tree_Projects);
445 this->tree_Projects->Destroy();
446 this->tree_Projects = 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->Unselect();
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);
529 std::string content = ""
531 "<body bgcolor=\"#3333CC\">"
532 "<table cellspacing=3 cellpadding=4 width=\"100%\">"
534 " <td bgcolor=\"#3333CC\">"
536 " <font size=+2 color=\"#FFFFFF\"><b>CREA Development Manager</b>"
542 " <td bgcolor=\"#FFFFFF\">"
543 " <p><b><font size=+1>Creatis 2012 - Lyon, France</font></b></p>"
545 " <table cellpadding=0 cellspacing=0 width=\"100%\">"
547 " <td width=\"65%\">"
548 " <p>Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr</p>"
553 " <p>This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software.</p>"
563 html -> SetPage(crea::std2wx(content));
564 html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
565 html -> GetInternalRepresentation() -> GetHeight());
567 topsizer -> Add(html, 1, wxALL, 10);
570 topsizer -> Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
571 #endif // wxUSE_STATLINE
573 wxButton *bu1 = new wxButton(&dlg, wxID_OK, _("OK"));
576 topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
578 dlg.SetSizer(topsizer);
579 topsizer -> Fit(&dlg);
583 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
585 wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en"), 0);
588 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
591 //get selected element
592 wxTreeItemId elementId = event.GetItem();
593 if(elementId.IsOk() && this->tree_Projects->IsSelected(elementId))
595 std::cout << "Tree Selection id: " << elementId << std::endl;
596 //get element from model
597 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
601 std::cout << "Tree Selection: " << element->GetName() << std::endl;
603 //TODO get element type
605 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
606 wxPanel* description;
607 if(elementProject != NULL)
609 //create element description
610 description = new wxCDMProjectDescriptionPanel(
613 ID_WINDOW_PROPERTIES,
614 wxT("Description Panel"),
624 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
625 if(elementAppli != NULL)
627 //create element description
628 description = new wxCDMAppliDescriptionPanel(
631 ID_WINDOW_PROPERTIES,
632 wxT("Description Panel"),
642 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
643 if(elementApplication != NULL)
645 //create element description
646 description = new wxCDMApplicationDescriptionPanel(
649 ID_WINDOW_PROPERTIES,
650 wxT("Description Panel"),
659 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
660 if(elementLib != NULL)
662 //create element description
663 description = new wxCDMLibDescriptionPanel(
666 ID_WINDOW_PROPERTIES,
667 wxT("Description Panel"),
676 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
677 if(elementLibrary != NULL)
679 //create element description
680 description = new wxCDMLibraryDescriptionPanel(
683 ID_WINDOW_PROPERTIES,
684 wxT("Description Panel"),
693 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
694 if(elementPackage != NULL)
696 //create element description
697 description = new wxCDMPackageDescriptionPanel(
700 ID_WINDOW_PROPERTIES,
701 wxT("Description Panel"),
710 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
711 if(elementBlackBox != NULL)
713 //create element description
714 description = new wxCDMBlackBoxDescriptionPanel(
717 ID_WINDOW_PROPERTIES,
718 wxT("Description Panel"),
727 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
728 if(elementCMakeLists != NULL)
730 //create element description
731 description = new wxCDMCMakeListsDescriptionPanel(
734 ID_WINDOW_PROPERTIES,
735 wxT("Description Panel"),
744 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
745 if(elementFolder != NULL)
747 //create element description
748 description = new wxCDMFolderDescriptionPanel(
751 ID_WINDOW_PROPERTIES,
752 wxT("Description Panel"),
761 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
762 if(elementFile != NULL)
764 //create element description
765 description = new wxCDMFileDescriptionPanel(
768 ID_WINDOW_PROPERTIES,
769 wxT("Description Panel"),
779 //create element description
780 description = new wxCDMMainDescriptionPanel(
782 ID_WINDOW_PROPERTIES,
783 wxT("Description Panel"),
800 if(this->panel_Properties!= NULL)
802 this->panel_Properties->Hide();
803 auiManager.DetachPane(this->panel_Properties);
804 this->panel_Properties->Destroy();
805 this->panel_Properties = NULL;
808 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
809 this->panel_Properties = description;
819 void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
821 modelCDMIProjectTreeNode* myItem = NULL;
822 switch(event.GetId())
825 myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
826 //select out old one to generate selection event
827 this->tree_Projects->Unselect();
828 this->tree_Projects->SelectItem(myItem->GetId(), true);
829 this->tree_Projects->Expand(myItem->GetId());
832 wxPanel* description = NULL;
833 if(event.GetString() == wxT("manage_packages"))
835 //this->tree_Projects->Expand(this->model->GetProject()->GetId());
836 //this->tree_Projects->Unselect();
837 description = new wxCDMPackageManagerPanel(
839 this->model->GetProject(),
840 ID_WINDOW_PROPERTIES,
841 wxT("Description Panel"),
847 else if(event.GetString() == wxT("manage_libraries"))
849 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
850 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
853 else if(event.GetString() == wxT("manage_applications"))
855 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
856 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
859 else if(event.GetString() == wxT("blackbox"))
861 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
862 description = new wxCDMBlackBoxDescriptionPanel(
865 ID_WINDOW_PROPERTIES,
866 wxT("Description Panel"),
874 if(this->panel_Properties!= NULL)
876 this->panel_Properties->Hide();
877 auiManager.DetachPane(this->panel_Properties);
878 this->panel_Properties->Destroy();
879 this->panel_Properties = NULL;
882 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
883 this->panel_Properties = description;
891 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
893 //std::cout << "element " << event.GetInt() << std::endl;
894 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
895 this->tree_Projects->EnsureVisible(item->GetId());
896 this->tree_Projects->SetItemBold(item->GetId(), true);
897 this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,255));
898 this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(230,230,255));
899 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
903 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
905 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
906 this->tree_Projects->SetItemBold(item->GetId(), false);
907 this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,0));
908 this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(255,255,255));
909 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
913 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
915 this->help = !this->help;
916 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
919 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
926 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);