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