Sync to Wine-0_9_2:
authorGé van Geldorp <ge@gse.nl>
Fri, 25 Nov 2005 23:05:28 +0000 (23:05 +0000)
committerGé van Geldorp <ge@gse.nl>
Fri, 25 Nov 2005 23:05:28 +0000 (23:05 +0000)
Vitaliy Margolen <wine-patch@kievinfo.com>
- Return false if index is out of bounds in GetItemT.
Francois Gouget <fgouget@free.fr>
- Remove spaces before '\n' in traces.
- Assorted spelling and case fixes.
Thomas Weidenmueller <wine-patches@reactsoft.com>
- Improved word wrapping and tab key handling.
Raphael Junqueira <fenix@club-internet.fr>
- Implement implement header callback support (HDN_GETDISPINFO notification):
- better factorisation
- unicode fixes
YunSong Hwang <hys545@dreamwiz.com>
- Update Korean translations.
Markus Amsler <markus.amsler@oribi.org>
- Reformat "see" section, to match c2man requirements.

svn path=/trunk/; revision=19585

reactos/lib/comctl32/comctl_Ko.rc
reactos/lib/comctl32/header.c
reactos/lib/comctl32/rebar.c
reactos/lib/comctl32/syslink.c
reactos/lib/comctl32/tooltips.c

index 651ddb2..f7cf69f 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2002 Won-kyu Park <wkpark@kldp.org>
+ * Copyright 2005 YunSong Hwang
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,20 +21,20 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
 
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
-CAPTION "Properties for "
+CAPTION "¼Ó¼º"
 FONT 9, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "È®ÀÎ",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Ãë¼Ò", IDCANCEL,58,122,50,14
   PUSHBUTTON    "Àû¿ë(&A)", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
   PUSHBUTTON    "µµ¿ò¸»",   IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
-  CONTROL       "Tab",    IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
+  CONTROL       "ÅÇ",    IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
 END
 
 
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
-CAPTION "Wizard"
+CAPTION "¸¶¹ý»ç"
 FONT 9, "MS Shell Dlg"
 BEGIN
   PUSHBUTTON    "< ÀÌÀü(&B)", IDC_BACK_BUTTON,71,138,50,14
@@ -42,26 +43,26 @@ BEGIN
   PUSHBUTTON    "Ãë¼Ò",  IDCANCEL,178,138,50,14
   PUSHBUTTON    "µµ¿ò¸»",    IDHELP,235,138,50,14,WS_GROUP
   LTEXT         "",        IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
-  CONTROL       "Tab",     IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
+  CONTROL       "ÅÇ",     IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
   LTEXT                "",        IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE
 END
 
 
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Customize Toolbar"
+CAPTION "µµ±¸¹Ù »ç¿ëÀÚ Á¤ÀÇ"
 FONT 9, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "´Ý±â(&C)",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "´Ù½Ã(&e)",     IDC_RESET_BTN,308,23,44,14
   PUSHBUTTON    "µµ¿ò¸»(&H)",      IDC_HELP_BTN,308,40,44,14
-  PUSHBUTTON    "Move &Up",   IDC_MOVEUP_BTN,308,74,44,14
-  PUSHBUTTON    "Move &Down", IDC_MOVEDN_BTN,308,91,44,14
-  LTEXT         "A&vailable buttons:", -1,4,5,84,10
+  PUSHBUTTON    "À§·Î À̵¿(&U)",   IDC_MOVEUP_BTN,308,74,44,14
+  PUSHBUTTON    "¾Æ·¡·Î À̵¿(&D)", IDC_MOVEDN_BTN,308,91,44,14
+  LTEXT         "°¡´ÉÇÑ ¹öÆ°(&v)", -1,4,5,84,10
   LISTBOX       IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
-  PUSHBUTTON    "&Add ->",    IDOK, 131, 42, 44, 14
-  PUSHBUTTON    "<- &Remove", IDC_REMOVE_BTN,131,62,44,14
-  LTEXT         "&Toolbar buttons:", -1,182,5,78,10
+  PUSHBUTTON    "´õÇϱâ(&A) ->",    IDOK, 131, 42, 44, 14
+  PUSHBUTTON    "<- Á¦°ÅÇϱâ(&R)", IDC_REMOVE_BTN,131,62,44,14
+  LTEXT         "µµ±¸¹Ù ¹öÆ°(&T):", -1,182,5,78,10
   LISTBOX       IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
 END
 
