Make new session dialog actually work.
This commit is contained in:
parent
5ca4efe837
commit
594f711533
|
@ -76,6 +76,9 @@ Loggable::close ( void )
|
||||||
|
|
||||||
DMESSAGE( "closing journal and destroying all journaled objects" );
|
DMESSAGE( "closing journal and destroying all journaled objects" );
|
||||||
|
|
||||||
|
if ( ! _fp )
|
||||||
|
return true;
|
||||||
|
|
||||||
fclose( _fp );
|
fclose( _fp );
|
||||||
|
|
||||||
_fp = NULL;
|
_fp = NULL;
|
||||||
|
|
|
@ -25,6 +25,8 @@ session state belongs to Timeline and other classes. */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "Loggable.H"
|
#include "Loggable.H"
|
||||||
#include "Session.H"
|
#include "Session.H"
|
||||||
|
@ -37,7 +39,7 @@ Session::set_name ( const char *name )
|
||||||
{
|
{
|
||||||
char *s = rindex( name, '/' );
|
char *s = rindex( name, '/' );
|
||||||
|
|
||||||
strcpy( Session::_name, s ? s : name );
|
strcpy( Session::_name, s ? s + 1 : name );
|
||||||
|
|
||||||
for ( s = Session::_name; *s; ++s )
|
for ( s = Session::_name; *s; ++s )
|
||||||
if ( *s == '_' || *s == '-' )
|
if ( *s == '_' || *s == '-' )
|
||||||
|
@ -81,6 +83,8 @@ Session::open ( const char *name )
|
||||||
FATAL( "error opening journal" );
|
FATAL( "error opening journal" );
|
||||||
|
|
||||||
set_name( name );
|
set_name( name );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -103,7 +107,7 @@ Session::create ( const char *name, const char *template_name )
|
||||||
|
|
||||||
mkdir( "sources", 0777 );
|
mkdir( "sources", 0777 );
|
||||||
|
|
||||||
set_name( name );
|
creat( "history", 0666 );
|
||||||
|
|
||||||
/* TODO: copy template */
|
/* TODO: copy template */
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ free( path );} {}
|
||||||
if ( ! name )
|
if ( ! name )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Loggable::close();
|
// Loggable::close();
|
||||||
// timeline->reset();
|
// timeline->reset();
|
||||||
main_window->redraw();}
|
main_window->redraw();}
|
||||||
xywh {0 0 40 25}
|
xywh {0 0 40 25}
|
||||||
|
@ -548,7 +548,7 @@ delete win;}
|
||||||
class Timeline
|
class Timeline
|
||||||
}
|
}
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
label {<session name>} selected
|
label {<session name>}
|
||||||
xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2
|
xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2
|
||||||
code0 {o->label( Session::name() );}
|
code0 {o->label( Session::name() );}
|
||||||
}
|
}
|
||||||
|
@ -637,8 +637,6 @@ with fast, light, reliable alternatives.}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decl {char new_session_pathname[512];} {}
|
|
||||||
|
|
||||||
class New_Session_Dialog {open
|
class New_Session_Dialog {open
|
||||||
} {
|
} {
|
||||||
Function {New_Session_Dialog()} {open
|
Function {New_Session_Dialog()} {open
|
||||||
|
@ -650,28 +648,12 @@ class New_Session_Dialog {open
|
||||||
code {_window->show();
|
code {_window->show();
|
||||||
|
|
||||||
while ( _window->shown() )
|
while ( _window->shown() )
|
||||||
Fl::wait();
|
Fl::wait();} {}
|
||||||
|
|
||||||
if ( strlen( _directory->value() ) && strlen( _name->value() ) )
|
|
||||||
{
|
|
||||||
snprintf( new_session_pathname, sizeof( new_session_pathname ), "%s/%s", _directory->value(), _name->value() );
|
|
||||||
|
|
||||||
return new_session_pathname;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;} {}
|
|
||||||
}
|
}
|
||||||
Function {make_window()} {open
|
Function {make_window()} {open
|
||||||
} {
|
} {
|
||||||
Fl_Window _window {
|
Fl_Window _window {
|
||||||
label {New Session}
|
label {New Session} open
|
||||||
callback {if ( Fl::event_key() == FL_Escape )
|
|
||||||
{
|
|
||||||
_directory->value( "" );
|
|
||||||
_name->value( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
o->hide();} open
|
|
||||||
xywh {464 344 550 195} type Double modal visible
|
xywh {464 344 550 195} type Double modal visible
|
||||||
} {
|
} {
|
||||||
Fl_File_Input _name {
|
Fl_File_Input _name {
|
||||||
|
@ -680,12 +662,23 @@ o->hide();} open
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
label Browse
|
label Browse
|
||||||
callback {_directory->value( fl_dir_chooser( "Session Directory", NULL, 0 ) );}
|
callback {_directory->value( fl_dir_chooser( "Directory for new session", NULL, 0 ) );} selected
|
||||||
xywh {455 110 80 25}
|
xywh {455 110 80 25}
|
||||||
}
|
}
|
||||||
Fl_Return_Button {} {
|
Fl_Return_Button {} {
|
||||||
label Create
|
label Create
|
||||||
callback {_window->hide();}
|
callback {if ( strlen( _directory->value() ) && strlen( _name->value() ) )
|
||||||
|
{
|
||||||
|
char pat[512];
|
||||||
|
|
||||||
|
snprintf( pat, sizeof( pat ), "%s/%s", _directory->value(), _name->value() );
|
||||||
|
|
||||||
|
|
||||||
|
if ( ! Session::create( pat, _template->text( _template->value() ) ) )
|
||||||
|
fl_alert( "Error opening session!" );
|
||||||
|
|
||||||
|
_window->hide();
|
||||||
|
}}
|
||||||
xywh {455 140 80 35}
|
xywh {455 140 80 35}
|
||||||
}
|
}
|
||||||
Fl_Output _directory {
|
Fl_Output _directory {
|
||||||
|
|
|
@ -104,12 +104,6 @@ main ( int argc, char **argv )
|
||||||
|
|
||||||
printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT );
|
printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT );
|
||||||
|
|
||||||
if ( argc > 1 )
|
|
||||||
if ( ! Session::open( argv[ 1 ] ) )
|
|
||||||
FATAL( "Could not open session specified on command line" );
|
|
||||||
|
|
||||||
/* FIXME: open session in /tmp if none is given? */
|
|
||||||
|
|
||||||
TLE tle;
|
TLE tle;
|
||||||
|
|
||||||
MESSAGE( "Initializing JACK" );
|
MESSAGE( "Initializing JACK" );
|
||||||
|
@ -122,6 +116,12 @@ main ( int argc, char **argv )
|
||||||
* scenario requiring otherwise */
|
* scenario requiring otherwise */
|
||||||
transport->stop();
|
transport->stop();
|
||||||
|
|
||||||
|
if ( argc > 1 )
|
||||||
|
if ( ! Session::open( argv[ 1 ] ) )
|
||||||
|
FATAL( "Could not open session specified on command line" );
|
||||||
|
|
||||||
|
/* FIXME: open session in /tmp if none is given? */
|
||||||
|
|
||||||
MESSAGE( "Starting GUI" );
|
MESSAGE( "Starting GUI" );
|
||||||
// tle.main_window->show( argc, argv );
|
// tle.main_window->show( argc, argv );
|
||||||
tle.main_window->show();
|
tle.main_window->show();
|
||||||
|
|
Loading…
Reference in New Issue