Browse Source

Mixer: Separate out public project commands.

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
cfd217e200
4 changed files with 75 additions and 4 deletions
  1. +58
    -4
      Mixer/Mixer.C
  2. +10
    -0
      Mixer/Mixer.H
  3. +6
    -0
      Mixer/Project.C
  4. +1
    -0
      Mixer/Project.H

+ 58
- 4
Mixer/Mixer.C View File

@@ -115,15 +115,15 @@ void Mixer::cb_menu(Fl_Widget* o) {
} }
else if (! strcmp( picked, "&Project/&Save" ) ) else if (! strcmp( picked, "&Project/&Save" ) )
{ {
Project::save();
command_save();
} }
else if (! strcmp( picked, "&Project/&Quit") ) else if (! strcmp( picked, "&Project/&Quit") )
{ {
quit();
command_quit();
} }
else if ( !strcmp( picked, "&Mixer/&Add Strip" ) ) else if ( !strcmp( picked, "&Mixer/&Add Strip" ) )
{ {
new_strip();
command_add_strip();
} }
else if ( !strcmp( picked, "&Mixer/Add &N Strips" ) ) else if ( !strcmp( picked, "&Mixer/Add &N Strips" ) )
{ {
@@ -132,7 +132,7 @@ void Mixer::cb_menu(Fl_Widget* o) {
if ( s ) if ( s )
{ {
for ( int i = atoi( s ); i > 0; i-- ) for ( int i = atoi( s ); i > 0; i-- )
new_strip();
command_add_strip();
} }
} }
else if (! strcmp( picked, "&Mixer/&Rows/One") ) else if (! strcmp( picked, "&Mixer/&Rows/One") )
@@ -487,3 +487,57 @@ Mixer::handle ( int m )


return 0; return 0;
} }


/************/
/* Commands */
/************/

bool
Mixer::command_save ( void )
{
return Project::save();
}

bool
Mixer::command_load ( const char *path, const char *display_name )
{
if ( int err = Project::open( path ) )
{
// fl_alert( "Error opening project specified on commandline: %s", Project::errstr( err ) );
return false;
}

if ( display_name )
Project::name( display_name );

return true;
}

bool
Mixer::command_new ( const char *path, const char *display_name )
{
if ( ! Project::create( path, "" ) )
return false;

if ( display_name )
Project::name( display_name );

return true;
// fl_alert( "Error creating project!" );
}

void
Mixer::command_quit ( void )
{
quit();
}

/* */

void
Mixer::command_add_strip ( void )
{
new_strip();
}

+ 10
- 0
Mixer/Mixer.H View File

@@ -83,6 +83,16 @@ public:


Mixer ( int X, int Y, int W, int H, const char *L ); Mixer ( int X, int Y, int W, int H, const char *L );
virtual ~Mixer(); virtual ~Mixer();

public:

bool command_save ( void );
bool command_load ( const char *path, const char *display_name = 0 );
bool command_new ( const char *path, const char *display_name = 0 );
void command_quit ( void );

void command_add_strip ( void );

}; };


extern Mixer* mixer; extern Mixer* mixer;

+ 6
- 0
Mixer/Project.C View File

@@ -84,6 +84,12 @@ Project::set_name ( const char *name )
*s = ' '; *s = ' ';
} }


void
Project::name ( const char *name )
{
strcpy( Project::_name, name );
}

bool bool
Project::write_info ( void ) Project::write_info ( void )
{ {


+ 1
- 0
Mixer/Project.H View File

@@ -50,6 +50,7 @@ public:
static const char *errstr ( int n ) { return _errstr[ ( 0 - n ) - 1 ]; } static const char *errstr ( int n ) { return _errstr[ ( 0 - n ) - 1 ]; }


static const char *name ( void ) { return Project::_name; } static const char *name ( void ) { return Project::_name; }
static void name ( const char *v );
static void compact ( void ); static void compact ( void );
static bool close ( void ); static bool close ( void );
static bool save ( void ); static bool save ( void );


Loading…
Cancel
Save