@@ -73,10 +74,10 @@ STRINGTABLE DISCARDABLE
 STRINGTABLE DISCARDABLE
 {
     IDM_TODAY    "¿À´Ã:"
-    IDM_GOTODAY  "Go to today"
+    IDM_GOTODAY  "¿À´Ã·Î °¡±â"
 }
 
 STRINGTABLE DISCARDABLE
 {
-    IDS_SEPARATOR "Separator"
+    IDS_SEPARATOR "ºÐ¸®ÀÚ"
 }
index 1e0c461..3657019 100644 (file)
@@ -813,11 +813,10 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
 
     if (phdi->mask == 0)
        return TRUE;
-
     if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
-        lpItem = NULL;
-    else
-        lpItem = &infoPtr->items[nItem];
+        return FALSE;
+
+    lpItem = &infoPtr->items[nItem];
 
     if (phdi->mask & HDI_BITMAP)
        phdi->hbm = (lpItem != NULL) ? lpItem->hbm : 0;
index 61806f4..468fe24 100644 (file)
@@ -2131,9 +2131,9 @@ REBAR_CommonSetupBand (HWND hwnd, LPREBARBANDINFOA lprbbi, REBAR_BAND *lpBand)
            lpBand->hwndChild = lprbbi->hwndChild;
            lpBand->hwndPrevParent =
                SetParent (lpBand->hwndChild, hwnd);
-           /* below in trace fro WinRAR */
+           /* below in trace from WinRAR */
            ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);
-           /* above in trace fro WinRAR */
+           /* above in trace from WinRAR */
        }
        else {
            TRACE("child: %p  prev parent: %p\n",
index 084a567..7459bc3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SysLink control
  *
- * Copyright 2004 Thomas Weidenmueller <w3seek@reactos.com>
+ * Copyright 2004, 2005 Thomas Weidenmueller <w3seek@reactos.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Unless otherwise noted, we believe this code to be complete, as per
  * the specification mentioned above.
  * If you discover missing features, or bugs, please note them below.
- * 
- * TODO:
- * - Fix SHIFT+TAB and TAB issue (wrong link is selected when control gets the focus)
- * - Better string parsing
- * - Improve word wrapping
- *
  */
 
 #include <stdarg.h>
@@ -52,6 +46,7 @@ INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT);
 typedef struct
 {
     int nChars;
+    int nSkip;
     RECT rc;
 } DOC_TEXTBLOCK, *PDOC_TEXTBLOCK;
 
@@ -78,7 +73,6 @@ typedef struct _DOC_ITEM
             UINT state;     /* Link state */
             WCHAR *szID;    /* Link ID string */
             WCHAR *szUrl;   /* Link URL string */
-            HRGN hRgn;      /* Region of the link */
         } Link;
         struct
         {
@@ -100,6 +94,7 @@ typedef struct
     COLORREF  TextColor;    /* Color of the text */
     COLORREF  LinkColor;    /* Color of links */
     COLORREF  VisitedColor; /* Color of visited links */
+    WCHAR     BreakChar;    /* Break Character for the current font */
 } SYSLINK_INFO;
 
 static const WCHAR SL_LINKOPEN[] =  { '<','a', 0 };
@@ -126,11 +121,6 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
         Free(DocItem->u.Link.szUrl);
     }
 
-    if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL)
-    {
-        DeleteObject(DocItem->u.Link.hRgn);
-    }
-
     /* we don't free Text because it's just a pointer to a character in the
        entire window text string */
 
