]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxGimmickView.cpp
bug correction : no spaces in descriptor files
[creaImageIO.git] / src2 / creaImageIOWxGimmickView.cpp
index 70c845c9a611c0442fbc666812734b1b5c3301da..024bc8c19589838b05252260ae162b0cb466aa01 100644 (file)
@@ -220,7 +220,7 @@ namespace creaImageIO
 
     // Add Notebook page
     mNotebook->AddPage( view, crea::std2wx(name) );
-
+       
   }
 
   //======================================================================
@@ -325,11 +325,11 @@ namespace creaImageIO
                               wxPD_CAN_ABORT );
 
        // TO DO : select the current tree handler
-       mGimmick->AddFiles("Local database",filenames);
+       mGimmick->AddFiles(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),filenames);
 
        mProgressDialog->Pulse(_T("Updating view..."));
 
-       UpdateTreeViewLevel("Local database",1);
+       UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
        delete mProgressDialog;
        DisplayAddSummary();    
 
@@ -342,6 +342,7 @@ namespace creaImageIO
   void WxGimmickView::OnAddDir(wxCommandEvent& event)
   {
     mViewer->StopPlayer();
+       std::string name = crea::wx2std(mNotebook->GetCurrentPage()->GetName());
     long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
     wxDirDialog* FD = 
       new wxDirDialog( 0, 
@@ -375,13 +376,10 @@ namespace creaImageIO
                                        wxPD_CAN_ABORT );
                
                mCurrentDirectory = FD->GetPath();  
-               
-               // TO DO : select the current tree handler
-               mGimmick->AddDir("Local database",dirname,recurse);
-               
+               mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),dirname,recurse);
                mProgressDialog->Pulse(_T("Updating view..."));
                
-               UpdateTreeViewLevel("Local database",1);
+               UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
                delete mProgressDialog;
                DisplayAddSummary();
 
@@ -639,6 +637,11 @@ namespace creaImageIO
     wxMessageBox(std2wx(mess.str()),_T("Addition result"),wxOK,this);
   }
 
+  //////////////////////////////////////////////////
+  // Add a DB to application                                     //
+  // @param event : WxEvent                                              //
+  // @return : -                                                                 //
+  //////////////////////////////////////////////////
   void WxGimmickView::OnAddDB(wxCommandEvent& event)
   {
     
@@ -658,10 +661,14 @@ namespace creaImageIO
                wxBusyCursor busy;
                wxArrayString files;
                FD->GetPaths(files);
+               std::stringstream st;
                for(int i = 0; i< files.size(); i++)
                {
-               //      gimmick->addDB("remote_" + i.c_str(),files[i]);
-               //      AddTreeHandler(gimmick->getTreeHandlerMap("remote_" + i.c_str()));
+                       st<< "remote_" << i+1;
+                       //create TreeHandler
+                       mGimmick->addDB(st.str(), crea::wx2std(files[i]));
+                       //create TreeView
+                       CreateSingleTreeView(st.str());
                }
        }