1 /*!
2  * @file seqscreen.h
3  * @brief Header for the SeqScreen class
4  *
5  *
6  *      Copyright 2009 - 2017 <qmidiarp-devel@lists.sourceforge.net>
7  *
8  *      This program is free software; you can redistribute it and/or modify
9  *      it under the terms of the GNU General Public License as published by
10  *      the Free Software Foundation; either version 2 of the License, or
11  *      (at your option) any later version.
12  *
13  *      This program is distributed in the hope that it will be useful,
14  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *      GNU General Public License for more details.
17  *
18  *      You should have received a copy of the GNU General Public License
19  *      along with this program; if not, write to the Free Software
20  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  *      MA 02110-1301, USA.
22  *
23  */
24 #ifndef SEQSCREEN_H
25 #define SEQSCREEN_H
26 
27 #include "screen.h"
28 #include "midiworker.h"
29 
30 #define SEQSCR_MIN_W   180
31 #define SEQSCR_MIN_H   216
32 #define SEQSCR_VMARG    14
33 #define SEQSCR_HMARG    20
34 
35 /*! @brief Drawing widget for visualization of sequences using QPainter
36  *
37  * SeqScreen is created and embedded by SeqWidget. The painter callback
38  * produces a streak map of a waveform as a piano roll display. The
39  * display is updated by calling SeqScreen::updateData() with the
40  * Sample vector as argument followed by updateDraw().
41  * SeqScreen emits mouse events combining the Qt mousePressed()
42  * and mouseMoved() events. The mouse position is transferred as a
43  * double from 0 ... 1.0 representing the relative mouse position on the
44  * entire SeqScreen display area.
45  */
46 class SeqScreen : public Screen
47 {
48   Q_OBJECT
49 
50   private:
51     QVector<Sample> p_data, data;
52     int currentRecStep;
53     int baseOctave, nOctaves;
54     QPointF trg[3];
55     void emitMouseEvent(QMouseEvent *event, int pressed);
56 
57   protected:
58     virtual void paintEvent(QPaintEvent *);
59 
60   public:
61     SeqScreen();
62     int loopMarker;
63 
64   public slots:
65     void updateData(const QVector<Sample>& data);
66     void setCurrentRecStep(int currentRecStep);
67     void setLoopMarker(int pos);
68     void updateDispVert(int mode);
69 };
70 
71 #endif
72