CanvasWindow.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*-  */
00002 
00016 #ifndef CanvasWindow_H
00017 #define CanvasWindow_H
00018 
00019 #include "qtui/CanvasWindowBase.h"
00020 
00021 #include <qglobal.h> // for version
00022 
00023 #if QT_VERSION < 0x040000
00024 #include <qcanvas.h>
00025 #else
00026 // #include "CanvasWindowUI.h"
00027 //Added by the Qt porting tool:
00028 #include <q3canvas.h>
00029 #endif
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <utility>
00034 
00035 class QCloseEvent;
00036 class QCustomEvent;
00037 class QHideEvent;
00038 class QResizeEvent;
00039 class QShowEvent;
00040 
00041 class std::exception;
00042 
00043 namespace hippodraw {
00044 
00045 class NTuple;
00046 class CanvasView;
00047 class QtFileDialog;
00048 class PlotterBase;
00049 class PlotTable;
00050 class QtView;
00051 class ViewBase;
00052 class XmlController;
00053 
00106 // #if QT_VERSION < 0x040000
00107 class MDL_QTHIPPOPLOT_API CanvasWindow : public CanvasWindowBase
00108 {
00109 // #else
00110 // class MDL_QTHIPPOPLOT_API CanvasWindow : public Q3MainWindow,
00111 //                                       private Ui::CanvasWindowUI
00112 // {
00113 //   Q_OBJECT
00114 // #endif
00115 
00116 private:
00117 
00120   XmlController * m_xml_controller;
00121 
00123   CanvasView * m_canvas_view;
00124 
00127   CanvasView * m_browsed_canvas;
00128 
00131   QtFileDialog * m_file_dialog;
00132 
00134   QString m_prefix;
00135 
00137   std::string  m_filename;
00138 
00140   QString m_changed;
00141 
00144   static PlotTable * s_plot_table;
00145 
00149   bool m_hasChanged;
00150 
00153   bool m_inhibit_close;
00154 
00158   bool m_allow_close;
00159 
00161   bool m_filenameExists;
00162 
00165   std::string  getSaveDocFilename ();
00166 
00168   void setTitleFileName ( const std::string & name );
00169 
00175   bool setFilenameFromDialog ();
00176 
00181   bool areDataSourcesSaved ();
00182 
00183 // #if QT_VERSION < 0x040000
00184 protected:
00185 // #else
00186 // protected slots:
00187 // #endif
00188 
00198   virtual void windowActivationChange ( bool oldActive );
00199 
00201   virtual void closeEvent ( QCloseEvent * e );
00202 
00204   virtual void hideEvent ( QHideEvent * e );
00205 
00207   virtual void showEvent ( QShowEvent * e );
00208 
00210   virtual void resizeEvent ( QResizeEvent * );
00211 
00212   /* Implementation of functions declared in base class. */
00213 
00218   virtual void filePrint ();
00219 
00226   virtual void fileSaveAll();
00227 
00232   virtual void fileSaveAllAs();
00233 
00238   virtual void editClear ();
00239 
00240   virtual void editCopy ();
00244   virtual void editCut ();
00245 
00249   virtual void editDelete ();
00250 
00251   virtual void editPaste ();
00252 
00255   virtual void editReTile ();
00256 
00259   virtual void editReTilePage ();
00260 
00263   virtual void editSelectAll ();
00264 
00267   virtual void editUndo ();
00268 
00269   virtual void fileExportTextTuple ();
00270 
00273   virtual void fileCreateNTuple ();
00274 
00277   virtual void helpHelp ();
00278 
00281   virtual void helpAbout ();
00282 
00285   virtual void aboutQt ();
00286 
00290   virtual void viewLock ();
00291 
00295   virtual void viewUnlock ();
00296 
00299   virtual void viewShowInspector ();
00300 
00303   virtual void viewShowPlotTable ();
00304 
00307   virtual void viewShowPickTable ();
00308 
00312   void previousView ();
00313 
00317   void nextView ();
00318 
00321   virtual void setZoomMode ( bool on );
00322 
00325   virtual void settingCanvas ();
00326 
00329   virtual void settingPrinter ();
00330 
00333   virtual void settingFonts ();
00334 
00337   virtual void setFitter ( QAction * );
00338 
00341   virtual void openRecentFile ( QAction * );
00342 
00344   virtual void viewZoomIn();
00345 
00347   virtual void viewZoomOut();
00348 
00351   virtual void viewZoomReset();
00352 
00354   virtual  void viewAddPage();
00355 
00358   virtual void setCutMode ( QAction * );
00359 
00362   virtual void groupView ();
00363 
00366   virtual void ungroupView ();
00367 
00369   virtual void defaultToolbar ();
00370 
00371 public:
00372 
00375 #if QT_VERSION < 0x040000
00376   CanvasWindow ( QWidget * parent = 0,
00377                  const char * name = 0,
00378                  Qt::WFlags fl = Qt::WType_TopLevel );
00379 #else
00380    CanvasWindow ( QWidget * parent = 0 );
00381  #endif
00382 
00386   CanvasWindow ( const CanvasWindow & );
00387 
00388   virtual ~CanvasWindow();
00389 
00392   static void resetFontSize ();
00393 
00395   void initFromFile ( const std::string & filename );
00396 
00400   virtual void customEvent ( QCustomEvent * event );
00401 
00404   void inhibitClose ( bool yes = true );
00405 
00409   void setAllowClose ( bool yes = true );
00410 
00414   bool allowClose ();
00415 
00420   virtual bool closeNoPrompt ();
00421 
00426   void setChanged ( bool flag = true );
00427 
00430   void setCaption ();
00431 
00435   void updateActions ();
00436 
00438   virtual void fileNew();
00439 
00445   void fileSave ();
00446 
00448   virtual void fileSaveAs ();
00449 
00452   virtual void fileSaveSelectedImages ();
00453 
00457    virtual void fileSaveSelectedImages( const std::string & filename );
00458 
00460   void saveAs ( const std::string & filename );
00461 
00463   void saveAllAs ( const std::string & filename );
00464 
00467   CanvasView * getCanvasView ();
00468 
00470   void addTextDisplay ( PlotterBase * plotter, 
00471                         const std::string & type);
00472 
00475   void addTextDisplay ( PlotterBase * plotter, 
00476                         const std::string & type,
00477                         const std::string & text);
00478 
00484    std::pair<double, double> addTextDisplayAt ( PlotterBase * plotter,
00485                                                 const std::string & type,
00486                                                 const std::string & text,
00487                                                 double xrel, double yrel);
00488 
00490   void addFuncDisplay ( PlotterBase * plotter, const std::string & name );
00491 
00496   void addPlotDisplay ( PlotterBase * plotter, bool select );
00497 
00499   void addDisplay ( PlotterBase * plotter );
00500 
00503   void removeDisplay ( PlotterBase * plotter );
00504 
00506   PlotterBase * selectedPlotter ();
00507 
00510   void clear();
00511 
00513   const std::vector < const ViewBase * > & views ();
00514 
00517   void fillPlotterList ( std::vector < PlotterBase * > & plotter_list );
00518 
00521   QtView * getViewFor ( const PlotterBase * plotter ) const;
00522 
00525   void setIntervalEnabled ( bool yes = true );
00526 
00537   void savePlotAsImage ( const PlotterBase * plotter, 
00538                          const std::string & filename );
00539 
00547   void saveAsImage ( const PlotterBase * plotter,
00548                      const std::string & filename );
00549 
00551    void setAllSelected ( bool flag = true );
00552 
00554    void setSelected ( QtView * view );
00555 
00557    const std::vector<double> & mouseEventData();
00558 
00561   void print ( const std::string & filename );
00562 
00566   void setPlotMatrix ( unsigned int columns, unsigned int rows );
00567 
00570   const QString & getAppKey () const;
00571 
00574   void setAddedSelected ( bool yes );
00575 
00578   NTuple * getPickTable () const;
00579 
00582   NTuple * getPickTable ( const PlotterBase * plotter ) const;
00583 
00587   void autosaveSettings ();
00588 
00589 protected slots:
00590 
00593   virtual void fileBrowse();
00594 
00597   virtual void fileExit ();
00598 
00603   virtual void fileOpen ();
00604 
00605 };
00606 
00607 } // namespace hippodraw
00608 
00609 #endif // CanvasWindow_H

Generated for HippoDraw Class Library by doxygen