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.

1095 lines
31KB

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