diff --git a/Mixer/Controller_Module.C b/Mixer/Controller_Module.C index 990327d..5bc0dc9 100644 --- a/Mixer/Controller_Module.C +++ b/Mixer/Controller_Module.C @@ -268,6 +268,17 @@ Controller_Module::connect_to ( Port *p ) } } +void +Controller_Module::resize ( int X, int Y, int W, int H ) +{ + Module::resize( X, Y, W, H ); + + if ( ! _pad && children() ) + { + child( 0 )->resize( X, Y, W, H ); + } +} + int Controller_Module::handle ( int m ) { diff --git a/Mixer/Controller_Module.H b/Mixer/Controller_Module.H index ac7c28e..54700a8 100644 --- a/Mixer/Controller_Module.H +++ b/Mixer/Controller_Module.H @@ -77,6 +77,8 @@ protected: virtual int handle ( int m ); + void resize ( int, int, int, int ); + private: std::vector jack_input; diff --git a/Mixer/Gain_Module.C b/Mixer/Gain_Module.C index 544f3d3..7b5fa36 100644 --- a/Mixer/Gain_Module.C +++ b/Mixer/Gain_Module.C @@ -50,6 +50,7 @@ Gain_Module::Gain_Module ( ) Gain_Module::~Gain_Module ( ) { + delete (float*)control_input[0].buffer(); log_destroy(); } diff --git a/Mixer/Gain_Module.H b/Mixer/Gain_Module.H index aa3b46a..c1335e4 100644 --- a/Mixer/Gain_Module.H +++ b/Mixer/Gain_Module.H @@ -26,7 +26,6 @@ class Gain_Module : public Module public: Gain_Module ( ); - Gain_Module ( int W, int H, const char *L=0 ); virtual ~Gain_Module ( ); const char *name ( void ) const { return "Gain"; } diff --git a/Mixer/Mixer.C b/Mixer/Mixer.C index f0cf01e..675b15b 100644 --- a/Mixer/Mixer.C +++ b/Mixer/Mixer.C @@ -25,7 +25,8 @@ #include #include #include - +#include +#include "New_Project_Dialog.H" #include "Engine/Engine.H" #include "Project.H" @@ -46,6 +47,53 @@ static void update_cb( void *v ) { ((Mixer*)v)->update(); } + +void Mixer::cb_menu(Fl_Widget* o) { + Fl_Menu_Bar *menu = (Fl_Menu_Bar*)o; + +/* const Fl_Menu_Item *mi = &menu->menu()[menu->value()]; */ + + char picked[256]; + // const char *picked = menu->text(); + + menu->item_pathname( picked, sizeof( picked ) ); + + if (! strcmp( picked, "&Project/&New") ) + { + DMESSAGE( "New project" ); + const char *templates[] = { "Default", NULL }; + + char *default_path; + char *selected_template; + +// read_line( user_config_dir, "default_path", &default_path ); + + char *path = new_project_chooser( templates, &default_path, &selected_template ); + + if ( ! Project::create( path, selected_template ) ) + fl_alert( "Error creating project!" ); + + free( path ); + free( selected_template ); + free( default_path ); + +// write_line( user_config_dir, "default_path", default_path ); + + } + else if (! strcmp( picked, "&Project/&Save" ) ) + { + Project::save(); + } + else if ( !strcmp( picked, "&Mixer/&Add Strip" ) ) + { + new_strip(); + } +} + +void Mixer::cb_menu(Fl_Widget* o, void* v) { + ((Mixer*)(v))->cb_menu(o); +} + Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L ) { @@ -54,9 +102,11 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : { Fl_Menu_Bar *o = new Fl_Menu_Bar( X, Y, W, 24 ); o->add( "&Project/&New" ); o->add( "&Project/&Open" ); - o->add( "&Project/&Quit" ); - o->add( "&Mixer/&Add Strip" ); + o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); + o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); + o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); o->add( "&Options" ); + o->callback( cb_menu, this ); } { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 ); o->box( FL_NO_BOX ); @@ -211,7 +261,7 @@ Mixer::save ( void ) { MESSAGE( "Saving state" ); Loggable::snapshot_callback( &Mixer::snapshot, this ); - Loggable::snapshot( "save.mix" ); + Loggable::snapshot( "snapshot" ); return true; } @@ -226,23 +276,6 @@ Mixer::handle ( int m ) case FL_ENTER: case FL_LEAVE: return 1; - case FL_SHORTCUT: - { - if ( Fl::event_key() == 'a' ) - { - new_strip(); - return 1; - } - else if ( Fl::event_ctrl() && Fl::event_key() == 's' ) - { -// save(); - Project::save(); - return 1; - } - else - return r; - break; - } default: return r; break; diff --git a/Mixer/Mixer.H b/Mixer/Mixer.H index aa31482..b005986 100644 --- a/Mixer/Mixer.H +++ b/Mixer/Mixer.H @@ -37,6 +37,9 @@ private: void snapshot ( void ); static void snapshot ( void *v ) { ((Mixer*)v)->snapshot(); } + void cb_menu(Fl_Widget*); + static void cb_menu(Fl_Widget*, void*); + Fl_Scroll *scroll; Fl_Pack *pack; diff --git a/Mixer/Mixer_Strip.C b/Mixer/Mixer_Strip.C index a00531d..85008a8 100644 --- a/Mixer/Mixer_Strip.C +++ b/Mixer/Mixer_Strip.C @@ -208,16 +208,16 @@ Mixer_Strip::handle_module_added ( Module *m ) DMESSAGE( "Connecting controls to default module \"%s\"", m->name() ); /* connect default modules to their default controllers/indicators */ - if ( ! strcmp( m->name(), "JACK" ) && m->ninputs() == 0 ) + if ( 0 == strcmp( m->name(), "JACK" ) && m->ninputs() == 0 ) { if ( !jack_input_controller->control_output[0].connected() ) jack_input_controller->connect_to( &m->control_input[1] ); } - else if ( ! strcmp( m->name(), "Gain" ) ) + else if ( 0 == strcmp( m->name(), "Gain" ) ) { gain_controller->connect_to( &m->control_input[0] ); } - else if ( ! strcmp( m->name(), "Meter" ) ) + else if ( 0 == strcmp( m->name(), "Meter" ) ) { meter_indicator->connect_to( &m->control_output[0] ); } @@ -327,7 +327,6 @@ Mixer_Strip::init ( ) Fl_Group::current()->resizable(o); } - o->end(); Fl_Group::current()->resizable(o); } // Fl_Group* o diff --git a/Mixer/Module.H b/Mixer/Module.H index 4f6b37c..d1b4b0c 100644 --- a/Mixer/Module.H +++ b/Mixer/Module.H @@ -46,8 +46,8 @@ class Module : public Fl_Group, public Loggable { Module_Parameter_Editor *_editor; - void cb_handle(Fl_Widget*); - static void cb_handle(Fl_Widget*, void*); +/* void cb_handle(Fl_Widget*); */ +/* static void cb_handle(Fl_Widget*, void*); */ void init ( void ); diff --git a/Mixer/Project.C b/Mixer/Project.C index 43e716b..28e2846 100644 --- a/Mixer/Project.C +++ b/Mixer/Project.C @@ -266,6 +266,8 @@ Project::open ( const char *name ) // timeline->zoom_fit(); + + MESSAGE( "Loaded project \"%s\"", name ); return 0; @@ -293,7 +295,7 @@ Project::create ( const char *name, const char *template_name ) if ( chdir( name ) ) FATAL( "WTF? Cannot change to new project directory" ); - mkdir( "sources", 0777 ); +// mkdir( "sources", 0777 ); creat( "snapshot", 0666 ); /* TODO: copy template */