Fixed the Fl_Input selection color when the user specifies a foreground or

background color on the command-line (patch from Bill).


git-svn-id: file:///fltk/svn/fltk/trunk@172 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
1998-12-29 14:05:13 +00:00
parent 434609ab0c
commit f17882c5cb
2 changed files with 13 additions and 9 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Input_.cxx,v 1.10 1998/12/02 15:39:31 mike Exp $" // "$Id: Fl_Input_.cxx,v 1.11 1998/12/29 14:05:12 mike Exp $"
// //
// Common input widget routines for the Fast Light Tool Kit (FLTK). // Common input widget routines for the Fast Light Tool Kit (FLTK).
// //
@@ -231,7 +231,8 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
} }
fl_clip(X, Y, W, H); fl_clip(X, Y, W, H);
Fl_Color color = active_r() ? textcolor() : inactive(textcolor()); Fl_Color color =
active_r() ? contrast(textcolor(),this->color()) : inactive(textcolor());
p = value(); p = value();
// visit each line and draw it: // visit each line and draw it:
@@ -727,5 +728,5 @@ Fl_Input_::~Fl_Input_() {
} }
// //
// End of "$Id: Fl_Input_.cxx,v 1.10 1998/12/02 15:39:31 mike Exp $". // End of "$Id: Fl_Input_.cxx,v 1.11 1998/12/29 14:05:12 mike Exp $".
// //
+9 -6
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_color.cxx,v 1.4 1998/12/07 13:36:24 mike Exp $" // "$Id: fl_color.cxx,v 1.5 1998/12/29 14:05:13 mike Exp $"
// //
// Color functions for the Fast Light Tool Kit (FLTK). // Color functions for the Fast Light Tool Kit (FLTK).
// //
@@ -272,12 +272,15 @@ void fl_color(Fl_Color i) {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Ways to modify the fltk colormap: // Ways to modify the fltk colormap:
// bright/dark is decided based on high bits of green:
#define bright(x) ((x)&0xc00000)
Fl_Color contrast(Fl_Color fg, Fl_Color bg) { Fl_Color contrast(Fl_Color fg, Fl_Color bg) {
// bright/dark is decided based on high bit of green: if (bright(fl_cmap[bg])) {
if (fl_cmap[bg] & 0x800000) { if (bright(fl_cmap[fg]))
if (fl_cmap[fg] & 0x800000) return FL_GRAY_RAMP; // black from gray ramp return FL_GRAY_RAMP; // black from gray ramp
} else { } else {
if (!(fl_cmap[fg] & 0x800000)) if (!bright(fl_cmap[fg]))
return (Fl_Color)(FL_COLOR_CUBE-1); // white from gray ramp return (Fl_Color)(FL_COLOR_CUBE-1); // white from gray ramp
} }
return fg; // this color is ok return fg; // this color is ok
@@ -331,5 +334,5 @@ void Fl::get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue) {
#endif #endif
// //
// End of "$Id: fl_color.cxx,v 1.4 1998/12/07 13:36:24 mike Exp $". // End of "$Id: fl_color.cxx,v 1.5 1998/12/29 14:05:13 mike Exp $".
// //