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 # ------------------------------------------------------------------------
30 * wxCDMPackageConfigurationDialog.cpp
32 * Created on: 6/4/2013
33 * Author: Daniel Felipe Gonzalez Obando
36 #include "wxCDMPackageConfigurationDialog.h"
38 #include "creaDevManagerIds.h"
40 BEGIN_EVENT_TABLE(wxCDMPackageConfigurationDialog, wxDialog)
41 EVT_BUTTON(wxID_OK, wxCDMPackageConfigurationDialog::OnFinish)
42 EVT_CHECKBOX(ID_CHECK_INCLUDE_3RDLIBRARY, wxCDMPackageConfigurationDialog::On3rdLibraryIncludeChange)
43 EVT_CHECKBOX(ID_CHECK_INCLUDE_LIBRARY, wxCDMPackageConfigurationDialog::OnCustomLibraryIncludeChange)
46 wxCDMPackageConfigurationDialog::wxCDMPackageConfigurationDialog(
48 modelCDMPackage* package,
50 const wxString& caption,
51 const wxPoint& position,
56 this->package = package;
57 wxCDMPackageConfigurationDialog::Create(parent, id, caption, position, size, style);
60 wxCDMPackageConfigurationDialog::~wxCDMPackageConfigurationDialog()
64 bool wxCDMPackageConfigurationDialog::Create(
67 const wxString& caption,
68 const wxPoint& position,
73 wxDialog::Create(parent, id, caption, position, size, style);
75 this->CreateControls();
80 void wxCDMPackageConfigurationDialog::CreateControls()
83 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
86 wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Please select the libraries that are used in this package."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
87 v_sizer1->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxALL, 5);
89 wxScrolledWindow* includesPanel = new wxScrolledWindow(this);
90 includesPanel->FitInside();
91 includesPanel->SetScrollRate(5,5);
93 wxBoxSizer* includesPanelSizer = new wxBoxSizer(wxVERTICAL);
95 //Third Party Libraries
96 wxStaticText* Title1 = new wxStaticText(includesPanel, wxID_ANY, wxT("Third Party Libraries:"));
97 wxFont font = Title1->GetFont();
98 font.SetWeight(wxFONTWEIGHT_BOLD);
99 Title1->SetFont(font);
100 includesPanelSizer->Add(Title1, 0, wxEXPAND);
103 std::map<std::string, bool> inclusions = this->package->Get3rdPartyLibraries();
105 wxFlexGridSizer* includesGridSizer = new wxFlexGridSizer(inclusions.size()+1, 2, 0, 5);
107 wxStaticText* ChBTitle = new wxStaticText(
115 wxStaticText* LNmTitle = new wxStaticText(
124 includesGridSizer->Add(ChBTitle, 1, wxEXPAND);
125 includesGridSizer->Add(LNmTitle, 1, wxEXPAND);
127 for (std::map<std::string, bool>::iterator it = inclusions.begin(); it != inclusions.end(); ++it) {
128 wxCheckBox* ChBIncl = new wxCheckBox(
129 includesPanel, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
131 ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " library is included in the project configuration for this library."));
132 ChBIncl->SetName(crea::std2wx(it->first));
133 ChBIncl->SetValue(it->second);
134 includesGridSizer->Add(ChBIncl, 1, wxEXPAND);
136 wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
137 includesGridSizer->Add(LNmIncl, 1, wxEXPAND);
140 includesGridSizer->AddGrowableCol(1,1);
142 includesPanelSizer->Add(includesGridSizer, 1, wxEXPAND | wxLEFT, 5);
145 wxStaticText* Title2 = new wxStaticText(includesPanel, wxID_ANY, wxT("Custom Libraries:"));
146 font = Title2->GetFont();
147 font.SetWeight(wxFONTWEIGHT_BOLD);
148 Title2->SetFont(font);
149 includesPanelSizer->Add(Title2, 0, wxEXPAND);
152 std::map<std::string, bool> inclusionsLibs = this->package->GetCustomLibraries();
154 wxFlexGridSizer* includesLibGridSizer = new wxFlexGridSizer(inclusionsLibs.size()+1, 2, 0, 5);
156 wxStaticText* ChBTitle1 = new wxStaticText(
164 wxStaticText* LNmTitle1 = new wxStaticText(
173 includesLibGridSizer->Add(ChBTitle1, 1, wxEXPAND);
174 includesLibGridSizer->Add(LNmTitle1, 1, wxEXPAND);
176 for (std::map<std::string, bool>::iterator it = inclusionsLibs.begin(); it != inclusionsLibs.end(); ++it) {
177 wxCheckBox* ChBIncl = new wxCheckBox(
178 includesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
180 ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " custom library is included in the project configuration for this library."));
181 ChBIncl->SetName(crea::std2wx(it->first));
182 ChBIncl->SetValue(it->second);
183 includesLibGridSizer->Add(ChBIncl, 1, wxEXPAND);
185 wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
186 includesLibGridSizer->Add(LNmIncl, 1, wxEXPAND);
189 includesLibGridSizer->AddGrowableCol(1,1);
191 includesPanelSizer->Add(includesLibGridSizer, 0, wxEXPAND | wxLEFT, 5);
193 includesPanel->SetSizer(includesPanelSizer);
195 v_sizer1->Add(includesPanel, 1, wxEXPAND | wxALL, 10);
197 v_sizer1->Add(new wxButton(this, wxID_OK, wxT("Close")), 0, wxALIGN_CENTER | wxRIGHT | wxBOTTOM, 30);
202 void wxCDMPackageConfigurationDialog::OnFinish(wxCommandEvent& event)
204 this->EndModal(wxID_OK);
207 void wxCDMPackageConfigurationDialog::On3rdLibraryIncludeChange(
208 wxCommandEvent& event)
210 if(this->package->Set3rdPartyLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue()))
211 ((wxCheckBox*)event.GetEventObject())->SetValue(((wxCheckBox*)event.GetEventObject())->GetValue());
213 ((wxCheckBox*)event.GetEventObject())->SetValue(!((wxCheckBox*)event.GetEventObject())->GetValue());
216 void wxCDMPackageConfigurationDialog::OnCustomLibraryIncludeChange(
217 wxCommandEvent& event)
219 this->package->SetCustomLibrary(
220 crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()),
221 ((wxCheckBox*)event.GetEventObject())->GetValue()