From 973bf3496911c8efc97cbfc2090b477a88eceba7 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Tue, 1 Jun 2010 14:37:57 +0000 Subject: [PATCH] *** empty log message *** --- .../bbcreaImageIOImagesChooserDialogBox.xml | 2 +- src/creaImageIOWxSimpleDlg.cpp | 42 +++++++++++++------ src/creaImageIOWxSimpleDlg.h | 9 +++- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml index d6c28ce..615d90e 100644 --- a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml +++ b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml @@ -30,7 +30,7 @@
-      creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()));
+      creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database");
       dlg.ShowModal();
       bbSetOutputOut( dlg.getImagesSelected());
     
diff --git a/src/creaImageIOWxSimpleDlg.cpp b/src/creaImageIOWxSimpleDlg.cpp index 5bc3cd7..0abba6a 100644 --- a/src/creaImageIOWxSimpleDlg.cpp +++ b/src/creaImageIOWxSimpleDlg.cpp @@ -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 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() ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/creaImageIOWxSimpleDlg.h b/src/creaImageIOWxSimpleDlg.h index 00693da..617b87f 100644 --- a/src/creaImageIOWxSimpleDlg.h +++ b/src/creaImageIOWxSimpleDlg.h @@ -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; -- 2.47.1