1 # data file for the Fltk User Interface Designer (fluid)
6 // Copyright (C) 2008-2010 Jonathan Moore Liles
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 } {in_source in_header
25 decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local
28 decl {class Fl_Flowpack;} {public global
31 decl {\#include <FL/Fl_Overlay_Window.H>} {private local
34 decl {\#include "Fl_Menu_Settings.H"} {private local
37 decl {\#include "Timeline.H"} {private local
40 decl {\#include "Transport.H"} {private local
43 decl {\#include "Loggable.H"} {private local
46 decl {\#include "Project.H"} {private local
49 decl {\#include "Clock.H"} {public local
52 decl {\#include "FL/Fl_Flowpack.H"} {private local
55 decl {\#include "New_Project_Dialog.H"} {private local
58 decl {\#include "Track.H" // for capture_format} {private local
61 decl {\#include "Waveform.H" // for options} {private local
64 decl {\#include "Audio_Region.H" // for options} {private local
67 decl {\#include "Control_Sequence.H" // for options} {private local
70 decl {\#include <FL/Fl_File_Chooser.H>} {private local
73 decl {\#include <FL/Fl_Shared_Image.H>} {private local
76 decl {\#include <FL/Fl.H>} {private local
79 decl {\#include <FL/fl_ask.H>} {private local
82 decl {\#include "Engine/Engine.H"} {private local
85 decl {\#include "Engine/Audio_File.H" // for supported formats} {private local
88 decl {\#include "FL/About_Dialog.H"} {private local
91 decl {extern char project_display_name[256];} {private global
94 decl {\#include <nsm.h>} {private local
97 decl {extern nsm_client_t *nsm;} {private global
100 decl {extern char *user_config_dir;} {private global
103 class TLE_Window {open : {public Fl_Overlay_Window}
105 Function {TLE_Window(int W, int H, const char *L = 0) : Fl_Overlay_Window( W, H, L )} {open
109 Function {draw_overlay(void)} {open return_type void
111 code {timeline->draw_overlay();} {}
113 Function {~TLE_Window()} {open return_type virtual
121 decl {Fl_Color system_colors[3];} {private local
123 Function {save_options()} {open
125 code {const char options_filename[] = "options";
126 // const char state_filename[] = "state";
131 asprintf( &path, "%s/%s", user_config_dir, options_filename );
132 ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
135 Function {save()} {open
137 code {timeline->command_save();} {}
139 Function {quit()} {} {
140 code {timeline->command_quit();} {}
142 Function {open( const char *name )} {} {
143 code {timeline->command_load( name, NULL );} {}
145 Function {save_timeline_settings()} {open
147 code {if ( ! Project::open() )
151 // save project local options (Timeline menu)
152 ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), "options" );} {}
154 Function {reset_timeline_settings( void )} {open private return_type void
156 code {char path[256];
157 snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
159 ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), path );} {}
161 Function {load_timeline_settings()} {open
163 code {reset_timeline_settings();
166 if ( Project::open() )
167 ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), "options" );
171 project_name->redraw();} {}
173 Function {run()} {} {
176 // main_window->show();
182 Function {TLE()} {open
186 Fl::visible_focus( 0 );
188 // constrain window to size of screen.
192 Fl::screen_xywh( sx, sy, sw, sh );
194 main_window->size( 947, 600 );
195 main_window->size_range( 947, 600 );
197 if ( main_window->w() > sw ||
198 main_window->h() > sh )
199 main_window->resize( sx, sy, sw, sh );
202 Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
204 fl_message_icon()->box( FL_RSHADOW_BOX );
205 fl_message_icon()->labelcolor( FL_BLACK );
206 fl_message_icon()->color( FL_RED );
207 fl_message_font( FL_HELVETICA, 18 );
210 std::list <const char *> formats;
212 Audio_File::all_supported_formats( formats );
214 for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats.end(); ++f )
216 // capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
219 snprintf( pat, sizeof( pat ), "&Project/Se&ttings/Capture Format/%s", *f );
221 menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
224 menubar->picked( menubar->find_item( "&Project/Se&ttings/Capture Format/Wav 24" ) );
227 asprintf( &path, "%s/options", user_config_dir );
228 ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
232 menubar->add( "&Timeline", 0, 0, const_cast< Fl_Menu_Item *>( timeline->menu->menu() ), FL_SUBMENU_POINTER );
235 // save a copy of the project settings menu so that we can restore the defaults later
238 snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
240 ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), path );
244 Loggable::progress_callback( &TLE::progress_cb, this );} {}
246 Function {make_window()} {open
248 Fl_Window main_window {
249 label {Non DAW : Timeline}
250 callback {if ( Fl::event_key() != FL_Escape )
251 timeline->command_quit();} open
252 xywh {551 117 1025 770} type Double resizable
253 class TLE_Window xclass Non_DAW size_range {900 300 0 0} visible
256 xywh {0 0 1025 72} box FLAT_BOX
258 Fl_Menu_Bar menubar {open
259 private xywh {0 0 1025 25}
262 label {&Project} open
267 callback {Project_Info_Dialog pi;
270 xywh {5 5 40 25} deactivate
273 label {Se&ttings} open
277 label {&Follow Playhead}
278 callback {Timeline::follow_playhead = menu_picked_value( o );}
279 xywh {45 45 40 25} type Toggle value 1
282 label {&Center Playhead}
283 callback {Timeline::center_playhead = menu_picked_value( o );}
284 xywh {55 55 40 25} type Toggle value 1
287 label {&Snap to} open
292 callback {Timeline::snap_to = Timeline::Bars;}
293 xywh {25 25 40 25} type Radio value 1
297 callback {Timeline::snap_to = Timeline::Beats;}
298 xywh {35 35 40 25} type Radio
302 callback {Timeline::snap_to = Timeline::None;}
303 xywh {45 45 40 25} type Radio
307 label {Magnetic snap}
308 callback {Timeline::snap_magnetic = menu_picked_value( o );}
309 xywh {35 35 40 25} type Toggle value 1
312 label {Capture Format} open
318 callback {save_timeline_settings();
320 const char *templates[] = { "Default", NULL };
323 char *selected_template;
325 read_line( user_config_dir, "default_path", &default_path );
327 char *path = new_project_chooser( templates, &default_path, &selected_template );
331 if ( ! Project::create( path, selected_template ) )
332 fl_alert( "Error creating project!" );
334 free( selected_template );
339 write_line( user_config_dir, "default_path", default_path );
340 free( default_path );
344 load_timeline_settings();
348 main_window->redraw();}
353 callback {char *path;
355 read_line( user_config_dir, "default_path", &path );
357 const char *name = fl_dir_chooser( "Open Project", path );
366 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" );
376 xywh {5 5 74 25} deactivate
390 xywh {45 45 40 25} shortcut 0x40071
399 callback {Loggable::undo();}
400 xywh {5 5 40 25} shortcut 0x4007a divider
404 callback {timeline->select_none();}
405 xywh {15 15 40 25} shortcut 0x50061
408 label {Delete Selected}
409 callback {timeline->delete_selected();}
410 xywh {25 25 40 25} shortcut 0xffff
414 label {T&ransport} open
419 callback {transport->locate( 0 );}
420 xywh {5 5 40 25} shortcut 0xff50
424 callback {transport->locate( timeline->length() );}
425 xywh {15 15 40 25} shortcut 0xff57
429 callback {transport->toggle();}
430 xywh {25 25 40 25} shortcut 0x20
434 callback {transport->toggle_record();}
435 xywh {45 45 40 25} shortcut 0x10072
452 callback {timeline->zoom_in();}
453 xywh {25 25 40 25} shortcut 0x2b
457 callback {timeline->zoom_out();}
458 xywh {35 35 40 25} shortcut 0x5f
462 callback {timeline->zoom_fit();}
463 xywh {15 15 40 25} shortcut 0x3d divider
467 callback {timeline->zoom( 1 );}
468 xywh {15 15 40 25} shortcut 0x31
472 callback {timeline->zoom( 60 );}
473 xywh {25 25 40 25} shortcut 0x32
477 callback {timeline->zoom( 60 * 60 );}
478 xywh {35 35 40 25} shortcut 0x33
483 callback {fl_theme_chooser();}
485 code0 {\#include "FL/Fl_Theme_Chooser.H"}
489 label {&Options} open
490 xywh {5 5 74 25} divider
493 label {&Display} open
497 label {&Timeline} open
501 label {&Measure lines}
502 callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
505 xywh {15 15 40 25} type Toggle value 1
509 label {&Waveform} open
514 callback {Waveform::fill = menu_picked_value( o );
517 xywh {25 25 40 25} type Toggle value 1
521 callback {Waveform::outline = menu_picked_value( o );
524 xywh {45 45 40 25} type Toggle value 1
528 callback {Waveform::vary_color = menu_picked_value( o );
531 xywh {35 35 40 25} type Toggle value 1
540 xywh {45 45 40 25} type Toggle value 1
543 label {Inherit track color}
544 callback {Audio_Region::inherit_track_color = menu_picked_value( o );
547 xywh {55 55 40 25} type Toggle value 1
551 callback {Audio_Region::show_box = menu_picked_value( o );
554 xywh {55 55 40 25} type Toggle value 1
558 label {&Control Sequence} open
563 callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
566 xywh {35 35 40 25} type Toggle value 1
570 callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
573 xywh {45 45 40 25} type Toggle value 1
577 callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
580 xywh {55 55 40 25} type Toggle value 1
585 label {&Behavior} open
589 label {&Transport} open
593 label {Stop Disables Record}
594 callback {transport->stop_disables_record( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );}
595 xywh {10 10 40 25} type Toggle value 1
606 callback {show_help_dialog( "MANUAL" );}
607 xywh {15 15 40 25} divider
611 callback {About_Dialog ab( PIXMAP_PATH "/non-daw/icon-256x256.png" );
613 ab.logo_box->label( VERSION );
615 ab.title->label( "The Non DAW (Digital Audio Workstation)" );
617 ab.copyright->label( "Copyright (C) 2008-2010 Jonathan Moore Liles" );
618 ab.credits->label( "Non-DAW was written from scratch by\\nJonathan Moore Liles for his own use\\n(see the manual).\\n\\nNobody planned. Nobody helped.\\nYou can help now by donating time, money,\\nand/or replacing the rest of Linux Audio\\nwith fast, light, reliable alternatives.\\n" );
620 ab.website_url->label( "http://non-daw.tuxfamily.org" );
629 xywh {3 28 477 44} type HORIZONTAL
630 code0 {o->spacing( 10 );}
634 xywh {5 30 185 37} color 30
635 code0 {transport = o;}
636 code1 {o->labeltype( FL_NO_LABEL );}
637 code2 {o->spacing( 1 );}
640 Fl_Pack clocks_pack {open
641 private xywh {195 28 285 44} type HORIZONTAL
642 code0 {o->spacing( 2 );}
646 private xywh {196 28 137 40} box BORDER_BOX color 40
647 code0 {o->type( Clock::HMS );}
648 code1 {o->run( &transport->frame );}
653 xywh {335 32 137 37} box BORDER_BOX color 40
654 code0 {o->type( Clock::BBT );}
655 code1 {o->run( &transport->frame );}
662 xywh {475 32 265 40} resizable
663 code0 {o->labeltype( FL_NO_LABEL );}
670 xywh {910 27 56 14} labelsize 10 align 24
674 xywh {910 43 56 14} labelsize 10 align 24
678 xywh {910 57 56 14} labelsize 10 align 24
682 xywh {855 28 55 18} labelsize 10 align 16
684 Fl_Progress capture_buffer_progress {
686 private xywh {965 27 60 14} labelsize 10
688 Fl_Progress cpu_load_progress {
690 private xywh {965 57 60 14} labelsize 9
692 Fl_Progress playback_buffer_progress {
694 private xywh {965 42 60 14} labelsize 10
696 Fl_Progress disk_usage_progress {
698 private xywh {855 43 55 28} labelsize 10
699 code0 {o->type( FL_VERTICAL );}
705 Fl_Button solo_blinker {
707 xywh {800 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate
708 code0 {\#include "FL/Fl_Blink_Button.H"}
709 class Fl_Blink_Button
711 Fl_Button rec_blinker {
713 xywh {800 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate
714 code0 {\#include "FL/Fl_Blink_Button.H"}
715 class Fl_Blink_Button
717 Fl_Button selected_blinker {
719 xywh {745 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 13 selection_color 5 labelfont 2 labelcolor 39 deactivate
720 code0 {\#include "FL/Fl_Blink_Button.H"}
721 code1 {o->blink( false );}
722 class Fl_Blink_Button
724 Fl_Button seek_blinker {
726 xywh {745 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 10 selection_color 2 labelfont 2 labelcolor 39 deactivate
727 code0 {\#include "FL/Fl_Blink_Button.H"}
728 code1 {o->blink_interval( Fl_Blink_Button::FAST );}
729 class Fl_Blink_Button
734 xywh {745 0 235 25} labelsize 13 labelcolor 53 align 88
736 Fl_Button sm_blinker {
738 xywh {985 6 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate
742 Fl_Progress progress {
744 private xywh {15 394 995 41} hide
747 label {<Timeline>} selected
748 xywh {0 75 1025 692} box FLAT_BOX color 47 labeltype NO_LABEL labelsize 100 resizable
749 code0 {timeline = o;}
752 Fl_Box project_name {
753 label {<project name>}
754 private xywh {440 0 305 24} labeltype SHADOW_LABEL labelfont 2
755 code0 {o->label( Project::name() );}
759 Function {menu_picked_value( const Fl_Menu_ *m )} {private return_type {static int}
761 code {return m->menu()[ m->value() ].flags & FL_MENU_VALUE;} {}
763 Function {find_item( Fl_Menu_ *menu, const char *path )} {private return_type {static Fl_Menu_Item *}
765 code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
767 decl {static void menubar_cb ( void *v )} {private local
769 decl {void menubar_cb ( void )} {private local
771 Function {update_menu()} {private
773 code {Fl_Menu_Bar *m = menubar;
775 if ( ! Project::open() )
777 find_item( m, "&Project/&Export" )->deactivate();
778 find_item( m, "&Project/&Compact" )->deactivate();
779 find_item( m, "&Project/&Info" )->deactivate();
781 find_item( m, "&Project/Se&ttings" )->deactivate();
782 find_item( m, "&Timeline" )->deactivate();
784 timeline->deactivate();
785 transport->deactivate();
789 find_item( m, "&Project/&Export" )->activate();
790 find_item( m, "&Project/&Compact" )->activate();
791 find_item( m, "&Project/&Info" )->activate();
793 find_item( m, "&Project/Se&ttings" )->activate();
794 find_item( m, "&Timeline" )->activate();
796 timeline->activate();
797 transport->activate();
801 project_name->redraw();} {}
803 Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void}
805 code {if ( p->value() != v )
809 snprintf( s, 5, "%d%%", (int)v );
815 Function {update_status()} {open private
817 code {static char cbp[5], pbp[5], clp[5], dup[5];
819 update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_percent() );
820 update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() );
821 update_progress( cpu_load_progress, clp, engine ? engine->cpu_load() : 0 );
823 if ( Project::open() )
824 update_progress( disk_usage_progress, dup, percent_used( Project::path() ) );
826 update_progress( disk_usage_progress, dup, 0 );
828 if ( timeline->total_capture_xruns() )
829 capture_buffer_progress->selection_color( FL_RED );
831 if ( timeline->total_playback_xruns() )
832 playback_buffer_progress->selection_color( FL_RED );
834 static char stats[100];
836 if ( engine && ! engine->zombified() )
838 snprintf( stats, sizeof( stats ), "latency: %.1fms, xruns: %d",
839 engine->frames_to_milliseconds( timeline->total_output_latency() ),
844 snprintf( stats, sizeof( stats ), "%s", "DISCONNECTED" );
847 stats_box->label( stats );
849 static bool zombie = false;
851 if ( engine && engine->zombified() && ! zombie )
854 fl_alert( "Disconnected from JACK!" );
857 solo_blinker->value( Track::soloing() );
859 if ( transport->punch_enabled() )
860 rec_blinker->value( transport->rolling &&
861 transport->rec_enabled() &&
862 transport->frame >= timeline->range_start() &&
863 transport->frame <= timeline->range_end() );
865 rec_blinker->value( transport->rolling && transport->rec_enabled() );
867 sm_blinker->value( timeline->session_manager_name() != NULL );
868 sm_blinker->tooltip( timeline->session_manager_name() );
869 selected_blinker->value( timeline->nselected() );
870 seek_blinker->value( timeline->seek_pending() );
872 if ( timeline->session_manager_name() != NULL )
874 find_item( menubar, "&Project/&New" )->deactivate();
875 find_item( menubar, "&Project/&Open" )->deactivate();
878 // project_name->redraw();} {}
880 Function {update_cb( void *v )} {open private return_type {static void}
882 code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v );
884 ((TLE*)v)->update_status();} {}
886 Function {capture_format_cb( Fl_Widget *, void *v )} {private return_type {static void}
888 code {((TLE*)v)->capture_format_cb();} {}
890 Function {capture_format_cb()} {private return_type void
892 code {Fl_Menu_ *o = menubar;
894 Track::capture_format = o->menu()[ o->value() ].label();} {}
896 Function {progress_cb( int p, void *arg )} {private return_type {static void}
898 code {((TLE*)arg)->progress_cb( p );} {}
900 Function {progress_cb( int p )} {private return_type void
902 code {if ( ! progress->visible() )
915 nsm_send_progress( nsm, p / 100.0f );
916 update_progress( progress, pat, p );
922 Function {show_help_dialog( const char *file )} {open private return_type {static void}
926 snprintf( pat, 256, "file://%s/non-daw/%s.html", DOCUMENT_PATH, file );
932 Function {set_theme_dark()} {C return_type void
934 code {Fl::background2( 100, 100, 100 );
935 Fl::background( 50, 50, 50 );
936 Fl::foreground( 255, 255, 255 );} {}
939 class Project_Info_Dialog {open
941 Function {Project_Info_Dialog()} {open
943 code {make_window();} {}
945 Function {run()} {open return_type void
947 code {window->show();
949 while ( window->shown() )
952 Function {make_window()} {open
958 if ( logo_box->image() )
960 ((Fl_Shared_Image*)logo_box->image())->release();
961 logo_box->image( NULL );
963 private xywh {105 612 520 775} type Double modal visible
967 xywh {40 80 90 25} labeltype SHADOW_LABEL align 1
968 code0 {o->value( timeline->sample_rate() );}
971 label {Size of Journal}
972 xywh {180 80 100 25} box UP_BOX labeltype SHADOW_LABEL align 1
973 code0 {static char pat[40];}
974 code1 {snprintf( pat, sizeof( pat ), "%.1fK", size( "history" ) / (float)1024 );}
975 code2 {o->value( pat );}
976 code3 {\#include "file.h"}
980 xywh {320 80 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12
981 code0 {o->value( Project::created_on() );}
985 xywh {30 130 115 25} box BORDER_BOX color 47 align 1 textcolor 71
986 code0 {char pat[40];}
987 code1 {Clock::frame_to_HMS( pat, sizeof( pat ), timeline->length() );}
988 code2 {o->value( pat );}
992 xywh {200 130 55 25} align 1
993 code0 {o->value( timeline->ntracks() );}
997 private xywh {20 173 485 268} color 53 labelfont 1 labelsize 18 align 16
998 code0 {o->image( Fl_Shared_Image::get( PIXMAP_PATH "non-daw/icon-256x256.png" ) );}
999 code1 {o->label( NULL );}
1001 Fl_Text_Editor notes_field {
1003 private xywh {20 475 480 245} color 47 selection_color 31 textsize 18 textcolor 92
1004 code0 {o->buffer( new Fl_Text_Buffer() );}
1005 code1 {o->buffer()->loadfile( "notes" );}
1009 callback {notes_field->buffer()->savefile( "notes" );
1011 window->do_callback();}
1012 xywh {420 735 74 25}
1015 label {Project Info}
1016 xywh {40 18 405 27} box RSHADOW_BOX color 95 labeltype SHADOW_LABEL labelsize 18
1019 label {Project Info}
1020 xywh {25 18 470 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
1024 callback {window->do_callback();}
1025 xywh {330 735 74 25}
1028 label {Last Modified On}
1029 xywh {320 130 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12
1030 code0 {time_t t = modification_time( "history" );}
1031 code1 {static char s[40];}
1032 code2 {ctime_r( &t, s ); s[ strlen( s ) - 1 ] = 0;}
1033 code3 {o->value( s );}