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