Author: manolo
Date: 2012-12-19 00:50:34 -0800 (Wed, 19 Dec 2012)
New Revision: 9767
Log:
Mac OS text input: marked text is now underlined.
Modified:
branches/branch-1.3/src/Fl_Input_.cxx
branches/branch-1.3/src/Fl_Text_Display.cxx
Modified: branches/branch-1.3/src/Fl_Input_.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Input_.cxx 2012-12-18 16:06:56 UTC (rev
9766)
+++ branches/branch-1.3/src/Fl_Input_.cxx 2012-12-19 08:50:34 UTC (rev
9767)
@@ -339,10 +339,25 @@
int offset2;
if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
else offset2 = (int) strlen(buf);
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state
!= 0) text
+ if (Fl::compose_state) {
+ fl_color(textcolor());
+ }
+ else
+#endif
+ {
fl_color(selection_color());
fl_rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
fl_color(fl_contrast(textcolor(), selection_color()));
+ }
fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state
!= 0) text
+ if (Fl::compose_state) {
+ fl_color( fl_color_average(textcolor(), color(), 0.6) );
+ float width = fl_width(buf+offset1, offset2-offset1);
+ fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
+ }
+#endif
if (pp < e) {
fl_color(tc);
fl_draw(buf+offset2, (int) strlen(buf+offset2), x2,
(float)(Y+ypos+desc));
@@ -357,7 +372,7 @@
CONTINUE2:
// draw the cursor:
- if (Fl::focus() == this && selstart == selend &&
+ if (Fl::focus() == this && (Fl::compose_state || selstart == selend) &&
position() >= p-value() && position() <= e-value()) {
fl_color(cursor_color());
// cursor position may need to be recomputed (see STR #2486)
Modified: branches/branch-1.3/src/Fl_Text_Display.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Display.cxx 2012-12-18 16:06:56 UTC (rev
9766)
+++ branches/branch-1.3/src/Fl_Text_Display.cxx 2012-12-19 08:50:34 UTC (rev
9767)
@@ -1940,7 +1940,13 @@
fsize = styleRec->size;
if (style & PRIMARY_MASK) {
- if (Fl::focus() == (Fl_Widget*)this) background = selection_color();
+ if (Fl::focus() == (Fl_Widget*)this) {
+#ifdef __APPLE__
+ if (Fl::compose_state) background = color();// Mac OS: underline marked
text
+ else
+#endif
+ background = selection_color();
+ }
else background = fl_color_average(color(), selection_color(), 0.4f);
} else if (style & HIGHLIGHT_MASK) {
if (Fl::focus() == (Fl_Widget*)this) background =
fl_color_average(color(), selection_color(), 0.5f);
@@ -1972,6 +1978,12 @@
fl_push_clip(X, Y, toX - X, mMaxsize);
#endif
fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
+#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state
!= 0) text
+ if (Fl::compose_state && (style & PRIMARY_MASK)) {
+ fl_color( fl_color_average(foreground, background, 0.6) );
+ fl_line(X, Y + mMaxsize - 1, X + fl_width(string, nChars), Y + mMaxsize
- 1);
+ }
+#endif
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
fl_pop_clip();
#endif
@@ -3457,7 +3469,7 @@
// draw the text cursor
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)
- && !buffer()->primary_selection()->selected() &&
+ && (Fl::compose_state || !buffer()->primary_selection()->selected()) &&
mCursorOn && Fl::focus() == (Fl_Widget*)this ) {
fl_push_clip(text_area.x-LEFT_MARGIN,
text_area.y,
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit