s/Session/Project/ig

This commit is contained in:
Jonathan Moore Liles 2008-05-06 18:33:24 -05:00
parent 45aeb9ad89
commit c413255e4a
6 changed files with 58 additions and 58 deletions

View File

@ -165,7 +165,7 @@ Engine::init ( void )
set_callback( process ); set_callback( process );
set_callback( xrun ); set_callback( xrun );
/* FIXME: should we wait to register this until after the session /* FIXME: should we wait to register this until after the project
has been loaded (and we have disk threads running)? */ has been loaded (and we have disk threads running)? */
set_callback( sync ); set_callback( sync );

View File

@ -17,8 +17,8 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/ /*******************************************************************************/
/* Routings for opening/closing/creation of sessions. All the actual /* Routings for opening/closing/creation of projects. All the actual
session state belongs to Timeline and other classes. */ project state belongs to Timeline and other classes. */
#include <stdio.h> #include <stdio.h>
@ -29,20 +29,20 @@ session state belongs to Timeline and other classes. */
#include <fcntl.h> #include <fcntl.h>
#include "Loggable.H" #include "Loggable.H"
#include "Session.H" #include "Project.H"
#include "debug.h" #include "debug.h"
char Session::_name[256]; char Project::_name[256];
bool Session::_is_open = false; bool Project::_is_open = false;
void void
Session::set_name ( const char *name ) Project::set_name ( const char *name )
{ {
char *s = rindex( name, '/' ); char *s = rindex( name, '/' );
strcpy( Session::_name, s ? s + 1 : name ); strcpy( Project::_name, s ? s + 1 : name );
for ( s = Session::_name; *s; ++s ) for ( s = Project::_name; *s; ++s )
if ( *s == '_' || *s == '-' ) if ( *s == '_' || *s == '-' )
*s = ' '; *s = ' ';
} }
@ -58,7 +58,7 @@ exists ( const char *name )
#include <errno.h> #include <errno.h>
bool bool
Session::close ( void ) Project::close ( void )
{ {
Loggable::close(); Loggable::close();
@ -66,11 +66,11 @@ Session::close ( void )
} }
bool bool
Session::open ( const char *name ) Project::open ( const char *name )
{ {
if ( chdir( name ) ) if ( chdir( name ) )
{ {
WARNING( "Cannot change to session dir \"%s\"", name ); WARNING( "Cannot change to project dir \"%s\"", name );
return false; return false;
} }
@ -78,7 +78,7 @@ Session::open ( const char *name )
! exists( "sources" ) ) ! exists( "sources" ) )
// ! exists( "options" ) ) // ! exists( "options" ) )
{ {
WARNING( "Not a Non-DAW session: \"%s\"", name ); WARNING( "Not a Non-DAW project: \"%s\"", name );
return false; return false;
} }
@ -93,22 +93,22 @@ Session::open ( const char *name )
} }
bool bool
Session::create ( const char *name, const char *template_name ) Project::create ( const char *name, const char *template_name )
{ {
if ( exists( name ) ) if ( exists( name ) )
{ {
WARNING( "Session already exists" ); WARNING( "Project already exists" );
return false; return false;
} }
if ( mkdir( name, 0777 ) ) if ( mkdir( name, 0777 ) )
{ {
WARNING( "Cannot create session directory" ); WARNING( "Cannot create project directory" );
return false; return false;
} }
if ( chdir( name ) ) if ( chdir( name ) )
FATAL( "WTF? Cannot change to new session directory" ); FATAL( "WTF? Cannot change to new project directory" );
mkdir( "sources", 0777 ); mkdir( "sources", 0777 );

View File

@ -20,7 +20,7 @@
const char template_dir[] = "share/non-daw/templates"; const char template_dir[] = "share/non-daw/templates";
const char user_template_dir[] = "~/.non-daw/templates"; const char user_template_dir[] = "~/.non-daw/templates";
class Session class Project
{ {
static bool _is_open; static bool _is_open;
@ -29,7 +29,7 @@ class Session
public: public:
static const char *name ( void ) { return Session::_name; } static const char *name ( void ) { return Project::_name; }
static void set_name ( const char *name ); static void set_name ( const char *name );
static bool close ( void ); static bool close ( void );
static bool open ( const char *name ); static bool open ( const char *name );

View File

@ -14,7 +14,7 @@ decl {\#include "Transport.H"} {}
decl {\#include "Loggable.H"} {} decl {\#include "Loggable.H"} {}
decl {\#include "Session.H"} {} decl {\#include "Project.H"} {}
decl {\#include "Clock.H"} {public decl {\#include "Clock.H"} {public
} }
@ -35,7 +35,7 @@ decl {\#include <FL/Fl_File_Chooser.H>} {}
decl {\#include <FL/Fl.H>} {} decl {\#include <FL/Fl.H>} {}
decl {extern char session_display_name[256];} {global decl {extern char project_display_name[256];} {global
} }
decl {extern char *user_config_dir;} {global decl {extern char *user_config_dir;} {global
@ -68,9 +68,9 @@ free( path );
// Loggable::save_unjournaled( state_filename ); // Loggable::save_unjournaled( state_filename );
if ( Session::open() ) if ( Project::open() )
{ {
// save session local options (Timeline menu) // save project local options (Timeline menu)
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), options_filename ); ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), options_filename );
}} {} }} {}
} }
@ -144,7 +144,7 @@ free( path );} {selected
xywh {0 0 1024 25} xywh {0 0 1024 25}
} { } {
Submenu {} { Submenu {} {
label {&Session} open label {&Project} open
xywh {0 0 74 25} xywh {0 0 74 25}
} { } {
MenuItem {} { MenuItem {} {
@ -155,7 +155,7 @@ free( path );} {selected
label {&New} label {&New}
callback {save_timeline_settings(); callback {save_timeline_settings();
new_session_chooser(); new_project_chooser();
load_timeline_settings(); load_timeline_settings();
@ -168,15 +168,15 @@ main_window->redraw();}
label {&Open} label {&Open}
callback {save_timeline_settings(); callback {save_timeline_settings();
const char *name = fl_dir_chooser( "Open Session", NULL, NULL ); const char *name = fl_dir_chooser( "Open Project", NULL, NULL );
Session::close(); Project::close();
if ( ! Session::open( name ) ) if ( ! Project::open( name ) )
{ {
fl_alert( "Could not open \\"%s\\" as a Non-DAW session!", name ); fl_alert( "Could not open \\"%s\\" as a Non-DAW project!", name );
// we are in a somewhar ambiguous state now with no session open. // we are in a somewhar ambiguous state now with no project open.
} }
else else
{ {
@ -188,7 +188,7 @@ update_menu();}
} }
MenuItem {} { MenuItem {} {
label {&Compact} label {&Compact}
callback {int n = fl_choice( "Compacting will replace the session history with a snapshot of the current state.\\n You will not be able to use Undo to go back beyond this point.\\n This operation is irreversible!", NULL, "Abort", "Procede with compaction" ); callback {int n = fl_choice( "Compacting will replace the project history with a snapshot of the current state.\\n You will not be able to use Undo to go back beyond this point.\\n This operation is irreversible!", NULL, "Abort", "Procede with compaction" );
if ( n != 2 ) if ( n != 2 )
return; return;
@ -201,7 +201,7 @@ Loggable::compact();}
xywh {0 0 74 25} deactivate xywh {0 0 74 25} deactivate
} { } {
MenuItem {} { MenuItem {} {
label Session label Project
xywh {0 0 40 25} xywh {0 0 40 25}
} }
MenuItem {} { MenuItem {} {
@ -592,9 +592,9 @@ delete win;}
class Timeline class Timeline
} }
Fl_Box {} { Fl_Box {} {
label {<session name>} label {<project 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( Project::name() );}
} }
Fl_Value_Output xruns_output { Fl_Value_Output xruns_output {
label {xruns:} label {xruns:}
@ -610,11 +610,11 @@ delete win;}
} { } {
code {Fl_Menu_Bar *m = menubar; code {Fl_Menu_Bar *m = menubar;
if ( ! Session::open() ) if ( ! Project::open() )
{ {
find_item( m, "&Session/&Export" )->deactivate(); find_item( m, "&Project/&Export" )->deactivate();
find_item( m, "&Session/&Compact" )->deactivate(); find_item( m, "&Project/&Compact" )->deactivate();
find_item( m, "&Session/&Info" )->deactivate(); find_item( m, "&Project/&Info" )->deactivate();
find_item( m, "&Timeline" )->deactivate(); find_item( m, "&Timeline" )->deactivate();
@ -623,9 +623,9 @@ if ( ! Session::open() )
} }
else else
{ {
find_item( m, "&Session/&Export" )->activate(); find_item( m, "&Project/&Export" )->activate();
find_item( m, "&Session/&Compact" )->activate(); find_item( m, "&Project/&Compact" )->activate();
find_item( m, "&Session/&Info" )->activate(); find_item( m, "&Project/&Info" )->activate();
find_item( m, "&Timeline" )->activate(); find_item( m, "&Timeline" )->activate();
@ -714,24 +714,24 @@ with fast, light, reliable alternatives.}
} }
Function {save_timeline_settings()} {open Function {save_timeline_settings()} {open
} { } {
code {if ( Session::open() ) code {if ( Project::open() )
{ {
// save session local options (Timeline menu) // save project local options (Timeline menu)
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), "options" ); ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), "options" );
}} {} }} {}
} }
Function {load_timeline_settings()} {open Function {load_timeline_settings()} {open
} { } {
code {if ( Session::open() ) code {if ( Project::open() )
{ {
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Timeline" ), "options" ); ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Timeline" ), "options" );
}} {} }} {}
} }
} }
class New_Session_Dialog {open class New_Project_Dialog {open
} { } {
Function {New_Session_Dialog()} {open Function {New_Project_Dialog()} {open
} { } {
code {make_window();} {} code {make_window();} {}
} }
@ -745,7 +745,7 @@ while ( _window->shown() )
Function {make_window()} {open Function {make_window()} {open
} { } {
Fl_Window _window { Fl_Window _window {
label {New Session} open label {New Project} open
xywh {576 340 550 195} type Double modal visible xywh {576 340 550 195} type Double modal visible
} { } {
Fl_File_Input _name { Fl_File_Input _name {
@ -754,7 +754,7 @@ while ( _window->shown() )
} }
Fl_Button {} { Fl_Button {} {
label Browse label Browse
callback {_directory->value( fl_dir_chooser( "Directory for new session", NULL, 0 ) );} callback {_directory->value( fl_dir_chooser( "Directory for new project", NULL, 0 ) );}
xywh {455 100 80 35} xywh {455 100 80 35}
} }
Fl_Return_Button {} { Fl_Return_Button {} {
@ -768,8 +768,8 @@ while ( _window->shown() )
// if ( ! fl_filename_exists( pat ) ) // if ( ! fl_filename_exists( pat ) )
{ {
if ( ! Session::create( pat, _template->text( _template->value() ) ) ) if ( ! Project::create( pat, _template->text( _template->value() ) ) )
fl_alert( "Error opening session!" ); fl_alert( "Error opening project!" );
_window->hide(); _window->hide();
} }
@ -792,7 +792,7 @@ while ( _window->shown() )
code0 {\#include <FL/filename.H>} code0 {\#include <FL/filename.H>}
} }
Fl_Box {} { Fl_Box {} {
label {New Session} label {New Project}
xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32 xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
} }
Fl_Choice _template { Fl_Choice _template {
@ -808,9 +808,9 @@ while ( _window->shown() )
} }
} }
Function {new_session_chooser()} {open C return_type void Function {new_project_chooser()} {open C return_type void
} { } {
code {New_Session_Dialog nsd; code {New_Project_Dialog nsd;
nsd.run();} {} nsd.run();} {}
} }

View File

@ -49,7 +49,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "Session.H" #include "Project.H"
Engine *engine; Engine *engine;
Timeline *timeline; Timeline *timeline;
@ -117,10 +117,10 @@ main ( int argc, char **argv )
transport->stop(); transport->stop();
if ( argc > 1 ) if ( argc > 1 )
if ( ! Session::open( argv[ 1 ] ) ) if ( ! Project::open( argv[ 1 ] ) )
FATAL( "Could not open session specified on command line" ); FATAL( "Could not open project specified on command line" );
/* FIXME: open session in /tmp if none is given? */ /* FIXME: open project in /tmp if none is given? */
MESSAGE( "Starting GUI" ); MESSAGE( "Starting GUI" );
// tle.main_window->show( argc, argv ); // tle.main_window->show( argc, argv );

View File

@ -31,7 +31,7 @@ Timeline/Transport.C \
Timeline/Waveform.C \ Timeline/Waveform.C \
Timeline/dsp.C \ Timeline/dsp.C \
Timeline/main.C \ Timeline/main.C \
Timeline/Session.C \ Timeline/Project.C \
debug.C \ debug.C \
Timeline_OBJS:=$(Timeline_SRCS:.C=.o) Timeline_OBJS:=$(Timeline_SRCS:.C=.o)