Fixed right to left line tool in event editor. Again.
[epichord.git] / src / eventedit.h
blob91ea406eacbf7df2d8d66c4b14e2ce807ea5a6f8
1 /*
2 Epichord - a midi sequencer
3 Copyright (C) 2008 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
23 #ifndef eventedit_h
24 #define eventedit_h
26 #include <vector>
28 class EventEdit : public fltk::Widget {
30 int event_type;
31 int controller_type;
33 int tick2xpix(int tick);
35 const char* event_type_name();
36 void event_type_next();
37 void event_type_prev();
40 int q_tick;
42 int line_flag;
43 int line_t1;
44 int line_M1;
45 int line_t2;
46 int line_M2;
47 int line_x1;
48 int line_x2;
49 int line_y1;
50 int line_y2;
52 int box_flag;
53 int box_x1;
54 int box_y1;
55 int box_x2;
56 int box_y2;
57 int box_t1;
58 int box_t2;
59 int box_m1;
60 int box_m2;
62 int insert_flag;
63 int insert_x;
64 int insert_y;
65 int insert_t;
66 int insert_M;
68 int paste_flag;
69 int paste_x;
70 int paste_t;
72 int delete_flag;
73 int delete_t1;
74 int delete_t2;
75 int delete_x1;
76 int delete_x2;
78 int xpix2tick(int xpix);
79 int ypix2mag(int ypix);
80 int mag2ypix(int mag);
81 int mag2val(int mag);
82 int val2mag(int val);
84 int quantize(int tick);
86 void apply_line();
87 void apply_box();
88 void apply_insert();
89 void apply_delete();
90 void apply_paste();
91 int match_event_type(mevent* e);
92 void get_event_color(mevent* e,fltk::Color*,fltk::Color*,fltk::Color*);
93 void get_event_value(int* v1, int* v2);
94 int get_event_mag(mevent* e);
96 void delete_events(int (EventEdit::*pred)(mevent* e));
98 int delete_type_in_range_pred(mevent* e);
99 int delete_type_all_pred(mevent* e);
100 int delete_all_non_note_pred(mevent* e);
101 int delete_all_pred(mevent* e);
105 public:
107 int label_flag;
109 seqpat* cur_seqpat;
110 track* cur_track;
112 int zoom;
114 int scroll;
116 EventEdit(int x, int y, int w, int h, const char* label);
117 int handle(int event);
118 void draw();
120 void load(seqpat* s);
121 void set_qtick(int q){q_tick=q;}
123 void clear_events();
124 void clear_non_note_events();
125 void clear_all_events();
127 void clear_selected_events();
128 void clear_selection();
129 void set_event_type(int type, int controller);
131 void recount_has();
132 int has[134];
134 int select_flag;
138 #endif