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