Browse Source

s/Session/Project/ig

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
c413255e4a
6 changed files with 58 additions and 58 deletions
  1. +1
    -1
      Timeline/Engine.C
  2. +16
    -16
      Timeline/Project.C
  3. +2
    -2
      Timeline/Project.H
  4. +34
    -34
      Timeline/TLE.fl
  5. +4
    -4
      Timeline/main.C
  6. +1
    -1
      Timeline/makefile.inc

+ 1
- 1
Timeline/Engine.C View File

@@ -165,7 +165,7 @@ Engine::init ( void )

set_callback( process );
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)? */
set_callback( sync );



Timeline/Session.C → Timeline/Project.C View File

@@ -17,8 +17,8 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/

/* Routings for opening/closing/creation of sessions. All the actual
session state belongs to Timeline and other classes. */
/* Routings for opening/closing/creation of projects. All the actual
project state belongs to Timeline and other classes. */


#include <stdio.h>
@@ -29,20 +29,20 @@ session state belongs to Timeline and other classes. */
#include <fcntl.h>

#include "Loggable.H"
#include "Session.H"
#include "Project.H"

#include "debug.h"
char Session::_name[256];
bool Session::_is_open = false;
char Project::_name[256];
bool Project::_is_open = false;

void
Session::set_name ( const char *name )
Project::set_name ( const char *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 == '-' )
*s = ' ';
}
@@ -58,7 +58,7 @@ exists ( const char *name )
#include <errno.h>

bool
Session::close ( void )
Project::close ( void )
{
Loggable::close();

@@ -66,11 +66,11 @@ Session::close ( void )
}

bool
Session::open ( const char *name )
Project::open ( const char *name )
{
if ( chdir( name ) )
{
WARNING( "Cannot change to session dir \"%s\"", name );
WARNING( "Cannot change to project dir \"%s\"", name );
return false;
}

@@ -78,7 +78,7 @@ Session::open ( const char *name )
! exists( "sources" ) )
// ! exists( "options" ) )
{
WARNING( "Not a Non-DAW session: \"%s\"", name );
WARNING( "Not a Non-DAW project: \"%s\"", name );
return false;
}

@@ -93,22 +93,22 @@ Session::open ( const char *name )
}

