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
9e8a9f4f
Commit
9e8a9f4f
authored
Feb 08, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Feb 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Move the split point calculation to wrap.c.
parent
68a4c30e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
52 deletions
+46
-52
editor.h
dlls/riched20/editor.h
+0
-1
run.c
dlls/riched20/run.c
+0
-50
wrap.c
dlls/riched20/wrap.c
+46
-1
No files found.
dlls/riched20/editor.h
View file @
9e8a9f4f
...
...
@@ -140,7 +140,6 @@ ME_DisplayItem *ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
DECLSPEC_HIDDEN
;
void
ME_CheckCharOffsets
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_PropagateCharOffset
(
ME_DisplayItem
*
p
,
int
shift
)
DECLSPEC_HIDDEN
;
int
ME_CharFromPoint
(
ME_Context
*
c
,
int
cx
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
/* this one accounts for 1/2 char tolerance */
int
ME_CharFromPointCursor
(
ME_TextEditor
*
editor
,
int
cx
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
int
ME_PointFromChar
(
ME_TextEditor
*
editor
,
ME_Run
*
pRun
,
int
nOffset
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/run.c
View file @
9e8a9f4f
...
...
@@ -404,56 +404,6 @@ void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
}
/******************************************************************************
* ME_CharFromPoint
*
* Returns a character position inside the run given a run-relative
* pixel horizontal position. This version rounds left (ie. if the second
* character is at pixel position 8, then for cx=0..7 it returns 0).
*/
int
ME_CharFromPoint
(
ME_Context
*
c
,
int
cx
,
ME_Run
*
run
)
{
int
fit
=
0
;
HGDIOBJ
hOldFont
;
SIZE
sz
;
if
(
!
run
->
len
||
cx
<=
0
)
return
0
;
if
(
run
->
nFlags
&
MERF_TAB
||
(
run
->
nFlags
&
(
MERF_ENDCELL
|
MERF_ENDPARA
))
==
MERF_ENDCELL
)
{
if
(
cx
<
run
->
nWidth
/
2
)
return
0
;
return
1
;
}
if
(
run
->
nFlags
&
MERF_GRAPHICS
)
{
SIZE
sz
;
ME_GetOLEObjectSize
(
c
,
run
,
&
sz
);
if
(
cx
<
sz
.
cx
)
return
0
;
return
1
;
}
hOldFont
=
ME_SelectStyleFont
(
c
,
run
->
style
);
if
(
c
->
editor
->
cPasswordMask
)
{
ME_String
*
strMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
len
);
GetTextExtentExPointW
(
c
->
hDC
,
strMasked
->
szData
,
run
->
len
,
cx
,
&
fit
,
NULL
,
&
sz
);
ME_DestroyString
(
strMasked
);
}
else
{
GetTextExtentExPointW
(
c
->
hDC
,
get_text
(
run
,
0
),
run
->
len
,
cx
,
&
fit
,
NULL
,
&
sz
);
}
ME_UnselectStyleFont
(
c
,
run
->
style
,
hOldFont
);
return
fit
;
}
/******************************************************************************
* ME_CharFromPointCursor
*
* Returns a character position inside the run given a run-relative
...
...
dlls/riched20/wrap.c
View file @
9e8a9f4f
...
...
@@ -80,6 +80,51 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
return
cursor
.
pRun
;
}
/******************************************************************************
* find_split_point
*
* Returns a character position to split inside the run given a run-relative
* pixel horizontal position. This version rounds left (ie. if the second
* character is at pixel position 8, then for cx=0..7 it returns 0).
*/
static
int
find_split_point
(
ME_Context
*
c
,
int
cx
,
ME_Run
*
run
)
{
int
fit
=
0
;
HGDIOBJ
hOldFont
;
SIZE
sz
;
if
(
!
run
->
len
||
cx
<=
0
)
return
0
;
if
(
run
->
nFlags
&
MERF_TAB
||
(
run
->
nFlags
&
(
MERF_ENDCELL
|
MERF_ENDPARA
))
==
MERF_ENDCELL
)
{
if
(
cx
<
run
->
nWidth
/
2
)
return
0
;
return
1
;
}
if
(
run
->
nFlags
&
MERF_GRAPHICS
)
{
SIZE
sz
;
ME_GetOLEObjectSize
(
c
,
run
,
&
sz
);
if
(
cx
<
sz
.
cx
)
return
0
;
return
1
;
}
hOldFont
=
ME_SelectStyleFont
(
c
,
run
->
style
);
if
(
c
->
editor
->
cPasswordMask
)
{
ME_String
*
strMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
len
);
GetTextExtentExPointW
(
c
->
hDC
,
strMasked
->
szData
,
run
->
len
,
cx
,
&
fit
,
NULL
,
&
sz
);
ME_DestroyString
(
strMasked
);
}
else
{
GetTextExtentExPointW
(
c
->
hDC
,
get_text
(
run
,
0
),
run
->
len
,
cx
,
&
fit
,
NULL
,
&
sz
);
}
ME_UnselectStyleFont
(
c
,
run
->
style
,
hOldFont
);
return
fit
;
}
static
ME_DisplayItem
*
ME_MakeRow
(
int
height
,
int
baseline
,
int
width
)
{
...
...
@@ -337,7 +382,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
int
i
,
idesp
,
len
;
ME_Run
*
run
=
&
p
->
member
.
run
;
idesp
=
i
=
ME_CharFromPoint
(
wc
->
context
,
loc
,
run
);
idesp
=
i
=
find_split_point
(
wc
->
context
,
loc
,
run
);
len
=
run
->
len
;
assert
(
len
>
0
);
assert
(
i
<
len
);
...
...
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