]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxTreeView.cpp
#3331 Add Manufacturer tag DICOM (0008,0070)
[creaImageIO.git] / src / creaImageIOWxTreeView.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 #include <creaImageIOWxTreeView.h>
29 #include <creaImageIOGimmickView.h>
30 #include <wx/splitter.h>
31 #include <wx/gdicmn.h>
32 #include <boost/date_time/gregorian/gregorian.hpp>
33 #include <creaImageIOGimmick.h>
34 #ifdef _DEBUG
35 #define new DEBUG_NEW
36 #endif
37 //=====================================================================
38 namespace creaImageIO
39 {
40
41   //=====================================================================
42 }
43 //=====================================================================
44
45 //=====================================================================
46 ///Comparing function for ordering algorithm. Takes parameters as strings.
47 //int wxCALLBACK CompareFunctionStrings(long item1, long item2, long sortData)
48 int wxCALLBACK CompareFunctionStrings(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
49 {       
50   creaImageIO::ItemData* data1 = (creaImageIO::ItemData*)item1;
51   creaImageIO::ItemData* data2 = (creaImageIO::ItemData*)item2;
52   const std::string& s1(*(data1->attr));
53   const std::string& s2(*(data2->attr));  
54   if(sortData==1)
55     {
56       // inverse the order
57       if (s1 < s2)  return 1;
58       if (s1 > s2)  return -1;
59       return 0;
60     }  else  {
61       if (s1 < s2)      return -1;
62       if (s1 > s2)      return 1;
63       return 0;
64     } // if sortData    
65 }
66 //=====================================================================
67
68 //=====================================================================
69 ///Comparing function for ordering algorithm. Takes parameters as ints.
70 int wxCALLBACK CompareFunctionInts(long item1, long item2, long sortData)
71 {       
72   creaImageIO::ItemData* data1 = (creaImageIO::ItemData*)item1;
73   creaImageIO::ItemData* data2 = (creaImageIO::ItemData*)item2;
74
75   const std::string& s1(*(data1->attr));
76   const std::string& s2(*(data2->attr));
77
78   int val1=atoi(s1.c_str());
79   int val2=atoi(s2.c_str());
80
81   if(sortData==1)
82     {
83       // inverse the order
84       if (val1 < val2)
85         return 1;
86       if (val1 > val2)
87         return -1;
88       
89       return 0;
90     }
91   else
92     {
93       if (val1 < val2)
94         return -1;
95       if (val1 > val2)
96         return 1;
97
98       return 0;
99       
100     }
101   
102 }
103
104 //=====================================================================
105
106
107 //=====================================================================
108 namespace creaImageIO
109 {
110   //=====================================================================
111   // CTor
112   WxTreeView::WxTreeView(TreeHandler* handler,
113                          GimmickView* gimmick,
114                          wxWindow* parent,
115                          const wxWindowID id)
116     : wxPanel(parent,id),
117       TreeView(handler, gimmick)
118   {
119     GimmickDebugMessage(1,"WxTreeView::WxTreeView"<<std::endl);
120
121     // Split part below toolbar into notebook for views and panel
122     // for preview, messages...
123     // TO DO : Splitter
124     //    mSplitter = new wxSplitterWindow( this , -1);
125
126     // Global sizer
127     msizer                      = new wxBoxSizer(wxHORIZONTAL);    
128     int ctrl_style      = wxLC_REPORT | wxLC_VRULES;
129     int col_style       = wxLIST_FORMAT_LEFT;
130     // Creating the ListCtrl for the levels > 0 (not for Root level)
131     for (int i = 0;i < handler->GetTree().GetNumberOfLevels() -1; ++i)
132     {
133                 GimmickDebugMessage(5,"Creating view for level "<<i <<std::endl);
134                 LevelType level;
135                 level.SelectedUpToDate  = true;
136                 level.SortColumn                = 0;
137
138                 // If the first level : parent = this
139                 wxWindow* sparent               = this;
140                 // else parent = last splitter
141                 if (i>0) 
142                 {
143                         sparent = mLevelList[i-1].wxSplitter;
144                 } // if
145                 level.wxSplitter = new wxSplitterWindow( sparent , -1);
146                 if(i!=0)
147                 {
148                         level.wxSplitter->Show(false);
149                 } // if
150                 //          level.wxSplitter->SetMinimumPaneSize(100);
151                 
152                 wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
153                 
154 // EED1 2018-08-16
155 //                                                i,
156                                                   wxID_ANY,
157                                                    
158                                                   wxDefaultPosition, 
159                                                   wxDefaultSize,
160                                                   ctrl_style);
161                 level.wxCtrl = ctrl;
162                 level.wxSplitter->Initialize(ctrl);
163            
164                 // Create the columns : one for each attribute of the level
165                 int col = 0;
166                 std::string title;
167
168                 tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
169                 for (a  = handler->GetTree().GetAttributeDescriptorList(i+1).begin();
170                          a != handler->GetTree().GetAttributeDescriptorList(i+1).end();
171                          ++a)
172                 {
173                         GimmickDebugMessage(5,"Creating column "<<col<<" : " <<a->GetName() <<std::endl);       
174                         if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE)
175                         {
176                                 if(a->GetName()=="UNKNOWN")
177                                 {
178                                         title = "#";
179                                         title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
180                                         if (title[title.size()-1]!='s')
181                                         {               
182                                                 title += "s";
183                                         } // if
184                                 } else {
185                                         title=a->GetName();
186                                 } // if a
187                                 std::string temp = a->GetKey();
188                                 if (temp.compare("ID") != 0)
189                                 {               
190                                         ctrl->InsertColumn(col,crea::std2wx(title),col_style);
191                                         col++;
192                                 } // if temp
193                                         level.key.push_back(a->GetKey());
194                         } // if
195                         
196                 } // for a  
197                 mLevelList.push_back(level);
198       } //  for i
199     
200 #if wxUSE_MENUS
201
202          // Column Menu
203     menu =new wxMenu();
204         wxMenuItem* m1=menu->Append(wxID_ANY, _T("&Sort ascending"));
205         wxMenuItem* m2=menu->Append(wxID_ANY, _T("&Sort descending"));
206         wxMenuItem* m3=menu->Append(wxID_ANY, _T("&Filter"));
207         mAscendingID=m1->GetId();
208         mDescendingID=m2->GetId();
209         mFilterID=m3->GetId();
210         Connect( mAscendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
211         Connect( mDescendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
212         Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );
213
214
215         ////SubMenuItem EXPORT
216         subExportMenu = new wxMenu();
217         wxMenuItem *subExp1 = subExportMenu->Append(wxID_ANY, _T("&Export to Storage"));
218         Connect( subExp1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnExportToStorage) );
219
220         //ItemMenu
221         menuItem =new wxMenu();
222
223         wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
224         wxMenuItem* m3Item=menuItem->Append(wxID_ANY, _T("&Edit Fields"));
225         wxMenuItem* m4Item=menuItem->Append(wxID_ANY, _T("&Display Dicom Tags"));
226         menuItem->AppendSubMenu(subExportMenu, wxT("&Export"));
227
228         wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
229         mAnonymizingID=m1Item->GetId();
230         Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymizer) );
231
232         mLocalCopyID=m2Item->GetId();
233         mEditFieldID=m3Item->GetId();
234         mDumpID=m4Item->GetId();
235         
236         Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
237         Connect( mEditFieldID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnEditField) );
238         Connect( mDumpID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnDumpTags) );
239         
240 #endif // wxUSE_MENUS
241         /// Initialize the first level splitter
242           
243         msizer->Add( mLevelList[0].wxSplitter ,1, wxGROW  ,0);
244         //      mColumnSelected = 1;
245         mLastSelected           = 0;
246         mLastLevel                      = 0;
247         //      mDirection              = true;
248
249         mIgnoreSelectedChanged = false;
250
251         //CreateColorPalette();
252     UpdateLevel(1);
253
254     SetSizer( msizer );     
255     SetAutoLayout(true);
256     Layout();
257   }
258   //=====================================================================
259
260   //=====================================================================
261   /// Destructor
262   WxTreeView::~WxTreeView()
263   {
264     GimmickDebugMessage(1,"WxTreeView::~WxTreeView"<<std::endl);
265         delete menu;
266         delete menuItem;
267   }
268   //=====================================================================
269   
270   //=====================================================================
271   const std::vector<tree::Node*>& WxTreeView::GetSelected(int level)
272   {
273           std::vector<tree::Node*>& sel = mLevelList[0].Selected;
274     //  if (GetSelectedUpToDate(level)) 
275     int l = level - 1;
276     // the selection of upper level
277         if(mLevelList.size() == level -1)
278         {
279                 sel = mLevelList.back().Selected;
280         } else {
281                 sel=  mLevelList[l].Selected;
282         }
283         if (sel.size() > 0)
284         {
285                 sel.clear();
286         }
287         if (level == 1) 
288     {
289                 sel.push_back( GetTreeHandler()->GetTree().GetTree() );
290     } else if (level < mLevelList.size()+2 ) {
291                 long item = -1;
292                 for ( ;; )
293                 {
294                 item = GetCtrl(l-1)->GetNextItem(item,
295                                                                                  wxLIST_NEXT_ALL,
296                                                                                  wxLIST_STATE_SELECTED);
297                         if ( item == -1 )
298                         {
299                                 break;
300                         }
301 //                      long adr = (long)GetCtrl(l-1)->GetItemData(item);
302                         ItemData* adr = (ItemData*)GetCtrl(l-1)->GetItemData(item);
303 //                      tree::Node* n = ((ItemData*)adr)->node;
304                         tree::Node* n = adr->node;
305                         /* FCY 18-04-2011: don't understand the real purpose of these lines,
306                          if uncomment add last frame in first place 
307                                 if(mLastSelected==item)
308                         {
309                                 std::vector<tree::Node*>::iterator it;
310                                 it = sel.begin();
311                                 it = sel.insert ( it , n );
312                         }
313                         else
314                         {*/     
315                                 sel.push_back(n);
316                         //}                     
317                         
318                 } // for
319                 /*int n = GetCtrl(l-1)->GetItemCount();
320                 for (int i = 0; i<n; i++)
321                 {
322                         std::cout<<GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED)<<std::endl;
323                         if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
324                         {
325                                 long adr = GetCtrl(l-1)->GetItemData(i);
326                                 tree::Node* n = ((ItemData*)adr)->node;
327                                 if(mLastSelected==i)
328                                 {
329                                         std::vector<tree::Node*>::iterator it;
330                                         it = sel.begin();
331                                         it = sel.insert ( it , n );
332                                 }
333                                 else
334                                 {
335                                         
336                                         sel.push_back(n);
337                                 }
338                         }
339               }*/
340           } else {
341                 // NOTHING
342         }   
343          
344     //    return mLevelList[level-1].Selected;
345     return sel;
346   }
347
348   //=====================================================================
349   
350   //=====================================================================
351   ///Removes selected nodes on last selected level
352    // NOT SPECIFIC 
353   void WxTreeView::RemoveSelected(std::string &i_save)
354   {
355          bool erase=false;
356          
357          unsigned int tempLevel = mLastLevel;
358     mLastLevel+=1;
359     const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
360         // if no selection, no remove action.
361     if(sel.size() != 0)
362         {
363             std::stringstream out;
364             std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
365             out<<"Delete ";
366             out<<sel.size();
367             if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
368               {
369                 out<<" "<<levelName;
370                 out<<"s?";
371               }
372             else
373               {
374                 out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<"?";
375               }
376             if (wxMessageBox(crea::std2wx(out.str()),
377                              _T("Remove Files"),
378                              wxYES_NO,this ) == wxYES)
379               {
380                 erase = true;
381               }
382             if(erase)
383                   {
384             GetGimmickView()->modifyValidationSignal(false);
385                     bool needRefresh=false;
386                     std::vector<tree::Node*>::const_iterator i;
387                     for (i=sel.begin(); i!=sel.end(); ++i)
388                       {
389                         GimmickMessage(1,"deleting '" << (*i)->GetLabel() << "'" << mLastLevel << std::endl );                  
390                         if((*i)->GetParent()->GetNumberOfChildren()<2)
391                           {
392                             needRefresh=true;
393                           }
394                           //tree::Node* n = new (tree::Node*)(*i);
395                           GetTreeHandler()->LoadChildren((*i),4);
396                           GetGimmickView()->AddIgnoreFile(*i);
397                           GetTreeHandler()->Remove(*i);
398                       }
399                     
400                     if(needRefresh && mLastLevel>1)
401                     {
402                                 UpdateLevel(mLastLevel-2);
403                     } else if(mLastLevel>1) {
404                                 UpdateLevel(mLastLevel-1);
405                     } else {
406                                 UpdateLevel(mLastLevel);
407                     } // if needRefresh
408                   } // if erase
409         } else {
410                 // no need to incremente level
411                 mLastLevel = tempLevel;
412         }
413     
414         if (erase && mLastLevel == 1 && i_save == "0")
415         {
416         
417                 RemoveAlertDlg *dial = new RemoveAlertDlg(this,  crea::std2wx("Remove files"), wxSize(450,300));
418                 //dial->ShowModal();
419                 if (dial->ShowModal() == wxID_OK)
420                 {
421                         i_save = dial->isChecked() == false? "0" : "1";
422                 }
423                 
424         }
425   }
426   
427   
428   //=====================================================================
429   /// Updates a level of the view (adds or removes children, etc.)
430   void WxTreeView::UpdateLevel( int level )
431   {
432         GimmickDebugMessage(1,
433                         GetTreeHandler()->GetTree().GetLabel()
434                         <<"WxTreeView::UpdateLevel(level "
435                         <<level
436                         <<")"
437                         <<std::endl);
438     
439     wxBusyCursor busy;
440     RecursiveUpdateLevel(level);
441     int i;
442     for (i=0; i<level-1; i++)
443     {
444                 if (!GetSplitter(i)->IsSplit()) 
445                 { 
446                         GetSplitter(i)->SplitVertically(  GetCtrl(i), GetSplitter(i+1),100 );
447                 } // if
448       } // for
449     if (GetSplitter(i)->IsSplit()) 
450         { 
451                 GetSplitter(i)->Unsplit(); 
452         }
453     
454   }
455   //=====================================================================
456   
457   //=====================================================================
458   /// Recursive method called upon by UpdateLevel to refresh all windows
459   void WxTreeView::RecursiveUpdateLevel( int level )
460   {
461     GimmickDebugMessage(1,
462                         GetTreeHandler()->GetTree().GetLabel()
463                         <<"WxTreeView::RecursiveUpdateLevel(level "
464                         <<level
465                         <<")"<<std::endl);
466     int l = level - 1;  
467     const std::vector<tree::Node*>& sel(GetSelected(level));
468     // to speed up inserting we hide the control temporarily
469     GetCtrl(l)->Hide();
470     GetCtrl(l)->DeleteAllItems();
471     std::vector<tree::Node*>::const_iterator i;
472     for (i=sel.begin(); i!=sel.end(); ++i)
473     {
474         GimmickDebugMessage(1,
475                             "adding children of '"
476                             <<(*i)->GetLabel()
477                             <<"'"
478                             <<std::endl);
479         int _id=0;
480         //Adds items and sets their attributes
481         GetTreeHandler()->LoadChildren(*i,1);
482         tree::Node::ChildrenListType::reverse_iterator j;
483         for (j = (*i)->GetChildrenList().rbegin(); 
484              j!= (*i)->GetChildrenList().rend(); 
485              ++j)
486           {
487             GimmickDebugMessage(1,
488                                 "adding children "
489                                 <<(*j)->GetLabel()
490                                 <<"'"
491                                 <<std::endl);
492             wxListItem item;
493             item.SetMask(wxLIST_MASK_STATE | 
494                          wxLIST_MASK_TEXT |
495                          //                      wxLIST_MASK_IMAGE |
496                          wxLIST_MASK_DATA |
497                          //                      wxLIST_MASK_WIDTH |
498                          wxLIST_MASK_FORMAT
499                          );
500             
501                 ItemData* data  = new ItemData();
502             data->node          = *j;
503             data->id            = _id;
504             item.SetId(_id);
505             item.SetData(data);
506             _id++;
507             GetCtrl(l)->InsertItem(item);
508             //Setting attributes
509             for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)                          
510             {
511                         std::string val;
512                         //  Temporary correction : it works but no explanation about the problem FCY            
513                         if(k==0 && level <3)
514                         {
515                                 val = (*j)->GetAttribute("NumberOfChildren");
516                         } else {
517                                 val = (*j)->GetAttribute(mLevelList[l].key[k]);
518                         }
519                         if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isDateEntry()) // Date
520                         {
521                                 //                                        std::cout << "["<<val<< "]" << std::endl;
522                                 std::string valtmp(val);
523                                 try
524                                 {
525                                         boost::gregorian::date d1(boost::gregorian::from_undelimited_string(val));
526                                         val = to_iso_extended_string(d1);
527                                 } catch (...) {
528                                         val =  valtmp;
529                                 }
530                                 //                                        std::cout << "["<<val<< "]" << std::endl;     
531                         } else if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isTimeEntry()) // Time
532                         {
533                                 if ((val.size()>6) && (val != "" || val != " "))
534                                 {               
535                                         val = val.substr(0,2) + " : " + val.substr(2,2) + " : " + val.substr(4,2);
536                                 }
537                         } else {
538                                 if (val.size()==0)
539                                 { 
540                                         val = "?";
541                                 }
542                         } // if j
543                         if (val.size()==0)
544                         {
545                                 val = "X";
546                         }
547                         item.SetText( crea::std2wx(val));
548                         item.SetColumn(k);
549                         GetCtrl(l)->SetItem(item);
550                 } // for k
551                 item.Clear();
552           } // for j
553
554     }  // for i
555     SortLevel(l);
556     GetCtrl(l)->Show();
557   }
558   //=====================================================================
559   
560   
561   //================================================================
562   void WxTreeView::OnItemDeSelected(wxListEvent& event)
563   { 
564     GimmickDebugMessage(1,
565                         GetTreeHandler()->GetTree().GetLabel()
566                         <<" WxTreeView::OnItemDeselected"<<std::endl);
567     // retrieve the level
568     wxObject* obj = event.GetEventObject();   
569     unsigned int level = 0;
570     for (level = 0; level<mLevelList.size(); ++level)
571       {
572         if ( GetCtrl(level) == obj ) break;
573       } 
574     SetSelectedUpToDate(level,false);
575     // to allow a first selection in images TreeView
576     if (level==mLevelList.size()-1) 
577       OnItemSelected(event);
578   }
579   //================================================================
580   
581   //================================================================
582   void WxTreeView::OnItemSelected(wxListEvent& event)
583   { 
584     GimmickDebugMessage(1,GetTreeHandler()->GetTree().GetLabel()<<" WxTreeView::OnItemSelected"<<std::endl);
585
586     if (mIgnoreSelectedChanged) 
587     {
588                 GimmickDebugMessage(1, " mIgnoreSelectedChanged true: returning"<<std::endl);
589                 return;
590     }
591         
592     wxListItem info;
593     info.m_itemId = event.m_itemIndex;
594     mLastSelected = event.m_itemIndex;
595     // retrieve the level
596     wxObject* obj = event.GetEventObject();   
597     unsigned int level = 0;
598     for (level = 0; level<mLevelList.size(); ++level)
599     {
600                 if ( GetCtrl(level) == obj ) break;
601     }
602         mLastLevel=level;
603     GimmickDebugMessage(1," Level "<<level+1<<std::endl);
604     
605     // Update the children level (if selection not at last level)
606     if (level<mLevelList.size()-1) 
607     {   
608                 UpdateLevel( level + 2 ); 
609                 // Reset the viewer setting the default image
610                 GetGimmickView()->ClearSelection();
611     }
612     // Select all images if the selection is at series level
613     if (level==mLevelList.size()-2) 
614         {
615                 SelectAll(level+1);
616         }
617     // Validate selected images if the selection is at image level
618     if (level==(mLevelList.size()-1)) //&&mProcess) 
619     {
620                 if(event.GetEventType()==wxEVT_COMMAND_LIST_ITEM_SELECTED)
621                 {
622                   ValidateSelectedImages (true);
623                 } else {
624                   ValidateSelectedImages (false);
625                 }
626     } // if
627   }
628   //================================================================
629
630   //================================================================
631   void WxTreeView::SelectAll(int level)
632   {       
633     long item = -1;
634     //    int level=mLevelList.size()-1;
635     for ( ;; )
636     {
637                 item = GetCtrl(level)->GetNextItem(item,wxLIST_NEXT_ALL);
638                 if ( item == -1 )
639                 {
640                         break;
641                 }
642                 if(item==(GetCtrl(level)->GetItemCount()-1))
643                 {
644                         mIgnoreSelectedChanged = false;//mProcess=true;
645                 } else {
646                         mIgnoreSelectedChanged = true;//        mProcess=false;
647                 }
648                 GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
649                                                  | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
650     } // for
651   }
652
653   //================================================================
654   //================================================================
655
656   void WxTreeView::OnColClick(wxListEvent& event)
657   { 
658     mColumnSelected = event.m_col;
659     wxPoint clientpt;
660     clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
661     clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
662     senderCtrl = event.GetEventObject(); 
663     unsigned int level = 0;
664     for (level = 0; level<mLevelList.size(); ++level)
665       {
666         if ( GetCtrl(level) == senderCtrl ) break;
667       }
668     PopupMenu(menu, clientpt);
669     
670   }
671
672    //================================================================
673   //================================================================
674
675   void WxTreeView::OnItemMenu(wxListEvent &event)
676   {
677          wxPoint clientpt;
678     clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
679     clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
680     senderCtrl = event.GetEventObject();
681     unsigned int level = 0;
682     for (level = 0; level<mLevelList.size(); ++level)
683       {
684                 if ( GetCtrl(level) == senderCtrl ) break;
685       }
686           long* ptr=0;
687           int flag;
688           mLastRightLevel=level;
689           mLastRightSelected=GetCtrl(level)->HitTest(wxPoint(0,clientpt.y-8),flag,ptr);
690     PopupMenu(menuItem, clientpt);
691     
692   }
693   
694   //================================================================
695   //================================================================
696
697   void WxTreeView::OnPopupFilter(wxCommandEvent& event)
698   {
699     wxBusyCursor busy;
700     GimmickDebugMessage(7,
701                         "WxTreeView::OnEndLabelEdit" 
702                         <<std::endl);
703     unsigned int level = 0;
704     for (level = 0; level<mLevelList.size(); ++level)
705       {
706         if ( GetCtrl(level) == senderCtrl ) break;
707       }
708     std::string filter = crea::wx2std(wxGetTextFromUser(_T("Enter the filter to apply"), _T("Filter On Column")));
709     
710     std::string att;
711     
712     long it = -1;
713     UpdateLevel(level+1);
714     
715     std::vector<long> items;
716     bool in=false;
717     int del=0;
718     for ( ;; )
719       {
720         it = GetCtrl(level)->GetNextItem(it,
721                                          wxLIST_NEXT_ALL);
722         if ( it == -1 )
723           break;
724         
725         long adr = (long)GetCtrl(level)->GetItemData(it);
726         tree::Node* nod = ((ItemData*)adr)->node;
727         att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected]);
728         
729         
730         if(att.find(filter)>900)
731           {
732             
733             if(!in)
734               {
735                 in=true;
736               }
737             else
738               {
739                 del+=1;
740               }
741             
742             items.push_back(it-del);
743           }
744         
745       }
746     std::vector<long>::iterator iter;
747     for(iter=items.begin();iter!=items.end();++iter)
748       {
749         GetCtrl(level)->DeleteItem(*iter);
750       }
751     GetGimmickView()->ClearSelection();
752   }
753   //================================================================
754   
755   //================================================================
756   void WxTreeView::OnPopupSort(wxCommandEvent& event)
757   {
758     wxBusyCursor busy;
759     unsigned int level = 0;
760     for (level = 0; level<mLevelList.size(); ++level)
761       {
762         if ( GetCtrl(level) == senderCtrl ) break;
763       }
764     mLevelList[level].SortColumn = mColumnSelected;
765
766     if(event.GetId()==mAscendingID)
767       {
768         mLevelList[level].SortAscending = true;
769       }
770     else if(event.GetId()==mDescendingID)
771       {
772         mLevelList[level].SortAscending = false;
773       }
774     SortLevel(level);
775   }
776   //================================================================
777
778   void WxTreeView::OnAnonymizer(wxCommandEvent &event)
779   {
780            wxBusyCursor busy;
781            std::vector<std::string> filesname;
782            std::vector<tree::Node*> nodes;
783            nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
784            if(nodes.size() != 0)
785            {
786                    GetFilenamesAsString(nodes,filesname);
787                    GetGimmickView()->Anonymize(filesname,0);
788            }
789         
790   }
791
792   //================================================================
793   void WxTreeView::OnLocalCopy(wxCommandEvent& event)
794   {
795     wxBusyCursor busy;
796     
797         unsigned int tempLevel = mLastLevel;
798     mLastLevel+=1;
799     const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
800         
801     if(sel.size() != 0)
802         {
803             bool copy=false;
804             std::stringstream out;
805             std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
806             out<<"Copy ";
807             out<<sel.size();
808             if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
809               {
810                 out<<" "<<levelName;
811                 out<<"s to .creaImageIO?";
812               }
813             else
814               {
815                 out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<" to .creaImageIO?";
816               }
817             if (wxMessageBox(crea::std2wx(out.str()),
818                              _T("Remove Files"),
819                              wxYES_NO,this ) == wxYES)
820               {
821                 copy = true;
822               }
823             if(copy)
824                   {
825                         std::vector<std::string> s;
826                         GetFilenamesAsString(sel,s);
827             GetGimmickView()->CopyFiles(s);
828                   }
829         }
830         else
831         {
832                 mLastLevel = tempLevel;
833         }
834     
835     
836   }
837   //================================================================
838
839    //================================================================
840   void WxTreeView::OnEditField(wxCommandEvent& event)
841   {
842         if(mLastRightSelected!=-1)
843         {
844     tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
845         tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
846         std::vector<std::string> names;
847         std::vector<std::string> keys;
848         for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).begin();
849              a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).end();
850              ++a)
851         {
852                 if(a->GetFlags()==creaImageIO::tree::AttributeDescriptor::EDITABLE)
853             {
854                         names.push_back(a->GetName());
855                         keys.push_back(a->GetKey());
856                 }
857         }
858         GetGimmickView()->CreateEditFieldsDialog(node,names,keys);
859         }
860   }
861
862   //================================================================
863
864   //================================================================
865
866   void WxTreeView::OnExportToStorage(wxCommandEvent &event)
867   {
868         std::vector<std::string> filesname;
869         std::vector<tree::Node*> nodes;
870         nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
871         GetFilenamesAsString(nodes,filesname);
872         GetGimmickView()->ExportToStorage(filesname);
873   }
874
875   //================================================================
876
877   //================================================================
878
879   void WxTreeView::OnDumpTags(wxCommandEvent &event)
880   {
881           if(mLastRightSelected!=-1)
882         {
883                 tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
884                 tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
885                 std::vector<std::string> names;
886                 std::vector<std::string> keys;
887                 for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).begin();
888                          a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).end();
889                          ++a)
890                         {
891                                 if(a->GetKey()=="FullFileName")
892                                 {
893                                         GetGimmickView()->DumpTags(node->GetAttribute("FullFileName"));
894                                         return;
895                                 }
896                         }
897           }
898   }
899   
900
901   //================================================================
902
903   //================================================================
904   void WxTreeView::SortLevel(int level)
905   { 
906     GimmickDebugMessage(1,
907                         "WxTreeView::SortLevel(" 
908                         <<level<<")"
909                         <<std::endl);  
910     //Obtain the column name and the level that needs to be organized
911     
912     //    int l = level - 1;
913     //Sets the data for the items to be sorted
914     //    std::string att;
915     unsigned int ty=0;
916     int nbselected = 0;
917     int n = GetCtrl(level)->GetItemCount();
918     for (int i = 0; i < n; i++)
919     {
920                 //Gets current item data
921                 ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
922                 //Extracts the node and the type of attribute   
923                 tree::Node* nod = data->node;
924                 if(i==0)
925                   {
926                         (*nod).GetAttributeDescriptor
927                           (mLevelList[level].key[mLevelList[level].SortColumn])
928                           .DecodeType( ty );
929                   } // if i
930                 //Obtains the organizing attribute
931                 data->attr = & (*nod).GetAttribute(mLevelList[level].key[mLevelList[level].SortColumn]);
932                 //Selected ?
933                 data->selected = false;
934                 if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
935                 {
936                         data->selected = true;
937                         nbselected++;
938                 } // if
939     }// for     
940     GimmickDebugMessage(1,
941                         "WxTreeView::OnSort : " 
942                         <<nbselected<<" selected before sorting"
943                         <<std::endl);  
944     mIgnoreSelectedChanged = true; 
945     // 
946     if (mLevelList[level].SortAscending)
947     {
948                 if(ty==1)
949                 {
950                         GetCtrl(level)->SortItems(CompareFunctionInts, 0);
951                 } else {
952                         GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
953                 } // if ty
954     } else {
955                 if(ty==1)
956                 {
957                         GetCtrl(level)->SortItems(CompareFunctionInts, 1);
958                 } else {
959                         GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
960                 } // if ty
961     } //mLevelList
962  
963     // Reselects the unselected 
964     n = GetCtrl(level)->GetItemCount();
965     int after = 0;
966     for (int i = 0; i < n; i++)
967     {
968                 //Gets current item data
969                 ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
970                 //  long item = -1;
971                 //    for ( ;; )
972                 //      {
973                 //      item = GetCtrl(level)->GetNextItem(item,wxLIST_NEXT_ALL);
974                 //      if ( item == -1 ) break;
975                 //Gets current item data
976                 //      ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(item);
977                 // was selected ?
978                 
979                 if (data->selected)
980                 {
981                         nbselected--;
982                         if (nbselected==0)
983                         {
984                                 // if it is the last one we must process the selection
985                                 mIgnoreSelectedChanged = false;
986                         }
987                         GetCtrl(level)->SetItemState(i,
988                                                  wxLIST_STATE_SELECTED, 
989                                                  wxLIST_MASK_STATE 
990                                                  | wxLIST_MASK_TEXT 
991                                                  | wxLIST_MASK_IMAGE 
992                                                  | wxLIST_MASK_DATA 
993                                                  | wxLIST_MASK_WIDTH 
994                                                  | wxLIST_MASK_FORMAT);   
995                 } // if data
996                 if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
997                 {
998                         after++;
999                 }
1000
1001         
1002     } // for
1003     mIgnoreSelectedChanged = false; 
1004     GimmickDebugMessage(1,
1005                         "WxTreeView::SortLevel : " 
1006                         <<after<<" selected after sorting"
1007                         <<std::endl);  
1008     }
1009   //================================================================
1010
1011   
1012   //================================================================
1013   void WxTreeView::ValidateSelectedImages(bool isSelection)
1014   {
1015     GimmickDebugMessage(7,
1016                         "WxTreeView::ValidateSelectedImages" 
1017                         <<std::endl);
1018     const std::vector<tree::Node*>& sel(GetSelected((int)mLevelList.size()+1));
1019     GetGimmickView()->OnSelectionChange(sel,
1020                                         isSelection,(mLastSelected-1),
1021                                         !mIgnoreSelectedChanged);
1022  
1023   }
1024   //================================================================
1025
1026
1027   //================================================================
1028   void WxTreeView::GetNodes(std::vector<tree::Node*>& nodes, bool direction)
1029   {
1030         long item = mLastSelected;
1031         int level=(int)mLevelList.size()-1;
1032         //Gets current item data
1033         long adr = (long)GetCtrl(level)->GetItemData(item);
1034         //Extracts the node
1035         tree::Node* nod = ((ItemData*)adr)->node;
1036     for ( ;; )
1037     {
1038                 if(direction)
1039                 {
1040                         item = GetCtrl(level)->GetNextItem(item,
1041                                      wxLIST_NEXT_ABOVE);
1042                 }
1043                 else
1044                 {
1045                         item = GetCtrl(level)->GetNextItem(item,
1046                                      wxLIST_NEXT_BELOW);
1047                 }
1048         if ( item == -1 || item==0  )
1049                 {
1050             break;
1051                 }
1052                 if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 )
1053                 {
1054
1055                         adr = (long)GetCtrl(level)->GetItemData(item);
1056                         nod = ((ItemData*)adr)->node;
1057                         nodes.push_back(nod);
1058                 }
1059     }
1060
1061   }
1062   //================================================================
1063    //=================================================
1064   void WxTreeView::OnKeyDown(wxListEvent &event)
1065   {
1066           if(event.GetKeyCode() == WXK_DELETE)
1067           {
1068                    wxBusyCursor busy;
1069                    std::string temp = "0";
1070                    RemoveSelected(temp);
1071                    GetGimmickView()->ClearSelection();
1072           }
1073                   
1074   }
1075   //================================================================
1076
1077   //================================================================
1078   // Should be in another place : not specific !
1079   void WxTreeView::GetSelectedAsString(std::vector<std::string>&s)
1080   {
1081     int level= (int)mLevelList.size();
1082     const std::vector<tree::Node*>& sel=GetSelected(level+1);
1083     std::vector<tree::Node*>::const_iterator i;
1084     
1085     for (i=sel.begin(); i!=sel.end(); ++i)
1086       {
1087         std::string filename=(*i)->GetAttribute("FullFileName");
1088         s.push_back(filename);
1089       }
1090   }
1091
1092
1093
1094   //================================================================
1095   void WxTreeView::GetFilenamesAsString(const std::vector<tree::Node*>& nodes, std::vector<std::string>&s)
1096   {
1097     std::vector<tree::Node*>::const_iterator i;
1098     
1099     for (i=nodes.begin(); i!=nodes.end(); ++i)
1100       {
1101                   if((*i)->GetLevel()<mLevelList.size())
1102                   {
1103                          GetTreeHandler()->LoadChildren(*i,0);
1104                          GetFilenamesAsString((*i)->GetChildrenList(),s);
1105                   }
1106                   else
1107                   {
1108                         std::string filename=(*i)->GetAttribute("FullFileName");
1109                         s.push_back(filename);
1110                   }
1111       }
1112   }
1113
1114    //================================================================
1115
1116    //================================================================
1117   void WxTreeView::GetAttributes(std::vector<std::string>& areShown, std::vector<std::string>& notShown, int level)
1118   {
1119           areShown.clear();
1120           notShown.clear();
1121         tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
1122         for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).begin();
1123              a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).end();
1124              ++a)
1125         {
1126                 if(a->GetFlags()==creaImageIO::tree::AttributeDescriptor::EDITABLE && IsAttributeVisible(a->GetName(),level))
1127             {
1128                         areShown.push_back(a->GetName());
1129                 }
1130         }
1131         notShown=mLevelList[level-1].notShownAtts;
1132   }
1133
1134   //================================================================
1135   void WxTreeView::SetNonVisibleAttributes(const std::vector<std::string>& notShown, int nlevel)
1136   {
1137         mLevelList[nlevel].notShownAtts=notShown;
1138   }
1139
1140   //================================================================
1141    void WxTreeView::CreateCtrl(std::vector<std::string>& notShown, int nlevel)
1142   {
1143         int ctrl_style = wxLC_REPORT | wxLC_VRULES;
1144     int col_style = wxLIST_FORMAT_LEFT;
1145         LevelType level;
1146         mLevelList[nlevel].SelectedUpToDate = true;
1147         mLevelList[nlevel].SortColumn = 0;
1148         mLevelList[nlevel].key.clear();
1149         
1150         mLevelList[nlevel].wxCtrl = new wxListCtrl(mLevelList[nlevel].wxSplitter,
1151                                           nlevel,
1152                                           wxDefaultPosition, 
1153                                           wxDefaultSize,
1154                                           ctrl_style);
1155         wxWindow* oldWin=mLevelList[nlevel].wxSplitter->GetWindow1();
1156         mLevelList[nlevel].wxSplitter->ReplaceWindow(oldWin,mLevelList[nlevel].wxCtrl);
1157         mLevelList[nlevel].wxSplitter->Initialize(mLevelList[nlevel].wxCtrl);
1158    
1159         // Create the columns : one for each attribute of the level
1160         int col = 0;
1161         std::string title;
1162
1163         tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
1164         for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).begin();
1165              a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).end();
1166              ++a)
1167
1168         {   
1169             if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE && IsAttributeVisible(a->GetName(),nlevel+1))
1170               {
1171                   title=a->GetName();
1172                   std::string temp = a->GetKey();
1173                   if (temp.compare("ID") != 0)
1174                   {
1175                         mLevelList[nlevel].wxCtrl->InsertColumn(col, 
1176                                         crea::std2wx(title),
1177                                         col_style);
1178                         col++;
1179                   }
1180                 mLevelList[nlevel].key.push_back(a->GetKey());
1181               }
1182                 
1183           }
1184         oldWin->Destroy();
1185         UpdateLevel(1);
1186         }
1187
1188    //================================================================
1189   bool WxTreeView::IsAttributeVisible(const std::string& val, int level)
1190   {
1191           std::vector<std::string> ns=mLevelList[level-1].notShownAtts;
1192           std::vector<std::string>::iterator it;
1193           bool found=false;
1194           for(it=ns.begin();it!=ns.end()&&!found;++it)
1195           {
1196                   if(val.compare(*it)==0)
1197                   {
1198                           found=true;
1199                   }
1200           }
1201           return !found;
1202   }
1203  //================================================================
1204   //================================================================
1205
1206         RemoveAlertDlg::RemoveAlertDlg(wxWindow *parent, 
1207                                        wxString title,    
1208                                        const wxSize& size)
1209  :   wxDialog( parent, 
1210                   wxID_ANY, 
1211                   title,
1212                   wxDefaultPosition,
1213                   size,
1214                   wxDEFAULT_DIALOG_STYLE)
1215         {
1216             wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
1217
1218                 //std::string out("To reload deleted patient, you should synchronize your database before.");  // JPR
1219                 //wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY,crea::std2wx(out),wxDefaultPosition, wxSize(500,20));
1220                 wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY,
1221                                         _T("To reload deleted patient, you should synchronize your database before."),
1222                                         wxDefaultPosition, wxSize(650,20));  // 650 vs 500 ? // JPRx
1223                 mcheck = new wxCheckBox(this, 5478, _T("Do not display this warning again!"));
1224                 Connect( mcheck->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &RemoveAlertDlg::onCheck ); 
1225                 wxSizer* buttonsSizer = this->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
1226                 
1227                 topsizer->Add(text);
1228                 topsizer->Add(mcheck,0,wxGROW);
1229                 topsizer->Add(buttonsSizer,0,wxGROW);
1230                 SetSizer(topsizer, true);
1231                 mSave = false;
1232                 Layout();
1233         }
1234         RemoveAlertDlg::~RemoveAlertDlg(){};
1235         bool RemoveAlertDlg::isChecked()
1236         {
1237                 return mSave;
1238         }
1239         void RemoveAlertDlg::onCheck(wxCommandEvent &Event)
1240         {
1241                 mSave = mcheck->IsChecked();
1242         }
1243         
1244
1245   //================================================================
1246   //================================================================
1247   BEGIN_EVENT_TABLE(WxTreeView, wxPanel)   
1248   /*
1249     EVT_SIZE(MyFrame::OnSize)
1250
1251     EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
1252     EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
1253     EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
1254     EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
1255     EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
1256     EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
1257     EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
1258     EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
1259     EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
1260     EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
1261
1262     EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
1263     EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
1264     EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
1265     EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
1266     EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
1267     EVT_MENU(LIST_ADD, MyFrame::OnAdd)
1268     EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
1269     EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
1270     EVT_MENU(LIST_SORT, MyFrame::OnSort)
1271     EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
1272     EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
1273     EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
1274     EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
1275     EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
1276     EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
1277     EVT_MENU(LIST_THAW, MyFrame::OnThaw)
1278     EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
1279     EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
1280
1281     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
1282     EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
1283 END_EVENT_TABLE()
1284
1285 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
1286     EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
1287     EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
1288         
1289     EVT_LIST_BEGIN_LABEL_EDIT(-1, WxTreeView::OnBeginLabelEdit)
1290     EVT_LIST_END_LABEL_EDIT(-1, WxTreeView::OnEndLabelEdit)
1291         
1292     EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
1293     EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
1294 #if WXWIN_COMPATIBILITY_2_4
1295     EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
1296     EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
1297 #endif
1298   */
1299     EVT_LIST_KEY_DOWN(-1, WxTreeView::OnKeyDown)
1300     EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnItemSelected)
1301         EVT_LIST_ITEM_RIGHT_CLICK(-1, WxTreeView::OnItemMenu)
1302     EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnItemDeSelected)
1303         /*
1304     EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
1305     EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
1306     EVT_LIST_ITEM_FOCUSED(LIST_CTRL, MyListCtrl::OnFocused)
1307 */
1308     EVT_LIST_COL_RIGHT_CLICK(-1, WxTreeView::OnColClick)
1309         
1310     EVT_LIST_COL_CLICK(-1, WxTreeView::OnColClick)
1311
1312         //EVT_LEFT_DOWN(WxTreeView::OnMouseClick)
1313         /*
1314     EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnColBeginDrag)
1315     EVT_LIST_COL_DRAGGING(LIST_CTRL, MyListCtrl::OnColDragging)
1316     EVT_LIST_COL_END_DRAG(LIST_CTRL, MyListCtrl::OnColEndDrag)
1317
1318     EVT_LIST_CACHE_HINT(LIST_CTRL, MyListCtrl::OnCacheHint)
1319
1320 #if USE_CONTEXT_MENU
1321     EVT_CONTEXT_MENU(MyListCtrl::OnContextMenu)
1322 #endif
1323     EVT_CHAR(MyListCtrl::OnChar)
1324
1325     EVT_RIGHT_DOWN(MyListCtrl::OnRightClick)
1326   */
1327 END_EVENT_TABLE()
1328   
1329 } // EO namespace creaImageIO
1330