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.

146 lines
4.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 <FL/Fl_Widget.H>
  20. #include <FL/Fl_Group.H>
  21. #include <FL/Fl.H>
  22. #include <stdio.h>
  23. #include "Loggable.H"
  24. #include <assert.h>
  25. #include <list>
  26. // using namespace std;
  27. class Track;
  28. class Sequence_Widget;
  29. #include "types.h"
  30. /* This is the base class for all track types. */
  31. class Sequence : public Fl_Widget, public Loggable
  32. {
  33. static queue <Sequence_Widget *> _delete_queue;
  34. protected:
  35. Track *_track; /* track this sequence belongs to */
  36. char *_name;
  37. std::list <Sequence_Widget *> _widgets;
  38. Sequence_Widget *event_widget ( void );
  39. // virtual const char *class_name ( void ) { return "Sequence"; }
  40. virtual void set ( Log_Entry &e )
  41. {
  42. for ( int i = 0; i < e.size(); ++i )
  43. {
  44. const char *s, *v;
  45. e.get( i, &s, &v );
  46. if ( ! strcmp( ":n", s ) )
  47. {
  48. name( strdup( v ) );
  49. }
  50. }
  51. }
  52. virtual void get ( Log_Entry &e ) const
  53. {
  54. e.add( ":n", name() );
  55. // e.add( ":t", _track );
  56. /* s += sprintf( s, ":items " ); */
  57. /* for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ ) */
  58. /* { */
  59. /* s += sprintf( s, "0x%X", ((Loggable*)(*i))->id() ); */
  60. /* list <Sequence_Widget *>::const_iterator e = i; */
  61. /* if ( ++e != _widgets.end() ) */
  62. /* s += sprintf( s, "," ); */
  63. /* } */
  64. }
  65. public:
  66. LOG_NAME_FUNC( Sequence );
  67. Sequence ( int X, int Y, int W, int H, Track *track=0 );
  68. virtual ~Sequence ( );
  69. const char * name ( void ) const { return _name; }
  70. void name ( const char *s )
  71. {
  72. if ( _name ) free( _name );
  73. _name = strdup( s );
  74. label( _name );
  75. }
  76. void sort ( void );
  77. Track *track ( void ) const { return _track; }
  78. void track ( Track *t ) { _track = t; }
  79. void remove ( Sequence_Widget *r );
  80. void add ( Sequence_Widget *r );
  81. void select_range ( int X, int W );
  82. void remove_selected ( void );
  83. const std::list <Sequence_Widget *> widgets ( void ) const { return _widgets; }
  84. void queue_delete ( Sequence_Widget *r )
  85. {
  86. _delete_queue.push( r );
  87. }
  88. Sequence_Widget * overlaps ( Sequence_Widget *r );
  89. virtual Sequence * clone ( void )
  90. {
  91. assert( 0 );
  92. }
  93. virtual Sequence * clone_empty ( void )
  94. {
  95. return NULL;
  96. }
  97. virtual void snap ( Sequence_Widget *r );
  98. virtual int handle ( int m );
  99. virtual void draw ( void );
  100. virtual nframes_t process ( nframes_t nframes ) { return 0; }
  101. };