vtkKWMimxMainWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   MIMX Meshing Toolkit
00004 Module:    $RCSfile: vtkKWMimxMainWindow.h,v $
00005 Language:  C++
00006 Date:      $Date: 2008/10/26 18:51:24 $
00007 Version:   $Revision: 1.18.4.2 $
00008 
00009  Musculoskeletal Imaging, Modelling and Experimentation (MIMX)
00010  Center for Computer Aided Design
00011  The University of Iowa
00012  Iowa City, IA 52242
00013  http://www.ccad.uiowa.edu/mimx/
00014  
00015 Copyright (c) The University of Iowa. All rights reserved.
00016 See MIMXCopyright.txt or http://www.ccad.uiowa.edu/mimx/Copyright.htm for details.
00017 
00018 This software is distributed WITHOUT ANY WARRANTY; without even 
00019 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00020 PURPOSE.  See the above copyright notices for more information.
00021 
00022 =========================================================================*/
00023 // .NAME vtkKWMimxMainUserInterfacePanel - Main window containing user
00024 // interface panel and view window.
00025 //
00026 // .SECTION Description
00027 // This is the main window containing user interface panels for operations
00028 // and the view window to view the objects. Also contains access to a pop-up
00029 // window to change the display settings.
00030 
00031 
00032 #ifndef __vtkKWMimxMainWindow_h
00033 #define __vtkKWMimxMainWindow_h
00034 
00035 #include "vtkKWWindow.h"
00036 #include "vtkKWRegistryHelper.h"
00037 #include "vtkKWRenderWidget.h"
00038 #include "vtkKWWindow.h"
00039 #include "vtkBuildingBlockWin32Header.h"
00040 //#include "vtkKWMimxViewProperties.h"
00041 
00042 
00043 class vtkCallbackCommand;
00044 class vtkPVAxesActor;
00045 class vtkRenderer;
00046 class vtkKWIcon;
00047 class vtkKWLoadSaveDialog;
00048 class vtkKWRenderWidget;
00049 class vtkMimxErrorCallback;
00050 class vtkKWMimxDisplayPropertiesGroup;
00051 class vtkKWMimxMainNotebook;
00052 class vtkKWMimxViewProperties;
00053 class vtkLinkedListWrapperTree;
00054 class vtkKWFrameWithLabel;
00055 class vtkKWCheckButtonWithLabel;
00056 class vtkKWScaleWithLabel;
00057 class vtkKWCheckButtonWithLabel;
00058 class vtkKWLoadSaveButtonWithLabel;
00059 class vtkKWEntryWithLabel;
00060 class vtkKWRadioButtonSet;
00061 class vtkSlicerTheme;
00062 class vtkKWTheme;
00063 class vtkObject;
00064 class vtkKWFrameWithScrollbar;
00065 
00066 // *** collabsible frame definition
00067 class vtkSlicerModuleCollapsibleFrame;
00068 
00069 class VTK_BUILDINGBLOCK_EXPORT vtkKWMimxMainWindow : public vtkKWCompositeWidget
00070 {
00071 public:
00072   static vtkKWMimxMainWindow* New();
00073   vtkTypeRevisionMacro(vtkKWMimxMainWindow,vtkKWCompositeWidget);
00074 
00075   // Description:
00076   // Get/Set the KWRenderWidget used to render the scene. The
00077   // RenderWidget must be set before calling the Create() method.
00078   vtkGetObjectMacro(RenderWidget, vtkKWRenderWidget);
00079   vtkSetObjectMacro(RenderWidget, vtkKWRenderWidget);
00080 
00081   // Description:
00082   // Get/Set the KWWindow used by the application. The Window must
00083   // be set before calling the Create() method.
00084   vtkGetObjectMacro(MainWindow, vtkKWWindow);
00085   vtkSetObjectMacro(MainWindow, vtkKWWindow);
00086 
00087   // Description:
00088   // Get/Set the mode for the user interface. The default mode (true)
00089   // is a standalone application. This will create options to
00090   // allow the user to set the font size and type. If the value
00091   // is false the main application is expected to manage this.
00092   // The mode must be set before calling the Create() method.
00093   vtkGetMacro(StandAloneApplication, bool);
00094   vtkSetMacro(StandAloneApplication, bool);
00095 
00096   // Description:
00097   // Get the Error dialog used to report errors
00098   vtkGetObjectMacro(ErrorCallback, vtkMimxErrorCallback);
00099 
00100   // Description:
00101   // Get the ViewProperties dialog box
00102   vtkGetObjectMacro(ViewProperties, vtkKWMimxViewProperties);
00103 
00104   // Description:
00105   // Get Axis Actor that is placed in the lower left.
00106   vtkGetObjectMacro(PVAxesActor, vtkPVAxesActor);
00107 
00108   // Description:
00109   // Get the user interface panel
00110   vtkGetObjectMacro(
00111           MainUserInterfacePanel, vtkKWMimxMainNotebook);
00112 
00113   // once the main window this will be drawing into is set, this method will
00114   // add and remove an orientation actor from the corner
00115   void RemoveOrientationAxis();
00116   void AddOrientationAxis();
00117 
00118   // Description:
00119   // Set the status text in the lower left of the application. This
00120   // is a convience function that calls the SetStatusText() in KWWindow.
00121   // The method is provided here for convience.It could be
00122   // eliminated with code refactoring in the other MIMX classes.
00123   void SetStatusText( const char * );
00124 
00125   // Description:
00126   // Get the UserInterfaceManager that is managed by the window. This
00127   // is a convience function that calls the GetMainUserInterfaceManager()
00128   // in KWWindow. The method is provided here for convience. It could be
00129   // eliminated with code refactoring in the other MIMX classes
00130   vtkKWUserInterfaceManager* GetMainUserInterfaceManager();
00131 
00132   // Description:
00133   // Update the Enabled state of the Window. This is a
00134   // convience function that calls the UpdateEnableState()
00135   // in KWWindow. The method is provided here for convience. It could be
00136   // eliminated with code refactoring in the other MIMX classes
00137   void UpdateEnableState();
00138 
00139 
00140   // Description:
00141   // Launch a window to containing display property change options
00142   void DisplayPropertyCallback();
00143 
00144   // Description:
00145   // Set/Get the application font family
00146   void SetApplicationFontFamily ( const char *family);
00147   const char *GetApplicationFontFamily ( ) const;
00148 
00149   // Description:
00150   // Set/Get the application font size
00151   void SetApplicationFontSize ( const char *size );
00152   const char *GetApplicationFontSize ( ) const;
00153 
00154   // Description:
00155   // Callback for autosave. Saves the active instance of the FE Mesh,
00156   // Building blocks and Surfaces in the object list
00157   void AutoSaveCallback( );
00158   void EnableAutoSave( );
00159   void DisableAutoSave( );
00160 
00161   // Description:
00162   // Set/Get the Current Render Window Text Color
00163   void SetTextColor(double color[3]);
00164   double *GetTextColor();
00165 
00166   // Description:
00167   // Set/Get the Current Render Window Background Color
00168   void SetBackgroundColor(double color[3]);
00169   //BTX
00170   using vtkKWFrame::SetBackgroundColor; 
00171   //ETX
00172   double *GetBackgroundColor();
00173   //BTX
00174   using vtkKWFrame::GetBackgroundColor; 
00175   //ETX
00176 
00177   // Description:
00178   // Set/Get the default average edge length for building blocks when created
00179   double GetAverageElementLength( );
00180   void SetAverageElementLength(double length);
00181 
00182   // Description:
00183   // Set/Get the default precision for material properties when written to ABAQUS
00184   int GetABAQUSPrecision( );
00185   void SetABAQUSPrecision(int precision);
00186 
00187   // Description:
00188   // Set/Get the application Auto Save Flag
00189   bool GetAutoSaveFlag( );
00190   void SetAutoSaveFlag(bool saveFlag);
00191 
00192   // Description:
00193   // Set/Get the Auto Save Working Directory Flag
00194   bool GetAutoSaveWorkDirFlag( );
00195   void SetAutoSaveWorkDirFlag(bool saveFlag);
00196 
00197   // Description:
00198   // Set/Get the application Auto Save Frequency
00199   int  GetAutoSaveTime( );
00200   void SetAutoSaveTime(int saveTime);
00201 
00202   // Description:
00203   // Set/Get the Auto Save Directory
00204   const char *GetWorkingDirectory();
00205   void SetWorkingDirectory(const char *dirName);
00206   void InitializeWorkingDirectory(const char *dirName);
00207 
00208   // Description:
00209   // Set/Get the Auto Save Directory
00210   const char *GetAutoSaveDirectory() const;
00211   void SetAutoSaveDirectory(const char *dirName);
00212 
00213   // Description:
00214   // Get Apply/Cancel Icons used througout the application
00215   vtkKWIcon* GetApplyButtonIcon();
00216   vtkKWIcon* GetCancelButtonIcon();
00217 
00218   // Description:
00219   // Get the Application Settings Interface as well as the Application
00220   // Settings User Interface Manager.
00221   //virtual vtkKWApplicationSettingsInterface *GetApplicationSettingsInterface();
00222 
00223   // Description:
00224   // Callbacks for the Module application settings. Internal, do not use.
00225 
00226   // Description:
00227   // Callbacks for font settings. Internal, do not use.
00228   virtual void SetFontFamilyCallback ( );
00229   virtual void SetFontSizeCallback ( );
00230 
00231   // Description:
00232   // Callbacks for the Application settings. Internal, do not use.
00233   virtual void AutoSaveModeCallback(int mode);
00234   virtual void AutoSaveScaleCallback(double value);
00235   virtual void AutoSaveDirectoryModeCallback(int mode);
00236   virtual void AutoSaveDirectoryCallback( );
00237   virtual void AverageElementLengthCallback(char *value);
00238   virtual void ABAQUSPrecisionCallback(double value);
00239 
00240   // Description:
00241   // Get the directory to be used for automated backups of the work
00242   const char *GetSaveDirectory ( );
00243 
00244   // Description:
00245   // Refresh the interface given the current value of the Window and its
00246   // views/composites/widgets.
00247   virtual void Update();
00248 
00249   // Description:
00250   // Load the previous set Registry Settings
00251   void LoadRegistryApplicationSettings();
00252 
00253   // Description:
00254   // Get/Set the Theme to be used for the Application
00255   virtual void InstallTheme ( vtkKWTheme *theme );
00256   virtual void InstallDefaultTheme ( );
00257   vtkSlicerTheme *GetSlicerTheme ( );
00258 
00259 
00260   // *** Force redraw since in slicer the panels weren't redrawing automatically
00261   void ForceWidgetRedraw(void);
00262 
00263   // add and remove the ApplicationSettings menus
00264   void CustomApplicationSettingsModuleEntry();
00265   void CustomApplicationSettingsModuleExit();
00266 
00267   // clear and display the objects from the lists.  This is used when the
00268   // module is entered and exited, so the actors don't display in the slicer
00269   // window when we are not in the module.  This traverses the list and stores
00270   // state in the MRML nodes.
00271   void SaveVisibilityStateOfObjectLists(void);
00272   void RestoreVisibilityStateOfObjectLists(void);
00273 
00274   // Widgets that must be public
00275   vtkKWRenderWidget *RenderWidget;
00276   vtkRenderer *AxesRenderer;
00277   vtkKWMimxMainNotebook *MainUserInterfacePanel;
00278 
00279 protected:
00280   vtkKWMimxMainWindow();
00281   ~vtkKWMimxMainWindow();
00282   virtual void CreateWidget();
00283   vtkMimxErrorCallback *ErrorCallback;
00284   vtkKWMimxViewProperties *ViewProperties;
00285   vtkLinkedListWrapperTree *DoUndoTree;
00286   vtkKWMimxDisplayPropertiesGroup *DisplayPropertyDialog;
00287   vtkSlicerModuleCollapsibleFrame *MainFrame;
00288 
00289         
00290 private:
00291   vtkKWMimxMainWindow(const vtkKWMimxMainWindow&);   // Not implemented.
00292   void operator=(const vtkKWMimxMainWindow&);  // Not implemented.
00293 
00294   void AddCustomApplicationSettingsPanel();
00295   void AddFontApplicationSettingsPanel();
00296 
00297   vtkKWIcon *applyIcon;
00298   vtkKWIcon *cancelIcon;
00299 
00300   char autoSaveEventId[256];
00301 
00302   /* Application Settings Interface Widgets */
00303   vtkPVAxesActor *PVAxesActor;
00304   vtkCallbackCommand *CallbackCommand;
00305   vtkKWWindow *MainWindow;
00306   vtkKWFrameWithLabel *MimxSettingsFrame;
00307   vtkKWCheckButtonWithLabel *AutoSaveButton;
00308   vtkKWScaleWithLabel *AutoSaveScale;
00309   vtkKWCheckButtonWithLabel *WorkingDirButton;
00310   vtkKWLoadSaveButtonWithLabel *AutoSaveDir;
00311   vtkKWEntryWithLabel *AverageElementLengthEntry;
00312   vtkKWScaleWithLabel *PropertyPrecisionScale;
00313   
00314   /* Hold Current Application Settings */
00315   /* Font Configuration */
00316   vtkKWFrameWithLabel *FontSettingsFrame;
00317   vtkKWRadioButtonSet *FontSizeButtons;
00318   vtkKWRadioButtonSet *FontFamilyButtons;
00319   vtkKWFrameWithScrollbar *FontScrollFrame;
00320   
00321   void RemoveFontApplicationSettingsPanel();
00322   void RemoveCustomApplicationSettingsPanel();
00323   
00324   vtkSlicerTheme *SlicerTheme;
00325   char ApplicationFontSize [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00326   char ApplicationFontFamily [vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00327   bool AutoSaveFlag;
00328   int  AutoSaveTime;
00329   char AutoSaveDirectory[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00330   bool AutoSaveWorkDirFlag; 
00331   char WorkingDirectory[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00332   char DateTimeString[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00333   char SaveDirectory[vtkKWRegistryHelper::RegistryKeyValueSizeMax];
00334   double AverageElementLength;
00335   int ABAQUSPrecision;
00336   double TextColor[3];
00337   double BackgroundColor[3];     
00338   bool StandAloneApplication;            
00339 
00340 };
00341 
00342 void updateAxis(vtkObject* caller, unsigned long , void* arg, void* );
00343 
00344 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1