From 45e8123561479c77ffffbcd3a6453f9dd4d12169 Mon Sep 17 00:00:00 2001 From: caballero Date: Tue, 10 Mar 2009 15:46:24 +0000 Subject: [PATCH] Added validation on frame exit --- appli/TestWxGimmickReaderDialog/main.cxx | 3 +++ src2/creaImageIOWxGimmickReaderDialog.h | 1 + src2/creaImageIOWxGimmickView.cpp | 1 - src2/creaImageIOWxGimmickView.h | 3 ++- src2/creaImageIOWxTreeView.cpp | 27 ++++++++++++++++++++++-- src2/creaImageIOWxTreeView.h | 6 +++++- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/appli/TestWxGimmickReaderDialog/main.cxx b/appli/TestWxGimmickReaderDialog/main.cxx index 5d4a335..105f796 100644 --- a/appli/TestWxGimmickReaderDialog/main.cxx +++ b/appli/TestWxGimmickReaderDialog/main.cxx @@ -65,14 +65,17 @@ bool myApp::OnInit( ) crea::VtkBasicSlicer(images.front()); images.front()->Delete(); + w.OnExit(); } else if (w.GetReturnCode() == wxID_CANCEL) { + w.OnExit(); std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<StopPlayer();} // void OnButtonOk(wxCommandEvent& event); // void OnButtonCancel(wxCommandEvent& event); diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp index 2bd904b..4da4ccc 100644 --- a/src2/creaImageIOWxGimmickView.cpp +++ b/src2/creaImageIOWxGimmickView.cpp @@ -220,7 +220,6 @@ namespace creaImageIO int level=GetTreeViewMap()["Local database"]->GetNumberOfLevels(); std::vector im=GetTreeViewMap()["Local database"]->GetSelected(level+1); ReadImagesNotThreaded(s,im,dim); - mViewer->StopPlayer(); } //====================================================================== /// Returns the selected Images so that they comply with the given parameter(4D) diff --git a/src2/creaImageIOWxGimmickView.h b/src2/creaImageIOWxGimmickView.h index 6a4f5b6..077c83b 100644 --- a/src2/creaImageIOWxGimmickView.h +++ b/src2/creaImageIOWxGimmickView.h @@ -46,7 +46,8 @@ namespace creaImageIO /// Callback called when a selection from a TreeView has changed //(overloaded from GimmickView) void OnSelectionChange(std::vector& s); - + ///Stops the player + void StopPlayer(){mViewer->StopPlayer();} ///Sends a request to read the currently selected node and the ones that surround it. diff --git a/src2/creaImageIOWxTreeView.cpp b/src2/creaImageIOWxTreeView.cpp index 64d395a..4aca9f8 100644 --- a/src2/creaImageIOWxTreeView.cpp +++ b/src2/creaImageIOWxTreeView.cpp @@ -298,6 +298,9 @@ namespace creaImageIO <<"'"<LoadChildren(*i,1); tree::Node::ChildrenListType::reverse_iterator j; @@ -334,10 +337,30 @@ namespace creaImageIO item.SetText( crea::std2wx(s)); // item.SetTextColour(*wxRED); - // item.SetBackgroundColour(*wxBLACK); + + //Setting the color according to the parent + /* + if(l==0) + { + item.SetBackgroundColour(wxColour(r,g,b)); + mColorMap.insert(NodeColorPair(*j,wxColour(r,g,b))); + } + else if(l!=mLevelList.size()-1) + { + item.SetBackgroundColour(mColorMap[*i]); + mColorMap.insert(NodeColorPair(*j,mColorMap[*i])); + } + else + { + item.SetBackgroundColour(mColorMap[*i]); + } + r+=20; + g+=20; + b+=20;*/ + item.SetColumn(0); - //Sets the last level as selecte....How to make it select only the first time? + //Sets the last level as selected....How to make it select only the first time? //if (level==mLevelList.size()) item.SetState(wxLIST_STATE_SELECTED); GetCtrl(l)->SetItem(item); diff --git a/src2/creaImageIOWxTreeView.h b/src2/creaImageIOWxTreeView.h index 60956fb..e316b47 100644 --- a/src2/creaImageIOWxTreeView.h +++ b/src2/creaImageIOWxTreeView.h @@ -82,8 +82,12 @@ namespace creaImageIO bool mDirection; ///The last selected item on the list long mLastSelected; - + ///The last selection of nodes std::vector mSelected; + ///The color map + typedef std::map ColorMap; + typedef std::pair NodeColorPair; + ColorMap mColorMap; -- 2.45.1