]> Creatis software - creaImageIO.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Fri, 17 Oct 2008 08:22:58 +0000 (08:22 +0000)
committerguigues <guigues>
Fri, 17 Oct 2008 08:22:58 +0000 (08:22 +0000)
src/creaImageIOWxGimmick.cpp
src/creaImageIOWxGimmick.h
src/creaImageIOWxGimmickSettings.cpp
src/creaImageIOWxGimmickSettings.h

index e58ec0eab4769cd38068359bb12783b8c245d197..026acf6011bdadd0c3c0281d0d75a5df7df1e1ac 100644 (file)
@@ -19,7 +19,8 @@
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 
-#include<wx/filefn.h>
+#include <wx/filefn.h>
+//#include <wx/tipwin.h>
 
 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()
-               {
-               }
-             //================================================================
-
-    
-
+           
 
 
 
index cd0b919df357426a8e83276268d018096f4e340d..aceaa5e5cb4b4e13fef081119c8a7676e9ad8d6e 100644 (file)
@@ -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;
index 2b04431bf90f95d96a1da40aeec5871f62041afc..da191a37f63d4f05ca7cf36f049afb3997bcd1b3 100644 (file)
@@ -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()
+  {
+  }
+  //================================================================
+
+
+
+
+
 }
index 957bdf6b947168fea1ff33c33bffc6f41f094190..0fd2165f03e8e7cf642dc334e81c8396699134bb 100644 (file)
@@ -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