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.

193 lines
5.3KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #include "Track_Header.H"
  19. void
  20. Track_Header::cb_input_field ( Fl_Widget *w, void *v )
  21. {
  22. ((Track_Header*)v)->cb_input_field();
  23. }
  24. void
  25. Track_Header::cb_button ( Fl_Widget *w, void *v )
  26. {
  27. ((Track_Header*)v)->cb_button( w );
  28. }
  29. void
  30. Track_Header::cb_input_field ( void )
  31. {
  32. log_start();
  33. if ( _name )
  34. free( _name );
  35. _name = strdup( name_field->value() );
  36. log_end();
  37. }
  38. void
  39. Track_Header::cb_button ( Fl_Widget *w )
  40. {
  41. printf( "FIXME: inform mixer here\n" );
  42. if ( w == record_button )
  43. {
  44. }
  45. else
  46. if ( w == take_menu )
  47. {
  48. int v = take_menu->value();
  49. if ( v == 0 )
  50. {
  51. show_all_takes( take_menu->menu()[ v ].value() );
  52. return;
  53. }
  54. const char *s = take_menu->menu()[ v ].text;
  55. for ( int i = takes->children(); i--; )
  56. {
  57. Track *t = (Track*)takes->child( i );
  58. if ( ! strcmp( s, t->name() ) )
  59. {
  60. track( t );
  61. redraw();
  62. break;
  63. }
  64. }
  65. }
  66. }
  67. Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
  68. Fl_Group ( X, Y, W, H, L )
  69. {
  70. _name = NULL;
  71. _selected = false;
  72. _show_all_takes = false;
  73. _size = 1;
  74. Fl_Group::size( w(), height() );
  75. Track_Header *o = this;
  76. o->box( FL_THIN_UP_BOX );
  77. {
  78. Fl_Group *o = new Fl_Group( 2, 2, 149, 70 );
  79. o->color( ( Fl_Color ) 53 );
  80. {
  81. Fl_Input *o = name_field = new Fl_Input( 2, 2, 144, 24 );
  82. o->color( ( Fl_Color ) 33 );
  83. o->labeltype( FL_NO_LABEL );
  84. o->labelcolor( FL_GRAY0 );
  85. o->textcolor( 32 );
  86. o->callback( cb_input_field, (void*)this );
  87. }
  88. {
  89. Fl_Group *o = controls = new Fl_Group( 2, 28, 149, 24 );
  90. {
  91. Fl_Button *o = record_button =
  92. new Fl_Button( 6, 28, 26, 24, "@circle" );
  93. o->type( 1 );
  94. o->box( FL_THIN_UP_BOX );
  95. o->color( FL_LIGHT1 );
  96. o->selection_color( FL_RED );
  97. o->labelsize( 8 );
  98. o->callback( cb_button, this );
  99. }
  100. {
  101. Fl_Button *o = mute_button =
  102. new Fl_Button( 35, 28, 26, 24, "m" );
  103. o->type( 1 );
  104. o->box( FL_THIN_UP_BOX );
  105. o->color( FL_LIGHT1 );
  106. o->labelsize( 11 );
  107. o->callback( cb_button, this );
  108. }
  109. {
  110. Fl_Button *o = solo_button =
  111. new Fl_Button( 66, 28, 26, 24, "s" );
  112. o->type( 1 );
  113. o->box( FL_THIN_UP_BOX );
  114. o->color( FL_LIGHT1 );
  115. o->labelsize( 11 );
  116. o->callback( cb_button, this );
  117. }
  118. {
  119. Fl_Menu_Button *o = take_menu =
  120. new Fl_Menu_Button( 97, 28, 47, 24, "T" );
  121. o->box( FL_THIN_UP_BOX );
  122. o->color( FL_LIGHT1 );
  123. o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
  124. o->callback( cb_button, this );
  125. o->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE );
  126. }
  127. o->end();
  128. }
  129. {
  130. Fl_Box *o = new Fl_Box( 0, 76, 149, 38 );
  131. o->box( FL_FLAT_BOX );
  132. Fl_Group::current()->resizable( o );
  133. }
  134. o->size( Track_Header::width(), h() );
  135. o->end();
  136. }
  137. {
  138. Fl_Pack *o = takes = new Fl_Pack( 150, 0, 1006, 115 );
  139. o->labeltype( FL_NO_LABEL );
  140. o->align( FL_ALIGN_CLIP );
  141. o->resize( x() + width(), y(), w() - width(), h() );
  142. o->end();
  143. Fl_Group::current()->resizable( o );
  144. }
  145. end();
  146. log_create();
  147. }
  148. Track_Header::~Track_Header ( )
  149. {
  150. log_destroy();
  151. }
  152. int
  153. Track_Header::width()
  154. {
  155. return 150;
  156. }
  157. void
  158. Track_Header::track( Track * t )
  159. {
  160. // t->size( 1, h() );
  161. takes->insert( *t, 0 );
  162. }