]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxAttributeSelectionPanel.cpp
move directory
[creaImageIO.git] / src2 / creaImageIOWxAttributeSelectionPanel.cpp
index 113dcfe2897c291e50b955fc708856644d55320a..87203d10638de5df9bc8a836809c84614950e743 100644 (file)
@@ -1,6 +1,7 @@
 #include <creaImageIOWxAttributeSelectionPanel.h>
 #include <creaImageIOSystem.h>
 
+
 namespace creaImageIO
 {
        const int  ID_COMBO             = 180;
@@ -34,13 +35,13 @@ namespace creaImageIO
        for(int i=1;i<=numLev;i++)
        {
                out<<i;
-               as.Add(out.str());
+               as.Add(crea::std2wx(out.str()));
                out.str("");
        }
-       levels=new wxComboBox(this, ID_COMBO,"1",wxPoint(190, 5),wxDefaultSize,as);
+       levels=new wxComboBox(this, ID_COMBO,_T("1"),wxPoint(190, 5),wxDefaultSize,as);
        wxStaticText * na=new wxStaticText(this,-1,_T(" Currently hidden attributes: "), wxPoint(255,10));
 
-    shownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(5,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL );
+    shownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(5,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
 
        shownAtts->InsertColumn(0, 
                                   crea::std2wx(""),
@@ -54,7 +55,7 @@ namespace creaImageIO
        wxButton *remove = new wxButton(this,wxID_ANY,_T("<<"), wxPoint(170,70) );
        Connect( remove->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnRemove ); 
        
-       notShownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(255,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL );
+       notShownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(255,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
 
        notShownAtts->InsertColumn(0, 
                                   crea::std2wx(""),
@@ -78,11 +79,9 @@ namespace creaImageIO
 
   void WxAttributeSelectionPanel::OnSaveConfig(wxCommandEvent& event)
   {
-         /*mView->OnSaveSettingsCallback(crea::wx2std(copyPath->GetValue()),
-                 crea::wx2std(dbPath->GetValue()),
-                 crea::wx2std(syncEvent->GetValue()),
-                 crea::wx2std(syncFrequency->GetValue()));
-         */
+         int n=levels->GetSelection();
+         if(n<0){n=0;}
+         mView->OnAttributesChanged(notShownA,n);
          dialog->Destroy();
   }
 
@@ -92,12 +91,12 @@ namespace creaImageIO
        for ( ;; )
        {
                item = shownAtts->GetNextItem(item,
-                                                                               wxLIST_NEXT_ALL,
-                                                                               wxLIST_STATE_SELECTED);
+                       wxLIST_NEXT_ALL,
+                       wxLIST_STATE_SELECTED);
                if ( item == -1 )
                        break;
        
-                       std::string change=shownAtts->GetItemText(item);
+                       std::string change = crea::wx2std(shownAtts->GetItemText(item));
                        std::vector<std::string>::iterator it;
                        bool found=false;
                        for(it=shownA.begin();it!=shownA.end()&&!found;++it)
@@ -109,9 +108,8 @@ namespace creaImageIO
                        }
                        shownA.erase(it-1);
                        notShownA.push_back(change);
-                       LoadCtrls();    
-               
        }
+       LoadCtrls();
        
   }
 
@@ -122,12 +120,12 @@ namespace creaImageIO
        for ( ;; )
        {
                item = notShownAtts->GetNextItem(item,
-                                                                               wxLIST_NEXT_ALL,
-                                                                               wxLIST_STATE_SELECTED);
+                       wxLIST_NEXT_ALL,
+                       wxLIST_STATE_SELECTED);
                if ( item == -1 )
                        break;
        
-                       std::string change=notShownAtts->GetItemText(item);
+                       std::string change = crea::wx2std(notShownAtts->GetItemText(item));
                        std::vector<std::string>::iterator it;
                        bool found=false;
                        for(it=notShownA.begin();it!=notShownA.end()&&!found;++it)
@@ -139,9 +137,9 @@ namespace creaImageIO
                        }
                        notShownA.erase(it-1);
                        shownA.push_back(change);
-                       LoadCtrls();    
                
        }
+       LoadCtrls();    
          
   }