From daccac9672a336b7eae79a2a4efc6c877442f132 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 24 Aug 2003 13:09:06 +0000 Subject: Fl_Text_Display/Editor did not disable the current selection when focus was shifted to another widget (STR #131) Fl_Choice didn't use the normal focus box when the plastic scheme was in use (STR #129) Fl_Text_Editor didn't use selection_color() consistently (STR #130) The fltk_forms, fltk_gl, and fltk_images DSO's and HP-UX shared libraries are now linked against the fltk shared library to provide complete dependency resolution (STR #118) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Text_Display.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/Fl_Text_Display.cxx') diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 0f9211f88..21a68a4aa 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.45 2003/05/04 22:29:01 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.46 2003/08/24 13:09:06 easysw Exp $" // // Copyright 2001-2003 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -1580,12 +1580,12 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX, font = styleRec->font; fsize = styleRec->size; - if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) ) { + if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) && Fl::focus() == this) { background = selection_color(); } else background = color(); foreground = fl_contrast(styleRec->color, background); - } else if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) ) { + } else if ( style & (HIGHLIGHT_MASK | PRIMARY_MASK) && Fl::focus() == this ) { background = selection_color(); foreground = fl_contrast(textcolor(), background); } else { @@ -1628,11 +1628,14 @@ void Fl_Text_Display::clear_rect( int style, int X, int Y, if ( width == 0 ) return; - if ( style & HIGHLIGHT_MASK ) { + if ( Fl::focus() != this ) { + fl_color( color() ); + fl_rectf( X, Y, width, height ); + } else if ( style & HIGHLIGHT_MASK ) { fl_color( fl_contrast(textcolor(), color()) ); fl_rectf( X, Y, width, height ); } else if ( style & PRIMARY_MASK ) { - fl_color( FL_SELECTION_COLOR ); + fl_color( selection_color() ); fl_rectf( X, Y, width, height ); } else { fl_color( color() ); @@ -3042,6 +3045,12 @@ int Fl_Text_Display::handle(int event) { case FL_MOUSEWHEEL: return mVScrollBar->handle(event); + + case FL_FOCUS: + case FL_UNFOCUS: + if (buffer()->primary_selection()->start() != + buffer()->primary_selection()->end()) redraw(); // Redraw selections... + break; } return 0; @@ -3049,5 +3058,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.45 2003/05/04 22:29:01 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.46 2003/08/24 13:09:06 easysw Exp $". // -- cgit v1.2.3