Author: manolo
Date: 2012-12-19 08:06:32 -0800 (Wed, 19 Dec 2012)
New Revision: 9769
Log:
Mac OS text input system: marked text is now underlined.
Modified:
branches/branch-3.0/src/fltk3/Input_.cxx
branches/branch-3.0/src/fltk3/TextDisplay.cxx
Modified: branches/branch-3.0/src/fltk3/Input_.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Input_.cxx 2012-12-19 12:34:42 UTC (rev
9768)
+++ branches/branch-3.0/src/fltk3/Input_.cxx 2012-12-19 16:06:32 UTC (rev
9769)
@@ -351,10 +351,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 (fltk3::compose_state) {
+ fltk3::color(textcolor());
+ }
+ else
+#endif
+ {
fltk3::color(selection_color());
fltk3::rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
fltk3::color(fltk3::contrast(textcolor(), selection_color()));
+ }
fltk3::draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state
!= 0) text
+ if (fltk3::compose_state) {
+ fltk3::color( fltk3::color_average(textcolor(), color(), 0.6) );
+ float width = fltk3::width(buf+offset1, offset2-offset1);
+ fltk3::line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
+ }
+#endif
if (pp < e) {
fltk3::color(tc);
fltk3::draw(buf+offset2, (int)strlen(buf+offset2), x2,
(float)(Y+ypos+desc));
@@ -369,7 +384,7 @@
CONTINUE2:
// draw the cursor:
- if (fltk3::focus() == this && selstart == selend &&
+ if (fltk3::focus() == this && (fltk3::compose_state || selstart == selend)
&&
position() >= p-value() && position() <= e-value()) {
fltk3::color(cursor_color());
// cursor position may need to be recomputed (see STR #2486)
Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-12-19 12:34:42 UTC
(rev 9768)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-12-19 16:06:32 UTC
(rev 9769)
@@ -1950,7 +1950,13 @@
fsize = styleRec->size;
if (style & PRIMARY_MASK) {
- if (fltk3::focus() == (fltk3::Widget*)this) background =
selection_color();
+ if (fltk3::focus() == (fltk3::Widget*)this) {
+#ifdef __APPLE__
+ if (fltk3::compose_state) background = color();// Mac OS: underline
marked text
+ else
+#endif
+ background = selection_color();
+ }
else background = fltk3::color_average(color(), selection_color(), 0.4f);
} else if (style & HIGHLIGHT_MASK) {
if (fltk3::focus() == (fltk3::Widget*)this) background =
fltk3::color_average(color(), selection_color(), 0.5f);
@@ -1982,6 +1988,12 @@
fltk3::push_clip(X, Y, toX - X, mMaxsize);
#endif
fltk3::draw( string, nChars, X, Y + mMaxsize - fltk3::descent());
+#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state
!= 0) text
+ if (fltk3::compose_state && (style & PRIMARY_MASK)) {
+ fltk3::color( fltk3::color_average(foreground, background, 0.6) );
+ fltk3::line(X, Y + mMaxsize - 1, X + fltk3::width(string, nChars), Y +
mMaxsize - 1);
+ }
+#endif
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
fltk3::pop_clip();
#endif
@@ -3467,7 +3479,7 @@
// draw the text cursor
if (damage() & (fltk3::DAMAGE_ALL | fltk3::DAMAGE_SCROLL |
fltk3::DAMAGE_EXPOSE)
- && !buffer()->primary_selection()->selected() &&
+ && (fltk3::compose_state || !buffer()->primary_selection()->selected())
&&
mCursorOn && fltk3::focus() == (fltk3::Widget*)this ) {
fltk3::push_clip(text_area.x-LEFT_MARGIN,
text_area.y,
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit