Set song dirtiness more often/more consistently.

This commit is contained in:
Jonathan Moore Liles 2008-03-22 23:43:40 -05:00
parent 93f51f33ea
commit cb5960d298
7 changed files with 43 additions and 7 deletions

3
TODO
View File

@ -6,9 +6,6 @@
; General ; General
* allow deletion and renumbering of individual patterns and phrases. * allow deletion and renumbering of individual patterns and phrases.
* dirty the song more often than just on note manipulation. Pattern
names, playlist chances, viewport size adjustments--all need to
dirty the song.
* add mode for disconnected operation. This is especially important * add mode for disconnected operation. This is especially important
for the situation where there is a timebase master when Non is for the situation where there is a timebase master when Non is
started that exits before Non is closed, resulting in a lack of BBT started that exits before Non is closed, resulting in a lack of BBT

View File

@ -85,7 +85,7 @@ void
Canvas::handle_event_change ( void ) Canvas::handle_event_change ( void )
{ {
/* mark the song as dirty and pass the signal on */ /* mark the song as dirty and pass the signal on */
song.dirty( true ); song.set_dirty();
signal_draw(); signal_draw();
} }
@ -914,6 +914,8 @@ Canvas::h_zoom ( float n )
m.vp->w = max( 32, min( (int)(m.vp->w * n), 256 ) ); m.vp->w = max( 32, min( (int)(m.vp->w * n), 256 ) );
resize_grid(); resize_grid();
song.set_dirty();
} }
void void
@ -928,6 +930,9 @@ Canvas::v_zoom_fit ( void )
m.vp->y = 0; m.vp->y = 0;
resize_grid(); resize_grid();
song.set_dirty();
} }
/** adjust vertical zoom (* n) */ /** adjust vertical zoom (* n) */
@ -937,6 +942,8 @@ Canvas::v_zoom ( float n )
m.vp->h = max( 1, min( (int)(m.vp->h * n), m.maxh ) ); m.vp->h = max( 1, min( (int)(m.vp->h * n), m.maxh ) );
resize_grid(); resize_grid();
song.set_dirty();
} }
void void

6
grid.C
View File

@ -784,6 +784,8 @@ Grid::resolution ( unsigned int n )
DEBUG( "%d setting resolution to %d", n, _ppqn ); DEBUG( "%d setting resolution to %d", n, _ppqn );
signal_events_change(); signal_events_change();
signal_settings_change();
} }
int int
@ -804,6 +806,8 @@ Grid::name ( char *s )
if ( _name ) free ( _name ); if ( _name ) free ( _name );
_name = s; _name = s;
signal_settings_change();
} }
const char * const char *
@ -818,6 +822,8 @@ Grid::notes ( char *s )
if ( _notes ) free ( _notes ); if ( _notes ) free ( _notes );
_notes = s; _notes = s;
signal_settings_change();
} }
char * char *

View File

@ -1008,7 +1008,7 @@ You should have received a copy of the GNU General Public License along with thi
system( "x-www-browser http://non.tuxfamily.org &" ); system( "x-www-browser http://non.tuxfamily.org &" );
\#else \#else
fl_open_uri( "http://non.tuxfamily.org" ); fl_open_uri( "http://non.tuxfamily.org" );
\#endif} selected \#endif}
xywh {178 554 188 30} color 14 labeltype SHADOW_LABEL labelcolor 6 xywh {178 554 188 30} color 14 labeltype SHADOW_LABEL labelcolor 6
} }
Fl_Return_Button {} { Fl_Return_Button {} {
@ -1472,7 +1472,9 @@ _c->resize( x(), y(), w(), h() );
_c->signal_draw.connect( sigc::mem_fun( this, &O_Canvas::draw_notes ) ); _c->signal_draw.connect( sigc::mem_fun( this, &O_Canvas::draw_notes ) );
_c->signal_resize.connect( sigc::mem_fun( this, &O_Canvas::clear ) ); _c->signal_resize.connect( sigc::mem_fun( this, &O_Canvas::clear ) );
_c->signal_settings_change.connect( sigc::ptr_fun( &UI::update_canvas_widgets ) );} {} _c->signal_settings_change.connect( sigc::ptr_fun( &UI::update_canvas_widgets ) );
_c->signal_settings_change.connect( sigc::mem_fun( song, &song_settings::set_dirty ) );} {selected
}
} }
Function {click_to_focus()} {open return_type bool Function {click_to_focus()} {open return_type bool
} { } {
@ -1645,7 +1647,7 @@ return r;} {}
} }
widget_class Triggers {open widget_class Triggers {open
xywh {429 76 1278 1003} type Double resizable xywh {397 42 1278 1003} type Double resizable
code0 {populate();} code0 {populate();}
code1 {\#include <Fl/Fl_Dial.H>} code1 {\#include <Fl/Fl_Dial.H>}
class Fl_Group visible class Fl_Group visible

6
main.C
View File

@ -113,6 +113,8 @@ load_song ( const char *name )
song.filename = strdup( name ); song.filename = strdup( name );
song.dirty( false );
return true; return true;
} }
@ -151,6 +153,8 @@ main ( int argc, char **argv )
init_song(); init_song();
pattern::signal_create_destroy.connect( mem_fun( phrase_c, &Canvas::v_zoom_fit ) ); pattern::signal_create_destroy.connect( mem_fun( phrase_c, &Canvas::v_zoom_fit ) );
pattern::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) );
phrase::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) );
if ( ! lash.init( &argc, &argv ) ) if ( ! lash.init( &argc, &argv ) )
WARNING( "error initializing LASH" ); WARNING( "error initializing LASH" );
@ -170,6 +174,8 @@ main ( int argc, char **argv )
else else
ASSERTION( "Either the version of JACK you are using does pass BBT information, or the current timebase master does not provide it." ); ASSERTION( "Either the version of JACK you are using does pass BBT information, or the current timebase master does not provide it." );
song.dirty( false );
MESSAGE( "Initializing GUI" ); MESSAGE( "Initializing GUI" );
init_colors(); init_colors();

12
non.H
View File

@ -104,11 +104,23 @@ struct song_settings
_dirty = b; _dirty = b;
if ( b ) if ( b )
{
MESSAGE( "song is now dirty" );
signal_dirty(); signal_dirty();
}
else else
{
MESSAGE( "song is now clean" );
signal_clean(); signal_clean();
} }
} }
}
void
set_dirty ( void )
{
dirty( true );
}
struct { struct {
int feel; int feel;

View File

@ -71,6 +71,8 @@ sequence::unlock ( void )
_rd = _rw; _rd = _rw;
_rw = NULL; _rw = NULL;
song.set_dirty();
} }
void void
@ -426,6 +428,8 @@ sequence::name ( const char *s )
if ( _name ) free( _name ); if ( _name ) free( _name );
_name = strdup( s ); _name = strdup( s );
song.set_dirty();
} }
char * char *
@ -440,4 +444,6 @@ sequence::notes ( const char *s )
if ( _notes ) free( _notes ); if ( _notes ) free( _notes );
_notes = strdup( s ); _notes = strdup( s );
song.set_dirty();
} }