Author: dchapyshev
Date: Sat Sep 5 17:01:30 2009
New Revision: 42993
URL:
http://svn.reactos.org/svn/reactos?rev=42993&view=rev
Log:
- Sync comctl32 and comdlg32 with Wine 1.1.29
Modified:
trunk/reactos/dll/win32/comctl32/comctl32.spec
trunk/reactos/dll/win32/comctl32/imagelist.c
trunk/reactos/dll/win32/comctl32/listview.c
trunk/reactos/dll/win32/comctl32/propsheet.c
trunk/reactos/dll/win32/comctl32/status.c
trunk/reactos/dll/win32/comctl32/tab.c
trunk/reactos/dll/win32/comctl32/trackbar.c
trunk/reactos/dll/win32/comdlg32/filedlg.c
Modified: trunk/reactos/dll/win32/comctl32/comctl32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32.spec [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -139,10 +139,12 @@
@ stdcall FlatSB_SetScrollRange (long long long long long)
@ stdcall FlatSB_ShowScrollBar (long long long)
@ stdcall GetMUILanguage()
+@ stdcall HIMAGELIST_QueryInterface(ptr ptr ptr)
@ stdcall ImageList_Add(ptr long long)
@ stdcall ImageList_AddIcon(ptr long)
@ stdcall ImageList_AddMasked(ptr long long)
@ stdcall ImageList_BeginDrag(ptr long long long)
+@ stdcall ImageList_CoCreateInstance(ptr ptr ptr ptr)
@ stdcall ImageList_Copy(ptr long ptr long long)
@ stdcall ImageList_Create(long long long long long)
@ stdcall ImageList_Destroy(ptr)
Modified: trunk/reactos/dll/win32/comctl32/imagelist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imageli…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -6,6 +6,7 @@
* Copyright 2001, 2004 Michael Stefaniuc
* Copyright 2001 Charles Loep for CodeWeavers
* Copyright 2002 Dimitrie O. Paun
+ * Copyright 2009 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -155,7 +156,7 @@
* This function CANNOT be used to reduce the number of images.
*/
static void
-IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy)
+IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy)
{
HDC hdcBitmap;
HBITMAP hbmNewBitmap, hbmNull;
@@ -166,14 +167,15 @@
&& (himl->cy >= cy))
return;
+ if (cx == 0) cx = himl->cx;
nNewCount = himl->cCurImage + nImageCount + himl->cGrow;
- imagelist_get_bitmap_size(himl, nNewCount, himl->cx, &sz);
+ imagelist_get_bitmap_size(himl, nNewCount, cx, &sz);
TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl,
sz.cx, cy, nNewCount);
hdcBitmap = CreateCompatibleDC (0);
- hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cx);
+ hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cx);
if (hbmNewBitmap == 0)
ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, cy);
@@ -247,7 +249,7 @@
nImageCount = bmp.bmWidth / himl->cx;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);
hdcBitmap = CreateCompatibleDC(0);
@@ -349,7 +351,7 @@
else
nImageCount = 0;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);
nIndex = himl->cCurImage;
himl->cCurImage += nImageCount;
@@ -2303,7 +2305,7 @@
if (nIndex == -1) {
if (himl->cCurImage + 1 > himl->cMaxImage)
- IMAGELIST_InternalExpandBitmaps (himl, 1, 0);
+ IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0);
nIndex = himl->cCurImage;
himl->cCurImage++;
@@ -2905,3 +2907,47 @@
{
return SetDIBColorTable(himl->hdcImage, uStartIndex, cEntries, prgb);
}
+
+/*************************************************************************
+ * ImageList_CoCreateInstance [COMCTL32.@]
+ *
+ * Creates a new imagelist instance and returns an interface pointer to it.
+ *
+ * PARAMS
+ * rclsid [I] A reference to the CLSID (CLSID_ImageList).
+ * punkOuter [I] Pointer to IUnknown interface for aggregation, if desired
+ * riid [I] Identifier of the requested interface.
+ * ppv [O] Returns the address of the pointer requested, or NULL.
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: Error value.
+ */
+HRESULT WINAPI
+ImageList_CoCreateInstance (REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void
**ppv)
+{
+ FIXME("STUB: %s %p %s %p\n", debugstr_guid(rclsid), punkOuter,
debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+}
+
+/*************************************************************************
+ * HIMAGELIST_QueryInterface [COMCTL32.@]
+ *
+ * Returns a pointer to an IImageList or IImageList2 object for the given
+ * HIMAGELIST.
+ *
+ * PARAMS
+ * himl [I] Image list handle.
+ * riid [I] Identifier of the requested interface.
+ * ppv [O] Returns the address of the pointer requested, or NULL.
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: Error value.
+ */
+HRESULT WINAPI
+HIMAGELIST_QueryInterface (HIMAGELIST himl, REFIID riid, void **ppv)
+{
+ FIXME("STUB: %p %s %p\n", himl, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+}
Modified: trunk/reactos/dll/win32/comctl32/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -9727,7 +9727,7 @@
/***
* DESCRIPTION:
- * Paints/Repaints the listview control.
+ * Paints/Repaints the listview control. Internal use.
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
@@ -9766,6 +9766,26 @@
return 0;
}
+/***
+ * DESCRIPTION:
+ * Paints/Repaints the listview control, WM_PAINT handler.
+ *
+ * PARAMETER(S):
+ * [I] infoPtr : valid pointer to the listview structure
+ * [I] hdc : device context handle
+ *
+ * RETURN:
+ * Zero
+ */
+static inline LRESULT LISTVIEW_WMPaint(LISTVIEW_INFO *infoPtr, HDC hdc)
+{
+ TRACE("(hdc=%p)\n", hdc);
+
+ if (!is_redrawing(infoPtr))
+ return DefWindowProcW (infoPtr->hwndSelf, WM_PAINT, (WPARAM)hdc, 0);
+
+ return LISTVIEW_Paint(infoPtr, hdc);
+}
/***
* DESCRIPTION:
@@ -10802,7 +10822,7 @@
return LISTVIEW_PrintClient(infoPtr, (HDC)wParam, (DWORD)lParam);
case WM_PAINT:
- return LISTVIEW_Paint(infoPtr, (HDC)wParam);
+ return LISTVIEW_WMPaint(infoPtr, (HDC)wParam);
case WM_RBUTTONDBLCLK:
return LISTVIEW_RButtonDblClk(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam),
(SHORT)HIWORD(lParam));
Modified: trunk/reactos/dll/win32/comctl32/propsheet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -904,7 +904,7 @@
*/
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
- x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
+ x += padding.x + buttonWidth;
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
@@ -914,34 +914,25 @@
*/
hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
- if (psInfo->hasApply)
- {
- if (psInfo->hasHelp)
- x = rcSheet.right - ((padding.x + buttonWidth) * 2);
- else
- x = rcSheet.right - (padding.x + buttonWidth);
-
- SetWindowPos(hwndButton, 0, x, y, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
-
- EnableWindow(hwndButton, FALSE);
- }
+ if(psInfo->hasApply)
+ x += padding.x + buttonWidth;
else
ShowWindow(hwndButton, SW_HIDE);
+ SetWindowPos(hwndButton, 0, x, y, 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+ EnableWindow(hwndButton, FALSE);
+
/*
* Position Help button.
*/
hwndButton = GetDlgItem(hwndParent, IDHELP);
- if (psInfo->hasHelp)
- {
- x = rcSheet.right - (padding.x + buttonWidth);
-
- SetWindowPos(hwndButton, 0, x, y, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
- }
- else
+ x += padding.x + buttonWidth;
+ SetWindowPos(hwndButton, 0, x, y, 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+
+ if(!psInfo->hasHelp)
ShowWindow(hwndButton, SW_HIDE);
return TRUE;
@@ -1549,6 +1540,7 @@
{
HWND hwndTabCtrl;
HWND hwndLineHeader;
+ HWND control;
LPCPROPSHEETPAGEW ppshpage;
TRACE("active_page %d, index %d\n", psInfo->active_page, index);
@@ -1569,6 +1561,10 @@
{
PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
psInfo->proppage[index].pszText);
+
+ control = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE);
+ if(control != NULL)
+ SetFocus(control);
}
if (psInfo->active_page != -1)
@@ -1631,7 +1627,11 @@
if (idx >= 0 && idx < psInfo->nPages)
{
if (PROPSHEET_CanSetCurSel(hwndDlg))
+ {
+ SetFocus(GetDlgItem(hwndDlg, IDC_BACK_BUTTON));
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
PROPSHEET_SetCurSel(hwndDlg, idx, -1, 0);
+ }
}
return TRUE;
}
@@ -1669,7 +1669,11 @@
if (idx < psInfo->nPages )
{
if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE)
+ {
+ SetFocus(GetDlgItem(hwndDlg, IDC_NEXT_BUTTON));
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0);
+ }
}
return TRUE;
@@ -3444,6 +3448,7 @@
/* set up the Next and Back buttons by default */
PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT);
+ SetFocus(GetDlgItem(hwnd, IDC_NEXT_BUTTON));
/* Set up fonts */
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
@@ -3528,7 +3533,11 @@
* from which to switch to the next page */
SendMessageW(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
- PROPSHEET_UnChanged(hwnd, (HWND)wParam);
+ PROPSHEET_UnChanged(hwnd, NULL);
+
+ /* wizards set their focus during init */
+ if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
+ return FALSE;
return TRUE;
}
Modified: trunk/reactos/dll/win32/comctl32/status.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/status.…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/status.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/status.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -1016,12 +1016,17 @@
len = strlenW (infoPtr->parts[0].text);
- if (size > len) {
+ if (!size)
+ return len;
+ else if (size > len) {
strcpyW (buf, infoPtr->parts[0].text);
return len;
}
-
- return -1;
+ else {
+ memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR));
+ buf[size - 1] = 0;
+ return size - 1;
+ }
}
Modified: trunk/reactos/dll/win32/comctl32/tab.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/tab.c?r…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/tab.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/tab.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -2810,8 +2810,16 @@
TRACE("(%p,%d,%p,%s)\n", infoPtr, iItem, tabItem, bUnicode ? "true"
: "false");
+ if (!tabItem) return FALSE;
+
if (iItem < 0 || iItem >= infoPtr->uNumItem)
+ {
+ /* init requested fields */
+ if (tabItem->mask & TCIF_IMAGE) tabItem->iImage = 0;
+ if (tabItem->mask & TCIF_PARAM) tabItem->lParam = 0;
+ if (tabItem->mask & TCIF_STATE) tabItem->dwState = 0;
return FALSE;
+ }
wineItem = TAB_GetItem(infoPtr, iItem);
Modified: trunk/reactos/dll/win32/comctl32/trackbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/trackba…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -52,6 +52,7 @@
typedef struct
{
HWND hwndSelf;
+ DWORD dwStyle;
LONG lRangeMin;
LONG lRangeMax;
LONG lLineSize;
@@ -137,7 +138,7 @@
static BOOL
notify_with_scroll (const TRACKBAR_INFO *infoPtr, UINT code)
{
- BOOL bVert = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT;
+ BOOL bVert = infoPtr->dwStyle & TBS_VERT;
TRACE("%x\n", code);
@@ -151,8 +152,12 @@
int tic;
unsigned nrTics, i;
- if (infoPtr->uTicFreq && infoPtr->lRangeMax >=
infoPtr->lRangeMin)
- nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq;
+ if (infoPtr->uTicFreq && infoPtr->lRangeMax >=
infoPtr->lRangeMin) {
+ nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq;
+ /* don't add extra tic if there's no remainder */
+ if ((infoPtr->lRangeMax - infoPtr->lRangeMin) % infoPtr->uTicFreq == 0)
+ nrTics--;
+ }
else {
Free (infoPtr->tics);
infoPtr->tics = NULL;
@@ -180,12 +185,12 @@
(in range of trackbar) */
static inline LONG
-TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place, int vertical)
+TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place)
{
double range, width, pos, offsetthumb;
range = infoPtr->lRangeMax - infoPtr->lRangeMin;
- if (vertical) {
+ if (infoPtr->dwStyle & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
width = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - (offsetthumb *
2) - 1;
pos = (range*(place - infoPtr->rcChannel.top - offsetthumb)) / width;
@@ -209,10 +214,9 @@
static LONG
TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO *infoPtr, POINT clickPoint)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT pageRect;
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
pageRect.top = infoPtr->rcChannel.top;
pageRect.bottom = infoPtr->rcChannel.bottom;
pageRect.left = infoPtr->rcThumb.left;
@@ -227,10 +231,10 @@
if (PtInRect(&pageRect, clickPoint))
{
- int clickPlace = (dwStyle & TBS_VERT) ? clickPoint.y : clickPoint.x;
-
- LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace,
- dwStyle & TBS_VERT);
+ int clickPlace = (infoPtr->dwStyle & TBS_VERT) ? clickPoint.y : clickPoint.x;
+
+ LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace);
+
return clickPos - infoPtr->lPos;
}
@@ -281,7 +285,6 @@
static void
TRACKBAR_CalcChannel (TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
INT cyChannel, offsetthumb, offsetedge;
RECT lpRect, *channel = & infoPtr->rcChannel;
@@ -289,22 +292,22 @@
offsetthumb = infoPtr->uThumbLen / 4;
offsetedge = offsetthumb + 3;
- cyChannel = (dwStyle & TBS_ENABLESELRANGE) ? offsetthumb*3 : 4;
- if (dwStyle & TBS_VERT) {
+ cyChannel = (infoPtr->dwStyle & TBS_ENABLESELRANGE) ? offsetthumb*3 : 4;
+ if (infoPtr->dwStyle & TBS_VERT) {
channel->top = lpRect.top + offsetedge;
channel->bottom = lpRect.bottom - offsetedge;
- if (dwStyle & TBS_ENABLESELRANGE)
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE)
channel->left = lpRect.left + ((infoPtr->uThumbLen - cyChannel + 2) /
2);
else
channel->left = lpRect.left + (infoPtr->uThumbLen / 2) - 1;
- if (dwStyle & TBS_BOTH) {
- if (dwStyle & TBS_NOTICKS)
+ if (infoPtr->dwStyle & TBS_BOTH) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->left += 1;
else
channel->left += 9;
}
- else if (dwStyle & TBS_TOP) {
- if (dwStyle & TBS_NOTICKS)
+ else if (infoPtr->dwStyle & TBS_TOP) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->left += 2;
else
channel->left += 10;
@@ -313,18 +316,18 @@
} else {
channel->left = lpRect.left + offsetedge;
channel->right = lpRect.right - offsetedge;
- if (dwStyle & TBS_ENABLESELRANGE)
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE)
channel->top = lpRect.top + ((infoPtr->uThumbLen - cyChannel + 2) /
2);
else
channel->top = lpRect.top + (infoPtr->uThumbLen / 2) - 1;
- if (dwStyle & TBS_BOTH) {
- if (dwStyle & TBS_NOTICKS)
+ if (infoPtr->dwStyle & TBS_BOTH) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->top += 1;
else
channel->top += 9;
}
- else if (dwStyle & TBS_TOP) {
- if (dwStyle & TBS_NOTICKS)
+ else if (infoPtr->dwStyle & TBS_TOP) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->top += 2;
else
channel->top += 10;
@@ -337,7 +340,6 @@
TRACKBAR_CalcThumb (const TRACKBAR_INFO *infoPtr, LONG lPos, RECT *thumb)
{
int range, width, height, thumbwidth;
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT lpRect;
range = infoPtr->lRangeMax - infoPtr->lRangeMin;
@@ -346,11 +348,11 @@
if (!range) range = 1;
GetClientRect(infoPtr->hwndSelf, &lpRect);
- if (dwStyle & TBS_VERT)
+ if (infoPtr->dwStyle & TBS_VERT)
{
height = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - thumbwidth;
- if ((dwStyle & (TBS_BOTH | TBS_LEFT)) && !(dwStyle &
TBS_NOTICKS))
+ if ((infoPtr->dwStyle & (TBS_BOTH | TBS_LEFT)) &&
!(infoPtr->dwStyle & TBS_NOTICKS))
thumb->left = 10;
else
thumb->left = 2;
@@ -366,7 +368,7 @@
thumb->left = infoPtr->rcChannel.left +
(width*(lPos - infoPtr->lRangeMin))/range;
thumb->right = thumb->left + thumbwidth;
- if ((dwStyle & (TBS_BOTH | TBS_TOP)) && !(dwStyle &
TBS_NOTICKS))
+ if ((infoPtr->dwStyle & (TBS_BOTH | TBS_TOP)) &&
!(infoPtr->dwStyle & TBS_NOTICKS))
thumb->top = 10;
else
thumb->top = 2;
@@ -420,7 +422,7 @@
if (range <= 0) {
SetRectEmpty (selection);
} else {
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
height = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top -
offsetthumb*2;
selection->top = infoPtr->rcChannel.top + offsetthumb +
@@ -467,7 +469,7 @@
/* Trackbar drawing code. I like my spaghetti done milanese. */
static void
-TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
RECT rcChannel = infoPtr->rcChannel;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
@@ -475,13 +477,13 @@
if (theme)
{
DrawThemeBackground (theme, hdc,
- (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) ?
+ (infoPtr->dwStyle & TBS_VERT) ?
TKP_TRACKVERT : TKP_TRACK, TKS_NORMAL, &rcChannel, 0);
}
else
{
DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
- if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
FillRect (hdc, &rcChannel, GetStockObject(WHITE_BRUSH));
if (TRACKBAR_HasSelection(infoPtr))
FillRect (hdc, &infoPtr->rcSelection,
GetSysColorBrush(COLOR_HIGHLIGHT));
@@ -575,17 +577,17 @@
}
static void
-TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
unsigned int i;
- int ticFlags = dwStyle & 0x0f;
+ int ticFlags = infoPtr->dwStyle & 0x0f;
LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) };
HPEN hOldPen, hTicPen;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
if (theme)
{
- int part = (dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
+ int part = (infoPtr->dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
GetThemeColor (theme, part, TSS_NORMAL, TMT_COLOR, &ticPen.lopnColor);
}
/* create the pen to draw the tics with */
@@ -599,7 +601,7 @@
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMin, ticFlags | TIC_EDGE);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMax, ticFlags | TIC_EDGE);
- if ((dwStyle & TBS_ENABLESELRANGE) && TRACKBAR_HasSelection(infoPtr)) {
+ if ((infoPtr->dwStyle & TBS_ENABLESELRANGE) &&
TRACKBAR_HasSelection(infoPtr)) {
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMin,
ticFlags | TIC_SELECTIONMARKMIN);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMax,
@@ -614,7 +616,7 @@
}
static void
-TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
HBRUSH oldbr;
HPEN oldpen;
@@ -630,14 +632,14 @@
{
int partId;
int stateId;
- if (dwStyle & TBS_BOTH)
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
- else if (dwStyle & TBS_LEFT)
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBLEFT : TKP_THUMBTOP;
+ if (infoPtr->dwStyle & TBS_BOTH)
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
+ else if (infoPtr->dwStyle & TBS_LEFT)
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBLEFT :
TKP_THUMBTOP;
else
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBRIGHT : TKP_THUMBBOTTOM;
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBRIGHT :
TKP_THUMBBOTTOM;
- if (dwStyle & WS_DISABLED)
+ if (infoPtr->dwStyle & WS_DISABLED)
stateId = TUS_DISABLED;
else if (infoPtr->flags & TB_DRAG_MODE)
stateId = TUS_PRESSED;
@@ -655,7 +657,7 @@
oldbr = SelectObject (hdc, GetSysColorBrush(fillClr));
SetPolyFillMode (hdc, WINDING);
- if (dwStyle & TBS_BOTH)
+ if (infoPtr->dwStyle & TBS_BOTH)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
@@ -672,10 +674,10 @@
}
else
{
- if (dwStyle & TBS_VERT)
+ if (infoPtr->dwStyle & TBS_VERT)
{
PointDepth = (thumb.bottom - thumb.top) / 2;
- if (dwStyle & TBS_LEFT)
+ if (infoPtr->dwStyle & TBS_LEFT)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
@@ -710,7 +712,7 @@
else
{
PointDepth = (thumb.right - thumb.left) / 2;
- if (dwStyle & TBS_TOP)
+ if (infoPtr->dwStyle & TBS_TOP)
{
points[0].x=(thumb.right - thumb.left) / 2 + thumb.left + 1;
points[0].y=thumb.top;
@@ -774,7 +776,6 @@
static void
TRACKBAR_UpdateToolTip (const TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
WCHAR buf[80];
static const WCHAR fmt[] = { '%', 'l', 'd', 0 };
TTTOOLINFOW ti;
@@ -795,7 +796,7 @@
GetClientRect (infoPtr->hwndSelf, &rcClient);
size = SendMessageW (infoPtr->hwndToolTip, TTM_GETBUBBLESIZE, 0,
(LPARAM)&ti);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
if (infoPtr->fLocation == TBTS_LEFT)
pt.x = 0 - LOWORD(size) - TOOLTIP_OFFSET;
else
@@ -818,7 +819,6 @@
static void
TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT rcClient;
HDC hdc;
HBITMAP hOldBmp = 0, hOffScreenBmp = 0;
@@ -885,14 +885,14 @@
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawChannel (infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawChannel (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
/* draw tics */
- if (!(dwStyle & TBS_NOTICKS)) {
+ if (!(infoPtr->dwStyle & TBS_NOTICKS)) {
if (gcdrf & CDRF_NOTIFYITEMDRAW) {
nmcd.dwItemSpec = TBCD_TICS;
nmcd.uItemState = CDIS_DEFAULT;
@@ -900,14 +900,14 @@
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawTics (infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawTics (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
}
/* draw thumb */
- if (!(dwStyle & TBS_NOTHUMB)) {
+ if (!(infoPtr->dwStyle & TBS_NOTHUMB)) {
if (gcdrf & CDRF_NOTIFYITEMDRAW) {
nmcd.dwItemSpec = TBCD_THUMB;
nmcd.uItemState = infoPtr->flags & TB_DRAG_MODE ? CDIS_HOT : CDIS_DEFAULT;
@@ -915,7 +915,7 @@
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawThumb(infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawThumb(infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
@@ -944,7 +944,6 @@
static void
TRACKBAR_AlignBuddies (const TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
HWND hwndParent = GetParent (infoPtr->hwndSelf);
RECT rcSelf, rcBuddy;
INT x, y;
@@ -957,7 +956,7 @@
GetWindowRect (infoPtr->hwndBuddyLA, &rcBuddy);
MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
(rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
y = rcSelf.top - (rcBuddy.bottom - rcBuddy.top);
@@ -978,7 +977,7 @@
GetWindowRect (infoPtr->hwndBuddyRB, &rcBuddy);
MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
(rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
y = rcSelf.bottom;
@@ -1039,13 +1038,9 @@
static inline LONG
TRACKBAR_GetNumTics (const TRACKBAR_INFO *infoPtr)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_NOTICKS)
- return 0;
-
- if(infoPtr->uNumTics == 0)
- return 2;
- else
- return infoPtr->uNumTics + 1;
+ if (infoPtr->dwStyle & TBS_NOTICKS) return 0;
+
+ return infoPtr->uNumTics + 2;
}
@@ -1222,7 +1217,7 @@
static inline LRESULT
TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
infoPtr->lSelMax = 0;
return 0;
@@ -1246,7 +1241,7 @@
static inline LRESULT
TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMax = 0;
return 0;
}
@@ -1266,7 +1261,7 @@
static inline LRESULT
TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
return 0;
}
@@ -1286,7 +1281,7 @@
static inline LRESULT
TRACKBAR_SetThumbLength (TRACKBAR_INFO *infoPtr, UINT iLength)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_FIXEDLENGTH) {
+ if (infoPtr->dwStyle & TBS_FIXEDLENGTH) {
infoPtr->uThumbLen = iLength;
infoPtr->flags |= TB_THUMBSIZECHANGED;
InvalidateRect (infoPtr->hwndSelf, &infoPtr->rcThumb, FALSE);
@@ -1299,7 +1294,7 @@
static inline LRESULT
TRACKBAR_SetTic (TRACKBAR_INFO *infoPtr, LONG lPos)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS)
+ if (infoPtr->dwStyle & TBS_AUTOTICKS)
return FALSE;
if ((lPos < infoPtr->lRangeMin) || (lPos> infoPtr->lRangeMax))
@@ -1326,7 +1321,7 @@
static inline LRESULT
TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS) {
+ if (infoPtr->dwStyle & TBS_AUTOTICKS) {
infoPtr->uTicFreq = wFreq;
TRACKBAR_RecalculateTics (infoPtr);
TRACKBAR_InvalidateAll(infoPtr);
@@ -1370,14 +1365,13 @@
static LRESULT
TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT rect;
int clientWidth, clientMetric;
/* initial thumb length */
- clientMetric = (dwStyle & TBS_ENABLESELRANGE) ? 23 : 21;
+ clientMetric = (infoPtr->dwStyle & TBS_ENABLESELRANGE) ? 23 : 21;
GetClientRect(infoPtr->hwndSelf,&rect);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
clientWidth = rect.right - rect.left;
} else {
clientWidth = rect.bottom - rect.top;
@@ -1399,7 +1393,6 @@
TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{
TRACKBAR_INFO *infoPtr;
- DWORD dwStyle;
infoPtr = Alloc (sizeof(TRACKBAR_INFO));
if (!infoPtr) return -1;
@@ -1407,6 +1400,7 @@
/* set default values */
infoPtr->hwndSelf = hwnd;
+ infoPtr->dwStyle = lpcs->style;
infoPtr->lRangeMin = 0;
infoPtr->lRangeMax = 100;
infoPtr->lLineSize = 1;
@@ -1422,10 +1416,8 @@
TRACKBAR_InitializeThumb (infoPtr);
- dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
-
/* Create tooltip control */
- if (dwStyle & TBS_TOOLTIPS) {
+ if (infoPtr->dwStyle & TBS_TOOLTIPS) {
infoPtr->hwndToolTip =
CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, WS_POPUP,
@@ -1575,6 +1567,16 @@
return 0;
}
+static LRESULT
+TRACKBAR_StyleChanged (TRACKBAR_INFO *infoPtr, WPARAM wStyleType,
+ const STYLESTRUCT *lpss)
+{
+ if (wStyleType != GWL_STYLE) return 0;
+
+ infoPtr->dwStyle = lpss->styleNew;
+
+ return 0;
+}
static LRESULT
TRACKBAR_Timer (TRACKBAR_INFO *infoPtr)
@@ -1602,8 +1604,7 @@
static LRESULT
TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, INT x, INT y)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
- INT clickPlace = (dwStyle & TBS_VERT) ? y : x;
+ INT clickPlace = (infoPtr->dwStyle & TBS_VERT) ? y : x;
LONG dragPos, oldPos = infoPtr->lPos;
TRACE("(x=%d. y=%d)\n", x, y);
@@ -1647,8 +1648,8 @@
return TRUE;
}
- dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
- dwStyle & TBS_VERT);
+ dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace);
+
if (dragPos == oldPos) return TRUE;
infoPtr->lPos = dragPos;
@@ -1666,9 +1667,8 @@
static BOOL
TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey)
{
- DWORD style = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
- BOOL downIsLeft = style & TBS_DOWNISLEFT;
- BOOL vert = style & TBS_VERT;
+ BOOL downIsLeft = infoPtr->dwStyle & TBS_DOWNISLEFT;
+ BOOL vert = infoPtr->dwStyle & TBS_VERT;
LONG pos = infoPtr->lPos;
TRACE("%x\n", nVirtKey);
@@ -1905,6 +1905,9 @@
case WM_SIZE:
return TRACKBAR_Size (infoPtr);
+ case WM_STYLECHANGED:
+ return TRACKBAR_StyleChanged (infoPtr, wParam, (LPSTYLESTRUCT)lParam);
+
case WM_THEMECHANGED:
return theme_changed (infoPtr);
Modified: trunk/reactos/dll/win32/comdlg32/filedlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
==============================================================================
--- trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] Sat Sep 5 17:01:30 2009
@@ -1150,7 +1150,7 @@
case WM_INITDIALOG:
{
FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;
- RECT rc;
+ RECT rc, rcstc;
int gripx = GetSystemMetrics( SM_CYHSCROLL);
int gripy = GetSystemMetrics( SM_CYVSCROLL);
@@ -1183,6 +1183,18 @@
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) {
SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
+ }
+
+ /* if the app has changed the position of the invisible listbox,
+ * change that of the listview (browser) as well */
+ GetWindowRect( fodInfos->ShellInfos.hwndView, &rc);
+ GetWindowRect( GetDlgItem( hwnd, IDC_SHELLSTATIC ), &rcstc);
+ if( !EqualRect( &rc, &rcstc))
+ {
+ MapWindowPoints( NULL, hwnd, (LPPOINT) &rcstc, 2);
+ SetWindowPos( fodInfos->ShellInfos.hwndView, NULL,
+ rcstc.left, rcstc.top, rcstc.right - rcstc.left, rcstc.bottom -
rcstc.top,
+ SWP_NOACTIVATE | SWP_NOZORDER);
}
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)