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
8d771576
Commit
8d771576
authored
Jan 07, 2009
by
Francois Gouget
Committed by
Alexandre Julliard
Jan 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view: Make FileIsPlaceable() and GetPlaceableMetaFile() static.
parent
e30bb829
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
82 deletions
+79
-82
view.c
programs/view/view.c
+79
-82
No files found.
programs/view/view.c
View file @
8d771576
...
@@ -23,9 +23,6 @@
...
@@ -23,9 +23,6 @@
#include "globals.h"
#include "globals.h"
#include <stdio.h>
#include <stdio.h>
BOOL
FileIsPlaceable
(
LPCSTR
szFileName
);
HMETAFILE
GetPlaceableMetaFile
(
HWND
hwnd
,
LPCSTR
szFileName
);
HMETAFILE
hmf
;
HMETAFILE
hmf
;
int
deltax
=
0
,
deltay
=
0
;
int
deltax
=
0
,
deltay
=
0
;
int
width
=
0
,
height
=
0
;
int
width
=
0
,
height
=
0
;
...
@@ -46,6 +43,85 @@ static BOOL FileOpen(HWND hWnd, char *fn, int fnsz)
...
@@ -46,6 +43,85 @@ static BOOL FileOpen(HWND hWnd, char *fn, int fnsz)
return
GetOpenFileName
(
&
ofn
);
return
GetOpenFileName
(
&
ofn
);
}
}
static
BOOL
FileIsPlaceable
(
LPCSTR
szFileName
)
{
HFILE
hInFile
;
APMFILEHEADER
apmh
;
if
(
(
hInFile
=
_lopen
(
szFileName
,
OF_READ
)
)
==
HFILE_ERROR
)
return
FALSE
;
if
(
_lread
(
hInFile
,
&
apmh
,
sizeof
(
APMFILEHEADER
)
)
!=
sizeof
(
APMFILEHEADER
)
)
{
_lclose
(
hInFile
);
return
FALSE
;
}
_lclose
(
hInFile
);
/* Is it placeable? */
return
(
apmh
.
key
==
APMHEADER_KEY
);
}
static
HMETAFILE
GetPlaceableMetaFile
(
HWND
hwnd
,
LPCSTR
szFileName
)
{
LPBYTE
lpData
;
METAHEADER
mfHeader
;
APMFILEHEADER
APMHeader
;
HFILE
fh
;
HMETAFILE
hmf
;
WORD
checksum
,
*
p
;
HDC
hdc
;
int
i
;
if
(
(
fh
=
_lopen
(
szFileName
,
OF_READ
)
)
==
HFILE_ERROR
)
return
0
;
_llseek
(
fh
,
0
,
0
);
if
(
!
_lread
(
fh
,
(
LPSTR
)
&
APMHeader
,
sizeof
(
APMFILEHEADER
)))
return
0
;
_llseek
(
fh
,
sizeof
(
APMFILEHEADER
),
0
);
checksum
=
0
;
p
=
(
WORD
*
)
&
APMHeader
;
for
(
i
=
0
;
i
<
10
;
i
++
)
checksum
^=
*
p
++
;
if
(
checksum
!=
APMHeader
.
checksum
)
{
char
msg
[
128
];
sprintf
(
msg
,
"Computed checksum %04x != stored checksum %04x
\n
"
,
checksum
,
APMHeader
.
checksum
);
MessageBox
(
hwnd
,
msg
,
"Checksum failed"
,
MB_OK
);
return
0
;
}
if
(
!
_lread
(
fh
,
(
LPSTR
)
&
mfHeader
,
sizeof
(
METAHEADER
)))
return
0
;
if
(
!
(
lpData
=
GlobalAlloc
(
GPTR
,
(
mfHeader
.
mtSize
*
2L
))))
return
0
;
_llseek
(
fh
,
sizeof
(
APMFILEHEADER
),
0
);
if
(
!
_lread
(
fh
,
lpData
,
(
UINT
)(
mfHeader
.
mtSize
*
2L
)))
{
GlobalFree
((
HGLOBAL
)
lpData
);
_lclose
(
fh
);
return
0
;
}
_lclose
(
fh
);
if
(
!
(
hmf
=
SetMetaFileBitsEx
(
mfHeader
.
mtSize
*
2
,
lpData
)))
return
0
;
width
=
APMHeader
.
bbox
.
Right
-
APMHeader
.
bbox
.
Left
;
height
=
APMHeader
.
bbox
.
Bottom
-
APMHeader
.
bbox
.
Top
;
/* printf("Ok! width %d height %d inch %d\n", width, height, APMHeader.inch); */
hdc
=
GetDC
(
hwnd
);
width
=
width
*
GetDeviceCaps
(
hdc
,
LOGPIXELSX
)
/
APMHeader
.
inch
;
height
=
height
*
GetDeviceCaps
(
hdc
,
LOGPIXELSY
)
/
APMHeader
.
inch
;
ReleaseDC
(
hwnd
,
hdc
);
deltax
=
0
;
deltay
=
0
;
return
hmf
;
}
LRESULT
CALLBACK
WndProc
(
HWND
hwnd
,
LRESULT
CALLBACK
WndProc
(
HWND
hwnd
,
UINT
uMessage
,
UINT
uMessage
,
...
@@ -137,82 +213,3 @@ LRESULT CALLBACK WndProc(HWND hwnd,
...
@@ -137,82 +213,3 @@ LRESULT CALLBACK WndProc(HWND hwnd,
}
}
return
0
;
return
0
;
}
}
BOOL
FileIsPlaceable
(
LPCSTR
szFileName
)
{
HFILE
hInFile
;
APMFILEHEADER
apmh
;
if
(
(
hInFile
=
_lopen
(
szFileName
,
OF_READ
)
)
==
HFILE_ERROR
)
return
FALSE
;
if
(
_lread
(
hInFile
,
&
apmh
,
sizeof
(
APMFILEHEADER
)
)
!=
sizeof
(
APMFILEHEADER
)
)
{
_lclose
(
hInFile
);
return
FALSE
;
}
_lclose
(
hInFile
);
/* Is it placeable? */
return
(
apmh
.
key
==
APMHEADER_KEY
);
}
HMETAFILE
GetPlaceableMetaFile
(
HWND
hwnd
,
LPCSTR
szFileName
)
{
LPBYTE
lpData
;
METAHEADER
mfHeader
;
APMFILEHEADER
APMHeader
;
HFILE
fh
;
HMETAFILE
hmf
;
WORD
checksum
,
*
p
;
HDC
hdc
;
int
i
;
if
(
(
fh
=
_lopen
(
szFileName
,
OF_READ
)
)
==
HFILE_ERROR
)
return
0
;
_llseek
(
fh
,
0
,
0
);
if
(
!
_lread
(
fh
,
(
LPSTR
)
&
APMHeader
,
sizeof
(
APMFILEHEADER
)))
return
0
;
_llseek
(
fh
,
sizeof
(
APMFILEHEADER
),
0
);
checksum
=
0
;
p
=
(
WORD
*
)
&
APMHeader
;
for
(
i
=
0
;
i
<
10
;
i
++
)
checksum
^=
*
p
++
;
if
(
checksum
!=
APMHeader
.
checksum
)
{
char
msg
[
128
];
sprintf
(
msg
,
"Computed checksum %04x != stored checksum %04x
\n
"
,
checksum
,
APMHeader
.
checksum
);
MessageBox
(
hwnd
,
msg
,
"Checksum failed"
,
MB_OK
);
return
0
;
}
if
(
!
_lread
(
fh
,
(
LPSTR
)
&
mfHeader
,
sizeof
(
METAHEADER
)))
return
0
;
if
(
!
(
lpData
=
GlobalAlloc
(
GPTR
,
(
mfHeader
.
mtSize
*
2L
))))
return
0
;
_llseek
(
fh
,
sizeof
(
APMFILEHEADER
),
0
);
if
(
!
_lread
(
fh
,
lpData
,
(
UINT
)(
mfHeader
.
mtSize
*
2L
)))
{
GlobalFree
((
HGLOBAL
)
lpData
);
_lclose
(
fh
);
return
0
;
}
_lclose
(
fh
);
if
(
!
(
hmf
=
SetMetaFileBitsEx
(
mfHeader
.
mtSize
*
2
,
lpData
)))
return
0
;
width
=
APMHeader
.
bbox
.
Right
-
APMHeader
.
bbox
.
Left
;
height
=
APMHeader
.
bbox
.
Bottom
-
APMHeader
.
bbox
.
Top
;
/* printf("Ok! width %d height %d inch %d\n", width, height, APMHeader.inch); */
hdc
=
GetDC
(
hwnd
);
width
=
width
*
GetDeviceCaps
(
hdc
,
LOGPIXELSX
)
/
APMHeader
.
inch
;
height
=
height
*
GetDeviceCaps
(
hdc
,
LOGPIXELSY
)
/
APMHeader
.
inch
;
ReleaseDC
(
hwnd
,
hdc
);
deltax
=
0
;
deltay
=
0
;
return
hmf
;
}
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