Non reinvents the DAW. Powerful enough to form a complete studio, fast and light enough to run on low-end hardware like the eeePC or Raspberry Pi, and so reliable that it can be used live https://non.tuxfamily.org/
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.

112 lines
3.2KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2013 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_DialX.H"
  19. #include <FL/Fl.H>
  20. #include <FL/fl_draw.H>
  21. void
  22. Fl_DialX::draw ( void )
  23. {
  24. int X,Y,S;
  25. {
  26. int ox, oy, ww, hh, side;
  27. ox = x();
  28. oy = y();
  29. ww = w();
  30. hh = h();
  31. if (ww > hh)
  32. {
  33. side = hh;
  34. ox = ox + (ww - side) / 2;
  35. }
  36. else
  37. {
  38. side = ww;
  39. oy = oy + (hh - side) / 2;
  40. }
  41. side = w() > h() ? hh : ww;
  42. X = ox;
  43. Y = oy;
  44. S = side;
  45. }
  46. draw_box();
  47. draw_label();
  48. double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();
  49. fl_draw_box( box(), X, Y, S, S, color() );
  50. /* shrink a bit */
  51. int OX = x();
  52. int OY = y();
  53. X += S / 8;
  54. Y += S / 8;
  55. int OS = S;
  56. S -= S / 4;
  57. fl_line_style( FL_SOLID, S / 12 );
  58. /* background arc */
  59. fl_color( fl_darker( color() ) );
  60. fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() );
  61. /* foreground arc */
  62. fl_color( selection_color() );
  63. fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle );
  64. fl_line_style( FL_SOLID, 0 );
  65. if ( active_r() )
  66. {
  67. int W = OS;
  68. int H = OS;
  69. fl_push_matrix();
  70. fl_translate(OX+W/2, OY+H/2);
  71. fl_scale(W, H);
  72. fl_rotate(310+angle);
  73. fl_color( fl_color_add_alpha( FL_WHITE, 127 ));
  74. fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon();
  75. fl_color( FL_WHITE );
  76. fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon();
  77. fl_pop_matrix();
  78. }
  79. fl_color( fl_contrast( labelcolor(), color() ) );
  80. if ( Fl::belowmouse() == this )
  81. {
  82. char s[10];
  83. fl_font( FL_HELVETICA, 10 );
  84. snprintf( s, sizeof( s ), "%.1f", value() );
  85. fl_color( FL_FOREGROUND_COLOR );
  86. fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER );
  87. }
  88. }