1 # data file for the Fltk User Interface Designer (fluid)
6 // Copyright (C) 2008 Jonathan Moore Liles
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 the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 } {in_source in_header
25 class List_Chooser {} {
26 Function {List_Chooser( const char *name, const char *action )} {open
28 Fl_Window window {open
29 xywh {696 57 310 524} type Single non_modal size_range {310 524 0 0} visible
33 code0 {o->spacing( 20 );}
37 xywh {15 30 280 447} type Multi color 32 selection_color 47 align 1 textcolor 55 resizable
38 code0 {o->label( name );}
45 callback {browser->clear();
49 Fl_Return_Button button {
51 callback {window->hide();}
53 code0 {o->label( action );}
59 Function {show()} {open
61 code {window->show();} {}
63 Function {shown()} {open return_type bool
65 code {return window->shown();} {}
67 Function {add( const char *item )} {open
69 code {browser->add( item );} {}
73 decl {\#include "../transport.H"} {public
76 decl {extern Fl_Color velocity_colors[];} {}
78 decl {\#include <FL/Fl_Box.H>} {}
80 decl {\#include <stdio.h>} {}
82 decl {\#include <stdlib.h>} {}
84 widget_class Visual_Metronome {open selected
85 xywh {763 217 1278 1003} type Single resizable
86 code0 {_bpb = _tpb = -1; _beat = _tick = _flip = 0;}
87 code1 {this->box( FL_NO_BOX );}
88 code2 {this->label( 0 );}
89 class Fl_Group visible
92 private xywh {119 95 1149 23} type Horizontal box THIN_UP_BOX color 32 selection_color 71
93 code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );}
94 code1 {o->slider_size( 0.25 );}
95 code2 {o->slider( FL_THIN_UP_BOX );}
98 private xywh {119 7 1149 78} type HORIZONTAL resizable
99 code0 {o->resize( x(), y(), w(), h() - progress->h() );}
106 Function {bpb( int b )} {open private return_type void
108 code {if ( b == _bpb )
117 for ( int i = 1; i <= b; ++i )
119 Fl_Box *box = new Fl_Box( FL_THIN_UP_BOX, 0, 0, bw, 1, 0 );
121 char *pat = (char *)malloc( 4 );
123 sprintf( pat, "%d", i );
126 box->color( fl_lighter( FL_GRAY ) );
127 box->color2( FL_GRAY );
132 // try to clear the background.
134 parent()->parent()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() );
137 Function {tpb( int ticks )} {open private return_type void
141 progress->minimum( 0 );
142 progress->maximum( ticks );} {}
144 Function {beat( int b )} {open private return_type void
146 code {if ( b == _beat || b >= _bpb )
150 pack->child( _beat )->color( fl_lighter( FL_GRAY ) );
151 pack->child( _beat )->redraw();
153 pack->child( b )->color( velocity_colors[ b * 127 / _bpb ] );
154 pack->child( b )->redraw();
160 Function {tick( int tick )} {open private return_type void
162 code {if ( tick == _tick )
170 progress->selection_color( FL_RED );
171 progress->value( _tpb - tick );
175 progress->selection_color( FL_GREEN );
176 progress->value( tick );
180 Fl_Widget *c = pack->child( _beat );
184 c->color( velocity_colors[ tick * 127 / _tpb ] );
191 Function {resize( int X, int Y, int W, int H )} {open return_type void
193 code {// pack->resize( 0, 0, W, pack->h() );
196 Fl_Group::resize( X, Y, W, H );
198 for ( int i = pack->children(); i-- ; )
199 pack->child( i )->resize( 0, 0, W / pack->children(), pack->h() );} {}
201 Function {update( void )} {open return_type void
203 code {if ( transport.beats_per_bar ) {
204 bpb( transport.beats_per_bar );
205 tpb( transport.ticks_per_beat );
206 beat( transport.beat - 1 );
207 tick( transport.tick - 1 );}} {}