@@ -215,9 +205,8 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
             {
                 BOOL ValidParam = FALSE, ValidLink = FALSE;
 
-                switch (*(current + 2))
+                if(*(current + 2) == '>')
                 {
-                case '>':
                     /* we just have to deal with a <a> tag */
                     taglen = 3;
                     ValidLink = TRUE;
@@ -226,8 +215,8 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
                     linklen = 0;
                     lpID = NULL;
                     lpUrl = NULL;
-                    break;
-                case ' ':
+                }
+                else if(*(current + 2) == infoPtr->BreakChar)
                 {
                     /* we expect parameters, parse them */
                     LPCWSTR *CurrentParameter = NULL, tmp;
@@ -285,27 +274,22 @@ CheckParameter:
                          * 1. another parameter is coming, so expect a ' ' (space) character
                          * 2. the tag is being closed, so expect a '<' character
                          */
-                        switch(*tmp)
+                        if(*tmp == infoPtr->BreakChar)
                         {
-                        case ' ':
                             /* we expect another parameter, do the whole thing again */
                             taglen++;
                             tmp++;
                             goto CheckParameter;
-
-                        case '>':
+                        }
+                        else if(*tmp == '>')
+                        {
                             /* the tag is being closed, we're done */
                             ValidLink = TRUE;
                             taglen++;
-                            break;
-                        default:
-                            tmp++;
-                            break;
                         }
+                        else
+                            tmp++;
                     }
-                    
-                    break;
-                }
                 }
                 
                 if(ValidLink && ValidParam)
@@ -495,16 +479,26 @@ CheckParameter:
  */
 static VOID SYSLINK_RepaintLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
 {
+    PDOC_TEXTBLOCK bl;
+    int n;
+
     if(DocItem->Type != slLink)
     {
         ERR("DocItem not a link!\n");
         return;
     }
     
-    if(DocItem->u.Link.hRgn != NULL)
+    bl = DocItem->Blocks;
+    if (bl != NULL)
     {
-        /* repaint the region */
-        RedrawWindow(infoPtr->Self, NULL, DocItem->u.Link.hRgn, RDW_INVALIDATE | RDW_UPDATENOW);
+        n = DocItem->nText;
+        
+        while(n > 0)
+        {
+            InvalidateRect(infoPtr->Self, &bl->rc, TRUE);
+            n -= bl->nChars + bl->nSkip;
+            bl++;
+        }
     }
 }
 
@@ -615,7 +609,8 @@ static PDOC_ITEM SYSLINK_GetPrevLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
  * SYSLINK_WrapLine
  * Tries to wrap a line.
  */
