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.

78 lines
2.8KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2012 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 "Fl_Value_SliderX.H"
  19. #include <FL/Fl.H>
  20. #include <FL/fl_draw.H>
  21. #include <math.h>
  22. /**
  23. Creates a new Fl_Value_SliderX widget using the given
  24. position, size, and label string. The default boxtype is FL_DOWN_BOX.
  25. */
  26. Fl_Value_SliderX::Fl_Value_SliderX(int X, int Y, int W, int H, const char*l)
  27. : Fl_SliderX(X,Y,W,H,l) {
  28. step(1,100);
  29. textfont_ = FL_HELVETICA;
  30. textsize_ = 10;
  31. textcolor_ = FL_FOREGROUND_COLOR;
  32. }
  33. void Fl_Value_SliderX::draw() {
  34. int sxx = x(), syy = y(), sww = w(), shh = h();
  35. int bxx = x(), byy = y(), bww = w(), bhh = h();
  36. if (horizontal()) {
  37. bww = 35; sxx += 35; sww -= 35;
  38. } else {
  39. syy += 25; bhh = 25; shh -= 25;
  40. }
  41. if (damage()&FL_DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color());
  42. Fl_SliderX::draw(sxx+Fl::box_dx(box()),
  43. syy+Fl::box_dy(box()),
  44. sww-Fl::box_dw(box()),
  45. shh-Fl::box_dh(box()));
  46. draw_box(box(),bxx,byy,bww,bhh,color());
  47. char buf[128];
  48. format(buf);
  49. fl_font(textfont(), textsize());
  50. fl_color(active_r() ? textcolor() : fl_inactive(textcolor()));
  51. fl_draw(buf, bxx, byy, bww, bhh, FL_ALIGN_CLIP);
  52. }
  53. int Fl_Value_SliderX::handle(int event) {
  54. if (event == FL_PUSH && Fl::visible_focus()) {
  55. Fl::focus(this);
  56. redraw();
  57. }
  58. int sxx = x(), syy = y(), sww = w(), shh = h();
  59. if (horizontal()) {
  60. sxx += 35; sww -= 35;
  61. } else {
  62. syy += 25; shh -= 25;
  63. }
  64. return Fl_SliderX::handle(event,
  65. sxx+Fl::box_dx(box()),
  66. syy+Fl::box_dy(box()),
  67. sww-Fl::box_dw(box()),
  68. shh-Fl::box_dh(box()));
  69. }