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