Mixer: Implement Project/Open menu option.

This commit is contained in:
Jonathan Moore Liles 2010-01-23 12:22:33 -06:00
parent 74f674b30f
commit bf376d9171
5 changed files with 37 additions and 10 deletions

View File

@ -36,6 +36,10 @@ public:
_max_width = _hspacing = _vspacing = 0;
}
virtual ~Fl_Flowpack ( )
{
}
int max_width ( void ) const { return _max_width; }
void vspacing ( int v ) { _vspacing = v; }

View File

@ -26,6 +26,7 @@
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/fl_ask.H>
#include <FL/Fl_File_Chooser.H>
#include "New_Project_Dialog.H"
#include "Engine/Engine.H"
#include "FL/Fl_Flowpack.H"
@ -78,6 +79,26 @@ void Mixer::cb_menu(Fl_Widget* o) {
// write_line( user_config_dir, "default_path", default_path );
}
else if (! strcmp( picked, "&Project/&Open" ) )
{
char *path = NULL;
// read_line( user_config_dir, "default_path", &path );
const char *name = fl_dir_chooser( "Open Project", path, NULL );
free( path );
mixer->hide();
if ( int err = Project::open( name ) )
{
fl_alert( "Error opening project: %s", Project::errstr( err ) );
mixer->show();
}
mixer->show();
}
else if (! strcmp( picked, "&Project/&Save" ) )
{
Project::save();
@ -169,8 +190,10 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
Mixer::~Mixer ( )
{
/* FIXME: teardown */
DMESSAGE( "Destroying mixer" );
/* FIXME: teardown */
mixer_strips->clear();
}
void Mixer::resize ( int X, int Y, int W, int H )
@ -244,8 +267,6 @@ void Mixer::remove ( Mixer_Strip *ms )
mixer_strips->remove( ms );
delete ms;
parent()->redraw();
}

View File

@ -182,6 +182,8 @@ Mixer_Strip::~Mixer_Strip ( )
_chain = NULL;
log_destroy();
mixer->remove( this );
}
void Mixer_Strip::cb_handle(Fl_Widget* o) {
@ -213,6 +215,7 @@ void Mixer_Strip::cb_handle(Fl_Widget* o) {
if ( Fl::event_shift() || 1 == fl_choice( "Are you sure you want to remove this strip?\n\n(this action cannot be undone)", "Cancel", "Remove", NULL ) )
{
((Mixer*)parent())->remove( this );
Fl::delete_widget( this );
}
}
else if ( o == name_field )

View File

@ -179,7 +179,7 @@ Project::close ( void )
if ( ! save() )
return false;
/* Loggable::close(); */
Loggable::close();
/* // write_info(); */
_is_open = false;

View File

@ -219,12 +219,11 @@ Loggable::close ( void )
{
DMESSAGE( "closing journal and destroying all journaled objects" );
if ( ! _fp )
return true;
fclose( _fp );
_fp = NULL;
if ( _fp )
{
fclose( _fp );
_fp = NULL;
}
if ( ! snapshot( "snapshot" ) )
WARNING( "Failed to create snapshot" );