From 8ae5783c3e5414ea0eb05fd6c0c9356070fe2d25 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 26 Jul 2008 01:49:18 -0500 Subject: [PATCH] Add solo and record blinkers to TLE. Also, fix bug in soloing when a solo'd track was removed. --- FL/Fl_Blinker.H | 69 ++++++++++++++++++++++++++++++++++++++++++++ Timeline/Clock.H | 2 +- Timeline/TLE.fl | 29 ++++++++++++++----- Timeline/Track.C | 13 +++++++++ Timeline/Track.H | 2 ++ Timeline/Transport.C | 6 ++++ Timeline/Transport.H | 1 + 7 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 FL/Fl_Blinker.H diff --git a/FL/Fl_Blinker.H b/FL/Fl_Blinker.H new file mode 100644 index 0000000..92167f1 --- /dev/null +++ b/FL/Fl_Blinker.H @@ -0,0 +1,69 @@ + +/*******************************************************************************/ +/* 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; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include +#include + +const float BLINK_FREQ = 0.5f; + +class Fl_Blinker : public Fl_Button +{ + + bool _on; + + static void + update_cb ( void *v ) + { + ((Fl_Blinker*)v)->update_cb(); + } + + void + update_cb ( void ) + { + Fl::repeat_timeout( BLINK_FREQ, update_cb, this ); + + _on = ! _on; + + redraw(); + } + +public: + + Fl_Blinker ( int X, int Y, int W, int H, const char *L ) + : Fl_Button( X, Y, W, H, L ) + { + _on = false; + Fl::add_timeout( BLINK_FREQ, update_cb, this ); + + type( FL_TOGGLE_BUTTON ); + } + + virtual + ~Fl_Blinker () + { + Fl::remove_timeout( update_cb, this ); + } + + virtual void + draw ( void ) + { + draw_box( value() ? box() : down_box(), x(), y(), w(), h(), ( value() != 0 && _on ) ? selection_color() : color() ); + draw_label(); + } +}; diff --git a/Timeline/Clock.H b/Timeline/Clock.H index f7da0e1..9cf3b51 100644 --- a/Timeline/Clock.H +++ b/Timeline/Clock.H @@ -115,7 +115,7 @@ public: ~Clock ( ) { - Fl::remove_timeout( update_cb ); + Fl::remove_timeout( update_cb, this ); } void run ( nframes_t *v ) diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 05ab5b0..0224410 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -198,7 +198,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} } { Fl_Window main_window { label Timeline open - private xywh {254 117 1025 770} type Double resizable xclass Non_DAW visible + private xywh {133 113 1025 770} type Double resizable xclass Non_DAW visible } { Fl_Menu_Bar menubar {open private xywh {0 0 1024 25} @@ -605,7 +605,7 @@ ab.run();} } Fl_Box {} { label {} - xywh {487 27 378 42} resizable + xywh {487 27 308 42} resizable code0 {o->labeltype( FL_NO_LABEL );} } Fl_Group {} {open @@ -636,6 +636,18 @@ ab.run();} private xywh {921 41 104 14} labelsize 10 } } + Fl_Button solo_blinker { + label SOLO + xywh {810 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blinker.H"} + class Fl_Blinker + } + Fl_Button rec_blinker { + label REC + xywh {810 50 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blinker.H"} + class Fl_Blinker + } } Fl_Progress progress { label {0%} @@ -708,7 +720,7 @@ snprintf( s, 5, "%d%%", (int)v ); p->label( s );} {} } - Function {update_status()} {private + Function {update_status()} {open private } { code {static char cbp[5], pbp[5], clp[5]; @@ -733,9 +745,13 @@ if ( engine->zombified() && ! zombie ) { zombie = true; fl_alert( "Disconnected from JACK!" ); -}} {} +} + +solo_blinker->value( Track::soloing() ); +rec_blinker->value( transport->rolling && transport->rec_enabled() );} {selected + } } - Function {update_cb( void *v )} {private return_type {static void} + Function {update_cb( void *v )} {open private return_type {static void} } { code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v ); @@ -782,8 +798,7 @@ Fl::check();} {} snprintf( pat, 256, "file://%s%s.html", DOCUMENT_PATH, file ); -open_url( pat );} {selected - } +open_url( pat );} {} } } diff --git a/Timeline/Track.C b/Timeline/Track.C index 1972f8a..d6722cc 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -69,6 +69,17 @@ Track::Track ( ) : Fl_Group( 0, 0, 1, 1 ) timeline->add_track( this ); } +void +Track::solo ( bool b ) +{ + if ( b && ! solo_button->value() ) + ++_soloing; + else if ( ! b && solo_button->value() ) + --_soloing; + + solo_button->value( b ); +} + Track::~Track ( ) { Loggable::block_start(); @@ -89,6 +100,8 @@ Track::~Track ( ) _sequence = NULL; + solo( false ); + if ( _name ) free( _name ); diff --git a/Timeline/Track.H b/Timeline/Track.H index 9c218a9..678e5ad 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -179,6 +179,8 @@ public: bool armed ( void ) const { return record_button->value(); } bool selected ( void ) const { return _selected; } + void solo ( bool b ); + static void cb_input_field ( Fl_Widget *w, void *v ); void cb_input_field ( void ); static void cb_button ( Fl_Widget *w, void *v ); diff --git a/Timeline/Transport.C b/Timeline/Transport.C index d2d0570..3890298 100644 --- a/Timeline/Transport.C +++ b/Timeline/Transport.C @@ -106,6 +106,12 @@ Transport::cb_button ( Fl_Widget *w ) } } +bool +Transport::rec_enabled ( void ) const +{ + return _record_button->value(); +} + void Transport::toggle_record ( void ) { diff --git a/Timeline/Transport.H b/Timeline/Transport.H index df19044..e84ba83 100644 --- a/Timeline/Transport.H +++ b/Timeline/Transport.H @@ -51,6 +51,7 @@ public: Transport ( int X, int Y, int W, int H, const char *L=0 ); + bool rec_enabled ( void ) const; void toggle_record ( void ); int handle ( int m );