From 5e5e79b4123da10a5714f47229ddd17cf22164bf Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 10 Jun 2008 22:43:13 -0500 Subject: [PATCH] Add Project_Info_Dialog. --- Timeline/TLE.fl | 83 ++++++++++++++++++++++++++++++++++++++++++++++--- util/file.C | 13 +++++++- util/file.h | 3 +- 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 7cd9c3b..822d0e9 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -161,9 +161,9 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} } { Fl_Window main_window { label Timeline open - xywh {894 189 1025 770} type Double resizable xclass Non_DAW visible + xywh {254 189 1025 770} type Double resizable xclass Non_DAW visible } { - Fl_Menu_Bar menubar { + Fl_Menu_Bar menubar {open xywh {0 0 1024 25} } { Submenu {} { @@ -172,6 +172,9 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} } { MenuItem {} { label {&Info} + callback {Project_Info_Dialog pi; + +pi.run();} xywh {0 0 40 25} deactivate } MenuItem {} { @@ -704,8 +707,7 @@ if ( engine->zombified() && ! zombie ) { zombie = true; fl_alert( "Disconnected from JACK!" ); -}} {selected - } +}} {} } Function {update_cb( void *v )} {return_type {static void} } { @@ -855,7 +857,7 @@ while ( _window->shown() ) } { Fl_Window _window { label {New Project} open - xywh {619 742 550 195} type Double modal xclass Non_DAW visible + xywh {384 630 550 195} type Double modal xclass Non_DAW visible } { Fl_File_Input _name { label {Named:} @@ -914,3 +916,74 @@ Function {new_project_chooser()} {open C return_type void nsd.run();} {} } + +class Project_Info_Dialog {open +} { + Function {Project_Info_Dialog()} {open + } { + code {make_window();} {} + } + Function {run()} {open return_type void + } { + code {_window->show(); + +while ( _window->shown() ) + Fl::wait();} {} + } + Function {make_window()} {open + } { + Fl_Window _window { + label {Project info} open selected + xywh {623 64 550 625} type Double visible + } { + Fl_Value_Output {} { + label {Sample Rate} + xywh {25 35 90 25} labeltype SHADOW_LABEL align 1 + code0 {o->value( timeline->sample_rate() );} + } + Fl_Text_Editor notes_field { + label {Notes:} + private xywh {20 395 510 185} color 47 selection_color 31 textsize 18 textcolor 92 + code0 {o->buffer( new Fl_Text_Buffer() );} + code1 {o->buffer()->loadfile( "notes" );} + } + Fl_Group {} {open + xywh {145 95 260 75} hide + } { + Fl_Input {} { + label {Engineer:} + xywh {145 95 260 25} align 1 + } + Fl_Input {} { + label {Performer:} + xywh {145 145 260 25} align 1 + } + } + Fl_Output {} { + label {Size of Journal} + xywh {220 35 100 25} box UP_BOX labeltype SHADOW_LABEL align 1 + code0 {static char pat[40];} + code1 {snprintf( pat, sizeof( pat ), "%.1fK", size( "history" ) / (float)1024 );} + code2 {o->value( pat );} + code3 {\#include "util/file.h"} + } + Fl_Output {} { + label {Created On} + xywh {380 35 135 25} box UP_BOX labeltype SHADOW_LABEL align 1 + } + Fl_Box {} { + label {} + xywh {52 194 445 153} box ROUNDED_BOX color 53 labelfont 1 labelsize 18 align 16 + code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo2.png" ) );} + code1 {o->label( NULL );} + } + Fl_Button {} { + label Save + callback {notes_field->buffer()->savefile( "notes" ); + +_window->hide();} + xywh {455 590 74 25} + } + } + } +} diff --git a/util/file.C b/util/file.C index 1247e34..6beedd7 100644 --- a/util/file.C +++ b/util/file.C @@ -21,7 +21,7 @@ #include #include -long +unsigned long mtime ( const char *file ) { struct stat st; @@ -38,3 +38,14 @@ newer ( const char *file1, const char *file2 ) { return mtime( file1 ) > mtime( file2 ); } + +unsigned long +size ( const char *file ) +{ + struct stat st; + + if ( stat( file, &st ) ) + return 0; + + return st.st_size; +} diff --git a/util/file.h b/util/file.h index 2853a21..be1ae1a 100644 --- a/util/file.h +++ b/util/file.h @@ -17,5 +17,6 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -long mtime ( const char *file ); +unsigned long mtime ( const char *file ); bool newer ( const char *file1, const char *file2 ); +unsigned long size ( const char *file );