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 "wxCDMMainFrame.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(
53 const wxString& caption,
54 const wxPoint& position,
59 wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style);
62 wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog()
66 bool wxCDMProjectHelpDialog::Create(
69 const wxString& caption,
70 const wxPoint& position,
75 wxDialog::Create(parent, id, caption, position, size, style);
77 this->CreateControls();
82 void wxCDMProjectHelpDialog::CreateControls()
84 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
87 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);
88 v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
90 wxStaticText* instruction = new wxStaticText(
93 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 "
94 "packages you can do it by clicking the \"Manage Packages\" button bellow. You can also work with Libraries and "
95 "Applications, just click in the \"Manage Libraries\" button or \"Manage Applications\" button to start working "
98 "Select an action or click Finish to continue working on the project."),
103 v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
105 wxFlexGridSizer* formItems = new wxFlexGridSizer(2,2,9,15);
107 wxButton* managePackagesBtn = new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, wxT("Manage Packages"));
108 wxButton* manageLibrariesBtn = new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, wxT("Manage Libraries"));
109 manageLibrariesBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseEnter,NULL,this);
110 manageLibrariesBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseExit,NULL,this);
111 wxButton* manageApplicationsBtn = new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, wxT("Manage Applications"));
112 manageApplicationsBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseEnter,NULL,this);
113 manageApplicationsBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseExit,NULL,this);
115 formItems->Add(managePackagesBtn, 1, wxALIGN_CENTER_VERTICAL);
116 formItems->Add(manageLibrariesBtn, 1, wxALIGN_CENTER_VERTICAL);
117 formItems->Add(manageApplicationsBtn, 1, wxALIGN_CENTER_VERTICAL);
119 formItems->AddGrowableCol(0,1);
120 formItems->AddGrowableCol(1,1);
122 v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15);
124 v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
126 v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Cancel")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
129 //v_sizer1->RecalcSizes();
132 void wxCDMProjectHelpDialog::OnFinish(wxCommandEvent& event)
134 this->EndDialog(wxID_CANCEL);
137 void wxCDMProjectHelpDialog::OnManagePackages(wxCommandEvent& event)
139 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
141 newEvent->SetString(wxT("manage_packages"));
142 newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId());
143 wxPostEvent(this->GetParent(), *newEvent);
146 this->EndDialog(wxID_OK);
149 void wxCDMProjectHelpDialog::OnManageLibraries(wxCommandEvent& event)
151 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
153 newEvent->SetString(wxT("manage_libraries"));
154 wxPostEvent(this->GetParent(), *newEvent);
156 wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
158 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL)
160 int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId();
161 newEvent1->SetInt(CMId);
163 wxPostEvent(this->GetParent(), *newEvent1);
168 this->EndDialog(wxID_OK);
171 void wxCDMProjectHelpDialog::OnManageApplications(wxCommandEvent& event)
173 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
175 newEvent->SetString(wxT("manage_applications"));
176 wxPostEvent(this->GetParent(), *newEvent);
178 wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
180 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL)
182 int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId();
183 newEvent1->SetInt(CMId);
185 wxPostEvent(this->GetParent(), *newEvent1);
190 this->EndDialog(wxID_OK);
193 void wxCDMProjectHelpDialog::OnAppliMouseEnter(wxMouseEvent& event)
195 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
197 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL)
199 int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId();
200 newEvent->SetInt(AppId);
202 wxPostEvent(this->GetParent(), *newEvent);
207 void wxCDMProjectHelpDialog::OnAppliMouseExit(wxMouseEvent& event)
209 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
211 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL)
213 int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId();
214 newEvent->SetInt(AppId);
216 wxPostEvent(this->GetParent(), *newEvent);
221 void wxCDMProjectHelpDialog::OnLibMouseEnter(wxMouseEvent& event)
223 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
225 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL)
227 int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId();
228 newEvent->SetInt(LbId);
230 wxPostEvent(this->GetParent(), *newEvent);
235 void wxCDMProjectHelpDialog::OnLibMouseExit(wxMouseEvent& event)
237 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
239 if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL)
241 int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId();
242 newEvent->SetInt(LbId);
244 wxPostEvent(this->GetParent(), *newEvent);
249 void wxCDMProjectHelpDialog::OnDisableHelp(wxCommandEvent& event)
251 wxPostEvent(this->GetParent(), event);