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 * wxCDMProjectReadyDialog.cpp
32 * Created on: 3/1/2013
33 * Author: Daniel Felipe Gonzalez Obando
36 #include "wxCDMProjectHelpDialog.h"
38 #include "wxCDMProjectDescriptionPanel.h"
40 #include "creaDevManagerIds.h"
42 BEGIN_EVENT_TABLE(wxCDMProjectHelpDialog, wxDialog)
43 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectHelpDialog::OnFinish)
44 EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectHelpDialog::OnManagePackages)
45 EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectHelpDialog::OnManageLibraries)
46 EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectHelpDialog::OnManageApplications)
47 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMProjectHelpDialog::OnDisableHelp)
50 wxCDMProjectHelpDialog::wxCDMProjectHelpDialog(
52 wxCDMProjectDescriptionPanel* projectDescription,
54 const wxString& caption,
55 const wxPoint& position,
60 wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style);
61 this->projectDescription = projectDescription;
64 wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog()
68 bool wxCDMProjectHelpDialog::Create(
71 const wxString& caption,
72 const wxPoint& position,
77 wxDialog::Create(parent, id, caption, position, size, style);
79 this->CreateControls();
84 void wxCDMProjectHelpDialog::CreateControls()
86 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
89 wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Your project is ready!"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
90 v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
92 wxStaticText* instruction = new wxStaticText(
95 crea::std2wx("When you create a project it comes with a default package. If you need to work in it or you want to create more "
96 "packages you can do it by clicking the \"Manage Packages\" button bellow. You can also work with Libraries and "
97 "Applications, just click in the \"Manage Libraries\" button or \"Manage Applications\" button to start working "
100 "Select an action or click Close to continue working on the project."),
105 v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
107 wxFlexGridSizer* formItems = new wxFlexGridSizer(2,2,9,15);
109 wxButton* managePackagesBtn = new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, wxT("Manage Packages"));
110 wxButton* manageLibrariesBtn = new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, wxT("Manage Libraries"));
111 manageLibrariesBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseEnter,NULL,this);
112 manageLibrariesBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseExit,NULL,this);
113 wxButton* manageApplicationsBtn = new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, wxT("Manage Applications"));
114 manageApplicationsBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseEnter,NULL,this);
115 manageApplicationsBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseExit,NULL,this);
117 formItems->Add(managePackagesBtn, 1, wxALIGN_CENTER_VERTICAL);
118 formItems->Add(manageLibrariesBtn, 1, wxALIGN_CENTER_VERTICAL);
119 formItems->Add(manageApplicationsBtn, 1, wxALIGN_CENTER_VERTICAL);
121 formItems->AddGrowableCol(0,1);
122 formItems->AddGrowableCol(1,1);
124 v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15);
126 v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
128 v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
131 //v_sizer1->RecalcSizes();
134 void wxCDMProjectHelpDialog::OnFinish(wxCommandEvent& event)
136 this->EndDialog(wxID_CANCEL);
139 void wxCDMProjectHelpDialog::OnManagePackages(wxCommandEvent& event)
141 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
143 newEvent->SetString(wxT("manage_packages"));
144 newEvent->SetInt(this->projectDescription->GetProject()->GetId());
145 wxPostEvent(this->GetParent(), *newEvent);
148 this->EndDialog(wxID_OK);
151 void wxCDMProjectHelpDialog::OnManageLibraries(wxCommandEvent& event)
153 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
155 newEvent->SetString(wxT("manage_libraries"));
156 wxPostEvent(this->GetParent(), *newEvent);
158 wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
160 if(this->projectDescription->GetProject()->GetLib() != NULL)
162 int CMId = this->projectDescription->GetProject()->GetLib()->GetId();
163 newEvent1->SetInt(CMId);
165 wxPostEvent(this->GetParent(), *newEvent1);
170 this->EndDialog(wxID_OK);
173 void wxCDMProjectHelpDialog::OnManageApplications(wxCommandEvent& event)
175 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
177 newEvent->SetString(wxT("manage_applications"));
178 wxPostEvent(this->GetParent(), *newEvent);
180 wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
182 if(this->projectDescription->GetProject()->GetAppli() != NULL)
184 int CMId = this->projectDescription->GetProject()->GetAppli()->GetId();
185 newEvent1->SetInt(CMId);
187 wxPostEvent(this->GetParent(), *newEvent1);
192 this->EndDialog(wxID_OK);
195 void wxCDMProjectHelpDialog::OnAppliMouseEnter(wxMouseEvent& event)
197 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
199 if(this->projectDescription->GetProject()->GetAppli() != NULL)
201 int AppId = this->projectDescription->GetProject()->GetAppli()->GetId();
202 newEvent->SetInt(AppId);
204 wxPostEvent(this->GetParent(), *newEvent);
209 void wxCDMProjectHelpDialog::OnAppliMouseExit(wxMouseEvent& event)
211 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
213 if(this->projectDescription->GetProject()->GetAppli() != NULL)
215 int AppId = this->projectDescription->GetProject()->GetAppli()->GetId();
216 newEvent->SetInt(AppId);
218 wxPostEvent(this->GetParent(), *newEvent);
223 void wxCDMProjectHelpDialog::OnLibMouseEnter(wxMouseEvent& event)
225 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
227 if(this->projectDescription->GetProject()->GetLib() != NULL)
229 int LbId = this->projectDescription->GetProject()->GetLib()->GetId();
230 newEvent->SetInt(LbId);
232 wxPostEvent(this->GetParent(), *newEvent);
237 void wxCDMProjectHelpDialog::OnLibMouseExit(wxMouseEvent& event)
239 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
241 if(this->projectDescription->GetProject()->GetLib() != NULL)
243 int LbId = this->projectDescription->GetProject()->GetLib()->GetId();
244 newEvent->SetInt(LbId);
246 wxPostEvent(this->GetParent(), *newEvent);
251 void wxCDMProjectHelpDialog::OnDisableHelp(wxCommandEvent& event)
253 wxPostEvent(this->GetParent(), event);