vtkSlicerApplication.h

Go to the documentation of this file.
00001 #ifndef __vtkSlicerApplication_h
00002 #define __vtkSlicerApplication_h
00003 
00004 #include "vtkSlicerConfigure.h"
00005 
00006 #ifdef Slicer3_USE_QT
00007 // QT includes
00008 #include <QStringList>
00009 #endif
00010 
00011 #include "vtkStringArray.h"
00012 #include "vtkSlicerBaseGUIWin32Header.h"
00013 #include "vtkKWApplication.h"
00014 #include "vtkKWRegistryHelper.h" 
00015 #include "itkMutexLock.h"
00016 
00017 #include "vtkSlicerApplicationGUI.h"
00018 
00019 #ifdef Slicer3_USE_QT
00020 //BTX
00021 class qSlicerApplication;
00022 class qSlicerModulePanel;
00023 //ETX
00024 #endif
00025 
00026 class vtkSlicerModuleGUI;
00027 class vtkSlicerGUILayout;
00028 class vtkSlicerTheme;
00029 class vtkSlicerGUICollection;
00030 //BTX
00031 class DisplayMessageQueue;
00032 //ETX
00033 
00034 
00037 //
00038 class VTK_SLICER_BASE_GUI_EXPORT vtkSlicerApplication : public vtkKWApplication
00039 {
00040  public:
00041     vtkTypeRevisionMacro ( vtkSlicerApplication, vtkKWApplication );
00042 
00049     static vtkSlicerApplication* New();
00050 
00053     static vtkSlicerApplication* GetInstance();
00054 
00057     static vtkSlicerApplication* GetInstance(const char* tmp_dir, const char* config_dir);
00058 
00061     void Init();
00062 
00067     virtual void DoOneTclEvent();
00068 
00071     vtkGetObjectMacro ( DefaultGeometry, vtkSlicerGUILayout );
00072     vtkGetObjectMacro ( SlicerTheme, vtkSlicerTheme );
00073     vtkGetObjectMacro ( ModuleGUICollection, vtkSlicerGUICollection );
00074     vtkGetObjectMacro ( ApplicationGUI, vtkSlicerApplicationGUI );
00075     vtkSetObjectMacro ( ApplicationGUI, vtkSlicerApplicationGUI );
00076 
00079     virtual void AddModuleGUI ( vtkSlicerModuleGUI *gui );
00080     virtual void RemoveModuleGUI ( vtkSlicerModuleGUI *gui );
00081     virtual vtkSlicerModuleGUI* GetModuleGUIByName ( const char *name );
00082 
00085     void SetMRMLScene( vtkMRMLScene* scene);
00086     vtkMRMLScene* GetMRMLScene();
00087 
00088     // Description:
00089     // Display the exit dialog.
00090     // Optionally provide a master window this dialog should be the slave of.
00091     // Return 1 if the user wants to exit, 0 otherwise
00092     virtual int DisplayExitDialog(vtkKWTopLevel *master);
00093 
00094 
00095 #ifdef Slicer3_USE_QT
00098     //BTX
00099     void InitializeQtCoreModules();
00100     //ETX
00101 
00104     //BTX
00105     void InitializeQtLoadableModules();
00106     //ETX
00107 
00110     //BTX
00111     void InitializeQtCommandLineModules();
00112     //ETX
00113 
00116     //BTX
00117     void InitializeQtModules(const QStringList& names);
00118     //ETX
00119 
00122     //BTX
00123     void InitializeQtModule(const QString& moduleName);
00124     //ETX
00125 
00128     //BTX
00129     qSlicerModulePanel* modulePanel();
00130     //ETX
00131 #endif
00132 
00136     //BTX
00137     virtual void RegisterDialogUp(vtkKWWidget *ptr);
00138     virtual void UnRegisterDialogUp(vtkKWWidget *ptr);
00139     //ETX
00140 
00143     virtual void CloseAllWindows ( ) ;
00144 
00147     virtual void ConfigureApplication ( );
00148     virtual int StartApplication ( );
00149 
00152     virtual void InstallTheme ( vtkKWTheme *theme );
00153 
00156   int HasRegistry(const char *key);
00157   void RequestRegistry(const char *key);
00158   const char *GetRegistryHolder();
00159   void SetRegistry(const char *key, char *value);
00160 
00165   virtual void RestoreApplicationSettingsFromRegistry();
00166   virtual void SaveApplicationSettingsToRegistry();
00167   virtual void ConfigureRemoteIOSettingsFromRegistry();
00168   virtual void UpdateRemoteIOSettingsForRegistry();
00175   virtual int FullFileSystemCheck ( );
00176 
00179   //BTX
00180   static const char *ConfirmDeleteRegKey;
00181   static const char *ModulePathsRegKey;
00182   static const char *ColorFilePathsRegKey;
00183   static const char *PotentialModulePathsRegKey;
00184   static const char *PotentialColorFilePathsRegKey;
00185   static const char *ExtensionsInstallPathRegKey;
00186   static const char *TemporaryDirectoryRegKey;
00187   static const char *WebBrowserRegKey;
00188   static const char *UnzipRegKey;
00189   static const char *ZipRegKey;
00190   static const char *RmRegKey;
00191   static const char *HomeModuleRegKey;
00192   static const char *LoadModulesRegKey;
00193   static const char *IgnoreModulesRegKey;
00194   static const char *LoadCommandLineModulesRegKey;
00195   static const char *EnableDaemonRegKey;
00196   static const char *ApplicationFontFamilyRegKey;
00197   static const char *ApplicationFontSizeRegKey;
00198   static const char *ApplicationWindowWidthRegKey;
00199   static const char *ApplicationWindowHeightRegKey;
00200   static const char *ApplicationSlicesFrameHeightRegKey;
00201   static const char *ApplicationLayoutTypeRegKey;
00202   static const char *ApplicationLayoutCompareViewRowsRegKey;
00203   static const char *ApplicationLayoutCompareViewColumnsRegKey;
00204   static const char *ApplicationLayoutLightboxRowsRegKey;
00205   static const char *ApplicationLayoutLightboxColumnsRegKey;
00206   static const char *EnableAsynchronousIORegKey;
00207   static const char *UseWelcomeModuleAtStartupRegKey;
00208   static const char *EnableForceRedownloadRegKey;
00209   static const char *EnableRemoteCacheOverwritingRegKey;
00210   static const char *RemoteCacheDirectoryRegKey;
00211   static const char *RemoteCacheLimitRegKey;
00212   static const char *RemoteCacheFreeBufferSizeRegKey;
00213   //ETX
00214 
00215 
00218   void SetApplicationFontFamily ( const char *family);
00219   const char *GetApplicationFontFamily ( ) const;
00220 
00223   void SetApplicationFontSize ( const char *size );
00224   const char *GetApplicationFontSize ( ) const;
00225 
00228   void SetConfirmDelete(const char* state);
00229   const char* GetConfirmDelete() const;
00230 
00235   void SetModulePaths(const char *paths);
00236   const char* GetModulePaths() const;
00237 
00238 
00254   void SetPotentialModulePaths(const char *paths);
00255   const char* GetPotentialModulePaths() const;
00256 
00260   void AppendPotentialModulePath(const char *path, bool enabled);
00261 
00265   void SetColorFilePaths(const char *paths);
00266   const char *GetColorFilePaths() const;
00267   void SetPotentialColorFilePaths(const char *paths);
00268   const char* GetPotentialColorFilePaths() const;
00269 
00272   void SetExtensionsInstallPath(const char *path);
00273   const char* GetExtensionsInstallPath();
00274 
00277   void SetHomeModule (const char *name);
00278   const char *GetHomeModule() const;
00279 
00282   void SetWebBrowser ( const char *browser);
00283   const char* GetWebBrowser () const;
00284 
00287   void SetUnzip ( const char *unzip );
00288   const char *GetUnzip() const;
00289   void SetZip (const char *zip);
00290   const char *GetZip() const;
00291 
00294   void SetRm ( const char *rm );
00295   const char *GetRm() const;
00296 
00299   void SetTemporaryDirectory(const char *path);
00300   const char* GetTemporaryDirectory() const;
00301 
00304   void SetRemoteCacheDirectory(const char *path);
00305   const char* GetRemoteCacheDirectory() const;
00306 
00309   void SetBinDir(const char* path);
00310   const char* GetBinDir() const;
00311 
00314   const char* GetPluginsDir() const;
00315 
00319   void SetApplicationWindowSize (int width, int height );
00320   vtkGetMacro (ApplicationWindowWidth, int);
00321   vtkSetMacro (ApplicationWindowWidth, int);
00322   vtkGetMacro (ApplicationWindowHeight, int);
00323   vtkSetMacro (ApplicationWindowHeight, int);
00324 
00327   void SaveApplicationWindowConfiguration ( );
00328 
00332   vtkGetMacro (ApplicationSlicesFrameHeight, int );
00333   vtkSetMacro (ApplicationSlicesFrameHeight, int );
00334   vtkGetMacro (ApplicationLayoutType, int );
00335   vtkSetMacro (ApplicationLayoutType, int );
00336   vtkGetMacro (ApplicationLayoutCompareViewRows, int );
00337   vtkSetMacro (ApplicationLayoutCompareViewRows, int );
00338   vtkGetMacro (ApplicationLayoutCompareViewColumns, int );
00339   vtkSetMacro (ApplicationLayoutCompareViewColumns, int );
00340   vtkGetMacro (ApplicationLayoutLightboxRows, int );
00341   vtkSetMacro (ApplicationLayoutLightboxRows, int );
00342   vtkGetMacro (ApplicationLayoutLightboxColumns, int );
00343   vtkSetMacro (ApplicationLayoutLightboxColumns, int );
00344 
00347   vtkSetMacro(LoadModules, int);
00348   vtkGetMacro(LoadModules, int);
00349   vtkBooleanMacro(LoadModules, int);
00350 
00353   vtkSetObjectMacro(IgnoreModules, vtkStringArray);
00354   vtkGetObjectMacro(IgnoreModules, vtkStringArray);
00355 
00358   vtkSetObjectMacro(LoadableModules, vtkStringArray);
00359   vtkGetObjectMacro(LoadableModules, vtkStringArray);
00360 
00361 
00364   vtkSetMacro(LoadCommandLineModules, int);
00365   vtkGetMacro(LoadCommandLineModules, int);
00366   vtkBooleanMacro(LoadCommandLineModules, int);
00367 
00370   vtkSetMacro(EnableDaemon, int);
00371   vtkGetMacro(EnableDaemon, int);
00372   vtkBooleanMacro(EnableDaemon, int);
00373 
00376   void SetEnableAsynchronousIO ( int );
00377   vtkGetMacro(EnableAsynchronousIO, int);
00378   vtkBooleanMacro(EnableAsynchronousIO, int);
00379 
00382   void SetUseWelcomeModuleAtStartup (int );
00383   vtkGetMacro (UseWelcomeModuleAtStartup, int );
00384   vtkBooleanMacro (UseWelcomeModuleAtStartup, int );
00385 
00388   void SetEnableForceRedownload (int);
00389   vtkGetMacro(EnableForceRedownload, int);
00390   vtkBooleanMacro(EnableForceRedownload, int);
00391 
00394   void SetEnableRemoteCacheOverwriting (int);
00395   vtkGetMacro(EnableRemoteCacheOverwriting, int);
00396   vtkBooleanMacro(EnableRemoteCacheOverwriting, int);
00397 
00400   void SetRemoteCacheLimit ( int);
00401   vtkGetMacro (RemoteCacheLimit, int);
00402 
00405   void SetRemoteCacheFreeBufferSize ( int );
00406   vtkGetMacro (RemoteCacheFreeBufferSize, int);
00407 
00410   const char *Evaluate(const char *expression);
00411 
00418   bool RequestDisplayMessage( const char *type, const char* message );
00419 
00425   void ProcessDisplayMessage();
00426 
00432   virtual void WarningMessage(const char* message);
00433   virtual void ErrorMessage(const char* message);
00434   virtual void DebugMessage(const char* message);
00435   virtual void InformationMessage(const char* message);
00436 
00441   virtual void DisplayTclInteractor(vtkKWTopLevel *master);
00442   virtual void DisplayLogDialog(vtkKWTopLevel *master);
00443 
00444 //BTX
00446   virtual void InitializePython(void* mod, void* dict);
00447   virtual void* GetPythonModule();
00448   virtual void* GetPythonDictionary();
00449 //ETX
00450 
00453   virtual void AddAboutCopyrights(ostream &);
00454 
00457   vtkSetMacro (UseSplashScreen, int);
00458   vtkGetMacro (UseSplashScreen, int);
00459 
00460 
00463   vtkSetMacro (StereoEnabled, int);
00464   vtkGetMacro (StereoEnabled, int);
00465 
00468   void SplashMessage (const char * message);
00469 
00476   const char *TraceScript (const char *script) {return (this->Script(script));};
00477   const char *Eval (const char *script) {return (this->Script(script));};
00478   const char *Eval (const char *script, const char *args) {return (this->Script("%s %s", script, args));};
00479 
00480   virtual vtkKWColorPickerDialog* GetColorPickerDialog();
00481 
00484   const char* GetPlatform();
00485   const char* GetBuildDate();
00486   const char* GetSvnUrl();
00487   const char* GetSvnRevision();
00488 
00490 
00491  protected:
00492   vtkSlicerApplication ( );
00493   vtkSlicerApplication (const char* tmp_dir, const char* config_dir);
00494   virtual ~vtkSlicerApplication ( );
00495 
00498   vtkSlicerGUILayout *DefaultGeometry;
00501   vtkSlicerTheme *SlicerTheme;
00504   vtkSlicerApplicationGUI *ApplicationGUI;
00507   vtkSlicerGUICollection *ModuleGUICollection;
00508 
00509 //BTX
00510   void StringToArray(std::string string, char separator, vtkStringArray *array);
00511   void ArrayToString(vtkStringArray *array, std::string sep, char *string, int maxLength );
00512 //ETX
00513 
00514   char ConfirmDelete[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00515   char ModulePaths[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00516   char ColorFilePaths[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00517   char PotentialModulePaths[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00518   char PotentialColorFilePaths[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00519   char ExtensionsInstallPath[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00520   char ExtensionsInstallPathDefault[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00521   char WebBrowser [vtkKWRegistryHelper::RegistryKeyValueSizeMax ];
00522   char Unzip [vtkKWRegistryHelper::RegistryKeyValueSizeMax ];
00523   char Zip [vtkKWRegistryHelper::RegistryKeyValueSizeMax ];
00524   char Rm [vtkKWRegistryHelper::RegistryKeyValueSizeMax ];
00525   char TemporaryDirectory[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00526   char HomeModule [ vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00527   char ApplicationFontSize [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00528   char ApplicationFontFamily [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00529   char IgnoreModuleNames [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00530   char BinDir [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00531 
00532   char Platform [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00533   char BuildDate [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00534   char SvnUrl [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00535   char SvnRevision [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00536 
00537   int ApplicationWindowWidth;
00538   int ApplicationWindowHeight;
00539   int ApplicationSlicesFrameHeight;
00540   int ApplicationLayoutType;
00541   int ApplicationLayoutCompareViewRows;
00542   int ApplicationLayoutCompareViewColumns;
00543   int ApplicationLayoutLightboxRows;
00544   int ApplicationLayoutLightboxColumns;
00545 
00546   char RegistryHolder [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00547 
00548   vtkStringArray *IgnoreModules;
00549   vtkStringArray *LoadableModules;
00550 
00551   int LoadModules;
00552   int LoadCommandLineModules;
00553   int EnableDaemon;
00554   void* PythonModule;
00555   void* PythonDictionary;
00556 
00557   int EnableAsynchronousIO;
00558   int EnableForceRedownload;
00559   int EnableRemoteCacheOverwriting;
00560   char RemoteCacheDirectory[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00561   int RemoteCacheLimit;
00562   int RemoteCacheFreeBufferSize;
00563 
00564   int UseWelcomeModuleAtStartup;
00565   bool TemporaryDirectorySpecified;
00566 
00569   void PrintSelf ( ostream& os, vtkIndent indent );
00570 
00571 private:
00572   vtkSlicerApplication ( const vtkSlicerApplication& ); 
00573   void operator = ( const vtkSlicerApplication& ); //Not implemented.
00574 
00575   //BTX
00578   void InitializeSlicer3Version();
00579   //ETX
00580 
00581   //BTX
00582   itk::MutexLock::Pointer DisplayMessageQueueActiveLock;
00583   itk::MutexLock::Pointer DisplayMessageQueueLock;
00584   std::string NameSeparator;
00585   //ETX
00586 
00587   bool DisplayMessageQueueActive;
00588 
00589   DisplayMessageQueue* InternalDisplayMessageQueue;
00590 
00591   static vtkSlicerApplication* Instance;
00592 
00593   int UseSplashScreen;
00594   int StereoEnabled;
00595 
00597   int ColorSwatchesAdded;
00598 
00599 //BTX
00600   class vtkInternal;
00601   vtkInternal* Internal;
00602 //ETX
00603 
00604 };
00605 
00606 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1