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());
155 this->tree_Projects->Unselect();
156 this->actualTreeItem.Unset();
159 void wxCDMMainFrame::CreateMenus()
161 wxMenuBar* menuBar = new wxMenuBar;
164 menu_File = new wxMenu();
165 menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
166 menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
167 menu_File->AppendSeparator();
168 menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
169 menu_File->AppendSeparator();
170 menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
171 menu_File->AppendSeparator();
172 menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
174 menuBar->Append(menu_File, wxT("&File"));
177 menu_Edit = new wxMenu();
178 menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
180 menuBar->Append(menu_Edit, wxT("&Edit"));
183 menu_Tools = new wxMenu();
184 menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
185 menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
186 menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
187 menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
189 menuBar->Append(menu_Tools, wxT("&Tools"));
192 menu_Help = new wxMenu();
193 menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs"));
194 menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
195 menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
196 menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
197 menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
198 menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
200 menuBar->Append(menu_Help, wxT("&Help"));
205 wxStatusBar* statusBar = new wxStatusBar(this, ID_STATUS_BAR, wxST_SIZEGRIP);
206 statusBar->SetFieldsCount(1);
207 SetStatusBar(statusBar);
211 void wxCDMMainFrame::CreateControls()
214 auiManager.SetManagedWindow(this);
217 tree_Projects = new wxCDMProjectsTreeCtrl(
222 wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
224 this->actualTreeItem.Unset();
226 panel_Properties = new wxCDMMainDescriptionPanel(
228 ID_WINDOW_PROPERTIES,
229 wxT("Description Panel"),
235 auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
236 auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
238 //auiManager.LoadPerspective(pers,true);
239 wxToolTip::Enable(true);
240 wxToolTip::SetDelay(0);
245 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
249 wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
251 userResponse = dialog->ShowModal();
253 if(userResponse == wxID_FORWARD)
256 if(this->model->GetProject() != NULL)
258 if(!this->model->CloseProject(result))
260 std::cout << "error closing project: " << *result << std::endl;
261 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
268 if(!this->model->CreateProject(
269 crea::wx2std(dialog->GetProjectName()),
270 crea::wx2std(dialog->GetProjectLocation()),
272 crea::wx2std(dialog->GetPackageAuthor()),
273 crea::wx2std(dialog->GetPackageDescription())
276 std::cout << "error opening project: " << *result << std::endl;
277 wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
282 //show project actions panel
283 if(this->panel_ProjectActions != NULL)
285 auiManager.DetachPane(this->panel_Properties);
286 this->panel_ProjectActions->Destroy();
287 this->panel_ProjectActions = NULL;
290 panel_ProjectActions = new wxCDMProjectActionsPanel(
292 this->model->GetProject(),
293 ID_WINDOW_PROJ_ACTIONS,
294 wxT("Project Actions Panel"),
300 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
303 //populate tree control
304 tree_Projects->Unselect();
305 this->actualTreeItem.Unset();
306 tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
307 tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId());
308 //wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR);
311 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
315 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
316 wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
317 long userResponse = FD->ShowModal();
318 if(userResponse == wxID_OK)
320 std::string path = crea::wx2std (FD->GetPath());
324 std::cout << "Selection to open: " << path << std::endl;
328 if(this->model->GetProject() != NULL)
330 std::cout << "Project not null, closing it" << std::endl;
331 if(!this->model->CloseProject(result))
333 std::cout << "error closing project: " << *result << std::endl;
334 wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
340 if (!this->model->OpenProject(path, result))
342 std::cout << "error opening project: " << *result << std::endl;
343 wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
348 std::cout << "building ui" << std::endl;
350 //populate tree control
351 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
352 tree_Projects->Unselect();
353 this->actualTreeItem.Unset();
354 tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
357 //change project's actions panel
358 if(this->panel_ProjectActions!= NULL)
360 auiManager.DetachPane(this->panel_ProjectActions);
361 this->panel_ProjectActions->Destroy();
362 this->panel_ProjectActions = NULL;
364 panel_ProjectActions = new wxCDMProjectActionsPanel(
366 this->model->GetProject(),
367 ID_WINDOW_PROJ_ACTIONS,
368 wxT("Project Actions Panel"),
373 panel_ProjectActions->SetMinSize(wxSize(500, 100));
376 auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false));
383 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
385 std::cout << "closing project" << std::endl;
387 if(!this->model->CloseProject(result))
389 std::cout << "error closing project: " << *result << std::endl;
390 wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
393 tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
394 this->actualTreeItem.Unset();
395 if(this->panel_Properties != NULL)
397 auiManager.DetachPane(this->panel_Properties);
398 this->panel_Properties->Hide();
400 if(this->panel_ProjectActions != NULL)
402 auiManager.DetachPane(this->panel_ProjectActions);
403 this->panel_ProjectActions->Hide();
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));
420 void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
422 std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
425 void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
427 std::cout << "Closing CreaDevManager..." << std::endl;
429 if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
431 std::cout << "error closing project: " << *result << std::endl;
434 if(this->panel_Properties != NULL)
436 auiManager.DetachPane(this->panel_Properties);
437 this->panel_Properties->Destroy();
438 this->panel_Properties = NULL;
441 if(this->tree_Projects != NULL)
443 auiManager.DetachPane(this->tree_Projects);
444 this->tree_Projects->Destroy();
445 this->tree_Projects = NULL;
448 if(this->panel_ProjectActions != NULL)
450 auiManager.DetachPane(this->panel_ProjectActions);
451 this->panel_ProjectActions->Destroy();
452 this->panel_ProjectActions = NULL;
459 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
462 if(!model->RefreshProject(result))
464 wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
466 if(this->model->GetProject() != NULL)
468 this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
469 this->auiManager.Update();
471 this->tree_Projects->Unselect();
472 this->actualTreeItem.Unset();
473 this->tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), 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 //std::cout << "Tree Selection id: " << elementId.m_pItem << this->actualTreeItem.m_pItem << std::endl;
594 //elementId.IsOk() && this->tree_Projects->IsSelected(elementId)
595 if(elementId.IsOk() && this->actualTreeItem != elementId)
598 //std::cout << "Valid tree selection id: " << elementId.m_pItem << std::endl;
599 //get element from model
600 modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
604 std::cout << "Tree Selection: " << element->GetName() << std::endl;
606 //std::stringstream ss;
607 //ss << this->actualTreeItem.m_pItem << ":" << event.GetOldItem().m_pItem << " --> " << elementId.m_pItem;
608 //wxMessageBox( wxT("Tree Selection id: " + ss.str() + " by " + element->GetName()), wxT("Refresh Project - Error"), wxICON_ERROR);
609 this->actualTreeItem = elementId;
613 modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
614 wxPanel* description;
615 if(elementProject != NULL)
617 //create element description
618 description = new wxCDMProjectDescriptionPanel(
621 ID_WINDOW_PROPERTIES,
622 wxT("Description Panel"),
632 modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
633 if(elementAppli != NULL)
635 //create element description
636 description = new wxCDMAppliDescriptionPanel(
639 ID_WINDOW_PROPERTIES,
640 wxT("Description Panel"),
650 modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
651 if(elementApplication != NULL)
653 //create element description
654 description = new wxCDMApplicationDescriptionPanel(
657 ID_WINDOW_PROPERTIES,
658 wxT("Description Panel"),
667 modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
668 if(elementLib != NULL)
670 //create element description
671 description = new wxCDMLibDescriptionPanel(
674 ID_WINDOW_PROPERTIES,
675 wxT("Description Panel"),
684 modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
685 if(elementLibrary != NULL)
687 //create element description
688 description = new wxCDMLibraryDescriptionPanel(
691 ID_WINDOW_PROPERTIES,
692 wxT("Description Panel"),
701 modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
702 if(elementPackage != NULL)
704 //create element description
705 description = new wxCDMPackageDescriptionPanel(
708 ID_WINDOW_PROPERTIES,
709 wxT("Description Panel"),
718 modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
719 if(elementBlackBox != NULL)
721 //create element description
722 description = new wxCDMBlackBoxDescriptionPanel(
725 ID_WINDOW_PROPERTIES,
726 wxT("Description Panel"),
735 modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast<modelCDMCMakeListsFile*>(element);
736 if(elementCMakeLists != NULL)
738 //create element description
739 description = new wxCDMCMakeListsDescriptionPanel(
742 ID_WINDOW_PROPERTIES,
743 wxT("Description Panel"),
752 modelCDMFolder* elementFolder = dynamic_cast<modelCDMFolder*>(element);
753 if(elementFolder != NULL)
755 //create element description
756 description = new wxCDMFolderDescriptionPanel(
759 ID_WINDOW_PROPERTIES,
760 wxT("Description Panel"),
769 modelCDMFile* elementFile = dynamic_cast<modelCDMFile*>(element);
770 if(elementFile != NULL)
772 //create element description
773 description = new wxCDMFileDescriptionPanel(
776 ID_WINDOW_PROPERTIES,
777 wxT("Description Panel"),
787 //create element description
788 description = new wxCDMMainDescriptionPanel(
790 ID_WINDOW_PROPERTIES,
791 wxT("Description Panel"),
808 if(this->panel_Properties!= NULL)
810 this->panel_Properties->Hide();
811 auiManager.DetachPane(this->panel_Properties);
812 //this->panel_Properties->Destroy();
813 //this->panel_Properties = NULL;
816 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
817 this->panel_Properties = description;
830 void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
832 modelCDMIProjectTreeNode* myItem = NULL;
833 wxPanel* description = NULL;
834 switch(event.GetId())
837 myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
838 //select out old one to generate selection event
839 this->tree_Projects->Unselect();
840 this->tree_Projects->SelectItem(myItem->GetId().GetWxId());
841 this->tree_Projects->Expand(myItem->GetId().GetWxId());
845 if(event.GetString() == wxT("manage_packages"))
847 //this->tree_Projects->Expand(this->model->GetProject()->GetId());
848 //this->tree_Projects->Unselect();
849 this->actualTreeItem.Unset();
850 description = new wxCDMPackageManagerPanel(
852 this->model->GetProject(),
853 ID_WINDOW_PROPERTIES,
854 wxT("Description Panel"),
860 else if(event.GetString() == wxT("manage_libraries"))
862 this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId().GetWxId());
863 this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId().GetWxId());
866 else if(event.GetString() == wxT("manage_applications"))
868 this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId().GetWxId());
869 this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId().GetWxId());
872 else if(event.GetString() == wxT("blackbox"))
874 modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
875 this->actualTreeItem.Unset();
876 description = new wxCDMBlackBoxDescriptionPanel(
879 ID_WINDOW_PROPERTIES,
880 wxT("Description Panel"),
889 if(this->panel_Properties!= NULL)
891 this->panel_Properties->Hide();
892 auiManager.DetachPane(this->panel_Properties);
893 this->panel_Properties->Destroy();
894 this->panel_Properties = NULL;
897 auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
898 this->panel_Properties = description;
907 void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
909 //std::cout << "element " << event.GetInt() << std::endl;
910 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
911 this->tree_Projects->EnsureVisible(item->GetId().GetWxId());
912 this->tree_Projects->SetItemBold(item->GetId().GetWxId(), true);
913 this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,255));
914 this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(230,230,255));
915 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
919 void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
921 modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
922 this->tree_Projects->SetItemBold(item->GetId().GetWxId(), false);
923 this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,0));
924 this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(255,255,255));
925 this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
929 void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event)
931 this->help = !this->help;
932 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
935 void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event)
942 this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);