Commit 9f625c5e authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Draw a representation of a document in the page setup dialog.

- Change some FIXME's to TRACE's because everything we need is implemented and they fire for ones that we don't need to implement.
parent 57e00da2
......@@ -152,6 +152,8 @@ typedef struct {
#define IDS_SAVE_AS 1204
#define IDS_OPEN_FILE 1205
#define IDS_FAKEDOCTEXT 1300
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
......
......@@ -470,6 +470,34 @@ STRINGTABLE DISCARDABLE
IDS_OPEN_FILE "Open File"
}
/* Translators do not need to translate this text, unless the language uses a
* different character set or if the distribution of characters looks wrong.
* It is rendered illegibly small and is used to make a mock-up of a document.
*/
STRINGTABLE DISCARDABLE
{
IDS_FAKEDOCTEXT
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
Nulla a tortor. Etiam aliquet libero venenatis nunc. \n \
\n \
Sed augue ante, fermentum sit amet, imperdiet et, gravida eu, enim. \
Donec nibh quam, sodales in, commodo vel, facilisis id, neque. \n \
\n \
Nunc eleifend bibendum nibh. Phasellus in lorem. Ut vel odio quis \
libero adipiscing consequat. Donec consectetuer laoreet mauris. \n \
\n \
Maecenas tempor, ligula sed congue nonummy, arcu dolor ornare erat, \
egestas iaculis magna purus sed turpis. \n \
\n \
Morbi ultricies est non ipsum. Cum sociis natoque penatibus et magnis \
dis parturient montes, nascetur ridiculus mus. \n \
\n \
Duis sit amet nibh quis purus sollicitudin blandit. Curabitur justo. \
Phasellus varius, erat eu luctus pharetra, odio elit fringilla leo, \
non vulputate turpis elit id neque. Vestibulum sit amet tellus sed \
tortor fermentum consectetuer."
}
/****************************************************************/
/* English neutral resources
/****************************************************************/
......
......@@ -71,6 +71,11 @@ static struct pd_flags psd_flags[] = {
{-1, NULL}
};
/* address of wndproc for subclassed Static control */
static WNDPROC lpfnStaticWndProc;
/* the text of the fake document to render for the Page Setup dialog */
static WCHAR wszFakeDocumentText[1024];
/***********************************************************************
* PRINTDLG_OpenDefaultPrinter
*
......@@ -2551,6 +2556,8 @@ static BOOL
PRINTDLG_PS_WMCommandA(
HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataA *pda
) {
TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n",
LOWORD(lParam),wParam,lParam);
switch (LOWORD(wParam)) {
case IDOK:
if (!PRINTDLG_PS_UpdateDlgStructA(hDlg, pda))
......@@ -2570,9 +2577,6 @@ PRINTDLG_PS_WMCommandA(
return TRUE;
}
}
FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n",
LOWORD(lParam),wParam,lParam
);
return FALSE;
}
......@@ -2580,6 +2584,8 @@ static BOOL
PRINTDLG_PS_WMCommandW(
HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataW *pda
) {
TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n",
LOWORD(lParam),wParam,lParam);
switch (LOWORD(wParam)) {
case IDOK:
if (!PRINTDLG_PS_UpdateDlgStructW(hDlg, pda))
......@@ -2599,13 +2605,114 @@ PRINTDLG_PS_WMCommandW(
return TRUE;
}
}
FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n",
LOWORD(lParam),wParam,lParam
);
return FALSE;
}
static LRESULT CALLBACK
PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_PAINT)
{
PAINTSTRUCT ps;
RECT rcClient;
HPEN hpen, holdpen;
HDC hdc;
HFONT hfont, holdfont;
LOGFONTW lf;
HBRUSH hbrush, holdbrush;
INT oldbkmode;
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rcClient);
/* fill background */
hbrush = GetSysColorBrush(COLOR_3DHIGHLIGHT);
FillRect(hdc, &rcClient, hbrush);
holdbrush = SelectObject(hdc, hbrush);
hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
holdpen = SelectObject(hdc, hpen);
/* paint left edge */
MoveToEx(hdc, rcClient.left, rcClient.top, NULL);
LineTo(hdc, rcClient.left, rcClient.bottom-1);
/* paint top edge */
MoveToEx(hdc, rcClient.left, rcClient.top, NULL);
LineTo(hdc, rcClient.right, rcClient.top);
hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW));
DeleteObject(SelectObject(hdc, hpen));
/* paint right edge */
MoveToEx(hdc, rcClient.right-1, rcClient.top, NULL);
LineTo(hdc, rcClient.right-1, rcClient.bottom);
/* paint bottom edge */
MoveToEx(hdc, rcClient.left, rcClient.bottom-1, NULL);
LineTo(hdc, rcClient.right, rcClient.bottom-1);
hpen = CreatePen(PS_DASH, 1, GetSysColor(COLOR_3DSHADOW));
DeleteObject(SelectObject(hdc, hpen));
/* draw dashed rectangle showing margins */
/* FIXME: use real margin values */
rcClient.left += 5;
rcClient.top += 5;
rcClient.right -= 5;
rcClient.bottom -= 5;
/* if the space is too small then we make sure to not draw anything */
rcClient.left = min(rcClient.left,rcClient.right);
rcClient.top = min(rcClient.top,rcClient.bottom);
Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
DeleteObject(SelectObject(hdc, holdpen));
/* draw the fake document */
/* give text a bit of a space from the frame */
rcClient.left += 2;
rcClient.top += 2;
rcClient.right -= 2;
rcClient.bottom -= 2;
/* if the space is too small then we make sure to not draw anything */
rcClient.left = min(rcClient.left,rcClient.right);
rcClient.top = min(rcClient.top,rcClient.bottom);
/* select a nice scalable font, because we want the text really small */
SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
lf.lfHeight = 6; /* value chosen based on visual effect */
hfont = CreateFontIndirectW(&lf);
holdfont = SelectObject(hdc, hfont);
/* if text not loaded, then do so now */
if (wszFakeDocumentText[0] == '\0')
LoadStringW(COMDLG32_hInstance,
IDS_FAKEDOCTEXT,
wszFakeDocumentText,
sizeof(wszFakeDocumentText)/sizeof(wszFakeDocumentText[0]));
oldbkmode = SetBkMode(hdc, TRANSPARENT);
DrawTextW(hdc, wszFakeDocumentText, -1, &rcClient, DT_TOP|DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
SetBkMode(hdc, oldbkmode);
DeleteObject(SelectObject(hdc, holdfont));
SelectObject(hdc, holdbrush);
EndPaint(hWnd, &ps);
return 0;
}
else
return CallWindowProcW(lpfnStaticWndProc, hWnd, uMsg, wParam, lParam);
}
static INT_PTR CALLBACK
PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
......@@ -2613,6 +2720,10 @@ PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR res = FALSE;
if (uMsg==WM_INITDIALOG) {
lpfnStaticWndProc = (WNDPROC)SetWindowLongPtrW(
GetDlgItem(hDlg, rct1),
GWLP_WNDPROC,
(ULONG_PTR)PagePaintProc);
res = TRUE;
pda = (PageSetupDataA*)lParam;
SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",pda);
......
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