@@ -61,6 +61,7 @@ const char *Project::_errstr[] = | |||||
}; | }; | ||||
char Project::_name[256]; | char Project::_name[256]; | ||||
char Project::_created_on[40]; | |||||
char Project::_path[512]; | char Project::_path[512]; | ||||
bool Project::_is_open = false; | bool Project::_is_open = false; | ||||
int Project::_lockfd = 0; | int Project::_lockfd = 0; | ||||
@@ -101,8 +102,20 @@ Project::write_info ( void ) | |||||
return false; | return false; | ||||
} | } | ||||
fprintf( fp, "created by\n\t%s\nversion\n\t%d\nsample rate\n\t%lu\n", | |||||
char s[40]; | |||||
if ( ! *_created_on ) | |||||
{ | |||||
time_t t = time( NULL ); | |||||
ctime_r( &t, s ); | |||||
s[ strlen( s ) - 1 ] = '\0'; | |||||
} | |||||
else | |||||
strcpy( s, _created_on ); | |||||
fprintf( fp, "created by\n\t%s\ncreated on\n\t%s\nversion\n\t%d\nsample rate\n\t%lu\n", | |||||
APP_TITLE " " VERSION, | APP_TITLE " " VERSION, | ||||
s, | |||||
PROJECT_VERSION, | PROJECT_VERSION, | ||||
(unsigned long)timeline->sample_rate() ); | (unsigned long)timeline->sample_rate() ); | ||||
@@ -112,7 +125,7 @@ Project::write_info ( void ) | |||||
} | } | ||||
bool | bool | ||||
Project::read_info ( int *version, nframes_t *sample_rate ) | |||||
Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date ) | |||||
{ | { | ||||
FILE *fp; | FILE *fp; | ||||
@@ -122,6 +135,10 @@ Project::read_info ( int *version, nframes_t *sample_rate ) | |||||
return false; | return false; | ||||
} | } | ||||
*version = 0; | |||||
*sample_rate = 0; | |||||
*creation_date = 0; | |||||
char *name, *value; | char *name, *value; | ||||
while ( fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) == 2 ) | while ( fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) == 2 ) | ||||
@@ -132,6 +149,8 @@ Project::read_info ( int *version, nframes_t *sample_rate ) | |||||
*sample_rate = atoll( value ); | *sample_rate = atoll( value ); | ||||
else if ( ! strcmp( name, "version" ) ) | else if ( ! strcmp( name, "version" ) ) | ||||
*version = atoi( value ); | *version = atoi( value ); | ||||
else if ( ! strcmp( name, "created on" ) ) | |||||
*creation_date = strdup( value ); | |||||
free( name ); | free( name ); | ||||
free( value ); | free( value ); | ||||
@@ -157,11 +176,12 @@ Project::close ( void ) | |||||
Loggable::close(); | Loggable::close(); | ||||
write_info(); | |||||
// write_info(); | |||||
_is_open = false; | _is_open = false; | ||||
*Project::_name = '\0'; | *Project::_name = '\0'; | ||||
*Project::_created_on = '\0'; | |||||
release_lock( &_lockfd, ".lock" ); | release_lock( &_lockfd, ".lock" ); | ||||
@@ -215,8 +235,9 @@ Project::open ( const char *name ) | |||||
int version; | int version; | ||||
nframes_t rate; | nframes_t rate; | ||||
char *creation_date; | |||||
if ( ! read_info( &version, &rate ) ) | |||||
if ( ! read_info( &version, &rate, &creation_date ) ) | |||||
return E_INVALID; | return E_INVALID; | ||||
if ( version != PROJECT_VERSION ) | if ( version != PROJECT_VERSION ) | ||||
@@ -227,6 +248,14 @@ Project::open ( const char *name ) | |||||
timeline->sample_rate( rate ); | timeline->sample_rate( rate ); | ||||
if ( creation_date ) | |||||
{ | |||||
strcpy( _created_on, creation_date ); | |||||
free( creation_date ); | |||||
} | |||||
else | |||||
*_created_on = 0; | |||||
set_name( name ); | set_name( name ); | ||||
*_path = '\0'; | *_path = '\0'; | ||||
@@ -29,11 +29,11 @@ class Project | |||||
static bool _is_open; | static bool _is_open; | ||||
static char _name[256]; | static char _name[256]; | ||||
static char _path[512]; | static char _path[512]; | ||||
static char _created_on[40]; | |||||
static bool write_info ( void ); | static bool write_info ( void ); | ||||
static bool read_info ( int *version, nframes_t *sample_rate ); | |||||
static bool read_info ( int *version, nframes_t *sample_rate, char **creation_date ); | |||||
static void set_name ( const char *name ); | static void set_name ( const char *name ); | ||||
static const char *_errstr[]; | static const char *_errstr[]; | ||||
public: | public: | ||||
@@ -57,4 +57,5 @@ public: | |||||
static bool open ( void ) { return _is_open; } | static bool open ( void ) { return _is_open; } | ||||
static bool create ( const char *name, const char *template_name ); | static bool create ( const char *name, const char *template_name ); | ||||
static const char *created_on ( void ) { return _created_on; } | |||||
}; | }; |
@@ -837,7 +837,8 @@ Function {new_project_chooser()} {C return_type void | |||||
nsd.run();} {} | nsd.run();} {} | ||||
} | } | ||||
class Project_Info_Dialog {} { | |||||
class Project_Info_Dialog {open | |||||
} { | |||||
Function {Project_Info_Dialog()} {open | Function {Project_Info_Dialog()} {open | ||||
} { | } { | ||||
code {make_window();} {} | code {make_window();} {} | ||||
@@ -869,7 +870,7 @@ if ( logo_box->image() ) | |||||
} | } | ||||
Fl_Output {} { | Fl_Output {} { | ||||
label {Size of Journal} | label {Size of Journal} | ||||
xywh {210 80 100 25} box UP_BOX labeltype SHADOW_LABEL align 1 | |||||
xywh {180 80 100 25} box UP_BOX labeltype SHADOW_LABEL align 1 | |||||
code0 {static char pat[40];} | code0 {static char pat[40];} | ||||
code1 {snprintf( pat, sizeof( pat ), "%.1fK", size( "history" ) / (float)1024 );} | code1 {snprintf( pat, sizeof( pat ), "%.1fK", size( "history" ) / (float)1024 );} | ||||
code2 {o->value( pat );} | code2 {o->value( pat );} | ||||
@@ -877,18 +878,19 @@ if ( logo_box->image() ) | |||||
} | } | ||||
Fl_Output {} { | Fl_Output {} { | ||||
label {Created On} | label {Created On} | ||||
xywh {350 80 135 25} box UP_BOX labeltype SHADOW_LABEL align 1 | |||||
xywh {320 80 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12 | |||||
code0 {o->value( Project::created_on() );} | |||||
} | } | ||||
Fl_Output {} { | Fl_Output {} { | ||||
label Length | label Length | ||||
xywh {30 130 115 25} align 1 | |||||
xywh {30 130 115 25} box BORDER_BOX color 47 align 1 textcolor 71 | |||||
code0 {char pat[40];} | code0 {char pat[40];} | ||||
code1 {Clock::frame_to_HMS( pat, sizeof( pat ), timeline->length() );} | code1 {Clock::frame_to_HMS( pat, sizeof( pat ), timeline->length() );} | ||||
code2 {o->value( pat );} | code2 {o->value( pat );} | ||||
} | } | ||||
Fl_Value_Output {} { | Fl_Value_Output {} { | ||||
label Tracks | label Tracks | ||||
xywh {230 130 60 25} align 1 | |||||
xywh {200 130 55 25} align 1 | |||||
code0 {o->value( timeline->ntracks() );} | code0 {o->value( timeline->ntracks() );} | ||||
} | } | ||||
Fl_Box logo_box { | Fl_Box logo_box { | ||||
@@ -923,6 +925,14 @@ window->do_callback();} | |||||
callback {window->do_callback();} | callback {window->do_callback();} | ||||
xywh {330 700 74 25} | xywh {330 700 74 25} | ||||
} | } | ||||
Fl_Output {} { | |||||
label {Last Modified On} selected | |||||
xywh {320 130 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12 | |||||
code0 {time_t t = modification_time( "history" );} | |||||
code1 {static char s[40];} | |||||
code2 {ctime_r( &t, s ); s[ strlen( s ) - 1 ] = 0;} | |||||
code3 {o->value( s );} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -952,7 +962,7 @@ if ( logo_box->image() ) | |||||
((Fl_Shared_Image*)logo_box->image())->release(); | ((Fl_Shared_Image*)logo_box->image())->release(); | ||||
logo_box->image( NULL ); | logo_box->image( NULL ); | ||||
}} open | }} open | ||||
private xywh {669 197 495 655} type Double xclass {Non-DAW} visible | |||||
private xywh {349 201 495 655} type Double xclass {Non-DAW} visible | |||||
} { | } { | ||||
Fl_Tabs {} {open | Fl_Tabs {} {open | ||||
xywh {0 264 497 392} | xywh {0 264 497 392} | ||||
@@ -26,7 +26,7 @@ | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
unsigned long | unsigned long | ||||
mtime ( const char *file ) | |||||
modification_time ( const char *file ) | |||||
{ | { | ||||
struct stat st; | struct stat st; | ||||
@@ -40,7 +40,7 @@ mtime ( const char *file ) | |||||
bool | bool | ||||
newer ( const char *file1, const char *file2 ) | newer ( const char *file1, const char *file2 ) | ||||
{ | { | ||||
return mtime( file1 ) > mtime( file2 ); | |||||
return modification_time( file1 ) > modification_time( file2 ); | |||||
} | } | ||||
unsigned long | unsigned long | ||||
@@ -19,7 +19,8 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
unsigned long mtime ( const char *file ); | |||||
unsigned long modification_time ( const char *file ); | |||||
bool newer ( const char *file1, const char *file2 ); | bool newer ( const char *file1, const char *file2 ); | ||||
unsigned long size ( const char *file ); | unsigned long size ( const char *file ); | ||||
int exists ( const char *name ); | int exists ( const char *name ); | ||||