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
222 this->actualTreeItem.Unset();
224 panel_Properties = new wxCDMMainDescriptionPanel(
226 ID_WINDOW_PROPERTIES,
227 wxT("Description Panel"),
233 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
234 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
236 //auiManager.LoadPerspective(pers,true);
237 wxToolTip::Enable(true);
238 wxToolTip::SetDelay(0);
243 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
247 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
249 userResponse = dialog->ShowModal();
251 if(userResponse == wxID_FORWARD)
254 if(this->model->GetProject() != NULL)
256 if(!this->model->CloseProject(result))
258 std::cout << "error closing project: " << *result << std::endl;
259 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
266 if(!this->model->CreateProject(
267 crea::wx2std(dialog->GetProjectName()),
268 crea::wx2std(dialog->GetProjectLocation()),
270 crea::wx2std(dialog->GetPackageAuthor()),
271 crea::wx2std(dialog->GetPackageDescription())
274 std::cout << "error opening project: " << *result << std::endl;
275 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
280 //show project actions panel
281 if(this->panel_ProjectActions != NULL)
283 auiManager.DetachPane(this->panel_Properties);
284 this->panel_ProjectActions->Destroy();
285 this->panel_ProjectActions = NULL;
288 panel_ProjectActions = new wxCDMProjectActionsPanel(
290 this->model->GetProject(),
291 ID_WINDOW_PROJ_ACTIONS,
292 wxT("Project Actions Panel"),
298 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
301 //populate tree control
302 tree_Projects->Unselect();
303 this->actualTreeItem.Unset();
304 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
305 tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId());
306 wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR);
309 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
313 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
314 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
315 long userResponse = FD->ShowModal();
316 if(userResponse == wxID_OK)
318 std::string path = crea::wx2std (FD->GetPath());
322 std::cout << "Selection to open: " << path << std::endl;
326 if(this->model->GetProject() != NULL)
328 std::cout << "Project not null, closing it" << std::endl;
329 if(!this->model->CloseProject(result))
331 std::cout << "error closing project: " << *result << std::endl;
332 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
338 if (!this->model->OpenProject(path, result))
340 std::cout << "error opening project: " << *result << std::endl;
341 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
346 std::cout << "building ui" << std::endl;
348 //populate tree control
349 tree_Projects->Unselect();
350 this->actualTreeItem.Unset();
351 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
352 tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
355 //change project's actions panel
356 if(this->panel_ProjectActions!= NULL)
358 auiManager.DetachPane(this->panel_ProjectActions);
359 this->panel_ProjectActions->Destroy();
360 this->panel_ProjectActions = NULL;
362 panel_ProjectActions = new wxCDMProjectActionsPanel(
364 this->model->GetProject(),
365 ID_WINDOW_PROJ_ACTIONS,
366 wxT("Project Actions Panel"),
371 panel_ProjectActions->SetMinSize(wxSize(500, 100));
374 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());
392 this->actualTreeItem.Unset();
393 if(this->panel_Properties != NULL)
395 auiManager.DetachPane(this->panel_Properties);
396 this->panel_Properties->Hide();
398 if(this->panel_ProjectActions != NULL)
400 auiManager.DetachPane(this->panel_ProjectActions);
401 this->panel_ProjectActions->Hide();
404 this->panel_Properties = new wxCDMMainDescriptionPanel(
406 ID_WINDOW_PROPERTIES,
407 wxT("Description Panel"),
413 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
418 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
420 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
423 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
425 std::cout << "Closing CreaDevManager..." << std::endl;
427 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
429 std::cout << "error closing project: " << *result << std::endl;
432 if(this->panel_Properties != NULL)
434 auiManager.DetachPane(this->panel_Properties);
435 this->panel_Properties->Destroy();
436 this->panel_Properties = NULL;
439 if(this->tree_Projects != NULL)
441 auiManager.DetachPane(this->tree_Projects);
442 this->tree_Projects->Destroy();
443 this->tree_Projects = NULL;
446 if(this->panel_ProjectActions != NULL)
448 auiManager.DetachPane(this->panel_ProjectActions);
449 this->panel_ProjectActions->Destroy();
450 this->panel_ProjectActions = NULL;
457 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
460 if(!model->RefreshProject(result))
462 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
464 if(this->model->GetProject() != NULL)
466 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
467 this->auiManager.Update();
469 this->tree_Projects->Unselect();
470 this->tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
475 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
477 std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
479 if(CDMUtilities::openBBEditor())
481 wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
484 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
486 if(CDMUtilities::openCreaToolsTools())
488 wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
491 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
493 if(CDMUtilities::openTextEditor())
495 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);
498 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
500 if(CDMUtilities::openTerminal())
502 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);
507 void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
509 wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en/CreatoolsDocumentation"), 0);
511 void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
513 wxLaunchDefaultBrowser(_T("http://vip.creatis.insa-lyon.fr:9002/projects/crea"), 0);
515 void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
517 wxBoxSizer *topsizer;
519 wxDialog dlg(this, wxID_ANY, wxString(_("About")));
521 topsizer = new wxBoxSizer(wxVERTICAL);
523 html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
524 html -> SetBorders(0);
526 std::string content = ""
528 "<body bgcolor=\"#3333CC\">"
529 "<table cellspacing=3 cellpadding=4 width=\"100%\">"
531 " <td bgcolor=\"#3333CC\">"
533 " <font size=+2 color=\"#FFFFFF\"><b>CREA Development Manager</b>"
539 " <td bgcolor=\"#FFFFFF\">"
540 " <p><b><font size=+1>Creatis 2012 - Lyon, France</font></b></p>"
542 " <table cellpadding=0 cellspacing=0 width=\"100%\">"
544 " <td width=\"65%\">"
545 " <p>Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr</p>"
550 " <p>This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software.</p>"
560 html -> SetPage(crea::std2wx(content));
561 html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
562 html -> GetInternalRepresentation() -> GetHeight());
564 topsizer -> Add(html, 1, wxALL, 10);
567 topsizer -> Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
568 #endif // wxUSE_STATLINE
570 wxButton *bu1 = new wxButton(&dlg, wxID_OK, _("OK"));
573 topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
575 dlg.SetSizer(topsizer);
576 topsizer -> Fit(&dlg);
580 void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
582 wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en"), 0);
585 void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
588 //get selected element
589 wxTreeItemId elementId = event.GetItem();
590 //elementId.IsOk() && this->tree_Projects->IsSelected(elementId)
591 if(elementId.IsOk() && this->actualTreeItem != elementId)
594 std::cout << "Tree Selection id: " << elementId.m_pItem << std::endl;
595 //get element from model
596 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
600 std::cout << "Tree Selection: " << element->GetName() << std::endl;
602 //std::stringstream ss;
603 //ss << this->actualTreeItem.m_pItem << ":" << event.GetOldItem().m_pItem << " --> " << elementId.m_pItem;
604 //wxMessageBox( wxT("Tree Selection id: " + ss.str() + " by " + element->GetName()), wxT("Refresh Project - Error"), wxICON_ERROR);
605 this->actualTreeItem = elementId;
609 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
610 wxPanel* description;
611 if(elementProject != NULL)
613 //create element description
614 description = new wxCDMProjectDescriptionPanel(
617 ID_WINDOW_PROPERTIES,
618 wxT("Description Panel"),
628 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
629 if(elementAppli != NULL)
631 //create element description
632 description = new wxCDMAppliDescriptionPanel(
635 ID_WINDOW_PROPERTIES,
636 wxT("Description Panel"),
646 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
647 if(elementApplication != NULL)
649 //create element description
650 description = new wxCDMApplicationDescriptionPanel(
653 ID_WINDOW_PROPERTIES,
654 wxT("Description Panel"),
663 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
664 if(elementLib != NULL)
666 //create element description
667 description = new wxCDMLibDescriptionPanel(
670 ID_WINDOW_PROPERTIES,
671 wxT("Description Panel"),
680 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
681 if(elementLibrary != NULL)
683 //create element description
684 description = new wxCDMLibraryDescriptionPanel(
687 ID_WINDOW_PROPERTIES,
688 wxT("Description Panel"),
697 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
698 if(elementPackage != NULL)
700 //create element description
701 description = new wxCDMPackageDescriptionPanel(
704 ID_WINDOW_PROPERTIES,
705 wxT("Description Panel"),
714 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
715 if(elementBlackBox != NULL)
717 //create element description
718 description = new wxCDMBlackBoxDescriptionPanel(
721 ID_WINDOW_PROPERTIES,
722 wxT("Description Panel"),
731 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
732 if(elementCMakeLists != NULL)
734 //create element description
735 description = new wxCDMCMakeListsDescriptionPanel(
738 ID_WINDOW_PROPERTIES,
739 wxT("Description Panel"),
748 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
749 if(elementFolder != NULL)
751 //create element description
752 description = new wxCDMFolderDescriptionPanel(
755 ID_WINDOW_PROPERTIES,
756 wxT("Description Panel"),
765 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
766 if(elementFile != NULL)
768 //create element description
769 description = new wxCDMFileDescriptionPanel(
772 ID_WINDOW_PROPERTIES,
773 wxT("Description Panel"),
783 //create element description
784 description = new wxCDMMainDescriptionPanel(
786 ID_WINDOW_PROPERTIES,
787 wxT("Description Panel"),
804 if(this->panel_Properties!= NULL)
806 this->panel_Properties->Hide();
807 auiManager.DetachPane(this->panel_Properties);
808 //this->panel_Properties->Destroy();
809 //this->panel_Properties = NULL;
812 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
813 this->panel_Properties = description;
826 void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
828 modelCDMIProjectTreeNode* myItem = NULL;
829 wxPanel* description = NULL;
830 switch(event.GetId())
833 myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
834 //select out old one to generate selection event
835 this->tree_Projects->Unselect();
836 this->tree_Projects->SelectItem(myItem->GetId().GetWxId());
837 this->tree_Projects->Expand(myItem->GetId().GetWxId());
841 if(event.GetString() == wxT("manage_packages"))
843 //this->tree_Projects->Expand(this->model->GetProject()->GetId());
844 //this->tree_Projects->Unselect();
845 this->actualTreeItem.Unset();
846 description = new wxCDMPackageManagerPanel(
848 this->model->GetProject(),
849 ID_WINDOW_PROPERTIES,
850 wxT("Description Panel"),
856 else if(event.GetString() == wxT("manage_libraries"))
858 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId().GetWxId());
859 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId().GetWxId());
862 else if(event.GetString() == wxT("manage_applications"))
864 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId().GetWxId());
865 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId().GetWxId());
868 else if(event.GetString() == wxT("blackbox"))
870 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
871 this->actualTreeItem.Unset();
872 description = new wxCDMBlackBoxDescriptionPanel(
875 ID_WINDOW_PROPERTIES,
876 wxT("Description Panel"),
885 if(this->panel_Properties!= NULL)
887 this->panel_Properties->Hide();
888 auiManager.DetachPane(this->panel_Properties);
889 this->panel_Properties->Destroy();
890 this->panel_Properties = NULL;
893 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
894 this->panel_Properties = description;
903 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
905 //std::cout << "element " << event.GetInt() << std::endl;
906 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
907 this->tree_Projects->EnsureVisible(item->GetId().GetWxId());
908 this->tree_Projects->SetItemBold(item->GetId().GetWxId(), true);
909 this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,255));
910 this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(230,230,255));
911 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
915 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
917 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
918 this->tree_Projects->SetItemBold(item->GetId().GetWxId(), false);
919 this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,0));
920 this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(255,255,255));
921 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
925 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
927 this->help = !this->help;
928 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
931 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
938 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);