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.

90 lines
3.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. #include "Tempo_Map_Sequence.H"
  19. void
  20. Tempo_Map_Sequence::draw ( void )
  21. {
  22. if ( ! fl_not_clipped( x(), y(), w(), h() ) )
  23. return;
  24. fl_push_clip( x(), y(), w(), h() );
  25. /* draw the box with the ends cut off. */
  26. draw_box( box(),
  27. x() - Fl::box_dx( box() ) - 1, y(),
  28. w() + Fl::box_dw( box() ) + 2, h() >> 1, color() );
  29. draw_box( box(),
  30. x() - Fl::box_dx( box() ) - 1, y() + (h() >> 1) ,
  31. w() + Fl::box_dw( box() ) + 2, h() >> 1, color() );
  32. int X, Y, W, H;
  33. fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
  34. if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this )
  35. {
  36. /* make sure the Sequence_Widget::pushed widget is above all others */
  37. remove( Sequence_Widget::pushed() );
  38. add( Sequence_Widget::pushed() );
  39. }
  40. timeline->draw_measure_lines( X, Y, W, H, color() );
  41. for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
  42. (*r)->draw_box();
  43. for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
  44. (*r)->draw();
  45. fl_pop_clip();
  46. }
  47. int
  48. Tempo_Map_Sequence::handle ( int m )
  49. {
  50. int r = Sequence::handle( m );
  51. if ( r )
  52. return r;
  53. switch ( m )
  54. {
  55. case FL_PUSH:
  56. if ( Fl::event_button1() )
  57. {
  58. static float t = 120.0f;
  59. if ( Tempo_Point::edit( &t ) )
  60. {
  61. add( new Tempo_Point( timeline->x_to_offset( Fl::event_x() ), t ) );
  62. timeline->redraw();
  63. }
  64. return 0;
  65. }
  66. default:
  67. return 0;
  68. }
  69. }