]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMPackageDescriptionPanel.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  * wxCDMPackageDescriptionPanel.cpp
30  *
31  *  Created on: Nov 27, 2012
32  *      Author: Daniel Felipe Gonzalez Obando
33  */
34
35 #include "wxCDMPackageDescriptionPanel.h"
36
37 #include "wxCDMMainFrame.h"
38
39 #include "creaDevManagerIds.h"
40 #include "images/PkIcon64.xpm"
41
42 #include "wxCDMNewBlackBoxDialog.h"
43 #include "wxCDMPackageConfigurationDialog.h"
44 #include <wx/textdlg.h>
45 #include "CDMUtilities.h"
46
47 #include <vector>
48 #include "modelCDMCMakeListsFile.h"
49 #include "wxCDMPackageHelpDialog.h"
50
51
52 BEGIN_EVENT_TABLE(wxCDMPackageDescriptionPanel, wxPanel)
53 EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMPackageDescriptionPanel::OnBtnReturn)
54 EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMPackageDescriptionPanel::OnBtnSetAuthor)
55 EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMPackageDescriptionPanel::OnBtnSetVersion)
56 EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMPackageDescriptionPanel::OnBtnSetDescription)
57 EVT_HYPERLINK(ID_LINK_SELECT_BLACKBOX, wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect)
58 EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox)
59 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists)
60 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMPackageDescriptionPanel::OnBtnOpenFolder)
61 EVT_BUTTON(ID_BUTTON_CHOOSE, wxCDMPackageDescriptionPanel::OnBtnConfigurePackage)
62 END_EVENT_TABLE()
63
64 wxCDMPackageDescriptionPanel::wxCDMPackageDescriptionPanel(
65     wxWindow* parent,
66     modelCDMPackage* package,
67     wxWindowID id,
68     const wxString& caption,
69     const wxPoint& pos,
70     const wxSize& size,
71     long style
72 )
73 {
74   wxCDMPackageDescriptionPanel::Create(parent, package, id, caption, pos, size, style);
75 }
76
77 wxCDMPackageDescriptionPanel::~wxCDMPackageDescriptionPanel()
78 {
79 }
80
81 bool wxCDMPackageDescriptionPanel::Create(
82     wxWindow* parent,
83     modelCDMPackage* package,
84     wxWindowID id,
85     const wxString& caption,
86     const wxPoint& pos,
87     const wxSize& size,
88     long style
89 )
90 {
91   this->package = package;
92   wxPanel::Create(parent, id, pos, size, style);
93   CreateControls();
94   // this part makes the scrollbars show up
95   this->FitInside(); // ask the sizer about the needed size
96   this->SetScrollRate(5, 5);
97   return TRUE;
98 }
99
100 void wxCDMPackageDescriptionPanel::CreateControls()
101 {
102   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
103
104   //Links to return
105   wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL);
106   std::vector<modelCDMIProjectTreeNode*> parents = this->package->GetParents();
107   for (int i = 0; i < (int)(parents.size()); i++)
108     {
109       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);
110       returnLnk->SetWindowStyle(wxNO_BORDER);
111           returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
112       linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
113       linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0);
114     }
115
116   linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->package->GetName())), 0, wxALIGN_CENTER, 0);
117
118   sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5);
119
120   //Header
121   wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
122   {
123     //Image
124     headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PkIcon64)),0, wxALIGN_CENTER, 0);
125     wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
126     //Title
127     textSizer->Add(new wxStaticText(this, -1, _("Package")),0, wxALIGN_LEFT, 0);
128     //Package Name
129     textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->package->GetNamePackage())),0, wxALIGN_LEFT, 0);
130     headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
131   }
132   sizer->Add(headerSizer, 0, wxALIGN_CENTER);
133
134   //Package Properties
135   wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties"));
136   wxPanel* propertiesPanel = new wxPanel(this);
137   wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
138   wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
139
140   wxStaticText *pAuthor = new wxStaticText(propertiesPanel, -1, wxT("Author"));
141   wxStaticText *pVersion = new wxStaticText(propertiesPanel, -1, wxT("Version"));
142   wxStaticText *pDescription = new wxStaticText(propertiesPanel, -1, wxT("Description"));
143
144   // author
145   wxBoxSizer* pAuthorsz = new wxBoxSizer(wxHORIZONTAL);
146   this->authortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetAuthors()));
147   wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_AUTHOR, wxT("Change"));
148   pAuthorbt->SetToolTip(wxT("Update the author/s of the package."));
149   pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER_VERTICAL);
150   pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10);
151
152   // version
153   wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
154   this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetVersion()));
155   wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
156   pVersionbt->SetToolTip(wxT("Update the version of the package."));
157   pVersionsz->Add(this->versiontc, 1, wxALIGN_CENTER_VERTICAL);
158   pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
159
160   // description
161   wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL);
162   this->descriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetDescription()));
163   wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_DESCRIPTION, wxT("Change"));
164   pDescriptionbt->SetToolTip(wxT("Update the description of the project."));
165   pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER_VERTICAL);
166   pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
167
168   propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
169   propertiesGridSizer->Add(pAuthorsz, 1, wxEXPAND);
170   propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
171   propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND);
172   propertiesGridSizer->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
173   propertiesGridSizer->Add(pDescriptionsz, 1, wxEXPAND);
174
175   propertiesGridSizer->AddGrowableCol(1,1);
176
177   propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
178   propertiesPanel->SetSizer(propertiesPanelSizer);
179   propertiesPanelSizer->Fit(propertiesPanel);
180   propertiesBox->Add(propertiesPanel, 0, wxEXPAND | wxALL, 5);
181
182   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
183
184   //Black Boxes
185   wxStaticBoxSizer* BBBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Black Boxes"));
186   BBBox->GetStaticBox()->SetToolTip(wxT("Select any of the available black boxes to see its details or modify them."));
187   wxPanel* BBPanel = new wxPanel(this);
188   wxBoxSizer* BBPanelSizer = new wxBoxSizer(wxVERTICAL);
189
190
191   std::vector<modelCDMBlackBox*> blackBoxes = this->package->GetSrc()->GetBlackBoxes();
192   for (int i = 0; i < (int)(blackBoxes.size()); i++)
193     {
194
195       if(blackBoxes[i] != NULL)
196         {
197
198                         wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
199           pBBlk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
200           std::string tt = "Author: " + blackBoxes[i]->GetAuthors() + "\nDescription: " + blackBoxes[i]->GetDescription() + "\nCategories: " + blackBoxes[i]->GetCategories();
201           pBBlk->SetToolTip(crea::std2wx(tt));
202           pBBlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseEnter,NULL,this);
203           pBBlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseExit,NULL,this);
204           BBPanelSizer -> Add(pBBlk, 0, wxEXPAND | wxALL, 5);
205         }
206     }
207
208   BBPanel->SetSizer(BBPanelSizer);
209   BBPanelSizer->Fit(BBPanel);
210   BBBox->Add(BBPanel, 1, wxEXPAND | wxALL, 5);
211   sizer -> Add(BBBox, 0, wxEXPAND | wxALL, 10);
212
213   //Actions
214   wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions"));
215   wxPanel* actionsPanel = new wxPanel(this);
216   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
217   //actionsGrid Sizer
218   wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
219
220   wxButton* createBBbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_BLACKBOX, _T("A. Create Black Box"));
221   createBBbt->SetToolTip(wxT("Create a new black box for the active project inside this package."));
222   actionsGridSizer->Add(createBBbt, 1, wxALL | wxEXPAND, 5);
223   wxButton* editConfbt = new wxButton(actionsPanel, ID_BUTTON_CHOOSE, _T("B. Configure Package"));
224   editConfbt->SetToolTip(wxT("Select the libraries your package is going to use. This procedure changes the package's CMakeLists file."));
225   actionsGridSizer->Add(editConfbt, 1, wxALL | wxEXPAND, 5);
226   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
227   editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the package's CMakeLists.txt file."));
228   editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseEnter,NULL,this);
229   editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseExit,NULL,this);
230   actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
231   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Package Folder"));
232   openFolderbt->SetToolTip(wxT("Open the package folder in the file explorer."));
233   actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
234
235   actionsGridSizer->AddGrowableCol(0,1);
236   actionsGridSizer->AddGrowableCol(1,1);
237
238   actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0);
239   actionsPanel->SetSizer(actionsPanelSizer);
240   actionsPanelSizer->Fit(actionsPanel);
241   actionsBox->Add(actionsPanel, 1, wxEXPAND);
242   sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10);
243
244   //Assign sizer
245   SetSizer(sizer);
246   sizer->SetSizeHints(this);
247
248   if (((wxCDMMainFrame*)this->GetParent())->isHelp())
249     {
250       wxCDMPackageHelpDialog* helpDialog = new wxCDMPackageHelpDialog(this->GetParent(), this->package, wxID_ANY);
251       helpDialog->Show(true);
252     }
253 }
254
255 void wxCDMPackageDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
256 {
257   std::vector<modelCDMIProjectTreeNode*> parents = this->package->GetParents();
258   std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
259   //std::cout << parentURL << std::endl;
260   for (int i = 0; i < (int)(parents.size()); i++)
261     {
262       if (parents[i]->GetPath() == parentURL)
263         {
264           wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
265           newEvent->SetClientData(parents[i]);
266           newEvent->SetId(0);
267           wxPostEvent(this->GetParent(), *newEvent);
268         }
269     }
270 }
271
272 void wxCDMPackageDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event)
273 {
274   //get author from user
275   wxTextEntryDialog* authDlg = new wxTextEntryDialog(
276       this,
277       wxT("Enter the new authors name. Separate each author with a '/'."),
278       wxT("Change Package Author - creaDevManager"),
279       crea::std2wx(this->package->GetAuthors()),
280       wxTE_MULTILINE | wxOK | wxCANCEL
281   );
282
283   if (authDlg->ShowModal() == wxID_OK)
284     {
285       std::string authorsStr = crea::wx2std(authDlg->GetValue());
286       //check name
287       if(authorsStr.size() > 0)
288         {
289           std::string* result;
290           if(!this->package->SetAuthors(authorsStr, result))
291             wxMessageBox(crea::std2wx(*result),_T("Change Package Author - Error!"),wxOK | wxICON_ERROR);
292         }
293       this->authortc->SetLabel(crea::std2wx(this->package->GetAuthors()));
294       this->authortc->GetParent()->GetSizer()->RecalcSizes();
295     }
296
297 }
298
299 void wxCDMPackageDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
300 {
301   //get version
302   wxString versionWx = wxGetTextFromUser(
303       wxT("Enter the new version name"),
304       wxT("Change Package Version - creaDevManager"),
305       crea::std2wx(this->package->GetVersion())
306   );
307   //check name
308   std::vector<std::string> parts;
309   CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties);
310   if(parts.size() == 3)
311     {
312       std::string* result;
313       if(!this->package->SetVersion(crea::wx2std(versionWx), result))
314         wxMessageBox(crea::std2wx(*result),_T("Change Package Version - Error!"),wxOK | wxICON_ERROR);
315     }
316   else
317     {
318       wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR);
319     }
320   this->versiontc->SetLabel(crea::std2wx(this->package->GetVersion()));
321 }
322
323 void wxCDMPackageDescriptionPanel::OnBtnSetDescription(wxCommandEvent& event)
324 {
325   //get description from user
326   wxTextEntryDialog* descDlg = new wxTextEntryDialog(
327       this,
328       wxT("Edit the package description."),
329       wxT("Change Package Description - creaDevManager"),
330       crea::std2wx(this->package->GetDescription()),
331       wxTE_MULTILINE | wxOK | wxCANCEL
332   );
333
334   if (descDlg->ShowModal() == wxID_OK)
335     {
336       std::string descriptionStr = crea::wx2std(descDlg->GetValue());
337       //check desc
338       if(descriptionStr.size() > 0)
339         {
340           std::string* result;
341           if(!this->package->SetDescription(descriptionStr, result))
342             wxMessageBox(crea::std2wx(*result),_T("Change Package Description - Error!"),wxOK | wxICON_ERROR);
343         }
344       this->descriptiontc->SetLabel(crea::std2wx(this->package->GetDescription()));
345       this->descriptiontc->GetParent()->GetSizer()->RecalcSizes();
346     }
347 }
348
349 void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event)
350 {
351   modelCDMBlackBox* bb;
352   std::vector<modelCDMBlackBox*> bbs = this->package->GetSrc()->GetBlackBoxes();
353   for (int i = 0; i < (int)(bbs.size()); i++)
354     {
355       if(bbs[i]->GetName() == crea::wx2std(event.GetURL()))
356         {
357           bb = bbs[i];
358           break;
359         }
360     }
361
362   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
363   newEvent->SetClientData(bb);
364   newEvent->SetId(1);
365   newEvent->SetString(wxT("blackbox"));
366   wxPostEvent(this->GetParent(), *newEvent);
367
368   wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
369   newEvent1->SetClientData(bb->GetHeaderFile());
370   newEvent1->SetId(0);
371   wxPostEvent(this->GetParent(), *newEvent1);
372
373 }
374
375 void wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event)
376 {
377
378   wxCDMNewBlackBoxDialog* dialog = new wxCDMNewBlackBoxDialog(this);
379   long userResponse;
380   userResponse = dialog->ShowModal();
381
382   if(userResponse == wxID_FORWARD)
383     {
384       std::string* result;
385       //create black box
386       modelCDMIProjectTreeNode* blackBox = this->package->CreateBlackBox(
387           result,
388           crea::wx2std(dialog->GetBlackBoxName()),
389           crea::wx2std(dialog->GetBlackBoxType()),
390           crea::wx2std(dialog->GetBlackBoxFormat()),
391           crea::wx2std(dialog->GetBlackBoxCategories()),
392           crea::wx2std(dialog->GetBlackBoxAuthor()),
393           crea::wx2std(dialog->GetBlackBoxAuthorEmail()),
394           crea::wx2std(dialog->GetBlackBoxDescription())
395       );
396       //check black box created
397       if(blackBox == NULL)
398         {
399           wxMessageBox(crea::std2wx(*result),_T("New Black Box - Error!"),wxOK | wxICON_ERROR);
400           return;
401         }
402       wxMessageBox(crea::std2wx("Black box successfully created."),_T("New Black Box - Success!"),wxOK | wxICON_INFORMATION);
403
404       //refreshing tree and description
405       //send event instead of calling parent to avoid crashing
406
407       ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
408
409       wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
410       newEvent->SetId(1);
411       newEvent->SetClientData(blackBox);
412       newEvent->SetString(wxT("blackbox"));
413       newEvent->SetClientData(blackBox);
414       wxPostEvent(this->GetParent(), *newEvent);
415     }
416 }
417
418 void
419 wxCDMPackageDescriptionPanel::OnBtnConfigurePackage(wxCommandEvent& event)
420 {
421   wxCDMPackageConfigurationDialog* dialog = new wxCDMPackageConfigurationDialog(this,this->package);
422   long userResponse;
423   userResponse = dialog->ShowModal();
424 }
425
426 void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
427 {
428   std::string* result;
429   if(!this->package->OpenCMakeListsFile(result))
430     wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
431
432   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
433
434   if(this->package->GetCMakeLists() != NULL)
435     {
436       newEvent->SetClientData(this->package->GetCMakeLists());
437       newEvent->SetId(0);
438       wxPostEvent(this->GetParent(), *newEvent);
439     }
440
441   event.Skip();
442 }
443
444 void wxCDMPackageDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
445 {
446   std::string* result;
447   if(!this->package->OpenInFileExplorer(result))
448     wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
449 }
450
451 void wxCDMPackageDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
452 {
453   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
454   std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
455
456   modelCDMFile* bbHeader = NULL;
457   std::vector<modelCDMBlackBox*> boxes = this->package->GetSrc()->GetBlackBoxes();
458   for (int i = 0; i < (int)(boxes.size()); i++)
459     {
460       if(boxes[i]->GetName() == BBName)
461         {
462           bbHeader = boxes[i]->GetHeaderFile();
463           break;
464         }
465     }
466   newEvent->SetClientData(bbHeader);
467   newEvent->SetId(0);
468   wxPostEvent(this->GetParent(), *newEvent);
469   event.Skip();
470 }
471
472 void wxCDMPackageDescriptionPanel::OnMouseExit(wxMouseEvent& event)
473 {
474   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
475   std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
476   modelCDMFile* bbHeader = NULL;
477   std::vector<modelCDMBlackBox*> boxes = this->package->GetSrc()->GetBlackBoxes();
478   for (int i = 0; i < (int)(boxes.size()); i++)
479     {
480       if(boxes[i]->GetName() == BBName)
481         {
482           bbHeader = boxes[i]->GetHeaderFile();
483           break;
484         }
485     }
486   newEvent->SetClientData(bbHeader);
487   newEvent->SetId(0);
488   wxPostEvent(this->GetParent(), *newEvent);
489   event.Skip();
490 }
491
492 void wxCDMPackageDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
493 {
494   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
495
496   if(this->package->GetCMakeLists() != NULL)
497     {
498       newEvent->SetClientData(this->package->GetCMakeLists());
499       newEvent->SetId(0);
500       wxPostEvent(this->GetParent(), *newEvent);
501     }
502   event.Skip();
503 }
504
505 void wxCDMPackageDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
506 {
507   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
508
509   if(this->package->GetCMakeLists() != NULL)
510     {
511       newEvent->SetClientData(this->package->GetCMakeLists());
512       newEvent->SetId(0);
513       wxPostEvent(this->GetParent(), *newEvent);
514     }
515   event.Skip();
516 }
517
518