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.

122 lines
3.5KB

  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 "Sequence.H"
  20. #include "Annotation_Point.H"
  21. #include "Timeline.H"
  22. class Annotation_Sequence : public Sequence, public Loggable
  23. {
  24. protected:
  25. virtual void get ( Log_Entry &e ) const
  26. {
  27. e.add( ":t", _track );
  28. }
  29. void
  30. set ( Log_Entry &e )
  31. {
  32. for ( int i = 0; i < e.size(); ++i )
  33. {
  34. const char *s, *v;
  35. e.get( i, &s, &v );
  36. if ( ! strcmp( ":t", s ) )
  37. {
  38. int i;
  39. sscanf( v, "%X", &i );
  40. Track *t = (Track*)Loggable::find( i );
  41. assert( t );
  42. t->track( this );
  43. }
  44. }
  45. }
  46. Annotation_Sequence ( ) : Sequence ( 0, 0, 0, 0 )
  47. {
  48. }
  49. public:
  50. LOG_CREATE_FUNC( Annotation_Sequence );
  51. Fl_Cursor cursor ( void ) const { return FL_CURSOR_INSERT; }
  52. Annotation_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0 )
  53. {
  54. _track = track;
  55. color( fl_darker( FL_GREEN ) );
  56. log_create();
  57. // labeltype( FL_NO_LABEL );
  58. }
  59. Annotation_Sequence ( int X, int Y, int W, int H ) : Sequence ( X, Y, W, H )
  60. {
  61. // box( FL_UP_BOX );
  62. }
  63. ~Annotation_Sequence ( )
  64. {
  65. log_destroy();
  66. }
  67. /* void */
  68. /* draw ( void ) */
  69. /* { */
  70. /* // timeline->draw_measure_BBT( x(), y(), w(), h(), FL_WHITE ); */
  71. /* Sequence::draw(); */
  72. /* } */
  73. int handle ( int m )
  74. {
  75. if ( Sequence::handle( m ) )
  76. return 1;
  77. switch ( m )
  78. {
  79. case FL_PUSH:
  80. {
  81. if ( Fl::event_button1() )
  82. {
  83. add( new Annotation_Point( this, x_to_offset( Fl::event_x() ), "mark" ) );
  84. redraw();
  85. }
  86. break;
  87. }
  88. default:
  89. break;
  90. }
  91. return 0;
  92. }
  93. };