More work on undo.

This commit is contained in:
Jonathan Moore Liles 2008-02-28 14:10:41 -06:00
parent aacd502f04
commit 618d78eaeb
4 changed files with 15 additions and 11 deletions

View File

@ -48,7 +48,7 @@ protected:
asprintf( &sa[i++], ":track 0x%X", _track ? _track->id() : 0 );
asprintf( &sa[i++], ":x %lu", _offset );
asprintf( &sa[i++], ":tempo %f", _tempo );
asprintf( &sa[i++], ":tempo %.2f", _tempo );
sa[i] = NULL;
@ -69,7 +69,7 @@ protected:
if ( ! strcmp( s, ":x" ) )
_offset = atol( v );
else
if ( ! strcmp( s, ":tepmo" ) )
if ( ! strcmp( s, ":tempo" ) )
_tempo = atof( v );
else
if ( ! strcmp( s, ":track" ) )
@ -92,6 +92,7 @@ protected:
timeline->rulers->redraw();
timeline->tracks->redraw();
_make_label();
}

View File

@ -69,7 +69,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
xoffset = 0;
{
Scalebar *o = new Scalebar( X, H - 18, W - 18, 18 );
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 );
o->range( 0, 48000 * 2 );
o->zoom_range( 2, 8192 );
@ -81,7 +81,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
}
{
Fl_Scrollbar *o = new Fl_Scrollbar( W - 18, Y, 18, H - 18 );
Fl_Scrollbar *o = new Fl_Scrollbar( X + W - 18, Y, 18, H - 18 );
o->type( FL_VERTICAL );
o->step( 10 );
@ -90,7 +90,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
}
{
Fl_Pack *o = new Fl_Pack( 0, 0, W - vscroll->w(), H - hscroll->h(), "rulers" );
Fl_Pack *o = new Fl_Pack( X, Y, W - vscroll->w(), H - hscroll->h(), "rulers" );
o->type( Fl_Pack::VERTICAL );
{

View File

@ -104,9 +104,10 @@ Track::add ( Track_Widget *r )
r->track()->redraw();
}
r->track( this );
_widgets.push_back( r );
r->track( this );
sort();
}
/* snap /r/ to nearest edge */

12
main.C
View File

@ -53,13 +53,14 @@ Timeline *timeline;
void cb_undo ( Fl_Widget *w, void *v )
{
static char pat[20];
/* static char pat[20]; */
Loggable::undo();
sprintf( pat, "undo %d", Loggable::undo_index() );
w->label( pat );
/* sprintf( pat, "undo %d", Loggable::undo_index() ); */
/* w->label( pat ); */
}
int
@ -76,7 +77,7 @@ main ( int argc, char **argv )
Loggable::register_create( "Time_Point", &Time_Point::create );
timeline = new Timeline( 0, 0, 800, 600, "Timeline" );
timeline = new Timeline( 0, 24, 800, 600 - 24, "Timeline" );
// Region *wave = new Region( Clip::from_file( "streambass8.wav" ) );
@ -85,7 +86,8 @@ main ( int argc, char **argv )
// timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 );
Fl_Button *o = new Fl_Button( 0, 0, 50, 50, "undo" );
Fl_Button *o = new Fl_Button( 0, 0, 50, 24, "undo" );
o->shortcut( FL_CTRL + 'z' );
o->callback( cb_undo, 0 );
main_window->end();