mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:50:37 +00:00
- Fix obsolete comments about windowsx, commdlg.
- Increase filename length to MAX_PATH. - Set the windows extent before playing the metafile. - Don't hardcode logpixels to 96.
This commit is contained in:
parent
e45d29cdc1
commit
5ac00719c8
|
@ -17,16 +17,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "resource.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
Wine doesn't have windowsx.h, so we use this
|
#include "resource.h"
|
||||||
*/
|
|
||||||
#define GET_WM_COMMAND_ID(wp,lp) LOWORD(wp)
|
|
||||||
|
|
||||||
/* Wine seems to need this */
|
|
||||||
#include <commdlg.h>
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -34,8 +26,6 @@
|
||||||
BOOL FileIsPlaceable( LPCSTR szFileName );
|
BOOL FileIsPlaceable( LPCSTR szFileName );
|
||||||
HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName );
|
HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName );
|
||||||
|
|
||||||
#define FN_LENGTH 80
|
|
||||||
|
|
||||||
HMETAFILE hmf;
|
HMETAFILE hmf;
|
||||||
int deltax = 0, deltay = 0;
|
int deltax = 0, deltay = 0;
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
|
@ -69,11 +59,12 @@ LRESULT CALLBACK WndProc(HWND hwnd,
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
BeginPaint(hwnd, &ps);
|
BeginPaint(hwnd, &ps);
|
||||||
SetMapMode(ps.hdc, MM_ANISOTROPIC);
|
SetMapMode(ps.hdc, MM_ANISOTROPIC);
|
||||||
|
/* Set the window extent to a sane value in case the metafile doesn't */
|
||||||
|
SetWindowExtEx(ps.hdc, width, height, NULL);
|
||||||
SetViewportExtEx(ps.hdc, width, height, NULL);
|
SetViewportExtEx(ps.hdc, width, height, NULL);
|
||||||
SetViewportOrgEx(ps.hdc, deltax, deltay, NULL);
|
SetViewportOrgEx(ps.hdc, deltax, deltay, NULL);
|
||||||
if(hmf) PlayMetaFile(ps.hdc, hmf);
|
if(hmf) PlayMetaFile(ps.hdc, hmf);
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -86,8 +77,8 @@ LRESULT CALLBACK WndProc(HWND hwnd,
|
||||||
|
|
||||||
case IDM_OPEN:
|
case IDM_OPEN:
|
||||||
{
|
{
|
||||||
char filename[FN_LENGTH];
|
char filename[MAX_PATH];
|
||||||
if (FileOpen(hwnd, filename, FN_LENGTH)) {
|
if (FileOpen(hwnd, filename, sizeof(filename))) {
|
||||||
isAldus = FileIsPlaceable(filename);
|
isAldus = FileIsPlaceable(filename);
|
||||||
if (isAldus) {
|
if (isAldus) {
|
||||||
hmf = GetPlaceableMetaFile(hwnd, filename);
|
hmf = GetPlaceableMetaFile(hwnd, filename);
|
||||||
|
@ -178,6 +169,7 @@ HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName )
|
||||||
HFILE fh;
|
HFILE fh;
|
||||||
HMETAFILE hmf;
|
HMETAFILE hmf;
|
||||||
WORD checksum, *p;
|
WORD checksum, *p;
|
||||||
|
HDC hdc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( (fh = _lopen( szFileName, OF_READ ) ) == HFILE_ERROR ) return 0;
|
if( (fh = _lopen( szFileName, OF_READ ) ) == HFILE_ERROR ) return 0;
|
||||||
|
@ -218,8 +210,10 @@ HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName )
|
||||||
height = APMHeader.bbox.Bottom - APMHeader.bbox.Top;
|
height = APMHeader.bbox.Bottom - APMHeader.bbox.Top;
|
||||||
|
|
||||||
/* printf("Ok! width %d height %d inch %d\n", width, height, APMHeader.inch); */
|
/* printf("Ok! width %d height %d inch %d\n", width, height, APMHeader.inch); */
|
||||||
width = width*96/APMHeader.inch;
|
hdc = GetDC(hwnd);
|
||||||
height = height*96/APMHeader.inch;
|
width = width * GetDeviceCaps(hdc, LOGPIXELSX)/APMHeader.inch;
|
||||||
|
height = height * GetDeviceCaps(hdc,LOGPIXELSY)/APMHeader.inch;
|
||||||
|
ReleaseDC(hwnd, hdc);
|
||||||
|
|
||||||
deltax = 0;
|
deltax = 0;
|
||||||
deltay = 0 ;
|
deltay = 0 ;
|
||||||
|
|
Loading…
Reference in a new issue