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.

135 lines
3.2KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2012 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 "Cursor_Point.H"
  19. #include "Cursor_Sequence.H"
  20. #include "Timeline.H" // for timeline->time_track
  21. Cursor_Point::Cursor_Point ( )
  22. {
  23. // timeline->->add( this );
  24. _label = NULL;
  25. _type = NULL;
  26. }
  27. Cursor_Point::Cursor_Point ( nframes_t when, const char *type, const char *label )
  28. {
  29. // _make_label();
  30. _label = NULL;
  31. _type = NULL;
  32. this->label( label );
  33. this->type( type );
  34. timeline->add_cursor( this );
  35. start( when );
  36. log_create();
  37. }
  38. Cursor_Point::Cursor_Point ( const Cursor_Point &rhs ) : Sequence_Point( rhs )
  39. {
  40. label( rhs.label() );
  41. type( rhs.type() );
  42. log_create();
  43. }
  44. Cursor_Point::~Cursor_Point ( )
  45. {
  46. // sequence()->remove( this );
  47. log_destroy();
  48. label(NULL);
  49. type(NULL);
  50. }
  51. void
  52. Cursor_Point::get ( Log_Entry &e ) const
  53. {
  54. // Sequence_Point::get( e );
  55. e.add( ":start", start() );
  56. e.add( ":label", label() );
  57. e.add( ":type", type() );
  58. }
  59. void
  60. Cursor_Point::set ( Log_Entry &e )
  61. {
  62. Sequence_Point::set( e );
  63. for ( int i = 0; i < e.size(); ++i )
  64. {
  65. const char *s, *v;
  66. e.get( i, &s, &v );
  67. if ( ! strcmp( s, ":label" ) )
  68. label( v );
  69. else if ( ! strcmp( s, ":type" ))
  70. {
  71. type( v );
  72. timeline->add_cursor( this );
  73. }
  74. /* /\* FIXME: we need to add this to the time track on creation!!! *\/ */
  75. /* timeline->time_track->add( this ); */
  76. }
  77. sequence()->handle_widget_change( start(), length() );
  78. // _make_label();
  79. }
  80. int
  81. Cursor_Point::handle ( int m )
  82. {
  83. Logger log( this );
  84. /* if ( m == FL_PUSH && Fl::event_button3() && ! ( Fl::event_state() & ( FL_ALT | FL_CTRL | FL_SHIFT ) ) ) */
  85. /* { */
  86. /* time_sig t = _time; */
  87. /* edit( &t ); */
  88. /* time( t.beats_per_bar, t.beat_type ); */
  89. /* return 0; */
  90. /* } */
  91. return Sequence_Point::handle( m );
  92. }