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.

119 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. #pragma once
  19. #include "Loggable.H"
  20. #include "Sequence_Point.H"
  21. class Ruler_Point : public Sequence_Point
  22. {
  23. public:
  24. const char *name ( void ) const { return _label; }
  25. void name ( const char *s )
  26. {
  27. if ( _label )
  28. free( _label );
  29. _label = strdup( s );
  30. }
  31. protected:
  32. // const char *class_name ( void ) { return "Ruler_Point"; }
  33. virtual void get ( Log_Entry &e ) const
  34. {
  35. Sequence_Point::get( e );
  36. e.add( ":label", _label );
  37. }
  38. void
  39. set ( Log_Entry &e )
  40. {
  41. Sequence_Point::set( e );
  42. for ( int i = 0; i < e.size(); ++i )
  43. {
  44. const char *s, *v;
  45. e.get( i, &s, &v );
  46. if ( ! strcmp( s, ":label" ) )
  47. name( v );
  48. }
  49. timeline->redraw();
  50. }
  51. Ruler_Point ( )
  52. {
  53. }
  54. public:
  55. /* for loggable */
  56. LOG_CREATE_FUNC( Ruler_Point );
  57. Ruler_Point ( nframes_t when, const char *name )
  58. {
  59. _r->offset = when;
  60. _label = strdup( name );
  61. log_create();
  62. }
  63. Ruler_Point ( const Ruler_Point &rhs )
  64. {
  65. _r->offset = rhs._r->offset;
  66. _label = strdup( rhs._label );
  67. }
  68. Sequence_Widget *clone ( const Sequence_Widget *r )
  69. {
  70. return new Ruler_Point( *(Ruler_Point*)r );
  71. }
  72. ~Ruler_Point ( )
  73. {
  74. if ( _label ) free( _label );
  75. log_destroy();
  76. }
  77. int
  78. handle ( int m )
  79. {
  80. int r = Sequence_Widget::handle( m );
  81. if ( m == FL_RELEASE )
  82. {
  83. _track->sort();
  84. timeline->redraw();
  85. }
  86. return r;
  87. }
  88. };