bool
Session::create ( const char *name, const char *template_name )
Project::create ( const char *name, const char *template_name )
{
if ( exists( name ) )
{
WARNING( "Session already exists" );
WARNING( "Project already exists" );
return false;
}

if ( mkdir( name, 0777 ) )
{
WARNING( "Cannot create session directory" );
WARNING( "Cannot create project directory" );
return false;
}

if ( chdir( name ) )
FATAL( "WTF? Cannot change to new session directory" );
FATAL( "WTF? Cannot change to new project directory" );

mkdir( "sources", 0777 );


Timeline/Session.H → Timeline/Project.H View File

@@ -20,7 +20,7 @@
const char template_dir[] = "share/non-daw/templates";
const char user_template_dir[] = "~/.non-daw/templates";

class Session
class Project
{

static bool _is_open;
@@ -29,7 +29,7 @@ class Session
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 bool close ( void );
static bool open ( const char *name );

+ 34
- 34
Timeline/TLE.fl View File

@@ -14,7 +14,7 @@ decl {\#include "Transport.H"} {}

decl {\#include "Loggable.H"} {}

decl {\#include "Session.H"} {}
decl {\#include "Project.H"} {}

decl {\#include "Clock.H"} {public
}
@@ -35,7 +35,7 @@ decl {\#include <FL/Fl_File_Chooser.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
@@ -68,9 +68,9 @@ free( path );
// 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 );
}} {}
}
@@ -144,7 +144,7 @@ free( path );} {selected
xywh {0 0 1024 25}
} {
Submenu {} {
label {&Session} open
label {&Project} open
xywh {0 0 74 25}
} {
MenuItem {} {
@@ -155,7 +155,7 @@ free( path );} {selected
label {&New}
callback {save_timeline_settings();

new_session_chooser();
new_project_chooser();

load_timeline_settings();

@@ -168,15 +168,15 @@ main_window->redraw();}
label {&Open}
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
{
@@ -188,7 +188,7 @@ update_menu();}
}
MenuItem {} {
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 )
return;
@@ -201,7 +201,7 @@ Loggable::compact();}
xywh {0 0 74 25} deactivate
} {
MenuItem {} {
label Session
label Project
xywh {0 0 40 25}
}
MenuItem {} {
@@ -592,9 +592,9 @@ delete win;}
class Timeline
}
Fl_Box {} {
label {<session name>}
label {<project name>}
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 {
label {xruns:}
@@ -610,11 +610,11 @@ delete win;}
} {
code {Fl_Menu_Bar *m = menubar;

if ( ! Session::open() )
if ( ! Project::open() )
{
find_item( m, "&Session/&Export" )->deactivate();
find_item( m, "&Session/&Compact" )->deactivate();
find_item( m, "&Session/&Info" )->deactivate();
find_item( m, "&Project/&Export" )->deactivate();
find_item( m, "&Project/&Compact" )->deactivate();
find_item( m, "&Project/&Info" )->deactivate();
find_item( m, "&Timeline" )->deactivate();

@@ -623,9 +623,9 @@ if ( ! Session::open() )
}
else
{
find_item( m, "&Session/&Export" )->activate();
find_item( m, "&Session/&Compact" )->activate();
find_item( m, "&Session/&Info" )->activate();
find_item( m, "&Project/&Export" )->activate();
find_item( m, "&Project/&Compact" )->activate();
find_item( m, "&Project/&Info" )->activate();

find_item( m, "&Timeline" )->activate();
@@ -714,24 +714,24 @@ with fast, light, reliable alternatives.}
}
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" );
}} {}
}
Function {load_timeline_settings()} {open
} {
code {if ( Session::open() )
code {if ( Project::open() )
{
((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();} {}
}
@@ -745,7 +745,7 @@ while ( _window->shown() )
Function {make_window()} {open
} {
Fl_Window _window {
label {New Session} open
label {New Project} open
xywh {576 340 550 195} type Double modal visible
} {
Fl_File_Input _name {
@@ -754,7 +754,7 @@ while ( _window->shown() )
}
Fl_Button {} {
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}
}
Fl_Return_Button {} {
@@ -768,8 +768,8 @@ while ( _window->shown() )
// if ( ! fl_filename_exists( pat ) )
{

if ( ! Session::create( pat, _template->text( _template->value() ) ) )
fl_alert( "Error opening session!" );
if ( ! Project::create( pat, _template->text( _template->value() ) ) )
fl_alert( "Error opening project!" );

_window->hide();
}
@@ -792,7 +792,7 @@ while ( _window->shown() )
code0 {\#include <FL/filename.H>}
}
Fl_Box {} {
label {New Session}
label {New Project}
xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
}
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();} {}
}

+ 4
- 4
Timeline/main.C View File

@@ -49,7 +49,7 @@
#include <stdlib.h>
#include <sys/stat.h>

#include "Session.H"
#include "Project.H"

Engine *engine;
Timeline *timeline;
@@ -117,10 +117,10 @@ main ( int argc, char **argv )
transport->stop();

if ( argc > 1 )
if ( ! Session::open( argv[ 1 ] ) )
FATAL( "Could not open session specified on command line" );
if ( ! Project::open( argv[ 1 ] ) )
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" );
// tle.main_window->show( argc, argv );


+ 1
- 1
Timeline/makefile.inc View File

@@ -31,7 +31,7 @@ Timeline/Transport.C \
Timeline/Waveform.C \
Timeline/dsp.C \
Timeline/main.C \
Timeline/Session.C \
Timeline/Project.C \
debug.C \

Timeline_OBJS:=$(Timeline_SRCS:.C=.o)


Loading…
Cancel
Save