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.

208 lines
4.9KB

  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. class List_Chooser {} {
  25. Function {List_Chooser( const char *name, const char *action )} {open
  26. } {
  27. Fl_Window window {open
  28. xywh {696 57 310 524} type Single non_modal size_range {310 524 0 0} visible
  29. } {
  30. Fl_Pack {} {open
  31. xywh {2 10 303 501}
  32. code0 {o->spacing( 20 );}
  33. } {
  34. Fl_Browser browser {
  35. label name
  36. xywh {15 30 280 447} type Multi color 32 selection_color 47 align 1 textcolor 55 resizable
  37. code0 {o->label( name );}
  38. }
  39. Fl_Group {} {open
  40. xywh {17 485 278 26}
  41. } {
  42. Fl_Button {} {
  43. label Cancel
  44. callback {browser->clear();
  45. window->hide();}
  46. xywh {17 485 75 26}
  47. }
  48. Fl_Return_Button button {
  49. label action
  50. callback {window->hide();}
  51. xywh {105 485 190 26}
  52. code0 {o->label( action );}
  53. }
  54. }
  55. }
  56. }
  57. }
  58. Function {show()} {open
  59. } {
  60. code {window->show();} {}
  61. }
  62. Function {shown()} {open return_type bool
  63. } {
  64. code {return window->shown();} {}
  65. }
  66. Function {add( const char *item )} {open
  67. } {
  68. code {browser->add( item );} {}
  69. }
  70. }
  71. decl {\#include "../transport.H"} {selected public
  72. }
  73. decl {extern Fl_Color velocity_colors[];} {}
  74. decl {\#include <Fl/Fl_Box.H>} {}
  75. decl {\#include <stdio.h>} {}
  76. decl {\#include <stdlib.h>} {}
  77. widget_class Visual_Metronome {open
  78. xywh {201 31 1278 1003} type Single hide resizable
  79. code0 {_bpb = _tpb = -1; _beat = _tick = _flip = 0;}
  80. code1 {o->box( FL_NO_BOX );}
  81. code2 {o->label( 0 );}
  82. class Fl_Group
  83. } {
  84. Fl_Slider progress {
  85. private xywh {119 95 1149 23} type Horizontal box ROUND_UP_BOX color 32 selection_color 71
  86. code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );}
  87. code1 {o->slider_size( 0.25 );}
  88. code2 {o->slider( FL_ROUNDED_BOX );}
  89. }
  90. Fl_Pack pack {open
  91. private xywh {119 7 1149 78} type HORIZONTAL resizable
  92. code0 {o->resize( x(), y(), w(), h() - progress->h() );}
  93. } {}
  94. decl {int _bpb} {}
  95. decl {int _tpb} {}
  96. decl {int _beat} {}
  97. decl {bool _flip} {}
  98. decl {int _tick} {}
  99. Function {bpb( int b )} {open private return_type void
  100. } {
  101. code {if ( b == _bpb )
  102. return;
  103. _bpb = b;
  104. pack->clear();
  105. int bw = w() / _bpb;
  106. for ( int i = 1; i <= b; ++i )
  107. {
  108. Fl_Box *box = new Fl_Box( FL_ROUNDED_BOX, 0, 0, bw, 1, 0 );
  109. char *pat = (char *)malloc( 4 );
  110. sprintf( pat, "%d", i );
  111. box->label( pat );
  112. box->color( fl_lighter( FL_GRAY ) );
  113. pack->add( box );
  114. }
  115. // try to clear the background.
  116. parent()->parent()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() );
  117. redraw();} {}
  118. }
  119. Function {tpb( int ticks )} {open private return_type void
  120. } {
  121. code {_tpb = ticks;
  122. progress->minimum( 0 );
  123. progress->maximum( ticks );} {}
  124. }
  125. Function {beat( int b )} {open private return_type void
  126. } {
  127. code {if ( b == _beat || b >= _bpb )
  128. return;
  129. pack->child( _beat )->color( fl_lighter( FL_GRAY ) );
  130. pack->child( _beat )->redraw();
  131. pack->child( b )->color( velocity_colors[ b * 127 / _bpb ] );
  132. pack->child( b )->redraw();
  133. _flip = ! _flip;
  134. _beat = b;} {}
  135. }
  136. Function {tick( int tick )} {open private return_type void
  137. } {
  138. code {if ( tick == _tick )
  139. return;
  140. if ( _beat < 0 )
  141. return;
  142. if ( _flip )
  143. {
  144. progress->selection_color( FL_RED );
  145. progress->value( _tpb - tick );
  146. }
  147. else
  148. {
  149. progress->selection_color( FL_GREEN );
  150. progress->value( tick );
  151. }
  152. \#if 0
  153. Fl_Widget *c = pack->child( _beat );
  154. if ( c )
  155. {
  156. c->color( velocity_colors[ tick * 127 / _tpb ] );
  157. c->redraw();
  158. }
  159. \#endif
  160. _tick = tick;} {}
  161. }
  162. Function {resize( int X, int Y, int W, int H )} {open return_type void
  163. } {
  164. code {// pack->resize( 0, 0, W, pack->h() );
  165. Fl_Group::resize( X, Y, W, H );
  166. for ( int i = pack->children(); i-- ; )
  167. pack->child( i )->resize( 0, 0, W / pack->children(), pack->h() );} {}
  168. }
  169. Function {update( void )} {open return_type void
  170. } {
  171. code {bpb( transport.beats_per_bar );
  172. tpb( transport.ticks_per_beat );
  173. beat( transport.beat - 1 );
  174. tick( transport.tick - 1 );} {}
  175. }
  176. }