00001
00002
00016 #ifndef CanvasWindow_H
00017 #define CanvasWindow_H
00018
00019 #include <qglobal.h>
00020 #if QT_VERSION < 0x040000
00021 #include "CanvasWindowBase.h"
00022 #include <qcanvas.h>
00023 #else
00024 #include "CanvasWindowUI.h"
00025
00026 #include <q3canvas.h>
00027 #endif
00028
00029 #include <string>
00030 #include <vector>
00031 #include <utility>
00032
00033 class CanvasView;
00034 class QtFileDialog;
00035 class PlotterBase;
00036 class PlotTable;
00037 class QtView;
00038 class ViewBase;
00039 class XmlController;
00040
00041 class QCloseEvent;
00042 class QCustomEvent;
00043 class QHideEvent;
00044 class QResizeEvent;
00045 class QShowEvent;
00046
00047 class std::exception;
00048
00105 #if QT_VERSION < 0x040000
00106 class MDL_QTHIPPOPLOT_API CanvasWindow : public CanvasWindowBase
00107 {
00108 #else
00109 class MDL_QTHIPPOPLOT_API CanvasWindow : public Q3MainWindow,
00110 private Ui::CanvasWindowUI
00111 {
00112 Q_OBJECT
00113 #endif
00114
00115 private:
00116
00119 XmlController * m_xml_controller;
00120
00122 CanvasView * m_canvas_view;
00123
00126 CanvasView * m_browsed_canvas;
00127
00130 QtFileDialog * m_file_dialog;
00131
00133 QString m_prefix;
00134
00136 std::string m_filename;
00137
00139 QString m_changed;
00140
00143 static PlotTable * s_plot_table;
00144
00148 bool m_hasChanged;
00149
00152 bool m_inhibit_close;
00153
00157 bool m_allow_close;
00158
00160 bool m_filenameExists;
00161
00163 void setTitleFileName ( const std::string & name );
00164
00170 bool setFilenameFromDialog ();
00171
00176 bool areDataSourcesSaved ();
00177
00178 #if QT_VERSION < 0x040000
00179 protected:
00180 #else
00181 protected slots:
00182 #endif
00183
00193 virtual void windowActivationChange ( bool oldActive );
00194
00196 virtual void closeEvent ( QCloseEvent * e );
00197
00199 virtual void hideEvent ( QHideEvent * e );
00200
00202 virtual void showEvent ( QShowEvent * e );
00203
00205 virtual void resizeEvent ( QResizeEvent * );
00206
00207
00208
00213 virtual void filePrint ();
00214
00221 virtual void fileSaveAll();
00222
00227 virtual void fileSaveAllAs();
00228
00233 virtual void editClear ();
00234
00235 virtual void editCopy ();
00239 virtual void editCut ();
00240
00244 virtual void editDelete ();
00245
00246 virtual void editPaste ();
00247
00250 virtual void editReTile ();
00251
00254 virtual void editReTilePage ();
00255
00258 virtual void editSelectAll ();
00259
00262 virtual void editUndo ();
00263
00264 virtual void fileExportTextTuple ();
00265
00268 virtual void helpAbout ();
00269
00272 virtual void on_aboutQt_activated();
00273
00277 virtual void viewLock ();
00278
00282 virtual void viewUnlock ();
00283
00286 virtual void viewShowInspector ();
00287
00290 virtual void viewShowPlotTable ();
00291
00294 virtual void viewShowPickTable ();
00295
00299 void previousView ();
00300
00304 void nextView ();
00305
00308 virtual void setZoomMode ( );
00309
00312 virtual void settingCanvas ();
00313
00316 virtual void settingPrinter ();
00317
00320 virtual void settingFonts ();
00321
00323 virtual void viewZoomIn();
00324
00326 virtual void viewZoomOut();
00327
00330 virtual void viewZoomReset();
00331
00333 virtual void viewAddPage();
00334
00335 public:
00336
00339 #if QT_VERSION < 0x040000
00340 CanvasWindow ( QWidget * parent = 0,
00341 const char * name = 0,
00342 Qt::WFlags fl = Qt::WType_TopLevel );
00343 #else
00344 CanvasWindow ( QWidget * parent = 0 );
00345 #endif
00346
00350 CanvasWindow ( const CanvasWindow & );
00351
00352 virtual ~CanvasWindow();
00353
00356 static void resetFontSize ();
00357
00359 void initFromFile ( const std::string & filename );
00360
00364 virtual void customEvent ( QCustomEvent * event );
00365
00368 void inhibitClose ( bool yes = true );
00369
00373 void setAllowClose ( bool yes = true );
00374
00378 bool allowClose ();
00379
00384 virtual bool closeNoPrompt ();
00385
00390 void setChanged ( bool flag = true );
00391
00394 void setCaption ();
00395
00399 void updateActions ();
00400
00402 virtual void fileNew();
00403
00409 void fileSave ();
00410
00412 virtual void fileSaveAs ();
00413
00416 virtual void fileSaveSelectedImages ();
00417
00421 virtual void fileSaveSelectedImages( const std::string & filename );
00422
00424 void saveAs ( const std::string & filename );
00425
00427 void saveAllAs ( const std::string & filename );
00428
00431 CanvasView * getCanvasView ();
00432
00434 void addTextDisplay ( PlotterBase * plotter,
00435 const std::string & type);
00436
00439 void addTextDisplay ( PlotterBase * plotter,
00440 const std::string & type,
00441 const std::string & text);
00442
00448 std::pair<double, double> addTextDisplayAt ( PlotterBase * plotter,
00449 const std::string & type,
00450 const std::string & text,
00451 double xrel, double yrel);
00452
00454 void addFuncDisplay ( PlotterBase * plotter, const std::string & name );
00455
00460 void addPlotDisplay ( PlotterBase * plotter );
00461
00466 void addPlotDisplay ( PlotterBase * plotter, bool select );
00467
00469 void addDisplay ( PlotterBase * plotter );
00470
00473 void removeDisplay ( PlotterBase * plotter );
00474
00476 PlotterBase * selectedPlotter ();
00477
00480 void clear();
00481
00483 const std::vector < const ViewBase * > & views ();
00484
00487 void fillPlotterList ( std::vector < PlotterBase * > & plotter_list );
00488
00491 QtView * getViewFor ( const PlotterBase * plotter ) const;
00492
00495 void setIntervalEnabled ( bool yes = true );
00496
00507 void savePlotAsImage ( const PlotterBase * plotter,
00508 const std::string & filename );
00509
00517 void saveAsImage ( const PlotterBase * plotter,
00518 const std::string & filename );
00519
00522 void savePlotAsImageImmediate ( const PlotterBase * plotter,
00523 const std::string & filename );
00524
00526 void setAllSelected ( bool flag = true );
00527
00529 void setSelected ( QtView * view );
00530
00532 const std::vector<double> & mouseEventData();
00533
00536 void print ( const std::string & filename );
00537
00541 void setPlotMatrix ( unsigned int columns, unsigned int rows );
00542
00545 void setAddedSelected ( bool yes );
00546
00547 protected slots:
00548
00551 virtual void on_fileBrowse_actived();
00552
00555 virtual void on_fileExit_activated ();
00556
00561 virtual void on_fileOpen_activated ();
00562
00563 };
00564
00565 #endif // CanvasWindow_H