2007-12-18 05:09:02 +01:00
|
|
|
# data file for the Fltk User Interface Designer (fluid)
|
|
|
|
version 1.0107
|
|
|
|
header_name {.H}
|
|
|
|
code_name {.C}
|
|
|
|
comment {//
|
|
|
|
// Copyright (C) 2008 Jonathan Moore Liles
|
|
|
|
//
|
|
|
|
// 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
} {in_source in_header
|
|
|
|
}
|
|
|
|
|
|
|
|
decl {\#include "../grid.H"} {}
|
|
|
|
|
|
|
|
decl {\#include "../scale.H"} {}
|
|
|
|
|
|
|
|
decl {extern Fl_Color velocity_colors[];} {}
|
|
|
|
|
|
|
|
decl {class Event_Widget;} {public
|
|
|
|
}
|
|
|
|
|
|
|
|
class Event_Editor {open
|
|
|
|
} {
|
|
|
|
decl {int _h;} {}
|
|
|
|
decl {Grid *_grid;} {}
|
|
|
|
decl {event_list *_old;} {}
|
|
|
|
decl {event_list *_el;} {}
|
|
|
|
decl {int _y;} {}
|
|
|
|
Function {make_window( Grid *g )} {open
|
|
|
|
} {
|
|
|
|
Fl_Window window {
|
|
|
|
label {Event Editor}
|
|
|
|
callback {delete _el;
|
|
|
|
|
|
|
|
_grid->events( _old );
|
|
|
|
|
|
|
|
delete _old;
|
|
|
|
|
2008-02-13 02:37:26 +01:00
|
|
|
_el = _old = NULL;
|
|
|
|
|
|
|
|
o->hide();
|
|
|
|
|
|
|
|
Fl::delete_widget( o );} open selected
|
2007-12-18 05:09:02 +01:00
|
|
|
xywh {704 82 659 803} type Double box DOWN_BOX resizable
|
|
|
|
code0 {\#include "event_edit.H"}
|
|
|
|
code1 {\#include "../grid.H"}
|
|
|
|
code2 {\#include "../event_list.H"} modal size_range {0 0 659 803} visible
|
|
|
|
} {
|
|
|
|
Fl_Pack {} {
|
|
|
|
label {Event List} open
|
|
|
|
xywh {10 23 640 738} type HORIZONTAL
|
|
|
|
} {
|
|
|
|
Fl_Scroll scroll_w {open
|
|
|
|
xywh {10 24 620 737} type HORIZONTAL box DOWN_BOX labeltype NO_LABEL resizable
|
|
|
|
} {
|
|
|
|
Fl_Pack pack {open
|
|
|
|
xywh {10 24 620 737} when 6 resizable
|
|
|
|
} {}
|
|
|
|
}
|
|
|
|
Fl_Scrollbar scroll_bar {
|
|
|
|
user_data this user_data_type {Event_Editor*}
|
|
|
|
callback {v->scroll( o->value() );
|
|
|
|
v->update_widgets();}
|
|
|
|
xywh {629 23 20 738} when 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Return_Button {} {
|
|
|
|
label {&Save}
|
|
|
|
callback {delete window;
|
|
|
|
delete _el;
|
|
|
|
delete _old;}
|
|
|
|
xywh {489 771 76 25}
|
|
|
|
}
|
|
|
|
Fl_Button {} {
|
|
|
|
label {&Discard}
|
|
|
|
callback {window->do_callback();}
|
|
|
|
xywh {575 771 74 25}
|
|
|
|
}
|
|
|
|
Fl_Button {} {
|
|
|
|
label Del
|
|
|
|
user_data this user_data_type {Event_Editor *}
|
|
|
|
callback {_el->remove_selected();
|
|
|
|
|
|
|
|
sync();}
|
|
|
|
xywh {10 771 74 25} shortcut 0xffff color 88
|
|
|
|
}
|
|
|
|
Fl_Menu_Button {} {
|
|
|
|
label {&Insert}
|
|
|
|
user_data this user_data_type {Event_Editor *}
|
|
|
|
callback {if ( o->value() == 0 )
|
|
|
|
{
|
|
|
|
// note;
|
|
|
|
|
|
|
|
event *on = new event;
|
|
|
|
event *off = new event;
|
|
|
|
|
|
|
|
on->status( event::NOTE_ON );
|
|
|
|
on->note( 64 );
|
|
|
|
on->note_velocity( 64 );
|
|
|
|
|
|
|
|
off->status( event::NOTE_OFF );
|
|
|
|
off->note( 64 );
|
|
|
|
off->timestamp( 1 );
|
|
|
|
off->note_velocity( 64 );
|
|
|
|
|
|
|
|
on->link( off );
|
|
|
|
|
|
|
|
_el->insert( on );
|
|
|
|
_el->insert( off );
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event *e = new event;
|
|
|
|
|
|
|
|
int opcode = e->name( o->menu()[ o->value() ].text );
|
|
|
|
|
|
|
|
if ( opcode < 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
e->status( opcode );
|
|
|
|
|
|
|
|
Event_Widget *ew = v->value();
|
|
|
|
|
|
|
|
if ( ew && ew->ev() )
|
|
|
|
e->timestamp( ew->ev()->timestamp() );
|
|
|
|
|
|
|
|
|
|
|
|
_el->insert( e );
|
|
|
|
}
|
|
|
|
|
|
|
|
sync();} open
|
|
|
|
xywh {94 771 121 25} color 63
|
|
|
|
} {
|
|
|
|
MenuItem {} {
|
|
|
|
label Note
|
|
|
|
xywh {10 10 40 25}
|
|
|
|
}
|
|
|
|
MenuItem {} {
|
|
|
|
label Aftertouch
|
|
|
|
xywh {50 50 40 25}
|
|
|
|
}
|
|
|
|
MenuItem {} {
|
|
|
|
label {Control Change}
|
|
|
|
xywh {20 20 40 25}
|
|
|
|
}
|
|
|
|
MenuItem {} {
|
|
|
|
label {Program Change}
|
|
|
|
xywh {30 30 40 25}
|
|
|
|
}
|
|
|
|
MenuItem {} {
|
|
|
|
label {Channel Pressure}
|
|
|
|
xywh {60 60 40 25}
|
|
|
|
}
|
|
|
|
MenuItem {} {
|
|
|
|
label {Pitch Wheel}
|
|
|
|
xywh {40 40 40 25}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
code {// keep a copy
|
|
|
|
_old = g->events();
|
|
|
|
_el = g->events();
|
|
|
|
|
|
|
|
_grid = g;
|
|
|
|
_y = 0;
|
|
|
|
|
|
|
|
_h = scroll_w->h() / 24;
|
|
|
|
|
|
|
|
// create widgets.
|
|
|
|
|
|
|
|
for ( int n = _h; n--; )
|
|
|
|
{
|
|
|
|
Event_Widget *ew = new Event_Widget( 0, 0, pack->w(), 24, 0 );
|
|
|
|
|
|
|
|
ew->callback( cb_changed, (void*)this );
|
|
|
|
ew->when( FL_WHEN_CHANGED );
|
|
|
|
|
|
|
|
pack->add( ew );
|
|
|
|
}
|
|
|
|
|
|
|
|
pack->end();
|
|
|
|
|
|
|
|
// Fl_Pack has a bug--it doesn't resize children until we resize it.
|
|
|
|
pack->resize( scroll_w->x(), scroll_w->y(), scroll_w->w(), scroll_w->h() );
|
|
|
|
|
|
|
|
scroll_bar->minimum( 0 );
|
|
|
|
scroll_bar->maximum( _el->size() - _h );
|
|
|
|
|
|
|
|
update_widgets();} {}
|
|
|
|
}
|
|
|
|
Function {sync( void )} {open return_type void
|
|
|
|
} {
|
|
|
|
code {MESSAGE( "syncing events to grid" );
|
|
|
|
|
|
|
|
_grid->events( _el );
|
|
|
|
|
|
|
|
update_widgets();} {}
|
|
|
|
}
|
|
|
|
Function {update_widgets( void )} {open return_type void
|
|
|
|
} {
|
|
|
|
code {// draw em
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
if ( ! _el->empty() )
|
|
|
|
for ( event* e = (*_el)[_y]; e && i < _h; (e = e->next()), i++ )
|
|
|
|
{
|
|
|
|
Event_Widget *ew = (Event_Widget *)(pack->child( i ));
|
|
|
|
|
|
|
|
ew->ev( e );
|
|
|
|
ew->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
// hide unused widgets.
|
|
|
|
|
|
|
|
for ( int j = i; j < _h; j++ )
|
|
|
|
{
|
|
|
|
Event_Widget *ew = (Event_Widget *)(pack->child( j ));
|
|
|
|
ew->ev( NULL );
|
|
|
|
ew->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ajdust scrollbar
|
|
|
|
|
|
|
|
int sbmax = _el->size() - _h;
|
|
|
|
|
|
|
|
if ( sbmax > 0 )
|
|
|
|
{
|
|
|
|
scroll_bar->maximum( sbmax );
|
|
|
|
scroll_bar->show();
|
|
|
|
|
|
|
|
scroll_w->size( scroll_w->parent()->w() - scroll_bar->w(), scroll_w->parent()->h() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scroll_bar->hide();
|
|
|
|
scroll_w->size( scroll_w->parent()->w(), scroll_w->parent()->h() );
|
2008-02-13 02:37:26 +01:00
|
|
|
}} {}
|
2007-12-18 05:09:02 +01:00
|
|
|
}
|
|
|
|
Function {scroll( int y )} {open return_type void
|
|
|
|
} {
|
|
|
|
code {_y = y;} {}
|
|
|
|
}
|
|
|
|
Function {value( void )} {return_type {Event_Widget *}
|
|
|
|
} {
|
|
|
|
code {for ( int i = _h; i--; )
|
|
|
|
{
|
|
|
|
Event_Widget *w = (Event_Widget*)pack->child( i );
|
|
|
|
if ( w->selected() )
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;} {}
|
|
|
|
}
|
|
|
|
Function {cb_changed( Fl_Widget *w, void *ee )} {open return_type {static void}
|
|
|
|
} {
|
|
|
|
code {Event_Widget *ew = (Event_Widget*)w;
|
|
|
|
|
|
|
|
if ( ew->changed() )
|
|
|
|
// sorting order changed.
|
|
|
|
((Event_Editor*)ee)->_el->sort( ew->ev() );
|
|
|
|
|
|
|
|
((Event_Editor*)ee)->sync();} {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Function {event_editor( Grid *g )} {open C return_type void
|
|
|
|
} {
|
|
|
|
code {Event_Editor ee;
|
|
|
|
|
|
|
|
|
|
|
|
Fl_Window *w = ee.make_window( g );
|
|
|
|
|
|
|
|
w->modal();
|
|
|
|
w->show();
|
|
|
|
|
|
|
|
while( w->shown() )
|
|
|
|
Fl::wait();} {}
|
|
|
|
}
|
|
|
|
|
|
|
|
widget_class Event_Widget {user_data_type {void *} open
|
|
|
|
xywh {969 357 594 31} type Single
|
|
|
|
code0 {\#include "../event.H"}
|
2008-02-13 02:37:26 +01:00
|
|
|
code1 {_event = NULL;}
|
2007-12-18 05:09:02 +01:00
|
|
|
class Fl_Group size_range {400 24 0 24} visible
|
|
|
|
} {
|
|
|
|
decl {static const Fl_Color note_color = FL_BLACK;} {}
|
|
|
|
decl {static const Fl_Color control_color = FL_BLUE;} {}
|
|
|
|
decl {static const Fl_Color prog_color = FL_RED;} {}
|
|
|
|
decl {static const Fl_Color pressure_color = FL_YELLOW;} {}
|
|
|
|
decl {static const Fl_Color after_color = FL_CYAN;} {}
|
|
|
|
decl {static const Fl_Color pitch_color = FL_GREEN} {}
|
|
|
|
decl {event *_event;} {}
|
|
|
|
decl {Fl_Group *tab;} {}
|
|
|
|
Function {ev( event * e )} {open return_type void
|
|
|
|
} {
|
|
|
|
code {if ( e && ( _event == NULL ) )
|
|
|
|
activate();
|
|
|
|
else
|
|
|
|
if ( ! e )
|
|
|
|
{
|
|
|
|
_event = NULL;
|
|
|
|
deactivate();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
activate();
|
|
|
|
|
|
|
|
_event = e;
|
|
|
|
|
|
|
|
name->label( e->name() );
|
|
|
|
time->value( e->timestamp() );
|
|
|
|
|
|
|
|
// hide all tabs
|
|
|
|
for ( int i = 2; i < children(); i++ )
|
|
|
|
child( i )->hide();
|
|
|
|
|
|
|
|
Fl_Valuator *d1, *d2;
|
|
|
|
|
2008-02-13 02:37:26 +01:00
|
|
|
d1 = d2 = NULL;
|
|
|
|
|
2007-12-18 05:09:02 +01:00
|
|
|
name->color( FL_BLACK );
|
|
|
|
name->value( e->selected() );
|
|
|
|
|
|
|
|
// display the proper subtype
|
|
|
|
switch ( e->opcode() )
|
|
|
|
{
|
|
|
|
\#define TWO d1 = (Fl_Valuator*)tab->child( 0 ); d2 = (Fl_Valuator*)tab->child( 1 )
|
|
|
|
\#define ONE d1 = (Fl_Valuator*)tab->child( 0 ); d2 = NULL
|
|
|
|
|
|
|
|
case midievent::NOTE_ON:
|
|
|
|
case midievent::NOTE_OFF:
|
|
|
|
tab = note_tab;
|
|
|
|
name->color( note_color );
|
|
|
|
|
|
|
|
note_name->label( Scale::chromatic_name( e->note() ) );
|
|
|
|
note_name->labelcolor( velocity_colors[ e->note_velocity() ] );
|
|
|
|
|
|
|
|
TWO;
|
|
|
|
break;
|
|
|
|
case midievent::CONTROL_CHANGE:
|
|
|
|
tab = control_tab;
|
|
|
|
name->color( control_color );
|
|
|
|
|
|
|
|
TWO;
|
|
|
|
break;
|
|
|
|
case midievent::AFTERTOUCH:
|
|
|
|
tab = after_tab;
|
|
|
|
name->color( after_color );
|
|
|
|
|
|
|
|
TWO;
|
|
|
|
break;
|
|
|
|
case midievent::CHANNEL_PRESSURE:
|
|
|
|
tab = pressure_tab;
|
|
|
|
name->color( pressure_color );
|
|
|
|
|
|
|
|
ONE;
|
|
|
|
break;
|
|
|
|
case midievent::PROGRAM_CHANGE:
|
|
|
|
tab = prog_tab;
|
|
|
|
name->color( prog_color );
|
|
|
|
|
|
|
|
ONE;
|
|
|
|
break;
|
|
|
|
case midievent::PITCH_WHEEL:
|
|
|
|
tab = pitch_tab;
|
|
|
|
name->color( pitch_color );
|
|
|
|
|
|
|
|
ONE;
|
|
|
|
d1->value( e->pitch() );
|
|
|
|
goto pitch;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte_t D1, D2;
|
|
|
|
|
|
|
|
e->data( &D1, &D2 );
|
|
|
|
|
|
|
|
d1->value( D1 );
|
|
|
|
if ( d2 )
|
|
|
|
d2->value( D2 );
|
|
|
|
|
|
|
|
|
|
|
|
pitch:
|
|
|
|
|
|
|
|
// show the current tab
|
|
|
|
tab->show();
|
|
|
|
|
|
|
|
time->redraw();
|
|
|
|
name->redraw();
|
|
|
|
|
|
|
|
// redraw();} {}
|
|
|
|
}
|
|
|
|
Function {ev( void )} {open return_type {event *}
|
|
|
|
} {
|
|
|
|
code {return _event;} {}
|
|
|
|
}
|
|
|
|
Fl_Value_Input time {
|
|
|
|
callback {if ( _event->is_note_off() )
|
|
|
|
{
|
|
|
|
if ( o->value() < _event->link()->timestamp() )
|
|
|
|
{
|
|
|
|
o->value( _event->timestamp() );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ( _event->is_note_on() )
|
|
|
|
if ( o->value() > _event->link()->timestamp() )
|
|
|
|
{
|
|
|
|
o->value( _event->timestamp() );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_event->timestamp( o->value() );
|
|
|
|
|
|
|
|
set_changed();
|
|
|
|
do_callback();}
|
|
|
|
xywh {3 0 125 24} labeltype NO_LABEL align 0 when 8 maximum 0
|
|
|
|
code1 {o->maximum( (unsigned long)-1 );}
|
|
|
|
}
|
|
|
|
Fl_Button name {
|
|
|
|
label {<Event Name>} user_data_type {void*}
|
|
|
|
callback {if ( o->value() )
|
|
|
|
_event->select();
|
|
|
|
else
|
|
|
|
_event->deselect();
|
|
|
|
|
|
|
|
do_callback();}
|
|
|
|
xywh {132 -1 149 25} type Toggle when 1
|
|
|
|
}
|
|
|
|
Fl_Group note_tab {open
|
|
|
|
xywh {282 0 309 24} align 16
|
|
|
|
} {
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Note:}
|
|
|
|
user_data this
|
|
|
|
callback cb_note
|
|
|
|
xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Velocity:}
|
|
|
|
user_data this
|
|
|
|
callback cb_msb
|
|
|
|
xywh {518 0 73 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
Fl_Box note_name {
|
|
|
|
label {A\#}
|
|
|
|
private xywh {284 1 31 24} labeltype SHADOW_LABEL labelfont 14 labelcolor 135
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Group after_tab {open
|
|
|
|
xywh {317 0 277 24} align 16 hide
|
|
|
|
} {
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Note:}
|
|
|
|
user_data this
|
|
|
|
callback cb_note
|
|
|
|
xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Pressure:}
|
|
|
|
user_data this
|
|
|
|
callback cb_msb
|
|
|
|
xywh {518 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Group control_tab {open
|
|
|
|
xywh {358 0 238 24} align 16 hide
|
|
|
|
} {
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Control:}
|
|
|
|
user_data this
|
|
|
|
callback cb_lsb
|
|
|
|
xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Value:}
|
|
|
|
user_data this
|
|
|
|
callback cb_msb
|
|
|
|
xywh {517 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Group prog_tab {open
|
|
|
|
xywh {287 0 238 24} align 16 hide
|
|
|
|
} {
|
|
|
|
Fl_Counter {} {
|
|
|
|
label {Program:}
|
|
|
|
user_data this
|
|
|
|
callback cb_lsb
|
|
|
|
xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Group pitch_tab {open
|
|
|
|
xywh {306 0 290 24} align 16 hide
|
|
|
|
} {
|
|
|
|
Fl_Slider {} {
|
|
|
|
label {Pitch:} user_data_type {void *}
|
|
|
|
callback {_event->pitch( o->value() );
|
|
|
|
do_callback();}
|
|
|
|
xywh {358 0 238 24} type Horizontal align 4 when 4 minimum -8192 maximum 8191 step 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Fl_Group pressure_tab {open
|
|
|
|
xywh {307 0 290 24} align 16 hide
|
|
|
|
} {
|
|
|
|
Fl_Slider {} {
|
|
|
|
label {Pressure:}
|
|
|
|
user_data this
|
|
|
|
callback cb_lsb
|
|
|
|
xywh {358 0 239 24} type Horizontal align 4 when 4 maximum 127 step 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Function {select( bool b )} {open return_type void
|
|
|
|
} {
|
|
|
|
code {/*
|
|
|
|
_selected = b;
|
|
|
|
|
|
|
|
if ( b )
|
|
|
|
name->color( FL_WHITE );
|
|
|
|
|
|
|
|
redraw();
|
|
|
|
*/} {}
|
|
|
|
}
|
|
|
|
Function {button()} {open return_type {Fl_Button *}
|
|
|
|
} {
|
|
|
|
code {return name;} {}
|
|
|
|
}
|
|
|
|
Function {selected( void )} {open return_type bool
|
|
|
|
} {
|
|
|
|
code {/*
|
|
|
|
int n = name->value();
|
|
|
|
name->value( 0 );
|
|
|
|
return n;
|
|
|
|
*/
|
|
|
|
|
|
|
|
return name->value();} {}
|
|
|
|
}
|
|
|
|
Function {cb_lsb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
|
|
|
|
} {
|
|
|
|
code {w->ev()->lsb( o->value() );
|
|
|
|
|
|
|
|
w->do_callback();} {}
|
|
|
|
}
|
|
|
|
Function {cb_msb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
|
|
|
|
} {
|
|
|
|
code {w->ev()->msb( o->value() );
|
|
|
|
w->do_callback();} {}
|
|
|
|
}
|
|
|
|
Function {cb_note( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
|
|
|
|
} {
|
|
|
|
code {w->ev()->note( o->value() );
|
|
|
|
w->do_callback();} {}
|
|
|
|
}
|
|
|
|
}
|