Aric Stewart : usp10: Draw selected glyphs in ScriptStringOut.

Alexandre Julliard julliard at winehq.org
Mon Aug 29 11:28:40 CDT 2011


Module: wine
Branch: master
Commit: 49dc1570b77dfa9f8a709d960af8be95284e5587
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=49dc1570b77dfa9f8a709d960af8be95284e5587

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Aug 29 06:50:05 2011 -0500

usp10: Draw selected glyphs in ScriptStringOut.

---

 dlls/usp10/Makefile.in |    2 +-
 dlls/usp10/usp10.c     |   44 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/dlls/usp10/Makefile.in b/dlls/usp10/Makefile.in
index 80c93d9..0013221 100644
--- a/dlls/usp10/Makefile.in
+++ b/dlls/usp10/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = usp10.dll
 IMPORTLIB = usp10
-IMPORTS   = gdi32
+IMPORTS   = user32 gdi32
 
 C_SRCS = \
 	bidi.c \
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 63e50c8..61f65e4 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -1029,16 +1029,20 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
                            int cEnd,
                            UINT uOptions,
                            const RECT *prc,
+                           BOOL fSelected,
                            BOOL fDisabled)
 {
     StringAnalysis *analysis;
     int off_x = 0;
     HRESULT hr;
+    COLORREF BkColor = 0x0;
+    COLORREF TextColor = 0x0;
+    INT BkMode = 0;
     INT runStart, runEnd;
     INT iGlyph, cGlyphs;
 
-    TRACE("(%p,%d,%d,%d,%d,%d, 0x%1x, %d)\n",
-         ssa, iX, iY, iItem, cStart, cEnd, uOptions, fDisabled);
+    TRACE("(%p,%d,%d,%d,%d,%d, 0x%1x, %d, %d)\n",
+         ssa, iX, iY, iItem, cStart, cEnd, uOptions, fSelected, fDisabled);
 
     if (!(analysis = ssa)) return E_INVALIDARG;
 
@@ -1049,6 +1053,20 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
     uOptions |= ETO_GLYPH_INDEX;
     analysis->pItem[0].a.fNoGlyphIndex = FALSE; /* say that we have glyphs */
 
+    if (fSelected)
+    {
+        BkMode = GetBkMode(analysis->hdc);
+        SetBkMode( analysis->hdc, OPAQUE);
+        BkColor = GetBkColor(analysis->hdc);
+        SetBkColor(analysis->hdc, GetSysColor(COLOR_HIGHLIGHT));
+        if (!fDisabled)
+        {
+            TextColor = GetTextColor(analysis->hdc);
+            SetTextColor(analysis->hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+        }
+
+    }
+
     if (cStart >= 0 && analysis->pItem[iItem+1].iCharPos > cStart && analysis->pItem[iItem].iCharPos <= cStart)
         runStart = cStart - analysis->pItem[iItem].iCharPos;
     else
@@ -1093,6 +1111,14 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
 
     TRACE("ScriptTextOut hr=%08x\n", hr);
 
+    if (fSelected)
+    {
+        SetBkColor(analysis->hdc, BkColor);
+        SetBkMode( analysis->hdc, BkMode);
+        if (!fDisabled)
+            SetTextColor(analysis->hdc, TextColor);
+    }
+
     return hr;
 }
 
@@ -1137,11 +1163,23 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa,
 
     for (item = 0; item < analysis->numItems; item++)
     {
-        hr = SS_ItemOut( ssa, iX, iY, analysis->logical2visual[item], -1, -1, uOptions, prc, fDisabled);
+        hr = SS_ItemOut( ssa, iX, iY, analysis->logical2visual[item], -1, -1, uOptions, prc, FALSE, fDisabled);
         if (FAILED(hr))
             return hr;
     }
 
+    if (iMinSel < iMaxSel && (iMinSel > 0 || iMaxSel > 0))
+    {
+        if (iMaxSel > 0 &&  iMinSel < 0)
+            iMinSel = 0;
+        for (item = 0; item < analysis->numItems; item++)
+        {
+            hr = SS_ItemOut( ssa, iX, iY, analysis->logical2visual[item], iMinSel, iMaxSel, uOptions, prc, TRUE, fDisabled);
+            if (FAILED(hr))
+                return hr;
+        }
+    }
+
     return S_OK;
 }
 




More information about the wine-cvs mailing list