Sequencer: Fix edit menu for phrase mode.

This commit is contained in:
Jonathan Moore Liles 2013-04-12 11:31:58 -07:00
parent 8101abafeb
commit 8001b1b2c1
2 changed files with 50 additions and 21 deletions

View File

@ -109,7 +109,7 @@ Function {init_colors()} {open private C return_type {static void}
} }
widget_class Visual_Metronome {open widget_class Visual_Metronome {open
xywh {1166 936 100 100} type Double visible xywh {1172 936 100 100} type Double visible
} { } {
Fl_Slider progress { Fl_Slider progress {
private xywh {139 115 1149 23} type Horizontal box FLAT_BOX color 7 selection_color 54 private xywh {139 115 1149 23} type Horizontal box FLAT_BOX color 7 selection_color 54
@ -121,6 +121,9 @@ widget_class Visual_Metronome {open
} { } {
code {if ( damage() & ~FL_DAMAGE_CHILD ) code {if ( damage() & ~FL_DAMAGE_CHILD )
{ {
if ( ! _bpb )
return;
int bw = w() / _bpb; int bw = w() / _bpb;
int b = _bpb; int b = _bpb;
@ -409,7 +412,7 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape )
if ( maybe_save_song() ) if ( maybe_save_song() )
quit();} open quit();} open
xywh {750 223 865 805} type Double color 47 resizable xywh {706 149 865 805} type Double color 47 resizable
code0 {o->color( FL_BACKGROUND_COLOR );} code0 {o->color( FL_BACKGROUND_COLOR );}
code1 {o->draw_overlay_callback( &UI::draw_overlay, this );} code1 {o->draw_overlay_callback( &UI::draw_overlay, this );}
code2 {o->xclass( APP_NAME );} code2 {o->xclass( APP_NAME );}
@ -776,7 +779,7 @@ o->maximum( phrase::phrases() );}
xywh {0 91 865 637} box FLAT_BOX color 37 labelsize 100 align 16 resizable xywh {0 91 865 637} box FLAT_BOX color 37 labelsize 100 align 16 resizable
class Canvas class Canvas
} }
Fl_Group pattern_settings_group {open Fl_Group pattern_settings_group {
xywh {0 731 865 54} box FLAT_BOX color 47 xywh {0 731 865 54} box FLAT_BOX color 47
} { } {
Fl_Input pattern_name_field { Fl_Input pattern_name_field {
@ -1048,7 +1051,7 @@ pattern_settings_group->redraw();}
xywh {45 759 140 18} type Horizontal labelsize 10 align 4 minimum 1 maximum 128 step 1 value 1 xywh {45 759 140 18} type Horizontal labelsize 10 align 4 minimum 1 maximum 128 step 1 value 1
} }
Fl_Button {} { Fl_Button {} {
label Select selected label Select
tooltip {Enable selection mode (you can also just hold down shift and drag the mouse)} xywh {260 735 45 45} type Toggle selection_color 5 labelsize 10 tooltip {Enable selection mode (you can also just hold down shift and drag the mouse)} xywh {260 735 45 45} type Toggle selection_color 5 labelsize 10
} }
} }
@ -1312,29 +1315,46 @@ ab.run();}
} { } {
MenuItem {} { MenuItem {} {
label {Add New} label {Add New}
callback {Grid *g = pattern_canvas_widget->grid()->create(); callback {Grid *g = current_canvas()->grid()->create();
pattern_canvas_widget->grid( g ); current_canvas()->grid( g );
update_pattern_widgets(); update_pattern_widgets();
update_sequence_widgets();} update_sequence_widgets();
update_phrase_widgets();}
xywh {0 0 34 18} shortcut 0x61 xywh {0 0 34 18} shortcut 0x61
} }
MenuItem {} { MenuItem {} {
label Previous label Previous
callback {pattern_number_spinner->value( max( 0, (int)pattern_number_spinner->value() - 1 ) ); callback {if ( tabs->value() == pattern_tab )
pattern_number_spinner->do_callback();} {
pattern_number_spinner->value( max( 0, (int)pattern_number_spinner->value() - 1 ) );
pattern_number_spinner->do_callback();
}
else
{
phrase_number_spinner->value( max( 0, (int)phrase_number_spinner->value() - 1 ) );
phrase_number_spinner->do_callback();
}}
xywh {10 10 34 18} shortcut 0x5b xywh {10 10 34 18} shortcut 0x5b
} }
MenuItem {} { MenuItem {} {
label Next label Next
callback {pattern_number_spinner->value( min( 127, (int)pattern_number_spinner->value() + 1 )); callback {if ( tabs->value() == pattern_tab )
pattern_number_spinner->do_callback();} {
pattern_number_spinner->value( min( 127, (int)pattern_number_spinner->value() + 1 ));
pattern_number_spinner->do_callback();
}
else
{
phrase_number_spinner->value( min( 127, (int)phrase_number_spinner->value() + 1 ));
phrase_number_spinner->do_callback();
}} selected
xywh {20 20 34 18} shortcut 0x5d xywh {20 20 34 18} shortcut 0x5d
} }
MenuItem {} { MenuItem {} {
label Duplicate label Duplicate
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid( w->grid()->clone() ); w->grid( w->grid()->clone() );
@ -1344,7 +1364,7 @@ ui->update_sequence_widgets();}
} }
MenuItem {} { MenuItem {} {
label {Duplicate Range} label {Duplicate Range}
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->duplicate_range(); w->duplicate_range();
@ -1354,14 +1374,14 @@ ui->update_sequence_widgets();}
} }
MenuItem {} { MenuItem {} {
label {Delete Selected} label {Delete Selected}
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->delete_selected();} w->grid()->delete_selected();}
xywh {50 50 34 18} shortcut 0xffff xywh {50 50 34 18} shortcut 0xffff
} }
MenuItem {} { MenuItem {} {
label Clear label Clear
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {60 60 34 18} shortcut 0x1ffff xywh {60 60 34 18} shortcut 0x1ffff
@ -1373,42 +1393,42 @@ w->grid()->clear();}
} }
MenuItem {} { MenuItem {} {
label {Select All} label {Select All}
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {70 70 34 18} shortcut 0x40061 xywh {70 70 34 18} shortcut 0x40061
} }
MenuItem {} { MenuItem {} {
label {Select None} label {Select None}
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {80 80 34 18} shortcut 0x50061 xywh {80 80 34 18} shortcut 0x50061
} }
MenuItem {} { MenuItem {} {
label {Invert Selection} label {Invert Selection}
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {90 90 34 18} shortcut 0x50069 xywh {90 90 34 18} shortcut 0x50069
} }
MenuItem {} { MenuItem {} {
label Copy label Copy
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {100 100 34 18} shortcut 0x40063 xywh {100 100 34 18} shortcut 0x40063
} }
MenuItem {} { MenuItem {} {
label Cut label Cut
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {110 110 34 18} shortcut 0x40078 xywh {110 110 34 18} shortcut 0x40078
} }
MenuItem {} { MenuItem {} {
label Paste label Paste
callback {Canvas *w = pattern_canvas_widget; callback {Canvas *w = current_canvas();
w->grid()->clear();} w->grid()->clear();}
xywh {120 120 34 18} shortcut 0x40076 xywh {120 120 34 18} shortcut 0x40076
@ -1710,6 +1730,13 @@ ie.set( i, n );
ie.run();} {} ie.run();} {}
} }
Function {current_canvas()} {open return_type {Canvas*}
} {
code {if ( tabs->value() == pattern_tab )
return pattern_canvas_widget;
else if ( tabs->value() == phrase_tab )
return phrase_canvas_widget;} {}
}
} }
class Instrument_Editor {} { class Instrument_Editor {} {

View File

@ -30,6 +30,8 @@
#include "pattern.H" #include "pattern.H"
#include "phrase.H" #include "phrase.H"
#include <signal.h> #include <signal.h>
#include <MIDI/midievent.H>
using namespace MIDI;
// extern const char *BUILD_ID; // extern const char *BUILD_ID;
// extern const char *VERSION; // extern const char *VERSION;