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 * wxCDMProjectDescriptionPanel.cpp
31 * Created on: Nov 27, 2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "wxCDMProjectDescriptionPanel.h"
37 #include "wxCDMMainFrame.h"
38 #include "wxCDMNewPackageDialog.h"
40 #include "creaDevManagerIds.h"
41 #include "images/PrIcon64.xpm"
43 BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel)
44 EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManagePackages)
45 EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageLibraries)
46 EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageApplications)
47 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists)
48 EVT_BUTTON(ID_BUTTON_SET_BUILD_PATH, wxCDMProjectDescriptionPanel::OnBtnSetBuildPath)
49 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMProjectDescriptionPanel::OnBtnOpenFolder)
50 EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMProjectDescriptionPanel::OnBtnSetVersion)
53 wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel(
55 modelCDMProject* project,
57 const wxString& caption,
63 wxCDMProjectDescriptionPanel::Create(parent, project, id, caption, pos, size, style);
66 wxCDMProjectDescriptionPanel::~wxCDMProjectDescriptionPanel()
70 bool wxCDMProjectDescriptionPanel::Create(
72 modelCDMProject* project,
74 const wxString& caption,
80 wxPanel::Create(parent, id, pos, size, style);
81 this->project = project;
86 void wxCDMProjectDescriptionPanel::CreateControls()
88 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
91 sizer->Add(new wxStaticText(this, -1, _("Project")),0, wxALIGN_CENTER, 0);
94 sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PrIcon64)),0, wxALIGN_CENTER, 0);
97 sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->project->GetName())),0, wxALIGN_CENTER, 0);
99 //----------------------------------Project Properties-----------------------------------
100 //properties StaticBoxSizer
101 wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, _T("&Properties"));
103 wxPanel* propertiesPanel = new wxPanel(this);
105 wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
106 //propertiesGrid Sizer
107 wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
108 //properties elements
110 wxStaticText* pVersion = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Version"));
111 wxStaticText* pVersionDate = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Version Date"));
112 wxStaticText* pSourceLocation = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Source Location"));
113 wxStaticText* pBuildLocation = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Build Location"));
116 wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
117 wxStaticText* pVersiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->project->GetVersion()));
118 wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
119 pVersionbt->SetToolTip(wxT("Update the version of the project."));
120 pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
121 pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
123 wxStaticText* pVersionDatetc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetVersionDate()));
125 wxBoxSizer* pSourceLocationsz = new wxBoxSizer(wxHORIZONTAL);
126 wxStaticText* pSourceLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetPath()));
127 pSourceLocationtc->SetMaxSize(wxSize(350,-1));
128 wxButton* pSourceLocationbt = new wxButton(propertiesPanel, ID_BUTTON_OPEN_FOLDER, wxT("Open"));
129 pSourceLocationbt->SetToolTip(wxT("Open the source folder in the file explorer."));
130 pSourceLocationsz->Add(pSourceLocationtc, 0, wxALIGN_CENTER, 0);
131 pSourceLocationsz->Add(pSourceLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
133 wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL);
134 wxStaticText* pBuildLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetBuildPath()));
135 pBuildLocationtc->SetMaxSize(wxSize(350,-1));
136 wxButton* pBuildLocationbt = new wxButton(propertiesPanel, ID_BUTTON_SET_BUILD_PATH, wxT("Choose"));
137 pBuildLocationbt->SetToolTip(wxT("Select a new location for compiling the project."));
138 pBuildLocationsz->Add(pBuildLocationtc, 0, wxALIGN_CENTER, 0);
139 pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
141 propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
142 propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND);
143 propertiesGridSizer->Add(pVersionDate, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
144 propertiesGridSizer->Add(pVersionDatetc, 1, wxEXPAND);
145 propertiesGridSizer->Add(pSourceLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
146 propertiesGridSizer->Add(pSourceLocationsz, 1, wxEXPAND);
147 propertiesGridSizer->Add(pBuildLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
148 propertiesGridSizer->Add(pBuildLocationsz, 1, wxEXPAND);
150 propertiesGridSizer->AddGrowableCol(1,1);
152 propertiesPanelSizer-> Add(propertiesGridSizer, 0, wxALL | wxEXPAND, 5);
154 //SetPanel sizer and box
155 propertiesPanel->SetSizer(propertiesPanelSizer);
156 propertiesPanelSizer->Fit(propertiesPanel);
157 propertiesBox->Add(propertiesPanel, 0, wxEXPAND);
158 sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
160 //----------------------------------Project Actions--------------------------------------
161 //actions StaticBoxSizer
162 wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL,this, _T("&Actions"));
163 actionsBox->GetStaticBox()->SetToolTip(wxT("Go to any of the content managers of the project or edit the project's CMakeLists.txt file by selecting any of the available actions."));
165 wxPanel* actionsPanel = new wxPanel(this);
167 wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
170 wxButton* packageMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("Package Manager"));
171 packageMgrbt->SetToolTip(wxT("Find the current available packages into this project. You can also create new Packages in this section."));
172 actionsPanelSizer->Add(packageMgrbt, 0, wxALL, 5);
174 // show only if there is a lib folder
175 if(this->project->GetLib() != NULL)
177 wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("Library Manager"));
178 libMgrbt->SetToolTip(wxT("Find the current available libraries into this project. You can also create new Libraries in this section as well as edit the lib folder's CMakeLists.txt file."));
179 actionsPanelSizer->Add(libMgrbt, 0, wxALL, 5);
182 // show only if there is a appli folder
183 if(this->project->GetAppli() != NULL)
185 wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("Application Manager"));
186 appliMgrbt->SetToolTip(wxT("Find the current available applications into this project. You can also create new Applications in this section as well as edit the appli folder's CMakeLists.txt file."));
187 actionsPanelSizer->Add(appliMgrbt, 0, wxALL, 5);
189 // edit CMakeLists file
190 wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
191 editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file of this project."));
192 actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
194 //SetPanel sizer and box
195 actionsPanel->SetSizer(actionsPanelSizer);
196 actionsPanelSizer->Fit(actionsPanel);
197 actionsBox->Add(actionsPanel, 0, wxALL, 5);
198 sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10);
202 this->SetSizer(sizer);
203 sizer->SetSizeHints(this);
207 wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event)
209 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
211 newEvent->SetString(wxT("manage_packages"));
212 newEvent->SetInt(this->project->GetId());
213 wxPostEvent(this->GetParent(), *newEvent);
218 wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
220 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
222 newEvent->SetString(wxT("manage_libraries"));
223 wxPostEvent(this->GetParent(), *newEvent);
228 wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event)
230 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
232 newEvent->SetString(wxT("manage_applications"));
233 wxPostEvent(this->GetParent(), *newEvent);
237 void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
239 //TODO: implement method
240 std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
245 wxCDMProjectDescriptionPanel::OnBtnSetBuildPath(wxCommandEvent& event)
247 //TODO: implement method
248 std::cerr << "Event OnBtnSetBuildPath not implemented" << std::endl;
253 wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
255 //TODO: implement method
256 std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
261 wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
263 //TODO: implement method
264 std::cerr << "Event OnBtnSetVersion not implemented" << std::endl;