From 221eac2eca0a97f01f3649e04d97e22b4c48e983 Mon Sep 17 00:00:00 2001 From: guigues Date: Fri, 17 Oct 2008 08:22:58 +0000 Subject: [PATCH] *** empty log message *** --- src/creaImageIOWxGimmick.cpp | 76 +++++-------- src/creaImageIOWxGimmick.h | 10 ++ src/creaImageIOWxGimmickSettings.cpp | 155 +++++++++++++++++++++++++++ src/creaImageIOWxGimmickSettings.h | 28 +++++ 4 files changed, 219 insertions(+), 50 deletions(-) diff --git a/src/creaImageIOWxGimmick.cpp b/src/creaImageIOWxGimmick.cpp index e58ec0e..026acf6 100644 --- a/src/creaImageIOWxGimmick.cpp +++ b/src/creaImageIOWxGimmick.cpp @@ -19,7 +19,8 @@ #include #include -#include +#include +//#include using namespace crea; @@ -209,18 +210,6 @@ namespace creaImageIO - //================================================================ - class WxGimmickSettingsDialog : public wxDialog - { - public: - WxGimmickSettingsDialog(wxWindow *parent); - ~WxGimmickSettingsDialog(); - - - }; - //================================================================ - - @@ -411,6 +400,7 @@ namespace creaImageIO ShowImage(mReader.GetImage("")); + mJustStarted = true; } //================================================================ @@ -1434,7 +1424,7 @@ namespace creaImageIO // Pop up menu callbacks void WxGimmick::OnPopUpAbout(wxCommandEvent& event) { - wxMessageBox( _T("Give me my medical images quick ! \n\n (c) CREATIS-LRMN 2008\n"), + wxMessageBox( _T("Give me my medical images quick ! \n\n (c) CREATIS-LRMN 2008\n laurent.guigues@creatis.insa-lyon.fr"), _T("Gimmick!"), wxOK | wxICON_INFORMATION, this); } @@ -2149,6 +2139,16 @@ namespace creaImageIO void WxGimmick::OnInternalIdle() { ProcessImageEvents(); + if (mJustStarted) + { + // Show tip if no collection + if (GetDicomDatabaseList().size()==0) + { + ShowHelp(); + } + mJustStarted = false; + } + // } //================================================================ @@ -2754,10 +2754,17 @@ namespace creaImageIO } - - - - + //==================================================================== + void WxGimmick::ShowHelp() + { + if (mHelpWindow==0) + { + mHelpWindow = new WxGimmickHelpWindow(this); + } + mHelpWindow->CenterOnParent(); + mHelpWindow->ShowModal(); + } + //==================================================================== @@ -2939,38 +2946,7 @@ namespace creaImageIO - //================================================================ - //================================================================ - //================================================================ - //================================================================ - - //================================================================ - WxGimmickSettingsDialog::WxGimmickSettingsDialog(wxWindow *parent) - : - wxDialog( parent, - -1, - _T("Settings"), - wxDefaultPosition, - wxSize(400,400), - wxRESIZE_BORDER | - wxSYSTEM_MENU | - wxCLOSE_BOX | - wxMAXIMIZE_BOX | - wxMINIMIZE_BOX | - wxCAPTION - ) - { - } - //================================================================ - - //================================================================ - WxGimmickSettingsDialog::~WxGimmickSettingsDialog() - { - } - //================================================================ - - - + diff --git a/src/creaImageIOWxGimmick.h b/src/creaImageIOWxGimmick.h index cd0b919..aceaa5e 100644 --- a/src/creaImageIOWxGimmick.h +++ b/src/creaImageIOWxGimmick.h @@ -105,6 +105,8 @@ namespace creaImageIO void LoadChildren( wxTreeItemId& id ); friend class WxGimmickEvent; + void ShowHelp(); + private: WxGimmick() { } @@ -132,8 +134,16 @@ namespace creaImageIO const std::string& GetDatabaseExtension() { return mDatabaseExtension; } void SetDatabaseExtension(const std::string& ext) { mDatabaseExtension = ext; } + + + /// Settings Settings mSettings; + + // Help + WxGimmickHelpWindow* mHelpWindow; + bool mJustStarted; + int mFirstDicomDatabaseIconIndex; // Id of the item which activated the popup menu wxTreeItemId mItemOfMenu; diff --git a/src/creaImageIOWxGimmickSettings.cpp b/src/creaImageIOWxGimmickSettings.cpp index 2b04431..da191a3 100644 --- a/src/creaImageIOWxGimmickSettings.cpp +++ b/src/creaImageIOWxGimmickSettings.cpp @@ -179,4 +179,159 @@ namespace creaImageIO return n; } //==================================================================== + + + + //================================================================ + //================================================================ + //================================================================ + //================================================================ + + //================================================================ + WxGimmickSettingsDialog::WxGimmickSettingsDialog(wxWindow *parent) + : + wxDialog( parent, + -1, + _T("Settings"), + wxDefaultPosition, + wxSize(400,400), + wxRESIZE_BORDER | + wxSYSTEM_MENU | + wxCLOSE_BOX | + wxMAXIMIZE_BOX | + wxMINIMIZE_BOX | + wxCAPTION + ) + { + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + wxSizer* bsizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); + mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); + mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); + + sizer->Add ( bsizer, 0, wxGROW ); + + SetSizer( sizer ); + Layout(); + } + //================================================================ + + //================================================================ + WxGimmickSettingsDialog::~WxGimmickSettingsDialog() + { + } + //================================================================ + + + //================================================================ + //================================================================ + //================================================================ + //================================================================ + + //================================================================ + WxGimmickHelpWindow::WxGimmickHelpWindow(wxWindow *parent) + : + wxDialog( parent, + -1, + _T("Gimmick! Help"), + wxDefaultPosition, + wxSize(600,500), + + + //wxDEFAULT_FRAME_STYLE | + //wxFRAME_FLOAT_ON_PARENT + + + wxBORDER_SIMPLE + // wxRESIZE_BORDER | + //wxSYSTEM_MENU | + //wxCLOSE_BOX | + // wxMAXIMIZE_BOX | + //wxMINIMIZE_BOX | + //wxCAPTION + + + ) + { + SetBackgroundColour(*wxBLUE); + + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + mText = new wxTextCtrl(this, + -1, //ID_InputText, + _T(""), + wxDefaultPosition, + wxDefaultSize, + wxTE_READONLY | + wxTE_MULTILINE + // |wxTE_PROCESS_ENTER + //| wxTE_PROCESS_TAB + // | wxWANTS_CHARS + // | wxTAB_TRAVERSAL + ); + + wxFont* FixedFont = new wxFont(10, + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL, + false); + + wxTextAttr mwxInputTextAttr; + mwxInputTextAttr.SetFont(*FixedFont); + mwxInputTextAttr.SetBackgroundColour(*wxBLUE); + mwxInputTextAttr.SetTextColour(*wxWHITE); + mText->SetDefaultStyle(mwxInputTextAttr); + mText->SetBackgroundColour(*wxBLUE); + + std::string tip("\n"); + tip += " Welcome to Gimmick !\n\n"; + tip += " ( Give me my medical images quick ! )\n\n\n"; + tip += " You do not have any image collection yet\n\n"; + tip += " To create one :\n"; + tip += " 1) Right click on 'Collection'\n"; + tip += " 2) Select 'New collection'\n"; + tip += " 3) Enter the collection file name and the collection name\n\n"; + tip += " To add images to your collection :\n"; + tip += " 1) Right click on your collection\n"; + tip += " 2) Select 'Add image(s) to collection'\n"; + tip += " 3) Select 'Scan Directory' to add all images of a directory or\n"; + tip += " Select 'Select File(s)' to add only some selected images\n"; + tip += " 4) Select the directory or the files to add\n"; + tip += "\n\n"; + tip += " Remember then that *ALL* actions in Gimmick! are accessible\n"; + tip += " by right clicking on the elements of the view\n"; + tip += "\n"; + tip += " Enjoy!\n"; + + mText->AppendText(tip); + + + sizer->Add(mText,1,wxGROW); + + + wxSizer* bsizer = CreateSeparatedButtonSizer(wxOK); + mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); + + sizer->Add ( bsizer, 0, wxGROW ); + + + SetSizer(sizer); + SetAutoLayout(true); + Layout(); + + + + } + //================================================================ + + //================================================================ + WxGimmickHelpWindow::~WxGimmickHelpWindow() + { + } + //================================================================ + + + + + } diff --git a/src/creaImageIOWxGimmickSettings.h b/src/creaImageIOWxGimmickSettings.h index 957bdf6..0fd2165 100644 --- a/src/creaImageIOWxGimmickSettings.h +++ b/src/creaImageIOWxGimmickSettings.h @@ -81,6 +81,34 @@ namespace creaImageIO //================================================================ + + //================================================================ + class WxGimmickSettingsDialog : public wxDialog + { + public: + WxGimmickSettingsDialog(wxWindow *parent); + ~WxGimmickSettingsDialog(); + + wxButton* mOkButton; + wxButton* mCancelButton; + + }; + //================================================================ + + + //================================================================ + class WxGimmickHelpWindow : public wxDialog + { + public: + WxGimmickHelpWindow(wxWindow *parent); + ~WxGimmickHelpWindow(); + + wxTextCtrl* mText; + wxButton* mOkButton; + }; + //================================================================ + + } // namespace creaImageIO -- 2.45.1