Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8286bfee
Commit
8286bfee
authored
Jul 25, 2011
by
André Hentschel
Committed by
Alexandre Julliard
Jul 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view: Add support for enhanced metafiles.
parent
c243e190
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
view.c
programs/view/view.c
+35
-4
No files found.
programs/view/view.c
View file @
8286bfee
...
...
@@ -27,9 +27,10 @@ static char szAppName[5] = "View";
static
char
szTitle
[
80
];
static
HMETAFILE
hmf
;
static
HENHMETAFILE
enhmf
;
static
int
deltax
=
0
,
deltay
=
0
;
static
int
width
=
0
,
height
=
0
;
static
BOOL
isAldus
;
static
BOOL
isAldus
,
isEnhanced
;
#include "pshpack1.h"
typedef
struct
...
...
@@ -52,7 +53,7 @@ static BOOL FileOpen(HWND hWnd, char *fn, int fnsz)
0
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
,
fnsz
,
NULL
,
0
,
NULL
,
NULL
,
OFN_SHOWHELP
,
0
,
0
,
NULL
,
0
,
NULL
};
ofn
.
lpstrFilter
=
"Metafiles
\0
*.wmf
\0
"
;
ofn
.
lpstrFilter
=
"Metafiles
\0
*.wmf
;*.emf
\0
"
;
ofn
.
hwndOwner
=
hWnd
;
ofn
.
lpstrFile
=
fn
;
if
(
fnsz
<
1
)
...
...
@@ -61,6 +62,25 @@ static BOOL FileOpen(HWND hWnd, char *fn, int fnsz)
return
GetOpenFileName
(
&
ofn
);
}
static
BOOL
FileIsEnhanced
(
LPCSTR
szFileName
)
{
HFILE
hInFile
;
ENHMETAHEADER
enh
;
if
(
(
hInFile
=
_lopen
(
szFileName
,
OF_READ
)
)
==
HFILE_ERROR
)
return
FALSE
;
if
(
_lread
(
hInFile
,
&
enh
,
sizeof
(
ENHMETAHEADER
)
)
!=
sizeof
(
ENHMETAHEADER
)
)
{
_lclose
(
hInFile
);
return
FALSE
;
}
_lclose
(
hInFile
);
/* Is it enhanced? */
return
(
enh
.
dSignature
==
ENHMETA_SIGNATURE
);
}
static
BOOL
FileIsPlaceable
(
LPCSTR
szFileName
)
{
HFILE
hInFile
;
...
...
@@ -154,7 +174,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM
SetWindowExtEx
(
ps
.
hdc
,
width
,
height
,
NULL
);
SetViewportExtEx
(
ps
.
hdc
,
width
,
height
,
NULL
);
SetViewportOrgEx
(
ps
.
hdc
,
deltax
,
deltay
,
NULL
);
if
(
hmf
)
PlayMetaFile
(
ps
.
hdc
,
hmf
);
if
(
isEnhanced
&&
enhmf
)
{
RECT
r
;
GetClientRect
(
hwnd
,
&
r
);
PlayEnhMetaFile
(
ps
.
hdc
,
enhmf
,
&
r
);
}
else
if
(
hmf
)
PlayMetaFile
(
ps
.
hdc
,
hmf
);
EndPaint
(
hwnd
,
&
ps
);
}
break
;
...
...
@@ -171,7 +198,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM
hmf
=
GetPlaceableMetaFile
(
hwnd
,
filename
);
}
else
{
RECT
r
;
hmf
=
GetMetaFile
(
filename
);
isEnhanced
=
FileIsEnhanced
(
filename
);
if
(
isEnhanced
)
enhmf
=
GetEnhMetaFile
(
filename
);
else
hmf
=
GetMetaFile
(
filename
);
GetClientRect
(
hwnd
,
&
r
);
width
=
r
.
right
-
r
.
left
;
height
=
r
.
bottom
-
r
.
top
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment