riched20: Use row and para ptrs in the ensure visible function.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
30ad0b936a
commit
1abbb78a09
|
@ -1176,13 +1176,11 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y)
|
||||||
|
|
||||||
if (editor->nSelectionType != stPosition &&
|
if (editor->nSelectionType != stPosition &&
|
||||||
memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor)))
|
memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor)))
|
||||||
{
|
|
||||||
/* The scroll the cursor towards the other end, since it was the one
|
/* The scroll the cursor towards the other end, since it was the one
|
||||||
* extended by ME_ExtendAnchorSelection */
|
* extended by ME_ExtendAnchorSelection */
|
||||||
ME_EnsureVisible(editor, &editor->pCursors[1]);
|
editor_ensure_visible( editor, &editor->pCursors[1] );
|
||||||
} else {
|
else
|
||||||
ME_EnsureVisible(editor, &editor->pCursors[0]);
|
editor_ensure_visible( editor, &editor->pCursors[0] );
|
||||||
}
|
|
||||||
|
|
||||||
ME_InvalidateSelection(editor);
|
ME_InvalidateSelection(editor);
|
||||||
update_caret(editor);
|
update_caret(editor);
|
||||||
|
@ -1520,7 +1518,7 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
|
||||||
ME_InvalidateSelection(editor);
|
ME_InvalidateSelection(editor);
|
||||||
ME_Repaint(editor);
|
ME_Repaint(editor);
|
||||||
hide_caret(editor);
|
hide_caret(editor);
|
||||||
ME_EnsureVisible(editor, &tmp_curs);
|
editor_ensure_visible( editor, &tmp_curs );
|
||||||
update_caret(editor);
|
update_caret(editor);
|
||||||
ME_SendSelChange(editor);
|
ME_SendSelChange(editor);
|
||||||
return success;
|
return success;
|
||||||
|
|
|
@ -4095,7 +4095,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
case EM_SCROLLCARET:
|
case EM_SCROLLCARET:
|
||||||
ME_EnsureVisible(editor, &editor->pCursors[0]);
|
editor_ensure_visible( editor, &editor->pCursors[0] );
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SETFONT:
|
case WM_SETFONT:
|
||||||
{
|
{
|
||||||
|
|
|
@ -242,7 +242,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLS
|
||||||
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN;
|
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN;
|
||||||
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN;
|
void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||||
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN;
|
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN;
|
||||||
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN;
|
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -117,7 +117,7 @@ void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
|
||||||
ME_UpdateScrollBar(editor);
|
ME_UpdateScrollBar(editor);
|
||||||
|
|
||||||
/* Ensure that the cursor is visible */
|
/* Ensure that the cursor is visible */
|
||||||
ME_EnsureVisible(editor, &editor->pCursors[0]);
|
editor_ensure_visible( editor, &editor->pCursors[0] );
|
||||||
|
|
||||||
ITextHost_TxViewChange(editor->texthost, update_now);
|
ITextHost_TxViewChange(editor->texthost, update_now);
|
||||||
|
|
||||||
|
@ -1269,19 +1269,17 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor )
|
||||||
{
|
{
|
||||||
ME_Run *pRun = &pCursor->pRun->member.run;
|
ME_Run *run = &cursor->pRun->member.run;
|
||||||
ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow);
|
ME_Row *row = row_from_cursor( cursor );
|
||||||
ME_DisplayItem *pPara = pCursor->pPara;
|
ME_Paragraph *para = &cursor->pPara->member.para;
|
||||||
int x, y, yheight;
|
int x, y, yheight;
|
||||||
|
|
||||||
assert(pRow);
|
|
||||||
assert(pPara);
|
|
||||||
|
|
||||||
if (editor->styleFlags & ES_AUTOHSCROLL)
|
if (editor->styleFlags & ES_AUTOHSCROLL)
|
||||||
{
|
{
|
||||||
x = pRun->pt.x + ME_PointFromChar(editor, pRun, pCursor->nOffset, TRUE);
|
x = run->pt.x + ME_PointFromChar( editor, run, cursor->nOffset, TRUE );
|
||||||
if (x > editor->horz_si.nPos + editor->sizeWindow.cx)
|
if (x > editor->horz_si.nPos + editor->sizeWindow.cx)
|
||||||
x = x + 1 - editor->sizeWindow.cx;
|
x = x + 1 - editor->sizeWindow.cx;
|
||||||
else if (x > editor->horz_si.nPos)
|
else if (x > editor->horz_si.nPos)
|
||||||
|
@ -1292,14 +1290,15 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
||||||
ME_HScrollAbs(editor, x);
|
ME_HScrollAbs(editor, x);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (~editor->styleFlags & ES_AUTOVSCROLL)
|
else
|
||||||
return;
|
{
|
||||||
|
if (~editor->styleFlags & ES_AUTOVSCROLL) return;
|
||||||
x = editor->horz_si.nPos;
|
x = editor->horz_si.nPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = pPara->member.para.pt.y + pRow->member.row.pt.y;
|
y = para->pt.y + row->pt.y;
|
||||||
yheight = pRow->member.row.nHeight;
|
yheight = row->nHeight;
|
||||||
|
|
||||||
if (y < editor->vert_si.nPos)
|
if (y < editor->vert_si.nPos)
|
||||||
ME_ScrollAbs(editor, x, y);
|
ME_ScrollAbs(editor, x, y);
|
||||||
|
|
Loading…
Reference in New Issue