Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CanvasView.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00002 
00016 #ifndef CanvasView_H
00017 #define CanvasView_H
00018 
00019 #include "FigureEditor.h"
00020 
00021 #if QT_VERSION < 0x040000
00022 #else
00023 //Added by the Qt porting tool:
00024 #include <QMouseEvent>
00025 #endif
00026 
00027 
00028 #ifdef _MSC_VER
00029 #include <msdevstudio/MSconfig.h>
00030 #endif
00031 
00032 #include <list>
00033 #include <map>
00034 
00035 class Inspector;
00036 class PlotterBase;
00037 class QtView;
00038 class ViewBase;
00039 class XmlController;
00040 class NTuple;
00041 class PickTable;
00042 
00043 #if QT_VERSION < 0x040000
00044 class QFileDialog;
00045 #else
00046 class Q3FileDialog;
00047 #endif
00048 class QFont;
00049 
00077 class MDL_QTHIPPOPLOT_API CanvasView : public FigureEditor {
00078 
00079 private:
00080 
00082   mutable std::vector < const ViewBase * > m_views; 
00083 
00085   mutable std::vector < const ViewBase * > m_sel_views; 
00086 
00088   std::map < const QtView *, PickTable * > m_table_map; 
00089 
00091   XmlController * m_xml_controller;
00092 
00094   Inspector * m_inspector;
00095 
00098   static const std::string s_app_name;
00099 
00101   static std::string s_image_filters;
00102 
00104    QCanvasRectangle*  drag_rect;
00105 
00111 #if QT_VERSION < 0x040000
00112   QFileDialog * m_image_dialog;
00113 #else
00114   Q3FileDialog * m_image_dialog;
00115 #endif
00116 
00117 
00119    std::vector<double> m_mouseData;
00120 
00123   int m_num_width;
00124 
00127   int m_num_height;
00128 
00131   bool m_add_selected;
00132   
00133 
00136   std::vector<double> m_current_range;
00137   
00140   void initSettings ();
00141 
00144   void saveSettings () const;
00145 
00148   static void createImageFilters ();
00149 
00153   static bool isValidImageFormat ( const std::string & suffix );
00154 
00158 #if QT_VERSION < 0x040000
00159   QFileDialog * createImageDialog ();
00160 #else
00161   Q3FileDialog * createImageDialog ();
00162 #endif
00163  
00165   void setChanged ( bool yes = true );
00166 
00169   void addView ( QtView * view, bool select );
00170 
00173 #if QT_VERSION < 0x040000
00174   void placeItems ( const std::vector < QCanvasItem * > & items );
00175 #else
00176   void placeItems ( const std::vector < Q3CanvasItem * > & items );
00177 #endif
00178 
00181   virtual void calcDefaultSize ( QtView * view, double aspect_ratio = 0.0);
00182 
00186   void moveToPlotter ( const PlotterBase * plotter, QtView * view );
00187 
00191   std::pair<double, double> moveToPlotterAt ( const PlotterBase * plotter,
00192                                                QtView * view,
00193                                                double x, double y );
00194 
00198   void fillSelectedWithObservers ( std::vector < const ViewBase * > & );
00199 
00200 protected:
00201 
00203   virtual void contentsMouseMoveEvent ( QMouseEvent * );
00204   virtual void contentsMousePressEvent ( QMouseEvent * );
00205 
00209   virtual void controlMousePressEvent ();
00210 
00214   virtual void contentsMouseReleaseEvent(QMouseEvent*);
00215 
00216 public:
00217  
00218 #if QT_VERSION < 0x040000
00219    CanvasView ( QCanvas *, QWidget * parent = 0, 
00220                 const char * name = 0, Qt::WFlags f = 0 );
00221 #else
00222    CanvasView ( Q3Canvas *, QWidget * parent = 0, 
00223                 const char * name = 0, Qt::WFlags f = 0 );
00224 #endif
00225 
00226   void initFrom ( const std::list < ViewBase * > & views );
00227 
00229   void initFromFile ( const std::string & filename );
00230 
00232   void copySelectedToPasteboard ();
00233 
00236   void copyFromPasteboard ();
00237 
00241   void addFromPasteboard ();
00242 
00246   void deleteSelected ( bool paste );
00247 
00250   void pasteViews ( const std::list < ViewBase * > & views );
00251 
00253   void restoreFromSelectCopy ();
00254 
00256   void setCurrentRange();
00257 
00259   std::vector<double>& getCurrentRange() ;
00260 
00263   void setInspector ( Inspector * inspector );
00264 
00266   Inspector * getInspector ();
00267 
00275   void notifyObservers ();
00276 
00278   PlotterBase * selectedPlotter () const;
00279 
00282   std::vector < PlotterBase * > getSelectedPlotters () const;
00283 
00287   void addPlotDisplay ( PlotterBase * plotter, bool select);
00288 
00293   void addPlotDisplay ( PlotterBase * plotter );
00294 
00298   void addTextDisplay ( PlotterBase * plotter, 
00299                         const std::string & s, 
00300                         const std::string & text = std::string () );
00301 
00306    std::pair<double, double> addTextDisplayAt ( PlotterBase * plotter,
00307                                                 const std::string & type,
00308                                                 const std::string & text,
00309                                                 double xrel, double yrel);
00310 
00311 
00313   void addFuncDisplay ( PlotterBase * plotter, const std::string & s );
00314 
00317   void removeDisplay ( PlotterBase * plotter );
00318 
00322   const std::vector < const ViewBase * > & selectedViews () const;
00323 
00328   const std::vector < const ViewBase * > & views () const;
00329 
00333   void fillPlotterList ( std::vector < PlotterBase * > & plotter_list );
00334 
00337   QtView * getViewFor ( const PlotterBase * plotter ) const;
00338 
00342   void previousView ();
00343 
00346   virtual void print ();
00347 
00350   virtual void print ( const std::string & filename );
00351 
00354   void reTile ();
00355 
00358   void reTilePage ();
00359 
00362   void setIntervalEnabled ( bool yes = true );
00363 
00365   void clear ();
00366 
00368   void removeSelected ();
00369 
00371   void saveSelectedImages ();
00372 
00374    void saveSelectedImages ( const std::string & filename );
00375 
00381   void savePlotAsImage ( const PlotterBase *, const std::string & filename );
00382 
00385   void saveAs ( const std::string & filename ) const;
00386 
00391   void exportTextTuple ( const std::string & suffix );
00392 
00395   void showInspector ();
00396 
00398   void viewShowPickTable();
00399 
00402    const std::vector<double> & mouseEventData();
00403 
00407   void setPlotMatrix ( unsigned int columns, unsigned int rows );
00408 
00410   void setup ();
00411   
00412  
00414   void setFonts( const QFont & font );
00415     
00417   void helpAbout ();
00418 
00421   const std::string & applicationName () const;
00422 
00425   void setAddedSelected ( bool yes );
00426 
00427 private:
00428 
00431   bool existingFileWarning ( const std::string & filename );
00432 
00435   void invalidImageFormatError ( const std::string & filename );
00436 
00438   void saveSelectedAsEps ( const std::string & filename );
00439 
00443   void setVisibleNonViews ( bool visible );
00444 
00452   void saveSelectedImages ( const std::string & filename, 
00453                             bool check_existing );
00454   
00457   static void toLower ( std::string & upper );
00458 
00459 };
00460 
00461 #endif // CanvasView_H

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3