Browse Source

Fix interaction between shortcut handling and multiple undo.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
0eb8babb3e
2 changed files with 17 additions and 9 deletions
  1. +16
    -8
      Timeline/Loggable.C
  2. +1
    -1
      Timeline/Track.C

+ 16
- 8
Timeline/Loggable.C View File

@@ -222,6 +222,10 @@ Loggable::do_this ( const char *s, bool reverse )


Log_Entry e( sa ); Log_Entry e( sa );






assert( _class_map[ string( classname ) ] ); assert( _class_map[ string( classname ) ] );


/* if ( ! _class_map[ string( classname ) ] ) */ /* if ( ! _class_map[ string( classname ) ] ) */
@@ -236,6 +240,8 @@ Loggable::do_this ( const char *s, bool reverse )
} }


} }

return true;
} }


void void
@@ -245,6 +251,8 @@ Loggable::undo ( void )


// fflush( _fp ); // fflush( _fp );


/* FIXME: handle more than the first block!!! */

fseek( _fp, 0, SEEK_END ); fseek( _fp, 0, SEEK_END );
size_t len = ftell( _fp ); size_t len = ftell( _fp );


@@ -254,7 +262,6 @@ Loggable::undo ( void )


char *s = buf + len - 1; char *s = buf + len - 1;


// FIXME: handle blocks
int i = 1; int i = 1;


/* move back _undo_index items from the end */ /* move back _undo_index items from the end */
@@ -334,11 +341,7 @@ Loggable::undo ( void )


block_end(); block_end();


// FIXME: bogus... needs to account for multiple events.
_undo_index = ui + 1;

++_undo_index;

_undo_index = ui + 2;


delete buf; delete buf;
} }
@@ -408,6 +411,8 @@ Loggable::log ( const char *fmt, ... )
void void
Loggable::flush ( void ) Loggable::flush ( void )
{ {


if ( ! _fp ) if ( ! _fp )
{ {
// printf( "error: no log file open!\n" ); // printf( "error: no log file open!\n" );
@@ -423,6 +428,10 @@ Loggable::flush ( void )


int n = _transaction.size(); int n = _transaction.size();


if ( n )
/* something done, reset undo index */
_undo_index = 1;

if ( n > 1 ) if ( n > 1 )
fprintf( _fp, "{\n" ); fprintf( _fp, "{\n" );


@@ -443,6 +452,7 @@ Loggable::flush ( void )
if ( n > 1 ) if ( n > 1 )
fprintf( _fp, "}\n" ); fprintf( _fp, "}\n" );



fflush( _fp ); fflush( _fp );
} }


@@ -510,8 +520,6 @@ Loggable::log_start ( void )
_old_state = e.sa(); _old_state = e.sa();
} }
++_nest; ++_nest;

_undo_index = 1;
} }


void void


+ 1
- 1
Timeline/Track.C View File

@@ -387,7 +387,6 @@ Track::handle ( int m )
{ {
case FL_MOUSEWHEEL: case FL_MOUSEWHEEL:
{ {

if ( ! Fl::event_shift() ) if ( ! Fl::event_shift() )
return 0; return 0;


@@ -404,6 +403,7 @@ Track::handle ( int m )
} }
case FL_PUSH: case FL_PUSH:
{ {

int X = Fl::event_x(); int X = Fl::event_x();
int Y = Fl::event_y(); int Y = Fl::event_y();




Loading…
Cancel
Save