Also, fix bug in soloing when a solo'd track was removed.tags/non-daw-v1.1.0
@@ -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 <FL/Fl_Button.H> | |||
#include <FL/Fl.H> | |||
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(); | |||
} | |||
}; |
@@ -115,7 +115,7 @@ public: | |||
~Clock ( ) | |||
{ | |||
Fl::remove_timeout( update_cb ); | |||
Fl::remove_timeout( update_cb, this ); | |||
} | |||
void run ( nframes_t *v ) | |||
@@ -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 {<empty>} | |||
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 );} {} | |||
} | |||
} | |||
@@ -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 ); | |||
@@ -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 ); | |||
@@ -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 ) | |||
{ | |||
@@ -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 ); | |||