1 /* 2 Copyright (C) 2008, 2009 Andres Cabrera 3 mantaraya36@gmail.com 4 5 This file is part of CsoundQt. 6 7 CsoundQt is free software; you can redistribute it 8 and/or modify it under the terms of the GNU Lesser General Public 9 License as published by the Free Software Foundation; either 10 version 2.1 of the License, or (at your option) any later version. 11 12 CsoundQt is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with Csound; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20 02111-1307 USA 21 */ 22 23 #ifndef GRAPHICWINDOW_H 24 #define GRAPHICWINDOW_H 25 26 #ifdef USE_QT5 27 #include <QtWidgets> 28 #include <QtPrintSupport/QPrinter> 29 #include <QtPrintSupport/QPrintDialog> 30 #else 31 #include <QtGui> 32 #endif 33 34 class GraphicWindow : public QWidget 35 { 36 Q_OBJECT 37 public: 38 GraphicWindow(QWidget *parent); 39 40 ~GraphicWindow(); 41 42 void openPng(QString fileName); 43 44 private slots: 45 void zoomIn(); 46 void zoomOut(); 47 void normalSize(); 48 void fitToWindow(); 49 void save(); 50 void print(); 51 52 protected: 53 // virtual void closeEvent (QCloseEvent * event); 54 55 private: 56 // QGraphicsScene *m_scene; 57 void createActions(); 58 // void createMenus(); 59 void updateActions(); 60 void scaleImage(double factor); 61 void adjustScrollBar(QScrollBar *scrollBar, double factor); 62 63 QLabel *imageLabel; 64 QScrollArea *scrollArea; 65 double scaleFactor; 66 67 QPrinter printer; 68 69 QToolBar *m_toolbar; 70 // QAction *openAct; 71 QAction *saveAct; 72 QAction *printAct; 73 QAction *exitAct; 74 QAction *zoomInAct; 75 QAction *zoomOutAct; 76 QAction *normalSizeAct; 77 QAction *fitToWindowAct; 78 // QAction *aboutAct; 79 // QAction *aboutQtAct; 80 81 QMenu *fileMenu; 82 QMenu *viewMenu; 83 QMenu *helpMenu; 84 }; 85 86 #endif 87