-static BOOL SYSLINK_WrapLine (HDC hdc, LPWSTR Text, WCHAR BreakChar, int *LineLen, int nFit, LPSIZE Extent, int Width)
+static BOOL SYSLINK_WrapLine (HDC hdc, LPWSTR Text, WCHAR BreakChar, int *LineLen,
+                             int nFit, LPSIZE Extent, int Width)
 {
     WCHAR *Current;
 
@@ -659,7 +654,6 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
     PDOC_ITEM Current;
     HGDIOBJ hOldFont;
     int x, y, LineHeight;
-    TEXTMETRICW tm;
     
     GetClientRect(infoPtr->Self, &rc);
     rc.right -= SL_RIGHTMARGIN;
@@ -668,7 +662,6 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
     if(rc.right - SL_LEFTMARGIN < 0 || rc.bottom - SL_TOPMARGIN < 0) return;
     
     hOldFont = SelectObject(hdc, infoPtr->Font);
-    GetTextMetricsW(hdc, &tm);
     
     x = SL_LEFTMARGIN;
     y = SL_TOPMARGIN;
@@ -684,13 +677,18 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
         
         if(Current->nText == 0)
         {
-            ERR("DOC_ITEM with no text?!\n");
             continue;
         }
         
         tx = Current->Text;
         n = Current->nText;
-        bl = Current->Blocks;
+
+        if (Current->Blocks != NULL)
+        {
+            Free(Current->Blocks);
+            Current->Blocks = NULL;
+        }
+        bl = NULL;
         nBlocks = 0;
         
         if(Current->Type == slText)
@@ -704,41 +702,80 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
         
         while(n > 0)
         {
-            if(GetTextExtentExPointW(hdc, tx, n, rc.right - x, &nFit, NULL, &szDim))
+            int SkipChars = 0;
+
+            /* skip break characters unless they're the first of the doc item */
+            if(tx != Current->Text || x == SL_LEFTMARGIN)
+            {
+                while(n > 0 && (*tx) == infoPtr->BreakChar)
+                {
+                    tx++;
+                    SkipChars++;
+                    n--;
+                }
+            }
+
+            if((n == 0 && SkipChars != 0) ||
+               GetTextExtentExPointW(hdc, tx, n, rc.right - x, &nFit, NULL, &szDim))
             {
                 int LineLen = n;
-                BOOL Wrap = SYSLINK_WrapLine(hdc, tx, tm.tmBreakChar, &LineLen, nFit, &szDim, rc.right - x);
+                BOOL Wrap = FALSE;
                 
-                if(LineLen == 0)
+                if(n != 0)
                 {
-                    if(x > SL_LEFTMARGIN)
+                    Wrap = SYSLINK_WrapLine(hdc, tx, infoPtr->BreakChar, &LineLen, nFit, &szDim, rc.right - x);
+
+                    if(LineLen == 0)
                     {
-                        /* move one line down, the word didn't fit into the line */
-                        x = SL_LEFTMARGIN;
-                        y += LineHeight;
-                        LineHeight = 0;
-                        continue;
+                        if(x > SL_LEFTMARGIN)
+                        {
+                            /* move one line down, the word didn't fit into the line */
+                            x = SL_LEFTMARGIN;
+                            y += LineHeight;
+                            LineHeight = 0;
+                            continue;
+                        }
+                        else
+                        {
+                            /* the word starts at the beginning of the line and doesn't
+                               fit into the line, so break it at the last character that fits */
+                            LineLen = max(nFit, 1);
+                        }
                     }
-                    else
+
+                    if(LineLen != n)
                     {
-                        /* the word starts at the beginning of the line and doesn't
-                           fit into the line, so break it at the last character that fits */
-                        LineLen = max(nFit, 1);
+                        if(!GetTextExtentExPointW(hdc, tx, LineLen, rc.right - x, NULL, NULL, &szDim))
+                        {
+                            if(bl != NULL)
+                            {
+                                Free(bl);
+                                bl = NULL;
+                            }
+                            break;
+                        }
                     }
                 }
                 
-                if(LineLen != n)
-                {
-                    GetTextExtentExPointW(hdc, tx, LineLen, rc.right - x, NULL, NULL, &szDim);
-                }
-                
                 if(bl != NULL)
                 {
-                    bl = ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK));
+                    PDOC_TEXTBLOCK nbl = ReAlloc(bl, (nBlocks + 1) * sizeof(DOC_TEXTBLOCK));
+                    if (nbl != NULL)
+                    {
+                        bl = nbl;
+                        nBlocks++;
+                    }
+                    else
+                    {
+                        Free(bl);
+                        bl = NULL;
+                    }
                 }
                 else
                 {
-                    bl = Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK));
+                    bl = Alloc((nBlocks + 1) * sizeof(DOC_TEXTBLOCK));
+                    if (bl != NULL)
+                        nBlocks++;
                 }
                 
                 if(bl != NULL)
@@ -746,42 +783,24 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
                     cbl = bl + nBlocks - 1;
                     
                     cbl->nChars = LineLen;
+                    cbl->nSkip = SkipChars;
                     cbl->rc.left = x;
                     cbl->rc.top = y;
                     cbl->rc.right = x + szDim.cx;
                     cbl->rc.bottom = y + szDim.cy;
                     
-                    x += szDim.cx;
-                    LineHeight = max(LineHeight, szDim.cy);
-                    
-                    /* (re)calculate the link's region */
-                    if(Current->Type == slLink)
+                    if(LineLen != 0)
                     {
-                        if(nBlocks <= 1)
-                        {
-                            if(Current->u.Link.hRgn != NULL)
-                            {
-                                DeleteObject(Current->u.Link.hRgn);
-                            }
-                            /* initialize the link's hRgn */
-                            Current->u.Link.hRgn = CreateRectRgnIndirect(&cbl->rc);
-                        }
-                        else if(Current->u.Link.hRgn != NULL)
+                        x += szDim.cx;
+                        LineHeight = max(LineHeight, szDim.cy);
+
+                        if(Wrap)
                         {
-                            HRGN hrgn;
-                            hrgn = CreateRectRgnIndirect(&cbl->rc);
-                            /* add the rectangle */
-                            CombineRgn(Current->u.Link.hRgn, Current->u.Link.hRgn, hrgn, RGN_OR);
-                            DeleteObject(hrgn);
+                            x = SL_LEFTMARGIN;
+                            y += LineHeight;
+                            LineHeight = 0;
                         }
                     }
