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.

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