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.

1006 lines
29KB

  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 "color_scheme.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 "New_Project_Dialog.H"} {}
  34. decl {\#include "Track.H" // for capture_format} {}
  35. decl {\#include "Waveform.H" // for options} {}
  36. decl {\#include "Audio_Region.H" // for options} {}
  37. decl {\#include "Control_Sequence.H" // for options} {}
  38. decl {\#include <FL/Fl_File_Chooser.H>} {}
  39. decl {\#include <Fl/Fl_Shared_Image.H>} {}
  40. decl {\#include <FL/Fl.H>} {selected
  41. }
  42. decl {\#include <FL/fl_ask.H>} {}
  43. decl {\#include "Engine/Engine.H"} {}
  44. decl {\#include "Engine/Audio_File.H" // for supported formats} {}
  45. decl {\#include "FL/About_Dialog.H"} {}
  46. decl {extern char project_display_name[256];} {global
  47. }
  48. decl {extern char *user_config_dir;} {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();} {}
  98. }
  99. Function {run()} {} {
  100. code {update_menu();
  101. main_window->show();
  102. Fl::lock();
  103. // Fl::run();} {}
  104. }
  105. Function {TLE()} {open
  106. } {
  107. code {Fl::visual( FL_DOUBLE | FL_RGB8 );
  108. make_window();
  109. Fl::visible_focus( 0 );
  110. get_system_colors();
  111. Fl::scheme( "plastic" );
  112. color_scheme( "dark" );
  113. // constrain window to size of screen.
  114. {
  115. int sx, sy, sw, sh;
  116. Fl::screen_xywh( sx, sy, sw, sh );
  117. main_window->size( 947, 600 );
  118. main_window->size_range( 947, 600 );
  119. if ( main_window->w() > sw ||
  120. main_window->h() > 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 {Non DAW : Timeline}
  156. callback {if ( Fl::event_key() != FL_Escape )
  157. o->hide();} open
  158. private xywh {705 125 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. const char *templates[] = { "Default", NULL };
  221. char *default_path;
  222. char *selected_template;
  223. read_line( user_config_dir, "default_path", &default_path );
  224. char *path = new_project_chooser( templates, &default_path, &selected_template );
  225. if ( path )
  226. {
  227. if ( ! Project::create( path, selected_template ) )
  228. fl_alert( "Error creating project!" );
  229. free( path );
  230. free( selected_template );
  231. }
  232. if ( default_path )
  233. {
  234. write_line( user_config_dir, "default_path", default_path );
  235. free( default_path );
  236. }
  237. load_timeline_settings();
  238. update_menu();
  239. main_window->redraw();}
  240. xywh {0 0 40 25}
  241. }
  242. MenuItem {} {
  243. label {&Open}
  244. callback {char *path;
  245. read_line( user_config_dir, "default_path", &path );
  246. const char *name = fl_dir_chooser( "Open Project", path, NULL );
  247. free( path );
  248. open( name );}
  249. xywh {10 10 40 25}
  250. }
  251. MenuItem {} {
  252. label {&Compact}
  253. 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" );
  254. if ( n != 2 )
  255. return;
  256. Project::compact();}
  257. xywh {20 20 40 25}
  258. }
  259. Submenu {} {
  260. label {&Export} open
  261. xywh {0 0 74 25} deactivate
  262. } {
  263. MenuItem {} {
  264. label Project
  265. xywh {0 0 40 25}
  266. }
  267. MenuItem {} {
  268. label Range
  269. xywh {10 10 40 25}
  270. }
  271. }
  272. MenuItem {} {
  273. label {&Quit}
  274. callback {quit()}
  275. xywh {40 40 40 25} shortcut 0x40071
  276. }
  277. }
  278. Submenu {} {
  279. label {&Edit} open
  280. xywh {0 0 74 25}
  281. } {
  282. MenuItem {} {
  283. label Undo
  284. callback {Loggable::undo();}
  285. xywh {0 0 40 25} shortcut 0x4007a divider
  286. }
  287. MenuItem {} {
  288. label {Select None}
  289. callback {timeline->select_none();}
  290. xywh {10 10 40 25} shortcut 0x50061
  291. }
  292. MenuItem {} {
  293. label {Delete Selected}
  294. callback {timeline->delete_selected();}
  295. xywh {20 20 40 25} shortcut 0xffff
  296. }
  297. }
  298. Submenu {} {
  299. label T&ransport open
  300. xywh {0 0 74 25}
  301. } {
  302. MenuItem {} {
  303. label Start
  304. callback {transport->locate( 0 );}
  305. xywh {0 0 40 25} shortcut 0xff50
  306. }
  307. MenuItem {} {
  308. label End
  309. callback {transport->locate( timeline->length() );}
  310. xywh {10 10 40 25} shortcut 0xff57
  311. }
  312. MenuItem {} {
  313. label {Play/Stop}
  314. callback {transport->toggle();}
  315. xywh {20 20 40 25} shortcut 0x20
  316. }
  317. MenuItem {} {
  318. label Record
  319. callback {transport->toggle_record();}
  320. xywh {40 40 40 25} shortcut 0x10072
  321. }
  322. }
  323. MenuItem {} {
  324. label {&Timeline}
  325. xywh {0 0 40 25}
  326. }
  327. Submenu {} {
  328. label {&View} open
  329. xywh {0 0 74 25}
  330. } {
  331. Submenu {} {
  332. label {&Zoom} open
  333. xywh {0 0 74 25}
  334. } {
  335. MenuItem {} {
  336. label {&In}
  337. callback {timeline->zoom_in();}
  338. xywh {20 20 40 25} shortcut 0x2b
  339. }
  340. MenuItem {} {
  341. label {&Out}
  342. callback {timeline->zoom_out();}
  343. xywh {30 30 40 25} shortcut 0x5f
  344. }
  345. MenuItem {} {
  346. label {&Fit}
  347. callback {timeline->zoom_fit();}
  348. xywh {10 10 40 25} shortcut 0x3d divider
  349. }
  350. MenuItem {} {
  351. label {1 sec.}
  352. callback {timeline->zoom( 1 );}
  353. xywh {10 10 40 25} shortcut 0x31
  354. }
  355. MenuItem {} {
  356. label {1 min.}
  357. callback {timeline->zoom( 60 );}
  358. xywh {20 20 40 25} shortcut 0x32
  359. }
  360. MenuItem {} {
  361. label {1 hour.}
  362. callback {timeline->zoom( 60 * 60 );}
  363. xywh {30 30 40 25} shortcut 0x33
  364. }
  365. }
  366. }
  367. Submenu {} {
  368. label {&Options} open
  369. xywh {0 0 74 25} divider
  370. } {
  371. Submenu {} {
  372. label {&Display} open
  373. xywh {10 10 74 25}
  374. } {
  375. Submenu {} {
  376. label {&Timeline} open
  377. xywh {10 10 74 25}
  378. } {
  379. MenuItem {} {
  380. label {&Measure lines}
  381. callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
  382. timeline->redraw();}
  383. xywh {10 10 40 25} type Toggle value 1
  384. }
  385. }
  386. Submenu {} {
  387. label {&Waveform} open
  388. xywh {10 10 74 25}
  389. } {
  390. MenuItem {} {
  391. label Fill
  392. callback {Waveform::fill = menu_picked_value( o );
  393. timeline->redraw();}
  394. xywh {20 20 40 25} type Toggle value 1
  395. }
  396. MenuItem {} {
  397. label Outline
  398. callback {Waveform::outline = menu_picked_value( o );
  399. timeline->redraw();}
  400. xywh {40 40 40 25} type Toggle value 1
  401. }
  402. MenuItem {} {
  403. label {Vary color}
  404. callback {Waveform::vary_color = menu_picked_value( o );
  405. timeline->redraw();}
  406. xywh {30 30 40 25} type Toggle value 1
  407. }
  408. }
  409. Submenu {} {
  410. label {&Region} open
  411. xywh {10 10 74 25}
  412. } {
  413. MenuItem {} {
  414. label {Filled fades}
  415. xywh {40 40 40 25} type Toggle value 1
  416. }
  417. MenuItem {} {
  418. label {Inherit track color}
  419. callback {Audio_Region::inherit_track_color = menu_picked_value( o );
  420. timeline->redraw();}
  421. xywh {50 50 40 25} type Toggle value 1
  422. }
  423. }
  424. Submenu {} {
  425. label {&Control Sequence} open
  426. xywh {10 10 74 25}
  427. } {
  428. MenuItem {} {
  429. label Polygon
  430. callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
  431. timeline->redraw();}
  432. xywh {30 30 40 25} type Toggle value 1
  433. }
  434. MenuItem {} {
  435. label Graded
  436. callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
  437. timeline->redraw();}
  438. xywh {40 40 40 25} type Toggle value 1
  439. }
  440. MenuItem {} {
  441. label Ruled
  442. callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
  443. timeline->redraw();}
  444. xywh {50 50 40 25} type Toggle value 1
  445. }
  446. }
  447. Submenu {} {
  448. label {&Style} open
  449. xywh {10 10 74 25}
  450. } {
  451. MenuItem {} {
  452. label Default
  453. callback {Fl::scheme( "plastic" );}
  454. xywh {10 10 40 25} type Radio value 1
  455. }
  456. MenuItem {} {
  457. label Flat
  458. callback {Fl::scheme( "gtk+" );}
  459. xywh {20 20 40 25} type Radio
  460. }
  461. }
  462. Submenu {} {
  463. label {C&olors} open
  464. xywh {10 10 74 25}
  465. } {
  466. MenuItem {} {
  467. label Dark
  468. callback {
  469. color_scheme( "dark" ); }
  470. xywh {20 20 40 25} type Radio value 1
  471. }
  472. MenuItem {} {
  473. label {Very Dark}
  474. callback {
  475. color_scheme( "very dark" ); }
  476. xywh {20 20 40 25} type Radio
  477. }
  478. MenuItem {} {
  479. label Light
  480. callback {
  481. color_scheme( "light" ); }
  482. xywh {30 30 40 25} type Radio
  483. }
  484. MenuItem {} {
  485. label System
  486. callback {
  487. color_scheme( "system" ); }
  488. xywh {10 10 40 25} type Radio
  489. }
  490. }
  491. }
  492. Submenu {} {
  493. label {&Behavior} open
  494. xywh {0 0 74 25}
  495. } {
  496. Submenu {} {
  497. label {&Transport} open
  498. xywh {0 0 74 25}
  499. } {
  500. MenuItem {} {
  501. label {Stop Disables Record}
  502. callback {transport->stop_disables_record( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );} selected
  503. xywh {5 5 40 25} type Toggle value 1
  504. }
  505. }
  506. }
  507. }
  508. Submenu {} {
  509. label {&Help} open
  510. xywh {0 0 74 25}
  511. } {
  512. MenuItem {} {
  513. label {&Manual}
  514. callback {show_help_dialog( "MANUAL" );}
  515. xywh {10 10 40 25} divider
  516. }
  517. MenuItem {} {
  518. label {&About}
  519. callback {About_Dialog ab( PIXMAP_PATH "/non-daw/logo.png" );
  520. ab.logo_box->label( VERSION );
  521. ab.title->label( "The Non DAW (Digital Audio Workstation)" );
  522. ab.copyright->label( "Copyright (C) 2008-2010 Jonathan Moore Liles" );
  523. ab.credits->label( "Non-DAW was written from scratch by\\nJonathan Moore Liles for his own use\\n(see the manual).\\n\\nNobody planned. Nobody helped.\\nYou can help now by donating time, money,\\nand/or replacing the rest of Linux Audio\\nwith fast, light, reliable alternatives.\\n" );
  524. ab.website_url->label( "http://non-daw.tuxfamily.org" );
  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 hide
  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() );
  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/non-daw/%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 "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( PIXMAP_PATH "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. }