casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtDisplayPanelGui.qo.h
Go to the documentation of this file.
00001 //# QtDisplayPanelGui.qo.h: Qt implementation of main viewer display window.
00002 //# with surrounding Gui functionality
00003 //# Copyright (C) 2005,2009
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id: QtDisplayPanelGui.qo.h,v 1.7 2006/10/10 21:42:05 dking Exp $
00028 
00029 #ifndef QTDISPLAYPANELGUI_H
00030 #define QTDISPLAYPANELGUI_H
00031 
00032 #include <casa/aips.h>
00033 #include <graphics/X11/X_enter.h>
00034 #  include <QtCore>
00035 #  include <QtGui>
00036 #include <QTextEdit>
00037 #include <QHash>
00038 #include <QFont>
00039 
00040    //#dk Be careful to put *.ui.h within X_enter/exit bracket too,
00041    //#   because they'll have Qt includes.
00042    //#   E.g. <QApplication> needs the X11 definition of 'Display'
00043 #include <graphics/X11/X_exit.h>
00044 #include <casaqt/QtUtilities/QtPanelBase.qo.h>
00045 #include <display/QtViewer/QtDisplayPanel.qo.h>
00046 #include <display/QtViewer/DisplayDataHolder.h>
00047 #include <display/region/QtRegionDock.qo.h>
00048 #include <display/Utilities/Lowlevel.h>
00049 #include <display/DisplayDatas/DisplayDataOptions.h>
00050 #include <display/Utilities/ImageProperties.h>
00051 #include <display/Utilities/StatusSink.h>
00052 
00053 namespace casa { //# NAMESPACE CASA - BEGIN
00054 
00055         namespace viewer {
00056                 class Preferences;
00057                 class CleanGui;
00058         }
00059 
00060 class String;
00061 class QtViewer;
00062 class QtViewerPrintGui;
00063 class QtMouseToolBar;
00064 class QtCanvasManager;
00065 class QtAnnotatorGui;
00066 class MakeMask;
00067 class FileBox;
00068 class MakeRegion;
00069 class QtProfile;
00070 class QtDisplayData;
00071 class TrackBox;
00072 class QtRegionManager;
00073 class QtRegionShapeManager;
00074 class QtDataManager;
00075 class QtExportManager;
00076 class QtDataOptionsPanel;
00077 class AnimatorHolder;
00078 class BinPlotWidget;
00079 class HistogramMain;
00080 class Fit2DTool;
00081 class SlicerMainWindow;
00082 class ColorHistogram;
00083 class ImageManagerDialog;
00084 
00085 template <class T> class ImageInterface;
00086 
00087 // <summary>
00088 // The main display window for the Qt version of the viewer.
00089 // </summary>
00090 
00091 class QtDisplayPanelGui : public QtPanelBase, public viewer::StatusSink {
00092 
00093   Q_OBJECT;     //# Allows slot/signal definition.  Must only occur in
00094                 //# implement/.../*.h files; also, makefile must include
00095                 //# name of this file in 'mocs' section.
00096 
00097  protected:
00098   friend class QtViewer;
00099   QtDisplayPanelGui( QtViewer* v, QWidget* parent=0, std::string rcstr="dpg",
00100                      const std::list<std::string> &args = std::list<std::string>( ) );
00101 
00102  public:
00103   enum SCRIPTING_OPTION { INTERACT, SETOPTIONS };
00104 
00105   ~QtDisplayPanelGui();
00106 
00107   // access to our viewer
00108   QtViewer *viewer( ) { return v_; }
00109   int buttonToolState(const std::string &tool) const;
00110 
00111   // access our logger...
00112   LogIO &logIO( ) { return logger; }
00113 
00114   // enter status information...
00115   void status( const std::string &s, const std::string &type="info" );
00116   
00117   // access to graphics panel 'base'....
00118   QtDisplayPanel* displayPanel() { return qdp_;  }
00119 
00120   typedef std::list<viewer::Region*> region_list_t;
00121   region_list_t regions( ) { return regionDock_ ? regionDock_->regions( ) : std::list<viewer::Region*>( ); }
00122   // region coupling between QtRegionDock and QtRegionSource(s)...
00123   void revokeRegion( viewer::Region *r ) { qdp_->revokeRegion(r); }
00124 
00125   
00126   // public toolbars, for inserting custom buttons.
00127   QToolBar* customToolBar;      //# limited room
00128   QToolBar* customToolBar2;     //# wider -- in its own row.
00129 
00130   virtual void setStatsPrint(Bool printStats=True) {
00131     qdp_->printStats = printStats;  }
00132 
00133   virtual void setUseRegion(Bool useRegion=True) {
00134     qdp_->useRegion = useRegion;  }
00135 
00136   virtual bool supports( SCRIPTING_OPTION option ) const;
00137   virtual QVariant start_interact( const QVariant &input, int id );
00138   virtual QVariant setoptions( const QMap<QString,QVariant> &input, int id);
00139 
00140   // At least for now, colorbars can only be placed horizontally or
00141   // vertically, identically for all display panels.
00142   // This returns the current value.
00143   Bool colorBarsVertical() { return colorBarsVertical_;  }
00144 
00145   //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00146   //# DisplayData functionality brought down from QtViewerBase
00147   //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00148   // Create a new QtDD from given parameters, and add to internal DD list.
00149   // (For now) QtViewerBase retains 'ownership' of the QtDisplayData; call
00150   // removeDD(qdd) to delete it.
00151   // Unless autoregister is set False, all open DisplayPanels will
00152   // register the DD for display.
00153   // Check return value for 0, or connect to the createDDFailed()
00154   // signal, to handle failure.
00155   QtDisplayData* createDD( String path, String dataType, String displayType, Bool autoRegister=True,
00156                            const viewer::DisplayDataOptions &ddo=viewer::DisplayDataOptions(),
00157                            const viewer::ImageProperties &props=viewer::ImageProperties( ) );
00158    
00159   // Removes the QDD from the list and deletes it (if it existed -- 
00160   // Return value: whether qdd was in the list in the first place).
00161   virtual Bool removeDD(QtDisplayData* qdd);
00162   
00163   // retrieve a copy of the current DD list.
00164   //List<QtDisplayData*> dds() { return qdds_;  }
00165   DisplayDataHolder::DisplayDataIterator beginDD() const;
00166   DisplayDataHolder::DisplayDataIterator endDD() const;
00167   Bool isEmptyDD() const;
00168   // return the number of user DDs.
00169   //Int nDDs() { return qdds_.len();  }
00170   
00171   // return a list of DDs that are registered on some panel.
00172   //List<QtDisplayData*> registeredDDs();
00173   
00174   // return a list of DDs that exist but are not registered on any panel.
00175   List<QtDisplayData*> unregisteredDDs();
00176   
00177   // retrieve a DD with given name (0 if none).
00178   QtDisplayData* dd(const std::string& name);
00179   // retrieve the controlling DD...
00180   QtDisplayData* dd( );
00181   
00182   // Check that a given DD is on the list.  Use qdd pointer or its name.
00183   //<group>
00184   Bool ddExists(QtDisplayData* qdd);
00185   //Bool ddExists(const String& name) { return dd(name)!=0;  }
00186   //</group>
00187   
00188   // Latest error (in createDD, etc.) 
00189   virtual String errMsg() { return errMsg_;  }
00190  
00191   //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00192   //# DisplayData functionality brought down from QtViewerBase
00193   //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00194 
00195   // the QtDBusViewerAdaptor can handle loading & registering data itself,
00196   // but to connect up extra functionality, the upper-level QtDisplayPanelGui
00197   // (or in the current case, the derived QtCleanPanelGui) would have to be
00198   // notified that data has been added. This will allow it to set up the
00199   // callbacks for drawing regions...
00200   virtual void addedData( QString type, QtDisplayData * );
00201  
00202   QtDataManager* dataMgr() { return qdm_;  }
00203 
00204   // return the id for viewer state for this type of panel
00205   virtual std::string rcid( ) const { return rcid_; }
00206 
00207   viewer::QtRegionDock *regionDock( ) { return regionDock_; }
00208   int numFrames( ) const { return qdp_->nFrames( ); }
00209 
00210   // load casa (or DS9?) region files...
00211   void loadRegions( const std::string &path, const std::string &datatype );
00212   // zero length string indicates OK!
00213   std::string outputRegions( std::list<viewer::QtRegionState*> regions, std::string file, std::string format, std::string ds9_csys="pixel" );
00214 
00215   bool useNewRegions( ) const { return use_new_regions; }
00216 
00217   // called to indicate application activation state... true -> activated, false -> deactivated
00218   void activate( bool );
00219 
00220  public slots:
00221  
00222   // At least for now, colorbars can only be placed horizontally or vertically,
00223   // identically for all display panels.  This sets that state for everyone.
00224   // Sends out colorBarOrientationChange signal when the state changes.
00225   virtual void setColorBarOrientation(Bool vertical);    
00226 
00227   virtual QtDisplayPanelGui *createNewPanel( );
00228 
00229   virtual void showDataManager();
00230   virtual void hideDataManager();
00231  
00232   virtual void showExportManager();
00233   virtual void hideExportManager();
00234 
00235   virtual void showDataOptionsPanel();
00236   virtual void hideDataOptionsPanel();
00237 
00238   virtual void showPreferences( );
00239   
00240   virtual void removeAllDDs();
00241   
00242   // Show/hide display panel's auxiliary windows.
00243   //<group>
00244   virtual void showPrintManager();
00245   virtual void hidePrintManager();
00246  
00247   virtual void showCanvasManager();
00248   virtual void hideCanvasManager();
00249 
00250   virtual void showRegionManager();
00251   virtual void hideRegionManager();
00252   
00253   virtual void showShapeManager();
00254   virtual void hideShapeManager();
00255 
00256   virtual void showAnnotatorPanel();
00257   virtual void hideAnnotatorPanel();
00258 
00259   virtual void showFileBoxPanel();
00260   virtual void hideFileBoxPanel();
00261 
00262   virtual void showMakeRegionPanel();
00263   virtual void hideMakeRegionPanel();
00264  
00265   virtual void showImageProfile();
00266   virtual void hideImageProfile();
00267   virtual void refreshImageProfile();
00268   
00269   virtual void hideAllSubwindows();
00270   virtual void hideImageMenus();
00271 
00272   //Increments the channel in the images from the start channel
00273   //to the end channel.
00274   void movieChannels( int startChannel, int endChannel );
00275   void movieChannels( int channel, bool forward, int stepSize, int channelStart, int channelEnd  );
00276   void movieStop();
00277   void registerAllDDs();
00278   void unregisterAllDDs();
00279   virtual void showStats(const String&);
00280   virtual void hideStats();
00281   //</group>
00282  
00283   // add a new DD
00284   virtual void addDD(String path, String dataType, String displayType, Bool autoRegister=True, Bool tmpDtata=False, ImageInterface<Float>* img = NULL);
00285   // go to a specifc channel
00286   virtual void doSelectChannel(int channelIndex);
00287  
00288   // (Attempts to) restore panel state from named file.
00289   virtual Bool restorePanelState(String filename);
00290  
00291   virtual void trackingMoved(Qt::DockWidgetArea);
00292   virtual void animatorMoved(Qt::DockWidgetArea);
00293   virtual void regionMoved(Qt::DockWidgetArea);
00294   virtual void mousetoolbarMoved(bool);
00295 
00296   // note that 'key' is prefixed with something like "viewer.dpg."...
00297   // for both get and put...
00298   std::string getrc( const std::string &key );
00299   void putrc( const std::string &key, const std::string &val );
00300   void showMomentsCollapseImageProfile();
00301   void showSpecFitImageProfile();
00302   void disconnectHistogram();
00303   void ddClose( QtDisplayData* removeDD);
00304   void ddOpen( const String& path, const String& dataType, const String& displayType );
00305 
00306  signals:
00307 
00308     void regionChange( viewer::Region *, std::string );
00309 
00310     void axisToolUpdate( QtDisplayData *controlling_dd );
00311 
00312     void colorBarOrientationChange();
00313 
00314     //Notification that the frame has changed.
00315     void frameChanged( int );
00316   
00317     void overlay(QHash<QString, ImageInterface<float>*>);
00318 
00319     void createDDFailed(String errMsg, String path, String dataType, 
00320                       String displayType);
00321   
00322     // The DD now exists, and is on QtViewerBase's list.
00323     // autoregister tells DPs whether they are to register the DD.
00324     // ***** dd is added to the world canvas holder during *****
00325     // ***** the processing of this event...               *****
00326     void ddCreated(QtDisplayData*, Bool autoRegister);
00327   
00328     // The DD is no longer on QtViewerBase's list, but is not
00329     // destroyed until after the signal.
00330     // ***** dd is removed from the world canvas holder    *****
00331     // ***** during the processing of this event...        *****
00332     void ddRemoved(QtDisplayData*);
00333 
00334     void closed( const QtDisplayPanelGui * );
00335 
00336         void cursorBoundary( QtDisplayPanel::CursorBoundaryCondition );
00337         void cursorPosition( viewer::Position );
00338 
00339  protected slots:
00340 
00341  virtual void close( );
00342 
00343  virtual void quit( );
00344 
00345   //# overrides of base QMainWindow slots
00346   
00347   void hideEvent(QHideEvent* ev) {
00348     // Note: If the display panel is iconified or the user changes
00349     // desktops, isVisible() will remain true here (surprising, but
00350     // useful -- see isVisible() doc).  Otherwise, in this context,
00351     // [I believe] we can assume the display panel has been _closed_;
00352     // in that case, we want to 'close' the auxiliary windows as well.
00353     // (Note that there is no 'closeEvent' per se).
00354     if(!isVisible()) hideAllSubwindows();
00355     
00356     QMainWindow::hideEvent(ev);  }
00357  
00358   
00359   //# purely internal slots
00360  
00361   /* virtual void toggleAnimExtras_(); */
00362   /* virtual void setAnimExtrasVisibility_();   */
00363 
00364   //# slots reacting to signals from the basic QtDisplayPanel.
00365   //# Protected, connected by this object itself.
00366   
00367   // Respond to QDP::registrationChange() signal
00368   virtual void ddRegChange_() {
00369     //hideImageMenus();
00370     updateDDMenus_();
00371     arrangeTrackBoxes_();
00372     updateFrameInformation();
00373   }
00374 
00375   // Respond to registration/close menu clicks.
00376   //<group>
00377   virtual void ddRegClicked_();  
00378   virtual void ddUnregClicked_();  
00379   virtual void ddCloseClicked_();
00380   //</group>
00381  
00382   // Reflect animator state [changes] in gui.
00383   virtual void updateAnimUi_();
00384   
00385   // These react to fwd/reverse Play buttons.  They allow a single
00386   // play button to be used to toggle between play and stop.
00387   //<group>
00388   virtual void fwdPlay_() {
00389     if(qdp_->animating()>0) qdp_->stop(); else qdp_->fwdPlay();  }
00390   
00391   virtual void revPlay_() {
00392     if(qdp_->animating()<0) qdp_->stop(); else qdp_->revPlay();  }
00393   //</group>
00394   
00395   
00396   // Display tracking data gathered by underlying panel.
00397   virtual void displayTrackingData_(Record trackingRec);
00398    
00399   // Reacts to QDP registration change signal.  If necessary, changes
00400   // the set of cursor position tracking boxes being displayed in
00401   // trkgWidget_ (creating new TrackBoxes as necessary).  A TrackBox
00402   // will be shown for each qdd in qdp_->registeredDDs() where
00403   // qdd->usesTracking() (in registration order).
00404   virtual void arrangeTrackBoxes_();
00405  
00406   // Deletes the TrackBox for the given QDD, if it exists.  (Deletion
00407   // automatically removes it from the trkgWidget_ and its layout).
00408   // Connected to the ddRemoved() signal of QtViewerBase.
00409   virtual void deleteTrackBox_(QtDisplayData* qdd);
00410  
00411 
00412    
00413   // Brings up dialog for saving display panel state: reg'd DDs, their
00414   // options, etc. Triggered by dpSaveAct_.
00415   virtual void savePanelState_();
00416  
00417   // Brings up dialog for restore file, attempts restore.
00418   // Triggered by dpRstrAct_.
00419   virtual void restorePanelState_();
00420   
00421   
00422   // Responds to qdp_->creatingRstrDoc(QDomDocument*) signal.
00423   // (Recall that qdp_ is unaware of this gui).
00424   // Adds gui state to the QDomDocument qdp has created.
00425   virtual void addGuiState_(QDomDocument*);
00426   
00427   // Responds to qdp_->restoring(QDomDocument*) signal.
00428   // Sets gui-specific state (most notably, overall window size).
00429   virtual void restoreGuiState_(QDomDocument*); 
00430  
00431  protected:
00432 
00433   LogIO logger;
00434   static bool logger_did_region_warning;
00435     
00436   // Existing user-visible QDDs
00437   //List<QtDisplayData*> qdds_;
00438   DisplayDataHolder* displayDataHolder;
00439   String errMsg_;
00440   
00441   
00442   QtDataManager* qdm_;          //# The window for loading data.
00443   QtExportManager* qem_;    //# The window for exporting images.
00444   QtDataOptionsPanel* qdo_;     //# The window for controlling data display.
00445 
00446   // Keeps current data directory in sync between
00447   // DataManager window and save-restore dialogs.
00448   virtual Bool syncDataDir_(String filename);
00449   
00450   // return the tracking box for a QDD (given pointer or name).  0 if none.
00451   //<group>
00452   virtual TrackBox* trkBox_(QtDisplayData* qdd);
00453   virtual TrackBox* trkBox_(String ddname);
00454   //</group>
00455   
00456   
00457   // Does the display panel have a TrackBox for this panel (yet)?
00458   virtual Bool hasTrackBox_(QtDisplayData* qdd) { return trkBox_(qdd)!=0;  }
00459   
00460   
00461   // If qdd->usesTracking(), this method assures that a TrackBox for qdd
00462   // is visible in the trkgWidget_'s layout (creating the TrackBox if it
00463   // didn't exist).  Used by arrangeTrackBoxes_().  Returns the TrackBox
00464   // (or 0 if none, i.e., if !qdd->usesTracking()).
00465   virtual TrackBox* showTrackBox_(QtDisplayData* qdd);
00466  
00467 
00468 
00469   
00470   virtual void updateDDMenus_(Bool doCloseMenu = True);
00471   
00472   
00473   // scripted (via dbus) panels should override the closeEvent( ) and hide the gui
00474   // instead of deleting it when it was created via a dbus script...
00475   void closeEvent(QCloseEvent *event);
00476 
00477   //# ----------------------------DATA----------------------------------
00478   
00479   // At least for now, colorbars can only be placed horizontally or vertically,
00480   // identically for all display panels.  Here is where that state is kept for
00481   // everyone.
00482   Bool colorBarsVertical_;  
00483   
00484   QtViewer* v_;                 //# (Same viewer as qdp_'s)
00485   QtDisplayPanel* qdp_;         //# Central Widget this window operates.
00486   QtViewerPrintGui* qpm_;       //# Print dialog for this display panel.
00487   QtCanvasManager* qcm_;        //# display panel options window.
00488   //QtAnnotatorGui* qap_;
00489   MakeMask* qap_;
00490   FileBox* qfb_;
00491   MakeRegion* qmr_;
00492   QtRegionManager* qrm_;      //# Region manager window.
00493   QtRegionShapeManager* qsm_; //# Region shape manager window.
00494   QTextEdit* qst_;
00495 
00496   
00497   QtProfile* profile_;          //# Profile window
00498   String savedTool_;            //# (for restoring left button)
00499   QtDisplayData* profileDD_;    //# QDD currently being profiled
00500                                 //# (0 if profiler is not showing).
00501 
00502   //# GUI LAYOUT  
00503 
00504   QMenu *dpMenu_, *ddMenu_, *ddRegMenu_, *ddCloseMenu_, *tlMenu_, *vwMenu_;
00505   
00506   QAction *dpNewAct_, *printAct_, *dpOptsAct_, *dpCloseAct_, *dpQuitAct_,
00507           *ddOpenAct_, *ddSaveAct_, *ddAdjAct_, *ddRegAct_, *ddCloseAct_, *unzoomAct_,
00508           *zoomInAct_, *zoomOutAct_, *annotAct_, *mkRgnAct_, *fboxAct_, *ddPreferencesAct_,
00509       *profileAct_, *momentsCollapseAct_, *histogramAct_, *fitAct_,
00510       *cleanAct_, *rgnMgrAct_, *shpMgrAct_, *dpSaveAct_, *dpRstrAct_, *manageImagesAct_;
00511   
00512   QToolBar* mainToolBar_;
00513   QToolButton *ddRegBtn_, *ddCloseBtn_;
00514 
00515   QtMouseToolBar* mouseToolBar_;
00516 
00517   // connection to rc file
00518   Casarc &rc;
00519   // rc id for this panel type
00520   std::string rcid_;
00521 
00522  private:
00523   bool use_new_regions;
00524   bool manageImages;
00525 
00526   //Animating the channel
00527   int movieChannel;
00528   int movieChannelEnd;
00529   int movieLast;
00530   int movieStart;
00531   int movieStep;
00532   QTimer movieTimer;
00533   void setAnimationRate();
00534   int getBoundedChannel( int channelNumber ) const;
00535   unsigned int showdataoptionspanel_enter_count;
00536   QtDisplayPanelGui() : rc(viewer::getrc()) {  }                // (not intended for use)  
00537   QtDisplayData* processDD( String path, String dataType, String displayType, Bool autoRegister,
00538                   QtDisplayData* qdd, const viewer::DisplayDataOptions &ddo=viewer::DisplayDataOptions() );
00539   void connectRegionSignals(PanelDisplay* ppd);
00540 
00541   //Management of the controlling DD
00542   QtDisplayData* lookForExistingController();
00543   void setControllingDD( QtDisplayData* controlDD );
00544   void replaceControllingDD( QtDisplayData* oldControllingDD, QtDisplayData* newControllingDD);
00545   // used to manage generation of the updateAxes( ) signal...
00546   //QtDisplayData *controlling_dd;
00547 
00548   void updateFrameInformation();
00549   void updateSliceCorners( int id, const QList<double>& worldX,
00550                 const QList<double>& worldY );
00551   void initAnimationHolder();
00552   void initHistogramHolder();
00553   void hideHistogram();
00554   void initFit2DTool();
00555   void hideFit2DTool();
00556   void resetHistogram( viewer::Region* qtRegion );
00557   viewer::Region* findRegion( int id );
00558 
00559   viewer::Preferences *preferences;
00560   AnimatorHolder* animationHolder;
00561   HistogramMain* histogrammer;
00562   ColorHistogram* colorHistogram;
00563   Fit2DTool* fitTool;
00564   SlicerMainWindow* sliceTool;
00565   ImageManagerDialog* imageManagerDialog;
00566 
00567   // interactive clean...
00568   void initCleanTool( );
00569   viewer::CleanGui *clean_tool;
00570   
00571 
00572   //Docking/Dock Widgets
00573   string addAnimationDockWidget();
00574   QDockWidget*  animDockWidget_;
00575   QDockWidget*  histogramDockWidget_;
00576   viewer::QtRegionDock  *regionDock_;
00577   QDockWidget*  trkgDockWidget_;
00578   QWidget*    trkgWidget_;
00579 
00580   QTimer *status_bar_timer;
00581   QString status_bar_state;
00582   QString status_bar_stylesheet;
00583 
00584  private slots:
00585   void loadRegions( const QString &path, const QString &type );
00586   void incrementMovieChannel();
00587   void clear_status_bar( );
00588   void reset_status_bar( );
00589   void controlling_dd_axis_change(String, String, String, std::vector<int> );
00590   void controlling_dd_update(QtDisplayData*);
00591   void showHistogram();
00592   void showSlicer();
00593   void resetListenerImage();
00594   void histogramRegionChange( int, viewer::region::RegionChanges change = viewer::region::RegionChangeLabel );
00595   void showFitInteractive();
00596   void showCleanTool( );
00597   void refreshFit();
00598   void addSkyComponentOverlay(String path, const QString& colorName);
00599   void removeSkyComponentOverlay( String path );
00600   void add2DFitOverlay( QList<RegionShape*> fitMarkers );
00601   void remove2DFitOverlay( QList<RegionShape*> fitMarkers );
00602   void addResidualFitImage( String path );
00603   void sliceChanged( int regionId, viewer::region::RegionChanges change,
00604                 const QList<double> & worldX, const QList<double> & worldY,
00605                 const QList<int> &pixelX, const QList<int> & pixelY );
00606   void addSlice( int id, const QString& shape, const QString&, const QList<double>& worldX,
00607                 const QList<double>& worldY, const QList<int>& pixelX, const QList<int>& pixelY,
00608                 const QString&, const QString&, const QString&, int, int);
00609   void showColorHistogram(QtDisplayData* displayData);
00610   void globalColorSettingsChanged( bool global );
00611   void globalOptionsChanged( QtDisplayData* originator, Record opts );
00612   void updateColorHistogram( const QString& ddName );
00613   void showImageManager();
00614   void sliceMarkerVisibilityChanged(int regionId, bool visible);
00615   void sliceMarkerPositionChanged(int regionId, int segmentIndex, float percentage);
00616   void updateMultiSpectralFitLocation( Record trackingRec);
00617 
00618 
00619 
00620  public:
00621  
00622   // True by default.  Set False to disable auto-raise of the Data
00623   // Options panel whenever the first DD is created.
00624   //# Users want to see this panel automatically when there are DDs
00625   //# to tweak.  (Apps like clean can turn v_->autoOptionsRaise off,
00626   //# if desired (yes, is is (gasp!) public data)).
00627   Bool autoDDOptionsShow;
00628  
00629   // Intended for use only by QtDataManager (or other data dialogs such as for
00630   // save-restore), to inform QtDisplayPanel of the directory currently
00631   // selected for data retrieval, if any ("" if none).
00632   String selectedDMDir;
00633 
00634 };
00635 
00636 
00637 
00638 
00639 // <summary>
00640 // Helper class for QtDisplayPanelGui, for display of tracking information.
00641 // </summary>
00642 
00643 // <synopsis>
00644 // TrackBox is the widget for the position the tracking information of
00645 // a single QtDisplayData within a QtDisplayPanelGui.  trkgWidget_ will
00646 // show a TrackBox for each registered QDD capable of displaying tracking
00647 // information, in registration order.  TrackBox is simply a QGroupBox with
00648 // a QTextEdit inside it.  The QGroupBox displays the QDD's name and has
00649 // a checkbox that can be used to hide the tracking text area to save
00650 // space.  TrackBox is intended to be used exclusively by QtDisplayPanelGui.
00651 // </synopsis>
00652   
00653 class TrackBox : public QGroupBox {
00654    
00655  Q_OBJECT;
00656    
00657  public:
00658    
00659   TrackBox(QtDisplayData* qdd, QWidget* parent=0);
00660   
00661   void setText(String trkgString);
00662   void clear() { trkgEdit_->clear();  }
00663   QtDisplayData* dd() { return qdd_;  }
00664   String name() { return objectName().toStdString();  }
00665   
00666  protected:
00667    
00668   // Attempts automatic adjustment of tracking display height
00669   // according to contents.
00670   void setTrackingHeight_();
00671     
00672   QtDisplayData* qdd_;  // (the QDD whose tracking info it displays).
00673   QTextEdit*    trkgEdit_;      // (the box's tracking info display area).
00674     
00675  private:
00676 
00677   TrackBox() {  }               // (not intended for use)  
00678 
00679 };
00680 
00681 
00682 namespace viewer {
00683         namespace hidden {
00684                 // Qt's meta object features not supported for nested classes...
00685                 // so this class cannot be nested in QtDisplayPanelGui...
00686                 class display_panel_gui_status : public QStatusBar {
00687                         Q_OBJECT;
00688                         public:
00689                                 display_panel_gui_status( QWidget *parent = 0 ) : QStatusBar(parent) { }
00690                                 ~display_panel_gui_status( ) { }
00691                         signals:
00692                                 void enter( );
00693                                 void leave( );
00694 
00695                     protected:
00696                                 void enterEvent( QEvent* );
00697                                 void leaveEvent( QEvent* );
00698                 };
00699         }
00700 }
00701 
00702 
00703 } //# NAMESPACE CASA - END
00704 
00705 #endif