non/Timeline/TLE.fl

876 lines
25 KiB
Plaintext

# data file for the Fltk User Interface Designer (fluid)
version 1.0108
header_name {.H}
code_name {.C}
comment {//
// Copyright (C) 2008 Jonathan Moore Liles
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
} {in_source in_header
}
decl {const float STATUS_UPDATE_FREQ = 0.5f;} {}
decl {\#include "Fl_Menu_Settings.H"} {}
decl {\#include "Timeline.H"} {}
decl {\#include "Transport.H"} {}
decl {\#include "Loggable.H"} {}
decl {\#include "Project.H"} {}
decl {\#include "Clock.H"} {public
}
decl {\#include "Track.H" // for capture_format} {}
decl {\#include "Waveform.H" // for options} {}
decl {\#include "Audio_Region.H" // for options} {}
decl {\#include "Control_Sequence.H" // for options} {}
decl {\#include <FL/fl_ask.H>} {}
decl {\#include <FL/Fl_File_Chooser.H>} {}
decl {\#include <FL/Fl.H>} {}
decl {\#include <Fl/Fl_Shared_Image.H>} {}
decl {\#include "Engine/Engine.H"} {}
decl {\#include "Engine/Audio_File.H" // for supported formats} {}
decl {extern char project_display_name[256];} {global
}
decl {extern char *user_config_dir;} {global
}
class TLE {open
} {
decl {Fl_Color system_colors[3];} {public
}
decl {static void menubar_cb ( void *v )} {}
decl {void menubar_cb ( void )} {}
Function {menu_picked_value( const Fl_Menu_ *m )} {open return_type {static int}
} {
code {return m->menu()[ m->value() ].flags & FL_MENU_VALUE;} {}
}
Function {save()} {open
} {
code {const char options_filename[] = "options";
// const char state_filename[] = "state";
// save options
char *path;
asprintf( &path, "%s/%s", user_config_dir, options_filename );
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options/&Global" ), path );
free( path );} {}
}
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
} {
code {((TLE*)v)->capture_format_cb();} {}
}
Function {capture_format_cb()} {open private return_type void
} {
code {Fl_Menu_ *o = menubar;
Track::capture_format = o->menu()[ o->value() ].label();} {}
}
Function {run()} {open
} {
code {update_menu();
main_window->show();
Fl::lock();
Fl::run();} {}
}
Function {TLE()} {open
} {
code {Fl::visual( FL_DOUBLE | FL_RGB8 );
make_window();
Fl::visible_focus( 0 );
Fl::get_system_colors();
Fl::scheme( "plastic" );
system_colors[ 0 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR );
system_colors[ 1 ] = (Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR );
system_colors[ 2 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR );
Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
fl_message_icon()->box( FL_RSHADOW_BOX );
fl_message_icon()->labelcolor( FL_BLACK );
fl_message_icon()->color( FL_RED );
fl_message_font( FL_HELVETICA, 18 );
std::list <const char *> formats;
Audio_File::all_supported_formats( formats );
for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats.end(); ++f )
{
// capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
//;
char pat[256];
snprintf( pat, sizeof( pat ), "&Options/&Project/&Timeline/Capture Format/%s", *f );
menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
}
menubar->picked( menubar->find_item( "&Options/&Project/&Timeline/Capture Format/Wav 24" ) );
char *path;
asprintf( &path, "%s/options", user_config_dir );
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options/&Global" ), path );
free( path );
menubar->add( "&Timeline", 0, 0, const_cast< Fl_Menu_Item *>( timeline->menu->menu() ), FL_SUBMENU_POINTER );} {selected
}
}
Function {make_window()} {open
} {
Fl_Window main_window {
label Timeline open
xywh {225 89 1020 765} type Double resizable xclass Non_DAW visible
} {
Fl_Menu_Bar menubar {open
xywh {0 0 1024 25}
} {
Submenu {} {
label {&Project} open
xywh {0 0 74 25}
} {
MenuItem {} {
label {&Info}
xywh {0 0 40 25} deactivate
}
MenuItem {} {
label {&New}
callback {save_timeline_settings();
new_project_chooser();
load_timeline_settings();
update_menu();
main_window->redraw();}
xywh {0 0 40 25}
}
MenuItem {} {
label {&Open}
callback {const char *name = fl_dir_chooser( "Open Project", NULL, NULL );
if ( ! name )
return;
if ( ! Project::validate( name ) )
{
fl_alert( "The path \\"%s\\"\\ndoes not refer to a valid Non-DAW project!", name );
}
else if ( ! Project::open( name ) )
{
fl_alert( "Could not open \\"%s\\" as a Non-DAW project!", name );
// we are in a somewhar ambiguous state now with no project open.
}}
xywh {10 10 40 25}
}
MenuItem {} {
label {&Compact}
callback {int n = fl_choice( "Compacting will replace the project history with a snapshot of the current state.\\nYou will not be able to use Undo to go back beyond this point.\\n\\nThis operation is irreversible!", NULL, "&Cancel", "Pr&ocede with compaction" );
if ( n != 2 )
return;
Loggable::compact();}
xywh {20 20 40 25}
}
Submenu {} {
label {&Export} open
xywh {0 0 74 25} deactivate
} {
MenuItem {} {
label Project
xywh {0 0 40 25}
}
MenuItem {} {
label Range
xywh {10 10 40 25}
}
}
MenuItem {} {
label {&Quit}
callback {quit()}
xywh {40 40 40 25} shortcut 0x40071
}
}
Submenu {} {
label {&Edit} open
xywh {0 0 74 25}
} {
MenuItem {} {
label Undo
callback {Loggable::undo();}
xywh {0 0 40 25} shortcut 0x4007a divider
}
MenuItem {} {
label {Select None}
callback {timeline->select_none();}
xywh {10 10 40 25} shortcut 0x50061
}
MenuItem {} {
label {Delete Selected}
callback {timeline->delete_selected();}
xywh {20 20 40 25} shortcut 0xffff
}
}
Submenu {} {
label Transport open
xywh {0 0 74 25}
} {
MenuItem {} {
label Start
callback {transport->locate( 0 );}
xywh {0 0 40 25} shortcut 0xff50
}
MenuItem {} {
label End
callback {transport->locate( timeline->length() );}
xywh {10 10 40 25} shortcut 0xff57
}
MenuItem {} {
label {Play/Stop}
callback {transport->toggle();}
xywh {20 20 40 25} shortcut 0x20
}
MenuItem {} {
label Record
callback {transport->toggle_record();}
xywh {40 40 40 25} shortcut 0x10072
}
}
MenuItem {} {
label {&Timeline}
xywh {0 0 40 25}
}
Submenu {} {
label {&View} open
xywh {0 0 74 25}
} {
Submenu {} {
label {&Zoom} open
xywh {0 0 74 25}
} {
MenuItem {} {
label {&In}
callback {timeline->zoom_in();}
xywh {20 20 40 25} shortcut 0x2b
}
MenuItem {} {
label {&Out}
callback {timeline->zoom_out();}
xywh {30 30 40 25} shortcut 0x5f
}
MenuItem {} {
label {&Fit}
callback {timeline->zoom_fit();}
xywh {10 10 40 25} shortcut 0x3d divider
}
MenuItem {} {
label {1 sec.}
callback {timeline->zoom( 1 );}
xywh {10 10 40 25} shortcut 0x31
}
MenuItem {} {
label {1 min.}
callback {timeline->zoom( 60 );}
xywh {20 20 40 25} shortcut 0x32
}
MenuItem {} {
label {1 hour.}
callback {timeline->zoom( 60 * 60 );}
xywh {30 30 40 25} shortcut 0x33
}
}
}
Submenu {} {
label {&Options} open
xywh {0 0 74 25} divider
} {
Submenu {} {
label {&Global} open
xywh {0 0 74 25}
} {
Submenu {} {
label {&Display} open
xywh {5 5 74 25}
} {
Submenu {} {
label {&Timeline} open
xywh {5 5 74 25}
} {
MenuItem {} {
label {&Measure lines}
callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
timeline->redraw();}
xywh {5 5 40 25} type Toggle value 1
}
}
Submenu {} {
label {&Waveform} open
xywh {5 5 74 25}
} {
MenuItem {} {
label Fill
callback {Waveform::fill = menu_picked_value( o );
timeline->redraw();}
xywh {15 15 40 25} type Toggle value 1
}
MenuItem {} {
label Outline
callback {Waveform::outline = menu_picked_value( o );
timeline->redraw();}
xywh {35 35 40 25} type Toggle value 1
}
MenuItem {} {
label {Vary color}
callback {Waveform::vary_color = menu_picked_value( o );
timeline->redraw();}
xywh {25 25 40 25} type Toggle value 1
}
}
Submenu {} {
label {&Region} open
xywh {5 5 74 25}
} {
MenuItem {} {
label {Filled fades}
xywh {35 35 40 25} type Toggle value 1
}
MenuItem {} {
label {Inherit track color}
callback {Audio_Region::inherit_track_color = menu_picked_value( o );
timeline->redraw();}
xywh {45 45 40 25} type Toggle value 1
}
}
Submenu {} {
label {&Control Sequence} open
xywh {5 5 74 25}
} {
MenuItem {} {
label Polygon
callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
timeline->redraw();}
xywh {25 25 40 25} type Toggle value 1
}
MenuItem {} {
label Graded
callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
timeline->redraw();}
xywh {35 35 40 25} type Toggle value 1
}
MenuItem {} {
label Ruled
callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
timeline->redraw();}
xywh {45 45 40 25} type Toggle value 1
}
}
Submenu {} {
label {&Style} open
xywh {5 5 74 25}
} {
MenuItem {} {
label Default
callback {Fl::scheme( "plastic" );}
xywh {5 5 40 25} type Radio value 1
}
MenuItem {} {
label Flat
callback {Fl::scheme( "gtk+" );}
xywh {15 15 40 25} type Radio
}
}
Submenu {} {
label {C&olors} open
xywh {5 5 74 25}
} {
MenuItem {} {
label System
callback {//Fl::get_system_colors();
unsigned char r, g, b;
Fl::get_color( system_colors[ 0 ], r, g, b );
Fl::background( r, g, b );
Fl::get_color( system_colors[ 1 ], r, g, b );
Fl::foreground( r, g, b );
Fl::get_color( system_colors[ 2 ], r, g, b );
Fl::background2( r, g, b );
Fl::scheme( Fl::scheme() );}
xywh {5 5 40 25} type Radio
}
MenuItem {} {
label Dark
callback {Fl::background2( 100, 100, 100 );
Fl::background( 50, 50, 50 );
Fl::foreground( 255, 255, 255 );
Fl::scheme( Fl::scheme() );}
xywh {15 15 40 25} type Radio value 1
}
MenuItem {} {
label Light
callback {Fl::background2( 192, 192, 192 );
Fl::background( 220, 220, 220 );
Fl::foreground( 0, 0, 0 );
Fl::scheme( Fl::scheme() );}
xywh {25 25 40 25} type Radio
}
}
}
}
Submenu {} {
label {&Project} open
xywh {0 0 74 25}
} {
Submenu {} {
label {&Timeline} open
xywh {10 10 74 25}
} {
MenuItem {} {
label {&Follow Playhead}
callback {Timeline::follow_playhead = menu_picked_value( o );}
xywh {30 30 40 25} type Toggle value 1
}
MenuItem {} {
label {&Center Playhead}
callback {Timeline::center_playhead = menu_picked_value( o );}
xywh {40 40 40 25} type Toggle value 1
}
Submenu {} {
label {&Snap to} open
xywh {10 10 74 25}
} {
MenuItem {} {
label Bars
callback {Timeline::snap_to = Timeline::Bars;}
xywh {10 10 40 25} type Radio value 1
}
MenuItem {} {
label Beats
callback {Timeline::snap_to = Timeline::Beats;}
xywh {20 20 40 25} type Radio
}
MenuItem {} {
label Off
callback {Timeline::snap_to = Timeline::None;}
xywh {30 30 40 25} type Radio
}
}
MenuItem {} {
label {Magnetic snap}
callback {Timeline::snap_magnetic = menu_picked_value( o );}
xywh {20 20 40 25} type Toggle value 1
}
Submenu {} {
label {Capture Format} open
xywh {10 10 74 25}
} {}
}
}
}
Submenu {} {
label {&Help} open
xywh {0 0 74 25}
} {
MenuItem {} {
label {&About}
callback {Fl_Window *win = make_about_dialog();
win->show();
while ( win->shown() )
Fl::wait();
delete win;}
xywh {0 0 40 25}
}
}
}
Fl_Group {} {open
xywh {0 23 1024 48}
} {
Fl_Pack {} {open
xywh {0 23 473 46} type HORIZONTAL
code0 {o->spacing( 10 );}
} {
Fl_Box {} {
label {<Transport>}
xywh {0 23 184 46} color 30
code0 {transport = o;}
code1 {o->labeltype( FL_NO_LABEL );}
class Transport
}
Fl_Pack clocks_pack {open
xywh {185 23 288 46} type HORIZONTAL
code0 {o->spacing( 2 );}
} {
Fl_Box playhead_clock {
label PLAYHEAD
xywh {185 29 137 40} box BORDER_BOX color 40
code0 {o->type( Clock::HMS );}
code1 {o->run( &transport->frame );}
class Clock
}
Fl_Box {} {
label PLAYHEAD
xywh {325 29 142 40} box BORDER_BOX color 40
code0 {o->type( Clock::BBT );}
code1 {o->run( &transport->frame );}
class Clock
}
}
}
Fl_Box {} {
label {<empty>}
xywh {477 27 387 42} resizable
code0 {o->labeltype( FL_NO_LABEL );}
}
Fl_Group {} {
xywh {869 25 155 44}
} {
Fl_Box {} {
label {capture:}
xywh {869 25 56 14} labelsize 10 align 24
}
Fl_Box {} {
label {playback:}
xywh {869 41 56 14} labelsize 10 align 24
}
Fl_Box {} {
label {DSP:}
xywh {869 55 56 14} labelsize 10 align 24
}
Fl_Progress capture_buffer_progress {
label {50%}
xywh {925 25 99 14} labelsize 10
}
Fl_Progress cpu_load_progress {
label {50%}
xywh {925 55 99 14} labelsize 9
}
Fl_Progress playback_buffer_progress {
label {50%}
xywh {925 40 99 14} labelsize 10
}
}
}
Fl_Box {} {
label {<Timeline>}
xywh {0 72 1024 695} box FLAT_BOX color 47 labelsize 100 resizable
code0 {timeline = o;}
class Timeline
}
Fl_Box project_name {
label {<project name>}
xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2
code0 {o->label( Project::name() );}
}
Fl_Value_Output xruns_output {
label {xruns:}
xywh {980 2 44 20} maximum 40000 step 1
}
}
}
Function {find_item( Fl_Menu_ *menu, const char *path )} {open return_type {static Fl_Menu_Item *}
} {
code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
}
Function {update_menu()} {open
} {
code {Fl_Menu_Bar *m = menubar;
if ( ! Project::open() )
{
find_item( m, "&Project/&Export" )->deactivate();
find_item( m, "&Project/&Compact" )->deactivate();
find_item( m, "&Project/&Info" )->deactivate();
find_item( m, "&Options/&Project/&Timeline" )->deactivate();
find_item( m, "&Timeline" )->deactivate();
timeline->deactivate();
transport->deactivate();
}
else
{
find_item( m, "&Project/&Export" )->activate();
find_item( m, "&Project/&Compact" )->activate();
find_item( m, "&Project/&Info" )->activate();
find_item( m, "&Options/&Project/&Timeline" )->activate();
find_item( m, "&Timeline" )->activate();
timeline->activate();
transport->activate();
}
m->redraw();
project_name->redraw();} {}
}
Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
} {
code {p->value( v );
snprintf( s, 5, "%d%%", (int)v );
p->label( s );} {}
}
Function {update_status()} {open
} {
code {static char cbp[5], pbp[5], clp[5];
update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_percent() );
update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() );
update_progress( cpu_load_progress, clp, engine->cpu_load() );
if ( timeline->total_capture_xruns() )
capture_buffer_progress->selection_color( FL_RED );
if ( timeline->total_playback_xruns() )
playback_buffer_progress->selection_color( FL_RED );
xruns_output->value( engine->xruns() );} {}
}
Function {update_cb( void *v )} {return_type {static void}
} {
code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v );
((TLE*)v)->update_status();} {}
}
Function {make_about_dialog()} {open
} {
Fl_Window about_dialog_window {
label About open
private xywh {658 165 495 600} type Double xclass {Non-DAW} visible
} {
Fl_Tabs {} {open
xywh {0 213 497 392}
} {
Fl_Group {} {
label Credits open
xywh {2 237 492 362}
} {
Fl_Box {} {
label {Non-DAW was written from scratch by
Jonathan Moore Liles for his own use
(see the manual).
Nobody planned. Nobody helped.
You can help now by donating time, money,
and/or replacing the rest of Linux Audio
with fast, light, reliable alternatives.}
xywh {39 266 418 262} box ROUNDED_BOX color 46 labelsize 18
}
}
Fl_Group {} {
label License open
xywh {2 237 492 362} hide
} {
Fl_Box {} {
label {Copyright (C) 2008 Jonathan Moore Liles}
xywh {43 246 410 37} labeltype SHADOW_LABEL labelfont 1 labelsize 18
}
Fl_Box {} {
label {This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.}
xywh {10 295 475 233} box ROUNDED_BOX color 46 labelfont 1 labelsize 12 labelcolor 53 align 144
}
}
}
Fl_Box {} {
label VERSION
xywh {25 11 445 151} box ROUNDED_BOX color 48 labelfont 1 labelsize 18 align 16
code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo.png" ) );}
code1 {o->label( VERSION );}
}
Fl_Return_Button {} {
label Rock
callback {about_dialog_window->hide();}
xywh {400 558 76 30}
}
Fl_Button {} {
label {http://non-daw.tuxfamily.org}
callback {\#if ! ( FL_MAJOR_VERSION >= 1 && FL_MINOR_VERSION >= 1 && FL_PATCH_VERSION >= 8 )
// FIXME: got a better idea?
system( "x-www-browser http://non-daw.tuxfamily.org &" );
\#else
fl_open_uri( "http://non-daw.tuxfamily.org" );
\#endif}
xywh {125 558 245 30} color 14 labeltype SHADOW_LABEL labelcolor 6
}
Fl_Box {} {
label {The Non DAW (Digital Audio Workstation)}
xywh {32 176 430 29} labeltype SHADOW_LABEL labelfont 3 labelsize 17
}
}
}
Function {save_timeline_settings()} {open
} {
code {if ( Project::open() )
{
// save project local options (Timeline menu)
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options/&Project" ), "options" );
}} {}
}
Function {load_timeline_settings()} {open
} {
code {if ( Project::open() )
{
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options/&Project" ), "options" );
}
update_menu();
project_name->redraw();} {}
}
Function {quit()} {open
} {
code {Project::close();
save();
exit( 0 );} {}
}
}
class New_Project_Dialog {open
} {
Function {New_Project_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 {New Project} open
xywh {619 742 550 195} type Double modal xclass Non_DAW visible
} {
Fl_File_Input _name {
label {Named:}
xywh {75 140 375 35}
}
Fl_Button {} {
label Browse
callback {_directory->value( fl_dir_chooser( "Directory for new project", NULL, 0 ) );}
xywh {455 100 80 35}
}
Fl_Return_Button {} {
label Create
callback {if ( strlen( _directory->value() ) && strlen( _name->value() ) )
{
char pat[512];
snprintf( pat, sizeof( pat ), "%s/%s", _directory->value(), _name->value() );
if ( ! Project::create( pat, _template->text( _template->value() ) ) )
fl_alert( "Error creating project!" );
_window->hide();
}}
xywh {455 140 80 35}
}
Fl_File_Input _directory {
label {Where:}
callback {if ( ! fl_filename_isdir( o->value() ) )
{
fl_alert( "Must be a directory" );
o->value( "" );
}}
xywh {75 100 375 35}
code0 {\#include <FL/filename.H>}
}
Fl_Box {} {
label {New Project}
xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
}
Fl_Choice _template {
label {Template:}
private xywh {310 60 225 25} down_box BORDER_BOX
} {
MenuItem {} {
label Default
xywh {0 0 40 25}
}
}
}
}
}
Function {new_project_chooser()} {open C return_type void
} {
code {New_Project_Dialog nsd;
nsd.run();} {}
}