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.

565 lines
12KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0107
  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 {\#include "../grid.H"} {}
  25. decl {\#include "../scale.H"} {}
  26. decl {extern Fl_Color velocity_colors[];} {}
  27. decl {class Event_Widget;} {public
  28. }
  29. class Event_Editor {open
  30. } {
  31. decl {int _h;} {}
  32. decl {Grid *_grid;} {}
  33. decl {event_list *_old;} {}
  34. decl {event_list *_el;} {}
  35. decl {int _y;} {}
  36. Function {make_window( Grid *g )} {open
  37. } {
  38. Fl_Window window {
  39. label {Event Editor}
  40. callback {delete _el;
  41. _grid->events( _old );
  42. delete _old;
  43. delete window;} open
  44. xywh {704 82 659 803} type Double box DOWN_BOX resizable
  45. code0 {\#include "event_edit.H"}
  46. code1 {\#include "../grid.H"}
  47. code2 {\#include "../event_list.H"} modal size_range {0 0 659 803} visible
  48. } {
  49. Fl_Pack {} {
  50. label {Event List} open
  51. xywh {10 23 640 738} type HORIZONTAL
  52. } {
  53. Fl_Scroll scroll_w {open
  54. xywh {10 24 620 737} type HORIZONTAL box DOWN_BOX labeltype NO_LABEL resizable
  55. } {
  56. Fl_Pack pack {open
  57. xywh {10 24 620 737} when 6 resizable
  58. } {}
  59. }
  60. Fl_Scrollbar scroll_bar {
  61. user_data this user_data_type {Event_Editor*}
  62. callback {v->scroll( o->value() );
  63. v->update_widgets();}
  64. xywh {629 23 20 738} when 3
  65. }
  66. }
  67. Fl_Return_Button {} {
  68. label {&Save}
  69. callback {delete window;
  70. delete _el;
  71. delete _old;}
  72. xywh {489 771 76 25}
  73. }
  74. Fl_Button {} {
  75. label {&Discard}
  76. callback {window->do_callback();}
  77. xywh {575 771 74 25}
  78. }
  79. Fl_Button {} {
  80. label Del
  81. user_data this user_data_type {Event_Editor *}
  82. callback {_el->remove_selected();
  83. sync();}
  84. xywh {10 771 74 25} shortcut 0xffff color 88
  85. }
  86. Fl_Menu_Button {} {
  87. label {&Insert}
  88. user_data this user_data_type {Event_Editor *}
  89. callback {if ( o->value() == 0 )
  90. {
  91. // note;
  92. event *on = new event;
  93. event *off = new event;
  94. on->status( event::NOTE_ON );
  95. on->note( 64 );
  96. on->note_velocity( 64 );
  97. off->status( event::NOTE_OFF );
  98. off->note( 64 );
  99. off->timestamp( 1 );
  100. off->note_velocity( 64 );
  101. on->link( off );
  102. _el->insert( on );
  103. _el->insert( off );
  104. }
  105. else
  106. {
  107. event *e = new event;
  108. int opcode = e->name( o->menu()[ o->value() ].text );
  109. if ( opcode < 0 )
  110. return;
  111. e->status( opcode );
  112. Event_Widget *ew = v->value();
  113. if ( ew && ew->ev() )
  114. e->timestamp( ew->ev()->timestamp() );
  115. _el->insert( e );
  116. }
  117. sync();} open
  118. xywh {94 771 121 25} color 63
  119. } {
  120. MenuItem {} {
  121. label Note
  122. xywh {10 10 40 25}
  123. }
  124. MenuItem {} {
  125. label Aftertouch
  126. xywh {50 50 40 25}
  127. }
  128. MenuItem {} {
  129. label {Control Change}
  130. xywh {20 20 40 25}
  131. }
  132. MenuItem {} {
  133. label {Program Change}
  134. xywh {30 30 40 25}
  135. }
  136. MenuItem {} {
  137. label {Channel Pressure}
  138. xywh {60 60 40 25}
  139. }
  140. MenuItem {} {
  141. label {Pitch Wheel}
  142. xywh {40 40 40 25}
  143. }
  144. }
  145. }
  146. code {// keep a copy
  147. _old = g->events();
  148. _el = g->events();
  149. _grid = g;
  150. _y = 0;
  151. _h = scroll_w->h() / 24;
  152. // create widgets.
  153. for ( int n = _h; n--; )
  154. {
  155. Event_Widget *ew = new Event_Widget( 0, 0, pack->w(), 24, 0 );
  156. ew->callback( cb_changed, (void*)this );
  157. ew->when( FL_WHEN_CHANGED );
  158. pack->add( ew );
  159. }
  160. pack->end();
  161. // Fl_Pack has a bug--it doesn't resize children until we resize it.
  162. pack->resize( scroll_w->x(), scroll_w->y(), scroll_w->w(), scroll_w->h() );
  163. scroll_bar->minimum( 0 );
  164. scroll_bar->maximum( _el->size() - _h );
  165. update_widgets();} {}
  166. }
  167. Function {sync( void )} {open return_type void
  168. } {
  169. code {MESSAGE( "syncing events to grid" );
  170. _grid->events( _el );
  171. update_widgets();} {}
  172. }
  173. Function {update_widgets( void )} {open return_type void
  174. } {
  175. code {// draw em
  176. int i = 0;
  177. if ( ! _el->empty() )
  178. for ( event* e = (*_el)[_y]; e && i < _h; (e = e->next()), i++ )
  179. {
  180. Event_Widget *ew = (Event_Widget *)(pack->child( i ));
  181. ew->ev( e );
  182. ew->show();
  183. }
  184. // hide unused widgets.
  185. for ( int j = i; j < _h; j++ )
  186. {
  187. Event_Widget *ew = (Event_Widget *)(pack->child( j ));
  188. ew->ev( NULL );
  189. ew->hide();
  190. }
  191. // ajdust scrollbar
  192. int sbmax = _el->size() - _h;
  193. if ( sbmax > 0 )
  194. {
  195. scroll_bar->maximum( sbmax );
  196. scroll_bar->show();
  197. scroll_w->size( scroll_w->parent()->w() - scroll_bar->w(), scroll_w->parent()->h() );
  198. }
  199. else
  200. {
  201. scroll_bar->hide();
  202. scroll_w->size( scroll_w->parent()->w(), scroll_w->parent()->h() );
  203. }} {selected
  204. }
  205. }
  206. Function {scroll( int y )} {open return_type void
  207. } {
  208. code {_y = y;} {}
  209. }
  210. Function {value( void )} {return_type {Event_Widget *}
  211. } {
  212. code {for ( int i = _h; i--; )
  213. {
  214. Event_Widget *w = (Event_Widget*)pack->child( i );
  215. if ( w->selected() )
  216. return w;
  217. }
  218. return NULL;} {}
  219. }
  220. Function {cb_changed( Fl_Widget *w, void *ee )} {open return_type {static void}
  221. } {
  222. code {Event_Widget *ew = (Event_Widget*)w;
  223. if ( ew->changed() )
  224. // sorting order changed.
  225. ((Event_Editor*)ee)->_el->sort( ew->ev() );
  226. ((Event_Editor*)ee)->sync();} {}
  227. }
  228. }
  229. Function {event_editor( Grid *g )} {open C return_type void
  230. } {
  231. code {Event_Editor ee;
  232. Fl_Window *w = ee.make_window( g );
  233. w->modal();
  234. w->show();
  235. while( w->shown() )
  236. Fl::wait();} {}
  237. }
  238. widget_class Event_Widget {user_data_type {void *} open
  239. xywh {969 357 594 31} type Single
  240. code0 {\#include "../event.H"}
  241. class Fl_Group size_range {400 24 0 24} visible
  242. } {
  243. decl {static const Fl_Color note_color = FL_BLACK;} {}
  244. decl {static const Fl_Color control_color = FL_BLUE;} {}
  245. decl {static const Fl_Color prog_color = FL_RED;} {}
  246. decl {static const Fl_Color pressure_color = FL_YELLOW;} {}
  247. decl {static const Fl_Color after_color = FL_CYAN;} {}
  248. decl {static const Fl_Color pitch_color = FL_GREEN} {}
  249. decl {event *_event;} {}
  250. decl {Fl_Group *tab;} {}
  251. Function {ev( event * e )} {open return_type void
  252. } {
  253. code {if ( e && ( _event == NULL ) )
  254. activate();
  255. else
  256. if ( ! e )
  257. {
  258. _event = NULL;
  259. deactivate();
  260. return;
  261. }
  262. activate();
  263. _event = e;
  264. name->label( e->name() );
  265. time->value( e->timestamp() );
  266. // hide all tabs
  267. for ( int i = 2; i < children(); i++ )
  268. child( i )->hide();
  269. Fl_Valuator *d1, *d2;
  270. name->color( FL_BLACK );
  271. name->value( e->selected() );
  272. // display the proper subtype
  273. switch ( e->opcode() )
  274. {
  275. \#define TWO d1 = (Fl_Valuator*)tab->child( 0 ); d2 = (Fl_Valuator*)tab->child( 1 )
  276. \#define ONE d1 = (Fl_Valuator*)tab->child( 0 ); d2 = NULL
  277. case midievent::NOTE_ON:
  278. case midievent::NOTE_OFF:
  279. tab = note_tab;
  280. name->color( note_color );
  281. note_name->label( Scale::chromatic_name( e->note() ) );
  282. note_name->labelcolor( velocity_colors[ e->note_velocity() ] );
  283. TWO;
  284. break;
  285. case midievent::CONTROL_CHANGE:
  286. tab = control_tab;
  287. name->color( control_color );
  288. TWO;
  289. break;
  290. case midievent::AFTERTOUCH:
  291. tab = after_tab;
  292. name->color( after_color );
  293. TWO;
  294. break;
  295. case midievent::CHANNEL_PRESSURE:
  296. tab = pressure_tab;
  297. name->color( pressure_color );
  298. ONE;
  299. break;
  300. case midievent::PROGRAM_CHANGE:
  301. tab = prog_tab;
  302. name->color( prog_color );
  303. ONE;
  304. break;
  305. case midievent::PITCH_WHEEL:
  306. tab = pitch_tab;
  307. name->color( pitch_color );
  308. ONE;
  309. d1->value( e->pitch() );
  310. goto pitch;
  311. break;
  312. }
  313. byte_t D1, D2;
  314. e->data( &D1, &D2 );
  315. d1->value( D1 );
  316. if ( d2 )
  317. d2->value( D2 );
  318. pitch:
  319. // show the current tab
  320. tab->show();
  321. time->redraw();
  322. name->redraw();
  323. // redraw();} {}
  324. }
  325. Function {ev( void )} {open return_type {event *}
  326. } {
  327. code {return _event;} {}
  328. }
  329. Fl_Value_Input time {
  330. callback {if ( _event->is_note_off() )
  331. {
  332. if ( o->value() < _event->link()->timestamp() )
  333. {
  334. o->value( _event->timestamp() );
  335. return;
  336. }
  337. }
  338. else
  339. if ( _event->is_note_on() )
  340. if ( o->value() > _event->link()->timestamp() )
  341. {
  342. o->value( _event->timestamp() );
  343. return;
  344. }
  345. _event->timestamp( o->value() );
  346. set_changed();
  347. do_callback();}
  348. xywh {3 0 125 24} labeltype NO_LABEL align 0 when 8 maximum 0
  349. code1 {o->maximum( (unsigned long)-1 );}
  350. }
  351. Fl_Button name {
  352. label {<Event Name>} user_data_type {void*}
  353. callback {if ( o->value() )
  354. _event->select();
  355. else
  356. _event->deselect();
  357. do_callback();}
  358. xywh {132 -1 149 25} type Toggle when 1
  359. }
  360. Fl_Group note_tab {open
  361. xywh {282 0 309 24} align 16
  362. } {
  363. Fl_Counter {} {
  364. label {Note:}
  365. user_data this
  366. callback cb_note
  367. xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  368. }
  369. Fl_Counter {} {
  370. label {Velocity:}
  371. user_data this
  372. callback cb_msb
  373. xywh {518 0 73 24} type Simple align 4 minimum 0 maximum 127 step 1
  374. }
  375. Fl_Box note_name {
  376. label {A\#}
  377. private xywh {284 1 31 24} labeltype SHADOW_LABEL labelfont 14 labelcolor 135
  378. }
  379. }
  380. Fl_Group after_tab {open
  381. xywh {317 0 277 24} align 16 hide
  382. } {
  383. Fl_Counter {} {
  384. label {Note:}
  385. user_data this
  386. callback cb_note
  387. xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  388. }
  389. Fl_Counter {} {
  390. label {Pressure:}
  391. user_data this
  392. callback cb_msb
  393. xywh {518 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  394. }
  395. }
  396. Fl_Group control_tab {open
  397. xywh {358 0 238 24} align 16 hide
  398. } {
  399. Fl_Counter {} {
  400. label {Control:}
  401. user_data this
  402. callback cb_lsb
  403. xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  404. }
  405. Fl_Counter {} {
  406. label {Value:}
  407. user_data this
  408. callback cb_msb
  409. xywh {517 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  410. }
  411. }
  412. Fl_Group prog_tab {open
  413. xywh {287 0 238 24} align 16 hide
  414. } {
  415. Fl_Counter {} {
  416. label {Program:}
  417. user_data this
  418. callback cb_lsb
  419. xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1
  420. }
  421. }
  422. Fl_Group pitch_tab {open
  423. xywh {306 0 290 24} align 16 hide
  424. } {
  425. Fl_Slider {} {
  426. label {Pitch:} user_data_type {void *}
  427. callback {_event->pitch( o->value() );
  428. do_callback();}
  429. xywh {358 0 238 24} type Horizontal align 4 when 4 minimum -8192 maximum 8191 step 1
  430. }
  431. }
  432. Fl_Group pressure_tab {open
  433. xywh {307 0 290 24} align 16 hide
  434. } {
  435. Fl_Slider {} {
  436. label {Pressure:}
  437. user_data this
  438. callback cb_lsb
  439. xywh {358 0 239 24} type Horizontal align 4 when 4 maximum 127 step 1
  440. }
  441. }
  442. Function {select( bool b )} {open return_type void
  443. } {
  444. code {/*
  445. _selected = b;
  446. if ( b )
  447. name->color( FL_WHITE );
  448. redraw();
  449. */} {}
  450. }
  451. Function {button()} {open return_type {Fl_Button *}
  452. } {
  453. code {return name;} {}
  454. }
  455. Function {selected( void )} {open return_type bool
  456. } {
  457. code {/*
  458. int n = name->value();
  459. name->value( 0 );
  460. return n;
  461. */
  462. return name->value();} {}
  463. }
  464. Function {cb_lsb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
  465. } {
  466. code {w->ev()->lsb( o->value() );
  467. w->do_callback();} {}
  468. }
  469. Function {cb_msb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
  470. } {
  471. code {w->ev()->msb( o->value() );
  472. w->do_callback();} {}
  473. }
  474. Function {cb_note( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void}
  475. } {
  476. code {w->ev()->note( o->value() );
  477. w->do_callback();} {}
  478. }
  479. }