diff --git a/CHANGES b/CHANGES index 23553457b..cb1bc3e7a 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ CHANGES IN FLTK 1.1.7 startup (STR #886) - Selected tabs are now drawn slightly larger than unselected tabs so they stand out more (STR #882) + - Round Plastic boxes now draw round (STR #841) - FL_PLASTIC_DOWN_BOX drew with artifacts (STR #852) - Changed initializations on WIN32 (STR #862) - Fl_Preferences::getUserdataPath() didn't work for diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx index af87941ad..bac2c7c94 100644 --- a/src/Fl_get_system_colors.cxx +++ b/src/Fl_get_system_colors.cxx @@ -302,7 +302,7 @@ int Fl::reload_scheme() { set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_THIN_UP_BOX); set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_THIN_DOWN_BOX); set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_ROUND_UP_BOX); - set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_ROUND_UP_BOX); + set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_ROUND_DOWN_BOX); } else { // Use the standard FLTK look-n-feel... if (scheme_bg_) { diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx index e240c68fc..6e8c429b6 100644 --- a/src/fl_plastic.cxx +++ b/src/fl_plastic.cxx @@ -103,18 +103,52 @@ static void frame_round(int x, int y, int w, int h, const char *c, Fl_Color bc) uchar *g = fl_gray_ramp(); int b = strlen(c) / 4 + 1; - for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2) - { - // Draw arcs around the perimeter of the button, 4 colors per - // circuit. - fl_color(shade_color(g[*c++], bc)); - fl_arc(x, y, w, h, 45.0, 135.0); - fl_color(shade_color(g[*c++], bc)); - fl_arc(x, y, w, h, 315.0, 405.0); - fl_color(shade_color(g[*c++], bc)); - fl_arc(x, y, w, h, 225.0, 315.0); - fl_color(shade_color(g[*c++], bc)); - fl_arc(x, y, w, h, 135.0, 225.0); + if (w==h) { + for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2) + { + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, h, 45.0, 135.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, h, 315.0, 405.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, h, 225.0, 315.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, h, 135.0, 225.0); + } + } else if (w>h) { + int d = h/2; + for (; b > 1; d--, b --, x ++, y ++, w -= 2, h -= 2) + { + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, h, h, 90.0, 135.0); + fl_xyline(x+d, y, x+w-d); + fl_arc(x+w-h, y, h, h, 45.0, 90.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x+w-h, y, h, h, 315.0, 405.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x+w-h, y, h, h, 270.0, 315.0); + fl_xyline(x+d, y+h, x+w-d); + fl_arc(x, y, h, h, 225.0, 270.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, h, h, 135.0, 225.0); + } + } else if (w 1; d--, b --, x ++, y ++, w -= 2, h -= 2) + { + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, w, 45.0, 135.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y, w, w, 0.0, 45.0); + fl_yxline(x+w, y+d, y+h-d); + fl_arc(x, y+h-w, w, w, 315.0, 360.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y+h-w, w, w, 225.0, 315.0); + fl_color(shade_color(g[*c++], bc)); + fl_arc(x, y+h-w, w, w, 180.0, 225.0); + fl_yxline(x, y+d, y+h-d); + fl_arc(x, y, w, w, 135.0, 180.0); + } } } @@ -193,48 +227,56 @@ static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) { static void shade_round(int x, int y, int w, int h, const char *c, Fl_Color bc) { uchar *g = fl_gray_ramp(); - int i, j, k; + int i, j; int clen = strlen(c) - 1; int chalf = clen / 2; int cstep = 1; - static const int kvals_table[] = { 21, 16, 11, 8, 5, 3, 2, 1 }; - const int *kvals = kvals_table + 8 - chalf; - if (clen >= h) cstep = 2; - for (i = 0, j = 0; j < chalf; i ++, j += cstep) { - // Indent k inside a circle... - k = kvals[i]; - - // Draw the top line and points... - fl_color(shade_color(g[c[i]], bc)); - fl_xyline(x + k, y + i, x + w - k); - - fl_color(shade_color(g[c[i] - 2], bc)); - fl_point(x + k - 1, y + i + 1); - fl_point(x + k - 2, y + i + 2); - fl_point(x + w - k, y + i + 1); - fl_point(x + w - k - 1, y + i + 2); - - // Draw the bottom line and points... - fl_color(shade_color(g[c[clen - i]], bc)); - fl_xyline(x + k, y + h - i, x + w - k); - - fl_color(shade_color(g[c[clen - i] - 2], bc)); - fl_point(x + k - 1, y + h - i); - fl_point(x + k - 2, y + h - i - 1); - fl_point(x + w - k, y + h - i); - fl_point(x + w - k - 1, y + h - i - 1); + if (w>h) { + int d = h/2; + const int na = 8; + for (i=0; iresizable(window); window->end(); -// window->show(argc,argv); + //window->show(argc,argv); window->show(); return Fl::run(); }