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
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: dcanvas.h,v 1.8.2.2 2009/02/02 21:38:00 terminator356 Exp $
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//
// 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; version 2 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=========================================================
#ifndef __DCANVAS_H__
#define __DCANVAS_H__
#include "ecanvas.h"
#include "song.h"
#include "steprec.h"
#define TH 18
class QResizeEvent;
class QDragEnterEvent;
class QDropEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class MidiEditor;
//---------------------------------------------------------
// DEvent
// ''visual'' Drum Event
//---------------------------------------------------------
class DEvent : public MusEWidget::CItem {
public:
DEvent(Event e, Part* p);
};
class ScrollScale;
class PianoRoll;
//---------------------------------------------------------
// DrumCanvas
//---------------------------------------------------------
class DrumCanvas : public EventCanvas {
Q_OBJECT
StepRec* steprec;
// Cursor tool position
QPoint cursorPos;
int _stepSize;
virtual void drawCanvas(QPainter&, const QRect&);
virtual void drawItem(QPainter&, const MusEWidget::CItem*, const QRect&);
void drawTopItem(QPainter& p, const QRect& rect);
virtual void drawMoving(QPainter&, const MusEWidget::CItem*, const QRect&);
virtual Undo moveCanvasItems(MusEWidget::CItemList&, int, int, DragType);
virtual UndoOp moveItem(MusEWidget::CItem*, const QPoint&, DragType);
virtual MusEWidget::CItem* newItem(const QPoint&, int);
virtual void resizeItem(MusEWidget::CItem*, bool, bool);
virtual void newItem(MusEWidget::CItem*, bool);
virtual void newItem(MusEWidget::CItem*, bool, bool replace );
virtual bool deleteItem(MusEWidget::CItem*);
MusEWidget::CItem* newItem(int tick, int instrument, int velocity);
int y2pitch(int y) const;
int pitch2y(int pitch) const;
void startDrag(MusEWidget::CItem*, bool copymode);
void dragEnterEvent(QDragEnterEvent* event);
void dragMoveEvent(QDragMoveEvent*);
void dragLeaveEvent(QDragLeaveEvent*);
virtual void addItem(Part*, Event&);
virtual void resizeEvent(QResizeEvent*);
virtual void curPartChanged();
int getNextStep(unsigned int pos, int basicStep, int stepSize=1);
signals:
void newWidth(int);
private slots:
void midiNote(int pitch, int velo);
public slots:
void mapChanged(int, int);
void keyPressed(int, int);
void keyReleased(int, bool);
void setTool2(int);
void setCurDrumInstrument(int);
virtual void setStep(int);
void moveAwayUnused();
public:
enum {
CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_SAVE, CMD_LOAD, CMD_RESET,
CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO,
CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST
};
DrumCanvas(MidiEditor*, QWidget*, int, int,
const char* name = 0);
void cmd(int);
virtual void modifySelected(MusEWidget::NoteInfo::ValType type, int delta);
virtual void keyPress(QKeyEvent* event);
Event *getEventAtCursorPos();
void selectCursorEvent(Event *ev);
};
#endif
|