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 * wxCDMProjectConfigurationDialog.cpp
32 * Created on: 6/4/2013
33 * Author: Daniel Felipe Gonzalez Obando
36 #include "wxCDMProjectConfigurationDialog.h"
38 #include "creaDevManagerIds.h"
40 BEGIN_EVENT_TABLE(wxCDMProjectConfigurationDialog, wxDialog)
41 EVT_BUTTON(wxID_OK, wxCDMProjectConfigurationDialog::OnFinish)
42 EVT_CHECKBOX(ID_CHECK_INCLUDE_3RDLIBRARY, wxCDMProjectConfigurationDialog::On3rdLibraryIncludeChange)
45 wxCDMProjectConfigurationDialog::wxCDMProjectConfigurationDialog(
47 modelCDMProject* project,
49 const wxString& caption,
50 const wxPoint& position,
55 this->project = project;
56 wxCDMProjectConfigurationDialog::Create(parent, id, caption, position, size, style);
59 wxCDMProjectConfigurationDialog::~wxCDMProjectConfigurationDialog()
63 bool wxCDMProjectConfigurationDialog::Create(
66 const wxString& caption,
67 const wxPoint& position,
72 wxDialog::Create(parent, id, caption, position, size, style);
74 this->CreateControls();
79 void wxCDMProjectConfigurationDialog::CreateControls()
82 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
85 wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Please select the libraries that are used in this project."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
86 v_sizer1->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxALL, 5);
88 wxScrolledWindow* includesPanel = new wxScrolledWindow(this);
89 includesPanel->FitInside();
90 includesPanel->SetScrollRate(5,5);
92 wxBoxSizer* includesPanelSizer = new wxBoxSizer(wxVERTICAL);
94 //Third Party Libraries
95 wxStaticText* Title1 = new wxStaticText(includesPanel, wxID_ANY, wxT("Third Party Libraries:"));
96 wxFont font = Title1->GetFont();
97 font.SetWeight(wxFONTWEIGHT_BOLD);
98 Title1->SetFont(font);
99 includesPanelSizer->Add(Title1, 0, wxEXPAND);
102 std::map<std::string, bool> inclusions = this->project->Get3rdPartyLibraries();
104 wxFlexGridSizer* includesGridSizer = new wxFlexGridSizer(inclusions.size()+1, 2, 0, 5);
106 wxStaticText* ChBTitle = new wxStaticText(
114 wxStaticText* LNmTitle = new wxStaticText(
123 includesGridSizer->Add(ChBTitle, 1, wxEXPAND);
124 includesGridSizer->Add(LNmTitle, 1, wxEXPAND);
126 for (std::map<std::string, bool>::iterator it = inclusions.begin(); it != inclusions.end(); ++it) {
127 wxCheckBox* ChBIncl = new wxCheckBox(
128 includesPanel, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
130 ChBIncl->SetToolTip(crea::std2wx(
131 "When this box is checked the " + it->first + " library\n"
132 "is included in the project configuration\n"
133 "including the following instruction\n"
134 "in the project's folder CMakeLists.txt file:\n"
135 "SET(USE_" + it->first+ " ON)\n"
137 ChBIncl->SetName(crea::std2wx(it->first));
138 ChBIncl->SetValue(it->second);
139 includesGridSizer->Add(ChBIncl, 0, wxEXPAND);
141 wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
142 includesGridSizer->Add(LNmIncl, 1, wxEXPAND);
145 includesGridSizer->AddGrowableCol(1,1);
147 includesPanelSizer->Add(includesGridSizer, 1, wxEXPAND | wxLEFT, 5);
149 includesPanel->SetSizer(includesPanelSizer);
151 v_sizer1->Add(includesPanel, 1, wxEXPAND | wxALL, 10);
153 v_sizer1->Add(new wxButton(this, wxID_OK, wxT("Close")), 0, wxALIGN_CENTER | wxRIGHT | wxBOTTOM, 30);
158 void wxCDMProjectConfigurationDialog::OnFinish(wxCommandEvent& event)
160 this->EndModal(wxID_OK);
163 void wxCDMProjectConfigurationDialog::On3rdLibraryIncludeChange(
164 wxCommandEvent& event)
166 if(this->project->Set3rdPartyLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue()))
167 ((wxCheckBox*)event.GetEventObject())->SetValue(((wxCheckBox*)event.GetEventObject())->GetValue());
169 ((wxCheckBox*)event.GetEventObject())->SetValue(!((wxCheckBox*)event.GetEventObject())->GetValue());