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.4KB

  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. class Track;
  27. class Sequence_Widget;
  28. #include "types.h"
  29. /* This is the base class for all track types. */
  30. class Sequence : public Fl_Widget, public Loggable
  31. {
  32. static queue <Sequence_Widget *> _delete_queue;
  33. void init ( void );
  34. protected:
  35. Track *_track; /* track this sequence belongs to */
  36. char *_name;
  37. friend class Timeline; // for draw_measure
  38. std::list <Sequence_Widget *> _widgets;
  39. Sequence_Widget *event_widget ( void );
  40. public:
  41. /* welcome to C++ */
  42. LOG_NAME_FUNC( Sequence );
  43. Sequence ( Track *track=0 );
  44. Sequence ( int X, int Y, int W, int H );
  45. virtual ~Sequence ( );
  46. /* override this to provide cursor */
  47. virtual Fl_Cursor cursor ( void ) const = 0;
  48. nframes_t x_to_offset ( int X );
  49. const char * name ( void ) const { return _name; }
  50. void name ( const char *s )
  51. {
  52. if ( _name ) free( _name );
  53. _name = strdup( s );
  54. label( _name );
  55. }
  56. void sort ( void );
  57. Track *track ( void ) const { return _track; }
  58. void track ( Track *t ) { _track = t; }
  59. void remove ( Sequence_Widget *r );
  60. void add ( Sequence_Widget *r );
  61. void select_range ( int X, int W );
  62. void remove_selected ( void );
  63. const std::list <Sequence_Widget *> widgets ( void ) const { return _widgets; }
  64. void queue_delete ( Sequence_Widget *r )
  65. {
  66. _delete_queue.push( r );
  67. }
  68. Sequence_Widget * overlaps ( Sequence_Widget *r );
  69. virtual Sequence * clone ( void )
  70. {
  71. assert( 0 );
  72. }
  73. virtual Sequence * clone_empty ( void )
  74. {
  75. return NULL;
  76. }
  77. virtual void snap ( Sequence_Widget *r );
  78. virtual int handle ( int m );
  79. virtual void draw ( void );
  80. virtual nframes_t process ( nframes_t nframes ) { return 0; }
  81. };