From 9c758380115f01878036f2985f7f02146e3d860f Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Thu, 6 Dec 2001 18:12:35 +0000
Subject: [PATCH] Use FL_NO_BOX for check button and round button.

Clip Fl_Tiled_Image to the bounding box.

Draw Fl_Progress using the box.

Draw plastic box types right for narrow (but horizontal buttons)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1814 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
 CHANGES                 |  7 +++++++
 src/Fl_Check_Button.cxx |  4 ++--
 src/Fl_Progress.cxx     | 29 +++++++++++++++--------------
 src/Fl_Round_Button.cxx |  6 +++---
 src/Fl_Tiled_Image.cxx  |  8 ++++++--
 src/fl_plastic.cxx      | 10 ++++++----
 6 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/CHANGES b/CHANGES
index cc484bcdc..a28d7bca8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -58,6 +58,13 @@ CHANGES IN FLTK 1.1.0b7
 	  selection and text as Fl_Input_ and friends.
 	- Changed the default line scrolling in Fl_Text_Display
 	  to 3 lines for the mouse wheel and scrollbar arrows.
+	- Fl_Check_Button and Fl_Round_Button now use the
+	  FL_NO_BOX box type to show the background of the
+	  parent widget.
+	- Tweeked the plastic boxtype code to draw with the
+	  right shading for narrow, but horizontal buttons.
+	- Fl_Progress now shades the bounding box instead of
+	  drawing a polygon inside it.
 
 
 CHANGES IN FLTK 1.1.0b6
diff --git a/src/Fl_Check_Button.cxx b/src/Fl_Check_Button.cxx
index 5afafec40..e6e4e6006 100644
--- a/src/Fl_Check_Button.cxx
+++ b/src/Fl_Check_Button.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Check_Button.cxx,v 1.4.2.3.2.1 2001/08/04 16:43:31 easysw Exp $"
+// "$Id: Fl_Check_Button.cxx,v 1.4.2.3.2.2 2001/12/06 18:12:35 easysw Exp $"
 //
 // Check button widget for the Fast Light Tool Kit (FLTK).
 //
@@ -32,7 +32,7 @@
 
 Fl_Check_Button::Fl_Check_Button(int x, int y, int w, int h, const char *l)
 : Fl_Light_Button(x, y, w, h, l) {
-  box(FL_FLAT_BOX);
+  box(FL_NO_BOX);
   down_box(FL_DOWN_BOX);
   selection_color(FL_BLACK);
 }
diff --git a/src/Fl_Progress.cxx b/src/Fl_Progress.cxx
index 30300b70c..6672d218f 100644
--- a/src/Fl_Progress.cxx
+++ b/src/Fl_Progress.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Progress.cxx,v 1.1.2.2 2001/10/29 03:44:32 easysw Exp $"
+// "$Id: Fl_Progress.cxx,v 1.1.2.3 2001/12/06 18:12:35 easysw Exp $"
 //
 // Progress bar widget routines.
 //
@@ -51,6 +51,7 @@ void Fl_Progress::draw()
 {
   int	progress;	// Size of progress bar...
   int	bx, by, bw, bh;	// Box areas...
+  int	tx, tw;		// Temporary X + width
 
 
   // Get the box borders...
@@ -59,31 +60,31 @@ void Fl_Progress::draw()
   bw = Fl::box_dw(box());
   bh = Fl::box_dh(box());
 
-  // Draw the box...
-  draw_box(box(), x(), y(), w(), h(), color());
+  tx = x() + bx;
+  tw = w() - bw;
 
   // Draw the progress bar...
   if (maximum_ > minimum_)
-    progress = (int)((w() - bw) * (value_ - minimum_) /
-                                  (maximum_ - minimum_) + 0.5f);
+    progress = (int)(tw * (value_ - minimum_) / (maximum_ - minimum_) + 0.5f);
   else
     progress = 0;
 
+  // Draw the box...
   if (progress > 0)
   {
-    fl_clip(x() + bx, y() + by, w() - bw, h() - bh);
-
-    fl_color(active_r() ? color2() : fl_inactive(color2()));
-    fl_polygon(x() + bx, y() + by,
-               x() + bx, y() + h() - by,
-	       x() + 3 + progress - h() / 4, y() + h() - by,
-               x() + 1 + progress + h() / 4, y() + by);
+    fl_clip(x(), y(), progress + bx, h());
+      draw_box(box(), x(), y(), w(), h(), active_r() ? color2() : fl_inactive(color2()));
+    fl_pop_clip();
 
+    fl_clip(tx + progress, y(), w() - progress, h());
+      draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fl_inactive(color()));
     fl_pop_clip();
   }