-                    
-                    if(Wrap)
-                    {
-                        x = SL_LEFTMARGIN;
-                        y += LineHeight;
-                        LineHeight = 0;
-                    }
                 }
                 else
                 {
@@ -793,11 +812,16 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
             }
             else
             {
-                ERR("GetTextExtentExPoint() failed?!\n");
                 n--;
             }
         }
-        Current->Blocks = bl;
+
+        if(nBlocks != 0)
+        {
+            Current->Blocks = bl;
+        }
+        else
+            Current->Blocks = NULL;
     }
     
     SelectObject(hdc, hOldFont);
@@ -849,6 +873,7 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
 
             while(n > 0)
             {
+                tx += bl->nSkip;
                 ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL);
                 if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
                 {
@@ -858,7 +883,7 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
                     SetBkColor(hdc, PrevColor);
                 }
                 tx += bl->nChars;
-                n -= bl->nChars;
+                n -= bl->nChars + bl->nSkip;
                 bl++;
             }
         }
@@ -896,6 +921,7 @@ static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
 {
     HDC hdc;
     LOGFONTW lf;
+    TEXTMETRICW tm;
     HFONT hOldFont = infoPtr->Font;
     infoPtr->Font = hFont;
     
@@ -911,10 +937,12 @@ static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
     if(hdc != NULL)
     {
         /* create a new underline font */
-        if(GetObjectW(infoPtr->Font, sizeof(LOGFONTW), &lf))
+        if(GetTextMetricsW(hdc, &tm) &&
+           GetObjectW(infoPtr->Font, sizeof(LOGFONTW), &lf))
         {
             lf.lfUnderline = TRUE;
             infoPtr->LinkFont = CreateFontIndirectW(&lf);
+            infoPtr->BreakChar = tm.tmBreakChar;
         }
         else
         {
@@ -1132,6 +1160,34 @@ static LRESULT SYSLINK_GetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
     return TRUE;
 }
 
+/***********************************************************************
+ *           SYSLINK_PtInDocItem
+ * Determines if a point is in the region of a document item
+ */
+static BOOL SYSLINK_PtInDocItem (PDOC_ITEM DocItem, POINT pt)
+{
+    PDOC_TEXTBLOCK bl;
+    int n;
+
+    bl = DocItem->Blocks;
+    if (bl != NULL)
+    {
+        n = DocItem->nText;
+
+        while(n > 0)
+        {
+            if (PtInRect(&bl->rc, pt))
+            {
+                return TRUE;
+            }
+            n -= bl->nChars + bl->nSkip;
+            bl++;
+        }
+    }
+    
+    return FALSE;
+}
+
 /***********************************************************************
  *           SYSLINK_HitTest
  * Determines the link the user clicked on.
@@ -1145,8 +1201,7 @@ static LRESULT SYSLINK_HitTest (SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
     {
         if(Current->Type == slLink)
         {
-            if((Current->u.Link.hRgn != NULL) &&
-               PtInRegion(Current->u.Link.hRgn, HitTest->pt.x, HitTest->pt.y))
+            if(SYSLINK_PtInDocItem(Current, HitTest->pt))
             {
                 HitTest->item.mask = 0;
                 HitTest->item.iLink = id;
@@ -1252,25 +1307,13 @@ static LRESULT SYSLINK_SetFocus (SYSLINK_INFO *infoPtr, HWND PrevFocusWindow)
     
     infoPtr->HasFocus = TRUE;
 
-#if 1
-    /* FIXME - How to detect whether SHIFT+TAB or just TAB has been pressed?
-     *         The problem is we could get this message without keyboard input, too
-     */
-    Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
-    
-    if(Focus == NULL && (Focus = SYSLINK_GetNextLink(infoPtr, NULL)))
-    {
-        SYSLINK_SetFocusLink(infoPtr, Focus);
-    }
-#else
-    /* This is a temporary hack since I'm not really sure how to detect which link to select.
-       See message above! */
+    /* We always select the first link, even if we activated the control using
+       SHIFT+TAB. This is the default behavior */
     Focus = SYSLINK_GetNextLink(infoPtr, NULL);
     if(Focus != NULL)
     {
         SYSLINK_SetFocusLink(infoPtr, Focus);
     }
-#endif
     
     SYSLINK_RepaintLink(infoPtr, Focus);
     
@@ -1307,8 +1350,7 @@ static PDOC_ITEM SYSLINK_LinkAtPt (SYSLINK_INFO *infoPtr, POINT *pt, int *LinkId
 
     for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
     {
-        if((Current->Type == slLink) && (Current->u.Link.hRgn != NULL) &&
-           PtInRegion(Current->u.Link.hRgn, pt->x, pt->y) &&
+        if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) &&
            (!MustBeEnabled || (MustBeEnabled && (Current->u.Link.state & LIS_ENABLED))))
         {
             if(LinkId != NULL)
@@ -1335,6 +1377,8 @@ static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT
     Current = SYSLINK_LinkAtPt(infoPtr, pt, &id, TRUE);
     if(Current != NULL)
     {
+      SetFocus(infoPtr->Self);
+
       Old = SYSLINK_SetFocusLink(infoPtr, Current);
       if(Old != NULL && Old != Current)
       {
@@ -1342,7 +1386,6 @@ static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT
       }
       infoPtr->MouseDownID = id;
       SYSLINK_RepaintLink(infoPtr, Current);
-      SetFocus(infoPtr->Self);
     }
 
     return 0;
@@ -1460,7 +1503,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
     infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0);
 
     if (!infoPtr && message != WM_CREATE)
-        return DefWindowProcW( hwnd, message, wParam, lParam );
+        goto HandleDefaultMessage;
 
     switch(message) {
     case WM_PRINTCLIENT:
@@ -1482,8 +1525,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
             return TRUE;
         }
         /* let the default window proc handle this message */
-        return DefWindowProcW(hwnd, message, wParam, lParam);
-
+        goto HandleDefaultMessage;
     }
 
     case WM_SIZE:
@@ -1505,7 +1547,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
 
     case WM_SETTEXT:
         SYSLINK_SetText(infoPtr, (LPWSTR)lParam);
-        return DefWindowProcW(hwnd, message, wParam, lParam);
+        goto HandleDefaultMessage;
 
     case WM_LBUTTONDOWN:
     {
@@ -1536,7 +1578,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
             return 0;
         }
         }
-        return DefWindowProcW(hwnd, message, wParam, lParam);
+        goto HandleDefaultMessage;
     }
     
     case WM_GETDLGCODE:
