]> Creatis software - creaImageIO.git/commitdiff
*** empty log message ***
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 1 Jun 2010 14:37:57 +0000 (14:37 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 1 Jun 2010 14:37:57 +0000 (14:37 +0000)
bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml
src/creaImageIOWxSimpleDlg.cpp
src/creaImageIOWxSimpleDlg.h

index d6c28ced88f2b6d443ea49e99adcdf1f34341982..615d90e89e45f7ba9d69391f3c17742a1f89c19a 100644 (file)
@@ -30,7 +30,7 @@
 
   <process>
     <PRE>
-      creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()));
+      creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database");
       dlg.ShowModal();
       bbSetOutputOut( dlg.getImagesSelected());
     </PRE>
index 5bc3cd7a38195423fc05319efbdc84d1a2d127b9..0abba6ab59d1e3d959446dc413768ed230d231b5 100644 (file)
@@ -5,9 +5,15 @@ namespace creaImageIO
 {
 
        ///Ctor
-   WxSimpleDlg::WxSimpleDlg(wxWindow *parent, wxString i_title)
+   WxSimpleDlg::WxSimpleDlg(wxWindow *parent, 
+                                                       wxString i_title,  
+                                                       const std::string i_namedescp , 
+                                                       const std::string i_namedb)
     : wxDialog(parent, -1,_T("DISPLAY IMAGES"), wxDefaultPosition, wxSize(230,150))
    {
+               namedescp       = i_namedescp; 
+               namedb          = i_namedb;
+
           if(!i_title.empty())
           {
                        this->SetTitle(i_title);  
@@ -34,12 +40,14 @@ namespace creaImageIO
 //////////////////////////////////////////////////////////////////////
          void WxSimpleDlg::OnReadFile(wxCommandEvent& event)
          {
-                 wxFileDialog* FD = new wxFileDialog( 0,  _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
+                 int resultShowModal;
+                 wxFileDialog* fileDlg = new wxFileDialog( 0,  _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
     
-                       if (FD->ShowModal()==wxID_OK)
+                   resultShowModal = fileDlg->ShowModal();
+                       if ( resultShowModal==wxID_OK )
                        {
                                wxArrayString wxArray;
-                               FD->GetPaths(wxArray);
+                               fileDlg->GetPaths(wxArray);
                                if(wxArray.size() >0)
                                {
                                        std::vector<std::string> files;
@@ -57,7 +65,9 @@ namespace creaImageIO
                                        // TO DO WARNING MESSAGES
                                }
                        }
-                 Close();
+                 SetReturnCode( resultShowModal );
+//              Close();
+                EndModal( resultShowModal );
          }
 
  //////////////////////////////////////////////////////////////////////
@@ -66,17 +76,21 @@ namespace creaImageIO
 
          void WxSimpleDlg::OnReadDirectory(wxCommandEvent &event)
          {
+                 int resultShowModal;
             long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
-                wxDirDialog* FD = new wxDirDialog( 0, _T("Select the directory to display"), _T(""), style);
+                wxDirDialog* dirDlg = new wxDirDialog( 0, _T("Select the directory to display"), _T(""), style);
                 
-                if (FD->ShowModal()==wxID_OK)
+                resultShowModal = dirDlg->ShowModal();
+                if ( resultShowModal==wxID_OK )
                 {  
-                       if(! m_view.readDirectory(crea::wx2std(FD->GetPath()),m_results))
+                       if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()),m_results))
                        {
                                //TO DO WARNING MESSAGE;
                        }
                 }
-                Close();
+                SetReturnCode( resultShowModal );
+//              Close();
+                EndModal( resultShowModal );
          }
 
          //////////////////////////////////////////////////////////////////////
@@ -86,8 +100,10 @@ namespace creaImageIO
          void WxSimpleDlg::OnReadGimmick(wxCommandEvent &event)
          {
                  // Run Gimmick
-                  WxGimmickReaderDialog dlg(0,-1, "localdatabase_Descriptor.dscp",
-                                  "Local Database", _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
+                  WxGimmickReaderDialog dlg(0,-1, 
+                                  namedescp,
+                                  namedb, 
+                                  _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
                    wxDefaultPosition,
                    wxSize(810,750),
                    GIMMICK_2D_IMAGE_SELECTION,
@@ -100,7 +116,9 @@ namespace creaImageIO
                        dlg.GetSelectedImages(m_results,3);
                        dlg.OnExit();
                 }
-                Close();
+                SetReturnCode( dlg.GetReturnCode() );
+//              Close();
+                EndModal( dlg.GetReturnCode() );
           }
 
  //////////////////////////////////////////////////////////////////////
index 00693dae7093e8e02744190627fad5f30eb4fc06..617b87f9b7eda44c956de9345ea47d64632da7c1 100644 (file)
@@ -12,7 +12,11 @@ namespace creaImageIO
        {
        public:
                 /// Ctor
-                 WxSimpleDlg( wxWindow *parent,  wxString i_title =_T(""));
+                 WxSimpleDlg( wxWindow *parent,  
+                         wxString i_title =_T(""),
+                         const std::string i_namedescp = "localdatabase_Descriptor.dscp",   
+                         const std::string i_namedb   = "Local Database"     
+                         );
                  ///Dtor
                  ~WxSimpleDlg(){};
 
@@ -30,6 +34,9 @@ namespace creaImageIO
 
        private:
 
+               std::string namedescp; 
+               std::string namedb;
+
                /// interface to read data
                SimpleView m_view;