Commit d2633549 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

comdlg32: Move all of the win 3.1 style functionality into the same file.

parent bd516247
......@@ -177,6 +177,9 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed) DECLSPEC_HIDDEN;
void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) DECLSPEC_HIDDEN;
extern BOOL GetFileName31A( OPENFILENAMEA *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
extern BOOL GetFileName31W( OPENFILENAMEW *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
/* ITEMIDLIST */
extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
......
......@@ -68,7 +68,6 @@
#include "commdlg.h"
#include "dlgs.h"
#include "cdlg.h"
#include "filedlg31.h"
#include "cderr.h"
#include "shellapi.h"
#include "shlobj.h"
......@@ -4025,188 +4024,6 @@ static void MemFree(void *mem)
HeapFree(GetProcessHeap(),0,mem);
}
/*
* Old-style (win3.1) dialogs */
/***********************************************************************
* FD32_GetTemplate [internal]
*
* Get a template (or FALSE if failure) when 16 bits dialogs are used
* by a 32 bits application
*
*/
BOOL FD32_GetTemplate(PFD31_DATA lfs)
{
LPOPENFILENAMEW ofnW = lfs->ofnW;
LPOPENFILENAMEA ofnA = lfs->ofnA;
HANDLE hDlgTmpl;
if (ofnW->Flags & OFN_ENABLETEMPLATEHANDLE)
{
if (!(lfs->template = LockResource( ofnW->hInstance )))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
}
else if (ofnW->Flags & OFN_ENABLETEMPLATE)
{
HRSRC hResInfo;
if (ofnA)
hResInfo = FindResourceA(ofnA->hInstance,
ofnA->lpTemplateName,
(LPSTR)RT_DIALOG);
else
hResInfo = FindResourceW(ofnW->hInstance,
ofnW->lpTemplateName,
(LPWSTR)RT_DIALOG);
if (!hResInfo)
{
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
return FALSE;
}
if (!(hDlgTmpl = LoadResource(ofnW->hInstance,
hResInfo)) ||
!(lfs->template = LockResource(hDlgTmpl)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
} else { /* get it from internal Wine resource */
HRSRC hResInfo;
if (!(hResInfo = FindResourceA(COMDLG32_hInstance,
lfs->open? "OPEN_FILE":"SAVE_FILE", (LPSTR)RT_DIALOG)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
return FALSE;
}
if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
!(lfs->template = LockResource( hDlgTmpl )))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
}
return TRUE;
}
/***********************************************************************
* FD32_WMMeasureItem [internal]
*/
static LONG FD32_WMMeasureItem(LPARAM lParam)
{
LPMEASUREITEMSTRUCT lpmeasure;
lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
lpmeasure->itemHeight = FD31_GetFldrHeight();
return TRUE;
}
/***********************************************************************
* FileOpenDlgProc [internal]
* Used for open and save, in fact.
*/
static INT_PTR CALLBACK FD32_FileOpenDlgProc(HWND hWnd, UINT wMsg,
WPARAM wParam, LPARAM lParam)
{
PFD31_DATA lfs = (PFD31_DATA)GetPropA(hWnd,FD31_OFN_PROP);
TRACE("msg=%x wparam=%lx lParam=%lx\n", wMsg, wParam, lParam);
if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
{
INT_PTR lRet;
lRet = (INT_PTR)FD31_CallWindowProc(lfs, wMsg, wParam, lParam);
if (lRet)
return lRet; /* else continue message processing */
}
switch (wMsg)
{
case WM_INITDIALOG:
return FD31_WMInitDialog(hWnd, wParam, lParam);
case WM_MEASUREITEM:
return FD32_WMMeasureItem(lParam);
case WM_DRAWITEM:
return FD31_WMDrawItem(hWnd, wParam, lParam, !lfs->open, (DRAWITEMSTRUCT *)lParam);
case WM_COMMAND:
return FD31_WMCommand(hWnd, lParam, HIWORD(wParam), LOWORD(wParam), lfs);
#if 0
case WM_CTLCOLOR:
SetBkColor((HDC16)wParam, 0x00C0C0C0);
switch (HIWORD(lParam))
{
case CTLCOLOR_BTN:
SetTextColor((HDC16)wParam, 0x00000000);
return hGRAYBrush;
case CTLCOLOR_STATIC:
SetTextColor((HDC16)wParam, 0x00000000);
return hGRAYBrush;
}
break;
#endif
}
return FALSE;
}
/***********************************************************************
* GetFileName31A [internal]
*
* Creates a win31 style dialog box for the user to select a file to open/save.
*/
static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with data*/
UINT dlgType /* type dialogue : open/save */
)
{
BOOL bRet = FALSE;
PFD31_DATA lfs;
if (!lpofn || !FD31_Init()) return FALSE;
TRACE("ofn flags %08x\n", lpofn->Flags);
lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
if (lfs)
{
bRet = DialogBoxIndirectParamA( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
FD32_FileOpenDlgProc, (LPARAM)lfs);
FD31_DestroyPrivate(lfs);
}
TRACE("return lpstrFile='%s' !\n", lpofn->lpstrFile);
return bRet;
}
/***********************************************************************
* GetFileName31W [internal]
*
* Creates a win31 style dialog box for the user to select a file to open/save
*/
static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with data*/
UINT dlgType /* type dialogue : open/save */
)
{
BOOL bRet = FALSE;
PFD31_DATA lfs;
if (!lpofn || !FD31_Init()) return FALSE;
lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
if (lfs)
{
bRet = DialogBoxIndirectParamW( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
FD32_FileOpenDlgProc, (LPARAM)lfs);
FD31_DestroyPrivate(lfs);
}
TRACE("file %s, file offset %d, ext offset %d\n",
debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension);
return bRet;
}
static inline BOOL is_win16_looks(DWORD flags)
{
return (flags & (OFN_ALLOWMULTISELECT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE) &&
......
/*
* Win3.1 style File Dialog interface (32 bit)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WINE_DLL_FILEDLG31_H
#define _WINE_DLL_FILEDLG31_H
#define FD31_OFN_PROP "FILEDLG_OFN"
typedef struct tagFD31_DATA
{
HWND hwnd; /* file dialog window handle */
BOOL hook; /* TRUE if the dialog is hooked */
UINT lbselchstring; /* registered message id */
UINT fileokstring; /* registered message id */
LPARAM lParam; /* save original lparam */
LPCVOID template; /* template for 32 bits resource */
BOOL open; /* TRUE if open dialog, FALSE if save dialog */
LPOPENFILENAMEW ofnW; /* pointer either to the original structure or
a W copy for A/16 API */
LPOPENFILENAMEA ofnA; /* original structure if 32bits ansi dialog */
} FD31_DATA, *PFD31_DATA;
extern BOOL FD32_GetTemplate(PFD31_DATA lfs) DECLSPEC_HIDDEN;
extern BOOL FD31_Init(void) DECLSPEC_HIDDEN;
extern PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode) DECLSPEC_HIDDEN;
extern void FD31_DestroyPrivate(PFD31_DATA lfs) DECLSPEC_HIDDEN;
extern BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam,
LPARAM lParam) DECLSPEC_HIDDEN;
extern LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
extern LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
int savedlg, const DRAWITEMSTRUCT *lpdis) DECLSPEC_HIDDEN;
extern LRESULT FD31_WMCommand(HWND hWnd, LPARAM lParam, UINT notification,
UINT control, const FD31_DATA *lfs) DECLSPEC_HIDDEN;
extern int FD31_GetFldrHeight(void) DECLSPEC_HIDDEN;
#endif /* _WINE_DLL_FILEDLG31_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment