File indexing completed on 2024-12-01 08:18:24

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef OSCILLOSCOPEVIEW_H
0012 #define OSCILLOSCOPEVIEW_H
0013 
0014 #include <QFrame>
0015 
0016 class Oscilloscope;
0017 class Simulator;
0018 class QMouseEvent;
0019 class QPaintEvent;
0020 class QPixmap;
0021 class QTimer;
0022 
0023 /**
0024 @author David Saxton
0025 */
0026 class OscilloscopeView : public QFrame
0027 {
0028     Q_OBJECT
0029 public:
0030     OscilloscopeView(QWidget *parent);
0031     ~OscilloscopeView() override;
0032 
0033 public slots:
0034     /**
0035      * Sets the needRedraw flag to true, and then class repaint
0036      */
0037     void updateView();
0038     void slotSetFrameRate(QAction *);
0039 
0040 protected slots:
0041     void updateViewTimeout();
0042 
0043 protected:
0044     void mousePressEvent(QMouseEvent *event) override;
0045     void mouseMoveEvent(QMouseEvent *event) override;
0046     void mouseReleaseEvent(QMouseEvent *event) override;
0047     void paintEvent(QPaintEvent *event) override;
0048     void resizeEvent(QResizeEvent *event) override;
0049 
0050     void drawLogicData(QPainter &p);
0051     void drawFloatingData(QPainter &p);
0052     void updateOutputHeight();
0053     void updateTimeLabel();
0054 
0055     bool b_needRedraw;
0056     QPixmap *m_pixmap;
0057     QTimer *m_updateViewTmr;
0058     int m_fps;
0059     int m_sliderValueAtClick;
0060     int m_clickOffsetPos;
0061     Simulator *m_pSimulator;
0062     double m_halfOutputHeight;
0063 };
0064 
0065 #endif