view editor/edwaveform.h @ 2208:90ec1ec89c56

Revamp the palette handling in lib64gfx somewhat, add helper functions to lib64util for handling external palette file options and add support for specifying one of the "internal" palettes or external (.act) palette file to gfxconv and 64vw.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 05:01:12 +0300
parents e2ac08228a0f
children
line wrap: on
line source

#ifndef EDWAVEFORM_H
#define EDWAVEFORM_H

#include <QWidget>
#include <QLabel>
#include "dmengine.h"

class QEDWaveTrackDisplay : public QWidget
{
    Q_OBJECT

public:
    QEDWaveTrackDisplay(QWidget *parent = 0);

    void setWaveform(void *mdata, int msize, int mformat, int mchannels, int mfreq);
    float getScaledWidth();
    void setScale(const float mscale);
    int getBps();
    float getDuration();
    float getTimeScale(float value);
    float getTimeFromCoord(float value);
    float getTime();
    float getOffset();

    QSize minimumSizeHint() const
    {
        return QSize(100, 60);
    }

    QSize sizeHint() const
    {
        return QSize(600, 60);
    }

public slots:
    void setTime(const float mtime);
    void setOffset(const float moffs);
    void setSelection(const float mstart, const float mend);
    void clearSelection();

signals:
    void selectionChanged(float mstart, float mduration);
    void timeChanged(float value);
    void offsetChanged(float value);

protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

    void paintEvent(QPaintEvent *event);

private:
    float scale, time, offs, duration; // in milliseconds
    int size, channels, format, freq, sduration;
    void *data;

    bool selectionValid;
    float selectionStart, selectionDuration;

    QPoint selectionPoint, dragPoint;
    bool selecting, dragging;
    float selectionOffs, dragOffs;
};


class QEDWaveTrackView : public QWidget
{
    Q_OBJECT

private:
    QEDWaveTrackDisplay *wave;
    QLabel *infoName, *infoData;

public:

    QEDWaveTrackView(QWidget *parent = 0);
    void setWaveform(void *mdata, int mlen, int mformat, int mchannels, int mfreq);
    void setName(QString name);
    void setTime(const float mtime);
    void setOffset(const float moffs);
    float getScaledWidth();
    void setScale(const float mscale);
    float getDuration();
    float getTime();
    float getOffset();

private slots:
    void slotTimeChanged(float value);
    void slotOffsetChanged(float value);

signals:
    void timeChanged(float value);
    void offsetChanged(float value);
};

#endif