Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ef23ef93
Commit
ef23ef93
authored
Oct 12, 2008
by
Andrey Turkin
Committed by
Alexandre Julliard
Oct 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wordpad: Use inches instead of cm in calculations.
parent
f229469d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
print.c
programs/wordpad/print.c
+5
-7
wordpad.c
programs/wordpad/wordpad.c
+3
-3
wordpad.h
programs/wordpad/wordpad.h
+2
-1
No files found.
programs/wordpad/print.c
View file @
ef23ef93
...
...
@@ -132,24 +132,22 @@ static HDC make_dc(void)
static
LONG
twips_to_centmm
(
int
twips
)
{
return
MulDiv
(
twips
,
1000
,
TWIPS_PER_CM
);
return
MulDiv
(
twips
,
CENTMM_PER_INCH
,
TWIPS_PER_INCH
);
}
static
LONG
centmm_to_twips
(
int
mm
)
{
return
MulDiv
(
mm
,
TWIPS_PER_
CM
,
1000
);
return
MulDiv
(
mm
,
TWIPS_PER_
INCH
,
CENTMM_PER_INCH
);
}
static
LONG
twips_to_pixels
(
int
twips
,
int
dpi
)
{
float
ret
=
((
float
)
twips
/
((
float
)
TWIPS_PER_CM
*
2
.
54
))
*
(
float
)
dpi
;
return
(
LONG
)
ret
;
return
MulDiv
(
twips
,
dpi
,
TWIPS_PER_INCH
);
}
static
LONG
devunits_to_twips
(
int
units
,
int
dpi
)
{
float
ret
=
((
float
)
units
/
(
float
)
dpi
)
*
(
float
)
TWIPS_PER_CM
*
2
.
54
;
return
(
LONG
)
ret
;
return
MulDiv
(
units
,
TWIPS_PER_INCH
,
dpi
);
}
...
...
@@ -502,7 +500,7 @@ static void add_ruler_units(HDC hdcRuler, RECT* drawRect, BOOL NewMetrics, long
hdc
=
CreateCompatibleDC
(
0
);
CmPixels
=
twips_to_pixels
(
TWIPS_PER_CM
,
GetDeviceCaps
(
hdc
,
LOGPIXELSX
));
CmPixels
=
twips_to_pixels
(
centmm_to_twips
(
1000
)
,
GetDeviceCaps
(
hdc
,
LOGPIXELSX
));
QuarterCmPixels
=
(
int
)((
float
)
CmPixels
/
4
.
0
);
hBitmap
=
CreateCompatibleBitmap
(
hdc
,
drawRect
->
right
,
drawRect
->
bottom
);
...
...
programs/wordpad/wordpad.c
View file @
ef23ef93
...
...
@@ -1271,7 +1271,7 @@ static void dialog_find(LPFINDREPLACEW fr, BOOL replace)
static
int
current_units_to_twips
(
float
number
)
{
int
twips
=
(
int
)(
number
*
TWIPS_PER_CM
);
int
twips
=
(
int
)(
number
*
1000
.
0
/
(
float
)
CENTMM_PER_INCH
*
(
float
)
TWIPS_PER_INCH
);
return
twips
;
}
...
...
@@ -1284,10 +1284,10 @@ static void append_current_units(LPWSTR buffer)
static
void
number_with_units
(
LPWSTR
buffer
,
int
number
)
{
float
converted
=
(
float
)
number
/
TWIPS_PER_CM
;
static
const
WCHAR
fmt
[]
=
{
'%'
,
'.'
,
'2'
,
'f'
,
' '
,
'%'
,
's'
,
'\0'
};
float
converted
=
(
float
)
number
/
(
float
)
TWIPS_PER_INCH
*
(
float
)
CENTMM_PER_INCH
/
1000
.
0
;
sprintfW
(
buffer
,
fmt
,
converted
,
units_cmW
);
w
sprintfW
(
buffer
,
fmt
,
converted
,
units_cmW
);
}
static
BOOL
get_comboexlist_selection
(
HWND
hComboEx
,
LPWSTR
wszBuffer
,
UINT
bufferLength
)
...
...
programs/wordpad/wordpad.h
View file @
ef23ef93
...
...
@@ -19,7 +19,8 @@
#define MAX_STRING_LEN 255
#define TWIPS_PER_CM 567
#define TWIPS_PER_INCH 1440
#define CENTMM_PER_INCH 2540
#define ID_FILE_EXIT 1000
#define ID_FILE_OPEN 1001
...
...
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