forked from hselasky/midipp
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmidipp_scores.h
208 lines (173 loc) · 5.99 KB
/
midipp_scores.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*-
* Copyright (c) 2009-2019 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _MIDIPP_SCORES_H_
#define _MIDIPP_SCORES_H_
#include "midipp.h"
#include "midipp_element.h"
class MppScoreView : public QWidget
{
public:
MppScoreView(MppScoreMain *parent);
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
void wheelEvent(QWheelEvent *);
void keyPressEvent(QKeyEvent *);
int delta_v;
MppScoreMain *pScores;
};
class MppScoreTextEdit : public QPlainTextEdit
{
public:
MppScoreMain *sm;
MppScoreTextEdit(MppScoreMain *parent);
~MppScoreTextEdit(void);
void mouseDoubleClickEvent(QMouseEvent *e);
};
class MppScoreMain : public QObject
{
Q_OBJECT;
public:
MppScoreMain(MppMainWindow *parent, int unit);
~MppScoreMain();
void decrementDuration(int vel, uint32_t timeout);
void handleLabelJump(int label);
void handleChordsLoad(void);
void handleMidiKeyPressLocked(int key, int vel);
void handleMidiKeyReleaseLocked(int key, int vel);
void handleKeyPressChord(int key, int vel, uint32_t key_delay);
void handleKeyPressureChord(int key, int vel, uint32_t key_delay);
void handleKeyReleaseChord(int key, int vel, uint32_t key_delay);
void handleKeyPressSub(int, int, uint32_t, int, int);
void handleKeyPress(int key, int vel, uint32_t key_delay);
void handleKeyRelease(int key, int vel, uint32_t key_delay);
void handleParse(const QString &ps);
uint8_t handleKeyRemovePast(MppScoreEntry *pn, int vel, uint32_t key_delay);
void handleScoreFileOpenRaw(char *, uint32_t);
void handlePrintSub(QPrinter *pd, QPoint orig);
int handleScoreFileOpenSub(QString fname);
void outputChannelMaskGet(uint16_t *pmask);
void outputControl(uint8_t ctrl, uint8_t val);
void outputChanPressure(uint8_t pressure);
void outputPitch(uint16_t val);
int getCurrLabel(void);
void handleScoreFileEffect(int, int, int);
void handleEditLine(void);
void viewPaintEvent(QPaintEvent *event);
void viewMousePressEvent(QMouseEvent *e);
void locateVisual(MppElement *, int *, int *, MppVisualDot **);
void watchdog();
int checkLabelJump(int label);
int setPressedKey(int chan, int out_key, int dur, int delay);
MppHead head;
uint8_t auto_zero_start[0];
MppVisualScore *pVisual;
MppSheet *sheet;
MppGridLayout *gl_view;
QScrollBar *viewScroll;
MppScoreView *viewWidgetSub;
MppMainWindow *mainWindow;
MppScoreTextEdit *editWidget;
MppGroupBox *gbScoreFile;
QPushButton *butScoreFileNew;
QPushButton *butScoreFileOpen;
QPushButton *butScoreFileSave;
QPushButton *butScoreFileSaveAs;
QPushButton *butScoreFilePrint;
QPushButton *butScoreFileAlign;
QSpinBox *spnScoreFileBassOffset;
QPushButton *butScoreFileBassOffset;
MppSpinBox *spnScoreFileAlign;
QPushButton *butScoreFileScale;
QSpinBox *spnScoreFileScale;
QPushButton *butScoreFileStepUpHalf;
QPushButton *butScoreFileStepDownHalf;
QPushButton *butScoreFileStepUpSingle;
QPushButton *butScoreFileStepDownSingle;
QPushButton *butScoreFileSetSharp;
QPushButton *butScoreFileSetFlat;
QPushButton *butScoreFileExport;
QPushButton *butScoreFileExportNoChords;
QPushButton *butScoreFileReplaceAll;
QString *currScoreFileName;
QLabel *lblFileStatus;
QPicture *picChord[2];
MppScoreEntry score_past[MPP_MAX_CHORD_MAP];
MppScoreEntry score_future_base[MPP_MAX_CHORD_FUTURE];
MppScoreEntry score_future_treble[MPP_MAX_CHORD_FUTURE];
int visual_max;
int visual_p_max;
int unit;
uint64_t pressedKeys[MPP_PRESSED_MAX];
uint64_t frozenKeys[MPP_PRESSED_MAX];
int picScroll;
uint32_t active_channels;
int baseKey;
int whatPlayKeyLocked;
int chordTranspose;
int8_t inputChannel;
uint8_t synthChannel;
int8_t synthChannelBase;
int8_t synthChannelTreb;
int8_t auxChannel;
int8_t auxChannelBase;
int8_t auxChannelTreb;
int8_t synthDevice;
int8_t synthDeviceBase;
int8_t synthDeviceTreb;
uint8_t delayNoise;
uint8_t last_key;
uint8_t last_vel;
uint8_t keyMode;
uint8_t noteMode;
uint8_t pressed_future;
uint8_t chordContrast;
uint8_t chordNormalize;
uint8_t songEventsOn;
uint8_t auto_zero_end[0];
int visual_y_max;
QString editText;
public slots:
int handleCompile(int force = 0);
void handleScoreFileNew(int invisible = 0);
void handleScoreFileOpen();
void handleScoreFileSave();
void handleScoreFileSaveAs();
void handleScorePrint();
void handleScoreFileBassOffset(void);
void handleScoreFileAlign(void);
void handleScoreFileStepUpHalf(void);
void handleScoreFileStepDownHalf(void);
void handleScoreFileStepUpSingle(void);
void handleScoreFileStepDownSingle(void);
void handleScoreFileSetSharp(void);
void handleScoreFileSetFlat(void);
void handleScoreFileScale(void);
void handleScoreFileExport(void);
void handleScoreFileExportNoChords(void);
void handleScrollChanged(int value);
void handleScoreFileReplaceAll(void);
};
#endif /* _MIDIPP_SCORES_H_ */