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