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.

186 lines
5.1KB

  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. printf( "%d\n", take_menu->value() );
  49. const char *s = take_menu->menu()[ take_menu->value() ].text;
  50. for ( int i = takes->children(); i--; )
  51. {
  52. Track *t = (Track*)takes->child( i );
  53. if ( ! strcmp( s, t->name() ) )
  54. {
  55. track( t );
  56. redraw();
  57. break;
  58. }
  59. }
  60. }
  61. }
  62. Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
  63. Fl_Group ( X, Y, W, H, L )
  64. {
  65. _name = NULL;
  66. _selected = false;
  67. _show_all_takes = false;
  68. _size = 1;
  69. Fl_Group::size( w(), height() );
  70. Track_Header *o = this;
  71. o->box( FL_THIN_UP_BOX );
  72. {
  73. Fl_Group *o = new Fl_Group( 2, 2, 149, 70 );
  74. o->color( ( Fl_Color ) 53 );
  75. {
  76. Fl_Input *o = name_field = new Fl_Input( 2, 2, 144, 24 );
  77. o->color( ( Fl_Color ) 33 );
  78. o->labeltype( FL_NO_LABEL );
  79. o->labelcolor( FL_GRAY0 );
  80. o->textcolor( 32 );
  81. o->callback( cb_input_field, (void*)this );
  82. }
  83. {
  84. Fl_Group *o = controls = new Fl_Group( 2, 28, 149, 24 );
  85. {
  86. Fl_Button *o = record_button =
  87. new Fl_Button( 6, 28, 26, 24, "@circle" );
  88. o->type( 1 );
  89. o->box( FL_THIN_UP_BOX );
  90. o->color( FL_LIGHT1 );
  91. o->selection_color( FL_RED );
  92. o->labelsize( 8 );
  93. o->callback( cb_button, this );
  94. }
  95. {
  96. Fl_Button *o = mute_button =
  97. new Fl_Button( 35, 28, 26, 24, "m" );
  98. o->type( 1 );
  99. o->box( FL_THIN_UP_BOX );
  100. o->color( FL_LIGHT1 );
  101. o->labelsize( 11 );
  102. o->callback( cb_button, this );
  103. }
  104. {
  105. Fl_Button *o = solo_button =
  106. new Fl_Button( 66, 28, 26, 24, "s" );
  107. o->type( 1 );
  108. o->box( FL_THIN_UP_BOX );
  109. o->color( FL_LIGHT1 );
  110. o->labelsize( 11 );
  111. o->callback( cb_button, this );
  112. }
  113. {
  114. Fl_Menu_Button *o = take_menu =
  115. new Fl_Menu_Button( 97, 28, 47, 24, "T" );
  116. o->box( FL_THIN_UP_BOX );
  117. o->color( FL_LIGHT1 );
  118. o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
  119. o->callback( cb_button, this );
  120. }
  121. o->end();
  122. }
  123. {
  124. Fl_Box *o = new Fl_Box( 0, 76, 149, 38 );
  125. o->box( FL_FLAT_BOX );
  126. Fl_Group::current()->resizable( o );
  127. }
  128. o->size( Track_Header::width(), h() );
  129. o->end();
  130. }
  131. {
  132. Fl_Pack *o = takes = new Fl_Pack( 150, 0, 1006, 115 );
  133. o->labeltype( FL_NO_LABEL );
  134. o->align( FL_ALIGN_CLIP );
  135. o->resize( x() + width(), y(), w() - width(), h() );
  136. o->end();
  137. Fl_Group::current()->resizable( o );
  138. }
  139. end();
  140. log_create();
  141. }
  142. Track_Header::~Track_Header ( )
  143. {
  144. log_destroy();
  145. }
  146. int
  147. Track_Header::width()
  148. {
  149. return 150;
  150. }
  151. void
  152. Track_Header::track( Track * t )
  153. {
  154. t->size( 1, h() );
  155. takes->insert( *t, 0 );
  156. }