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.

127 lines
3.9KB

  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. #pragma once
  19. #include "Track.H"
  20. #include "Control_Point.H"
  21. class Control_Track : public Track
  22. {
  23. public:
  24. Control_Track ( int X, int Y, int W, int H ) : Track( X, Y, W, H )
  25. {
  26. color( fl_darker( FL_GREEN ) );
  27. log_create();
  28. }
  29. ~Control_Track ( )
  30. {
  31. log_destroy();
  32. }
  33. const char *class_name ( void ) { return "Control_Track"; }
  34. void
  35. draw ( void )
  36. {
  37. if ( ! fl_not_clipped( x(), y(), w(), h() ) )
  38. return;
  39. fl_push_clip( x(), y(), w(), h() );
  40. draw_box();
  41. int X, Y, W, H;
  42. fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
  43. fl_line_style( FL_SOLID, 4 );
  44. fl_color( fl_color_average( selection_color(), color(), 0.90f ) );
  45. fl_begin_complex_polygon();
  46. list <Track_Widget *>::const_iterator e = _widgets.end();
  47. e--;
  48. if ( _widgets.size() )
  49. for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); ; r++ )
  50. {
  51. if ( r == _widgets.begin() )
  52. {
  53. fl_vertex( x(), y() + h() );
  54. fl_vertex( x(), (*r)->y() );
  55. }
  56. fl_vertex( (*r)->x(), (*r)->y() );
  57. if ( r == e )
  58. {
  59. fl_vertex( x() + w(), (*r)->y() );
  60. fl_vertex( x() + w(), y() + h() );
  61. break;
  62. }
  63. }
  64. fl_end_complex_polygon();
  65. fl_line_style( FL_SOLID, 0 );
  66. timeline->draw_measure_lines( x(), y(), w(), h(), color() );
  67. for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
  68. (*r)->draw_box( X, Y, W, H );
  69. fl_pop_clip();
  70. }
  71. int
  72. handle ( int m )
  73. {
  74. int r = Track::handle( m );
  75. if ( r )
  76. return r;
  77. switch ( m )
  78. {
  79. case FL_PUSH:
  80. {
  81. if ( Fl::event_button1() )
  82. {
  83. Control_Point *r = new Control_Point( this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ), (float)(Fl::event_y() - y()) / h() );
  84. add( r );
  85. }
  86. return 1;
  87. }
  88. default:
  89. return 0;
  90. }
  91. }
  92. };