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.

170 lines
5.5KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2012 Jonathan Moore Liles */
  3. /* Copyright (C) 2001-2005 by Colin Jones */
  4. /* */
  5. /* This program is free software; you can redistribute it and/or modify it */
  6. /* under the terms of the GNU General Public License as published by the */
  7. /* Free Software Foundation; either version 2 of the License, or (at your */
  8. /* option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  11. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  12. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  13. /* more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License along */
  16. /* with This program; see the file COPYING. If not,write to the Free Software */
  17. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  18. /*******************************************************************************/
  19. /* Taken from the "Gleam" FLTK scheme, as modified by prodatum */
  20. #include <FL/Fl.H>
  21. #include <FL/fl_draw.H>
  22. #include "FL/Fl_Theme.H"
  23. static void gleam_color(Fl_Color c)
  24. {
  25. if (Fl::draw_box_active())
  26. fl_color(c);
  27. else
  28. fl_color(fl_inactive(c));
  29. }
  30. static void frame_rect(int x, int y, int w, int h, Fl_Color bc)
  31. {
  32. // Draw the outline around the perimeter of the box
  33. fl_color(fl_color_average(FL_BLACK, FL_BACKGROUND_COLOR, .1));
  34. fl_line(x, y, x + w, y);
  35. fl_line(x + w, y, x + w, y + h);
  36. fl_line(x + w, y + h, x, y + h);
  37. fl_line(x, y + h, x, y);
  38. }
  39. static void shade_rect_up(int x, int y, int w, int h, Fl_Color bc)
  40. {
  41. // Draws the shiny
  42. float third = (float) h / 3;
  43. gleam_color(bc);
  44. fl_rectf(x, y, w, third + 1);
  45. //gleam_color(fl_color_average(bc, FL_WHITE, .90f));
  46. //fl_rectf(x, y, w, half + 1);
  47. float step_size = 0.10 / ((float) h - third);
  48. int j = 0;
  49. //step_size = (.1 / (float) half);
  50. //printf("1 / %i = %f \n", half, (1.0/half));
  51. /**
  52. * This loop generates the nice gradient at the bottom of the
  53. * widget
  54. **/
  55. for (float k = 1; k >= .90; k -= step_size)
  56. {
  57. j++;
  58. gleam_color(fl_color_average(bc, FL_WHITE, k));
  59. fl_line(x, y + j + third - 1, x + w - 1, y + j + third - 1);
  60. }
  61. }
  62. static void frame_rect_up(int x, int y, int w, int h, Fl_Color bc)
  63. {
  64. // Draw the outline around the perimeter of the box
  65. gleam_color(bc);
  66. fl_line(x, y, x + w, y); //Go across.
  67. fl_line(x, y + (h / 2), x, y + 1); //Go to top
  68. fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
  69. gleam_color(fl_darker(bc));
  70. fl_line(x, y + h, x + w, y + h); //Go across again!
  71. fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
  72. fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
  73. }
  74. static void frame_rect_down(int x, int y, int w, int h, Fl_Color bc)
  75. {
  76. // Draw the outline around the perimeter of the box
  77. gleam_color(fl_darker(bc));
  78. fl_line(x, y, x + w, y); //Go across.
  79. fl_line(x, y + (h / 2), x, y + 1); //Go to top
  80. fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
  81. //gleam_color(bc);
  82. fl_line(x, y + h, x + w, y + h); //Go across again!
  83. fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
  84. fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
  85. }
  86. static void shade_rect_down(int x, int y, int w, int h, Fl_Color bc)
  87. {
  88. gleam_color(bc);
  89. Fl_Color color = fl_color();
  90. fl_rectf(x, y, w, h);
  91. gleam_color(fl_color_average(bc, fl_darker(color), 0.65));
  92. fl_line(x, y + 1, x + w, y + 1);
  93. fl_line(x, y + 1, x, y + h - 2);
  94. gleam_color(fl_color_average(bc, fl_darker(color), 0.85));
  95. fl_line(x + 1, y + 2, x + w, y + 2);
  96. fl_line(x + 1, y + 2, x + 1, y + h - 2);
  97. }
  98. static void up_frame(int x, int y, int w, int h, Fl_Color c)
  99. {
  100. frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
  101. }
  102. static void up_box(int x, int y, int w, int h, Fl_Color c)
  103. {
  104. shade_rect_up(x + 1, y, w - 2, h - 1, c);
  105. frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
  106. //draw the inner rect.
  107. frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f));
  108. }
  109. static void down_frame(int x, int y, int w, int h, Fl_Color c)
  110. {
  111. frame_rect_down(x, y, w - 1, h - 1, fl_darker(c));
  112. }
  113. static void down_box(int x, int y, int w, int h, Fl_Color c)
  114. {
  115. shade_rect_down(x + 1, y, w - 2, h, c);
  116. down_frame(x, y, w, h, fl_darker(c));
  117. //draw the inner rect.
  118. //frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65));
  119. }
  120. static void
  121. init_theme ( void )
  122. {
  123. /* replace the gtk+ boxes... (is there a better way?) */
  124. Fl::set_boxtype( FL_UP_BOX, up_box, 2,2,4,4 );
  125. Fl::set_boxtype( FL_DOWN_BOX, down_box, 2,2,3,3 );
  126. Fl::set_boxtype( FL_THIN_UP_BOX, up_box, 2,2,3,3 );
  127. Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 2,2,3,3 );
  128. Fl::set_boxtype( FL_UP_FRAME, up_frame, 2,2,3,3 );
  129. Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 2,2,3,3 );
  130. Fl::set_boxtype( FL_ROUND_UP_BOX, up_box, 2,2,3,3 );
  131. Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_box, 2,2,3,3 );
  132. }
  133. void
  134. init_gleam_theme ( void )
  135. {
  136. Fl_Theme *t = new Fl_Theme( "Gleam", "", "", init_theme );
  137. Fl_Theme::add( t );
  138. }