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 * wxCDMPackageManagerHelpDialog.cpp
32 * Created on: 7/1/2013
33 * Author: Daniel Felipe Gonzalez Obando
36 #include "wxCDMPackageManagerHelpDialog.h"
38 #include "creaDevManagerIds.h"
40 BEGIN_EVENT_TABLE(wxCDMPackageManagerHelpDialog, wxDialog)
41 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageManagerHelpDialog::OnFinish)
42 EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerHelpDialog::OnCreatePackage)
43 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerHelpDialog::OnEditCMake)
44 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageManagerHelpDialog::OnDisableHelp)
47 wxCDMPackageManagerHelpDialog::wxCDMPackageManagerHelpDialog(
49 wxCDMPackageManagerPanel* packageManager,
51 const wxString& caption,
52 const wxPoint& position,
57 wxCDMPackageManagerHelpDialog::Create(parent, id, caption, position, size, style);
58 this->packageManager = packageManager;
61 wxCDMPackageManagerHelpDialog::~wxCDMPackageManagerHelpDialog()
65 bool wxCDMPackageManagerHelpDialog::Create(
68 const wxString& caption,
69 const wxPoint& position,
74 wxDialog::Create(parent, id, caption, position, size, style);
76 this->CreateControls();
81 void wxCDMPackageManagerHelpDialog::CreateControls()
83 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
86 wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Managing your packages"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
87 v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
89 wxStaticText* instruction = new wxStaticText(
93 "Packages contain black boxes, which allow to work modularly with other boxes. This boxes can use the functions "
94 "present in your libraries and expose them to work in a BBTK-fashion.\n"
96 "In the package manager you can view a list of the available packages in the current project, as well as create "
97 "new packages. Remember that any package you make must be included in the CMakeLists file. You can do that by "
98 "clicking on the \"Edit CMakeLists File\" button in the package manager section and include the desired packages "
99 "at the end of the file using \"ADD_SUBDIRECTORY([packageName])\"."),
104 v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
106 // wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15);
108 // wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_CREATE_PACKAGE, wxT("Create a Package"));
109 // wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit the CMakeLists File"));
110 // editCMakeBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter,NULL,this);
111 // editCMakeBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit,NULL,this);
113 // formItems->Add(createPackageBtn, 1, wxALIGN_CENTER);
114 // formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER);
116 // formItems->AddGrowableCol(0,1);
117 // formItems->AddGrowableCol(1,1);
119 // v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15);
121 v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
123 v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
126 //v_sizer1->RecalcSizes();
129 void wxCDMPackageManagerHelpDialog::OnFinish(wxCommandEvent& event)
131 this->EndDialog(wxID_CANCEL);
134 void wxCDMPackageManagerHelpDialog::OnCreatePackage(wxCommandEvent& event)
136 if(this->packageManager != NULL)
138 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_CLICKED);
139 wxPostEvent(this->packageManager, *newEvent);
143 this->EndDialog(wxID_OK);
146 void wxCDMPackageManagerHelpDialog::OnEditCMake(wxCommandEvent& event)
148 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_ENTER);
149 if(this->packageManager != NULL)
150 wxPostEvent(this->packageManager, *newEvent);
153 this->EndDialog(wxID_OK);
157 void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event)
159 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
161 if(packageManager->GetProject()->GetCMakeLists() != NULL)
163 newEvent->SetClientData(packageManager->GetProject()->GetCMakeLists());
165 wxPostEvent(this->GetParent(), *newEvent);
170 void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event)
172 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
174 if(packageManager->GetProject()->GetCMakeLists() != NULL)
176 newEvent->SetClientData(packageManager->GetProject()->GetCMakeLists());
178 wxPostEvent(this->GetParent(), *newEvent);
184 void wxCDMPackageManagerHelpDialog::OnDisableHelp(wxCommandEvent& event)
186 wxPostEvent(this->GetParent(), event);