Get undo working again.
This commit is contained in:
parent
300c6c3726
commit
5f662f3913
|
@ -30,58 +30,6 @@ class Audio_Sequence : public Sequence
|
|||
|
||||
protected:
|
||||
|
||||
|
||||
/* void set ( char **sa ) */
|
||||
/* { */
|
||||
/* for ( int i = 0; sa[i]; ++i ) */
|
||||
/* { */
|
||||
/* char *s = sa[i]; */
|
||||
/* char *v = s + strlen( s ) + 1; */
|
||||
|
||||
/* else if ( ! strcmp( s, ":name" ) ) */
|
||||
/* { */
|
||||
/* if ( _name ) */
|
||||
/* free( _name ); */
|
||||
|
||||
/* _name = strdup( v ); */
|
||||
/* } */
|
||||
/* else if ( ! strcmp( s, ":track" ) ) */
|
||||
/* { */
|
||||
/* int i; */
|
||||
/* sscanf( v, "%X", &i ); */
|
||||
|
||||
/* if ( i ) */
|
||||
/* { */
|
||||
/* Sequence *t = (Sequence*)Loggable::find( i ); */
|
||||
|
||||
/* assert( t ); */
|
||||
|
||||
/* track( t ); */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* free( s ); */
|
||||
/* } */
|
||||
|
||||
/* free( sa ); */
|
||||
|
||||
/* } */
|
||||
|
||||
/* char ** get ( void ) */
|
||||
/* { */
|
||||
/* char **sa = (char**)malloc( sizeof( char* ) * (1 + 1) ); */
|
||||
|
||||
/* int i = 0; */
|
||||
|
||||
/* asprintf( &sa[ i++ ], ":name \"%s\"", _name ? _name : "" ); */
|
||||
/* // asprintf( &sa[ i++ ], ":track 0x%X", track() ? track()->id() : 0 ); */
|
||||
|
||||
/* sa[ i ] = NULL; */
|
||||
|
||||
/* return sa; */
|
||||
/* } */
|
||||
|
||||
|
||||
Audio_Sequence ( ) : Sequence( 0, 0, 0, 0 )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ Loggable::do_this ( const char *s, bool reverse )
|
|||
|
||||
if ( reverse )
|
||||
{
|
||||
sscanf( s, "%s %*X %s %*[^\n<] %a[^\n]", classname, command, &arguments );
|
||||
sscanf( s, "%s %*X %s %*[^\n<]<< %a[^\n]", classname, command, &arguments );
|
||||
create = "destroy";
|
||||
destroy = "create";
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ Loggable::do_this ( const char *s, bool reverse )
|
|||
}
|
||||
else if ( ! strcmp( command, "set" ) )
|
||||
{
|
||||
printf( "got set command.\n" );
|
||||
printf( "got set command (%s).\n", arguments );
|
||||
|
||||
char **sa = parse_alist( arguments );
|
||||
|
||||
|
@ -407,13 +407,13 @@ Loggable::log_print( char **o, char **n )
|
|||
{
|
||||
if ( n )
|
||||
for ( ; *n; n++ )
|
||||
log( "%s%s", *n, *(n + 1) ? " " : "" );
|
||||
log( "%s %s%s", *n, *n + strlen( *n ) + 1, *(n + 1) ? " " : "" );
|
||||
|
||||
if ( o && *o )
|
||||
{
|
||||
if ( n ) log( " << " );
|
||||
for ( ; *o; o++ )
|
||||
log( "%s%s", *o, *(o + 1) ? " " : "" );
|
||||
log( "%s %s%s", *o, *o + strlen( *o ) + 1, *(o + 1) ? " " : "" );
|
||||
}
|
||||
|
||||
log( "\n" );
|
||||
|
@ -431,7 +431,10 @@ log_diff ( char **sa1, char **sa2 )
|
|||
int w = 0;
|
||||
for ( int i = 0; sa1[ i ]; ++i )
|
||||
{
|
||||
if ( ! strcmp( sa1[ i ], sa2[ i ] ) )
|
||||
const char *v1 = sa1[ i ] + strlen( sa1[ i ] ) + 1;
|
||||
const char *v2 = sa2[ i ] + strlen( sa2[ i ] ) + 1;
|
||||
|
||||
if ( ! strcmp( sa1[ i ], sa2[ i ] ) && ! strcmp( v1, v2 ) )
|
||||
{
|
||||
free( sa2[ i ] );
|
||||
free( sa1[ i ] );
|
||||
|
|
|
@ -38,12 +38,6 @@ class Log_Entry;
|
|||
class Loggable;
|
||||
typedef Loggable *(create_func)(Log_Entry &);
|
||||
|
||||
/* struct Pair */
|
||||
/* { */
|
||||
/* const char *name; */
|
||||
/* const char *value; */
|
||||
/* }; */
|
||||
|
||||
|
||||
|
||||
#define LOG_CREATE_FUNC( class ) \
|
||||
|
@ -236,6 +230,12 @@ class Log_Entry
|
|||
|
||||
public:
|
||||
|
||||
struct Pair
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
Log_Entry ( )
|
||||
{
|
||||
_sa = (char**)malloc( sizeof( char * ) );
|
||||
|
@ -245,14 +245,15 @@ public:
|
|||
|
||||
Log_Entry ( char **sa )
|
||||
{
|
||||
_sa = _sa;
|
||||
_sa = sa;
|
||||
_i = 0;
|
||||
|
||||
for ( _i = 0; _sa[ _i ]; ++_i );
|
||||
if ( _sa )
|
||||
while ( _sa[ _i ] ) ++_i;
|
||||
}
|
||||
|
||||
~Log_Entry ( )
|
||||
{
|
||||
|
||||
if ( ! _sa )
|
||||
return;
|
||||
|
||||
|
@ -271,17 +272,17 @@ public:
|
|||
void grow ( )
|
||||
{
|
||||
_sa = (char**)realloc( _sa, sizeof( char * ) * (_i + 2) );
|
||||
_sa[ _i ] = NULL;
|
||||
_sa[ _i + 1 ] = NULL;
|
||||
}
|
||||
|
||||
#define ADD( type, format, exp ) \
|
||||
#define ADD( type, format, exp ) \
|
||||
void add ( const char *name, type v ) \
|
||||
{ \
|
||||
grow(); \
|
||||
asprintf( &_sa[ _i++ ], "%s " format, name, (exp) ); \
|
||||
asprintf( &_sa[ _i ], "%s " format, name, (exp) ); \
|
||||
strtok( _sa[ _i++ ], " " ); \
|
||||
} \
|
||||
|
||||
|
||||
/***************/
|
||||
/* Examination */
|
||||
/***************/
|
||||
|
@ -319,7 +320,7 @@ public:
|
|||
/* } \ */
|
||||
|
||||
ADD( int, "%d", v );
|
||||
ADD( nframes_t, "%lu", v );
|
||||
ADD( nframes_t, "%lu", (unsigned long)v );
|
||||
ADD( const char *, "\"%s\"", v ? v : "" );
|
||||
ADD( Loggable *, "0x%X", v ? v->id() : 0 );
|
||||
ADD( float, "%f", v );
|
||||
|
|
Loading…
Reference in New Issue