forked from dliganov/Chaotic-DAW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Awful_CursorAndMouse.h
192 lines (182 loc) · 5.4 KB
/
Awful_CursorAndMouse.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
#ifndef CURSOR_H
#define CURSOR_H
#include "awful.h"
class Cursor
{
public:
CursMode mode;
CursType type;
Loc loc;
float qsize;
Element* curElem;
PEdit* curParam;
NoteInstance* slideparent;
Pattern* patt; // Only derived pattern can be referred here. No originator.
Pattern* tmp_patt;
Loc tmp_loc;
float tmp_tick;
int tmp_line;
int trknum;
Trk* trk;
Trk* maintrk;
int last_note;
char last_char;
float fieldposx;
int fieldposy;
float staticposx;
int staticposy;
float lastslidelength;
int pianokey_num;
int pianokey_keybound;
bool pianokey_pressed;
Cursor();
void SetPattern(Pattern* pattern, Loc location);
void SetPatternContext(int mouse_x, int mouse_y);
void PlaceCursor();
void AdvanceView(float dtick, int dline);
void AdvanceTick(float dtick);
void AdvanceLine(int dline);
void SetPos(float tick, int line);
void PosUpdate();
void PatternUpdate();
void SaveState();
void RestoreState();
Element* CheckVisibility();
void ExitPerClickInAnotherGridPlace();
void ExitToDefaultMode();
void ExitToCurrentMode();
void ExitToNoteMode(Instrument* instr, int note_num);
void ExitToSlidingMode(Element* parent, int note_num);
SlideNote* PlaceSlideNote(char character, unsigned flags);
void PosAndCursor2Mouse(int mx, int my);
};
typedef enum LastClicked
{
LastClicked_Nothing,
LastClicked_Instrument,
LastClicked_Grid,
LastClicked_Effect
}LastClicked;
class Mouse
{
public:
__int64 mmode;
LastClicked lastclick;
SelMode selmode;
BrwType btype;
int brwindex;
Command* active_command;
Control* active_ctrl;
Control* lasthintctrl;
Pattern* patt;
SlideNote* active_slide;
Instrument* active_instr;
Instrument* dropinstr1;
Instrument* dropinstr2;
Eff* dropeff1;
Eff* dropeff2;
Envelope* active_env;
EnvPnt* active_pnt;
EnvAction env_action;
float env_xstart;
PEdit* active_paramedit;
FileData* active_filedata;
Element* active_elem;
Element* resize_elem;
Samplent* active_samplent;
GenNote* active_longnote;
Mixcell* active_mixcell;
Mixcell* active_dropmixcell;
MixChannel* active_mixchannel;
bool on_effects;
Eff* active_effect;
MixChannel* active_dropmixchannel;
bool mixcellindexing;
bool auxcellindexing;
DigitStr* active_paramfx;
Numba* active_numba;
Panel* active_panel;
Menu* active_menu;
bool skip_menu;
bool patternbrush;
ResizeElem resize_object;
Loc resize_loc;
bool v_only;
LaneType active_lane;
int current_track_num;
Trk* current_trk;
int current_line;
float current_tick;
int current_pt_line;
float current_pt_tick;
TrkBunch* track_bunch;
DragData drag_data;
int dragcount;
bool selstarted;
bool loostarted;
RectEdge edge;
bool LMB; // left mouse button is pressed (if true)
bool RMB; // right mouse button is pressed (if true)
bool bypass_element_activating;
bool menu_active;
bool at_definer;
Loc loc;
Loc lineloc;
Loc delloc;
Loc brushloc;
bool quanting;
bool on_keys;
int pianokey_num;
bool pianokey_pressed;
int pianokey_slot;
float pianokey_vol;
Menu* contextmenu;
bool prbunch;
int mouse_x;
int mouse_y;
int prev_x;
int prev_y;
float snappedTick;
int snappedLine;
float dragTick;
int dragLine;
float movetick;
int moveline;
float lpx;
int lpy;
bool prepianorolling;
bool pickedup;
Loc pickloc;
Loc selloc;
Loc looloc;
bool hint_active;
bool mousefix;
bool bpmbig;
float brushbasetick;
float brushwidth;
BrushMode brushmode;
float adtick;
float adtrack;
float qsize;
bool holding;
Mouse();
void PosUpdate(int mx, int my, unsigned flags, bool reset = false);
void CalcPosition(int mx, int my);
void CalcTickAndLine(int mx, int my, float* tick, int* line, Loc cloc);
void PosCheck(int mx, int my);
void CheckGridStuff(int mx, int my);
void CheckGridElements(int mx, int my);
void CheckAuxMixerStuff(int mx, int my);
void* IsMouseOnBunch(int mx, int my);
bool IsMouseOnMixer(int mx, int my);
bool IsMouseOnLiner(int mx, int my);
bool IsMouseOnAux(int mx, int my);
bool IsMouseOnInstrPane(int mx, int my);
bool IsMouseOnStaticGrid(int mx, int my);
bool IsMouseOnSmallGrid(int mx, int my);
bool IsMouseOnMainGrid(int mx, int my);
void ClickActiveElement(int mx, int my, bool dbclick, unsigned flags);
bool IsOnEdge();
void DeleteContextMenu();
};
#endif CURSOR_H