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.

1005 lines
28KB

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