Fixed bug that crashed on saving after importing.
[epichord.git] / src / ui.cpp
blobc2d33434a7d7f618a9b5de3afebc8538f34e917a
1 // generated by Fast Light User Interface Designer (fluid) version 2.1000
3 #include "ui.h"
4 /*
5 Epichord - a midi sequencer
6 Copyright (C) 2008 Evan Rinehart
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to
21 The Free Software Foundation, Inc.
22 51 Franklin Street, Fifth Floor
23 Boston, MA 02110-1301, USA
25 #include <stdlib.h>
26 #include <fltk/events.h>
27 #include <fltk/file_chooser.h>
28 #include "backend.h"
29 #include "util.h"
30 #include "uihelper.h"
31 #include "config.h"
32 extern UI* ui;
34 inline void UI::cb_main_window_i(fltk::Window* o, void*) {
35 config_window->hide();
36 help_window->hide();
37 action_window->hide();
38 scope_window->hide();
39 o->hide();
41 save_config();
43 void UI::cb_main_window(fltk::Window* o, void* v) {
44 ((UI*)(o->user_data()))->cb_main_window_i(o,v);
47 inline void UI::cb_line_i(fltk::Button*, void*) {
48 ui->track_info->toggle_controls();
50 void UI::cb_line(fltk::Button* o, void* v) {
51 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_line_i(o,v);
54 inline void UI::cb_event_menu_button_i(fltk::Button* o, void*) {
55 if(o->state()==0){
56 ui->event_menu->hide();
57 ui->event_edit->show();
59 else{
60 ui->event_edit->hide();
61 ui->event_edit->recount_has();
62 ui->event_menu->show();
65 void UI::cb_event_menu_button(fltk::Button* o, void* v) {
66 ((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_event_menu_button_i(o,v);
69 inline void UI::cb_L_i(fltk::Button* o, void*) {
70 ui->event_edit->label_flag = o->state();
71 ui->event_edit->redraw();
73 void UI::cb_L(fltk::Button* o, void* v) {
74 ((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_L_i(o,v);
77 inline void UI::cb_C_i(fltk::Button*, void*) {
78 ui->event_edit->clear_events();
80 void UI::cb_C(fltk::Button* o, void* v) {
81 ((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_C_i(o,v);
84 inline void UI::cb_X_i(fltk::Button*, void*) {
85 ui->event_edit->clear_non_note_events();
87 void UI::cb_X(fltk::Button* o, void* v) {
88 ((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_X_i(o,v);
91 inline void UI::cb_Z_i(fltk::Button*, void*) {
92 ui->event_edit->clear_all_events();
94 void UI::cb_Z(fltk::Button* o, void* v) {
95 ((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Z_i(o,v);
98 inline void UI::cb__i(fltk::Button*, void*) {
99 show_song_edit();
101 void UI::cb_(fltk::Button* o, void* v) {
102 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb__i(o,v);
105 inline void UI::cb_play_button_i(fltk::Button*, void*) {
106 press_play();
108 void UI::cb_play_button(fltk::Button* o, void* v) {
109 ((UI*)(o->parent()->parent()->user_data()))->cb_play_button_i(o,v);
112 inline void UI::cb_stop_button_i(fltk::Button*, void*) {
113 press_stop();
115 void UI::cb_stop_button(fltk::Button* o, void* v) {
116 ((UI*)(o->parent()->parent()->user_data()))->cb_stop_button_i(o,v);
119 inline void UI::cb_record_button_i(fltk::Button*, void*) {
120 toggle_backend_recording();
122 void UI::cb_record_button(fltk::Button* o, void* v) {
123 ((UI*)(o->parent()->parent()->user_data()))->cb_record_button_i(o,v);
126 inline void UI::cb_qbutton4_i(fltk::Button*, void*) {
127 set_quant(4);
129 void UI::cb_qbutton4(fltk::Button* o, void* v) {
130 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton4_i(o,v);
133 inline void UI::cb_qbutton8_i(fltk::Button*, void*) {
134 set_quant(8);
136 void UI::cb_qbutton8(fltk::Button* o, void* v) {
137 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton8_i(o,v);
140 inline void UI::cb_qbutton16_i(fltk::Button*, void*) {
141 set_quant(16);
143 void UI::cb_qbutton16(fltk::Button* o, void* v) {
144 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton16_i(o,v);
147 inline void UI::cb_qbutton32_i(fltk::Button*, void*) {
148 set_quant(32);
150 void UI::cb_qbutton32(fltk::Button* o, void* v) {
151 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton32_i(o,v);
154 inline void UI::cb_qbutton64_i(fltk::Button*, void*) {
155 set_quant(64);
157 void UI::cb_qbutton64(fltk::Button* o, void* v) {
158 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton64_i(o,v);
161 inline void UI::cb_qbutton128_i(fltk::Button*, void*) {
162 set_quant(128);
164 void UI::cb_qbutton128(fltk::Button* o, void* v) {
165 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton128_i(o,v);
168 inline void UI::cb_qbutton0_i(fltk::Button*, void*) {
169 set_quant(0);
171 void UI::cb_qbutton0(fltk::Button* o, void* v) {
172 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_qbutton0_i(o,v);
175 inline void UI::cb_tool_button_i(fltk::Button*, void*) {
176 toggle_tool();
178 void UI::cb_tool_button(fltk::Button* o, void* v) {
179 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_tool_button_i(o,v);
182 inline void UI::cb_color_toggle_i(fltk::Button* o, void*) {
183 arranger->color_flag = o->state();
185 void UI::cb_color_toggle(fltk::Button* o, void* v) {
186 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_color_toggle_i(o,v);
189 inline void UI::cb_loop_toggle_i(fltk::Button*, void*) {
190 toggle_loop();
192 void UI::cb_loop_toggle(fltk::Button* o, void* v) {
193 ((UI*)(o->parent()->parent()->user_data()))->cb_loop_toggle_i(o,v);
196 inline void UI::cb_config_button_i(fltk::Button* o, void*) {
197 if(o->state()){
198 ui->config_window->show();
200 else{
201 ui->config_window->hide();
204 void UI::cb_config_button(fltk::Button* o, void* v) {
205 ((UI*)(o->parent()->parent()->user_data()))->cb_config_button_i(o,v);
208 inline void UI::cb_scope_button_i(fltk::Button* o, void*) {
209 if(o->state()){
210 ui->scope_window->show();
212 else{
213 ui->scope_window->hide();
216 void UI::cb_scope_button(fltk::Button* o, void* v) {
217 ((UI*)(o->parent()->parent()->user_data()))->cb_scope_button_i(o,v);
220 inline void UI::cb_file_button_i(fltk::Button* o, void*) {
221 if(o->state()){
222 ui->action_window->show();
224 else{
225 ui->action_window->hide();
228 void UI::cb_file_button(fltk::Button* o, void* v) {
229 ((UI*)(o->parent()->parent()->user_data()))->cb_file_button_i(o,v);
232 inline void UI::cb_help_button_i(fltk::Button* o, void*) {
233 if(o->state()){
234 ui->help_window->show();
236 else{
237 ui->help_window->hide();
240 void UI::cb_help_button(fltk::Button* o, void* v) {
241 ((UI*)(o->parent()->parent()->user_data()))->cb_help_button_i(o,v);
244 inline void UI::cb_beats_per_measure_i(fltk::ValueInput* o, void*) {
245 if(o->value() > o->maximum())
246 o->value(o->maximum());
247 if(o->value() < o->minimum())
248 o->value(o->minimum());
249 set_beats_per_measure((int)o->value());
251 void UI::cb_beats_per_measure(fltk::ValueInput* o, void* v) {
252 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_beats_per_measure_i(o,v);
255 inline void UI::cb_measures_per_phrase_i(fltk::ValueInput* o, void*) {
256 if(o->value() > o->maximum())
257 o->value(o->maximum());
258 if(o->value() < o->minimum())
259 o->value(o->minimum());
260 set_measures_per_phrase((int)o->value());
262 void UI::cb_measures_per_phrase(fltk::ValueInput* o, void* v) {
263 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_measures_per_phrase_i(o,v);
266 inline void UI::cb_bpm_wheel_i(fltk::ThumbWheel* o, void*) {
267 set_bpm((int)o->value());
268 ui->bpm_output->value(o->value());
270 void UI::cb_bpm_wheel(fltk::ThumbWheel* o, void* v) {
271 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_bpm_wheel_i(o,v);
274 inline void UI::cb_measures_until_record_i(fltk::ValueInput* o, void*) {
275 if(o->value() > o->maximum())
276 o->value(o->maximum());
277 if(o->value() < o->minimum())
278 o->value(o->minimum());
279 set_measures_until_record((int)o->value());
281 void UI::cb_measures_until_record(fltk::ValueInput* o, void* v) {
282 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_measures_until_record_i(o,v);
285 inline void UI::cb_check_alwayscopy_i(fltk::CheckButton* o, void*) {
286 set_alwayscopy(o->value());
288 void UI::cb_check_alwayscopy(fltk::CheckButton* o, void* v) {
289 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_alwayscopy_i(o,v);
292 inline void UI::cb_check_autotrackname_i(fltk::CheckButton* o, void*) {
293 set_autotrackname(o->value());
295 void UI::cb_check_autotrackname(fltk::CheckButton* o, void* v) {
296 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_autotrackname_i(o,v);
299 inline void UI::cb_check_passthru_i(fltk::CheckButton* o, void*) {
300 set_passthru(o->value());
302 void UI::cb_check_passthru(fltk::CheckButton* o, void* v) {
303 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_passthru_i(o,v);
306 inline void UI::cb_check_playinsert_i(fltk::CheckButton* o, void*) {
307 set_playinsert(o->value());
309 void UI::cb_check_playinsert(fltk::CheckButton* o, void* v) {
310 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_playinsert_i(o,v);
313 inline void UI::cb_check_recordonchan_i(fltk::CheckButton* o, void*) {
314 set_recordonchan(o->value());
316 void UI::cb_check_recordonchan(fltk::CheckButton* o, void* v) {
317 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_recordonchan_i(o,v);
320 inline void UI::cb_check_playmove_i(fltk::CheckButton* o, void*) {
321 set_playmove(o->value());
323 void UI::cb_check_playmove(fltk::CheckButton* o, void* v) {
324 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_playmove_i(o,v);
327 inline void UI::cb_check_follow_i(fltk::CheckButton* o, void*) {
328 set_follow(o->value());
330 void UI::cb_check_follow(fltk::CheckButton* o, void* v) {
331 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_check_follow_i(o,v);
334 inline void UI::cb_default_velocity_i(fltk::ValueInput* o, void*) {
335 if(o->value() > o->maximum())
336 o->value(o->maximum());
337 if(o->value() < o->minimum())
338 o->value(o->minimum());
339 set_defaultvelocity((int)o->value());
341 void UI::cb_default_velocity(fltk::ValueInput* o, void* v) {
342 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_default_velocity_i(o,v);
345 inline void UI::cb_merge_i(fltk::Item*, void*) {
346 set_recordmode(0);
348 void UI::cb_merge(fltk::Item* o, void* v) {
349 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_merge_i(o,v);
352 inline void UI::cb_overwrite_i(fltk::Item*, void*) {
353 set_recordmode(1);
355 void UI::cb_overwrite(fltk::Item* o, void* v) {
356 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_overwrite_i(o,v);
359 inline void UI::cb_layer_i(fltk::Item*, void*) {
360 set_recordmode(2);
362 void UI::cb_layer(fltk::Item* o, void* v) {
363 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_layer_i(o,v);
366 inline void UI::cb_do_i(fltk::Item*, void*) {
367 set_robmode(0);
369 void UI::cb_do(fltk::Item* o, void* v) {
370 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_do_i(o,v);
373 inline void UI::cb_new_i(fltk::Item*, void*) {
374 set_robmode(1);
376 void UI::cb_new(fltk::Item* o, void* v) {
377 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_new_i(o,v);
380 inline void UI::cb_extend_i(fltk::Item*, void*) {
381 set_robmode(2);
383 void UI::cb_extend(fltk::Item* o, void* v) {
384 ((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_extend_i(o,v);
387 inline void UI::cb_kg_l10_i(KeyGrabber*, void*) {
390 void UI::cb_kg_l10(KeyGrabber* o, void* v) {
391 ((UI*)(o->parent()->parent()->parent()->user_data()))->cb_kg_l10_i(o,v);
394 inline void UI::cb_new1_i(fltk::Button*, void*) {
395 reset_song();
397 void UI::cb_new1(fltk::Button* o, void* v) {
398 ((UI*)(o->parent()->user_data()))->cb_new1_i(o,v);
401 inline void UI::cb_save_i(fltk::Button*, void*) {
402 action_window->hide();
403 save();
405 void UI::cb_save(fltk::Button* o, void* v) {
406 ((UI*)(o->parent()->user_data()))->cb_save_i(o,v);
409 inline void UI::cb_save1_i(fltk::Button*, void*) {
410 action_window->hide();
411 save(fltk::file_chooser("save file",NULL,get_last_dir()));
413 void UI::cb_save1(fltk::Button* o, void* v) {
414 ((UI*)(o->parent()->user_data()))->cb_save1_i(o,v);
417 inline void UI::cb_load_i(fltk::Button*, void*) {
418 action_window->hide();
419 if(load(fltk::file_chooser("open file",NULL,get_last_dir()))<0){
420 reset_song();
423 void UI::cb_load(fltk::Button* o, void* v) {
424 ((UI*)(o->parent()->user_data()))->cb_load_i(o,v);
427 inline void UI::cb_import_i(fltk::Button*, void*) {
428 action_window->hide();
429 if(loadsmf(fltk::file_chooser("import file",NULL,get_last_dir()))<0){
430 reset_song();
433 void UI::cb_import(fltk::Button* o, void* v) {
434 ((UI*)(o->parent()->user_data()))->cb_import_i(o,v);
437 inline void UI::cb_export_i(fltk::Button*, void*) {
438 action_window->hide();
439 savesmf(fltk::file_chooser("export file",NULL,get_last_dir()));
441 void UI::cb_export(fltk::Button* o, void* v) {
442 ((UI*)(o->parent()->user_data()))->cb_export_i(o,v);
445 inline void UI::cb_on_i(fltk::Button* o, void*) {
446 if(o->state()){
447 turnonscope();
449 else{
450 turnoffscope();
453 void UI::cb_on(fltk::Button* o, void* v) {
454 ((UI*)(o->parent()->parent()->user_data()))->cb_on_i(o,v);
457 UI::UI() {
458 fltk::Window* w;
459 {fltk::Window* o = main_window = new fltk::Window(640, 480, "Epichord");
460 o->shortcut(0xff1b);
461 o->callback((fltk::Callback*)cb_main_window, (void*)(this));
462 o->begin();
463 {fltk::Group* o = new fltk::Group(0, 0, 640, 445);
464 o->begin();
465 {fltk::Group* o = song_edit = new fltk::Group(0, 0, 640, 445);
466 o->begin();
467 {fltk::Group* o = new fltk::Group(0, 0, 255, 445);
468 o->set_vertical();
469 o->box(fltk::FLAT_BOX);
470 o->begin();
471 {TrackInfo* o = track_info = new TrackInfo(0, 15, 255, 415, "track info");
472 o->set_vertical();
473 fltk::Group::current()->resizable(o);
475 {fltk::Button* o = new fltk::Button(0, 0, 255, 15, "@line");
476 o->callback((fltk::Callback*)cb_line);
478 o->end();
480 {fltk::Group* o = new fltk::Group(255, 0, 385, 15);
481 o->begin();
482 {Timeline* o = song_timeline = new Timeline(0, 0, 370, 15, "timeline");
483 fltk::Group::current()->resizable(o);
484 o->scale=16;
485 o->label_scale=4;
487 o->end();
489 {CustomScroll* o = song_scroll = new CustomScroll(255, 15, 385, 430);
490 o->set_vertical();
491 o->begin();
492 {Arranger* o = arranger = new Arranger(0, 0, 245, 220, "arranger");
493 o->box(fltk::FLAT_BOX);
494 o->resize(1000,30*16);
496 o->end();
497 o->type(fltk::ScrollGroup::BOTH_ALWAYS);
498 fltk::Group::current()->resizable(o);
500 o->end();
502 {fltk::Group* o = pattern_edit = new fltk::Group(0, 0, 640, 445);
503 o->hide();
504 o->begin();
505 {fltk::Group* o = new fltk::Group(45, 0, 595, 445);
506 o->begin();
507 {fltk::Group* o = new fltk::Group(0, 0, 595, 15);
508 o->begin();
509 {Timeline* o = pattern_timeline = new Timeline(0, 0, 580, 15, "timeline");
510 o->box(fltk::FLAT_BOX);
511 fltk::Group::current()->resizable(o);
512 o->edit_flag = 1;
514 o->end();
516 {fltk::ScrollGroup* o = pattern_scroll = new fltk::ScrollGroup(0, 15, 595, 355);
517 o->box(fltk::FLAT_BOX);
518 o->shortcut(0xff1b);
519 o->when(fltk::WHEN_CHANGED);
520 o->begin();
521 {PianoRoll* o = piano_roll = new PianoRoll(0, 0, 595, 355, "pianoroll");
522 o->box(fltk::FLAT_BOX);
523 fltk::Group::current()->resizable(o);
524 o->resize(960,900);
526 o->end();
527 o->type(fltk::ScrollGroup::BOTH_ALWAYS);
528 fltk::Group::current()->resizable(o);
530 {fltk::Group* o = new fltk::Group(0, 370, 595, 75);
531 o->begin();
532 {EventEdit* o = event_edit = new EventEdit(0, 0, 580, 75, "event editor");
533 o->box(fltk::FLAT_BOX);
535 {EventMenu* o = event_menu = new EventMenu(0, 0, 580, 75);
536 o->box(fltk::FLAT_BOX);
537 o->hide();
539 {fltk::Button* o = event_menu_button = new fltk::Button(580, 0, 15, 15, "E");
540 o->callback((fltk::Callback*)cb_event_menu_button);
541 o->tooltip("pick event type");
542 o->type(fltk::Button::TOGGLE);
544 {fltk::Button* o = new fltk::Button(580, 15, 15, 15, "L");
545 o->callback((fltk::Callback*)cb_L);
546 o->tooltip("toggle event value labels");
547 o->type(fltk::Button::TOGGLE);
549 {fltk::Button* o = new fltk::Button(580, 30, 15, 15, "C");
550 o->callback((fltk::Callback*)cb_C);
551 o->tooltip("clear these events");
553 {fltk::Button* o = new fltk::Button(580, 45, 15, 15, "X");
554 o->callback((fltk::Callback*)cb_X);
555 o->tooltip("clear all non note events in pattern");
557 {fltk::Button* o = new fltk::Button(580, 60, 15, 15, "Z");
558 o->labelcolor((fltk::Color)0xff000000);
559 o->callback((fltk::Callback*)cb_Z);
560 o->tooltip("clear everything");
562 o->end();
564 o->end();
565 fltk::Group::current()->resizable(o);
567 {fltk::Group* o = new fltk::Group(0, 0, 45, 445);
568 o->begin();
569 new fltk::Button(0, 0, 45, 15, "@line");
570 {fltk::Group* o = new fltk::Group(0, 15, 45, 340);
571 o->set_vertical();
572 o->begin();
573 {TrackSelect* o = track_select = new TrackSelect(0, 35, 45, 305, "track picker");
574 o->set_vertical();
576 {SampleView* o = sample_view = new SampleView(0, 35, 45, 305, "sample names");
577 o->set_vertical();
579 {Keyboard* o = keyboard = new Keyboard(0, 0, 45, 340, "keyboard");
580 o->set_vertical();
582 o->end();
583 fltk::Group::current()->resizable(o);
585 {fltk::Button* o = new fltk::Button(0, 370, 45, 75, "@<-");
586 o->set_vertical();
587 o->callback((fltk::Callback*)cb_);
589 o->end();
591 o->end();
593 o->end();
594 fltk::Group::current()->resizable(o);
596 {fltk::Group* o = new fltk::Group(0, 445, 640, 35);
597 o->box(fltk::UP_BOX);
598 o->begin();
599 {fltk::Button* o = play_button = new fltk::Button(5, 5, 25, 25, "@>");
600 o->labelcolor((fltk::Color)0x800000);
601 o->callback((fltk::Callback*)cb_play_button);
603 {fltk::Button* o = stop_button = new fltk::Button(35, 5, 25, 25, "@square");
604 o->labelcolor((fltk::Color)0x800000);
605 o->callback((fltk::Callback*)cb_stop_button);
607 {fltk::Button* o = record_button = new fltk::Button(65, 5, 25, 25, "@circle");
608 o->labelcolor((fltk::Color)0xff000000);
609 o->callback((fltk::Callback*)cb_record_button);
610 o->type(fltk::Button::TOGGLE);
612 {Metronome* o = metronome = new Metronome(95, 5, 25, 25, "0");
613 o->color((fltk::Color)56);
614 o->labelcolor((fltk::Color)0xffffff00);
616 {fltk::Group* o = new fltk::Group(200, 0, 20, 35);
617 o->set_vertical();
618 fltk::Group::current()->resizable(o);
620 {fltk::Group* o = pattern_buttons = new fltk::Group(145, 5, 310, 25);
621 o->hide();
622 o->begin();
623 {fltk::Button* o = qbutton4 = new fltk::Button(135, 0, 25, 25);
624 o->callback((fltk::Callback*)cb_qbutton4);
625 o->type(fltk::Button::TOGGLE);
627 {fltk::Button* o = qbutton8 = new fltk::Button(160, 0, 25, 25);
628 o->callback((fltk::Callback*)cb_qbutton8);
629 o->type(fltk::Button::TOGGLE);
631 {fltk::Button* o = qbutton16 = new fltk::Button(185, 0, 25, 25);
632 o->callback((fltk::Callback*)cb_qbutton16);
633 o->type(fltk::Button::TOGGLE);
634 o->state(1);
636 {fltk::Button* o = qbutton32 = new fltk::Button(210, 0, 25, 25);
637 o->callback((fltk::Callback*)cb_qbutton32);
638 o->type(fltk::Button::TOGGLE);
640 {fltk::Button* o = qbutton64 = new fltk::Button(235, 0, 25, 25);
641 o->callback((fltk::Callback*)cb_qbutton64);
642 o->type(fltk::Button::TOGGLE);
644 {fltk::Button* o = qbutton128 = new fltk::Button(260, 0, 25, 25);
645 o->callback((fltk::Callback*)cb_qbutton128);
646 o->type(fltk::Button::TOGGLE);
648 {fltk::Button* o = qbutton0 = new fltk::Button(285, 0, 25, 25);
649 o->callback((fltk::Callback*)cb_qbutton0);
650 o->type(fltk::Button::TOGGLE);
652 {fltk::Button* o = quant1_button = new fltk::Button(15, 0, 25, 25, "qua");
653 o->tooltip("quantize selected notes");
655 {fltk::Button* o = quant0_button = new fltk::Button(45, 0, 25, 25, "qu_");
656 o->tooltip("quantize length of selected notes");
658 {fltk::Button* o = tool_button = new fltk::Button(75, 0, 25, 25, "tool");
659 o->callback((fltk::Callback*)cb_tool_button);
661 o->end();
663 {fltk::Group* o = song_buttons = new fltk::Group(340, 5, 115, 25);
664 o->begin();
665 {fltk::Button* o = color_toggle = new fltk::Button(0, 0, 25, 25);
666 o->callback((fltk::Callback*)cb_color_toggle);
667 o->tooltip("color tool");
668 o->type(fltk::Button::TOGGLE);
670 {fltk::Button* o = unclone_button = new fltk::Button(30, 0, 25, 25, "dclo");
671 o->tooltip("unclone selected block");
673 {fltk::Button* o = join_button = new fltk::Button(60, 0, 25, 25, "join");
674 o->tooltip("join selected blocks");
676 {fltk::Button* o = split_button = new fltk::Button(90, 0, 25, 25, "split");
677 o->tooltip("split selected block");
679 o->end();
681 {fltk::Button* o = loop_toggle = new fltk::Button(490, 5, 25, 25);
682 o->callback((fltk::Callback*)cb_loop_toggle);
683 o->tooltip("toggle looping");
684 o->type(fltk::Button::TOGGLE);
686 {fltk::Button* o = config_button = new fltk::Button(520, 5, 25, 25, "conf");
687 o->callback((fltk::Callback*)cb_config_button);
688 o->tooltip("configuration");
689 o->type(fltk::Button::TOGGLE);
691 {fltk::Button* o = scope_button = new fltk::Button(550, 5, 25, 25);
692 o->callback((fltk::Callback*)cb_scope_button);
693 o->tooltip("scope");
694 o->type(fltk::Button::TOGGLE);
696 {fltk::Button* o = file_button = new fltk::Button(580, 5, 25, 25);
697 o->callback((fltk::Callback*)cb_file_button);
698 o->tooltip("disk");
699 o->type(fltk::Button::TOGGLE);
701 {fltk::Button* o = help_button = new fltk::Button(610, 5, 25, 25);
702 o->callback((fltk::Callback*)cb_help_button);
703 o->tooltip("help");
704 o->type(fltk::Button::TOGGLE);
706 o->end();
708 o->end();
709 o->size_range(640,455);
710 o->resize(640,455);
712 {fltk::Window* o = config_window = new fltk::Window(320, 285, "controls");
713 o->shortcut(0xff1b);
714 o->user_data((void*)(this));
715 o->begin();
716 {fltk::TabGroup* o = new fltk::TabGroup(0, 0, 320, 285);
717 o->begin();
718 {fltk::Group* o = new fltk::Group(145, 15, 170, 265, "options");
719 o->begin();
720 {fltk::ValueInput* o = beats_per_measure = new fltk::ValueInput(5, 5, 45, 20, "beats per measure");
721 o->minimum(1);
722 o->maximum(31);
723 o->step(1);
724 o->value(4);
725 o->callback((fltk::Callback*)cb_beats_per_measure);
727 {fltk::ValueInput* o = measures_per_phrase = new fltk::ValueInput(5, 30, 45, 20, "measures per phrase");
728 o->maximum(128);
729 o->step(1);
730 o->value(4);
731 o->callback((fltk::Callback*)cb_measures_per_phrase);
733 {fltk::ValueOutput* o = bpm_output = new fltk::ValueOutput(5, 55, 45, 20, "bpm");
734 o->minimum(1);
735 o->maximum(1000);
736 o->step(1);
737 o->value(120);
739 {fltk::ThumbWheel* o = bpm_wheel = new fltk::ThumbWheel(55, 55, 105, 20);
740 o->minimum(1);
741 o->maximum(1000);
742 o->step(1);
743 o->value(120);
744 o->callback((fltk::Callback*)cb_bpm_wheel);
745 o->align(fltk::ALIGN_LEFT);
747 {fltk::ValueInput* o = measures_until_record = new fltk::ValueInput(5, 80, 45, 20, "measures until record");
748 o->maximum(128);
749 o->step(1);
750 o->value(1);
751 o->callback((fltk::Callback*)cb_measures_until_record);
753 {fltk::CheckButton* o = check_alwayscopy = new fltk::CheckButton(5, 105, 25, 25, "always hard copy");
754 o->callback((fltk::Callback*)cb_check_alwayscopy);
755 o->align(fltk::ALIGN_LEFT);
756 o->tooltip("instead of making a linked clone when you copy a block in the song view.");
758 {fltk::CheckButton* o = check_autotrackname = new fltk::CheckButton(145, 105, 25, 25, "auto track name");
759 o->callback((fltk::Callback*)cb_check_autotrackname);
760 o->align(fltk::ALIGN_LEFT);
761 o->tooltip("Fill in GM instruments for track names when you change the program.");
763 {fltk::CheckButton* o = check_passthru = new fltk::CheckButton(5, 130, 25, 26, "record pass-thru");
764 o->set_flag(fltk::STATE);
765 o->callback((fltk::Callback*)cb_check_passthru);
766 o->align(fltk::ALIGN_LEFT);
767 o->tooltip("Echo midi input to midi output.");
769 {fltk::CheckButton* o = check_playinsert = new fltk::CheckButton(145, 130, 25, 26, "play note insertion");
770 o->set_flag(fltk::STATE);
771 o->callback((fltk::Callback*)cb_check_playinsert);
772 o->align(fltk::ALIGN_LEFT);
773 o->tooltip("Send midi note on when you create notes.");
775 {fltk::CheckButton* o = check_recordonchan = new fltk::CheckButton(5, 155, 25, 25, "record on channel");
776 o->callback((fltk::Callback*)cb_check_recordonchan);
777 o->align(fltk::ALIGN_LEFT);
778 o->tooltip("Record on first track that matches channel of midi input instead of selected \
779 track.");
781 {fltk::CheckButton* o = check_playmove = new fltk::CheckButton(145, 155, 25, 26, "play note move");
782 o->set_flag(fltk::STATE);
783 o->callback((fltk::Callback*)cb_check_playmove);
784 o->align(fltk::ALIGN_LEFT);
785 o->tooltip("Send midi note on when you move notes.");
787 {fltk::CheckButton* o = check_follow = new fltk::CheckButton(5, 179, 25, 26, "follow playback");
788 o->set_flag(fltk::STATE);
789 o->callback((fltk::Callback*)cb_check_follow);
790 o->align(fltk::ALIGN_LEFT);
791 o->tooltip("Auto scroll horizontally when play head leaves viewing area.");
793 {fltk::ValueInput* o = default_velocity = new fltk::ValueInput(120, 180, 45, 20, "default velocity");
794 o->maximum(127);
795 o->step(1);
796 o->value(96);
797 o->callback((fltk::Callback*)cb_default_velocity);
799 {fltk::Choice* o = menu_recordmode = new fltk::Choice(5, 210, 160, 25, "record mode");
800 o->begin();
801 {fltk::Item* o = new fltk::Item("merge");
802 o->callback((fltk::Callback*)cb_merge);
804 {fltk::Item* o = new fltk::Item("overwrite");
805 o->callback((fltk::Callback*)cb_overwrite);
807 {fltk::Item* o = new fltk::Item("layer");
808 o->callback((fltk::Callback*)cb_layer);
810 o->end();
812 {fltk::Choice* o = menu_rob = new fltk::Choice(5, 240, 160, 25, "record outside block");
813 o->begin();
814 {fltk::Item* o = new fltk::Item("do nothing");
815 o->callback((fltk::Callback*)cb_do);
817 {fltk::Item* o = new fltk::Item("new block");
818 o->callback((fltk::Callback*)cb_new);
820 {fltk::Item* o = new fltk::Item("extend block");
821 o->callback((fltk::Callback*)cb_extend);
823 o->end();
825 o->end();
827 {fltk::Group* o = new fltk::Group(0, 15, 320, 270, "keyboard");
828 o->hide();
829 o->begin();
830 {KeyGrabber* o = kg_l0 = new KeyGrabber(35, 5, 45, 15, "C0");
831 o->align(fltk::ALIGN_LEFT);
833 {KeyGrabber* o = kg_l1 = new KeyGrabber(35, 20, 45, 15, "C#0");
834 o->align(fltk::ALIGN_LEFT);
836 {KeyGrabber* o = kg_l2 = new KeyGrabber(35, 35, 45, 15, "D0");
837 o->align(fltk::ALIGN_LEFT);
839 {KeyGrabber* o = kg_l3 = new KeyGrabber(35, 50, 45, 15, "D#0");
840 o->align(fltk::ALIGN_LEFT);
842 {KeyGrabber* o = kg_l4 = new KeyGrabber(35, 65, 45, 15, "E0");
843 o->align(fltk::ALIGN_LEFT);
845 {KeyGrabber* o = kg_l5 = new KeyGrabber(35, 80, 45, 15, "F0");
846 o->align(fltk::ALIGN_LEFT);
848 {KeyGrabber* o = kg_l6 = new KeyGrabber(35, 95, 45, 15, "F#0");
849 o->align(fltk::ALIGN_LEFT);
851 {KeyGrabber* o = kg_l7 = new KeyGrabber(35, 110, 45, 15, "G0");
852 o->align(fltk::ALIGN_LEFT);
854 {KeyGrabber* o = kg_l8 = new KeyGrabber(35, 125, 45, 15, "G#0");
855 o->align(fltk::ALIGN_LEFT);
857 {KeyGrabber* o = kg_l9 = new KeyGrabber(35, 140, 45, 15, "A0");
858 o->align(fltk::ALIGN_LEFT);
860 {KeyGrabber* o = kg_l10 = new KeyGrabber(35, 155, 45, 15, "A#0");
861 o->callback((fltk::Callback*)cb_kg_l10);
862 o->align(fltk::ALIGN_LEFT);
864 {KeyGrabber* o = kg_l11 = new KeyGrabber(35, 170, 45, 15, "B0");
865 o->align(fltk::ALIGN_LEFT);
867 {KeyGrabber* o = kg_l12 = new KeyGrabber(35, 185, 45, 15, "C1");
868 o->align(fltk::ALIGN_LEFT);
870 {KeyGrabber* o = kg_l13 = new KeyGrabber(35, 200, 45, 15, "C#1");
871 o->align(fltk::ALIGN_LEFT);
873 {KeyGrabber* o = kg_l14 = new KeyGrabber(35, 215, 45, 15, "D1");
874 o->align(fltk::ALIGN_LEFT);
876 {KeyGrabber* o = kg_l15 = new KeyGrabber(35, 230, 45, 15, "D#1");
877 o->align(fltk::ALIGN_LEFT);
879 {KeyGrabber* o = kg_l16 = new KeyGrabber(35, 245, 45, 15, "E1");
880 o->align(fltk::ALIGN_LEFT);
882 {KeyGrabber* o = kg_u0 = new KeyGrabber(130, 5, 45, 15, "C1");
883 o->align(fltk::ALIGN_LEFT);
885 {KeyGrabber* o = kg_u1 = new KeyGrabber(130, 20, 45, 15, "C#1");
886 o->align(fltk::ALIGN_LEFT);
888 {KeyGrabber* o = kg_u2 = new KeyGrabber(130, 35, 45, 15, "D1");
889 o->align(fltk::ALIGN_LEFT);
891 {KeyGrabber* o = kg_u3 = new KeyGrabber(130, 50, 45, 15, "D#1");
892 o->align(fltk::ALIGN_LEFT);
894 {KeyGrabber* o = kg_u4 = new KeyGrabber(130, 65, 45, 15, "E1");
895 o->align(fltk::ALIGN_LEFT);
897 {KeyGrabber* o = kg_u5 = new KeyGrabber(130, 80, 45, 15, "F1");
898 o->align(fltk::ALIGN_LEFT);
900 {KeyGrabber* o = kg_u6 = new KeyGrabber(130, 95, 45, 15, "F#1");
901 o->align(fltk::ALIGN_LEFT);
903 {KeyGrabber* o = kg_u7 = new KeyGrabber(130, 110, 45, 15, "G1");
904 o->align(fltk::ALIGN_LEFT);
906 {KeyGrabber* o = kg_u8 = new KeyGrabber(130, 125, 45, 15, "G#1");
907 o->align(fltk::ALIGN_LEFT);
909 {KeyGrabber* o = kg_u9 = new KeyGrabber(130, 140, 45, 15, "A1");
910 o->align(fltk::ALIGN_LEFT);
912 {KeyGrabber* o = kg_u10 = new KeyGrabber(130, 155, 45, 15, "A#1");
913 o->align(fltk::ALIGN_LEFT);
915 {KeyGrabber* o = kg_u11 = new KeyGrabber(130, 170, 45, 15, "B1");
916 o->align(fltk::ALIGN_LEFT);
918 {KeyGrabber* o = kg_u12 = new KeyGrabber(130, 185, 45, 15, "C2");
919 o->align(fltk::ALIGN_LEFT);
921 {KeyGrabber* o = kg_u13 = new KeyGrabber(130, 200, 45, 15, "C#2");
922 o->align(fltk::ALIGN_LEFT);
924 {KeyGrabber* o = kg_u14 = new KeyGrabber(130, 215, 45, 15, "D2");
925 o->align(fltk::ALIGN_LEFT);
927 {KeyGrabber* o = kg_u15 = new KeyGrabber(130, 230, 45, 15, "D#2");
928 o->align(fltk::ALIGN_LEFT);
930 {KeyGrabber* o = kg_u16 = new KeyGrabber(130, 245, 45, 15, "E2");
931 o->align(fltk::ALIGN_LEFT);
933 {KeyGrabber* o = kg_u17 = new KeyGrabber(265, 5, 45, 15, "F2");
934 o->align(fltk::ALIGN_LEFT);
936 {KeyGrabber* o = kg_u18 = new KeyGrabber(265, 20, 45, 15, "F#2");
937 o->align(fltk::ALIGN_LEFT);
939 {KeyGrabber* o = kg_u19 = new KeyGrabber(265, 35, 45, 15, "G2");
940 o->align(fltk::ALIGN_LEFT);
942 {KeyGrabber* o = kg_u20 = new KeyGrabber(265, 50, 45, 15, "G#2");
943 o->align(fltk::ALIGN_LEFT);
945 {KeyGrabber* o = kg_zi = new KeyGrabber(265, 65, 45, 15, "zoom in");
946 o->align(fltk::ALIGN_LEFT);
948 {KeyGrabber* o = kg_zo = new KeyGrabber(265, 80, 45, 15, "zoom out");
949 o->align(fltk::ALIGN_LEFT);
951 {KeyGrabber* o = kg_ou = new KeyGrabber(265, 95, 45, 15, "octave up");
952 o->align(fltk::ALIGN_LEFT);
954 {KeyGrabber* o = kg_od = new KeyGrabber(265, 110, 45, 15, "octave down");
955 o->align(fltk::ALIGN_LEFT);
957 o->end();
959 o->end();
961 o->end();
962 o->resizable(o);
964 {fltk::Window* o = help_window = new fltk::Window(580, 370, "help");
965 o->shortcut(0xff1b);
966 o->user_data((void*)(this));
967 o->begin();
968 {fltk::TabGroup* o = new fltk::TabGroup(0, 0, 580, 370);
969 o->begin();
970 {fltk::Group* o = new fltk::Group(0, 25, 580, 345, "info");
971 o->begin();
972 title_text = new fltk::Input(55, 5, 520, 20, "Title");
973 author_text = new fltk::Input(55, 30, 520, 20, "Author");
974 {fltk::TextEditor* o = info_text = new fltk::TextEditor(5, 55, 570, 285);
975 o->textfont(fltk::COURIER);
976 fltk::Group::current()->resizable(o);
978 o->end();
979 fltk::Group::current()->resizable(o);
981 {fltk::Group* o = new fltk::Group(0, 25, 580, 345, "controls");
982 o->hide();
983 o->begin();
984 {fltk::TextDisplay* o = new fltk::TextDisplay(5, 5, 570, 335);
985 o->textfont(fltk::COURIER);
986 fltk::Group::current()->resizable(o);
987 load_text(o,ROOT_DATA_DIR"doc/controls.txt");
989 o->end();
991 {fltk::Group* o = new fltk::Group(0, 25, 580, 345, "guide");
992 o->hide();
993 o->begin();
994 {fltk::TextDisplay* o = new fltk::TextDisplay(5, 5, 570, 335);
995 o->textfont(fltk::COURIER);
996 fltk::Group::current()->resizable(o);
997 load_text(o,ROOT_DATA_DIR"doc/guide.txt");
999 o->end();
1001 {fltk::Group* o = new fltk::Group(0, 25, 580, 345, "license");
1002 o->hide();
1003 o->begin();
1004 {fltk::TextDisplay* o = new fltk::TextDisplay(5, 5, 570, 335);
1005 o->textfont(fltk::COURIER);
1006 fltk::Group::current()->resizable(o);
1007 load_text(o,ROOT_DATA_DIR"doc/license.txt");
1009 o->end();
1011 {fltk::Group* o = new fltk::Group(0, 25, 580, 345, "about");
1012 o->hide();
1013 o->begin();
1014 {fltk::TextDisplay* o = new fltk::TextDisplay(5, 5, 570, 335);
1015 o->textfont(fltk::COURIER);
1016 fltk::Group::current()->resizable(o);
1017 load_text(o,ROOT_DATA_DIR"doc/README");
1019 o->end();
1021 o->end();
1023 o->end();
1024 o->size_range(580,370);
1025 o->resizable(o);
1027 {fltk::Window* o = action_window = new fltk::Window(100, 130, "menu");
1028 o->shortcut(0xff1b);
1029 o->user_data((void*)(this));
1030 o->begin();
1031 {fltk::Button* o = new fltk::Button(5, 5, 90, 20, "new");
1032 o->callback((fltk::Callback*)cb_new1);
1034 {fltk::Button* o = new fltk::Button(5, 25, 90, 20, "save");
1035 o->callback((fltk::Callback*)cb_save);
1037 {fltk::Button* o = new fltk::Button(5, 45, 90, 20, "save as");
1038 o->callback((fltk::Callback*)cb_save1);
1040 {fltk::Button* o = new fltk::Button(5, 65, 90, 20, "load");
1041 o->callback((fltk::Callback*)cb_load);
1043 {fltk::Button* o = new fltk::Button(5, 85, 90, 20, "import");
1044 o->callback((fltk::Callback*)cb_import);
1046 {fltk::Button* o = new fltk::Button(5, 105, 90, 20, "export");
1047 o->callback((fltk::Callback*)cb_export);
1049 o->end();
1051 {fltk::Window* o = scope_window = new fltk::Window(425, 280, "scope");
1052 w = o;
1053 o->shortcut(0xff1b);
1054 o->user_data((void*)(this));
1055 o->begin();
1056 {fltk::TextDisplay* o = scope = new fltk::TextDisplay(5, 5, 415, 245);
1057 o->textfont(fltk::COURIER);
1058 o->color((fltk::Color)0x280000);
1059 o->textcolor((fltk::Color)0xff0000);
1060 fltk::Group::current()->resizable(o);
1061 o->wrap_mode(1);
1063 {fltk::Group* o = new fltk::Group(5, 255, 410, 20);
1064 o->begin();
1065 {fltk::Button* o = new fltk::Button(0, 0, 40, 20, "on");
1066 o->callback((fltk::Callback*)cb_on);
1067 o->type(fltk::Button::TOGGLE);
1069 {fltk::InvisibleBox* o = new fltk::InvisibleBox(45, 0, 95, 20);
1070 fltk::Group::current()->resizable(o);
1072 o->end();
1074 o->end();
1076 loop_toggle->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/loop.gif"));
1077 color_toggle->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/color.gif"));
1078 scope_button->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/conf.gif"));
1079 file_button->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/file.gif"));
1080 help_button->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/help.gif"));
1082 qbutton4->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q4.gif"));
1083 qbutton8->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q8.gif"));
1084 qbutton16->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q16.gif"));
1085 qbutton32->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q32.gif"));
1086 qbutton64->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q64.gif"));
1087 qbutton128->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q128.gif"));
1088 qbutton0->image(fltk::SharedImage::get(ROOT_DATA_DIR"gfx/q0.gif"));
1089 track_info->set_rec(0);
1090 start_monitor();
1091 main_window->show();