]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.cpp
4d4ff43d68e5dcda8ac0afcd8c00e7d414b2f70e
[crea.git] / lib / creaDevManagerLib / wxCDMBlackBoxHelpDialog.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  * wxCDMBlackBoxHelpDialog.cpp
31  *
32  *  Created on: 11/1/2013
33  *      Author: Daniel Felipe Gonzalez Obando
34  */
35
36 #include "wxCDMBlackBoxHelpDialog.h"
37
38 #include "creaDevManagerIds.h"
39
40 BEGIN_EVENT_TABLE(wxCDMBlackBoxHelpDialog, wxDialog)
41 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMBlackBoxHelpDialog::OnFinish)
42 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMBlackBoxHelpDialog::OnCMakeLists)
43 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMBlackBoxHelpDialog::OnCMakeLists)
44 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMBlackBoxHelpDialog::OnDisableHelp)
45 END_EVENT_TABLE()
46
47 wxCDMBlackBoxHelpDialog::wxCDMBlackBoxHelpDialog(
48     wxWindow* parent,
49     modelCDMBlackBox* blackBox,
50     wxWindowID id,
51     const wxString& caption,
52     const wxPoint& position,
53     const wxSize& size,
54     long style
55 )
56 {
57   wxCDMBlackBoxHelpDialog::Create(parent, id, caption, position, size, style);
58   this->blackBox = blackBox;
59 }
60
61 wxCDMBlackBoxHelpDialog::~wxCDMBlackBoxHelpDialog()
62 {
63 }
64
65 bool wxCDMBlackBoxHelpDialog::Create(
66     wxWindow* parent,
67     wxWindowID id,
68     const wxString& caption,
69     const wxPoint& position,
70     const wxSize& size,
71     long int style
72 )
73 {
74   wxDialog::Create(parent, id, caption, position, size, style);
75
76   this->CreateControls();
77
78   return TRUE;
79 }
80
81 void wxCDMBlackBoxHelpDialog::CreateControls()
82 {
83
84   wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
85
86
87   wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with BlackBoxes"), 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);
89
90   wxStaticText* instruction = new wxStaticText(
91       this,
92       wxID_ANY,
93       crea::std2wx(
94           "Black boxes are made to work in a modular fashion. They have programmer defined inputs and outputs. Their "
95           "purpose is to use the functions available in the libraries and expose them to be used as boxes in the crea "
96           "environment.\n"
97           "Black boxes are stored in the src folder of a package and they are composed of two files, the header(.h) "
98           "and the implementation(.cxx) files.\n"
99           "To start developing black boxes, go ahead and open the header file with the button \"Open .h\" and define "
100           "the inputs and outputs of the black box. Then, you will be able to use them in the implementation file, which "
101           "you can open using the \"Open .cxx\" button.\n"
102           "If you don't understand how this inputs and outputs are used, try looking at the sample black boxes available "
103           "in the sample package, which is shipped with every new project.\n"
104           "Also, don't forget to include the libraries your boxes use in the header and implementation files. They should "
105           "also be pointed and included in the package's directory CMakeLists.txt file and the project's directory "
106           "CMakeLists.txt file. Again, please take a look at the sample package and its boxes to see how to include libraries "
107           "in order to use them in the boxes.\n"
108           "\n"
109           "You can easily edit the CMakeLists files previously mentioned by clicking on the following buttons."),
110           wxDefaultPosition,
111           wxDefaultSize,
112           wxALIGN_LEFT
113   );
114   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
115
116   wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
117   wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
118
119   v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
120   v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
121
122   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
123
124   v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
125
126   SetSizer(v_sizer1);
127   //v_sizer1->RecalcSizes();
128 }
129
130 void wxCDMBlackBoxHelpDialog::OnFinish(wxCommandEvent& event)
131 {
132   this->EndDialog(wxID_CANCEL);
133 }
134
135 void wxCDMBlackBoxHelpDialog::OnCMakeLists(wxCommandEvent& event)
136 {
137   //TODO: implement method
138   std::cout << "OnCMakeLists not implemented yet." << std::endl;
139   event.Skip();
140 }
141
142 void wxCDMBlackBoxHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
143 {
144   //TODO: implement method
145   std::cout << "OnCMakeListsEnter not implemented yet." << std::endl;
146   event.Skip();
147 }
148
149 void wxCDMBlackBoxHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
150 {
151   //TODO: implement method
152   std::cout << "OnCMakeListsExit not implemented yet." << std::endl;
153   event.Skip();
154 }
155
156 void wxCDMBlackBoxHelpDialog::OnDisableHelp(wxCommandEvent& event)
157 {
158   wxPostEvent(this->GetParent(), event);
159 }