Update NTK.
[nondaw.git] / timeline / src / TLE.fl
blobfde1216b2fa2d1f40347c0cb380718955625852f
1 # data file for the Fltk User Interface Designer (fluid)
2 version 1.0300 
3 header_name {.H} 
4 code_name {.C}
5 comment {//
6 // Copyright (C) 2008-2010 Jonathan Moore Liles
7 //
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
23
25 decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local
26
28 decl {class Fl_Flowpack;} {public global
29
31 decl {\#include <FL/Fl_Overlay_Window.H>} {private local
32
34 decl {\#include "Fl_Menu_Settings.H"} {private local
35
37 decl {\#include "Timeline.H"} {private local
38
40 decl {\#include "Transport.H"} {private local
41
43 decl {\#include "Loggable.H"} {private local
44
46 decl {\#include "Project.H"} {private local
47
49 decl {\#include "Clock.H"} {public local
50
52 decl {\#include "FL/Fl_Flowpack.H"} {private local
53
55 decl {\#include "New_Project_Dialog.H"} {private local
56
58 decl {\#include "Track.H" // for capture_format} {private local
59
61 decl {\#include "Waveform.H" // for options} {private local
62
64 decl {\#include "Audio_Region.H" // for options} {private local
65
67 decl {\#include "Control_Sequence.H" // for options} {private local
68
70 decl {\#include <FL/Fl_File_Chooser.H>} {private local
71
73 decl {\#include <FL/Fl_Shared_Image.H>} {private local
74
76 decl {\#include <FL/Fl.H>} {private local
77
79 decl {\#include <FL/fl_ask.H>} {private local
80
82 decl {\#include "Engine/Engine.H"} {private local
83
85 decl {\#include "Engine/Audio_File.H" // for supported formats} {private local
86
88 decl {\#include "FL/About_Dialog.H"} {private local
89
91 decl {extern char project_display_name[256];} {private global
92
94 decl {\#include <nsm.h>} {private local
95
97 decl {extern nsm_client_t *nsm;} {private global
98
100 decl {extern char *user_config_dir;} {private global
103 class TLE_Window {open : {public Fl_Overlay_Window}
104 } {
105   Function {TLE_Window(int W, int H, const char *L = 0) : Fl_Overlay_Window( W, H, L )} {open
106   } {
107     code {} {}
108   }
109   Function {draw_overlay(void)} {open return_type void
110   } {
111     code {timeline->draw_overlay();} {}
112   }
113   Function {~TLE_Window()} {open return_type virtual
114   } {
115     code {} {}
116   }
119 class TLE {open
120 } {
121   decl {Fl_Color system_colors[3];} {private local
122   }
123   Function {save_options()} {open
124   } {
125     code {const char options_filename[] = "options";
126   // const char state_filename[] = "state";
127   
128   // save options
129   
130   char *path;
131   asprintf( &path, "%s/%s", user_config_dir, options_filename );
132   ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
133   free( path );} {}
134   }
135   Function {save()} {open
136   } {
137     code {timeline->command_save();} {}
138   }
139   Function {quit()} {} {
140     code {timeline->command_quit();} {}
141   }
142   Function {open( const char *name )} {} {
143     code {timeline->command_load( name, NULL );} {}
144   }
145   Function {save_timeline_settings()} {open
146   } {
147     code {if ( ! Project::open() )
148         return;
149         
151 // save project local options (Timeline menu)
152 ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), "options" );} {}
153   }
154   Function {reset_timeline_settings( void )} {open private return_type void
155   } {
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 );} {}
160   }
161   Function {load_timeline_settings()} {open
162   } {
163     code {reset_timeline_settings();
166 if ( Project::open() )
167         ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), "options" );
169 update_menu();
171 project_name->redraw();} {}
172   }
173   Function {run()} {} {
174     code {update_menu();
176 // main_window->show();
178 Fl::lock();
180 // Fl::run();} {}
181   }
182   Function {TLE()} {open
183   } {
184     code {make_window();
185         
186 Fl::visible_focus( 0 );
188 // constrain window to size of screen.
190         int sx, sy, sw, sh;
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 );
218         char pat[256];
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" ) );
226 char *path;
227 asprintf( &path, "%s/options", user_config_dir );
228 ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
229 free( 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
237         char path[512];
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 );} {}
245   }
246   Function {make_window()} {open
247   } {
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
254     } {
255       Fl_Group {} {open
256         xywh {0 0 1025 72} box FLAT_BOX
257       } {
258         Fl_Menu_Bar menubar {open
259           private xywh {0 0 1025 25}
260         } {
261           Submenu {} {
262             label {&Project} open
263             xywh {5 5 74 25}
264           } {
265             MenuItem {} {
266               label {&Info}
267               callback {Project_Info_Dialog pi;
269 pi.run();}
270               xywh {5 5 40 25} deactivate
271             }
272             Submenu {} {
273               label {Se&ttings} open
274               xywh {25 25 74 25}
275             } {
276               MenuItem {} {
277                 label {&Follow Playhead}
278                 callback {Timeline::follow_playhead = menu_picked_value( o );}
279                 xywh {45 45 40 25} type Toggle value 1
280               }
281               MenuItem {} {
282                 label {&Center Playhead}
283                 callback {Timeline::center_playhead = menu_picked_value( o );}
284                 xywh {55 55 40 25} type Toggle value 1
285               }
286               Submenu {} {
287                 label {&Snap to} open
288                 xywh {25 25 74 25}
289               } {
290                 MenuItem {} {
291                   label Bars
292                   callback {Timeline::snap_to = Timeline::Bars;}
293                   xywh {25 25 40 25} type Radio value 1
294                 }
295                 MenuItem {} {
296                   label Beats
297                   callback {Timeline::snap_to = Timeline::Beats;}
298                   xywh {35 35 40 25} type Radio
299                 }
300                 MenuItem {} {
301                   label Off
302                   callback {Timeline::snap_to = Timeline::None;}
303                   xywh {45 45 40 25} type Radio
304                 }
305               }
306               MenuItem {} {
307                 label {Magnetic snap}
308                 callback {Timeline::snap_magnetic = menu_picked_value( o );}
309                 xywh {35 35 40 25} type Toggle value 1
310               }
311               Submenu {} {
312                 label {Capture Format} open
313                 xywh {25 25 74 25}
314               } {}
315             }
316             MenuItem {} {
317               label {&New}
318               callback {save_timeline_settings();
320 const char *templates[] = { "Default", NULL };
322 char *default_path;
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 );
329         if ( path )
330         {
331             if ( ! Project::create( path, selected_template ) )
332                 fl_alert( "Error creating project!" );
333             free( path );
334             free( selected_template );
335         }
337         if ( default_path )
338         {
339             write_line( user_config_dir, "default_path", default_path );
340             free( default_path );
341         }
344 load_timeline_settings();
346 update_menu();
348 main_window->redraw();}
349               xywh {5 5 40 25}
350             }
351             MenuItem {} {
352               label {&Open}
353               callback {char *path;
355 read_line( user_config_dir, "default_path", &path );
357 const char *name = fl_dir_chooser( "Open Project", path );
359 free( path );
361 open( name );}
362               xywh {15 15 40 25}
363             }
364             MenuItem {} {
365               label {&Compact}
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" );
368 if ( n != 2 )
369         return;
370         
371 Project::compact();}
372               xywh {25 25 40 25}
373             }
374             Submenu {} {
375               label {&Export} open
376               xywh {5 5 74 25} deactivate
377             } {
378               MenuItem {} {
379                 label Project
380                 xywh {5 5 40 25}
381               }
382               MenuItem {} {
383                 label Range
384                 xywh {15 15 40 25}
385               }
386             }
387             MenuItem {} {
388               label {&Quit}
389               callback {quit()}
390               xywh {45 45 40 25} shortcut 0x40071
391             }
392           }
393           Submenu {} {
394             label {&Edit} open
395             xywh {5 5 74 25}
396           } {
397             MenuItem {} {
398               label Undo
399               callback {Loggable::undo();}
400               xywh {5 5 40 25} shortcut 0x4007a divider
401             }
402             MenuItem {} {
403               label {Select None}
404               callback {timeline->select_none();}
405               xywh {15 15 40 25} shortcut 0x50061
406             }
407             MenuItem {} {
408               label {Delete  Selected}
409               callback {timeline->delete_selected();}
410               xywh {25 25 40 25} shortcut 0xffff
411             }
412           }
413           Submenu {} {
414             label {T&ransport} open
415             xywh {5 5 74 25}
416           } {
417             MenuItem {} {
418               label Start
419               callback {transport->locate( 0 );}
420               xywh {5 5 40 25} shortcut 0xff50
421             }
422             MenuItem {} {
423               label End
424               callback {transport->locate( timeline->length() );}
425               xywh {15 15 40 25} shortcut 0xff57
426             }
427             MenuItem {} {
428               label {Play/Stop}
429               callback {transport->toggle();}
430               xywh {25 25 40 25} shortcut 0x20
431             }
432             MenuItem {} {
433               label Record
434               callback {transport->toggle_record();}
435               xywh {45 45 40 25} shortcut 0x10072
436             }
437           }
438           MenuItem {} {
439             label {&Timeline}
440             xywh {5 5 40 25}
441           }
442           Submenu {} {
443             label {&View} open
444             xywh {5 5 74 25}
445           } {
446             Submenu {} {
447               label {&Zoom} open
448               xywh {5 5 74 25}
449             } {
450               MenuItem {} {
451                 label {&In}
452                 callback {timeline->zoom_in();}
453                 xywh {25 25 40 25} shortcut 0x2b
454               }
455               MenuItem {} {
456                 label {&Out}
457                 callback {timeline->zoom_out();}
458                 xywh {35 35 40 25} shortcut 0x5f
459               }
460               MenuItem {} {
461                 label {&Fit}
462                 callback {timeline->zoom_fit();}
463                 xywh {15 15 40 25} shortcut 0x3d divider
464               }
465               MenuItem {} {
466                 label {1 sec.}
467                 callback {timeline->zoom( 1 );}
468                 xywh {15 15 40 25} shortcut 0x31
469               }
470               MenuItem {} {
471                 label {1 min.}
472                 callback {timeline->zoom( 60 );}
473                 xywh {25 25 40 25} shortcut 0x32
474               }
475               MenuItem {} {
476                 label {1 hour.}
477                 callback {timeline->zoom( 60 * 60 );}
478                 xywh {35 35 40 25} shortcut 0x33
479               }
480             }
481             MenuItem {} {
482               label {&Theme}
483               callback {fl_theme_chooser();}
484               xywh {15 15 40 24}
485               code0 {\#include "FL/Fl_Theme_Chooser.H"}
486             }
487           }
488           Submenu {} {
489             label {&Options} open
490             xywh {5 5 74 25} divider
491           } {
492             Submenu {} {
493               label {&Display} open
494               xywh {15 15 74 25}
495             } {
496               Submenu {} {
497                 label {&Timeline} open
498                 xywh {15 15 74 25}
499               } {
500                 MenuItem {} {
501                   label {&Measure lines}
502                   callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
504 timeline->redraw();}
505                   xywh {15 15 40 25} type Toggle value 1
506                 }
507               }
508               Submenu {} {
509                 label {&Waveform} open
510                 xywh {15 15 74 25}
511               } {
512                 MenuItem {} {
513                   label Fill
514                   callback {Waveform::fill = menu_picked_value( o );
516 timeline->redraw();}
517                   xywh {25 25 40 25} type Toggle value 1
518                 }
519                 MenuItem {} {
520                   label Outline
521                   callback {Waveform::outline = menu_picked_value( o );
523 timeline->redraw();}
524                   xywh {45 45 40 25} type Toggle value 1
525                 }
526                 MenuItem {} {
527                   label {Vary color}
528                   callback {Waveform::vary_color = menu_picked_value( o );
530 timeline->redraw();}
531                   xywh {35 35 40 25} type Toggle value 1
532                 }
533               }
534               Submenu {} {
535                 label {&Region} open
536                 xywh {15 15 74 25}
537               } {
538                 MenuItem {} {
539                   label {Filled fades}
540                   xywh {45 45 40 25} type Toggle value 1
541                 }
542                 MenuItem {} {
543                   label {Inherit track color}
544                   callback {Audio_Region::inherit_track_color = menu_picked_value( o );
546 timeline->redraw();}
547                   xywh {55 55 40 25} type Toggle value 1
548                 }
549                 MenuItem {} {
550                   label {Show box}
551                   callback {Audio_Region::show_box = menu_picked_value( o );
553 timeline->redraw();}
554                   xywh {55 55 40 25} type Toggle value 1
555                 }
556               }
557               Submenu {} {
558                 label {&Control Sequence} open
559                 xywh {15 15 74 25}
560               } {
561                 MenuItem {} {
562                   label Polygon
563                   callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
565 timeline->redraw();}
566                   xywh {35 35 40 25} type Toggle value 1
567                 }
568                 MenuItem {} {
569                   label Graded
570                   callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
572 timeline->redraw();}
573                   xywh {45 45 40 25} type Toggle value 1
574                 }
575                 MenuItem {} {
576                   label Ruled
577                   callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
579 timeline->redraw();}
580                   xywh {55 55 40 25} type Toggle value 1
581                 }
582               }
583             }
584             Submenu {} {
585               label {&Behavior} open
586               xywh {5 5 74 25}
587             } {
588               Submenu {} {
589                 label {&Transport} open
590                 xywh {5 5 74 25}
591               } {
592                 MenuItem {} {
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
596                 }
597               }
598             }
599           }
600           Submenu {} {
601             label {&Help} open
602             xywh {5 5 74 25}
603           } {
604             MenuItem {} {
605               label {&Manual}
606               callback {show_help_dialog( "MANUAL" );}
607               xywh {15 15 40 25} divider
608             }
609             MenuItem {} {
610               label {&About}
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" );
623 ab.run();}
624               xywh {5 5 40 25}
625             }
626           }
627         }
628         Fl_Pack {} {open
629           xywh {3 28 477 44} type HORIZONTAL
630           code0 {o->spacing( 10 );}
631         } {
632           Fl_Box {} {
633             label {<Transport>}
634             xywh {5 30 185 37} color 30
635             code0 {transport = o;}
636             code1 {o->labeltype( FL_NO_LABEL );}
637             code2 {o->spacing( 1 );}
638             class Transport
639           }
640           Fl_Pack clocks_pack {open
641             private xywh {195 28 285 44} type HORIZONTAL
642             code0 {o->spacing( 2 );}
643           } {
644             Fl_Box {} {
645               label PLAYHEAD
646               private xywh {196 28 137 40} box BORDER_BOX color 40
647               code0 {o->type( Clock::HMS );}
648               code1 {o->run( &transport->frame );}
649               class Clock
650             }
651             Fl_Box {} {
652               label PLAYHEAD
653               xywh {335 32 137 37} box BORDER_BOX color 40
654               code0 {o->type( Clock::BBT );}
655               code1 {o->run( &transport->frame );}
656               class Clock
657             }
658           }
659         }
660         Fl_Box {} {
661           label {<empty>}
662           xywh {475 32 265 40} resizable
663           code0 {o->labeltype( FL_NO_LABEL );}
664         }
665         Fl_Group {} {open
666           xywh {850 23 175 50}
667         } {
668           Fl_Box {} {
669             label {capture:}
670             xywh {910 27 56 14} labelsize 10 align 24
671           }
672           Fl_Box {} {
673             label {playback:}
674             xywh {910 43 56 14} labelsize 10 align 24
675           }
676           Fl_Box {} {
677             label {DSP:}
678             xywh {910 57 56 14} labelsize 10 align 24
679           }
680           Fl_Box {} {
681             label filesystem
682             xywh {855 28 55 18} labelsize 10 align 16
683           }
684           Fl_Progress capture_buffer_progress {
685             label {50%}
686             private xywh {965 27 60 14} labelsize 10
687           }
688           Fl_Progress cpu_load_progress {
689             label {50%}
690             private xywh {965 57 60 14} labelsize 9
691           }
692           Fl_Progress playback_buffer_progress {
693             label {50%}
694             private xywh {965 42 60 14} labelsize 10
695           }
696           Fl_Progress disk_usage_progress {
697             label {50%}
698             private xywh {855 43 55 28} labelsize 10
699             code0 {o->type( FL_VERTICAL );}
700           }
701         }
702         Fl_Group {} {open
703           xywh {740 31 115 40}
704         } {
705           Fl_Button solo_blinker {
706             label SOLO
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
710           }
711           Fl_Button rec_blinker {
712             label REC
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
716           }
717           Fl_Button selected_blinker {
718             label SEL
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
723           }
724           Fl_Button seek_blinker {
725             label SEEK
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
730           }
731         }
732         Fl_Box stats_box {
733           label {<stats>}
734           xywh {745 0 235 25} labelsize 13 labelcolor 53 align 88
735         }
736         Fl_Button sm_blinker {
737           label SM
738           xywh {985 6 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate
739           class Fl_Button
740         }
741       }
742       Fl_Progress progress {
743         label {0%}
744         private xywh {15 394 995 41} hide
745       }
746       Fl_Box {} {
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;}
750         class Timeline
751       }
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() );}
756       }
757     }
758   }
759   Function {menu_picked_value( const Fl_Menu_ *m )} {private return_type {static int}
760   } {
761     code {return m->menu()[ m->value() ].flags & FL_MENU_VALUE;} {}
762   }
763   Function {find_item( Fl_Menu_ *menu, const char *path )} {private return_type {static Fl_Menu_Item *}
764   } {
765     code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
766   }
767   decl {static void menubar_cb ( void *v )} {private local
768   }
769   decl {void menubar_cb ( void )} {private local
770   }
771   Function {update_menu()} {private
772   } {
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();
780         
781         find_item( m, "&Project/Se&ttings" )->deactivate();
782         find_item( m, "&Timeline" )->deactivate();
784         timeline->deactivate();
785         transport->deactivate();
787 else
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();
795         
796         timeline->activate();
797         transport->activate();  
800 m->redraw();
801 project_name->redraw();} {}
802   }
803   Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void}
804   } {
805     code {if ( p->value() != v )
807 p->value( v );
809 snprintf( s, 5, "%d%%", (int)v );
811 p->label( s );
813 }} {}
814   }
815   Function {update_status()} {open private
816   } {
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() ) );
825 else
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() ),
840         engine->xruns() );
842 else
844         snprintf( stats, sizeof( stats ), "%s", "DISCONNECTED" );
847 stats_box->label( stats );
849 static bool zombie = false;
851 if ( engine && engine->zombified() && ! zombie )
853         zombie = true;
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() );
864 else
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();} {}
879   }
880   Function {update_cb( void *v )} {open private return_type {static void}
881   } {
882     code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v );
884 ((TLE*)v)->update_status();} {}
885   }
886   Function {capture_format_cb( Fl_Widget *, void *v )} {private return_type {static void}
887   } {
888     code {((TLE*)v)->capture_format_cb();} {}
889   }
890   Function {capture_format_cb()} {private return_type void
891   } {
892     code {Fl_Menu_ *o = menubar;
894 Track::capture_format = o->menu()[ o->value() ].label();} {}
895   }
896   Function {progress_cb( int p, void *arg )} {private return_type {static void}
897   } {
898     code {((TLE*)arg)->progress_cb( p );} {}
899   }
900   Function {progress_cb( int p )} {private return_type void
901   } {
902     code {if ( ! progress->visible() )
904         timeline->hide();
905         progress->show();
907 else if ( 0 == p )
909         timeline->show();
910         progress->hide();
913 static char pat[10];
915 nsm_send_progress( nsm, p / 100.0f );
916 update_progress( progress, pat, p );
918 progress->redraw();
920 Fl::check();} {}
921   }
922   Function {show_help_dialog( const char *file )} {open private return_type {static void}
923   } {
924     code {char pat[256];
926 snprintf( pat, 256, "file://%s/non-daw/%s.html", DOCUMENT_PATH, file );
928 open_url( pat );} {}
929   }
932 Function {set_theme_dark()} {C return_type void
933 } {
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
940 } {
941   Function {Project_Info_Dialog()} {open
942   } {
943     code {make_window();} {}
944   }
945   Function {run()} {open return_type void
946   } {
947     code {window->show();
949 while ( window->shown() )
950         Fl::wait();} {}
951   }
952   Function {make_window()} {open
953   } {
954     Fl_Window window {
955       label {Project info}
956       callback {o->hide();
958 if ( logo_box->image() )
960         ((Fl_Shared_Image*)logo_box->image())->release();
961         logo_box->image( NULL );
962 }} open
963       private xywh {105 612 520 775} type Double modal visible
964     } {
965       Fl_Value_Output {} {
966         label {Sample Rate}
967         xywh {40 80 90 25} labeltype SHADOW_LABEL align 1
968         code0 {o->value( timeline->sample_rate() );}
969       }
970       Fl_Output {} {
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"}
977       }
978       Fl_Output {} {
979         label {Created On}
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() );}
982       }
983       Fl_Output {} {
984         label Length
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 );}
989       }
990       Fl_Value_Output {} {
991         label Tracks
992         xywh {200 130 55 25} align 1
993         code0 {o->value( timeline->ntracks() );}
994       }
995       Fl_Box logo_box {
996         label {<LOGO>}
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 );}
1000       }
1001       Fl_Text_Editor notes_field {
1002         label {Notes:}
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" );}
1006       }
1007       Fl_Button {} {
1008         label {&Save}
1009         callback {notes_field->buffer()->savefile( "notes" );
1011 window->do_callback();}
1012         xywh {420 735 74 25}
1013       }
1014       Fl_Box {} {
1015         label {Project Info}
1016         xywh {40 18 405 27} box RSHADOW_BOX color 95 labeltype SHADOW_LABEL labelsize 18
1017       }
1018       Fl_Box {} {
1019         label {Project Info}
1020         xywh {25 18 470 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
1021       }
1022       Fl_Button {} {
1023         label {&Discard}
1024         callback {window->do_callback();}
1025         xywh {330 735 74 25}
1026       }
1027       Fl_Output {} {
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 );}
1034       }
1035     }
1036   }