riched20: Move run extent calculation to wrap.c.
This commit is contained in:
parent
a32199b3f3
commit
c07212b3d0
|
@ -147,7 +147,8 @@ int ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
|
|||
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN;
|
||||
void ME_CalcRunExtent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Run *run) DECLSPEC_HIDDEN;
|
||||
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
int startx, int *pAscent, int *pDescent) DECLSPEC_HIDDEN;
|
||||
SIZE ME_GetRunSize(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx) DECLSPEC_HIDDEN;
|
||||
void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor) DECLSPEC_HIDDEN;
|
||||
void ME_RunOfsFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_DisplayItem **ppPara, ME_DisplayItem **ppRun, int *pOfs) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -530,8 +530,8 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
|
|||
* Finds width, height, ascent and descent of a run, up to given character
|
||||
* (nLen).
|
||||
*/
|
||||
static SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
int startx, int *pAscent, int *pDescent)
|
||||
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
int startx, int *pAscent, int *pDescent)
|
||||
{
|
||||
SIZE size;
|
||||
int nMaxLen = run->len;
|
||||
|
@ -614,28 +614,6 @@ SIZE ME_GetRunSize(ME_Context *c, const ME_Paragraph *para,
|
|||
return ME_GetRunSizeCommon(c, para, run, nLen, startx, &asc, &desc);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ME_CalcRunExtent
|
||||
*
|
||||
* Updates the size of the run (fills width, ascent and descent). The height
|
||||
* is calculated based on whole row's ascent and descent anyway, so no need
|
||||
* to use it here.
|
||||
*/
|
||||
void ME_CalcRunExtent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Run *run)
|
||||
{
|
||||
if (run->nFlags & MERF_HIDDEN)
|
||||
run->nWidth = 0;
|
||||
else
|
||||
{
|
||||
int nEnd = run->len;
|
||||
SIZE size = ME_GetRunSizeCommon(c, para, run, nEnd, startx,
|
||||
&run->nAscent, &run->nDescent);
|
||||
run->nWidth = size.cx;
|
||||
if (!size.cx)
|
||||
WARN("size.cx == 0\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ME_SetSelectionCharFormat
|
||||
*
|
||||
|
|
|
@ -32,6 +32,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
|||
* - no tabs
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* calc_run_extent
|
||||
*
|
||||
* Updates the size of the run (fills width, ascent and descent). The height
|
||||
* is calculated based on whole row's ascent and descent anyway, so no need
|
||||
* to use it here.
|
||||
*/
|
||||
static void calc_run_extent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Run *run)
|
||||
{
|
||||
if (run->nFlags & MERF_HIDDEN) run->nWidth = 0;
|
||||
else
|
||||
{
|
||||
SIZE size = ME_GetRunSizeCommon( c, para, run, run->len, startx, &run->nAscent, &run->nDescent );
|
||||
run->nWidth = size.cx;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* split_run_extents
|
||||
*
|
||||
|
@ -62,7 +79,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
|
|||
|
||||
run2 = &cursor.pRun->member.run;
|
||||
|
||||
ME_CalcRunExtent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
|
||||
calc_run_extent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
|
||||
|
||||
run2->pt.x = run->pt.x+run->nWidth;
|
||||
run2->pt.y = run->pt.y;
|
||||
|
@ -296,8 +313,8 @@ static void ME_WrapSizeRun(ME_WrapContext *wc, ME_DisplayItem *p)
|
|||
|
||||
ME_UpdateRunFlags(wc->context->editor, &p->member.run);
|
||||
|
||||
ME_CalcRunExtent(wc->context, &wc->pPara->member.para,
|
||||
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, &p->member.run);
|
||||
calc_run_extent(wc->context, &wc->pPara->member.para,
|
||||
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, &p->member.run);
|
||||
}
|
||||
|
||||
|
||||
|
@ -488,9 +505,9 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
|
|||
if (black) {
|
||||
wc->bOverflown = FALSE;
|
||||
pp = split_run_extents(wc, p, black);
|
||||
ME_CalcRunExtent(wc->context, &wc->pPara->member.para,
|
||||
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin,
|
||||
&pp->member.run);
|
||||
calc_run_extent(wc->context, &wc->pPara->member.para,
|
||||
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin,
|
||||
&pp->member.run);
|
||||
ME_InsertRowStart(wc, pp);
|
||||
return pp;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue