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.

842 lines
23KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0108
  3. header_name {.H}
  4. code_name {.C}
  5. decl {const float STATUS_UPDATE_FREQ = 0.5f;} {}
  6. decl {\#include "Fl_Menu_Settings.H"} {}
  7. decl {\#include "Timeline.H"} {}
  8. decl {\#include "Engine.H"} {}
  9. decl {\#include "Transport.H"} {}
  10. decl {\#include "Loggable.H"} {}
  11. decl {\#include "Project.H"} {}
  12. decl {\#include "Clock.H"} {public
  13. }
  14. decl {\#include "Track.H" // for capture_format} {}
  15. decl {\#include "Audio_File.H" // for supported formats} {}
  16. decl {\#include "Waveform.H" // for options} {}
  17. decl {\#include "Audio_Region.H" // for options} {}
  18. decl {\#include "Control_Sequence.H" // for options} {}
  19. decl {\#include <FL/fl_ask.H>} {}
  20. decl {\#include <FL/Fl_File_Chooser.H>} {}
  21. decl {\#include <FL/Fl.H>} {}
  22. decl {\#include <Fl/Fl_Shared_Image.H>} {}
  23. decl {extern char project_display_name[256];} {global
  24. }
  25. decl {extern char *user_config_dir;} {global
  26. }
  27. class TLE {open
  28. } {
  29. decl {Fl_Color system_colors[3];} {public
  30. }
  31. decl {static void menubar_cb ( void *v )} {}
  32. decl {void menubar_cb ( void )} {}
  33. Function {menu_picked_value( const Fl_Menu_ *m )} {open return_type {static int}
  34. } {
  35. code {return m->menu()[ m->value() ].flags & FL_MENU_VALUE;} {}
  36. }
  37. Function {save()} {open
  38. } {
  39. code {const char options_filename[] = "options";
  40. // const char state_filename[] = "state";
  41. // save options
  42. char *path;
  43. asprintf( &path, "%s/%s", user_config_dir, options_filename );
  44. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
  45. free( path );
  46. // save unjournaled state
  47. // Loggable::save_unjournaled( state_filename );
  48. if ( Project::open() )
  49. {
  50. // save project local options (Timeline menu)
  51. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), options_filename );
  52. }} {}
  53. }
  54. Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
  55. } {
  56. code {((TLE*)v)->capture_format_cb();} {}
  57. }
  58. Function {capture_format_cb()} {open private return_type void
  59. } {
  60. code {Fl_Menu_ *o = menubar;
  61. Track::capture_format = o->menu()[ o->value() ].label();} {}
  62. }
  63. Function {run()} {open
  64. } {
  65. code {update_menu();
  66. main_window->show();
  67. Fl::lock();
  68. Fl::run();} {selected
  69. }
  70. }
  71. Function {TLE()} {open
  72. } {
  73. code {make_window();
  74. // Fl::visual( RGB8 );
  75. Fl::visible_focus( 0 );
  76. Fl::get_system_colors();
  77. Fl::scheme( "plastic" );
  78. system_colors[ 0 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR );
  79. system_colors[ 1 ] = (Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR );
  80. system_colors[ 2 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR );
  81. Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
  82. fl_message_icon()->box( FL_RSHADOW_BOX );
  83. fl_message_icon()->labelcolor( FL_BLACK );
  84. fl_message_icon()->color( FL_RED );
  85. fl_message_font( FL_HELVETICA, 18 );
  86. std::list <const char *> formats;
  87. Audio_File::all_supported_formats( formats );
  88. for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats.end(); ++f )
  89. {
  90. // capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
  91. //;
  92. char pat[256];
  93. snprintf( pat, sizeof( pat ), "&Timeline/Capture Format/%s", *f );
  94. menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
  95. }
  96. menubar->picked( menubar->find_item( "&Timeline/Capture Format/Wav 24" ) );
  97. char *path;
  98. asprintf( &path, "%s/options", user_config_dir );
  99. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
  100. free( path );} {}
  101. }
  102. Function {make_window()} {open
  103. } {
  104. Fl_Window main_window {
  105. label {Non-DAW - Timeline} open
  106. xywh {236 77 1020 765} type Double resizable xclass {Non-DAW} visible
  107. } {
  108. Fl_Menu_Bar menubar {open
  109. xywh {0 0 1024 25}
  110. } {
  111. Submenu {} {
  112. label {&Project} open
  113. xywh {0 0 74 25}
  114. } {
  115. MenuItem {} {
  116. label {&Info}
  117. xywh {0 0 40 25} deactivate
  118. }
  119. MenuItem {} {
  120. label {&New}
  121. callback {save_timeline_settings();
  122. new_project_chooser();
  123. load_timeline_settings();
  124. update_menu();
  125. main_window->redraw();}
  126. xywh {0 0 40 25}
  127. }
  128. MenuItem {} {
  129. label {&Open}
  130. callback {const char *name = fl_dir_chooser( "Open Project", NULL, NULL );
  131. if ( ! name )
  132. return;
  133. if ( ! Project::validate( name ) )
  134. {
  135. fl_alert( "The path \\"%s\\"\\ndoes not refer to a valid Non-DAW project!", name );
  136. }
  137. else if ( ! Project::open( name ) )
  138. {
  139. fl_alert( "Could not open \\"%s\\" as a Non-DAW project!", name );
  140. // we are in a somewhar ambiguous state now with no project open.
  141. }}
  142. xywh {10 10 40 25}
  143. }
  144. MenuItem {} {
  145. label {&Compact}
  146. 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" );
  147. if ( n != 2 )
  148. return;
  149. Loggable::compact();}
  150. xywh {20 20 40 25}
  151. }
  152. Submenu {} {
  153. label {&Export} open
  154. xywh {0 0 74 25} deactivate
  155. } {
  156. MenuItem {} {
  157. label Project
  158. xywh {0 0 40 25}
  159. }
  160. MenuItem {} {
  161. label Range
  162. xywh {10 10 40 25}
  163. }
  164. }
  165. MenuItem {} {
  166. label {&Quit}
  167. callback {quit()}
  168. xywh {40 40 40 25} shortcut 0x40071
  169. }
  170. }
  171. Submenu {} {
  172. label {&Edit} open
  173. xywh {0 0 74 25}
  174. } {
  175. MenuItem {} {
  176. label Undo
  177. callback {Loggable::undo();}
  178. xywh {0 0 40 25} shortcut 0x4007a divider
  179. }
  180. MenuItem {} {
  181. label {Select None}
  182. callback {timeline->select_none();}
  183. xywh {10 10 40 25} shortcut 0x50061
  184. }
  185. MenuItem {} {
  186. label {Delete Selected}
  187. callback {timeline->delete_selected();}
  188. xywh {20 20 40 25} shortcut 0xffff
  189. }
  190. }
  191. Submenu {} {
  192. label Transport open
  193. xywh {0 0 74 25}
  194. } {
  195. MenuItem {} {
  196. label Start
  197. callback {transport->locate( 0 );}
  198. xywh {0 0 40 25} shortcut 0xff50
  199. }
  200. MenuItem {} {
  201. label End
  202. callback {transport->locate( timeline->length() );}
  203. xywh {10 10 40 25} shortcut 0xff57
  204. }
  205. MenuItem {} {
  206. label {Play/Stop}
  207. callback {transport->toggle();}
  208. xywh {20 20 40 25} shortcut 0x20
  209. }
  210. MenuItem {} {
  211. label Record
  212. callback {transport->toggle_record();}
  213. xywh {40 40 40 25} shortcut 0x10072
  214. }
  215. }
  216. Submenu {} {
  217. label {&View} open
  218. xywh {0 0 74 25}
  219. } {
  220. Submenu {} {
  221. label {&Zoom} open
  222. xywh {0 0 74 25}
  223. } {
  224. MenuItem {} {
  225. label {&In}
  226. callback {timeline->zoom_in();}
  227. xywh {20 20 40 25}
  228. }
  229. MenuItem {} {
  230. label {&Out}
  231. callback {timeline->zoom_out();}
  232. xywh {30 30 40 25}
  233. }
  234. MenuItem {} {
  235. label {&Fit}
  236. callback {timeline->zoom_fit();}
  237. xywh {10 10 40 25} divider
  238. }
  239. MenuItem {} {
  240. label {1 sec.}
  241. callback {timeline->zoom( 1 );}
  242. xywh {10 10 40 25} shortcut 0x31
  243. }
  244. MenuItem {} {
  245. label {1 min.}
  246. callback {timeline->zoom( 60 );}
  247. xywh {20 20 40 25} shortcut 0x32
  248. }
  249. MenuItem {} {
  250. label {1 hour.}
  251. callback {timeline->zoom( 60 * 60 );}
  252. xywh {30 30 40 25} shortcut 0x33
  253. }
  254. }
  255. }
  256. Submenu timeline_menu {
  257. label {&Timeline} open
  258. xywh {0 0 74 25}
  259. } {
  260. MenuItem {} {
  261. label {&Follow Playhead}
  262. callback {Timeline::follow_playhead = menu_picked_value( o );}
  263. xywh {20 20 40 25} type Toggle value 1
  264. }
  265. MenuItem {} {
  266. label {&Center Playhead}
  267. callback {Timeline::center_playhead = menu_picked_value( o );}
  268. xywh {30 30 40 25} type Toggle value 1
  269. }
  270. Submenu {} {
  271. label {&Snap to} open
  272. xywh {0 0 74 25}
  273. } {
  274. MenuItem {} {
  275. label Bars
  276. callback {Timeline::snap_to = Timeline::Bars;}
  277. xywh {0 0 40 25} type Radio value 1
  278. }
  279. MenuItem {} {
  280. label Beats
  281. callback {Timeline::snap_to = Timeline::Beats;}
  282. xywh {10 10 40 25} type Radio
  283. }
  284. MenuItem {} {
  285. label Off
  286. callback {Timeline::snap_to = Timeline::None;}
  287. xywh {20 20 40 25} type Radio
  288. }
  289. }
  290. MenuItem {} {
  291. label {Magnetic snap}
  292. callback {Timeline::snap_magnetic = menu_picked_value( o );}
  293. xywh {10 10 40 25} type Toggle value 1
  294. }
  295. Submenu {} {
  296. label {Capture Format} open
  297. xywh {0 0 74 25}
  298. } {}
  299. }
  300. Submenu {} {
  301. label {&Options} open
  302. xywh {0 0 74 25} divider
  303. } {
  304. Submenu {} {
  305. label {&Display} open
  306. xywh {0 0 74 25}
  307. } {
  308. Submenu {} {
  309. label {&Timeline} open
  310. xywh {0 0 74 25}
  311. } {
  312. MenuItem {} {
  313. label {&Measure lines}
  314. callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
  315. timeline->redraw();}
  316. xywh {0 0 40 25} type Toggle value 1
  317. }
  318. }
  319. Submenu {} {
  320. label {&Waveforms} open
  321. xywh {0 0 74 25}
  322. } {
  323. MenuItem {} {
  324. label Fill
  325. callback {Waveform::fill = menu_picked_value( o );
  326. timeline->redraw();}
  327. xywh {10 10 40 25} type Toggle value 1
  328. }
  329. MenuItem {} {
  330. label Outline
  331. callback {Waveform::outline = menu_picked_value( o );
  332. timeline->redraw();}
  333. xywh {30 30 40 25} type Toggle value 1
  334. }
  335. MenuItem {} {
  336. label {Vary color}
  337. callback {Waveform::vary_color = menu_picked_value( o );
  338. timeline->redraw();}
  339. xywh {20 20 40 25} type Toggle value 1
  340. }
  341. }
  342. Submenu {} {
  343. label {&Audio_Region} open
  344. xywh {0 0 74 25}
  345. } {
  346. MenuItem {} {
  347. label {Filled fades}
  348. xywh {30 30 40 25} type Toggle value 1
  349. }
  350. MenuItem {} {
  351. label {Inherit track color}
  352. callback {Audio_Region::inherit_track_color = menu_picked_value( o );
  353. timeline->redraw();}
  354. xywh {40 40 40 25} type Toggle value 1
  355. }
  356. }
  357. Submenu {} {
  358. label {&Control Sequence} open
  359. xywh {0 0 74 25}
  360. } {
  361. MenuItem {} {
  362. label Polygon
  363. callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
  364. timeline->redraw();}
  365. xywh {20 20 40 25} type Toggle value 1
  366. }
  367. MenuItem {} {
  368. label Graded
  369. callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
  370. timeline->redraw();}
  371. xywh {30 30 40 25} type Toggle value 1
  372. }
  373. MenuItem {} {
  374. label Ruled
  375. callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
  376. timeline->redraw();}
  377. xywh {40 40 40 25} type Toggle value 1
  378. }
  379. }
  380. Submenu {} {
  381. label {&Style} open
  382. xywh {0 0 74 25}
  383. } {
  384. MenuItem {} {
  385. label Default
  386. callback {Fl::scheme( "plastic" );}
  387. xywh {0 0 40 25} type Radio value 1
  388. }
  389. MenuItem {} {
  390. label Flat
  391. callback {Fl::scheme( "gtk+" );}
  392. xywh {10 10 40 25} type Radio
  393. }
  394. }
  395. Submenu {} {
  396. label {C&olors} open
  397. xywh {0 0 74 25}
  398. } {
  399. MenuItem {} {
  400. label System
  401. callback {//Fl::get_system_colors();
  402. unsigned char r, g, b;
  403. Fl::get_color( system_colors[ 0 ], r, g, b );
  404. Fl::background( r, g, b );
  405. Fl::get_color( system_colors[ 1 ], r, g, b );
  406. Fl::foreground( r, g, b );
  407. Fl::get_color( system_colors[ 2 ], r, g, b );
  408. Fl::background2( r, g, b );
  409. Fl::scheme( Fl::scheme() );}
  410. xywh {0 0 40 25} type Radio
  411. }
  412. MenuItem {} {
  413. label Dark
  414. callback {Fl::background2( 100, 100, 100 );
  415. Fl::background( 50, 50, 50 );
  416. Fl::foreground( 255, 255, 255 );
  417. Fl::scheme( Fl::scheme() );}
  418. xywh {10 10 40 25} type Radio value 1
  419. }
  420. MenuItem {} {
  421. label Light
  422. callback {Fl::background2( 192, 192, 192 );
  423. Fl::background( 220, 220, 220 );
  424. Fl::foreground( 0, 0, 0 );
  425. Fl::scheme( Fl::scheme() );}
  426. xywh {20 20 40 25} type Radio
  427. }
  428. }
  429. }
  430. }
  431. Submenu {} {
  432. label {&Help} open
  433. xywh {0 0 74 25}
  434. } {
  435. MenuItem {} {
  436. label {&About}
  437. callback {Fl_Window *win = make_about_dialog();
  438. win->show();
  439. while ( win->shown() )
  440. Fl::wait();
  441. delete win;}
  442. xywh {0 0 40 25}
  443. }
  444. }
  445. }
  446. Fl_Group {} {open
  447. xywh {0 23 1024 48}
  448. } {
  449. Fl_Pack {} {open
  450. xywh {0 23 473 46} type HORIZONTAL
  451. code0 {o->spacing( 10 );}
  452. } {
  453. Fl_Box {} {
  454. label {<Transport>}
  455. xywh {0 23 184 46} color 30
  456. code0 {transport = o;}
  457. code1 {o->labeltype( FL_NO_LABEL );}
  458. class Transport
  459. }
  460. Fl_Pack clocks_pack {open
  461. xywh {185 23 288 46} type HORIZONTAL
  462. code0 {o->spacing( 2 );}
  463. } {
  464. Fl_Box playhead_clock {
  465. label PLAYHEAD
  466. xywh {185 29 137 40} box BORDER_BOX color 40
  467. code0 {o->type( Clock::HMS );}
  468. code1 {o->run( &transport->frame );}
  469. class Clock
  470. }
  471. Fl_Box {} {
  472. label PLAYHEAD
  473. xywh {325 29 142 40} box BORDER_BOX color 40
  474. code0 {o->type( Clock::BBT );}
  475. code1 {o->run( &transport->frame );}
  476. class Clock
  477. }
  478. }
  479. }
  480. Fl_Box {} {
  481. label {<empty>}
  482. xywh {477 27 387 42} resizable
  483. code0 {o->labeltype( FL_NO_LABEL );}
  484. }
  485. Fl_Group {} {
  486. xywh {869 25 155 44}
  487. } {
  488. Fl_Box {} {
  489. label {capture:}
  490. xywh {869 25 56 14} labelsize 10 align 24
  491. }
  492. Fl_Box {} {
  493. label {playback:}
  494. xywh {869 41 56 14} labelsize 10 align 24
  495. }
  496. Fl_Box {} {
  497. label {DSP:}
  498. xywh {869 55 56 14} labelsize 10 align 24
  499. }
  500. Fl_Progress capture_buffer_progress {
  501. label {50%}
  502. xywh {925 25 99 14} labelsize 10
  503. }
  504. Fl_Progress cpu_load_progress {
  505. label {50%}
  506. xywh {925 55 99 14} labelsize 9
  507. }
  508. Fl_Progress playback_buffer_progress {
  509. label {50%}
  510. xywh {925 40 99 14} labelsize 10
  511. }
  512. }
  513. }
  514. Fl_Box {} {
  515. label {<Timeline>}
  516. xywh {0 72 1024 695} box FLAT_BOX color 47 labelsize 100 resizable
  517. code0 {timeline = o;}
  518. class Timeline
  519. }
  520. Fl_Box project_name {
  521. label {<project name>}
  522. xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2
  523. code0 {o->label( Project::name() );}
  524. }
  525. Fl_Value_Output xruns_output {
  526. label {xruns:}
  527. xywh {980 2 44 20} maximum 40000 step 1
  528. }
  529. }
  530. }
  531. Function {find_item( Fl_Menu_ *menu, const char *path )} {open return_type {static Fl_Menu_Item *}
  532. } {
  533. code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
  534. }
  535. Function {update_menu()} {open
  536. } {
  537. code {Fl_Menu_Bar *m = menubar;
  538. if ( ! Project::open() )
  539. {
  540. find_item( m, "&Project/&Export" )->deactivate();
  541. find_item( m, "&Project/&Compact" )->deactivate();
  542. find_item( m, "&Project/&Info" )->deactivate();
  543. find_item( m, "&Timeline" )->deactivate();
  544. timeline->deactivate();
  545. transport->deactivate();
  546. }
  547. else
  548. {
  549. find_item( m, "&Project/&Export" )->activate();
  550. find_item( m, "&Project/&Compact" )->activate();
  551. find_item( m, "&Project/&Info" )->activate();
  552. find_item( m, "&Timeline" )->activate();
  553. timeline->activate();
  554. transport->activate();
  555. }
  556. m->redraw();
  557. project_name->redraw();} {}
  558. }
  559. Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
  560. } {
  561. code {p->value( v );
  562. snprintf( s, 5, "%d%%", (int)v );
  563. p->label( s );} {}
  564. }
  565. Function {update_status()} {open
  566. } {
  567. code {static char cbp[5], pbp[5], clp[5];
  568. update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_percent() );
  569. update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() );
  570. update_progress( cpu_load_progress, clp, engine->cpu_load() );
  571. if ( timeline->total_capture_xruns() )
  572. capture_buffer_progress->selection_color( FL_RED );
  573. if ( timeline->total_playback_xruns() )
  574. playback_buffer_progress->selection_color( FL_RED );
  575. xruns_output->value( engine->xruns() );} {}
  576. }
  577. Function {update_cb( void *v )} {return_type {static void}
  578. } {
  579. code {Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v );
  580. ((TLE*)v)->update_status();} {}
  581. }
  582. Function {make_about_dialog()} {open
  583. } {
  584. Fl_Window about_dialog_window {
  585. label About open
  586. private xywh {625 208 495 525} type Double visible
  587. } {
  588. Fl_Tabs {} {open
  589. xywh {-4 122 513 427}
  590. } {
  591. Fl_Group {} {
  592. label Credits open
  593. xywh {-4 147 507 394}
  594. } {
  595. Fl_Box {} {
  596. label {Non-DAW was written from scratch by
  597. Jonathan Moore Liles for his own use
  598. (see the manual).
  599. Nobody planned. Nobody helped.
  600. You can help now by donating time, money,
  601. and/or replacing the rest of Linux Audio
  602. with fast, light, reliable alternatives.}
  603. xywh {42 203 418 262} box ROUNDED_BOX color 46 labelsize 18
  604. }
  605. }
  606. Fl_Group {} {
  607. label License open
  608. xywh {-1 157 510 392} hide
  609. } {
  610. Fl_Box {} {
  611. label {Copyright (C) 2008 Jonathan Moore Liles}
  612. xywh {50 168 410 37} labeltype SHADOW_LABEL labelfont 1 labelsize 18
  613. }
  614. Fl_Box {} {
  615. 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.
  616. 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.
  617. 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.}
  618. xywh {10 217 475 233} box ROUNDED_BOX color 46 labelfont 1 labelsize 12 labelcolor 53 align 144
  619. }
  620. }
  621. }
  622. Fl_Box {} {
  623. label {the Non-DAW (Digital Audio Workstation)}
  624. xywh {-1 1 499 115} align 16
  625. code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo.png" ) );}
  626. }
  627. Fl_Return_Button {} {
  628. label Rock
  629. callback {about_dialog_window->hide();}
  630. xywh {400 480 76 30}
  631. }
  632. Fl_Button {} {
  633. label {http://non-daw.tuxfamily.org}
  634. callback {\#if ! ( FL_MAJOR_VERSION >= 1 && FL_MINOR_VERSION >= 1 && FL_PATCH_VERSION >= 8 )
  635. // FIXME: got a better idea?
  636. system( "x-www-browser http://non-daw.tuxfamily.org &" );
  637. \#else
  638. fl_open_uri( "http://non-daw.tuxfamily.org" );
  639. \#endif}
  640. xywh {125 480 245 30} color 14 labeltype SHADOW_LABEL labelcolor 6
  641. }
  642. }
  643. }
  644. Function {save_timeline_settings()} {open
  645. } {
  646. code {if ( Project::open() )
  647. {
  648. // save project local options (Timeline menu)
  649. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), "options" );
  650. }} {}
  651. }
  652. Function {load_timeline_settings()} {open
  653. } {
  654. code {if ( Project::open() )
  655. {
  656. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Timeline" ), "options" );
  657. }
  658. update_menu();
  659. project_name->redraw();} {}
  660. }
  661. Function {quit()} {open
  662. } {
  663. code {Project::close();
  664. save();
  665. exit( 0 );} {}
  666. }
  667. }
  668. class New_Project_Dialog {open
  669. } {
  670. Function {New_Project_Dialog()} {open
  671. } {
  672. code {make_window();} {}
  673. }
  674. Function {run()} {open return_type void
  675. } {
  676. code {_window->show();
  677. while ( _window->shown() )
  678. Fl::wait();} {}
  679. }
  680. Function {make_window()} {open
  681. } {
  682. Fl_Window _window {
  683. label {New Project} open
  684. xywh {23 779 550 195} type Double modal visible
  685. } {
  686. Fl_File_Input _name {
  687. label {Named:}
  688. xywh {75 140 375 35}
  689. }
  690. Fl_Button {} {
  691. label Browse
  692. callback {_directory->value( fl_dir_chooser( "Directory for new project", NULL, 0 ) );}
  693. xywh {455 100 80 35}
  694. }
  695. Fl_Return_Button {} {
  696. label Create
  697. callback {if ( strlen( _directory->value() ) && strlen( _name->value() ) )
  698. {
  699. char pat[512];
  700. snprintf( pat, sizeof( pat ), "%s/%s", _directory->value(), _name->value() );
  701. if ( ! Project::create( pat, _template->text( _template->value() ) ) )
  702. fl_alert( "Error creating project!" );
  703. _window->hide();
  704. }}
  705. xywh {455 140 80 35}
  706. }
  707. Fl_File_Input _directory {
  708. label {Where:}
  709. callback {if ( ! fl_filename_isdir( o->value() ) )
  710. {
  711. fl_alert( "Must be a directory" );
  712. o->value( "" );
  713. }}
  714. xywh {75 100 375 35}
  715. code0 {\#include <FL/filename.H>}
  716. }
  717. Fl_Box {} {
  718. label {New Project}
  719. xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
  720. }
  721. Fl_Choice _template {
  722. label {Template:}
  723. private xywh {310 60 225 25} down_box BORDER_BOX
  724. } {
  725. MenuItem {} {
  726. label Default
  727. xywh {0 0 40 25}
  728. }
  729. }
  730. }
  731. }
  732. }
  733. Function {new_project_chooser()} {open C return_type void
  734. } {
  735. code {New_Project_Dialog nsd;
  736. nsd.run();} {}
  737. }