@@ -28,6 +28,7 @@ | |||
#include "../common.h" | |||
#include "ui.H" | |||
#include "../transport.H" | |||
extern UI *ui; | |||
@@ -49,9 +49,6 @@ decl {\#include <Fl_Menu_Settings.H>} {private local | |||
decl {\#include <FL/Fl_Shared_Image.H>} {private local | |||
} | |||
decl {\#include "widgets.H"} {private local | |||
} | |||
decl {\#include "event_edit.H"} {private local | |||
} | |||
@@ -64,6 +61,9 @@ decl {\#include "../NSM.H"} {private local | |||
decl {extern NSM_Client *nsm;} {private local | |||
} | |||
decl {\#include "../transport.H"} {private local | |||
} | |||
decl {extern UI *ui;} {private local | |||
} | |||
@@ -82,6 +82,122 @@ decl {Fl_Color canvas_background_color;} {public local | |||
decl {extern Fl_Color velocity_colors[];} {private local | |||
} | |||
widget_class Visual_Metronome {open | |||
xywh {638 936 100 100} type Double visible | |||
} { | |||
Fl_Slider progress { | |||
private xywh {139 115 1149 23} type Horizontal box FLAT_BOX color 7 selection_color 54 | |||
code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );} | |||
code1 {o->slider_size( 0.25 );} | |||
code2 {o->slider( FL_FLAT_BOX );} | |||
} | |||
Function {draw(void)} {open protected return_type void | |||
} { | |||
code {if ( damage() & ~FL_DAMAGE_CHILD ) | |||
{ | |||
int bw = w() / _bpb; | |||
int b = _bpb; | |||
for ( int i = 0; i < b; ++i ) | |||
{ | |||
if ( i == _beat ) | |||
fl_color( velocity_colors[ i * 127 / _bpb ] ); | |||
else | |||
fl_color( FL_GRAY ); | |||
int X = x() + ( i * bw ); | |||
int Y = y(); | |||
int W = bw; | |||
int H = h() - 14; | |||
fl_rectf(X,Y,W,H); | |||
fl_color( fl_darker( fl_color() ) ); | |||
fl_rect( X,Y,W,H); | |||
char pat[4]; | |||
snprintf( pat, sizeof(pat), "%d", i + 1 ); | |||
fl_font( FL_HELVETICA_BOLD, 24 ); | |||
fl_draw( pat, X,Y,W,H, FL_ALIGN_CENTER ); | |||
} | |||
} | |||
progress->resize( x(), y() + h() - 14, w(), 14 ); | |||
if ( damage() & FL_DAMAGE_CHILD ) | |||
update_child( *progress ); | |||
else | |||
draw_child( *progress ); | |||
// _flip = ! _flip;} {selected | |||
} | |||
} | |||
decl {int _bpb} {private local | |||
} | |||
decl {int _tpb} {private local | |||
} | |||
decl {int _beat} {private local | |||
} | |||
decl {bool _flip} {private local | |||
} | |||
decl {int _tick} {private local | |||
} | |||
Function {bpb( int b )} {open private return_type void | |||
} { | |||
code {if ( b != _bpb ) | |||
{ | |||
_bpb = b; | |||
redraw(); | |||
}} {} | |||
} | |||
Function {tpb( int ticks )} {open private return_type void | |||
} { | |||
code {_tpb = ticks; | |||
progress->minimum( 0 ); | |||
progress->maximum( ticks );} {} | |||
} | |||
Function {beat( int b )} {open private return_type void | |||
} { | |||
code {if ( b == _beat || b >= _bpb ) | |||
return; | |||
_flip = ! _flip; | |||
_beat = b; | |||
redraw();} {} | |||
} | |||
Function {tick( int tick )} {open private return_type void | |||
} { | |||
code {if ( tick == _tick ) | |||
return; | |||
if ( _beat < 0 ) | |||
return; | |||
if ( _flip ) | |||
{ | |||
progress->value( _tpb - tick ); | |||
} | |||
else | |||
{ | |||
progress->value( tick ); | |||
} | |||
_tick = tick;} {} | |||
} | |||
Function {update( void )} {open return_type void | |||
} { | |||
code {if ( transport.beats_per_bar ) { | |||
bpb( transport.beats_per_bar ); | |||
tpb( transport.ticks_per_beat ); | |||
beat( transport.beat - 1 ); | |||
tick( transport.tick - 1 );}} {} | |||
} | |||
} | |||
Function {update_transport( void * )} {open return_type void | |||
} { | |||
code {// transport_poll(); | |||
@@ -223,7 +339,7 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape ) | |||
if ( maybe_save_song() ) | |||
quit();} open | |||
xywh {798 131 865 805} type Double color 47 resizable | |||
xywh {832 231 865 805} type Double color 47 resizable | |||
code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible | |||
} { | |||
Fl_Group {} {open | |||
@@ -255,8 +371,7 @@ if ( maybe_save_song() ) | |||
Fl_Pack vmetro_widget { | |||
label Metronome | |||
xywh {520 35 336 59} type HORIZONTAL box UP_BOX color 40 selection_color 48 labelsize 33 align 0 resizable | |||
code0 {\#include "widgets.H"} | |||
code1 {o->box( FL_FLAT_BOX );} | |||
code0 {o->box( FL_FLAT_BOX );} | |||
class Visual_Metronome | |||
} {} | |||
Fl_Pack transport_controls_group {open | |||
@@ -563,7 +678,7 @@ o->maximum( phrase::phrases() );} | |||
code0 {update_pattern_widgets();} | |||
} { | |||
Fl_Box pattern_canvas_widget { | |||
label Pattern selected | |||
label Pattern | |||
xywh {1 103 863 587} box FLAT_BOX color 37 labelsize 100 align 16 resizable | |||
code0 {\#include "draw.H"} | |||
code1 {o->set_canvas( pattern_c );} | |||
@@ -1931,3 +2046,46 @@ Fl_Group::resize( X, Y, W, H );} {} | |||
decl {unsigned long _timer;} {private local | |||
} | |||
} | |||
class List_Chooser {open | |||
} { | |||
Function {List_Chooser( const char *name, const char *action )} {} { | |||
Fl_Window window {open | |||
xywh {525 313 310 545} type Single hide resizable non_modal size_range {310 524 0 0} | |||
} { | |||
Fl_Browser browser { | |||
label name | |||
xywh {5 26 300 480} type Multi box THIN_DOWN_BOX color 32 selection_color 0 align 1 textcolor 55 resizable | |||
code0 {o->label( name );} | |||
} | |||
Fl_Group {} {open | |||
xywh {5 505 300 39} | |||
} { | |||
Fl_Button {} { | |||
label Cancel | |||
callback {browser->clear(); | |||
window->hide();} | |||
xywh {5 513 75 27} | |||
} | |||
Fl_Return_Button button { | |||
label action | |||
callback {window->hide();} | |||
xywh {115 513 190 27} | |||
code0 {o->label( action );} | |||
} | |||
} | |||
} | |||
} | |||
Function {show()} {open | |||
} { | |||
code {window->show();} {} | |||
} | |||
Function {shown()} {open return_type bool | |||
} { | |||
code {return window->shown();} {} | |||
} | |||
Function {add( const char *item )} {open | |||
} { | |||
code {browser->add( item );} {} | |||
} | |||
} |
@@ -1,209 +0,0 @@ | |||
# data file for the Fltk User Interface Designer (fluid) | |||
version 1.0108 | |||
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 | |||
} | |||
class List_Chooser {} { | |||
Function {List_Chooser( const char *name, const char *action )} {open | |||
} { | |||
Fl_Window window {open | |||
xywh {696 57 310 524} type Single non_modal size_range {310 524 0 0} visible | |||
} { | |||
Fl_Pack {} {open | |||
xywh {2 10 303 501} | |||
code0 {o->spacing( 20 );} | |||
} { | |||
Fl_Browser browser { | |||
label name | |||
xywh {15 30 280 447} type Multi color 32 selection_color 47 align 1 textcolor 55 resizable | |||
code0 {o->label( name );} | |||
} | |||
Fl_Group {} {open | |||
xywh {17 485 278 26} | |||
} { | |||
Fl_Button {} { | |||
label Cancel | |||
callback {browser->clear(); | |||
window->hide();} | |||
xywh {17 485 75 26} | |||
} | |||
Fl_Return_Button button { | |||
label action | |||
callback {window->hide();} | |||
xywh {105 485 190 26} | |||
code0 {o->label( action );} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
Function {show()} {open | |||
} { | |||
code {window->show();} {} | |||
} | |||
Function {shown()} {open return_type bool | |||
} { | |||
code {return window->shown();} {} | |||
} | |||
Function {add( const char *item )} {open | |||
} { | |||
code {browser->add( item );} {} | |||
} | |||
} | |||
decl {\#include "../transport.H"} {public | |||
} | |||
decl {extern Fl_Color velocity_colors[];} {} | |||
decl {\#include <FL/Fl_Box.H>} {} | |||
decl {\#include <stdio.h>} {} | |||
decl {\#include <stdlib.h>} {} | |||
widget_class Visual_Metronome {open selected | |||
xywh {763 217 1278 1003} type Single resizable | |||
code0 {_bpb = _tpb = -1; _beat = _tick = _flip = 0;} | |||
code1 {this->box( FL_NO_BOX );} | |||
code2 {this->label( 0 );} | |||
class Fl_Group visible | |||
} { | |||
Fl_Slider progress { | |||
private xywh {119 95 1149 23} type Horizontal box THIN_UP_BOX color 32 selection_color 71 | |||
code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );} | |||
code1 {o->slider_size( 0.25 );} | |||
code2 {o->slider( FL_THIN_UP_BOX );} | |||
} | |||
Fl_Pack pack {open | |||
private xywh {119 7 1149 78} type HORIZONTAL resizable | |||
code0 {o->resize( x(), y(), w(), h() - progress->h() );} | |||
} {} | |||
decl {int _bpb} {} | |||
decl {int _tpb} {} | |||
decl {int _beat} {} | |||
decl {bool _flip} {} | |||
decl {int _tick} {} | |||
Function {bpb( int b )} {open private return_type void | |||
} { | |||
code {if ( b == _bpb ) | |||
return; | |||
_bpb = b; | |||
pack->clear(); | |||
int bw = w() / _bpb; | |||
for ( int i = 1; i <= b; ++i ) | |||
{ | |||
Fl_Box *box = new Fl_Box( FL_THIN_UP_BOX, 0, 0, bw, 1, 0 ); | |||
char *pat = (char *)malloc( 4 ); | |||
sprintf( pat, "%d", i ); | |||
box->label( pat ); | |||
box->color( fl_lighter( FL_GRAY ) ); | |||
box->color2( FL_GRAY ); | |||
pack->add( box ); | |||
} | |||
// try to clear the background. | |||
parent()->parent()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); | |||
redraw();} {} | |||
} | |||
Function {tpb( int ticks )} {open private return_type void | |||
} { | |||
code {_tpb = ticks; | |||
progress->minimum( 0 ); | |||
progress->maximum( ticks );} {} | |||
} | |||
Function {beat( int b )} {open private return_type void | |||
} { | |||
code {if ( b == _beat || b >= _bpb ) | |||
return; | |||
pack->child( _beat )->color( fl_lighter( FL_GRAY ) ); | |||
pack->child( _beat )->redraw(); | |||
pack->child( b )->color( velocity_colors[ b * 127 / _bpb ] ); | |||
pack->child( b )->redraw(); | |||
_flip = ! _flip; | |||
_beat = b;} {} | |||
} | |||
Function {tick( int tick )} {open private return_type void | |||
} { | |||
code {if ( tick == _tick ) | |||
return; | |||
if ( _beat < 0 ) | |||
return; | |||
if ( _flip ) | |||
{ | |||
progress->selection_color( FL_RED ); | |||
progress->value( _tpb - tick ); | |||
} | |||
else | |||
{ | |||
progress->selection_color( FL_GREEN ); | |||
progress->value( tick ); | |||
} | |||
\#if 0 | |||
Fl_Widget *c = pack->child( _beat ); | |||
if ( c ) | |||
{ | |||
c->color( velocity_colors[ tick * 127 / _tpb ] ); | |||
c->redraw(); | |||
} | |||
\#endif | |||
_tick = tick;} {} | |||
} | |||
Function {resize( int X, int Y, int W, int H )} {open return_type void | |||
} { | |||
code {// pack->resize( 0, 0, W, pack->h() ); | |||
Fl_Group::resize( X, Y, W, H ); | |||
for ( int i = pack->children(); i-- ; ) | |||
pack->child( i )->resize( 0, 0, W / pack->children(), pack->h() );} {} | |||
} | |||
Function {update( void )} {open return_type void | |||
} { | |||
code {if ( transport.beats_per_bar ) { | |||
bpb( transport.beats_per_bar ); | |||
tpb( transport.ticks_per_beat ); | |||
beat( transport.beat - 1 ); | |||
tick( transport.tick - 1 );}} {} | |||
} | |||
} |
@@ -26,7 +26,7 @@ | |||
#include "gui/ui.H" | |||
#include "jack.H" | |||
#include "NSM.H" | |||
#include "transport.H" | |||
#include "pattern.H" | |||
#include "phrase.H" | |||
#include <signal.h> | |||
@@ -53,7 +53,6 @@ src/gui/draw.C | |||
src/gui/event_edit.fl | |||
src/gui/input.C | |||
src/gui/ui.fl | |||
src/gui/widgets.fl | |||
src/instrument.C | |||
src/jack.C | |||
src/main.C | |||