]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMPackageHelpDialog.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMPackageHelpDialog.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Sant�)
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
9 #
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.
16 #
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
21 #  liability. 
22 #
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 # ------------------------------------------------------------------------ 
26  */
27
28
29 /*
30  * wxCDMPackageHelpDialog.cpp
31  *
32  *  Created on: 9/1/2013
33  *      Author: Daniel Felipe Gonzalez Obando
34  */
35
36 #include "wxCDMPackageHelpDialog.h"
37
38 #include "creaDevManagerIds.h"
39
40 BEGIN_EVENT_TABLE(wxCDMPackageHelpDialog, wxDialog)
41 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageHelpDialog::OnFinish)
42 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageHelpDialog::OnDisableHelp)
43 END_EVENT_TABLE()
44
45 wxCDMPackageHelpDialog::wxCDMPackageHelpDialog(
46     wxWindow* parent,
47     std::vector<modelCDMCMakeListsFile*>& files,
48     wxWindowID id,
49     const wxString& caption,
50     const wxPoint& position,
51     const wxSize& size,
52     long style
53 )
54 {
55   wxCDMPackageHelpDialog::Create(parent, id, caption, position, size, style);
56   this->cmakefiles = files;
57 }
58
59 wxCDMPackageHelpDialog::~wxCDMPackageHelpDialog()
60 {
61 }
62
63 bool wxCDMPackageHelpDialog::Create(
64     wxWindow* parent,
65     wxWindowID id,
66     const wxString& caption,
67     const wxPoint& position,
68     const wxSize& size,
69     long int style
70 )
71 {
72   wxDialog::Create(parent, id, caption, position, size, style);
73
74   this->CreateControls();
75
76   return TRUE;
77 }
78
79 void wxCDMPackageHelpDialog::CreateControls()
80 {
81
82   wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
83
84
85   wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with Packages"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
86   v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
87
88   wxStaticText* instruction = new wxStaticText(
89       this,
90       wxID_ANY,
91       crea::std2wx(
92           "Packages contain black boxes, which allow to work modularly with other boxes. This boxes can use the functions "
93           "present in your libraries and expose them to work in a BBTK-fashion.\n"
94           "\n"
95           "To create a black box click on the \"Create Black Box\" button.\n"
96           "If you want to check the files in the file explorer click the \"Open Package Folder\" "
97           "button.\n"
98           "\n"
99           "Don't forget to include the libraries your black boxes use in the Package directory CMakeLists.txt file\n"
100           "Also, make sure you include this package in the Project directory CMakeLists.txt file\n"
101           "You can open these files with the following buttons."),
102           wxDefaultPosition,
103           wxDefaultSize,
104           wxALIGN_LEFT
105   );
106   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
107
108   wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
109   wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
110
111   v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
112   v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
113
114   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
115
116   v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
117
118   SetSizer(v_sizer1);
119   //v_sizer1->RecalcSizes();
120 }
121
122 void wxCDMPackageHelpDialog::OnFinish(wxCommandEvent& event)
123 {
124   this->EndDialog(wxID_CANCEL);
125 }
126
127 void wxCDMPackageHelpDialog::OnDisableHelp(wxCommandEvent& event)
128 {
129   wxPostEvent(this->GetParent(), event);
130 }