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
9c20cdfe
Commit
9c20cdfe
authored
Jan 27, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Make use of the size info in REOBJECT if present.
parent
bcbf9eeb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
15 deletions
+47
-15
editor.h
dlls/riched20/editor.h
+1
-1
richole.c
dlls/riched20/richole.c
+36
-6
run.c
dlls/riched20/run.c
+10
-8
No files found.
dlls/riched20/editor.h
View file @
9c20cdfe
...
...
@@ -260,7 +260,7 @@ int ME_GetParaLineSpace(ME_Context *c, ME_Paragraph*);
/* richole.c */
LRESULT
CreateIRichEditOle
(
ME_TextEditor
*
editor
,
LPVOID
*
);
void
ME_DrawOLE
(
ME_Context
*
c
,
int
x
,
int
y
,
ME_Run
*
run
,
ME_Paragraph
*
para
,
BOOL
selected
);
void
ME_GetOLEObjectSize
(
ME_
TextEditor
*
editor
,
ME_Run
*
run
,
SIZE
*
pSize
);
void
ME_GetOLEObjectSize
(
ME_
Context
*
c
,
ME_Run
*
run
,
SIZE
*
pSize
);
void
ME_CopyReObject
(
REOBJECT
*
dst
,
const
REOBJECT
*
src
);
void
ME_DeleteReObject
(
REOBJECT
*
reo
);
...
...
dlls/riched20/richole.c
View file @
9c20cdfe
...
...
@@ -550,12 +550,19 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
return
1
;
}
static
void
convert_sizel
(
ME_Context
*
c
,
const
SIZEL
*
szl
,
SIZE
*
sz
)
{
/* sizel is in .01 millimeters, sz in pixels */
sz
->
cx
=
MulDiv
(
szl
->
cx
,
c
->
dpi
.
cx
,
2540
);
sz
->
cy
=
MulDiv
(
szl
->
cy
,
c
->
dpi
.
cy
,
2540
);
}
/******************************************************************************
* ME_GetOLEObjectSize
*
* Sets run extent for OLE objects.
*/
void
ME_GetOLEObjectSize
(
ME_
TextEditor
*
editor
,
ME_Run
*
run
,
SIZE
*
pSize
)
void
ME_GetOLEObjectSize
(
ME_
Context
*
c
,
ME_Run
*
run
,
SIZE
*
pSize
)
{
IDataObject
*
ido
;
FORMATETC
fmt
;
...
...
@@ -565,6 +572,13 @@ void ME_GetOLEObjectSize(ME_TextEditor *editor, ME_Run *run, SIZE *pSize)
assert
(
run
->
nFlags
&
MERF_GRAPHICS
);
assert
(
run
->
ole_obj
);
if
(
run
->
ole_obj
->
sizel
.
cx
!=
0
||
run
->
ole_obj
->
sizel
.
cy
!=
0
)
{
convert_sizel
(
c
,
&
run
->
ole_obj
->
sizel
,
pSize
);
return
;
}
IOleObject_QueryInterface
(
run
->
ole_obj
->
poleobj
,
&
IID_IDataObject
,
(
void
**
)
&
ido
);
fmt
.
cfFormat
=
CF_BITMAP
;
fmt
.
ptd
=
NULL
;
...
...
@@ -603,10 +617,10 @@ void ME_GetOLEObjectSize(ME_TextEditor *editor, ME_Run *run, SIZE *pSize)
break
;
}
IDataObject_Release
(
ido
);
if
(
editor
->
nZoomNumerator
!=
0
)
if
(
c
->
editor
->
nZoomNumerator
!=
0
)
{
pSize
->
cx
=
MulDiv
(
pSize
->
cx
,
editor
->
nZoomNumerator
,
editor
->
nZoomDenominator
);
pSize
->
cy
=
MulDiv
(
pSize
->
cy
,
editor
->
nZoomNumerator
,
editor
->
nZoomDenominator
);
pSize
->
cx
=
MulDiv
(
pSize
->
cx
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
pSize
->
cy
=
MulDiv
(
pSize
->
cy
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
}
}
...
...
@@ -620,6 +634,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
ENHMETAHEADER
emh
;
HDC
hMemDC
;
SIZE
sz
;
BOOL
has_size
;
assert
(
run
->
nFlags
&
MERF_GRAPHICS
);
assert
(
run
->
ole_obj
);
...
...
@@ -628,6 +643,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
FIXME
(
"Couldn't get interface
\n
"
);
return
;
}
has_size
=
run
->
ole_obj
->
sizel
.
cx
!=
0
||
run
->
ole_obj
->
sizel
.
cy
!=
0
;
fmt
.
cfFormat
=
CF_BITMAP
;
fmt
.
ptd
=
NULL
;
fmt
.
dwAspect
=
DVASPECT_CONTENT
;
...
...
@@ -650,7 +666,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
GetObjectW
(
stgm
.
u
.
hBitmap
,
sizeof
(
dibsect
),
&
dibsect
);
hMemDC
=
CreateCompatibleDC
(
c
->
hDC
);
SelectObject
(
hMemDC
,
stgm
.
u
.
hBitmap
);
if
(
c
->
editor
->
nZoomNumerator
==
0
)
if
(
!
has_size
&&
c
->
editor
->
nZoomNumerator
==
0
)
{
sz
.
cx
=
dibsect
.
dsBm
.
bmWidth
;
sz
.
cy
=
dibsect
.
dsBm
.
bmHeight
;
...
...
@@ -660,10 +676,17 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
}
else
{
if
(
has_size
)
{
convert_sizel
(
c
,
&
run
->
ole_obj
->
sizel
,
&
sz
);
}
else
{
sz
.
cy
=
MulDiv
(
dibsect
.
dsBm
.
bmWidth
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
sz
.
cx
=
MulDiv
(
dibsect
.
dsBm
.
bmHeight
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
}
StretchBlt
(
c
->
hDC
,
x
,
y
-
sz
.
cy
,
sz
.
cx
,
sz
.
cy
,
hMemDC
,
0
,
0
,
dibsect
.
dsBm
.
bmWidth
,
dibsect
.
dsBm
.
bmHeight
,
SRCCOPY
);
}
...
...
@@ -671,18 +694,25 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
break
;
case
TYMED_ENHMF
:
GetEnhMetaFileHeader
(
stgm
.
u
.
hEnhMetaFile
,
sizeof
(
emh
),
&
emh
);
if
(
c
->
editor
->
nZoomNumerator
==
0
)
if
(
!
has_size
&&
c
->
editor
->
nZoomNumerator
==
0
)
{
sz
.
cy
=
emh
.
rclBounds
.
bottom
-
emh
.
rclBounds
.
top
;
sz
.
cx
=
emh
.
rclBounds
.
right
-
emh
.
rclBounds
.
left
;
}
else
{
if
(
has_size
)
{
convert_sizel
(
c
,
&
run
->
ole_obj
->
sizel
,
&
sz
);
}
else
{
sz
.
cy
=
MulDiv
(
emh
.
rclBounds
.
bottom
-
emh
.
rclBounds
.
top
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
sz
.
cx
=
MulDiv
(
emh
.
rclBounds
.
right
-
emh
.
rclBounds
.
left
,
c
->
editor
->
nZoomNumerator
,
c
->
editor
->
nZoomDenominator
);
}
}
{
RECT
rc
;
...
...
dlls/riched20/run.c
View file @
9c20cdfe
...
...
@@ -492,7 +492,7 @@ int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run)
if
(
run
->
nFlags
&
MERF_GRAPHICS
)
{
SIZE
sz
;
ME_GetOLEObjectSize
(
c
->
editor
,
run
,
&
sz
);
ME_GetOLEObjectSize
(
c
,
run
,
&
sz
);
if
(
cx
<
sz
.
cx
)
return
0
;
return
1
;
...
...
@@ -546,10 +546,12 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
return
0
;
return
1
;
}
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
if
(
run
->
nFlags
&
MERF_GRAPHICS
)
{
SIZE
sz
;
ME_GetOLEObjectSize
(
editor
,
run
,
&
sz
);
ME_GetOLEObjectSize
(
&
c
,
run
,
&
sz
);
ReleaseDC
(
editor
->
hWnd
,
c
.
hDC
);
if
(
cx
<
sz
.
cx
/
2
)
return
0
;
return
1
;
...
...
@@ -560,7 +562,6 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
else
strRunText
=
run
->
strText
;
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
hOldFont
=
ME_SelectStyleFont
(
&
c
,
run
->
style
);
GetTextExtentExPointW
(
c
.
hDC
,
strRunText
->
szData
,
strRunText
->
nLen
,
cx
,
&
fit
,
NULL
,
&
sz
);
...
...
@@ -609,11 +610,13 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
ME_String
*
strRunText
;
/* This could point to either the run's real text, or it's masked form in a password control */
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
if
(
pRun
->
nFlags
&
MERF_GRAPHICS
)
{
if
(
!
nOffset
)
return
0
;
ME_GetOLEObjectSize
(
editor
,
pRun
,
&
size
);
return
1
;
if
(
nOffset
)
ME_GetOLEObjectSize
(
&
c
,
pRun
,
&
size
);
ReleaseDC
(
editor
->
hWnd
,
c
.
hDC
);
return
nOffset
!=
0
;
}
if
(
editor
->
cPasswordMask
)
...
...
@@ -621,7 +624,6 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
else
strRunText
=
pRun
->
strText
;
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
ME_GetTextExtent
(
&
c
,
strRunText
->
szData
,
nOffset
,
pRun
->
style
,
&
size
);
ReleaseDC
(
editor
->
hWnd
,
c
.
hDC
);
if
(
editor
->
cPasswordMask
)
...
...
@@ -689,7 +691,7 @@ static SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run
}
if
(
run
->
nFlags
&
MERF_GRAPHICS
)
{
ME_GetOLEObjectSize
(
c
->
editor
,
run
,
&
size
);
ME_GetOLEObjectSize
(
c
,
run
,
&
size
);
if
(
size
.
cy
>
*
pAscent
)
*
pAscent
=
size
.
cy
;
/* descent is unchanged */
...
...
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