Author: dchapyshev
Date: Sat May 9 13:20:57 2009
New Revision: 40847
URL:
http://svn.reactos.org/svn/reactos?rev=40847&view=rev
Log:
- Sync comctl32 (without listview.c), comdlg32 with Wine 1.1.21
Modified:
trunk/reactos/dll/win32/comctl32/commctrl.c
trunk/reactos/dll/win32/comctl32/header.c
trunk/reactos/dll/win32/comctl32/toolbar.c
trunk/reactos/dll/win32/comdlg32/filedlg.c
trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c
trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h
Modified: trunk/reactos/dll/win32/comctl32/commctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Sat May 9 13:20:57 2009
@@ -772,7 +772,7 @@
HWND WINAPI
CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
- HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
+ HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons,
INT iNumButtons, INT dxButton, INT dyButton,
INT dxBitmap, INT dyBitmap, UINT uStructSize)
{
Modified: trunk/reactos/dll/win32/comctl32/header.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/header.…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/header.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/header.c [iso-8859-1] Sat May 9 13:20:57 2009
@@ -1663,7 +1663,8 @@
}
else
InvalidateRect(hwnd, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
-
+
+ infoPtr->bDragging = FALSE;
HEADER_SetHotDivider(hwnd, FALSE, -1);
}
else if (!(dwStyle&HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt))
Modified: trunk/reactos/dll/win32/comctl32/toolbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] Sat May 9 13:20:57 2009
@@ -1841,7 +1841,9 @@
btnPtr->fsState = lpTbb[iButton].fsState;
btnPtr->fsStyle = lpTbb[iButton].fsStyle;
btnPtr->dwData = lpTbb[iButton].dwData;
- if(HIWORD(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1)
+ if (btnPtr->fsStyle & BTNS_SEP)
+ btnPtr->iString = -1;
+ else if(HIWORD(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1)
{
if (fUnicode)
Str_SetPtrW((LPWSTR*)&btnPtr->iString,
(LPWSTR)lpTbb[iButton].iString );
@@ -3433,9 +3435,6 @@
INT nIndex;
LPWSTR lpText;
- if (lParam == 0)
- return -1;
-
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return -1;
@@ -3443,7 +3442,7 @@
lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
return WideCharToMultiByte( CP_ACP, 0, lpText, -1,
- (LPSTR)lParam, 0x7fffffff, NULL, NULL ) - 1;
+ (LPSTR)lParam, lParam ? 0x7fffffff : 0, NULL, NULL ) -
1;
}
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 May 9 13:20:57 2009
@@ -37,7 +37,6 @@
* FIXME: add to recent docs
*
* FIXME: flags not implemented: OFN_DONTADDTORECENT,
- * OFN_ENABLESIZING,
* OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NOTESTFILECREATE, OFN_USEMONIKERS
*
@@ -82,7 +81,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#define UNIMPLEMENTED_FLAGS \
-(OFN_DONTADDTORECENT | OFN_ENABLESIZING |\
+(OFN_DONTADDTORECENT |\
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
@@ -269,6 +268,13 @@
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
+ }
+
+ if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
+ {
+ ((LPDLGTEMPLATEW)template)->style |= WS_SIZEBOX;
+ fodInfos->sizedlg.cx = fodInfos->sizedlg.cy = 0;
+ fodInfos->initial_size.x = fodInfos->initial_size.y = 0;
}
/* old style hook messages */
@@ -979,6 +985,125 @@
}
/***********************************************************************
+ * FILEDLG95_OnWMGetMMI
+ *
+ * WM_GETMINMAXINFO message handler for resizable dialogs
+ */
+static LRESULT FILEDLG95_OnWMGetMMI( HWND hwnd, LPMINMAXINFO mmiptr)
+{
+ FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
+ if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
+ if( fodInfos->initial_size.x || fodInfos->initial_size.y)
+ {
+ mmiptr->ptMinTrackSize = fodInfos->initial_size;
+ }
+ return TRUE;
+}
+
+/***********************************************************************
+ * FILEDLG95_OnWMSize
+ *
+ * WM_SIZE message handler, resize the dialog. Re-arrange controls.
+ *
+ * FIXME: this could be made more elaborate. Now use a simple scheme
+ * where the file view is enlarged and the controls are either moved
+ * vertically or horizontally to get out of the way. Only the "grip"
+ * is moved in both directions to stay in the corner.
+ */
+static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+ RECT rc, rcview;
+ int chgx, chgy;
+ HWND ctrl;
+ HDWP hdwp;
+ FileOpenDlgInfos *fodInfos;
+
+ if( wParam != SIZE_RESTORED) return FALSE;
+ fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
+ if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
+ /* get the new dialog rectangle */
+ GetWindowRect( hwnd, &rc);
+ /* not initialized yet */
+ if( (fodInfos->sizedlg.cx == 0 && fodInfos->sizedlg.cy == 0) ||
+ ((fodInfos->sizedlg.cx == rc.right -rc.left) && /* no change */
+ (fodInfos->sizedlg.cy == rc.bottom -rc.top)))
+ return FALSE;
+ chgx = rc.right - rc.left - fodInfos->sizedlg.cx;
+ chgy = rc.bottom - rc.top - fodInfos->sizedlg.cy;
+ fodInfos->sizedlg.cx = rc.right - rc.left;
+ fodInfos->sizedlg.cy = rc.bottom - rc.top;
+ /* change the size of the view window */
+ GetWindowRect( fodInfos->ShellInfos.hwndView, &rcview);
+ MapWindowPoints( NULL, hwnd, (LPPOINT) &rcview, 2);
+ hdwp = BeginDeferWindowPos( 10);
+ DeferWindowPos( hdwp, fodInfos->ShellInfos.hwndView, NULL, 0, 0,
+ rcview.right - rcview.left + chgx,
+ rcview.bottom - rcview.top + chgy,
+ SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+ /* change position and sizes of the controls */
+ for( ctrl = GetWindow( hwnd, GW_CHILD); ctrl ; ctrl = GetWindow( ctrl, GW_HWNDNEXT))
+ {
+ GetWindowRect( ctrl, &rc);
+ MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
+ if( ctrl == fodInfos->DlgInfos.hwndGrip)
+ {
+ DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top + chgy,
+ 0, 0,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ else if( rc.top > rcview.bottom)
+ {
+ /* if it was below the shell view
+ * move to bottom */
+ DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
+ rc.right - rc.left, rc.bottom - rc.top,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ else if( rc.left > rcview.right)
+ {
+ /* if it was to the right of the shell view
+ * move to right */
+ DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
+ rc.right - rc.left, rc.bottom - rc.top,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ }
+ if(fodInfos->DlgInfos.hwndCustomDlg &&
+ (fodInfos->ofnInfos->Flags & (OFN_ENABLETEMPLATE |
OFN_ENABLETEMPLATEHANDLE)))
+ {
+ GetClientRect(hwnd, &rc);
+ DeferWindowPos( hdwp,fodInfos->DlgInfos.hwndCustomDlg, NULL,
+ 0, 0, rc.right, rc.bottom, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+ for( ctrl = GetWindow( fodInfos->DlgInfos.hwndCustomDlg, GW_CHILD);
+ ctrl ; ctrl = GetWindow( ctrl, GW_HWNDNEXT))
+ {
+ GetWindowRect( ctrl, &rc);
+ MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
+ if( rc.top > rcview.bottom)
+ {
+ /* if it was below the shell view
+ * move to bottom */
+ DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
+ rc.right - rc.left, rc.bottom - rc.top,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ else if( rc.left > rcview.right)
+ {
+ /* if it was to the right of the shell view
+ * move to right */
+ DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
+ rc.right - rc.left, rc.bottom - rc.top,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ }
+ }
+ EndDeferWindowPos( hdwp);
+ /* should not be needed */
+ RedrawWindow( hwnd, NULL, 0, RDW_ALLCHILDREN | RDW_INVALIDATE );
+ return TRUE;
+}
+
+/***********************************************************************
* FileOpenDlgProc95
*
* File open dialog procedure
@@ -994,6 +1119,9 @@
case WM_INITDIALOG:
{
FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;
+ RECT rc;
+ int gripx = GetSystemMetrics( SM_CYHSCROLL);
+ int gripy = GetSystemMetrics( SM_CYVSCROLL);
/* Adds the FileOpenDlgInfos in the property list of the dialog
so it will be easily accessible through a GetPropA(...) */
@@ -1001,17 +1129,49 @@
FILEDLG95_InitControls(hwnd);
+ if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
+ {
+ GetWindowRect( hwnd, &rc);
+ fodInfos->DlgInfos.hwndGrip =
+ CreateWindowExA( 0, "SCROLLBAR", NULL,
+ WS_CHILD | WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS |
+ SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN,
+ rc.right - gripx, rc.bottom - gripy,
+ gripx, gripy, hwnd, (HMENU) -1, COMDLG32_hInstance, NULL);
+ }
+
fodInfos->DlgInfos.hwndCustomDlg =
CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
FILEDLG95_ResizeControls(hwnd, wParam, lParam);
FILEDLG95_FillControls(hwnd, wParam, lParam);
- SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
- SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
- SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE);
+ if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
+ {
+ GetWindowRect( hwnd, &rc);
+ /* FIXME: should remember sizes of last invocation */
+ fodInfos->sizedlg.cx = rc.right - rc.left;
+ fodInfos->sizedlg.cy = rc.bottom - rc.top;
+ fodInfos->initial_size.x = fodInfos->sizedlg.cx;
+ fodInfos->initial_size.y = fodInfos->sizedlg.cy;
+ GetClientRect( hwnd, &rc);
+ SetWindowPos( fodInfos->DlgInfos.hwndGrip, NULL,
+ rc.right - gripx, rc.bottom - gripy,
+ 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ {
+ SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
+ SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
+ SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE);
+ }
return 0;
}
+ case WM_SIZE:
+ return FILEDLG95_OnWMSize(hwnd, wParam, lParam);
+ case WM_GETMINMAXINFO:
+ return FILEDLG95_OnWMGetMMI( hwnd, (LPMINMAXINFO)lParam);
case WM_COMMAND:
return FILEDLG95_OnWMCommand(hwnd, wParam, lParam);
case WM_DRAWITEM:
@@ -1592,11 +1752,12 @@
/* ask the hook if we can close */
if(IsHooked(fodInfos))
{
- LRESULT retval;
+ LRESULT retval = 0;
TRACE("---\n");
/* First send CDN_FILEOK as MSDN doc says */
- retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT))
{
TRACE("canceled\n");
@@ -1991,7 +2152,8 @@
IPersistFolder2_Release(ppf2);
if( ! COMDLG32_PIDL_ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
{
- if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
pidlCurrent, SBSP_ABSOLUTE)))
+ if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
pidlCurrent, SBSP_ABSOLUTE))
+ && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
{
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
}
@@ -2294,7 +2456,8 @@
NULL,
SBSP_PARENT)))
{
- SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE;
}
return FALSE;
@@ -2316,7 +2479,8 @@
SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl,
SBSP_ABSOLUTE);
- SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
COMDLG32_SHFree(pidl);
return SUCCEEDED(hres);
}
@@ -2494,7 +2658,8 @@
len = lstrlenW(lpstrFilter)+1;
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
- SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
}
/* Refresh the actual view to display the included items*/
@@ -2798,7 +2963,8 @@
tmpFolder->pidlItem,
SBSP_ABSOLUTE)))
{
- SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE;
}
break;
@@ -3472,7 +3638,8 @@
MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK |
MB_ICONEXCLAMATION );
}
bBrowseSelFolder = TRUE;
- SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
}
COMDLG32_SHFree( pidlSelection );
}
Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
==============================================================================
--- trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] Sat May 9 13:20:57
2009
@@ -785,7 +785,8 @@
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
{
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
- SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
}
else
{
@@ -960,7 +961,8 @@
FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
- SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
+ if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
+ SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
return S_OK;
}
Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
==============================================================================
--- trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h [iso-8859-1] Sat May 9 13:20:57
2009
@@ -58,6 +58,8 @@
LPCWSTR defext;
LPCWSTR filter;
LPCWSTR customfilter;
+ SIZE sizedlg; /* remember the size of the dialog */
+ POINT initial_size; /* remember the initial size of the dialog */
struct {
IShellBrowser *FOIShellBrowser;
IShellFolder *FOIShellFolder;
@@ -78,6 +80,7 @@
HWND hwndLookInCB;
HWND hwndFileName;
HWND hwndTB;
+ HWND hwndGrip;
HWND hwndCustomDlg;
DWORD dwDlgProp;
} DlgInfos;