Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1129 lines
31KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0108
  3. header_name {.H}
  4. code_name {.C}
  5. comment {//
  6. // Copyright (C) 2008 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.
  12. //
  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.
  17. //
  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.
  21. //
  22. } {in_source in_header
  23. }
  24. decl {const float STATUS_UPDATE_FREQ = 0.5f;} {}
  25. decl {\#include "LASH_Engine.H"} {}
  26. decl {\#include "Fl_Menu_Settings.H"} {}
  27. decl {\#include "Timeline.H"} {}
  28. decl {\#include "Transport.H"} {}
  29. decl {\#include "Loggable.H"} {}
  30. decl {\#include "Project.H"} {}
  31. decl {\#include "Clock.H"} {public
  32. }
  33. decl {\#include "Track.H" // for capture_format} {}
  34. decl {\#include "Waveform.H" // for options} {}
  35. decl {\#include "Audio_Region.H" // for options} {}
  36. decl {\#include "Control_Sequence.H" // for options} {}
  37. decl {\#include <FL/Fl_File_Chooser.H>} {}
  38. decl {\#include <Fl/Fl_Shared_Image.H>} {}
  39. decl {\#include <FL/Fl.H>} {}
  40. decl {\#include <FL/fl_ask.H>} {}
  41. decl {\#include "Engine/Engine.H"} {}
  42. decl {\#include "Engine/Audio_File.H" // for supported formats} {}
  43. decl {class About_Dialog;} {}
  44. decl {extern char project_display_name[256];} {global
  45. }
  46. decl {extern char *user_config_dir;} {global
  47. }
  48. decl {extern LASH_Engine *lash;} {global
  49. }
  50. class TLE {open
  51. } {
  52. decl {Fl_Color system_colors[3];} {}
  53. Function {save()} {open
  54. } {
  55. code {const char options_filename[] = "options";
  56. // const char state_filename[] = "state";
  57. // save options
  58. char *path;
  59. asprintf( &path, "%s/%s", user_config_dir, options_filename );
  60. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
  61. free( path );} {}
  62. }
  63. Function {quit()} {} {
  64. code {Project::close();
  65. save();
  66. while ( Fl::first_window() ) Fl::first_window()->hide();} {}
  67. }
  68. Function {open( const char *name )} {} {
  69. code {if ( ! name )
  70. return;
  71. int r = Project::open( name );
  72. if ( r < 0 )
  73. {
  74. const char *s = Project::errstr( r );
  75. fl_alert( "Could not open project \\"%s\\":\\n\\n\\t%s", name, s );
  76. }} {}
  77. }
  78. Function {save_timeline_settings()} {open
  79. } {
  80. code {if ( ! Project::open() )
  81. return;
  82. // save project local options (Timeline menu)
  83. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), "options" );} {}
  84. }
  85. Function {reset_timeline_settings( void )} {open private return_type void
  86. } {
  87. code {char path[256];
  88. snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
  89. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), path );} {}
  90. }
  91. Function {load_timeline_settings()} {open
  92. } {
  93. code {reset_timeline_settings();
  94. if ( Project::open() )
  95. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), "options" );
  96. update_menu();
  97. project_name->redraw();} {selected
  98. }
  99. }
  100. Function {run()} {} {
  101. code {update_menu();
  102. main_window->show();
  103. Fl::lock();
  104. // Fl::run();} {}
  105. }
  106. Function {TLE()} {open
  107. } {
  108. code {
  109. Fl::visual( FL_DOUBLE | FL_RGB8 );
  110. make_window();
  111. Fl::visible_focus( 0 );
  112. Fl::get_system_colors();
  113. Fl::scheme( "plastic" );
  114. system_colors[ 0 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR );
  115. system_colors[ 1 ] = (Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR );
  116. system_colors[ 2 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR );
  117. // try to fill the screen
  118. {
  119. int sx, sy, sw, sh;
  120. Fl::screen_xywh( sx, sy, sw, sh );
  121. main_window->resize( sx, sy, sw, sh );
  122. }
  123. Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
  124. fl_message_icon()->box( FL_RSHADOW_BOX );
  125. fl_message_icon()->labelcolor( FL_BLACK );
  126. fl_message_icon()->color( FL_RED );
  127. fl_message_font( FL_HELVETICA, 18 );
  128. std::list <const char *> formats;
  129. Audio_File::all_supported_formats( formats );
  130. for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats.end(); ++f )
  131. {
  132. // capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
  133. //;
  134. char pat[256];
  135. snprintf( pat, sizeof( pat ), "&Project/Se&ttings/Capture Format/%s", *f );
  136. menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
  137. }
  138. menubar->picked( menubar->find_item( "&Project/Se&ttings/Capture Format/Wav 24" ) );
  139. char *path;
  140. asprintf( &path, "%s/options", user_config_dir );
  141. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
  142. free( path );
  143. menubar->add( "&Timeline", 0, 0, const_cast< Fl_Menu_Item *>( timeline->menu->menu() ), FL_SUBMENU_POINTER );
  144. // save a copy of the project settings menu so that we can restore the defaults later
  145. {
  146. char path[512];
  147. snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
  148. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), path );
  149. }
  150. Loggable::progress_callback( &TLE::progress_cb, this );} {}
  151. }
  152. Function {make_window()} {open
  153. } {
  154. Fl_Window main_window {
  155. label Timeline
  156. callback {if ( Fl::event_key() != FL_Escape )
  157. o->hide();} open
  158. private xywh {102 111 1025 770} type Double resizable xclass Non_DAW visible
  159. } {
  160. Fl_Menu_Bar menubar {open
  161. private xywh {0 0 1024 25}
  162. } {
  163. Submenu {} {
  164. label {&Project} open
  165. xywh {0 0 74 25}
  166. } {
  167. MenuItem {} {
  168. label {&Info}
  169. callback {Project_Info_Dialog pi;
  170. pi.run();}
  171. xywh {0 0 40 25} deactivate
  172. }
  173. Submenu {} {
  174. label {Se&ttings} open
  175. xywh {20 20 74 25}
  176. } {
  177. MenuItem {} {
  178. label {&Follow Playhead}
  179. callback {Timeline::follow_playhead = menu_picked_value( o );}
  180. xywh {40 40 40 25} type Toggle value 1
  181. }
  182. MenuItem {} {
  183. label {&Center Playhead}
  184. callback {Timeline::center_playhead = menu_picked_value( o );}
  185. xywh {50 50 40 25} type Toggle value 1
  186. }
  187. Submenu {} {
  188. label {&Snap to} open
  189. xywh {20 20 74 25}
  190. } {
  191. MenuItem {} {
  192. label Bars
  193. callback {Timeline::snap_to = Timeline::Bars;}
  194. xywh {20 20 40 25} type Radio value 1
  195. }
  196. MenuItem {} {
  197. label Beats
  198. callback {Timeline::snap_to = Timeline::Beats;}
  199. xywh {30 30 40 25} type Radio
  200. }
  201. MenuItem {} {
  202. label Off
  203. callback {Timeline::snap_to = Timeline::None;}
  204. xywh {40 40 40 25} type Radio
  205. }
  206. }
  207. MenuItem {} {
  208. label {Magnetic snap}
  209. callback {Timeline::snap_magnetic = menu_picked_value( o );}
  210. xywh {30 30 40 25} type Toggle value 1
  211. }
  212. Submenu {} {
  213. label {Capture Format} open
  214. xywh {20 20 74 25}
  215. } {}
  216. }
  217. MenuItem {} {
  218. label {&New}
  219. callback {save_timeline_settings();
  220. new_project_chooser();
  221. load_timeline_settings();
  222. update_menu();
  223. main_window->redraw();}
  224. xywh {0 0 40 25}
  225. }
  226. MenuItem {} {
  227. label {&Open}
  228. callback {char *path;
  229. read_line( user_config_dir, "default_path", &path );
  230. const char *name = fl_dir_chooser( "Open Project", path, NULL );
  231. free( path );
  232. open( name );}
  233. xywh {10 10 40 25}
  234. }
  235. MenuItem {} {
  236. label {&Compact}
  237. 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" );
  238. if ( n != 2 )
  239. return;
  240. Project::compact();}
  241. xywh {20 20 40 25}
  242. }
  243. Submenu {} {
  244. label {&Export} open
  245. xywh {0 0 74 25} deactivate
  246. } {
  247. MenuItem {} {
  248. label Project
  249. xywh {0 0 40 25}
  250. }
  251. MenuItem {} {
  252. label Range
  253. xywh {10 10 40 25}
  254. }
  255. }
  256. MenuItem {} {
  257. label {&Quit}
  258. callback {quit()}
  259. xywh {40 40 40 25} shortcut 0x40071
  260. }
  261. }
  262. Submenu {} {
  263. label {&Edit} open
  264. xywh {0 0 74 25}
  265. } {
  266. MenuItem {} {
  267. label Undo
  268. callback {Loggable::undo();}
  269. xywh {0 0 40 25} shortcut 0x4007a divider
  270. }
  271. MenuItem {} {
  272. label {Select None}
  273. callback {timeline->select_none();}
  274. xywh {10 10 40 25} shortcut 0x50061
  275. }
  276. MenuItem {} {
  277. label {Delete Selected}
  278. callback {timeline->delete_selected();}
  279. xywh {20 20 40 25} shortcut 0xffff
  280. }
  281. }
  282. Submenu {} {
  283. label Transport open
  284. xywh {0 0 74 25}
  285. } {
  286. MenuItem {} {
  287. label Start
  288. callback {transport->locate( 0 );}
  289. xywh {0 0 40 25} shortcut 0xff50
  290. }
  291. MenuItem {} {
  292. label End
  293. callback {transport->locate( timeline->length() );}
  294. xywh {10 10 40 25} shortcut 0xff57
  295. }
  296. MenuItem {} {
  297. label {Play/Stop}
  298. callback {transport->toggle();}
  299. xywh {20 20 40 25} shortcut 0x20
  300. }
  301. MenuItem {} {
  302. label Record
  303. callback {transport->toggle_record();}
  304. xywh {40 40 40 25} shortcut 0x10072
  305. }
  306. }
  307. MenuItem {} {
  308. label {&Timeline}
  309. xywh {0 0 40 25}
  310. }
  311. Submenu {} {
  312. label {&View} open
  313. xywh {0 0 74 25}
  314. } {
  315. Submenu {} {
  316. label {&Zoom} open
  317. xywh {0 0 74 25}
  318. } {
  319. MenuItem {} {
  320. label {&In}
  321. callback {timeline->zoom_in();}
  322. xywh {20 20 40 25} shortcut 0x2b
  323. }
  324. MenuItem {} {
  325. label {&Out}
  326. callback {timeline->zoom_out();}
  327. xywh {30 30 40 25} shortcut 0x5f
  328. }
  329. MenuItem {} {
  330. label {&Fit}
  331. callback {timeline->zoom_fit();}
  332. xywh {10 10 40 25} shortcut 0x3d divider
  333. }
  334. MenuItem {} {
  335. label {1 sec.}
  336. callback {timeline->zoom( 1 );}
  337. xywh {10 10 40 25} shortcut 0x31
  338. }
  339. MenuItem {} {
  340. label {1 min.}
  341. callback {timeline->zoom( 60 );}
  342. xywh {20 20 40 25} shortcut 0x32
  343. }
  344. MenuItem {} {
  345. label {1 hour.}
  346. callback {timeline->zoom( 60 * 60 );}
  347. xywh {30 30 40 25} shortcut 0x33
  348. }
  349. }
  350. }
  351. Submenu {} {
  352. label {&Options} open
  353. xywh {0 0 74 25} divider
  354. } {
  355. Submenu {} {
  356. label {&Display} open
  357. xywh {10 10 74 25}
  358. } {
  359. Submenu {} {
  360. label {&Timeline} open
  361. xywh {10 10 74 25}
  362. } {
  363. MenuItem {} {
  364. label {&Measure lines}
  365. callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
  366. timeline->redraw();}
  367. xywh {10 10 40 25} type Toggle value 1
  368. }
  369. }
  370. Submenu {} {
  371. label {&Waveform} open
  372. xywh {10 10 74 25}
  373. } {
  374. MenuItem {} {
  375. label Fill
  376. callback {Waveform::fill = menu_picked_value( o );
  377. timeline->redraw();}
  378. xywh {20 20 40 25} type Toggle value 1
  379. }
  380. MenuItem {} {
  381. label Outline
  382. callback {Waveform::outline = menu_picked_value( o );
  383. timeline->redraw();}
  384. xywh {40 40 40 25} type Toggle value 1
  385. }
  386. MenuItem {} {
  387. label {Vary color}
  388. callback {Waveform::vary_color = menu_picked_value( o );
  389. timeline->redraw();}
  390. xywh {30 30 40 25} type Toggle value 1
  391. }
  392. }
  393. Submenu {} {
  394. label {&Region} open
  395. xywh {10 10 74 25}
  396. } {
  397. MenuItem {} {
  398. label {Filled fades}
  399. xywh {40 40 40 25} type Toggle value 1
  400. }
  401. MenuItem {} {
  402. label {Inherit track color}
  403. callback {Audio_Region::inherit_track_color = menu_picked_value( o );
  404. timeline->redraw();}
  405. xywh {50 50 40 25} type Toggle value 1
  406. }
  407. }
  408. Submenu {} {
  409. label {&Control Sequence} open
  410. xywh {10 10 74 25}
  411. } {
  412. MenuItem {} {
  413. label Polygon
  414. callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
  415. timeline->redraw();}
  416. xywh {30 30 40 25} type Toggle value 1
  417. }
  418. MenuItem {} {
  419. label Graded
  420. callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
  421. timeline->redraw();}
  422. xywh {40 40 40 25} type Toggle value 1
  423. }
  424. MenuItem {} {
  425. label Ruled
  426. callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
  427. timeline->redraw();}
  428. xywh {50 50 40 25} type Toggle value 1
  429. }
  430. }
  431. Submenu {} {
  432. label {&Style} open
  433. xywh {10 10 74 25}
  434. } {
  435. MenuItem {} {
  436. label Default
  437. callback {Fl::scheme( "plastic" );}
  438. xywh {10 10 40 25} type Radio value 1
  439. }
  440. MenuItem {} {
  441. label Flat
  442. callback {Fl::scheme( "gtk+" );}
  443. xywh {20 20 40 25} type Radio
  444. }
  445. }
  446. Submenu {} {
  447. label {C&olors} open
  448. xywh {10 10 74 25}
  449. } {
  450. MenuItem {} {
  451. label System
  452. callback {//Fl::get_system_colors();
  453. unsigned char r, g, b;
  454. Fl::get_color( system_colors[ 0 ], r, g, b );
  455. Fl::background( r, g, b );
  456. Fl::get_color( system_colors[ 1 ], r, g, b );
  457. Fl::foreground( r, g, b );
  458. Fl::get_color( system_colors[ 2 ], r, g, b );
  459. Fl::background2( r, g, b );
  460. Fl::scheme( Fl::scheme() );}
  461. xywh {10 10 40 25} type Radio
  462. }
  463. MenuItem {} {
  464. label Dark
  465. callback {Fl::background2( 100, 100, 100 );
  466. Fl::background( 50, 50, 50 );
  467. Fl::foreground( 255, 255, 255 );
  468. Fl::scheme( Fl::scheme() );}
  469. xywh {20 20 40 25} type Radio value 1
  470. }
  471. MenuItem {} {
  472. label Light
  473. callback {Fl::background2( 192, 192, 192 );
  474. Fl::background( 220, 220, 220 );
  475. Fl::foreground( 0, 0, 0 );
  476. Fl::scheme( Fl::scheme() );}
  477. xywh {30 30 40 25} type Radio
  478. }
  479. }
  480. }
  481. }
  482. Submenu {} {
  483. label {&Help} open
  484. xywh {0 0 74 25}
  485. } {
  486. MenuItem {} {
  487. label {&Manual}
  488. callback {show_help_dialog( "MANUAL" );}
  489. xywh {10 10 40 25} divider
  490. }
  491. MenuItem {} {
  492. label {&About}
  493. callback {About_Dialog ab;
  494. ab.run();}
  495. xywh {0 0 40 25}
  496. }
  497. }
  498. }
  499. Fl_Group {} {open
  500. xywh {0 1 1025 73}
  501. } {
  502. Fl_Pack {} {open
  503. xywh {0 23 483 46} type HORIZONTAL
  504. code0 {o->spacing( 10 );}
  505. } {
  506. Fl_Box {} {
  507. label {<Transport>}
  508. xywh {5 23 189 46} color 30
  509. code0 {transport = o;}
  510. code1 {o->labeltype( FL_NO_LABEL );}
  511. class Transport
  512. }
  513. Fl_Pack clocks_pack {
  514. private xywh {195 23 288 46} type HORIZONTAL
  515. code0 {o->spacing( 2 );}
  516. } {
  517. Fl_Box {} {
  518. label PLAYHEAD
  519. private xywh {195 29 137 40} box BORDER_BOX color 40
  520. code0 {o->type( Clock::HMS );}
  521. code1 {o->run( &transport->frame );}
  522. class Clock
  523. }
  524. Fl_Box {} {
  525. label PLAYHEAD
  526. xywh {335 29 142 40} box BORDER_BOX color 40
  527. code0 {o->type( Clock::BBT );}
  528. code1 {o->run( &transport->frame );}
  529. class Clock
  530. }
  531. }
  532. }
  533. Fl_Box {} {
  534. label {<empty>}
  535. xywh {487 27 203 42} resizable
  536. code0 {o->labeltype( FL_NO_LABEL );}
  537. }
  538. Fl_Group {} {open
  539. xywh {745 26 280 44}
  540. } {
  541. Fl_Box {} {
  542. label {capture:}
  543. xywh {865 26 56 14} labelsize 10 align 24
  544. }
  545. Fl_Box {} {
  546. label {playback:}
  547. xywh {865 42 56 14} labelsize 10 align 24
  548. }
  549. Fl_Box {} {
  550. label {DSP:}
  551. xywh {865 56 56 14} labelsize 10 align 24
  552. }
  553. Fl_Progress capture_buffer_progress {
  554. label {50%}
  555. private xywh {921 26 104 14} labelsize 10
  556. }
  557. Fl_Progress cpu_load_progress {
  558. label {50%}
  559. private xywh {921 56 104 14} labelsize 9
  560. }
  561. Fl_Progress playback_buffer_progress {
  562. label {50%}
  563. private xywh {921 41 104 14} labelsize 10
  564. }
  565. Fl_Box {} {
  566. label {disk:}
  567. xywh {810 27 55 18} labelsize 10 align 16
  568. }
  569. Fl_Progress disk_usage_progress {
  570. label {50%}
  571. private xywh {810 43 55 26} labelsize 10
  572. }
  573. }
  574. Fl_Button solo_blinker {
  575. label SOLO
  576. xywh {750 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate
  577. code0 {\#include "FL/Fl_Blinker.H"}
  578. class Fl_Blinker
  579. }
  580. Fl_Button rec_blinker {
  581. label REC
  582. xywh {750 50 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate
  583. code0 {\#include "FL/Fl_Blinker.H"}
  584. class Fl_Blinker
  585. }
  586. Fl_Button lash_blinker {
  587. label LASH
  588. xywh {695 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 75 selection_color 86 labelfont 2 labelcolor 39 deactivate
  589. code0 {\#include "FL/Fl_Blinker.H"}
  590. class Fl_Blinker
  591. }
  592. Fl_Box stats_box {
  593. label {<stats>}
  594. xywh {810 1 215 21} labelsize 13 labelcolor 53 align 88
  595. }
  596. }
  597. Fl_Progress progress {
  598. label {0%}
  599. private xywh {15 394 995 41} hide
  600. }
  601. Fl_Box {} {
  602. label {<Timeline>}
  603. xywh {0 72 1024 695} box FLAT_BOX color 47 labelsize 100 resizable
  604. code0 {timeline = o;}
  605. class Timeline
  606. }
  607. Fl_Box project_name {
  608. label {<project name>}
  609. private xywh {450 0 365 22} labeltype SHADOW_LABEL labelfont 2
  610. code0 {o->label( Project::name() );}
  611. }
  612. }
  613. }
  614. Function {menu_picked_value( const Fl_Menu_ *m )} {private return_type {static int}
  615. } {
  616. code {return m->menu()[ m->value() ].flags & FL_MENU_VALUE;} {}
  617. }
  618. Function {find_item( Fl_Menu_ *menu, const char *path )} {private return_type {static Fl_Menu_Item *}
  619. } {
  620. code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
  621. }
  622. decl {static void menubar_cb ( void *v )} {}
  623. decl {void menubar_cb ( void )} {}
  624. Function {update_menu()} {private
  625. } {
  626. code {Fl_Menu_Bar *m = menubar;
  627. if ( ! Project::open() )
  628. {
  629. find_item( m, "&Project/&Export" )->deactivate();
  630. find_item( m, "&Project/&Compact" )->deactivate();
  631. find_item( m, "&Project/&Info" )->deactivate();
  632. find_item( m, "&Project/Se&ttings" )->deactivate();
  633. find_item( m, "&Timeline" )->deactivate();
  634. timeline->deactivate();
  635. transport->deactivate();
  636. }
  637. else
  638. {
  639. find_item( m, "&Project/&Export" )->activate();
  640. find_item( m, "&Project/&Compact" )->activate();
  641. find_item( m, "&Project/&Info" )->activate();
  642. find_item( m, "&Project/Se&ttings" )->activate();
  643. find_item( m, "&Timeline" )->activate();
  644. timeline->activate();
  645. transport->activate();
  646. }
  647. m->redraw();
  648. project_name->redraw();} {}
  649. }
  650. Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void}
  651. } {
  652. code {p->value( v );
  653. snprintf( s, 5, "%d%%", (int)v );
  654. p->label( s );} {}
  655. }
  656. Function {update_status()} {open private
  657. } {
  658. code {static char cbp[5], pbp[5], clp[5], dup[5];
  659. update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_percent() );
  660. update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() );
  661. update_progress( cpu_load_progress, clp, engine->cpu_load() );
  662. update_progress( disk_usage_progress, dup, percent_used( "." ) );
  663. if ( timeline->total_capture_xruns() )
  664. capture_buffer_progress->selection_color( FL_RED );
  665. if ( timeline->total_playback_xruns() )
  666. playback_buffer_progress->selection_color( FL_RED );
  667. static char stats[100];
  668. snprintf( stats, sizeof( stats ), "latency: %.1fms, xruns: %d",
  669. engine->frames_to_milliseconds( timeline->total_output_latency() ),
  670. engine->xruns() );
  671. stats_box->label( stats );
  672. static bool zombie = false;
  673. if ( engine->zombified() && ! zombie )
  674. {
  675. zombie = true;
  676. fl_alert( "Disconnected from JACK!" );
  677. }
  678. solo_blinker->value( Track::soloing() );
  679. rec_blinker->value( transport->rolling && transport->rec_enabled() );
  680. lash_blinker->value( lash->enabled() );} {}
  681. }
  682. Function {update_cb( void *v )} {open private return_type {static void}
  683. } {
  684. code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v );
  685. ((TLE*)v)->update_status();} {}
  686. }
  687. Function {capture_format_cb( Fl_Widget *w, void *v )} {private return_type {static void}
  688. } {
  689. code {((TLE*)v)->capture_format_cb();} {}
  690. }
  691. Function {capture_format_cb()} {private return_type void
  692. } {
  693. code {Fl_Menu_ *o = menubar;
  694. Track::capture_format = o->menu()[ o->value() ].label();} {}
  695. }
  696. Function {progress_cb( int p, void *arg )} {private return_type {static void}
  697. } {
  698. code {((TLE*)arg)->progress_cb( p );} {}
  699. }
  700. Function {progress_cb( int p )} {private return_type void
  701. } {
  702. code {if ( ! progress->visible() )
  703. {
  704. timeline->hide();
  705. progress->show();
  706. }
  707. else if ( 0 == p )
  708. {
  709. timeline->show();
  710. progress->hide();
  711. }
  712. static char pat[10];
  713. update_progress( progress, pat, p );
  714. progress->redraw();
  715. Fl::check();} {}
  716. }
  717. Function {show_help_dialog( const char *file )} {open private return_type {static void}
  718. } {
  719. code {char pat[256];
  720. snprintf( pat, 256, "file://%s%s.html", DOCUMENT_PATH, file );
  721. open_url( pat );} {}
  722. }
  723. }
  724. class New_Project_Dialog {open
  725. } {
  726. Function {New_Project_Dialog()} {open
  727. } {
  728. code {make_window();} {}
  729. }
  730. Function {run()} {open return_type void
  731. } {
  732. code {_window->show();
  733. while ( _window->shown() )
  734. Fl::wait();} {}
  735. }
  736. Function {make_window()} {open
  737. } {
  738. Fl_Window _window {
  739. label {New Project} open
  740. xywh {615 414 550 195} type Double modal xclass Non_DAW visible
  741. } {
  742. Fl_File_Input _name {
  743. label {Named:}
  744. xywh {75 140 375 35}
  745. }
  746. Fl_Button {} {
  747. label Browse
  748. callback {_directory->value( fl_dir_chooser( "Directory for new project", NULL, 0 ) );}
  749. xywh {455 100 80 35}
  750. }
  751. Fl_Return_Button {} {
  752. label Create
  753. callback {if ( strlen( _directory->value() ) && strlen( _name->value() ) )
  754. {
  755. char pat[512];
  756. snprintf( pat, sizeof( pat ), "%s/%s", _directory->value(), _name->value() );
  757. if ( ! Project::create( pat, _template->text( _template->value() ) ) )
  758. fl_alert( "Error creating project!" );
  759. _window->hide();
  760. }}
  761. xywh {455 140 80 35}
  762. }
  763. Fl_File_Input _directory {
  764. label {Where:}
  765. callback {if ( ! fl_filename_isdir( o->value() ) )
  766. {
  767. fl_alert( "Must be a directory" );
  768. o->value( "" );
  769. return;
  770. }
  771. write_line( user_config_dir, "default_path", o->value() );}
  772. xywh {75 100 375 35}
  773. code0 {\#include <FL/filename.H>}
  774. code1 {char *v;}
  775. code2 {read_line( user_config_dir, "default_path", &v );}
  776. code3 {o->value( v );}
  777. }
  778. Fl_Box {} {
  779. label {New Project}
  780. xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
  781. }
  782. Fl_Choice _template {
  783. label {Template:}
  784. private xywh {310 60 225 25} down_box BORDER_BOX
  785. } {
  786. MenuItem {} {
  787. label Default
  788. xywh {0 0 40 25}
  789. }
  790. }
  791. }
  792. }
  793. }
  794. Function {new_project_chooser()} {C return_type void
  795. } {
  796. code {New_Project_Dialog nsd;
  797. nsd.run();} {}
  798. }
  799. class Project_Info_Dialog {open
  800. } {
  801. Function {Project_Info_Dialog()} {open
  802. } {
  803. code {make_window();} {}
  804. }
  805. Function {run()} {open return_type void
  806. } {
  807. code {window->show();
  808. while ( window->shown() )
  809. Fl::wait();} {}
  810. }
  811. Function {make_window()} {open
  812. } {
  813. Fl_Window window {
  814. label {Project info}
  815. callback {o->hide();
  816. if ( logo_box->image() )
  817. {
  818. ((Fl_Shared_Image*)logo_box->image())->release();
  819. logo_box->image( NULL );
  820. }} open
  821. private xywh {649 226 520 740} type Double modal visible
  822. } {
  823. Fl_Value_Output {} {
  824. label {Sample Rate}
  825. xywh {40 80 90 25} labeltype SHADOW_LABEL align 1
  826. code0 {o->value( timeline->sample_rate() );}
  827. }
  828. Fl_Output {} {
  829. label {Size of Journal}
  830. xywh {180 80 100 25} box UP_BOX labeltype SHADOW_LABEL align 1
  831. code0 {static char pat[40];}
  832. code1 {snprintf( pat, sizeof( pat ), "%.1fK", size( "history" ) / (float)1024 );}
  833. code2 {o->value( pat );}
  834. code3 {\#include "util/file.h"}
  835. }
  836. Fl_Output {} {
  837. label {Created On}
  838. xywh {320 80 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12
  839. code0 {o->value( Project::created_on() );}
  840. }
  841. Fl_Output {} {
  842. label Length
  843. xywh {30 130 115 25} box BORDER_BOX color 47 align 1 textcolor 71
  844. code0 {char pat[40];}
  845. code1 {Clock::frame_to_HMS( pat, sizeof( pat ), timeline->length() );}
  846. code2 {o->value( pat );}
  847. }
  848. Fl_Value_Output {} {
  849. label Tracks
  850. xywh {200 130 55 25} align 1
  851. code0 {o->value( timeline->ntracks() );}
  852. }
  853. Fl_Box logo_box {
  854. label {<LOGO>}
  855. private xywh {51 180 418 235} box ROUNDED_BOX color 53 labelfont 1 labelsize 18 align 16
  856. code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo2.png" ) );}
  857. code1 {o->label( NULL );}
  858. }
  859. Fl_Text_Editor notes_field {
  860. label {Notes:}
  861. private xywh {20 445 480 245} color 47 selection_color 31 textsize 18 textcolor 92
  862. code0 {o->buffer( new Fl_Text_Buffer() );}
  863. code1 {o->buffer()->loadfile( "notes" );}
  864. }
  865. Fl_Button {} {
  866. label {&Save}
  867. callback {notes_field->buffer()->savefile( "notes" );
  868. window->do_callback();}
  869. xywh {425 700 74 25}
  870. }
  871. Fl_Box {} {
  872. label {Project Info}
  873. xywh {40 18 405 27} box RSHADOW_BOX color 95 labeltype SHADOW_LABEL labelsize 18
  874. }
  875. Fl_Box {} {
  876. label {Project Info}
  877. xywh {25 18 470 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
  878. }
  879. Fl_Button {} {
  880. label {&Discard}
  881. callback {window->do_callback();}
  882. xywh {330 700 74 25}
  883. }
  884. Fl_Output {} {
  885. label {Last Modified On}
  886. xywh {320 130 180 25} box UP_BOX labeltype SHADOW_LABEL align 1 textfont 11 textsize 12
  887. code0 {time_t t = modification_time( "history" );}
  888. code1 {static char s[40];}
  889. code2 {ctime_r( &t, s ); s[ strlen( s ) - 1 ] = 0;}
  890. code3 {o->value( s );}
  891. }
  892. }
  893. }
  894. }
  895. class About_Dialog {open
  896. } {
  897. Function {About_Dialog()} {open
  898. } {
  899. code {make_window();} {}
  900. }
  901. Function {run()} {return_type void
  902. } {
  903. code {window->show();
  904. while ( window->shown() )
  905. Fl::wait();
  906. delete window;} {}
  907. }
  908. Function {make_window()} {open private
  909. } {
  910. Fl_Window window {
  911. label About
  912. callback {o->hide();
  913. if ( logo_box->image() )
  914. {
  915. ((Fl_Shared_Image*)logo_box->image())->release();
  916. logo_box->image( NULL );
  917. }} open
  918. private xywh {349 201 495 655} type Double xclass {Non-DAW} visible
  919. } {
  920. Fl_Tabs {} {open
  921. xywh {0 264 497 392}
  922. } {
  923. Fl_Group {} {
  924. label Credits open
  925. xywh {2 293 492 362}
  926. } {
  927. Fl_Box {} {
  928. label {Non-DAW was written from scratch by
  929. Jonathan Moore Liles for his own use
  930. (see the manual).
  931. Nobody planned. Nobody helped.
  932. You can help now by donating time, money,
  933. and/or replacing the rest of Linux Audio
  934. with fast, light, reliable alternatives.}
  935. xywh {39 322 418 262} box ROUNDED_BOX color 46 labelsize 18
  936. }
  937. }
  938. Fl_Group {} {
  939. label License open
  940. xywh {2 288 492 311} hide
  941. } {
  942. Fl_Box {} {
  943. label {Copyright (C) 2008 Jonathan Moore Liles}
  944. xywh {43 302 410 37} labeltype SHADOW_LABEL labelfont 1 labelsize 18
  945. }
  946. Fl_Box {} {
  947. 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.
  948. 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.
  949. 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.}
  950. xywh {10 351 475 233} box ROUNDED_BOX color 46 labelfont 1 labelsize 12 labelcolor 53 align 144
  951. }
  952. }
  953. }
  954. Fl_Box logo_box {
  955. label VERSION
  956. private xywh {25 20 445 180} box ROUNDED_BOX color 48 labelfont 1 labelsize 18 align 16
  957. code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo.png" ) );}
  958. code1 {o->label( VERSION );}
  959. }
  960. Fl_Return_Button {} {
  961. label Rock
  962. callback {o->window()->do_callback();}
  963. xywh {400 614 76 30}
  964. }
  965. Fl_Button {} {
  966. label {http://non-daw.tuxfamily.org}
  967. callback {open_url( o->label() );}
  968. xywh {125 614 245 30} color 14 labeltype SHADOW_LABEL labelcolor 6
  969. }
  970. Fl_Box {} {
  971. label {The Non DAW (Digital Audio Workstation)}
  972. xywh {32 221 430 29} labeltype SHADOW_LABEL labelfont 3 labelsize 17
  973. }
  974. }
  975. }
  976. }
  977. Function {open_url( const char *url )} {open return_type void
  978. } {
  979. code {\#if ! ( FL_MAJOR_VERSION >= 1 && FL_MINOR_VERSION >= 1 && FL_PATCH_VERSION >= 8 )
  980. // FIXME: got a better idea?
  981. char cmd[256];
  982. snprintf( cmd, sizeof( cmd ), "x-www-browser '%s' &", url );
  983. system( cmd );
  984. \#else
  985. fl_open_uri( url );
  986. \#endif} {}
  987. }