+  else
+    draw_box(box(), x(), y(), w(), h(), color());
 
   // Finally, the label...
-  draw_label(x() + bx, y() + by, w() - bw, h() - bh);
+  draw_label(tx, y() + by, tw, h() - bh);
 }
 
 
@@ -104,5 +105,5 @@ Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l)
 
 
 //
-// End of "$Id: Fl_Progress.cxx,v 1.1.2.2 2001/10/29 03:44:32 easysw Exp $".
+// End of "$Id: Fl_Progress.cxx,v 1.1.2.3 2001/12/06 18:12:35 easysw Exp $".
 //
diff --git a/src/Fl_Round_Button.cxx b/src/Fl_Round_Button.cxx
index 6eef6b91e..1f83b3726 100644
--- a/src/Fl_Round_Button.cxx
+++ b/src/Fl_Round_Button.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Round_Button.cxx,v 1.4.2.3.2.1 2001/08/04 16:43:31 easysw Exp $"
+// "$Id: Fl_Round_Button.cxx,v 1.4.2.3.2.2 2001/12/06 18:12:35 easysw Exp $"
 //
 // Round button for the Fast Light Tool Kit (FLTK).
 //
@@ -32,11 +32,11 @@
 
 Fl_Round_Button::Fl_Round_Button(int x,int y,int w,int h, const char *l)
 : Fl_Light_Button(x,y,w,h,l) {
-  box(FL_FLAT_BOX);
+  box(FL_NO_BOX);
   down_box(FL_ROUND_DOWN_BOX);
   selection_color(FL_BLACK);
 }
 
 //
-// End of "$Id: Fl_Round_Button.cxx,v 1.4.2.3.2.1 2001/08/04 16:43:31 easysw Exp $".
+// End of "$Id: Fl_Round_Button.cxx,v 1.4.2.3.2.2 2001/12/06 18:12:35 easysw Exp $".
 //
diff --git a/src/Fl_Tiled_Image.cxx b/src/Fl_Tiled_Image.cxx
index fc652ca43..22cb2b86c 100644
--- a/src/Fl_Tiled_Image.cxx
+++ b/src/Fl_Tiled_Image.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.1 2001/11/24 18:07:57 easysw Exp $"
+// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.2 2001/12/06 18:12:35 easysw Exp $"
 //
 // Tiled image code for the Fast Light Tool Kit (FLTK).
 //
@@ -113,6 +113,8 @@ Fl_Tiled_Image::draw(int X,	// I - Starting X position
   if (W == 0) W = Fl::w();
   if (H == 0) H = Fl::h();
 
+  fl_clip(X, Y, W, H);
+
   X += cx;
   Y += cy;
 
@@ -125,9 +127,11 @@ Fl_Tiled_Image::draw(int X,	// I - Starting X position
   for (int yy = Y; yy < H; yy += image_->h())
     for (int xx = X; xx < W; xx += image_->w())
       image_->draw(xx, yy);
+
+  fl_pop_clip();
 }
 
 
 //
-// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.1 2001/11/24 18:07:57 easysw Exp $".
+// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.2 2001/12/06 18:12:35 easysw Exp $".
 //
diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx
index ed9eebb24..8d1b9cf84 100644
--- a/src/fl_plastic.cxx
+++ b/src/fl_plastic.cxx
@@ -1,9 +1,11 @@
 //
-// "$Id: fl_plastic.cxx,v 1.1.2.2 2001/12/01 13:59:50 easysw Exp $"
+// "$Id: fl_plastic.cxx,v 1.1.2.3 2001/12/06 18:12:35 easysw Exp $"
 //
 // "Plastic" drawing routines for the Fast Light Tool Kit (FLTK).
 //
-// These box types provide a 
+// These box types provide a cross between Aqua and KDE buttons; kindof
+// like translucent plastic buttons...
+//
 // Copyright 2001 by Michael Sweet.
 //
 // This library is free software; you can redistribute it and/or
@@ -64,7 +66,7 @@ static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc)
   int		clen = strlen(c);
 
 
-  if (w >= h)
+  if (h < (w * 2))
   {
     h ++;
     cmod = clen % h;
@@ -163,5 +165,5 @@ Fl_Boxtype define_FL_PLASTIC_UP_BOX() {
 
 
 //
-// End of "$Id: fl_plastic.cxx,v 1.1.2.2 2001/12/01 13:59:50 easysw Exp $".
+// End of "$Id: fl_plastic.cxx,v 1.1.2.3 2001/12/06 18:12:35 easysw Exp $".
 //
-- 
GitLab