X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOWxGimmickReaderDialog.cpp;h=bdf1f6687c34e65ccc308f1042d2e6eb7a652c81;hb=75a36cc2a5936be131f570520d4cc2f74bd0c548;hp=b04c27e9b36eb191825baa2a8f34bd0587d334a5;hpb=10480b68ab85e5e7a4ddcf56ebfc83f5870061b5;p=creaImageIO.git diff --git a/src2/creaImageIOWxGimmickReaderDialog.cpp b/src2/creaImageIOWxGimmickReaderDialog.cpp index b04c27e..bdf1f66 100644 --- a/src2/creaImageIOWxGimmickReaderDialog.cpp +++ b/src2/creaImageIOWxGimmickReaderDialog.cpp @@ -1,16 +1,27 @@ #include #include +#include +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +#ifdef _RELWITHDEBINFO +#define new DEBUG_NEW +#endif namespace creaImageIO { // CTor WxGimmickReaderDialog::WxGimmickReaderDialog(wxWindow *parent, wxWindowID id, + const std::string i_namedescp, + const std::string i_namedb, wxString title, const wxPoint& pos, const wxSize& size, int min_dim, - int max_dim, + int max_dim, + int output_dim, // never used ?!? // JPR int threads) : wxDialog( parent, id, @@ -18,25 +29,24 @@ namespace creaImageIO pos, size, wxRESIZE_BORDER | - wxSYSTEM_MENU | - wxCLOSE_BOX | - wxMAXIMIZE_BOX | - wxMINIMIZE_BOX | + wxSYSTEM_MENU | + wxCLOSE_BOX | + wxMAXIMIZE_BOX | + wxMINIMIZE_BOX | wxCAPTION ), - mGimmick(0), + // mGimmick(0), mView(0) { GimmickDebugMessage(1,"WxGimmickReaderDialog::WxGimmickReaderDialog" <Initialize(); - - + + mGimmick = boost::shared_ptr(new Gimmick()); + mGimmick->Initialize(i_namedescp,i_namedb); + mView = new WxGimmickView(mGimmick, this, TVID, @@ -46,6 +56,9 @@ namespace creaImageIO max_dim, threads); mView->Initialize(); + // Connect the AddProgress callback + mView->ConnectValidationObserver + ( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) ); } catch (crea::Exception e) { @@ -55,15 +68,20 @@ namespace creaImageIO topsizer->Add( mView,1,wxGROW,0); - wxSizer* bsizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); - mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); - mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); - + wxSizer* bsizer = this->CreateSeparatedButtonSizer(wxOK|wxCANCEL); + /*mOkButton = new wxButton(this, wxID_OK, _T("OK"), wxPoint(170,50)); + mCancelButton = new wxButton(this, wxID_CANCEL, _T("CANCEL"), wxPoint(210,50)); + */ mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); + mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); + mOkButton->Enable(false); - topsizer->Add ( bsizer, 0, wxGROW ); +topsizer->Add(mOkButton, 0, wxGROW); +topsizer->Add(mCancelButton, 0, wxGROW); + topsizer->Add ( bsizer, 0, wxGROW ); SetSizer( topsizer ); + Layout(); } @@ -74,33 +92,24 @@ namespace creaImageIO <Finalize(); - delete mGimmick; + mGimmick->Finalize(); } } ///Callback method on a selection - void WxGimmickReaderDialog::OnValid(wxCommandEvent& event) + void WxGimmickReaderDialog::OnValid(bool t) { - if (event.GetInt()==0) - {mOkButton->Enable(true);} - else - {mOkButton->Enable(false);} + mOkButton->Enable(t); } - - //================================================================ - BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog) - EVT_COMMAND(wxID_ANY, 0, WxGimmickReaderDialog::OnValid) - END_EVENT_TABLE() + //BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog) + //END_EVENT_TABLE() //================================================================ - } // EO namespace creaImageIO -