DSRemote/signalcurve.h

185 wiersze
4.2 KiB
C

/*
***************************************************************************
*
* Author: Teunis van Beelen
*
2023-02-08 20:22:28 +00:00
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
2019-05-28 06:36:25 +00:00
* Email: teuniz@protonmail.com
*
***************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***************************************************************************
*/
#ifndef SIGNALCURVE_H
#define SIGNALCURVE_H
#include <QtGlobal>
#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPushButton>
#include <QPen>
#include <QString>
#include <QStringList>
#include <QFont>
#include <QTimer>
#include <QMutex>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mainwindow.h"
#include "global.h"
2015-06-27 09:04:41 +00:00
#include "connection.h"
#include "tmc_dev.h"
#include "utils.h"
class UI_Mainwindow;
class SignalCurve: public QWidget
{
Q_OBJECT
public:
SignalCurve(QWidget *parent=0);
QSize sizeHint() const {return minimumSizeHint(); }
QSize minimumSizeHint() const {return QSize(30,10); }
int label_active,
trig_line_visible;
unsigned int scr_update_cntr;
2015-06-10 13:29:45 +00:00
void setSignalColor1(QColor);
void setSignalColor2(QColor);
void setSignalColor3(QColor);
void setSignalColor4(QColor);
void setTraceWidth(int);
void setBackgroundColor(QColor);
void setRasterColor(QColor);
void setTextColor(QColor);
void setBorderSize(int);
2016-01-04 13:20:26 +00:00
void drawCurve(struct device_settings *, struct tmcdev *);
void clear();
void setUpdatesEnabled(bool);
void setTrigLineVisible(void);
2015-05-31 14:56:25 +00:00
void setDeviceParameters(struct device_settings *);
bool hasMoveEvent(void);
int print_to_image(const char *);
signals: void chan1Clicked();
void chan2Clicked();
void chan3Clicked();
void chan4Clicked();
private slots:
void trig_line_timer_handler();
void trig_stat_timer_handler();
private:
QMutex paint_mutex;
QColor SignalColor[MAX_CHNS],
BackgroundColor,
RasterColor,
TextColor;
QTimer *trig_line_timer,
*trig_stat_timer;
QFont smallfont;
2016-01-04 13:20:26 +00:00
double v_sense,
fft_v_sense,
fft_v_offset;
int bufsize,
bordersize,
tracewidth,
w,
h,
old_w,
updates_enabled,
chan_arrow_moving[MAX_CHNS],
trig_level_arrow_moving,
trig_pos_arrow_moving,
use_move_events,
chan_arrow_pos[MAX_CHNS],
chan_tmp_y_pixel_offset[MAX_CHNS],
chan_tmp_old_y_pixel_offset[MAX_CHNS],
trig_level_arrow_pos,
trig_pos_arrow_pos,
trig_stat_flash,
2016-01-05 16:13:11 +00:00
fft_arrow_pos,
fft_arrow_moving,
mouse_x,
mouse_y,
mouse_old_x,
mouse_old_y;
clock_t clk_start,
clk_end;
double cpu_time_used;
void drawWidget(QPainter *, int, int);
void drawArrow(QPainter *, int, int, int, QColor, char);
2015-06-04 15:24:31 +00:00
void drawSmallTriggerArrow(QPainter *, int, int, int, QColor);
void drawTrigCenterArrow(QPainter *, int, int);
void drawChanLabel(QPainter *, int, int, int);
void drawTopLabels(QPainter *);
2015-06-10 13:29:45 +00:00
void paintLabel(QPainter *, int, int, int, int, const char *, QColor);
2015-06-05 15:43:27 +00:00
void paintCounterLabel(QPainter *, int, int);
2017-05-14 16:16:49 +00:00
void paintPlaybackLabel(QPainter *, int, int);
2016-01-05 09:56:50 +00:00
void drawFFT(QPainter *, int, int);
void drawfpsLabel(QPainter *, int, int);
2016-12-03 22:37:04 +00:00
void draw_decoder(QPainter *, int, int);
int ascii_decode_control_char(char, char *, int);
struct device_settings *devparms;
struct tmcdev *device;
UI_Mainwindow *mainwindow;
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void resizeEvent(QResizeEvent *);
};
#endif