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.

134 lines
3.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 "Sequence_Point.H"
  19. #include <FL/fl_draw.H>
  20. Sequence_Point::Sequence_Point ( const Sequence_Point &rhs ) : Sequence_Widget( rhs )
  21. {
  22. if ( _label )
  23. _label = strdup( rhs._label );
  24. }
  25. Sequence_Point::Sequence_Point ( )
  26. {
  27. _label = NULL;
  28. color( FL_CYAN );
  29. }
  30. Sequence_Point::~Sequence_Point ( )
  31. {
  32. if ( _label )
  33. free( _label );
  34. }
  35. void
  36. Sequence_Point::get ( Log_Entry &e ) const
  37. {
  38. Sequence_Widget::get( e );
  39. }
  40. void
  41. Sequence_Point::set ( Log_Entry &e )
  42. {
  43. Sequence_Widget::set( e );
  44. for ( int i = 0; i < e.size(); ++i )
  45. {
  46. const char *s, *v;
  47. e.get( i, &s, &v );
  48. if ( ! strcmp( ":start", s ) )
  49. {
  50. sequence()->sort();
  51. }
  52. }
  53. }
  54. static void
  55. draw_marker ( Fl_Color c )
  56. {
  57. fl_color( c );
  58. fl_begin_polygon();
  59. #define vv(x,y) fl_vertex( x, y );
  60. vv( 0.0, 0.0 );
  61. vv( 0.0, 0.6 );
  62. vv( 0.5, 1.0 );
  63. vv( 1.0, 0.6 );
  64. vv( 1.0, 0.0 );
  65. vv( 0.0, 0.0 );
  66. fl_end_polygon();
  67. fl_color( fl_darker( c ) );
  68. fl_begin_line();
  69. vv( 0.0, 0.0 );
  70. vv( 0.0, 0.6 );
  71. vv( 0.5, 1.0 );
  72. vv( 1.0, 0.6 );
  73. vv( 1.0, 0.0 );
  74. vv( 0.0, 0.0 );
  75. fl_end_line();
  76. }
  77. void
  78. Sequence_Point::draw_box ( void )
  79. {
  80. // Sequence_Widget::draw_box();
  81. const int X = x() - (abs_w() >> 1);
  82. // const int Y = y() + Fl::box_dy( box() );
  83. const int Y = y();
  84. fl_color( color() );
  85. fl_push_matrix();
  86. fl_translate( X, Y + ( h() >> 3 ) );
  87. fl_scale( w(), h() - ( h() >> 3 ) );
  88. draw_marker( color() );
  89. fl_pop_matrix();
  90. // fl_line( X, Y, X, Y + h() - Fl::box_dh( box() ) );
  91. }
  92. void
  93. Sequence_Point::draw ( void )
  94. {
  95. // Sequence_Widget::draw();
  96. draw_label( _label, align() );
  97. }