summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-05-14 09:07:09 +0000
committerBill Spitzak <spitzak@gmail.com>1999-05-14 09:07:09 +0000
commitce68c7386cf90ef28e7cc88a2a2449620f5703a4 (patch)
tree9e403c349001e07382365affc7aaaecdeca888ce
parent4e66f937698fd0792c17db2085d99ee5985c81ff (diff)
Colors in cmap changed to use 0xFF instead of 0xF4.
Drawing of scrollbars altered somewhat so that the box (if any) goes around the buttons, this seems to match the design that other toolkits use. Hope everybody likes this... This required internal changes to the Fl_Slider and Fl_Value_Slider as well but they should draw exactly the same. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@587 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Scrollbar.cxx53
-rw-r--r--src/Fl_Slider.cxx60
-rw-r--r--src/Fl_Value_Slider.cxx16
-rw-r--r--src/cmap.cxx9
-rw-r--r--src/fl_cmap.h14
5 files changed, 88 insertions, 64 deletions
diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx
index c873aba9f..c0e3276ca 100644
--- a/src/Fl_Scrollbar.cxx
+++ b/src/Fl_Scrollbar.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Scrollbar.cxx,v 1.7 1999/01/07 19:17:26 mike Exp $"
+// "$Id: Fl_Scrollbar.cxx,v 1.7.2.1 1999/05/14 09:07:07 bill Exp $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
@@ -132,45 +132,50 @@ int Fl_Scrollbar::handle(int event) {
}
void Fl_Scrollbar::draw() {
+ if (damage()&FL_DAMAGE_ALL) draw_box();
+ int X = x()+Fl::box_dx(box());
+ int Y = y()+Fl::box_dy(box());
+ int W = w()-Fl::box_dw(box());
+ int H = h()-Fl::box_dh(box());
if (horizontal()) {
- if (w() < 3*h()) {Fl_Slider::draw(); return;}
- Fl_Slider::draw(x()+h(), y(), w()-2*h(), h());
+ if (W < 3*H) {Fl_Slider::draw(X,Y,W,H); return;}
+ Fl_Slider::draw(X+H,Y,W-2*H,H);
if (damage()&FL_DAMAGE_ALL) {
draw_box((pushed_&1) ? down(slider()) : slider(),
- x(), y(), h(), h(), selection_color());
+ X, Y, H, H, selection_color());
draw_box((pushed_&2) ? down(slider()) : slider(),
- x()+w()-h(), y(), h(), h(), selection_color());
+ X+W-H, Y, H, H, selection_color());
if (active_r())
fl_color(labelcolor());
else
fl_color(inactive(labelcolor()));
- int w1 = (h()-1)|1; // use odd sizes only
- int Y = y()+w1/2;
- int W = w1/3;
- int X = x()+w1/2+W/2;
- fl_polygon(X-W, Y, X, Y-W, X, Y+W);
- X = x()+w()-(X-x())-1;
- fl_polygon(X+W, Y, X, Y+W, X, Y-W);
+ int w1 = (H-1)|1; // use odd sizes only
+ int Y1 = Y+w1/2;
+ int W1 = w1/3;
+ int X1 = X+w1/2+W1/2;
+ fl_polygon(X1-W1, Y1, X1, Y1-W1, X1, Y1+W1);
+ X1 = X+W-(X1-X)-1;
+ fl_polygon(X1+W1, Y1, X1, Y1+W1, X1, Y1-W1);
}
} else { // vertical
- if (h() < 3*w()) {Fl_Slider::draw(); return;}
- Fl_Slider::draw(x(), y()+w(), w(), h()-2*w());
+ if (H < 3*W) {Fl_Slider::draw(X,Y,W,H); return;}
+ Fl_Slider::draw(X,Y+W,W,H-2*W);
if (damage()&FL_DAMAGE_ALL) {
draw_box((pushed_&1) ? down(slider()) : slider(),
- x(), y(), w(), w(), selection_color());
+ X, Y, W, W, selection_color());
draw_box((pushed_&2) ? down(slider()) : slider(),
- x(), y()+h()-w(), w(), w(), selection_color());
+ X, Y+H-W, W, W, selection_color());
if (active_r())
fl_color(labelcolor());
else
fl_color(labelcolor() | 8);
- int w1 = (w()-1)|1; // use odd sizes only
- int X = x()+w1/2;
- int W = w1/3;
- int Y = y()+w1/2+W/2;
- fl_polygon(X, Y-W, X+W, Y, X-W, Y);
- Y = y()+h()-(Y-y())-1;
- fl_polygon(X, Y+W, X-W, Y, X+W, Y);
+ int w1 = (W-1)|1; // use odd sizes only
+ int X1 = X+w1/2;
+ int W1 = w1/3;
+ int Y1 = Y+w1/2+W1/2;
+ fl_polygon(X1, Y1-W1, X1+W1, Y1, X1-W1, Y1);
+ Y1 = Y+H-(Y1-Y)-1;
+ fl_polygon(X1, Y1+W1, X1-W1, Y1, X1+W1, Y1);
}
}
}
@@ -187,5 +192,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
}
//
-// End of "$Id: Fl_Scrollbar.cxx,v 1.7 1999/01/07 19:17:26 mike Exp $".
+// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.1 1999/05/14 09:07:07 bill Exp $".
//
diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx
index cc28e32b7..eb779565d 100644
--- a/src/Fl_Slider.cxx
+++ b/src/Fl_Slider.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Slider.cxx,v 1.8 1999/03/03 07:21:28 bill Exp $"
+// "$Id: Fl_Slider.cxx,v 1.8.2.1 1999/05/14 09:07:08 bill Exp $"
//
// Slider widget for the Fast Light Tool Kit (FLTK).
//
@@ -83,13 +83,15 @@ int Fl_Slider::scrollvalue(int p, int w, int t, int l) {
// actually it ranges from 0 to 1/(1-size).
void Fl_Slider::draw_bg(int x, int y, int w, int h) {
- draw_box(box(), x, y, w, h, color());
- int BW = Fl::box_dx(box());
+ if (!(damage()&FL_DAMAGE_ALL)) { // not a complete redraw
+ fl_color(color());
+ fl_rectf(x, y, w, h);
+ }
Fl_Color black = active_r() ? FL_BLACK : FL_INACTIVE_COLOR;
if (type() == FL_VERT_NICE_SLIDER) {
- draw_box(FL_THIN_DOWN_BOX, x+w/2-2, y+BW, 4, h-2*BW, black);
+ draw_box(FL_THIN_DOWN_BOX, x+w/2-2, y, 4, h, black);
} else if (type() == FL_HOR_NICE_SLIDER) {
- draw_box(FL_THIN_DOWN_BOX, x+BW, y+h/2-2, w-2*BW, 4, black);
+ draw_box(FL_THIN_DOWN_BOX, x, y+h/2-2, w, 4, black);
}
}
@@ -104,45 +106,44 @@ void Fl_Slider::draw(int x, int y, int w, int h) {
else if (val < 0.0) val = 0.0;
}
- int BW = Fl::box_dx(box());
- int W = (horizontal() ? w : h) - 2*BW;
+ int W = (horizontal() ? w : h);
int X, S;
if (type()==FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) {
S = int(val*W+.5);
- if (minimum()>maximum()) {S = W-S; X = W-S+BW;}
- else X = BW;
+ if (minimum()>maximum()) {S = W-S; X = W-S;}
+ else X = 0;
} else {
S = int(slider_size_*W+.5);
- int T = (horizontal() ? h : w)/2-BW+1;
+ int T = (horizontal() ? h : w)/2+1;
if (type()==FL_VERT_NICE_SLIDER || type()==FL_HOR_NICE_SLIDER) T += 4;
if (S < T) S = T;
- X = BW+int(val*(W-S)+.5);
+ X = int(val*(W-S)+.5);
}
int xsl, ysl, wsl, hsl;
if (horizontal()) {
xsl = x+X;
wsl = S;
- ysl = y+BW;
- hsl = h-2*BW;
+ ysl = y;
+ hsl = h;
} else {
ysl = y+X;
hsl = S;
- xsl = x+BW;
- wsl = w-2*BW;
+ xsl = x;
+ wsl = w;
}
if (damage()&FL_DAMAGE_ALL) { // complete redraw
draw_bg(x, y, w, h);
} else { // partial redraw, clip off new position of slider
- if (X > BW) {
+ if (X > 0) {
if (horizontal()) fl_clip(x, ysl, X, hsl);
else fl_clip(xsl, y, wsl, X);
draw_bg(x, y, w, h);
fl_pop_clip();
}
- if (X+S < W+BW) {
- if (horizontal()) fl_clip(xsl+wsl, ysl, x+w-BW-xsl-wsl, hsl);
- else fl_clip(xsl, ysl+hsl, wsl, y+h-BW-ysl-hsl);
+ if (X+S < W) {
+ if (horizontal()) fl_clip(xsl+wsl, ysl, x+w-xsl-wsl, hsl);
+ else fl_clip(xsl, ysl+hsl, wsl, y+h-ysl-hsl);
draw_bg(x, y, w, h);
fl_pop_clip();
}
@@ -166,7 +167,11 @@ void Fl_Slider::draw(int x, int y, int w, int h) {
}
void Fl_Slider::draw() {
- draw(x(), y(), w(), h());
+ if (damage()&FL_DAMAGE_ALL) draw_box();
+ draw(x()+Fl::box_dx(box()),
+ y()+Fl::box_dy(box()),
+ w()-Fl::box_dw(box()),
+ h()-Fl::box_dh(box()));
}
int Fl_Slider::handle(int event, int x, int y, int w, int h) {
@@ -176,11 +181,10 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
handle_push();
case FL_DRAG: {
if (slider_size() >= 1 || minimum()==maximum()) return 1;
- int BW = Fl::box_dx(box());
- int W = (horizontal() ? w : h) - 2*BW;
- int X = (horizontal() ? Fl::event_x()-x : Fl::event_y()-y) - BW;
+ int W = (horizontal() ? w : h);
+ int X = (horizontal() ? Fl::event_x()-x : Fl::event_y()-y);
int S = int(slider_size_*W+.5);
- int T = (horizontal() ? h : w)/2-BW+1;
+ int T = (horizontal() ? h : w)/2+1;
if (type()==FL_VERT_NICE_SLIDER || type()==FL_HOR_NICE_SLIDER) T += 4;
if (type()!=FL_HOR_FILL_SLIDER && type()!=FL_VERT_FILL_SLIDER) {
if (S < T) S = T;
@@ -226,9 +230,13 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
}
int Fl_Slider::handle(int event) {
- return handle(event, x(), y(), w(), h());
+ return handle(event,
+ x()+Fl::box_dx(box()),
+ y()+Fl::box_dy(box()),
+ w()-Fl::box_dw(box()),
+ h()-Fl::box_dh(box()));
}
//
-// End of "$Id: Fl_Slider.cxx,v 1.8 1999/03/03 07:21:28 bill Exp $".
+// End of "$Id: Fl_Slider.cxx,v 1.8.2.1 1999/05/14 09:07:08 bill Exp $".
//
diff --git a/src/Fl_Value_Slider.cxx b/src/Fl_Value_Slider.cxx
index cdef3c27b..eae63bd12 100644
--- a/src/Fl_Value_Slider.cxx
+++ b/src/Fl_Value_Slider.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Value_Slider.cxx,v 1.5 1999/01/07 19:17:28 mike Exp $"
+// "$Id: Fl_Value_Slider.cxx,v 1.5.2.1 1999/05/14 09:07:08 bill Exp $"
//
// Value slider widget for the Fast Light Tool Kit (FLTK).
//
@@ -44,7 +44,11 @@ void Fl_Value_Slider::draw() {
} else {
syy += 25; bhh = 25; shh -= 25;
}
- Fl_Slider::draw(sxx,syy,sww,shh);
+ if (damage()&FL_DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color());
+ Fl_Slider::draw(sxx+Fl::box_dx(box()),
+ syy+Fl::box_dy(box()),
+ sww-Fl::box_dw(box()),
+ shh-Fl::box_dh(box()));
draw_box(box(),bxx,byy,bww,bhh,color());
char buf[128];
format(buf);
@@ -60,9 +64,13 @@ int Fl_Value_Slider::handle(int event) {
} else {
syy += 25; shh -= 25;
}
- return Fl_Slider::handle(event,sxx,syy,sww,shh);
+ return Fl_Slider::handle(event,
+ sxx+Fl::box_dx(box()),
+ syy+Fl::box_dy(box()),
+ sww-Fl::box_dw(box()),
+ shh-Fl::box_dh(box()));
}
//
-// End of "$Id: Fl_Value_Slider.cxx,v 1.5 1999/01/07 19:17:28 mike Exp $".
+// End of "$Id: Fl_Value_Slider.cxx,v 1.5.2.1 1999/05/14 09:07:08 bill Exp $".
//
diff --git a/src/cmap.cxx b/src/cmap.cxx
index aebca3418..2a11184db 100644
--- a/src/cmap.cxx
+++ b/src/cmap.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: cmap.cxx,v 1.4 1999/01/07 19:17:33 mike Exp $"
+// "$Id: cmap.cxx,v 1.4.2.1 1999/05/14 09:07:08 bill Exp $"
//
// Colormap generation program for the Fast Light Tool Kit (FLTK).
//
@@ -36,7 +36,10 @@
// fltk programs more friendly on color-adjusted screens. If you want
// pure colors you should get them out of the colormap.
-#define III 244 // maximum intensity of the basic colors
+//#define III 244 // maximum intensity of the basic colors
+
+// that results in errors and unshared colormap entries, so full intensity:
+#define III 255 // maximum intensity of the basic colors
static short cmap[256][3] = {
// 3-bit colormap:
@@ -145,5 +148,5 @@ int main() {
}
//
-// End of "$Id: cmap.cxx,v 1.4 1999/01/07 19:17:33 mike Exp $".
+// End of "$Id: cmap.cxx,v 1.4.2.1 1999/05/14 09:07:08 bill Exp $".
//
diff --git a/src/fl_cmap.h b/src/fl_cmap.h
index 934172440..3f092dd0d 100644
--- a/src/fl_cmap.h
+++ b/src/fl_cmap.h
@@ -1,11 +1,11 @@
0x00000000,
- 0xf4000000,
- 0x00f40000,
- 0xf4f40000,
- 0x0000f400,
- 0xf400f400,
- 0x00f4f400,
- 0xf4f4f400,
+ 0xff000000,
+ 0x00ff0000,
+ 0xffff0000,
+ 0x0000ff00,
+ 0xff00ff00,
+ 0x00ffff00,
+ 0xffffff00,
0x55555500,
0xc6717100,
0x71c67100,