CanvasWindow.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
16 #ifndef CanvasWindow_H
17 #define CanvasWindow_H
18 
19 #include "qtui/CanvasWindowBase.h"
20 
21 #include <qglobal.h> // for version
22 
23 #if QT_VERSION < 0x040000
24 #include <qcanvas.h>
25 #else
26 // #include "CanvasWindowUI.h"
27 //Added by the Qt porting tool:
28 #include <q3canvas.h>
29 #endif
30 
31 #include <string>
32 #include <vector>
33 #include <utility>
34 
35 class QCloseEvent;
36 class QCustomEvent;
37 class QHideEvent;
38 class QResizeEvent;
39 class QShowEvent;
40 
41 
42 namespace hippodraw {
43 
44 class NTuple;
45 class CanvasView;
46 class QtFileDialog;
47 class PlotterBase;
48 class PlotTable;
49 class QtView;
50 class ViewBase;
51 class XmlController;
52 
105 // #if QT_VERSION < 0x040000
107 {
108 // #else
109 // class MDL_QTHIPPOPLOT_API CanvasWindow : public Q3MainWindow,
110 // private Ui::CanvasWindowUI
111 // {
112 // Q_OBJECT
113 // #endif
114 
115 private:
116 
120 
123 
127 
131 
134 
136  std::string m_filename;
137 
140 
144 
149 
153 
158 
161 
164  std::string getSaveDocFilename ();
165 
167  void setTitleFileName ( const std::string & name );
168 
174  bool setFilenameFromDialog ();
175 
180  bool areDataSourcesSaved ();
181 
182 // #if QT_VERSION < 0x040000
183 protected:
184 // #else
185 // protected slots:
186 // #endif
187 
197  virtual void windowActivationChange ( bool oldActive );
198 
200  virtual void closeEvent ( QCloseEvent * e );
201 
203  virtual void hideEvent ( QHideEvent * e );
204 
206  virtual void showEvent ( QShowEvent * e );
207 
209  virtual void resizeEvent ( QResizeEvent * );
210 
211  /* Implementation of functions declared in base class. */
212 
217  virtual void filePrint ();
218 
225  virtual void fileSaveAll();
226 
231  virtual void fileSaveAllAs();
232 
237  virtual void editClear ();
238 
239  virtual void editCopy ();
243  virtual void editCut ();
244 
248  virtual void editDelete ();
249 
250  virtual void editPaste ();
251 
254  virtual void editReTile ();
255 
258  virtual void editReTilePage ();
259 
262  virtual void editSelectAll ();
263 
266  virtual void editUndo ();
267 
268  virtual void fileExportTextTuple ();
269 
272  virtual void fileCreateNTuple ();
273 
276  virtual void helpHelp ();
277 
280  virtual void helpAbout ();
281 
284  virtual void aboutQt ();
285 
289  virtual void viewLock ();
290 
294  virtual void viewUnlock ();
295 
298  virtual void viewShowInspector ();
299 
302  virtual void viewShowPlotTable ();
303 
306  virtual void viewShowPickTable ();
307 
311  void previousView ();
312 
316  void nextView ();
317 
320  virtual void setZoomMode ( bool on );
321 
324  virtual void settingCanvas ();
325 
328  virtual void settingPrinter ();
329 
332  virtual void settingFonts ();
333 
336  virtual void setFitter ( QAction * );
337 
340  virtual void openRecentFile ( QAction * );
341 
343  virtual void viewZoomIn();
344 
346  virtual void viewZoomOut();
347 
350  virtual void viewZoomReset();
351 
353  virtual void viewAddPage();
354 
357  virtual void setCutMode ( QAction * );
358 
361  virtual void groupView ();
362 
365  virtual void ungroupView ();
366 
368  virtual void defaultToolbar ();
369 
370 public:
371 
374 #if QT_VERSION < 0x040000
375  CanvasWindow ( QWidget * parent = 0,
376  const char * name = 0,
377  Qt::WFlags fl = Qt::WType_TopLevel );
378 #else
379  CanvasWindow ( QWidget * parent = 0 );
380  #endif
381 
385  CanvasWindow ( const CanvasWindow & );
386 
387  virtual ~CanvasWindow();
388 
391  static void resetFontSize ();
392 
394  void initFromFile ( const std::string & filename );
395 
399  virtual void customEvent ( QCustomEvent * event );
400 
403  void inhibitClose ( bool yes = true );
404 
408  void setAllowClose ( bool yes = true );
409 
413  bool allowClose ();
414 
419  virtual bool closeNoPrompt ();
420 
425  void setChanged ( bool flag = true );
426 
429  void setCaption ();
430 
434  void updateActions ();
435 
437  virtual void fileNew();
438 
444  void fileSave ();
445 
447  virtual void fileSaveAs ();
448 
451  virtual void fileSaveSelectedImages ();
452 
456  virtual void fileSaveSelectedImages( const std::string & filename );
457 
459  void saveAs ( const std::string & filename );
460 
462  void saveAllAs ( const std::string & filename );
463 
466  CanvasView * getCanvasView ();
467 
469  void addTextDisplay ( PlotterBase * plotter,
470  const std::string & type);
471 
474  void addTextDisplay ( PlotterBase * plotter,
475  const std::string & type,
476  const std::string & text);
477 
483  std::pair<double, double> addTextDisplayAt ( PlotterBase * plotter,
484  const std::string & type,
485  const std::string & text,
486  double xrel, double yrel);
487 
489  void addFuncDisplay ( PlotterBase * plotter, const std::string & name );
490 
495  void addPlotDisplay ( PlotterBase * plotter, bool select );
496 
498  void addDisplay ( PlotterBase * plotter );
499 
502  void removeDisplay ( PlotterBase * plotter );
503 
505  PlotterBase * selectedPlotter ();
506 
509  void clear();
510 
512  const std::vector < const ViewBase * > & views ();
513 
516  void fillPlotterList ( std::vector < PlotterBase * > & plotter_list );
517 
520  QtView * getViewFor ( const PlotterBase * plotter ) const;
521 
524  void setIntervalEnabled ( bool yes = true );
525 
536  void savePlotAsImage ( const PlotterBase * plotter,
537  const std::string & filename );
538 
546  void saveAsImage ( const PlotterBase * plotter,
547  const std::string & filename );
548 
550  void setAllSelected ( bool flag = true );
551 
553  void setSelected ( QtView * view );
554 
556  const std::vector<double> & mouseEventData();
557 
560  void print ( const std::string & filename );
561 
565  void setPlotMatrix ( unsigned int columns, unsigned int rows );
566 
569  const QString & getAppKey () const;
570 
573  void setAddedSelected ( bool yes );
574 
577  NTuple * getPickTable () const;
578 
581  NTuple * getPickTable ( const PlotterBase * plotter ) const;
582 
586  void autosaveSettings ();
587 
588 protected slots:
589 
592  virtual void fileBrowse();
593 
596  virtual void fileExit ();
597 
602  virtual void fileOpen ();
603 
604 };
605 
606 } // namespace hippodraw
607 
608 #endif // CanvasWindow_H
CanvasView * m_canvas_view
The CanvasView object which is the central widget.
Definition: CanvasWindow.h:122
The file created from CanvasWindowBase.ui with the Qt uic tool.
QString m_changed
The changed status part of the window title.
Definition: CanvasWindow.h:139
This class implements additional FigureEditor functionality particular to QtView objects.
Definition: CanvasView.h:96
#define MDL_QTHIPPOPLOT_API
Definition: libqthippo.h:36
The base class for the CanvasWindow class.
return yes
Definition: CanvasView.cxx:883
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
CanvasView * m_browsed_canvas
The CanvasView object that is being browsed.
Definition: CanvasWindow.h:126
bool m_filenameExists
True if filename has been assigned, false if not.
Definition: CanvasWindow.h:160
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
A class to handle various file types.
Definition: QtFileDialog.h:49
A derived class of PlotTableBase class which is generated by the Qt designer.
Definition: PlotTable.h:49
bool m_inhibit_close
A flag set to true if the CanvasWindow should not accept a close event.
Definition: CanvasWindow.h:152
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
Definition: QtView.h:41
bool m_hasChanged
The current changed status.
Definition: CanvasWindow.h:148
QString m_prefix
The prefix part of the window title.
Definition: CanvasWindow.h:133
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
std::string m_filename
The file name part of the window title.
Definition: CanvasWindow.h:136
XmlController * m_xml_controller
The controller object capable of serializing the canvas contents as XML and serializing them...
Definition: CanvasWindow.h:119
bool m_allow_close
A flag set to true to allow the window to close without prompting the user.
Definition: CanvasWindow.h:157
A base class that is the interface between GUI and the XML serialization and deserialization.
Definition: XmlController.h:53
QtFileDialog * m_file_dialog
The open file dialog for this window.
Definition: CanvasWindow.h:130
A concrete window class that contains the canvas and responds to menu item and tool bar events from t...
Definition: CanvasWindow.h:106
static PlotTable * s_plot_table
The singleton instance of PlotTable.
Definition: CanvasWindow.h:143

Generated for HippoDraw Class Library by doxygen