00001 #ifndef __creaImageIOWxGimmickView_h_INCLUDED__
00002 #define __creaImageIOWxGimmickView_h_INCLUDED__
00003
00004 #ifdef USE_WXWIDGETS
00005
00006 #include <creaImageIOGimmickView.h>
00007 #include <creaImageIOWxViewer.h>
00008 #include <creaImageIOWxGimmickTools.h>
00009 #include <creaImageIOListener.h>
00010 #include <creaWx.h>
00011 #include "wx/wx.h"
00012 #include <wx/splitter.h>
00013 #include <wx/toolbar.h>
00014 #include <wx/tbarbase.h>
00015 #include <wx/notebook.h>
00016
00017 namespace creaImageIO
00018 {
00022
00023
00024
00026
00027 class WxGimmickView : public wxPanel, virtual public GimmickView
00028 {
00029 public:
00030
00031 typedef int EventType;
00032
00034 WxGimmickView(Gimmick*,
00035 wxWindow *parent,
00036 const wxWindowID id,
00037 const wxPoint& pos, const wxSize& size,
00038 int min_dim = GIMMICK_2D_IMAGE_SELECTION,
00039 int max_dim = GIMMICK_3D_IMAGE_SELECTION,
00040 int number_of_threads = 0);
00042 virtual ~WxGimmickView();
00043
00046 void GetSelectedFiles(std::vector<std::string>& s);
00047
00050 void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
00051
00054
00055 void GetImages(int dim, const std::vector<std::string>& files,
00056 std::vector<vtkImageData*>& s);
00057
00059
00060 void OnSelectionChange(const std::vector<tree::Node*>& s,
00061 bool isSelection, int selection, bool mProcess);
00063 void StopPlayer(){mViewer->StopPlayer();}
00065 void AddIgnoreFile(tree::Node* toRemove);
00067 void ClearSelection();
00069 void CopyFiles(const std::vector<std::string>& filenames);
00071 void AddDir(std::string dirName);
00072
00073
00075 void ReadImageThreaded(const std::vector<tree::Node*>& sel);
00076
00078 void OnSaveSettingsCallback(const std::string& copyPath,
00079 const std::string& dbPath,
00080 const std::string& syncEvent,
00081 const std::string& syncFreq);
00082
00084 void OnListenerCallback(const std::string& drive, bool addFiles, bool removeFiles);
00085
00087 void OnDriveMount(bool mount);
00088
00090 void StartListeningThread();
00091
00093 void StopListeningThread();
00094
00096 void OnFieldsEdited(tree::Node* node, const std::string& name, const std::string& key, const std::string& val);
00097
00099 void GetVisibleAttributes(std::vector<std::string>& shown,std::vector<std::string>& nShown, int level);
00100
00102 void OnAttributesChanged(const std::vector<std::string>& nShown, int level);
00103
00104 protected:
00106 void CreateToolBar();
00107
00110 void CreateTreeView( TreeHandler* );
00111
00112
00113 private:
00117 bool mConstructed;
00119 wxToolBar* mToolBar;
00120 wxToolBarToolBase* mToolAddFile;
00121 wxToolBarToolBase* mToolAddDir;
00122 wxToolBarToolBase* mToolRemove;
00123 wxToolBarToolBase* mToolAddDatabase;
00124 wxToolBarToolBase* mToolHelp;
00125 wxToolBarToolBase* mToolSynchronize;
00126 wxToolBarToolBase* mToolSettings;
00127 wxToolBarToolBase* mToolTools;
00128
00129 wxSplitterWindow* mSplitter;
00130 wxPanel* mBottomPanel;
00131 wxStaticText * mText;
00132 wxNotebook* mNotebook;
00133
00135 wxImageList * mIcon;
00136 void CreateIconList();
00137
00138 Gimmick * mGimmick;
00139
00140 Listener* mListener;
00142 void OnAddFiles(wxCommandEvent& event);
00144 void OnAddDir(wxCommandEvent& event);
00146 void OnRemove(wxCommandEvent& event);
00148 void OnSynchronize(wxCommandEvent& event);
00150 void OnSettings(wxCommandEvent& event);
00152 void OnTools(wxCommandEvent& event);
00154 void CreateSettingsDialog(wxNotebook* nb, wxDialog* dial);
00155
00157 void DisplayAddSummary();
00158
00160 bool isNeedRecursive(std::string i_name);
00161
00163 void OnAddProgress( Gimmick::AddProgress& );
00165 void OnInternalIdle();
00166
00168 void OnAddDB(wxCommandEvent& event);
00169
00171 void OnCreateDB(wxCommandEvent& event);
00172
00174 void CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys);
00175
00177 wxProgressDialog* mProgressDialog;
00179 int mSelectionMaxDimension;
00181 int mSelectionMinDimension;
00183 WxViewer* mViewer;
00185 tree::Node* mCurImageItemToShow;
00186
00187 std::vector<ImagePointerHolder*> pointers;
00188
00189
00190 wxString mCurrentDirectory;
00191
00192 DECLARE_EVENT_TABLE()
00193 };
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00212
00214
00216
00218
00220
00222
00223
00224
00226
00228
00229
00231
00232
00233
00234
00236
00238
00239
00240
00242
00244
00245
00246
00247
00248
00249
00250
00251
00253
00254
00255
00256
00257
00258
00259
00260
00261
00263
00264
00266
00268
00269
00270
00271
00272
00273
00274
00276
00277
00278
00279
00280
00281
00282
00283
00286
00291
00295
00296
00297
00299
00301
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00316
00318
00319
00321
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 }
00343
00344 #endif // USE_WIDGETS
00345
00346 #endif