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.

1074 lines
29KB

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