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; break;
case 'c': case 'c':
{ {
c->grid( c->grid()->create() ); Grid *g = c->grid()->create();
if ( g )
{
c->grid( g );
ui->update_sequence_widgets(); ui->update_sequence_widgets();
}
break; break;
} }

View File

@ -261,7 +261,12 @@ pattern::recording ( void )
pattern * pattern *
pattern::create ( void ) pattern::create ( void )
{ {
if ( pattern::patterns() < 128 )
{
return new pattern; return new pattern;
}
else
return NULL;
} }
pattern * pattern *

View File

@ -109,7 +109,12 @@ phrase::reset ( void )
phrase * phrase *
phrase::create ( void ) phrase::create ( void )
{ {
if ( phrase::phrases() < 128 )
{
return new phrase; return new phrase;
}
else
return NULL;
} }
phrase * phrase *