@@ -1638,6 +1680,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
         infoPtr->TextColor = GetSysColor(COLOR_WINDOWTEXT);
         infoPtr->LinkColor = GetSysColor(COLOR_HIGHLIGHT);
         infoPtr->VisitedColor = GetSysColor(COLOR_HIGHLIGHT);
+        infoPtr->BreakChar = ' ';
         TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
         SYSLINK_SetText(infoPtr, ((LPCREATESTRUCTW)lParam)->lpszName);
         return 0;
@@ -1652,8 +1695,11 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
         return 0;
 
     default:
+HandleDefaultMessage:
         if ((message >= WM_USER) && (message < WM_APP))
-           ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam );
+        {
+               ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam );
+        }
         return DefWindowProcW(hwnd, message, wParam, lParam);
     }
 }
index b738a4e..39d981b 100644 (file)
@@ -1507,7 +1507,7 @@ TOOLTIPS_GetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* NB this API is broken, there is no way for the app to determine
        what size buffer it requires nor a way to specify how long the
-       one it supplies is.  We'll assume it's upto INFOTIPSIZE */
+       one it supplies is.  We'll assume it's up to INFOTIPSIZE */
 
     WideCharToMultiByte(CP_ACP, 0, infoPtr->tools[nTool].lpszText, -1,
                        lpToolInfo->lpszText, INFOTIPSIZE, NULL, NULL);