]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMApplicationDescriptionPanel.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  * wxCDMApplicationDescriptionPanel.cpp
30  *
31  *  Created on: Nov 27, 2012
32  *      Author: Daniel Felipe Gonzalez Obando
33  */
34
35 #include "wxCDMApplicationDescriptionPanel.h"
36
37 #include "CDMUtilities.h"
38 #include "wxCDMMainFrame.h"
39
40 #include "wxCDMApplicationHelpDialog.h"
41
42 #include "creaDevManagerIds.h"
43 #include "images/AIcon64.xpm"
44
45 BEGIN_EVENT_TABLE(wxCDMApplicationDescriptionPanel, wxPanel)
46 EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMApplicationDescriptionPanel::OnBtnSetExeName)
47 EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMApplicationDescriptionPanel::OnBtnReturn)
48 EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMApplicationDescriptionPanel::OnBtnCreateClass)
49 EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder)
50 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists)
51 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnOpenFolder)
52 EVT_BUTTON(ID_BUTTON_OPEN_CXX, wxCDMApplicationDescriptionPanel::OnBtnOpenMain)
53 EVT_CHECKBOX(ID_CHECK_INCLUDE_3RDLIBRARY, wxCDMApplicationDescriptionPanel::On3rdLibraryChBChange)
54 EVT_CHECKBOX(ID_CHECK_INCLUDE_LIBRARY, wxCDMApplicationDescriptionPanel::OnLibraryChBChange)
55 END_EVENT_TABLE()
56
57 wxCDMApplicationDescriptionPanel::wxCDMApplicationDescriptionPanel(
58     wxWindow* parent,
59     modelCDMApplication* application,
60     wxWindowID id,
61     const wxString& caption,
62     const wxPoint& pos,
63     const wxSize& size,
64     long style
65 )
66 {
67   wxCDMApplicationDescriptionPanel::Create(parent, application, id, caption, pos, size, style);
68 }
69
70 wxCDMApplicationDescriptionPanel::~wxCDMApplicationDescriptionPanel()
71 {
72 }
73
74 bool wxCDMApplicationDescriptionPanel::Create(
75     wxWindow* parent,
76     modelCDMApplication* application,
77     wxWindowID id,
78     const wxString& caption,
79     const wxPoint& pos,
80     const wxSize& size,
81     long style
82 )
83 {
84   wxPanel::Create(parent, id, pos, size, style);
85
86   // this part makes the scrollbars show up
87   this->FitInside(); // ask the sizer about the needed size
88   this->SetScrollRate(5, 5);
89
90   this->application = application;
91   CreateControls();
92   return TRUE;
93 }
94
95 void wxCDMApplicationDescriptionPanel::CreateControls()
96 {
97   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
98
99   //Links to return
100   wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL);
101   std::vector<modelCDMIProjectTreeNode*> parents = this->application->GetParents();
102   for (int i = 0; i < (int)(parents.size()); i++)
103     {
104                 wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
105       returnLnk->SetWindowStyle(wxNO_BORDER);
106       returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
107       linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
108       linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0);
109     }
110   linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->application->GetName())), 0, wxALIGN_CENTER, 0);
111   sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5);
112
113   //Header
114   wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
115   {
116     //Image
117     headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(AIcon64)),0, wxALIGN_CENTER, 0);
118     wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
119     //Title
120     textSizer->Add(new wxStaticText(this, -1, _("Application")),0, wxALIGN_LEFT, 0);
121     //Application Name
122     textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->application->GetName())),0, wxALIGN_LEFT, 0);
123     headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
124   }
125   sizer->Add(headerSizer, 0, wxALIGN_CENTER);
126
127   /*  //Properties
128   wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties"));
129   wxPanel* propertiesPanel = new wxPanel(this);
130   wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
131
132   wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
133
134   wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Executable Name"));
135   wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL);
136   this->executableNametc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->application->GetExecutableName()));
137   wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_NAME, wxT("Set"));
138   pMainFilebt->SetToolTip(wxT("Set the name of the executable file for the application."));
139   pMainFilesz->Add(this->executableNametc, 0, wxALIGN_CENTER_VERTICAL, 0);
140   pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10);
141
142   propertiesGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
143   propertiesGridSizer->Add(pMainFilesz, 1, wxEXPAND);
144
145   propertiesGridSizer->AddGrowableCol(1,1);
146
147   propertiesPanelSizer->Add(propertiesGridSizer, 0, wxEXPAND);
148   propertiesPanel->SetSizer(propertiesPanelSizer);
149   propertiesPanelSizer->Fit(propertiesPanel);
150   propertiesBox->Add(propertiesPanel, 0, wxEXPAND);
151   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
152    */
153
154   //Includes
155   wxStaticBoxSizer* includesBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Used Libraries"));
156   wxPanel* includesPanel = new wxPanel(this);
157   wxBoxSizer* includesPanelSizer = new wxBoxSizer(wxVERTICAL);
158
159   //Third Party Libraries
160   wxStaticText* Title1 = new wxStaticText(includesPanel, wxID_ANY, wxT("Third Party Libraries:"));
161   wxFont font = Title1->GetFont();
162   font.SetWeight(wxFONTWEIGHT_BOLD);
163   Title1->SetFont(font);
164   includesPanelSizer->Add(Title1, 0, wxEXPAND | wxALL, 5);
165
166   //inclusion data
167   std::map<std::string, bool> inclusions = this->application->Get3rdPartyLibraries();
168   //includesGrid Sizer
169   wxFlexGridSizer* includesGridSizer = new wxFlexGridSizer(inclusions.size()+1, 2, 0, 5);
170
171   wxStaticText* ChBTitle = new wxStaticText(
172       includesPanel,
173       wxID_ANY,
174       wxT("Included"),
175       wxDefaultPosition,
176       wxDefaultSize,
177       wxALIGN_CENTER
178     );
179   wxStaticText* LNmTitle = new wxStaticText(
180       includesPanel,
181       wxID_ANY,
182       wxT("Library Name"),
183       wxDefaultPosition,
184       wxDefaultSize,
185       wxALIGN_LEFT
186     );
187
188   includesGridSizer->Add(ChBTitle, 1, wxEXPAND);
189   includesGridSizer->Add(LNmTitle, 1, wxEXPAND);
190
191   for (std::map<std::string, bool>::iterator it = inclusions.begin(); it != inclusions.end(); ++it) {
192     wxCheckBox* ChBIncl = new wxCheckBox(
193         includesPanel, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
194       );
195     ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " library is included in the project configuration for this application."));
196     ChBIncl->SetName(crea::std2wx(it->first));
197     ChBIncl->SetValue(it->second);
198     includesGridSizer->Add(ChBIncl, 1, wxEXPAND);
199
200     wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
201     includesGridSizer->Add(LNmIncl, 1, wxEXPAND);
202   }
203
204   includesGridSizer->AddGrowableCol(1,1);
205
206   includesPanelSizer->Add(includesGridSizer, 1, wxEXPAND, 0);
207
208   //Custom Libraries
209   wxStaticText* Title2 = new wxStaticText(includesPanel, wxID_ANY, wxT("Custom Libraries:"));
210   font = Title2->GetFont();
211   font.SetWeight(wxFONTWEIGHT_BOLD);
212   Title2->SetFont(font);
213   includesPanelSizer->Add(Title2, 0, wxEXPAND | wxALL, 5);
214
215   //inclusion data
216   std::map<std::string, bool> inclusionsLibs = this->application->GetCustomLibraries();
217   //includesGrid Sizer
218   wxFlexGridSizer* includesLibGridSizer = new wxFlexGridSizer(inclusionsLibs.size()+1, 2, 0, 5);
219
220   wxStaticText* ChBTitle1 = new wxStaticText(
221       includesPanel,
222       wxID_ANY,
223       wxT("Included"),
224       wxDefaultPosition,
225       wxDefaultSize,
226       wxALIGN_CENTER
227     );
228   wxStaticText* LNmTitle1 = new wxStaticText(
229       includesPanel,
230       wxID_ANY,
231       wxT("Library Name"),
232       wxDefaultPosition,
233       wxDefaultSize,
234       wxALIGN_LEFT
235     );
236
237   includesLibGridSizer->Add(ChBTitle1, 1, wxEXPAND);
238   includesLibGridSizer->Add(LNmTitle1, 1, wxEXPAND);
239
240   for (std::map<std::string, bool>::iterator it = inclusionsLibs.begin(); it != inclusionsLibs.end(); ++it) {
241     wxCheckBox* ChBIncl = new wxCheckBox(
242         includesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
243       );
244     ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " custom library is included in the project configuration for this application."));
245     ChBIncl->SetName(crea::std2wx(it->first));
246     ChBIncl->SetValue(it->second);
247     includesLibGridSizer->Add(ChBIncl, 1, wxEXPAND);
248
249     wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
250     includesLibGridSizer->Add(LNmIncl, 1, wxEXPAND);
251   }
252
253   includesLibGridSizer->AddGrowableCol(1,1);
254
255   includesPanelSizer->Add(includesLibGridSizer, 1, wxEXPAND, 0);
256
257   includesPanel->SetSizer(includesPanelSizer);
258   includesPanelSizer->Fit(includesPanel);
259   includesBox->Add(includesPanel, 1, wxEXPAND);
260   sizer -> Add(includesBox, 0, wxALL | wxEXPAND, 10);
261
262
263   //Actions
264   //actions StaticBoxSizer
265   wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions"));
266   actionsBox->GetStaticBox()->SetToolTip(wxT("Create classes or edit them for this application, as well as editing the application's CMakeLists.txt file by selecting the desired action."));
267   //actions Panel
268   wxPanel* actionsPanel = new wxPanel(this);
269   //actions Sizer
270   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
271   //actionsGrid Sizer
272   wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(3, 2, 9, 15);
273
274   wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("Create Class"));
275   createClassbt->SetToolTip(wxT("Create a new Class (.h and .cxx files)."));
276   wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder"));
277   createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder."));
278   wxButton* openMainbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("A. Open Main File"));
279   openMainbt->SetToolTip(wxT("Open the main file in the application folder with the default code editor."));
280   openMainbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseEnter,NULL,this);
281   openMainbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseExit,NULL,this);
282   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
283   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file inside this application."));
284   editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter,NULL,this);
285   editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseExit,NULL,this);
286   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Application Folder"));
287   openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer."));
288
289
290   actionsGridSizer->Add(openMainbt, 1, wxALL | wxEXPAND, 5);
291   actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
292   actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
293   actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
294   actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5);
295
296   //SetPanel sizer and box
297   actionsGridSizer->AddGrowableCol(0,1);
298   actionsGridSizer->AddGrowableCol(1,1);
299
300   actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0);
301   actionsPanel->SetSizer(actionsPanelSizer);
302   actionsPanelSizer->Fit(actionsPanel);
303   actionsBox->Add(actionsPanel, 1, wxALL | wxEXPAND, 5);
304   sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10);
305
306   //Assign sizer
307   SetSizer(sizer);
308   sizer->SetSizeHints(this);
309
310   if (((wxCDMMainFrame*)this->GetParent())->isHelp())
311     {
312       wxCDMApplicationHelpDialog* helpDialog = new wxCDMApplicationHelpDialog(this->GetParent(), this->application, wxID_ANY);
313       helpDialog->Show(true);
314     }
315 }
316
317 void wxCDMApplicationDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
318 {
319   std::vector<modelCDMIProjectTreeNode*> parents = this->application->GetParents();
320   std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
321   //std::cout << parentURL << std::endl;
322   for (int i = 0; i < (int)(parents.size()); i++)
323     {
324       if (parents[i]->GetPath() == parentURL)
325         {
326           wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
327           newEvent->SetClientData(parents[i]);
328           newEvent->SetId(0);
329           wxPostEvent(this->GetParent(), *newEvent);
330         }
331     }
332
333 }
334
335 void wxCDMApplicationDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event)
336 {
337   //get name
338   wxString versionWx = wxGetTextFromUser(
339       wxT("Enter the new executable name"),
340       wxT("Change Application Executable Name - creaDevManager"),
341       crea::std2wx(this->application->GetExecutableName())
342   );
343   //check name
344   std::vector<std::string> parts;
345   CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties);
346   if(parts.size() > 0)
347     {
348       std::string* result;
349       if(!this->application->SetExecutableName(crea::wx2std(versionWx), result))
350         wxMessageBox(crea::std2wx(*result),_T("Change Application Executable Name - Error!"),wxOK | wxICON_ERROR);
351     }
352   else
353     {
354       wxMessageBox(crea::std2wx("No name specified"),_T("Set Application Executable Name - Error!"),wxOK | wxICON_ERROR);
355     }
356   this->executableNametc->SetLabel(crea::std2wx(this->application->GetExecutableName()));
357 }
358
359 void wxCDMApplicationDescriptionPanel::On3rdLibraryChBChange(wxCommandEvent& event)
360 {
361   this->application->Set3rdPartyLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue());
362 }
363
364 void wxCDMApplicationDescriptionPanel::OnLibraryChBChange(wxCommandEvent& event)
365 {
366   this->application->SetCustomLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue());
367 }
368
369 void wxCDMApplicationDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
370 {
371   //get class name from user
372   wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
373       this,
374       wxT("Please enter the new class name."),
375       wxT("New Class - creaDevManager"),
376       wxT(""),
377       wxOK | wxCANCEL
378   );
379
380   if (newClassDlg->ShowModal() == wxID_OK)
381     {
382       std::string className = crea::wx2std(newClassDlg->GetValue());
383       //check class name
384       if(className.size() > 0)
385         {
386           if(!this->application->CreateClass(className))
387             wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
388
389           ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
390
391           wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
392           newEvent->SetId(0);
393           newEvent->SetClientData(this->application);
394           wxPostEvent(this->GetParent(), *newEvent);
395
396           wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
397         }
398       else
399         {
400           wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
401         }
402     }
403 }
404
405 void wxCDMApplicationDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
406 {
407   //get name
408   wxString folderName = wxGetTextFromUser(
409       wxT("Enter the name of the new folder:"),
410       wxT("Create Folder - creaDevManager")
411   );
412   //check name
413   std::vector<std::string> parts;
414   CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties);
415   if(parts.size() > 0)
416     {
417       std::string* result;
418       modelCDMFolder* folderC = this->application->CreateFolder(crea::wx2std(folderName), result);
419       if(folderC == NULL)
420         {
421           wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
422           return;
423         }
424       ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
425       wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
426       newEvent->SetClientData(folderC);
427       wxPostEvent(this->GetParent(), *newEvent);
428       wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION);
429     }
430   else
431     {
432       wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
433     }
434 }
435
436 void wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
437 {
438   std::string* result;
439   if(!this->application->OpenCMakeListsFile(result))
440     wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
441
442   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
443
444   if(this->application->GetCMakeLists() != NULL)
445     {
446       newEvent->SetClientData(this->application->GetCMakeLists());
447       newEvent->SetId(0);
448       wxPostEvent(this->GetParent(), *newEvent);
449     }
450
451   event.Skip();
452 }
453
454 void wxCDMApplicationDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
455 {
456   std::string* result;
457   if(!this->application->OpenInFileExplorer(result))
458     wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
459 }
460
461 void wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
462 {
463   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
464
465   if(this->application->GetCMakeLists() != NULL)
466     {
467       newEvent->SetClientData(this->application->GetCMakeLists());
468       newEvent->SetId(0);
469       wxPostEvent(this->GetParent(), *newEvent);
470     }
471   event.Skip();
472 }
473
474 void wxCDMApplicationDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
475 {
476   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
477
478   if(this->application->GetCMakeLists() != NULL)
479     {
480       newEvent->SetClientData(this->application->GetCMakeLists());
481       newEvent->SetId(0);
482       wxPostEvent(this->GetParent(), *newEvent);
483     }
484   event.Skip();
485 }
486
487 void wxCDMApplicationDescriptionPanel::OnBtnOpenMain(wxCommandEvent& event)
488 {
489   if (this->application->GetMainFile() != NULL)
490     {
491       if (CDMUtilities::openTextEditor(this->application->GetMainFile()->GetPath()))
492       {
493         wxMessageBox(crea::std2wx("The main file couldn't be opened."),_T("Open Main File - Error!"),wxOK | wxICON_ERROR);
494       }
495
496       wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
497
498       newEvent->SetClientData(this->application->GetMainFile());
499       newEvent->SetId(0);
500       wxPostEvent(this->GetParent(), *newEvent);
501
502       event.Skip();
503     }
504   else
505     {
506       wxMessageBox(crea::std2wx("There is no main file or it couldn't be detected."),_T("Open Main File - Error!"),wxOK | wxICON_ERROR);
507     }
508 }
509
510 void wxCDMApplicationDescriptionPanel::OnMainMouseEnter(wxMouseEvent& event)
511 {
512   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
513
514   if(this->application->GetMainFile() != NULL)
515     {
516       newEvent->SetClientData(this->application->GetMainFile());
517       newEvent->SetId(0);
518       wxPostEvent(this->GetParent(), *newEvent);
519     }
520   event.Skip();
521 }
522
523 void wxCDMApplicationDescriptionPanel::OnMainMouseExit(wxMouseEvent& event)
524 {
525   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
526
527   if(this->application->GetMainFile() != NULL)
528     {
529       newEvent->SetClientData(this->application->GetMainFile());
530       newEvent->SetId(0);
531       wxPostEvent(this->GetParent(), *newEvent);
532     }
533   event.Skip();
534 }