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