]> Creatis software - creaImageIO.git/commitdiff
Added validation on frame exit
authorcaballero <caballero>
Tue, 10 Mar 2009 15:46:24 +0000 (15:46 +0000)
committercaballero <caballero>
Tue, 10 Mar 2009 15:46:24 +0000 (15:46 +0000)
appli/TestWxGimmickReaderDialog/main.cxx
src2/creaImageIOWxGimmickReaderDialog.h
src2/creaImageIOWxGimmickView.cpp
src2/creaImageIOWxGimmickView.h
src2/creaImageIOWxTreeView.cpp
src2/creaImageIOWxTreeView.h

index 5d4a3356fb5074e1764c8b9667a745a7a1c67d38..105f796c54bbcede631af2f569de6dcdad161d80 100644 (file)
@@ -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' $$$$"<<std::endl;
      }
    else 
      {
+                w.OnExit();
         std::cout << "$$$$ main : dialog ended without return code ! $$$$"
                  <<std::endl;
       
index 38341c5fd59ffba37f5338b6df882c13e2dd1f22..dbd874cf2751484dc8cccc925ac1f9a007996a5d 100644 (file)
@@ -50,6 +50,7 @@ namespace creaImageIO
     void OnContextualMenu(EventType& event);
     void OnMenuTest(wxCommandEvent& event);
        void OnValid(bool valid);
+       void OnExit(){mView->StopPlayer();}
     //    void OnButtonOk(wxCommandEvent& event);
     //    void OnButtonCancel(wxCommandEvent& event);  
        
index 2bd904bbf15977a0a863083221aa0aacc1b1c535..4da4ccc9da2f81e2d2010d4c82af5793ea0d25f7 100644 (file)
@@ -220,7 +220,6 @@ namespace creaImageIO
        int level=GetTreeViewMap()["Local database"]->GetNumberOfLevels();
        std::vector<tree::Node*> 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)
index 6a4f5b69776a8c562d13dd64dfe6e1e98c675009..077c83b3634e5995a427a172564035ad03641c3e 100644 (file)
@@ -46,7 +46,8 @@ namespace creaImageIO
       /// Callback called when a selection from a TreeView has changed 
       //(overloaded from GimmickView)
       void OnSelectionChange(std::vector<tree::Node*>& s);
-
+         ///Stops the player
+         void StopPlayer(){mViewer->StopPlayer();}
 
 
       ///Sends a request to read the currently selected node and the ones that surround it.
index 64d395af23c38bf60c4ee69bf5a3c75c9755f1d1..4aca9f841bb524e9657ded94c9797e43875cb9df 100644 (file)
@@ -298,6 +298,9 @@ namespace creaImageIO
                            <<"'"<<level
                            <<std::endl);
        int _id=0;
+       int r=100;
+       int g=100;
+       int b=100;
        //Adds columns
        GetTreeHandler()->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);
index 60956fba2bfe28fdd4e6e2038dfc8bc3230a0363..e316b47da0a33ff50fd6f551fb48848d2fed4170 100644 (file)
@@ -82,8 +82,12 @@ namespace creaImageIO
          bool mDirection;
          ///The last selected item on the list
          long mLastSelected;
-
+         ///The last selection of nodes
          std::vector<tree::Node*> mSelected;
+         ///The color map
+         typedef std::map<tree::Node*,wxColour> ColorMap;
+         typedef std::pair<tree::Node*,wxColour> NodeColorPair;
+      ColorMap mColorMap;