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.

117 lines
3.3KB

  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_Scroll.H>
  20. #include <FL/Fl_Pack.H>
  21. #include <FL/Fl_Scrollbar.H>
  22. #include <FL/Fl_Widget.H>
  23. #include "Scalebar.H"
  24. #include "Audio_File.H" // just for nframes_t
  25. #include <math.h>
  26. #include <assert.h>
  27. #include <FL/fl_draw.H>
  28. class Timeline;
  29. extern Timeline *timeline;
  30. #include "Track.H"
  31. // #include "Tempo_Track.H"
  32. class Tempo_Track;
  33. class Time_Track;
  34. // #include "Tempo_Point.H"
  35. // #include "Region.H"
  36. #include <list>
  37. using std::list;
  38. struct Timeline : public Fl_Group
  39. {
  40. static void draw_clip ( void * v, int X, int Y, int W, int H );
  41. int _old_xposition;
  42. int _old_yposition;
  43. enum snap_flags_e {
  44. SNAP_TO_REGION,
  45. SNAP_TO_BAR,
  46. SNAP_TO_BEAT
  47. } snap_to;
  48. Fl_Scroll *scroll;
  49. Fl_Pack *tracks;
  50. Fl_Pack *rulers;
  51. Scalebar *hscroll;
  52. Fl_Scrollbar *vscroll;
  53. Tempo_Track *tempo_track;
  54. Time_Track *time_track;
  55. float fpp; /* frames per pixel */
  56. // nframes_t fpp;
  57. nframes_t sample_rate;
  58. nframes_t xoffset;
  59. nframes_t length;
  60. int yposition;
  61. int _beats_per_bar;
  62. float _beats_per_minute;
  63. Timeline ( int X, int Y, int W, int H, const char *L=0 );
  64. int
  65. ts_to_x( nframes_t ts )
  66. {
  67. // assert( ts / fpp > 0 );
  68. return ts / fpp;
  69. }
  70. nframes_t
  71. x_to_ts ( int x )
  72. {
  73. return x * fpp;
  74. }
  75. /* #define FOR_CHILDREN_OF( name, ind ) \ */
  76. /* for ( int i = (name) ->children(); i-- && ( (ind) = (name) ->child( i ) ); ) */
  77. float beats_per_minute ( nframes_t when ) const;
  78. int beats_per_bar ( nframes_t when ) const;
  79. void beats_per_minute ( nframes_t when, float bpm );
  80. int nearest_line ( int ix );
  81. void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color );
  82. void position ( int X );
  83. void draw ( void );
  84. int handle ( int m );
  85. };