From d3cd32d90d2ac307d424d3e951b16044b3eb92d0 Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Mon, 18 Sep 2006 16:59:16 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=24203 --- reactos/dll/win32/comctl32/comctl32_ros.diff | 12 +--- reactos/dll/win32/comctl32/listview.c | 64 +++++++++++++++++++- reactos/dll/win32/comctl32/propsheet.c | 4 +- reactos/dll/win32/comctl32/theme_dialog.c | 2 - reactos/dll/win32/comctl32/theme_edit.c | 2 - reactos/dll/win32/comctl32/theme_listbox.c | 2 - reactos/dll/win32/comctl32/trackbar.c | 4 +- 7 files changed, 66 insertions(+), 24 deletions(-) diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff index 463bb689f03..d14857c23c4 100644 --- a/reactos/dll/win32/comctl32/comctl32_ros.diff +++ b/reactos/dll/win32/comctl32/comctl32_ros.diff @@ -1,18 +1,8 @@ -Index: comctl32.rbuild -=================================================================== ---- comctl32.rbuild (revision 23123) -+++ comctl32.rbuild (working copy) -@@ -1,4 +1,5 @@ - -+ - - . - include/reactos/wine Index: listview.c =================================================================== --- listview.c (revision 23123) +++ listview.c (working copy) -@@ -3770,9 +3770,8 @@ +@@ -3777,9 +3777,8 @@ if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon)) { TRACE("iImage=%d\n", lvItem.iImage); diff --git a/reactos/dll/win32/comctl32/listview.c b/reactos/dll/win32/comctl32/listview.c index 9865746b69c..3631766d584 100644 --- a/reactos/dll/win32/comctl32/listview.c +++ b/reactos/dll/win32/comctl32/listview.c @@ -240,6 +240,12 @@ typedef struct tagITERATOR INT index; } ITERATOR; +typedef struct tagDELAYED_ITEM_EDIT +{ + BOOL fEnabled; + INT iItem; +} DELAYED_ITEM_EDIT; + typedef struct tagLISTVIEW_INFO { HWND hwndSelf; @@ -310,6 +316,7 @@ typedef struct tagLISTVIEW_INFO BOOL bIsDrawing; INT nMeasureItemHeight; INT xTrackLine; /* The x coefficient of the track line or -1 if none */ + DELAYED_ITEM_EDIT itemEdit; /* Pointer to this structure will be the timer ID */ } LISTVIEW_INFO; /* @@ -7614,7 +7621,32 @@ static BOOL LISTVIEW_DrawTrackLine(LISTVIEW_INFO *infoPtr) return TRUE; } - +/*** + * DESCRIPTION: + * Called when an edit control should be displayed. This function is called after + * we are sure that there was a single click - not a double click (this is a TIMERPROC). + * + * PARAMETER(S): + * [I] hwnd : Handle to the listview + * [I] uMsg : WM_TIMER (ignored) + * [I] idEvent : The timer ID interpreted as a pointer to a DELAYED_EDIT_ITEM struct + * [I] dwTimer : The elapsed time (ignored) + * + * RETURN: + * None. + */ +static CALLBACK VOID LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + DELAYED_ITEM_EDIT *editItem = (DELAYED_ITEM_EDIT *)idEvent; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); + + KillTimer(hwnd, idEvent); + editItem->fEnabled = FALSE; + /* check if the item is still selected */ + if (infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, editItem->iItem, LVIS_SELECTED)) + LISTVIEW_EditLabelT(infoPtr, editItem->iItem, TRUE); +} + /*** * DESCRIPTION: * Creates the listview control. @@ -7667,6 +7699,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->dwHoverTime = -1; /* default system hover time */ infoPtr->nMeasureItemHeight = 0; infoPtr->xTrackLine = -1; /* no track line */ + infoPtr->itemEdit.fEnabled = FALSE; /* get default font (icon title) */ SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); @@ -8219,6 +8252,13 @@ static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, LVHITTESTINFO htInfo; TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y); + + /* Cancel the item edition if any */ + if (infoPtr->itemEdit.fEnabled) + { + KillTimer(infoPtr->hwndSelf, (UINT_PTR)&infoPtr->itemEdit); + infoPtr->itemEdit.fEnabled = FALSE; + } /* send NM_RELEASEDCAPTURE notification */ if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0; @@ -8252,6 +8292,7 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN { LVHITTESTINFO lvHitTestInfo; static BOOL bGroupSelect = TRUE; + BOOL bReceivedFocus = FALSE; POINT pt = { x, y }; INT nItem; @@ -8260,7 +8301,11 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN /* send NM_RELEASEDCAPTURE notification */ if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0; - if (!infoPtr->bFocus) SetFocus(infoPtr->hwndSelf); + if (!infoPtr->bFocus) + { + bReceivedFocus = TRUE; + SetFocus(infoPtr->hwndSelf); + } /* set left button down flag and record the click position */ infoPtr->bLButtonDown = TRUE; @@ -8347,6 +8392,9 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN LISTVIEW_DeselectAll(infoPtr); ReleaseCapture(); } + + if (bReceivedFocus) + infoPtr->nEditLabelItem = -1; return 0; } @@ -8383,7 +8431,17 @@ static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT /* if we clicked on a selected item, edit the label */ if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem && (lvHitTestInfo.flags & LVHT_ONITEMLABEL)) - LISTVIEW_EditLabelT(infoPtr, lvHitTestInfo.iItem, TRUE); + { + /* we want to make sure the user doesn't want to do a double click. So we will + * delay the edit. WM_LBUTTONDBLCLICK will cancel the timer + */ + infoPtr->itemEdit.fEnabled = TRUE; + infoPtr->itemEdit.iItem = lvHitTestInfo.iItem; + SetTimer(infoPtr->hwndSelf, + (UINT_PTR)&infoPtr->itemEdit, + GetDoubleClickTime(), + LISTVIEW_DelayedEditItem); + } return 0; } diff --git a/reactos/dll/win32/comctl32/propsheet.c b/reactos/dll/win32/comctl32/propsheet.c index 972f862129b..185b843cb21 100644 --- a/reactos/dll/win32/comctl32/propsheet.c +++ b/reactos/dll/win32/comctl32/propsheet.c @@ -448,7 +448,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, else { HRSRC hResource = FindResourceA(lppsp->hInstance, - (LPSTR)lppsp->u.pszTemplate, + (LPCSTR)lppsp->u.pszTemplate, (LPSTR)RT_DIALOG); HGLOBAL hTemplate = LoadResource(lppsp->hInstance, hResource); @@ -1424,7 +1424,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, HANDLE hTemplate; hResource = FindResourceA(ppshpage->hInstance, - (LPSTR)ppshpage->u.pszTemplate, + (LPCSTR)ppshpage->u.pszTemplate, (LPSTR)RT_DIALOG); if(!hResource) return FALSE; diff --git a/reactos/dll/win32/comctl32/theme_dialog.c b/reactos/dll/win32/comctl32/theme_dialog.c index cfcb56f937b..92859418e76 100644 --- a/reactos/dll/win32/comctl32/theme_dialog.c +++ b/reactos/dll/win32/comctl32/theme_dialog.c @@ -32,8 +32,6 @@ #include "comctl32.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(themingdialog); - /********************************************************************** * The dialog subclass window proc. */ diff --git a/reactos/dll/win32/comctl32/theme_edit.c b/reactos/dll/win32/comctl32/theme_edit.c index 3cbf7608121..b3b142a11db 100644 --- a/reactos/dll/win32/comctl32/theme_edit.c +++ b/reactos/dll/win32/comctl32/theme_edit.c @@ -32,8 +32,6 @@ #include "comctl32.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(themingedit); - /* Draw themed border */ static void nc_paint (HTHEME theme, HWND hwnd, HRGN region) { diff --git a/reactos/dll/win32/comctl32/theme_listbox.c b/reactos/dll/win32/comctl32/theme_listbox.c index 93e9ac7d926..8147ba4cf15 100644 --- a/reactos/dll/win32/comctl32/theme_listbox.c +++ b/reactos/dll/win32/comctl32/theme_listbox.c @@ -32,8 +32,6 @@ #include "comctl32.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(theminglistbox); - /* Draw themed border */ static void nc_paint (HTHEME theme, HWND hwnd, HRGN region) { diff --git a/reactos/dll/win32/comctl32/trackbar.c b/reactos/dll/win32/comctl32/trackbar.c index 1acccc43d93..615df572a50 100644 --- a/reactos/dll/win32/comctl32/trackbar.c +++ b/reactos/dll/win32/comctl32/trackbar.c @@ -1048,8 +1048,8 @@ TRACKBAR_GetNumTics (TRACKBAR_INFO *infoPtr) static int comp_tics(const void *ap, const void *bp) { - DWORD a = *((DWORD *)ap); - DWORD b = *((DWORD *)bp); + const DWORD a = *(const DWORD *)ap; + const DWORD b = *(const DWORD *)bp; TRACE("(a=%ld, b=%ld)\n", a, b); if (a < b) return -1;