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.

79 lines
2.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. /* Just like an Fl_Input, except that when not being edited it
  19. * displays just like a label. */
  20. class Fl_Sometimes_Input : public Fl_Input
  21. {
  22. bool _editing;
  23. public:
  24. Fl_Sometimes_Input ( int X, int Y, int W, int H, const char *L=0 )
  25. : Fl_Input( X, Y, W, H, L )
  26. {
  27. _editing = false;
  28. }
  29. virtual void
  30. draw ( void )
  31. {
  32. if ( _editing )
  33. Fl_Input::draw();
  34. else
  35. {
  36. fl_color( FL_FOREGROUND_COLOR /* textcolor() */ );
  37. fl_font( textfont(), textsize() );
  38. fl_draw( value(), x(), y(), w(), h(), FL_ALIGN_CENTER );
  39. }
  40. }
  41. virtual int
  42. handle ( int m )
  43. {
  44. int r = Fl_Input::handle( m );
  45. switch ( m )
  46. {
  47. case FL_FOCUS:
  48. _editing = true;
  49. redraw();
  50. return 1;
  51. case FL_PUSH:
  52. _editing = true;
  53. redraw();
  54. return r;
  55. case FL_UNFOCUS:
  56. _editing = false;
  57. if ( window() )
  58. window()->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() );
  59. redraw();
  60. return r;
  61. default:
  62. return r;
  63. }
  64. }
  65. };