Enforce restriction on total number of patterns and phrases.

This commit is contained in:
Jonathan Moore Liles 2012-02-29 23:06:21 -08:00
parent f8221f51e8
commit d733de358e
3 changed files with 19 additions and 4 deletions

View File

@ -195,9 +195,14 @@ canvas_input_callback ( O_Canvas *widget, Canvas *c, int m )
break;
case 'c':
{
c->grid( c->grid()->create() );
Grid *g = c->grid()->create();
if ( g )
{
c->grid( g );
ui->update_sequence_widgets();
}
break;
}

View File

@ -260,9 +260,14 @@ pattern::recording ( void )
/* allows us to create a new pattern/phrase from a base class pointer */
pattern *
pattern::create ( void )
{
if ( pattern::patterns() < 128 )
{
return new pattern;
}
else
return NULL;
}
pattern *
pattern::by_number ( int n ) const

View File

@ -108,9 +108,14 @@ phrase::reset ( void )
phrase *
phrase::create ( void )
{
if ( phrase::phrases() < 128 )
{
return new phrase;
}
else
return NULL;
}
phrase *
phrase::by_number ( int n ) const