Browse Source

Make Fl_Text_Display use the same defaults for the selection and background

colors as Fl_Input_, and use fl_contrast to get an appropriate text color.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1801 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Michael R Sweet 24 years ago
parent
commit
9e6b78b5ca
  1. 4
      CHANGES
  2. 27
      src/Fl_Text_Display.cxx

4
CHANGES

@ -39,6 +39,10 @@ CHANGES IN FLTK 1.1.0b7
- fl_draw() reset the text color under WIN32, causing - fl_draw() reset the text color under WIN32, causing
bitmaps to draw incorrectly. bitmaps to draw incorrectly.
- Fl::get_font_sizes() is now implemented under WIN32. - Fl::get_font_sizes() is now implemented under WIN32.
- Fl_Text_Display now uses the same default colors for
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.
CHANGES IN FLTK 1.1.0b6 CHANGES IN FLTK 1.1.0b6

27
src/Fl_Text_Display.cxx

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $" // "$Id: Fl_Text_Display.cxx,v 1.12.2.5 2001/12/03 20:14:30 easysw Exp $"
// //
// Copyright Mark Edel. Permission to distribute under the LGPL for // Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel. // the FLTK library granted by Mark Edel.
@ -71,6 +71,7 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
dragPos = dragType = dragging = 0; dragPos = dragType = dragging = 0;
display_insert_position_hint = 0; display_insert_position_hint = 0;
color(FL_WHITE, FL_SELECTION_COLOR);
box(FL_DOWN_FRAME); box(FL_DOWN_FRAME);
textsize(FL_NORMAL_SIZE); textsize(FL_NORMAL_SIZE);
textcolor(FL_BLACK); textcolor(FL_BLACK);
@ -1059,17 +1060,15 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
styleRec = &mStyleTable[ ( style & STYLE_LOOKUP_MASK ) - 'A' ]; styleRec = &mStyleTable[ ( style & STYLE_LOOKUP_MASK ) - 'A' ];
font = styleRec->font; font = styleRec->font;
size = styleRec->size; size = styleRec->size;
foreground = styleRec->color;
background = style & PRIMARY_MASK ? FL_SELECTION_COLOR : if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) ) {
style & HIGHLIGHT_MASK ? fl_contrast(textcolor(),color()) : color(); background = selection_color();
if ( foreground == background ) /* B&W kludge */ } else background = color();
foreground = textcolor();
} else if ( style & HIGHLIGHT_MASK ) { foreground = fl_contrast(styleRec->color, background);
foreground = textcolor(); } else if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) ) {
background = fl_contrast(textcolor(),color()); background = selection_color();
} else if ( style & PRIMARY_MASK ) { foreground = fl_contrast(textcolor(), background);
foreground = textcolor();
background = FL_SELECTION_COLOR;
} else { } else {
foreground = textcolor(); foreground = textcolor();
background = color(); background = color();
@ -1597,7 +1596,7 @@ void Fl_Text_Display::update_v_scrollbar() {
bar maximum value is chosen to generally represent the size of the whole bar maximum value is chosen to generally represent the size of the whole
buffer, with minor adjustments to keep the scroll bar widget happy */ buffer, with minor adjustments to keep the scroll bar widget happy */
mVScrollBar->value(mTopLineNum, mNVisibleLines, 1, mNBufferLines+2); mVScrollBar->value(mTopLineNum, mNVisibleLines, 1, mNBufferLines+2);
mVScrollBar->linesize(1); mVScrollBar->linesize(3);
} }
/* /*
@ -1956,5 +1955,5 @@ int Fl_Text_Display::handle(int event) {
// //
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $". // End of "$Id: Fl_Text_Display.cxx,v 1.12.2.5 2001/12/03 20:14:30 easysw Exp $".
// //

Loading…
Cancel
Save