diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-12-14 16:48:13 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-12-14 16:48:13 +0000 |
| commit | 5c3b2f74bc97b5ffdd2a7834c47b285b2f84aaee (patch) | |
| tree | a36299c3c5156078de8b007e6515c590787262a3 | |
| parent | ce129e16208dd7271549db64fe778a0ae3266f5e (diff) | |
More tweeking of plastic boxtypes.
Redraw parent if child button loses focus and is using FL_NO_BOX.
Fix test/Makefile to build mandelbrot and shiny demos right.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1844 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 15 | ||||
| -rw-r--r-- | FL/Fl.H | 5 | ||||
| -rw-r--r-- | src/Fl_Button.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_Widget.cxx | 6 | ||||
| -rw-r--r-- | src/fl_boxtype.cxx | 15 | ||||
| -rw-r--r-- | src/fl_plastic.cxx | 150 | ||||
| -rw-r--r-- | test/Makefile | 12 |
7 files changed, 109 insertions, 101 deletions
@@ -1,3 +1,18 @@ +CHANGES IN FLTK 1.1.0b8 + + - Cosmetic changes to plastic boxtypes. Now look much + better for large areas and the sides now have a much + greater "3D" feeling to them. + - Added new Fl::draw_box_active() method so that + boxtypes can find out if the widget they are drawing + for is active or not. + - Fl_Button and its subclasses did not redraw the parent + when the boxtype was FL_NO_BOX and they lost keyboard + focus (the parent redraw clears the focus box.) + - Fixed the example program makefile - wasn't building + the mandelbrot and shiny demos right. + + CHANGES IN FLTK 1.1.0b7 - More documentation updates... @@ -1,5 +1,5 @@ // -// "$Id: Fl.H,v 1.8.2.11.2.8 2001/12/11 16:03:11 easysw Exp $" +// "$Id: Fl.H,v 1.8.2.11.2.9 2001/12/14 16:48:13 easysw Exp $" // // Main header file for the Fast Light Tool Kit (FLTK). // @@ -202,6 +202,7 @@ public: static FL_EXPORT int box_dy(Fl_Boxtype); static FL_EXPORT int box_dw(Fl_Boxtype); static FL_EXPORT int box_dh(Fl_Boxtype); + static FL_EXPORT int draw_box_active(); // back compatability: static FL_EXPORT void set_abort(void (*f)(const char*,...)) {fatal = f;} @@ -233,5 +234,5 @@ public: #endif // !Fl_H // -// End of "$Id: Fl.H,v 1.8.2.11.2.8 2001/12/11 16:03:11 easysw Exp $". +// End of "$Id: Fl.H,v 1.8.2.11.2.9 2001/12/14 16:48:13 easysw Exp $". // diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index 4b26865c9..ae4ddcadf 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Button.cxx,v 1.4.2.6.2.6 2001/12/11 16:03:11 easysw Exp $" +// "$Id: Fl_Button.cxx,v 1.4.2.6.2.7 2001/12/14 16:48:13 easysw Exp $" // // Button widget for the Fast Light Tool Kit (FLTK). // @@ -108,7 +108,8 @@ int Fl_Button::handle(int event) { case FL_FOCUS : case FL_UNFOCUS : if (Fl::visible_focus()) { - redraw(); + if (event == FL_UNFOCUS && box() == FL_NO_BOX) parent()->redraw(); + else redraw(); return 1; } else return 0; case FL_KEYBOARD : @@ -138,5 +139,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l) } // -// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.6 2001/12/11 16:03:11 easysw Exp $". +// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.7 2001/12/14 16:48:13 easysw Exp $". // diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx index 717f75e84..6092229c8 100644 --- a/src/Fl_Widget.cxx +++ b/src/Fl_Widget.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.9 2001/12/07 16:28:38 easysw Exp $" +// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.10 2001/12/14 16:48:13 easysw Exp $" // // Base widget class for the Fast Light Tool Kit (FLTK). // @@ -152,7 +152,7 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const { // every other pixel around the focus area... // // Also, QuickDraw (MacOS) does not support line styles specifically, - // and the hack we use in fl_line_style() will not horizontal lines + // and the hack we use in fl_line_style() will not draw horizontal lines // on odd-numbered rows... int i, xx, yy; @@ -248,5 +248,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const { } // -// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.9 2001/12/07 16:28:38 easysw Exp $". +// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.10 2001/12/14 16:48:13 easysw Exp $". // diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index 7718a7171..4aa8f9377 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.4 2001/11/28 21:37:35 easysw Exp $" +// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.5 2001/12/14 16:48:13 easysw Exp $" // // Box drawing code for the Fast Light Tool Kit (FLTK). // @@ -49,6 +49,9 @@ static uchar inactive_ramp[24] = { 49, 49, 50, 50, 51, 51, 52, 52}; static int draw_it_active = 1; + +int Fl::draw_box_active() { return draw_it_active; } + uchar *fl_gray_ramp() {return (draw_it_active?active_ramp:inactive_ramp)-'A';} void fl_frame(const char* s, int x, int y, int w, int h) { @@ -219,10 +222,10 @@ static struct { {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX, {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, - {fl_up_box, 3,3,5,5,0}, // _FL_PLASTIC_UP_BOX, - {fl_down_box, 3,3,5,5,0}, // _FL_PLASTIC_DOWN_BOX, - {fl_up_frame, 3,3,5,5,0}, // _FL_PLASTIC_UP_FRAME, - {fl_down_frame, 3,3,5,5,0}, // _FL_PLASTIC_DOWN_FRAME, + {fl_up_box, 4,4,7,6,0}, // _FL_PLASTIC_UP_BOX, + {fl_down_box, 4,4,7,6,0}, // _FL_PLASTIC_DOWN_BOX, + {fl_up_frame, 4,4,7,6,0}, // _FL_PLASTIC_UP_FRAME, + {fl_down_frame, 4,4,7,6,0}, // _FL_PLASTIC_DOWN_FRAME, {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 @@ -288,5 +291,5 @@ const { } // -// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.4 2001/11/28 21:37:35 easysw Exp $". +// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.5 2001/12/14 16:48:13 easysw Exp $". // diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx index c4d8605bf..4c5fbdeaf 100644 --- a/src/fl_plastic.cxx +++ b/src/fl_plastic.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_plastic.cxx,v 1.1.2.6 2001/12/14 03:45:37 easysw Exp $" +// "$Id: fl_plastic.cxx,v 1.1.2.7 2001/12/14 16:48:13 easysw Exp $" // // "Plastic" drawing routines for the Fast Light Tool Kit (FLTK). // @@ -38,15 +38,17 @@ extern uchar *fl_gray_ramp(); inline Fl_Color shade_color(uchar gc, Fl_Color bc) { - return fl_color_average((Fl_Color)gc, bc, 0.67f); + return fl_color_average((Fl_Color)gc, bc, 0.75f); } static void shade_frame(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 (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --) + for (x += b, y += b, w -= 2 * b + 1, h -= 2 * b + 1; b > 1; b --) { + // Draw lines around the perimeter of the button, 4 colors per + // circuit. fl_color(shade_color(g[*c++], bc)); fl_line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h); fl_color(shade_color(g[*c++], bc)); @@ -58,87 +60,88 @@ static void shade_frame(int x, int y, int w, int h, const char *c, Fl_Color bc) } } + static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) { uchar *g = fl_gray_ramp(); - int xoff, yoff; - int cmod, cerr; - int clen = strlen(c); + int i, j; + int clen = strlen(c) - 1; + int chalf = clen / 2; + int cstep = 1; + + if (h < (w * 2)) { + // Horizontal shading... + if (clen >= h) cstep = 2; + + for (i = 0, j = 0; j < chalf; i ++, j += cstep) { + // Draw the top line and points... + fl_color(shade_color(g[c[i]], bc)); + fl_xyline(x + 1, y + i, x + w - 1); + + fl_color(shade_color(g[c[i] - 8], bc)); + fl_point(x, y + i); + fl_point(x + w - 1, y + i); + + // Draw the bottom line and points... + fl_color(shade_color(g[c[clen - i]], bc)); + fl_xyline(x + 1, y + h - 1 - i, x + w - 1); + + fl_color(shade_color(g[c[clen - i] - 8], bc)); + fl_point(x, y + h - i); + fl_point(x + w - 1, y + h - i); + } + // Draw the interior and sides... + i = chalf / cstep; - if (h < (w * 2)) - { - h ++; - cmod = clen % h; - cerr = 0; + fl_color(shade_color(g[c[chalf]], bc)); + fl_rectf(x + 1, y + i, w - 2, h - 2 * i); - fl_color(shade_color(g[*c], bc)); + fl_color(shade_color(g[c[chalf] - 8], bc)); + fl_yxline(x, y + i, y + h - i); + fl_yxline(x + w - 1, y + i, y + h - i); + } else { + // Vertical shading... + if (clen >= w) cstep = 2; - for (yoff = 0; yoff < h; yoff ++) - { - fl_xyline(x, y + yoff, x + w - 1); + for (i = 0, j = 0; j < chalf; i ++, j += cstep) { + // Draw the left line and points... + fl_color(shade_color(g[c[i]], bc)); + fl_yxline(x + i, y + 1, y + h - 1); - cerr += cmod; - if (cerr >= h) - { - cerr -= h; - c ++; + fl_color(shade_color(g[c[i] - 8], bc)); + fl_point(x + i, y); + fl_point(x + i, y + h - 1); - fl_color(shade_color(g[*c], bc)); - } - } - } - else - { - w ++; - cmod = clen % w; - cerr = 0; + // Draw the right line and points... + fl_color(shade_color(g[c[clen - i]], bc)); + fl_yxline(x + w - 1 - i, y + 1, y + h - 1); - fl_color(shade_color(g[*c], bc)); + fl_color(shade_color(g[c[clen - i] - 8], bc)); + fl_point(x + w - 1 - i, y); + fl_point(x + w - 1 - i, y + h - 1); + } - for (xoff = 0; xoff < w; xoff ++) - { - fl_yxline(x + xoff, y, y + h - 1); + // Draw the interior, top, and bottom... + i = chalf / cstep; - cerr += cmod; - if (cerr >= w) - { - cerr -= w; - c ++; + fl_color(shade_color(g[c[chalf]], bc)); + fl_rectf(x + i, y + 1, w - 2 * i, h - 2); - fl_color(shade_color(g[*c], bc)); - } - } + fl_color(shade_color(g[c[chalf] - 8], bc)); + fl_xyline(x + i, y, x + w - i); + fl_xyline(x + i, y + h - 1, x + w - i); } } static void up_frame(int x, int y, int w, int h, Fl_Color c) { - shade_frame(x, y, w, h, "RRSSDLNN", c); + shade_frame(x, y, w, h, "KLOPMNNO", c); } static void up_box(int x, int y, int w, int h, Fl_Color c) { - if (w > 30 && h > 30) - { - uchar *g = fl_gray_ramp(); - if ( h<(w*2) ) - { - shade_rect(x + 2, y + 2, w - 4, 9, "VTR", c); - fl_color(shade_color(g['P'], c)); - fl_rectf(x + 2, y + 11, w - 4, h - 25); - shade_rect(x + 2, y + h - 14, w - 4, 12, "RTVXX", c); - } - else - { - shade_rect(x + 2, y + 2, 9, h-4, "VTR", c); - fl_color(shade_color(g['P'], c)); - fl_rectf(x + 11, y + 2, w - 25, h - 4); - shade_rect(x + w - 14, y + 2, 12, h-4, "RTVXX", c); - } - } - else - shade_rect(x + 2, y + 2, w - 4, h - 4, "VTRPPRTVXX", c); + shade_rect(x + 2, y + 2, w - 4, h - 4, "QTXWVUTRSTUVWXS", c); up_frame(x, y, w, h, c); } @@ -150,26 +153,7 @@ static void down_frame(int x, int y, int w, int h, Fl_Color c) { static void down_box(int x, int y, int w, int h, Fl_Color c) { - if (w > 30 && h > 30) - { - uchar *g = fl_gray_ramp(); - if ( w>=h ) - { - shade_rect(x + 2, y + 2, w - 4, 11, "STUV", c); - fl_color(shade_color(g['W'], c)); - fl_rectf(x + 2, y + 13, w - 4, h - 21); - shade_rect(x + 2, y + h - 8, w - 4, 6, "VT", c); - } - else - { - shade_rect(x + 2, y + 2, 11, h-4, "STUV", c); - fl_color(shade_color(g['W'], c)); - fl_rectf(x + 13, y + 2, w - 21, h - 4); - shade_rect(x + w - 8, y + 2, 6, h-4, "VT", c); - } - } - else - shade_rect(x + 2, y + 2, w - 4, h - 4, "STUVWWWWVT", c); + shade_rect(x + 2, y + 2, w - 4, h - 4, "STUVWWWVT", c); down_frame(x, y, w, h, c); } @@ -189,5 +173,5 @@ Fl_Boxtype define_FL_PLASTIC_UP_BOX() { // -// End of "$Id: fl_plastic.cxx,v 1.1.2.6 2001/12/14 03:45:37 easysw Exp $". +// End of "$Id: fl_plastic.cxx,v 1.1.2.7 2001/12/14 16:48:13 easysw Exp $". // diff --git a/test/Makefile b/test/Makefile index 0d41ca152..8fb239a70 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.19.2.7.2.18 2001/12/12 21:33:34 easysw Exp $" +# "$Id: Makefile,v 1.19.2.7.2.19 2001/12/14 16:48:13 easysw Exp $" # # Test/example program makefile for the Fast Light Tool Kit (FLTK). # @@ -181,10 +181,12 @@ keyboard$(EXEEXT): keyboard.o $(POSTBUILD) keyboard.o: keyboard.cxx keyboard_ui.cxx -mandelbrot$(EXEEXT): mandelbrot.o mandelbrot_ui.o +mandelbrot$(EXEEXT): mandelbrot.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) mandelbrot.o $(LINKFLTK) $(LDLIBS) -o $@ $(POSTBUILD) +mandlebrot.o: mandelbrot.cxx mandelbrot_ui.cxx + pixmap_browser$(EXEEXT): pixmap_browser.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) pixmap_browser.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) @@ -219,10 +221,12 @@ gl_overlay$(EXEEXT): gl_overlay.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) gl_overlay.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ $(POSTBUILD) -shiny$(EXEEXT): shiny.o shiny_panel.o +shiny$(EXEEXT): shiny.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) shiny.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ $(POSTBUILD) +shiny.o: shiny.cxx shiny_panel.cxx + shape$(EXEEXT): shape.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ @@ -249,5 +253,5 @@ uninstall: @echo Nothing to uninstall in test directory. # -# End of "$Id: Makefile,v 1.19.2.7.2.18 2001/12/12 21:33:34 easysw Exp $". +# End of "$Id: Makefile,v 1.19.2.7.2.19 2001/12/14 16:48:13 easysw Exp $". # |
