Add emacs-like redo.

pull/167/head
Nicolò Balzarotti 2015-09-22 18:02:43 +02:00 committed by nixo
parent 7565be85fb
commit aebe16893c
7 changed files with 33 additions and 1 deletions

View File

@ -541,6 +541,15 @@ Loggable::undo ( void )
}
void
Loggable::redo ( void )
{
if (! _fp)
return;
_undo_offset = ftell( _fp );
}
/** write a snapshot of the current state of all loggable objects to
* file handle /fp/ */
bool

View File

@ -177,6 +177,7 @@ public:
static bool open ( const char *filename );
static bool close ( void );
static void undo ( void );
static void redo ( void );
static void compact ( void );

View File

@ -134,6 +134,12 @@ Project::undo ( void )
Loggable::undo();
}
void
Project::redo ( void )
{
Loggable::redo();
}
bool
Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date, char **created_by )
{

View File

@ -62,5 +62,6 @@ public:
static bool open ( void ) { return _is_open; }
static bool create ( const char *name, const char *template_name );
static void undo ( void );
static void redo ( void );
static const char *created_on ( void ) { return _created_on; }
};

View File

@ -456,7 +456,12 @@ free(path);}
MenuItem {} {
label Undo
callback {timeline->command_undo();}
xywh {5 5 40 25} shortcut 0x4007a divider
xywh {5 5 40 25} shortcut 0x4007a
}
MenuItem {} {
label Redo
callback {timeline->command_redo();}
xywh {5 5 40 25} shortcut 0x40079 divider
}
MenuItem {} {
label {Select None}

View File

@ -2088,6 +2088,15 @@ Timeline::command_undo ( void )
track_lock.unlock();
}
void
Timeline::command_redo ( void )
{
/* FIXME: sequence lock too? */
track_lock.wrlock();
Project::redo();
track_lock.unlock();
}
bool
Timeline::command_load ( const char *name, const char *display_name )
{

View File

@ -246,6 +246,7 @@ public:
void command_move_track_up ( Track *track );
void command_move_track_down ( Track *track );
void command_undo ( void );
void command_redo ( void );
int find_track ( const Track * track ) const;