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.

132 lines
3.7KB

  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 "Region.H"
  23. #include <stdio.h>
  24. #include "Loggable.H"
  25. #include <assert.h>
  26. #include <list>
  27. #include <queue>
  28. using namespace std;
  29. class Region;
  30. class Track_Widget;
  31. #include "types.h"
  32. /* This is the base class for all track types. */
  33. class Track : public Fl_Widget, public Loggable
  34. {
  35. char *_name;
  36. static queue <Track_Widget *> _delete_queue;
  37. protected:
  38. list <Track_Widget *> _widgets;
  39. Track_Widget *event_widget ( void );
  40. virtual const char *class_name ( void ) { return "Track"; }
  41. void set ( char ** ) { return; }
  42. char ** get ( void )
  43. {
  44. // char *r;
  45. char **sa = (char**)malloc( sizeof( char* ) * 2);
  46. sa[0] = (char*)malloc( (_widgets.size() * ((sizeof( int ) * 2) + 3)) + 1 );
  47. sa[1] = NULL;
  48. sa[0][0] = '\0';
  49. /* char *s = sa[0]; */
  50. /* s += sprintf( s, ":items " ); */
  51. /* for ( list <Track_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ ) */
  52. /* { */
  53. /* s += sprintf( s, "0x%X", ((Loggable*)(*i))->id() ); */
  54. /* list <Track_Widget *>::const_iterator e = i; */
  55. /* if ( ++e != _widgets.end() ) */
  56. /* s += sprintf( s, "," ); */
  57. /* } */
  58. return sa;
  59. }
  60. public:
  61. Track ( int X, int Y, int W, int H );
  62. virtual ~Track ( );
  63. const char * name ( void ) const { return _name; }
  64. void name ( char *s ) { if ( _name ) free( _name ); _name = s; label( _name ); }
  65. void sort ( void );
  66. void remove ( Track_Widget *r );
  67. void add ( Track_Widget *r );
  68. void select_range ( int X, int W );
  69. void remove_selected ( void );
  70. const list <Track_Widget *> widgets ( void ) const { return _widgets; }
  71. void queue_delete ( Track_Widget *r )
  72. {
  73. _delete_queue.push( r );
  74. }
  75. Track_Widget * overlaps ( Track_Widget *r );
  76. virtual Track * clone ( void )
  77. {
  78. assert( 0 );
  79. }
  80. virtual Track * clone_empty ( void )
  81. {
  82. return NULL;
  83. }
  84. virtual void snap ( Track_Widget *r );
  85. virtual int handle ( int m );
  86. virtual void draw ( void );
  87. virtual nframes_t process ( nframes_t nframes ) { return 0; }
  88. };