2005-03-05 12:19:14 +01:00
|
|
|
/*
|
|
|
|
* RichEdit - painting functions
|
|
|
|
*
|
|
|
|
* Copyright 2004 by Krzysztof Foltman
|
2006-01-13 13:53:35 +01:00
|
|
|
* Copyright 2005 by Phil Krylov
|
2005-03-05 12:19:14 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-03-05 12:19:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "editor.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
|
|
|
|
2009-01-14 00:25:51 +01:00
|
|
|
static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph);
|
|
|
|
|
2012-05-08 04:11:55 +02:00
|
|
|
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate)
|
2008-12-19 15:54:58 +01:00
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
ME_DisplayItem *item;
|
|
|
|
ME_Context c;
|
2008-12-19 15:54:58 +01:00
|
|
|
int ys, ye;
|
2009-01-14 19:23:57 +01:00
|
|
|
HRGN oldRgn;
|
|
|
|
|
|
|
|
oldRgn = CreateRectRgn(0, 0, 0, 0);
|
|
|
|
if (!GetClipRgn(hDC, oldRgn))
|
|
|
|
{
|
|
|
|
DeleteObject(oldRgn);
|
|
|
|
oldRgn = NULL;
|
|
|
|
}
|
|
|
|
IntersectClipRect(hDC, rcUpdate->left, rcUpdate->top,
|
|
|
|
rcUpdate->right, rcUpdate->bottom);
|
2005-03-05 12:19:14 +01:00
|
|
|
|
|
|
|
ME_InitContext(&c, editor, hDC);
|
|
|
|
SetBkMode(hDC, TRANSPARENT);
|
2009-02-06 07:09:36 +01:00
|
|
|
ME_MoveCaret(editor);
|
2005-03-05 12:19:14 +01:00
|
|
|
item = editor->pBuffer->pFirst->next;
|
2008-12-19 15:54:58 +01:00
|
|
|
/* This context point is an offset for the paragraph positions stored
|
|
|
|
* during wrapping. It shouldn't be modified during painting. */
|
2009-01-14 19:24:02 +01:00
|
|
|
c.pt.x = c.rcView.left - editor->horz_si.nPos;
|
|
|
|
c.pt.y = c.rcView.top - editor->vert_si.nPos;
|
2008-12-19 15:54:58 +01:00
|
|
|
while(item != editor->pBuffer->pLast)
|
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
assert(item->type == diParagraph);
|
2008-12-19 15:54:58 +01:00
|
|
|
|
|
|
|
ys = c.pt.y + item->member.para.pt.y;
|
2008-08-07 18:31:41 +02:00
|
|
|
if (item->member.para.pCell
|
|
|
|
!= item->member.para.next_para->member.para.pCell)
|
|
|
|
{
|
|
|
|
ME_Cell *cell = NULL;
|
|
|
|
cell = &ME_FindItemBack(item->member.para.next_para, diCell)->member.cell;
|
2008-12-19 15:54:58 +01:00
|
|
|
ye = c.pt.y + cell->pt.y + cell->nHeight;
|
2008-08-07 18:31:41 +02:00
|
|
|
} else {
|
2008-12-19 15:54:58 +01:00
|
|
|
ye = ys + item->member.para.nHeight;
|
2008-08-07 18:31:41 +02:00
|
|
|
}
|
2008-12-19 15:54:58 +01:00
|
|
|
if (item->member.para.pCell && !(item->member.para.nFlags & MEPF_ROWEND) &&
|
2008-08-13 05:15:36 +02:00
|
|
|
item->member.para.pCell != item->member.para.prev_para->member.para.pCell)
|
|
|
|
{
|
|
|
|
/* the border shifts the text down */
|
2008-12-19 15:54:58 +01:00
|
|
|
ys -= item->member.para.pCell->member.cell.yTextOffset;
|
2008-08-13 05:15:36 +02:00
|
|
|
}
|
2008-12-19 15:54:58 +01:00
|
|
|
|
2012-05-08 04:11:55 +02:00
|
|
|
/* Draw the paragraph if any of the paragraph is in the update region. */
|
|
|
|
if (ys < rcUpdate->bottom && ye > rcUpdate->top)
|
|
|
|
ME_DrawParagraph(&c, item);
|
2005-03-05 12:19:14 +01:00
|
|
|
item = item->member.para.next_para;
|
|
|
|
}
|
2008-12-19 15:54:58 +01:00
|
|
|
if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
|
2008-12-18 07:56:49 +01:00
|
|
|
{
|
|
|
|
/* Fill space after the end of the text. */
|
2008-12-19 15:54:58 +01:00
|
|
|
RECT rc;
|
|
|
|
rc.top = c.pt.y + editor->nTotalLength;
|
|
|
|
rc.left = c.rcView.left;
|
|
|
|
rc.bottom = c.rcView.bottom;
|
|
|
|
rc.right = c.rcView.right;
|
2008-12-18 07:56:49 +01:00
|
|
|
|
2008-12-19 15:54:58 +01:00
|
|
|
IntersectRect(&rc, &rc, rcUpdate);
|
2005-03-05 12:19:14 +01:00
|
|
|
|
2008-12-19 15:54:58 +01:00
|
|
|
if (!IsRectEmpty(&rc))
|
2005-11-03 12:33:24 +01:00
|
|
|
FillRect(hDC, &rc, c.editor->hbrBackground);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
if (editor->nTotalLength != editor->nLastTotalLength ||
|
|
|
|
editor->nTotalWidth != editor->nLastTotalWidth)
|
2005-11-03 10:52:29 +01:00
|
|
|
ME_SendRequestResize(editor, FALSE);
|
2005-03-09 19:43:18 +01:00
|
|
|
editor->nLastTotalLength = editor->nTotalLength;
|
2009-01-14 19:24:02 +01:00
|
|
|
editor->nLastTotalWidth = editor->nTotalWidth;
|
2009-01-14 19:23:57 +01:00
|
|
|
|
|
|
|
SelectClipRgn(hDC, oldRgn);
|
|
|
|
if (oldRgn)
|
|
|
|
DeleteObject(oldRgn);
|
2009-01-20 07:41:32 +01:00
|
|
|
|
|
|
|
c.hDC = NULL;
|
|
|
|
ME_DestroyContext(&c);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ME_Repaint(ME_TextEditor *editor)
|
|
|
|
{
|
2006-09-08 23:37:25 +02:00
|
|
|
if (ME_WrapMarkedParagraphs(editor))
|
2005-08-15 11:47:14 +02:00
|
|
|
{
|
2006-09-08 23:37:25 +02:00
|
|
|
ME_UpdateScrollBar(editor);
|
|
|
|
FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
|
2005-08-15 11:47:14 +02:00
|
|
|
}
|
2009-01-20 07:41:32 +01:00
|
|
|
ITextHost_TxViewChange(editor->texthost, TRUE);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
2010-07-29 03:17:40 +02:00
|
|
|
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
|
2005-03-05 12:19:14 +01:00
|
|
|
{
|
2006-09-08 23:37:25 +02:00
|
|
|
/* Should be called whenever the contents of the control have changed */
|
2008-04-21 17:02:52 +02:00
|
|
|
BOOL wrappedParagraphs;
|
2008-01-01 22:05:40 +01:00
|
|
|
|
2008-04-21 17:02:52 +02:00
|
|
|
wrappedParagraphs = ME_WrapMarkedParagraphs(editor);
|
|
|
|
if (wrappedParagraphs)
|
2006-09-08 23:37:25 +02:00
|
|
|
ME_UpdateScrollBar(editor);
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2006-09-08 23:37:25 +02:00
|
|
|
/* Ensure that the cursor is visible */
|
2009-02-09 18:01:35 +01:00
|
|
|
ME_EnsureVisible(editor, &editor->pCursors[0]);
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2010-07-29 03:17:40 +02:00
|
|
|
ITextHost_TxViewChange(editor->texthost, update_now);
|
|
|
|
|
2010-05-19 08:33:02 +02:00
|
|
|
ME_SendSelChange(editor);
|
|
|
|
|
2006-11-26 06:04:20 +01:00
|
|
|
/* send EN_CHANGE if the event mask asks for it */
|
|
|
|
if(editor->nEventMask & ENM_CHANGE)
|
|
|
|
{
|
2007-09-19 16:31:14 +02:00
|
|
|
editor->nEventMask &= ~ENM_CHANGE;
|
2006-11-26 06:04:20 +01:00
|
|
|
ME_SendOldNotify(editor, EN_CHANGE);
|
2007-09-19 16:31:14 +02:00
|
|
|
editor->nEventMask |= ENM_CHANGE;
|
2006-11-26 06:04:20 +01:00
|
|
|
}
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
2005-07-24 18:17:43 +02:00
|
|
|
void
|
|
|
|
ME_RewrapRepaint(ME_TextEditor *editor)
|
2009-01-14 19:24:02 +01:00
|
|
|
{
|
2006-09-08 23:37:25 +02:00
|
|
|
/* RewrapRepaint should be called whenever the control has changed in
|
|
|
|
* looks, but not content. Like resizing. */
|
|
|
|
|
2005-07-24 18:17:43 +02:00
|
|
|
ME_MarkAllForWrapping(editor);
|
2008-10-18 03:29:55 +02:00
|
|
|
ME_WrapMarkedParagraphs(editor);
|
|
|
|
ME_UpdateScrollBar(editor);
|
2008-10-19 10:43:17 +02:00
|
|
|
ME_Repaint(editor);
|
2005-07-24 18:17:43 +02:00
|
|
|
}
|
|
|
|
|
2011-10-22 18:11:27 +02:00
|
|
|
int ME_twips2pointsX(const ME_Context *c, int x)
|
2008-01-01 22:04:40 +01:00
|
|
|
{
|
|
|
|
if (c->editor->nZoomNumerator == 0)
|
2008-01-01 22:05:33 +01:00
|
|
|
return x * c->dpi.cx / 1440;
|
2008-01-01 22:04:40 +01:00
|
|
|
else
|
2008-01-01 22:05:33 +01:00
|
|
|
return x * c->dpi.cx * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
|
|
|
|
}
|
|
|
|
|
2011-10-22 18:11:27 +02:00
|
|
|
int ME_twips2pointsY(const ME_Context *c, int y)
|
2008-01-01 22:05:33 +01:00
|
|
|
{
|
|
|
|
if (c->editor->nZoomNumerator == 0)
|
|
|
|
return y * c->dpi.cy / 1440;
|
|
|
|
else
|
|
|
|
return y * c->dpi.cy * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
|
2008-01-01 22:04:40 +01:00
|
|
|
}
|
2005-07-24 18:17:43 +02:00
|
|
|
|
2013-02-14 15:16:16 +01:00
|
|
|
|
|
|
|
static int calc_y_offset( const ME_Context *c, ME_Style *style )
|
|
|
|
{
|
|
|
|
int offs = 0, twips = 0;
|
|
|
|
|
|
|
|
if ((style->fmt.dwMask & style->fmt.dwEffects) & CFM_OFFSET)
|
|
|
|
twips = style->fmt.yOffset;
|
|
|
|
|
|
|
|
if ((style->fmt.dwMask & style->fmt.dwEffects) & (CFM_SUPERSCRIPT | CFM_SUBSCRIPT))
|
|
|
|
{
|
|
|
|
if (style->fmt.dwEffects & CFE_SUPERSCRIPT) twips = style->fmt.yHeight/3;
|
|
|
|
if (style->fmt.dwEffects & CFE_SUBSCRIPT) twips = -style->fmt.yHeight/12;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (twips) offs = ME_twips2pointsY( c, twips );
|
|
|
|
|
|
|
|
return offs;
|
|
|
|
}
|
|
|
|
|
2013-02-14 15:16:17 +01:00
|
|
|
static COLORREF get_text_color( ME_Context *c, ME_Style *style, BOOL highlight )
|
|
|
|
{
|
|
|
|
COLORREF color;
|
|
|
|
|
|
|
|
if (highlight)
|
|
|
|
color = ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHTTEXT );
|
|
|
|
else if ((style->fmt.dwMask & CFM_LINK) && (style->fmt.dwEffects & CFE_LINK))
|
|
|
|
color = RGB(0,0,255);
|
|
|
|
else if ((style->fmt.dwMask & CFM_COLOR) && (style->fmt.dwEffects & CFE_AUTOCOLOR))
|
|
|
|
color = ITextHost_TxGetSysColor( c->editor->texthost, COLOR_WINDOWTEXT );
|
|
|
|
else
|
|
|
|
color = style->fmt.crTextColor;
|
|
|
|
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2013-02-14 15:16:15 +01:00
|
|
|
static void get_underline_pen( ME_Style *style, COLORREF color, HPEN *pen )
|
|
|
|
{
|
|
|
|
*pen = NULL;
|
|
|
|
/* Choose the pen type for underlining the text. */
|
|
|
|
if (style->fmt.dwMask & CFM_UNDERLINETYPE)
|
|
|
|
{
|
|
|
|
switch (style->fmt.bUnderlineType)
|
|
|
|
{
|
|
|
|
case CFU_UNDERLINE:
|
|
|
|
case CFU_UNDERLINEWORD: /* native seems to map it to simple underline (MSDN) */
|
|
|
|
case CFU_UNDERLINEDOUBLE: /* native seems to map it to simple underline (MSDN) */
|
|
|
|
*pen = CreatePen( PS_SOLID, 1, color );
|
|
|
|
break;
|
|
|
|
case CFU_UNDERLINEDOTTED:
|
|
|
|
*pen = CreatePen( PS_DOT, 1, color );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME( "Unknown underline type (%u)\n", style->fmt.bUnderlineType );
|
|
|
|
/* fall through */
|
|
|
|
case CFU_CF1UNDERLINE: /* this type is supported in the font, do nothing */
|
|
|
|
case CFU_UNDERLINENONE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-15 17:13:38 +01:00
|
|
|
static void draw_underline( ME_Context *c, ME_Run *run, int x, int y, COLORREF color )
|
|
|
|
{
|
|
|
|
HPEN pen;
|
|
|
|
|
|
|
|
get_underline_pen( run->style, color, &pen );
|
|
|
|
if (pen)
|
|
|
|
{
|
|
|
|
HPEN old_pen = SelectObject( c->hDC, pen );
|
|
|
|
MoveToEx( c->hDC, x, y + 1, NULL );
|
|
|
|
LineTo( c->hDC, x + run->nWidth, y + 1 );
|
|
|
|
SelectObject( c->hDC, old_pen );
|
|
|
|
DeleteObject( pen );
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-14 15:16:18 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* draw_space
|
|
|
|
*
|
|
|
|
* Draw the end-of-paragraph or tab space.
|
|
|
|
*
|
|
|
|
* If actually_draw is TRUE then ensure any underline is drawn.
|
|
|
|
*/
|
|
|
|
static void draw_space( ME_Context *c, ME_Run *run, int x, int y,
|
|
|
|
BOOL selected, BOOL actually_draw, int ymin, int cy )
|
2008-07-11 00:28:41 +02:00
|
|
|
{
|
2013-02-14 15:16:18 +01:00
|
|
|
HDC hdc = c->hDC;
|
|
|
|
BOOL old_style_selected = FALSE;
|
2008-07-11 00:28:45 +02:00
|
|
|
RECT rect;
|
2013-02-14 15:16:18 +01:00
|
|
|
COLORREF back_color = 0;
|
|
|
|
|
|
|
|
SetRect( &rect, x, ymin, x + run->nWidth, ymin + cy );
|
|
|
|
|
|
|
|
if (c->editor->bHideSelection) selected = FALSE;
|
|
|
|
if (c->editor->bEmulateVersion10)
|
|
|
|
{
|
|
|
|
old_style_selected = selected;
|
|
|
|
selected = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
back_color = ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHT );
|
|
|
|
|
|
|
|
if (actually_draw)
|
|
|
|
{
|
|
|
|
COLORREF text_color = get_text_color( c, run->style, selected );
|
|
|
|
COLORREF old_text, old_back;
|
|
|
|
HFONT old_font = NULL;
|
|
|
|
int y_offset = calc_y_offset( c, run->style );
|
|
|
|
static const WCHAR space[1] = {' '};
|
|
|
|
|
|
|
|
old_font = ME_SelectStyleFont( c, run->style );
|
|
|
|
old_text = SetTextColor( hdc, text_color );
|
|
|
|
if (selected) old_back = SetBkColor( hdc, back_color );
|
|
|
|
|
|
|
|
ExtTextOutW( hdc, x, y - y_offset, selected ? ETO_OPAQUE : 0, &rect, space, 1, &run->nWidth );
|
|
|
|
|
|
|
|
if (selected) SetBkColor( hdc, old_back );
|
|
|
|
SetTextColor( hdc, old_text );
|
|
|
|
ME_UnselectStyleFont( c, run->style, old_font );
|
|
|
|
|
2013-02-15 17:13:38 +01:00
|
|
|
draw_underline( c, run, x, y - y_offset, text_color );
|
2013-02-14 15:16:18 +01:00
|
|
|
}
|
|
|
|
else if (selected)
|
|
|
|
{
|
|
|
|
HBRUSH brush = CreateSolidBrush( back_color );
|
|
|
|
FillRect( hdc, &rect, brush );
|
|
|
|
DeleteObject( brush );
|
|
|
|
}
|
|
|
|
|
|
|
|
if (old_style_selected)
|
|
|
|
PatBlt( hdc, x, ymin, run->nWidth, cy, DSTINVERT );
|
2008-07-11 00:28:41 +02:00
|
|
|
}
|
|
|
|
|
2013-02-14 15:16:22 +01:00
|
|
|
static void get_selection_rect( ME_Context *c, ME_Run *run, int from, int to, int cy, RECT *r )
|
|
|
|
{
|
2013-02-15 17:13:39 +01:00
|
|
|
from = max( 0, from );
|
|
|
|
to = min( run->len, to );
|
2013-04-17 13:56:37 +02:00
|
|
|
r->left = ME_PointFromCharContext( c, run, from, TRUE );
|
2013-02-14 15:16:22 +01:00
|
|
|
r->top = 0;
|
2013-04-17 13:56:37 +02:00
|
|
|
r->right = ME_PointFromCharContext( c, run, to, TRUE );
|
2013-02-14 15:16:22 +01:00
|
|
|
r->bottom = cy;
|
|
|
|
return;
|
|
|
|
}
|
2013-02-14 15:16:18 +01:00
|
|
|
|
2013-02-14 15:16:23 +01:00
|
|
|
|
2013-02-15 17:13:40 +01:00
|
|
|
static void draw_text( ME_Context *c, ME_Run *run, int x, int y, BOOL selected, RECT *sel_rect )
|
2013-02-14 15:16:23 +01:00
|
|
|
{
|
|
|
|
COLORREF text_color = get_text_color( c, run->style, selected );
|
|
|
|
COLORREF back_color = selected ? ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHT ) : 0;
|
2013-04-17 13:56:39 +02:00
|
|
|
COLORREF old_text, old_back = 0;
|
2013-02-15 17:13:40 +01:00
|
|
|
const WCHAR *text = get_text( run, 0 );
|
|
|
|
ME_String *masked = NULL;
|
|
|
|
|
|
|
|
if (c->editor->cPasswordMask)
|
|
|
|
{
|
|
|
|
masked = ME_MakeStringR( c->editor->cPasswordMask, run->len );
|
|
|
|
text = masked->szData;
|
|
|
|
}
|
2013-02-14 15:16:23 +01:00
|
|
|
|
|
|
|
old_text = SetTextColor( c->hDC, text_color );
|
|
|
|
if (selected) old_back = SetBkColor( c->hDC, back_color );
|
|
|
|
|
2014-01-15 14:06:43 +01:00
|
|
|
if (run->para->nFlags & MEPF_COMPLEX)
|
|
|
|
ScriptTextOut( c->hDC, &run->style->script_cache, x, y, selected ? ETO_OPAQUE : 0, sel_rect,
|
|
|
|
&run->script_analysis, NULL, 0, run->glyphs, run->num_glyphs, run->advances,
|
|
|
|
NULL, run->offsets );
|
|
|
|
else
|
|
|
|
ExtTextOutW( c->hDC, x, y, selected ? ETO_OPAQUE : 0, sel_rect, text, run->len, NULL );
|
2013-02-14 15:16:23 +01:00
|
|
|
|
|
|
|
if (selected) SetBkColor( c->hDC, old_back );
|
|
|
|
SetTextColor( c->hDC, old_text );
|
|
|
|
|
2013-02-15 17:13:38 +01:00
|
|
|
draw_underline( c, run, x, y, text_color );
|
2013-02-14 15:16:23 +01:00
|
|
|
|
2013-02-15 17:13:40 +01:00
|
|
|
ME_DestroyString( masked );
|
2013-02-14 15:16:23 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-15 17:13:40 +01:00
|
|
|
static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y,
|
2013-02-14 15:16:21 +01:00
|
|
|
int nSelFrom, int nSelTo, int ymin, int cy)
|
2008-07-11 00:26:56 +02:00
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
HDC hDC = c->hDC;
|
|
|
|
HGDIOBJ hOldFont;
|
2013-02-14 15:16:16 +01:00
|
|
|
int yOffset = 0;
|
2013-02-14 15:16:23 +01:00
|
|
|
BOOL selected = (nSelFrom < run->len && nSelTo >= 0
|
|
|
|
&& nSelFrom < nSelTo && !c->editor->bHideSelection);
|
|
|
|
BOOL old_style_selected = FALSE;
|
2013-02-14 15:16:22 +01:00
|
|
|
RECT sel_rect;
|
2013-02-14 15:16:23 +01:00
|
|
|
HRGN clip = NULL, sel_rgn = NULL;
|
2008-01-01 22:04:04 +01:00
|
|
|
|
2013-02-14 15:16:16 +01:00
|
|
|
yOffset = calc_y_offset( c, run->style );
|
2008-07-11 00:28:45 +02:00
|
|
|
|
2013-02-14 15:16:23 +01:00
|
|
|
if (selected)
|
2008-07-11 00:28:45 +02:00
|
|
|
{
|
2013-02-14 15:16:22 +01:00
|
|
|
get_selection_rect( c, run, nSelFrom, nSelTo, cy, &sel_rect );
|
|
|
|
OffsetRect( &sel_rect, x, ymin );
|
2008-07-11 00:26:56 +02:00
|
|
|
|
2013-02-14 15:16:23 +01:00
|
|
|
if (c->editor->bEmulateVersion10)
|
2008-07-11 00:26:56 +02:00
|
|
|
{
|
2013-02-14 15:16:23 +01:00
|
|
|
old_style_selected = TRUE;
|
|
|
|
selected = FALSE;
|
2008-07-11 00:26:56 +02:00
|
|
|
}
|
2013-02-14 15:16:23 +01:00
|
|
|
else
|
2008-07-11 00:26:56 +02:00
|
|
|
{
|
2013-02-14 15:16:23 +01:00
|
|
|
sel_rgn = CreateRectRgnIndirect( &sel_rect );
|
|
|
|
clip = CreateRectRgn( 0, 0, 0, 0 );
|
|
|
|
if (GetClipRgn( hDC, clip ) != 1)
|
|
|
|
{
|
|
|
|
DeleteObject( clip );
|
|
|
|
clip = NULL;
|
|
|
|
}
|
2008-07-11 00:26:56 +02:00
|
|
|
}
|
2008-07-11 00:28:45 +02:00
|
|
|
}
|
|
|
|
|
2013-02-14 15:16:23 +01:00
|
|
|
hOldFont = ME_SelectStyleFont( c, run->style );
|
2008-07-11 00:28:45 +02:00
|
|
|
|
2013-02-14 15:16:23 +01:00
|
|
|
if (sel_rgn) ExtSelectClipRgn( hDC, sel_rgn, RGN_DIFF );
|
2013-02-15 17:13:40 +01:00
|
|
|
draw_text( c, run, x, y - yOffset, FALSE, NULL );
|
2013-02-14 15:16:23 +01:00
|
|
|
if (sel_rgn)
|
2008-07-11 00:28:45 +02:00
|
|
|
{
|
2013-02-14 15:16:23 +01:00
|
|
|
ExtSelectClipRgn( hDC, clip, RGN_COPY );
|
|
|
|
ExtSelectClipRgn( hDC, sel_rgn, RGN_AND );
|
2013-02-15 17:13:40 +01:00
|
|
|
draw_text( c, run, x, y - yOffset, TRUE, &sel_rect );
|
2013-02-14 15:16:23 +01:00
|
|
|
ExtSelectClipRgn( hDC, clip, RGN_COPY );
|
|
|
|
if (clip) DeleteObject( clip );
|
|
|
|
DeleteObject( sel_rgn );
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
2013-02-14 15:16:23 +01:00
|
|
|
|
|
|
|
if (old_style_selected)
|
|
|
|
PatBlt( hDC, sel_rect.left, ymin, sel_rect.right - sel_rect.left, cy, DSTINVERT );
|
|
|
|
|
2013-02-14 15:16:14 +01:00
|
|
|
ME_UnselectStyleFont(c, run->style, hOldFont);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
2007-08-13 23:41:55 +02:00
|
|
|
static void ME_DebugWrite(HDC hDC, const POINT *pt, LPCWSTR szText) {
|
2005-03-05 12:19:14 +01:00
|
|
|
int align = SetTextAlign(hDC, TA_LEFT|TA_TOP);
|
|
|
|
HGDIOBJ hFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
|
|
|
|
COLORREF color = SetTextColor(hDC, RGB(128,128,128));
|
|
|
|
TextOutW(hDC, pt->x, pt->y, szText, lstrlenW(szText));
|
|
|
|
SelectObject(hDC, hFont);
|
|
|
|
SetTextAlign(hDC, align);
|
|
|
|
SetTextColor(hDC, color);
|
|
|
|
}
|
|
|
|
|
2006-08-04 21:47:44 +02:00
|
|
|
static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para)
|
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
ME_Run *run = &rundi->member.run;
|
2008-01-01 22:05:22 +01:00
|
|
|
ME_DisplayItem *start;
|
2005-03-05 12:19:14 +01:00
|
|
|
int runofs = run->nCharOfs+para->nCharOfs;
|
2006-01-13 13:53:35 +01:00
|
|
|
int nSelFrom, nSelTo;
|
2005-03-05 12:19:14 +01:00
|
|
|
|
2006-01-31 13:01:26 +01:00
|
|
|
if (run->nFlags & MERF_HIDDEN)
|
|
|
|
return;
|
|
|
|
|
2008-01-01 22:05:22 +01:00
|
|
|
start = ME_FindItemBack(rundi, diStartRow);
|
2009-08-12 15:05:46 +02:00
|
|
|
ME_GetSelectionOfs(c->editor, &nSelFrom, &nSelTo);
|
2006-01-13 13:53:35 +01:00
|
|
|
|
|
|
|
/* Draw selected end-of-paragraph mark */
|
2008-07-11 00:26:56 +02:00
|
|
|
if (run->nFlags & MERF_ENDPARA)
|
2008-07-11 00:28:41 +02:00
|
|
|
{
|
|
|
|
if (runofs >= nSelFrom && runofs < nSelTo)
|
|
|
|
{
|
2013-02-14 15:16:18 +01:00
|
|
|
draw_space( c, run, x, y, TRUE, FALSE,
|
|
|
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
|
|
|
start->member.row.nHeight );
|
2008-07-11 00:28:41 +02:00
|
|
|
}
|
2005-03-17 11:23:40 +01:00
|
|
|
return;
|
2008-07-11 00:28:41 +02:00
|
|
|
}
|
2006-01-13 13:53:35 +01:00
|
|
|
|
2008-08-07 18:31:41 +02:00
|
|
|
if (run->nFlags & (MERF_TAB | MERF_ENDCELL))
|
2008-07-11 00:26:56 +02:00
|
|
|
{
|
2013-02-14 15:16:18 +01:00
|
|
|
BOOL selected = runofs >= nSelFrom && runofs < nSelTo;
|
|
|
|
|
|
|
|
draw_space( c, run, x, y, selected, TRUE,
|
|
|
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
|
|
|
start->member.row.nHeight );
|
2008-07-11 00:26:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-13 13:53:35 +01:00
|
|
|
if (run->nFlags & MERF_GRAPHICS)
|
2008-01-27 19:01:41 +01:00
|
|
|
ME_DrawOLE(c, x, y, run, para, (runofs >= nSelFrom) && (runofs < nSelTo));
|
2006-01-13 13:53:35 +01:00
|
|
|
else
|
2006-08-04 21:47:44 +02:00
|
|
|
{
|
2013-02-15 17:13:40 +01:00
|
|
|
ME_DrawTextWithStyle(c, run, x, y, nSelFrom - runofs, nSelTo - runofs,
|
|
|
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
|
|
|
start->member.row.nHeight);
|
2008-07-11 00:26:56 +02:00
|
|
|
}
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
2010-02-27 19:31:02 +01:00
|
|
|
/* The documented widths are in points (72 dpi), but converting them to
|
|
|
|
* 96 dpi (standard display resolution) avoids dealing with fractions. */
|
|
|
|
static const struct {unsigned width : 8, pen_style : 4, dble : 1;} border_details[] = {
|
|
|
|
/* none */ {0, PS_SOLID, FALSE},
|
|
|
|
/* 3/4 */ {1, PS_SOLID, FALSE},
|
|
|
|
/* 1 1/2 */ {2, PS_SOLID, FALSE},
|
|
|
|
/* 2 1/4 */ {3, PS_SOLID, FALSE},
|
|
|
|
/* 3 */ {4, PS_SOLID, FALSE},
|
|
|
|
/* 4 1/2 */ {6, PS_SOLID, FALSE},
|
|
|
|
/* 6 */ {8, PS_SOLID, FALSE},
|
|
|
|
/* 3/4 double */ {1, PS_SOLID, TRUE},
|
|
|
|
/* 1 1/2 double */ {2, PS_SOLID, TRUE},
|
|
|
|
/* 2 1/4 double */ {3, PS_SOLID, TRUE},
|
|
|
|
/* 3/4 gray */ {1, PS_DOT /* FIXME */, FALSE},
|
|
|
|
/* 1 1/2 dashed */ {2, PS_DASH, FALSE},
|
2008-01-01 22:04:46 +01:00
|
|
|
};
|
|
|
|
|
2008-06-19 23:52:00 +02:00
|
|
|
static const COLORREF pen_colors[16] = {
|
2008-01-01 22:04:46 +01:00
|
|
|
/* Black */ RGB(0x00, 0x00, 0x00), /* Blue */ RGB(0x00, 0x00, 0xFF),
|
|
|
|
/* Cyan */ RGB(0x00, 0xFF, 0xFF), /* Green */ RGB(0x00, 0xFF, 0x00),
|
|
|
|
/* Magenta */ RGB(0xFF, 0x00, 0xFF), /* Red */ RGB(0xFF, 0x00, 0x00),
|
|
|
|
/* Yellow */ RGB(0xFF, 0xFF, 0x00), /* White */ RGB(0xFF, 0xFF, 0xFF),
|
|
|
|
/* Dark blue */ RGB(0x00, 0x00, 0x80), /* Dark cyan */ RGB(0x00, 0x80, 0x80),
|
|
|
|
/* Dark green */ RGB(0x00, 0x80, 0x80), /* Dark magenta */ RGB(0x80, 0x00, 0x80),
|
|
|
|
/* Dark red */ RGB(0x80, 0x00, 0x00), /* Dark yellow */ RGB(0x80, 0x80, 0x00),
|
|
|
|
/* Dark gray */ RGB(0x80, 0x80, 0x80), /* Light gray */ RGB(0xc0, 0xc0, 0xc0),
|
|
|
|
};
|
|
|
|
|
2011-10-22 18:11:27 +02:00
|
|
|
static int ME_GetBorderPenWidth(const ME_Context* c, int idx)
|
2008-01-01 22:04:46 +01:00
|
|
|
{
|
2010-02-27 19:31:02 +01:00
|
|
|
int width = border_details[idx].width;
|
|
|
|
|
|
|
|
if (c->dpi.cx != 96)
|
|
|
|
width = MulDiv(width, c->dpi.cx, 96);
|
|
|
|
|
|
|
|
if (c->editor->nZoomNumerator != 0)
|
|
|
|
width = MulDiv(width, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
|
2008-01-01 22:04:46 +01:00
|
|
|
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2011-10-22 18:11:27 +02:00
|
|
|
int ME_GetParaBorderWidth(const ME_Context* c, int flags)
|
2008-01-01 22:04:46 +01:00
|
|
|
{
|
|
|
|
int idx = (flags >> 8) & 0xF;
|
|
|
|
int width;
|
|
|
|
|
|
|
|
if (idx >= sizeof(border_details) / sizeof(border_details[0]))
|
|
|
|
{
|
|
|
|
FIXME("Unsupported border value %d\n", idx);
|
|
|
|
return 0;
|
|
|
|
}
|
2010-02-27 19:31:02 +01:00
|
|
|
width = ME_GetBorderPenWidth(c, idx);
|
2008-01-01 22:04:46 +01:00
|
|
|
if (border_details[idx].dble) width = width * 2 + 1;
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2008-04-24 22:04:26 +02:00
|
|
|
static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT* bounds)
|
2008-01-01 22:04:46 +01:00
|
|
|
{
|
2008-04-24 22:04:26 +02:00
|
|
|
int idx, border_width, top_border, bottom_border;
|
2008-01-01 22:04:52 +01:00
|
|
|
RECT rc;
|
2008-08-13 05:15:36 +02:00
|
|
|
BOOL hasParaBorder;
|
2008-01-01 22:04:46 +01:00
|
|
|
|
2008-04-24 22:04:26 +02:00
|
|
|
SetRectEmpty(bounds);
|
|
|
|
if (!(para->pFmt->dwMask & (PFM_BORDER | PFM_SPACEBEFORE | PFM_SPACEAFTER))) return;
|
|
|
|
|
|
|
|
border_width = top_border = bottom_border = 0;
|
|
|
|
idx = (para->pFmt->wBorders >> 8) & 0xF;
|
2008-08-13 05:15:36 +02:00
|
|
|
hasParaBorder = (!(c->editor->bEmulateVersion10 &&
|
|
|
|
para->pFmt->dwMask & PFM_TABLE &&
|
|
|
|
para->pFmt->wEffects & PFE_TABLE) &&
|
|
|
|
(para->pFmt->dwMask & PFM_BORDER) &&
|
|
|
|
idx != 0 &&
|
|
|
|
(para->pFmt->wBorders & 0xF));
|
|
|
|
if (hasParaBorder)
|
2008-04-24 22:04:26 +02:00
|
|
|
{
|
2008-08-13 05:15:36 +02:00
|
|
|
/* FIXME: wBorders is not stored as MSDN says in v1.0 - 4.1 of richedit
|
|
|
|
* controls. It actually stores the paragraph or row border style. Although
|
|
|
|
* the value isn't used for drawing, it is used for streaming out rich text.
|
|
|
|
*
|
|
|
|
* wBorders stores the border style for each side (top, left, bottom, right)
|
|
|
|
* using nibble (4 bits) to store each border style. The rich text format
|
|
|
|
* control words, and their associated value are the following:
|
|
|
|
* \brdrdash 0
|
|
|
|
* \brdrdashsm 1
|
|
|
|
* \brdrdb 2
|
|
|
|
* \brdrdot 3
|
|
|
|
* \brdrhair 4
|
|
|
|
* \brdrs 5
|
|
|
|
* \brdrth 6
|
|
|
|
* \brdrtriple 7
|
|
|
|
*
|
|
|
|
* The order of the sides stored actually differs from v1.0 to 3.0 and v4.1.
|
|
|
|
* The mask corresponding to each side for the version are the following:
|
|
|
|
* mask v1.0-3.0 v4.1
|
|
|
|
* 0x000F top left
|
|
|
|
* 0x00F0 left top
|
|
|
|
* 0x0F00 bottom right
|
|
|
|
* 0xF000 right bottom
|
|
|
|
*/
|
2008-04-24 22:04:26 +02:00
|
|
|
if (para->pFmt->wBorders & 0x00B0)
|
|
|
|
FIXME("Unsupported border flags %x\n", para->pFmt->wBorders);
|
2010-02-27 19:31:02 +01:00
|
|
|
border_width = ME_GetParaBorderWidth(c, para->pFmt->wBorders);
|
2008-04-24 22:04:26 +02:00
|
|
|
if (para->pFmt->wBorders & 4) top_border = border_width;
|
|
|
|
if (para->pFmt->wBorders & 8) bottom_border = border_width;
|
|
|
|
}
|
2008-01-01 22:04:46 +01:00
|
|
|
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->dwMask & PFM_SPACEBEFORE)
|
|
|
|
{
|
|
|
|
rc.left = c->rcView.left;
|
|
|
|
rc.right = c->rcView.right;
|
|
|
|
rc.top = y;
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->top = ME_twips2pointsY(c, para->pFmt->dySpaceBefore);
|
|
|
|
rc.bottom = y + bounds->top + top_border;
|
2008-01-01 22:04:52 +01:00
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->dwMask & PFM_SPACEAFTER)
|
|
|
|
{
|
|
|
|
rc.left = c->rcView.left;
|
|
|
|
rc.right = c->rcView.right;
|
|
|
|
rc.bottom = y + para->nHeight;
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->bottom = ME_twips2pointsY(c, para->pFmt->dySpaceAfter);
|
|
|
|
rc.top = rc.bottom - bounds->bottom - bottom_border;
|
2008-01-01 22:04:52 +01:00
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
|
|
|
}
|
|
|
|
|
2008-08-13 05:15:36 +02:00
|
|
|
/* Native richedit doesn't support paragraph borders in v1.0 - 4.1,
|
|
|
|
* but might support it in later versions. */
|
|
|
|
if (hasParaBorder) {
|
2009-01-14 19:24:02 +01:00
|
|
|
int pen_width, rightEdge;
|
2008-01-01 22:04:52 +01:00
|
|
|
COLORREF pencr;
|
|
|
|
HPEN pen = NULL, oldpen = NULL;
|
|
|
|
POINT pt;
|
|
|
|
|
|
|
|
if (para->pFmt->wBorders & 64) /* autocolor */
|
2009-01-20 07:41:32 +01:00
|
|
|
pencr = ITextHost_TxGetSysColor(c->editor->texthost,
|
|
|
|
COLOR_WINDOWTEXT);
|
2008-01-01 22:04:52 +01:00
|
|
|
else
|
2008-01-01 22:04:46 +01:00
|
|
|
pencr = pen_colors[(para->pFmt->wBorders >> 12) & 0xF];
|
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
rightEdge = c->pt.x + max(c->editor->sizeWindow.cx,
|
|
|
|
c->editor->nTotalWidth);
|
|
|
|
|
2010-02-27 19:31:02 +01:00
|
|
|
pen_width = ME_GetBorderPenWidth(c, idx);
|
2008-01-01 22:04:52 +01:00
|
|
|
pen = CreatePen(border_details[idx].pen_style, pen_width, pencr);
|
|
|
|
oldpen = SelectObject(c->hDC, pen);
|
|
|
|
MoveToEx(c->hDC, 0, 0, &pt);
|
|
|
|
|
|
|
|
/* before & after spaces are not included in border */
|
2008-04-24 22:04:26 +02:00
|
|
|
|
|
|
|
/* helper to draw the double lines in case of corner */
|
|
|
|
#define DD(x) ((para->pFmt->wBorders & (x)) ? (pen_width + 1) : 0)
|
|
|
|
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->wBorders & 1)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL);
|
|
|
|
LineTo(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom);
|
2008-01-01 22:04:52 +01:00
|
|
|
if (border_details[idx].dble) {
|
2009-01-14 19:24:02 +01:00
|
|
|
rc.left = c->pt.x + 1;
|
2008-04-24 22:04:26 +02:00
|
|
|
rc.right = rc.left + border_width;
|
|
|
|
rc.top = y + bounds->top;
|
|
|
|
rc.bottom = y + para->nHeight - bounds->bottom;
|
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x + pen_width + 1, y + bounds->top + DD(4), NULL);
|
|
|
|
LineTo(c->hDC, c->pt.x + pen_width + 1, y + para->nHeight - bounds->bottom - DD(8));
|
2008-01-01 22:04:52 +01:00
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->left += border_width;
|
2008-01-01 22:04:46 +01:00
|
|
|
}
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->wBorders & 2)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, rightEdge - 1, y + bounds->top, NULL);
|
|
|
|
LineTo(c->hDC, rightEdge - 1, y + para->nHeight - bounds->bottom);
|
2008-01-01 22:04:52 +01:00
|
|
|
if (border_details[idx].dble) {
|
2009-01-14 19:24:02 +01:00
|
|
|
rc.left = rightEdge - pen_width - 1;
|
|
|
|
rc.right = rc.left + pen_width;
|
2008-04-24 22:04:26 +02:00
|
|
|
rc.top = y + bounds->top;
|
|
|
|
rc.bottom = y + para->nHeight - bounds->bottom;
|
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, rightEdge - 1 - pen_width - 1, y + bounds->top + DD(4), NULL);
|
|
|
|
LineTo(c->hDC, rightEdge - 1 - pen_width - 1, y + para->nHeight - bounds->bottom - DD(8));
|
2008-01-01 22:04:52 +01:00
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->right += border_width;
|
2008-01-01 22:04:46 +01:00
|
|
|
}
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->wBorders & 4)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL);
|
|
|
|
LineTo(c->hDC, rightEdge, y + bounds->top);
|
2008-01-01 22:04:52 +01:00
|
|
|
if (border_details[idx].dble) {
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x + DD(1), y + bounds->top + pen_width + 1, NULL);
|
|
|
|
LineTo(c->hDC, rightEdge - DD(2), y + bounds->top + pen_width + 1);
|
2008-01-01 22:04:52 +01:00
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->top += border_width;
|
2008-01-01 22:04:46 +01:00
|
|
|
}
|
2008-01-01 22:04:52 +01:00
|
|
|
if (para->pFmt->wBorders & 8)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom - 1, NULL);
|
|
|
|
LineTo(c->hDC, rightEdge, y + para->nHeight - bounds->bottom - 1);
|
2008-01-01 22:04:52 +01:00
|
|
|
if (border_details[idx].dble) {
|
2009-01-14 19:24:02 +01:00
|
|
|
MoveToEx(c->hDC, c->pt.x + DD(1), y + para->nHeight - bounds->bottom - 1 - pen_width - 1, NULL);
|
|
|
|
LineTo(c->hDC, rightEdge - DD(2), y + para->nHeight - bounds->bottom - 1 - pen_width - 1);
|
2008-01-01 22:04:52 +01:00
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
bounds->bottom += border_width;
|
2008-01-01 22:04:46 +01:00
|
|
|
}
|
2008-04-24 22:04:26 +02:00
|
|
|
#undef DD
|
2008-01-01 22:04:52 +01:00
|
|
|
|
|
|
|
MoveToEx(c->hDC, pt.x, pt.y, NULL);
|
|
|
|
SelectObject(c->hDC, oldpen);
|
|
|
|
DeleteObject(pen);
|
2008-01-01 22:04:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-13 05:15:32 +02:00
|
|
|
static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
|
|
|
|
{
|
|
|
|
ME_Paragraph *para = ¶graph->member.para;
|
2008-08-13 05:15:36 +02:00
|
|
|
if (!c->editor->bEmulateVersion10) /* v4.1 */
|
2008-08-13 05:15:32 +02:00
|
|
|
{
|
2008-08-13 05:15:36 +02:00
|
|
|
if (para->pCell)
|
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
ME_Cell *cell = ¶->pCell->member.cell;
|
|
|
|
ME_DisplayItem *paraAfterRow;
|
|
|
|
HPEN pen, oldPen;
|
|
|
|
LOGBRUSH logBrush;
|
|
|
|
HBRUSH brush;
|
|
|
|
COLORREF color;
|
|
|
|
POINT oldPt;
|
|
|
|
int width;
|
|
|
|
BOOL atTop = (para->pCell != para->prev_para->member.para.pCell);
|
|
|
|
BOOL atBottom = (para->pCell != para->next_para->member.para.pCell);
|
2008-12-19 15:54:58 +01:00
|
|
|
int top = c->pt.y + (atTop ? cell->pt.y : para->pt.y);
|
2008-08-13 05:15:36 +02:00
|
|
|
int bottom = (atBottom ?
|
2008-12-19 15:54:58 +01:00
|
|
|
c->pt.y + cell->pt.y + cell->nHeight :
|
2008-08-13 05:15:36 +02:00
|
|
|
top + para->nHeight + (atTop ? cell->yTextOffset : 0));
|
2008-12-19 15:54:58 +01:00
|
|
|
rc.left = c->pt.x + cell->pt.x;
|
2008-08-13 05:15:36 +02:00
|
|
|
rc.right = rc.left + cell->nWidth;
|
|
|
|
if (atTop) {
|
|
|
|
/* Erase gap before text if not all borders are the same height. */
|
|
|
|
width = max(ME_twips2pointsY(c, cell->border.top.width), 1);
|
|
|
|
rc.top = top + width;
|
|
|
|
width = cell->yTextOffset - width;
|
|
|
|
rc.bottom = rc.top + width;
|
|
|
|
if (width) {
|
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Draw cell borders.
|
2008-12-19 15:54:58 +01:00
|
|
|
* The order borders are draw in is left, top, bottom, right in order
|
2008-08-13 05:15:36 +02:00
|
|
|
* to be consistent with native richedit. This is noticeable from the
|
|
|
|
* overlap of borders of different colours. */
|
|
|
|
if (!(para->nFlags & MEPF_ROWEND)) {
|
|
|
|
rc.top = top;
|
|
|
|
rc.bottom = bottom;
|
|
|
|
if (cell->border.left.width > 0)
|
|
|
|
{
|
2008-08-13 05:15:40 +02:00
|
|
|
color = cell->border.left.colorRef;
|
2008-08-13 05:15:36 +02:00
|
|
|
width = max(ME_twips2pointsX(c, cell->border.left.width), 1);
|
|
|
|
} else {
|
|
|
|
color = RGB(192,192,192);
|
|
|
|
width = 1;
|
|
|
|
}
|
|
|
|
logBrush.lbStyle = BS_SOLID;
|
|
|
|
logBrush.lbColor = color;
|
|
|
|
logBrush.lbHatch = 0;
|
|
|
|
pen = ExtCreatePen(PS_GEOMETRIC|PS_SOLID|PS_ENDCAP_FLAT|PS_JOIN_MITER,
|
|
|
|
width, &logBrush, 0, NULL);
|
|
|
|
oldPen = SelectObject(c->hDC, pen);
|
|
|
|
MoveToEx(c->hDC, rc.left, rc.top, &oldPt);
|
|
|
|
LineTo(c->hDC, rc.left, rc.bottom);
|
|
|
|
SelectObject(c->hDC, oldPen);
|
|
|
|
DeleteObject(pen);
|
|
|
|
MoveToEx(c->hDC, oldPt.x, oldPt.y, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (atTop) {
|
|
|
|
if (cell->border.top.width > 0)
|
|
|
|
{
|
2008-08-13 05:15:40 +02:00
|
|
|
brush = CreateSolidBrush(cell->border.top.colorRef);
|
2008-08-13 05:15:36 +02:00
|
|
|
width = max(ME_twips2pointsY(c, cell->border.top.width), 1);
|
|
|
|
} else {
|
|
|
|
brush = GetStockObject(LTGRAY_BRUSH);
|
|
|
|
width = 1;
|
|
|
|
}
|
|
|
|
rc.top = top;
|
|
|
|
rc.bottom = rc.top + width;
|
|
|
|
FillRect(c->hDC, &rc, brush);
|
2008-08-13 05:15:40 +02:00
|
|
|
if (cell->border.top.width > 0)
|
|
|
|
DeleteObject(brush);
|
2008-08-13 05:15:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw the bottom border if at the last paragraph in the cell, and when
|
|
|
|
* in the last row of the table. */
|
|
|
|
if (atBottom) {
|
|
|
|
int oldLeft = rc.left;
|
|
|
|
width = max(ME_twips2pointsY(c, cell->border.bottom.width), 1);
|
|
|
|
paraAfterRow = ME_GetTableRowEnd(paragraph)->member.para.next_para;
|
|
|
|
if (paraAfterRow->member.para.nFlags & MEPF_ROWSTART) {
|
|
|
|
ME_DisplayItem *nextEndCell;
|
|
|
|
nextEndCell = ME_FindItemBack(ME_GetTableRowEnd(paraAfterRow), diCell);
|
|
|
|
assert(nextEndCell && !nextEndCell->member.cell.next_cell);
|
2008-12-19 15:54:58 +01:00
|
|
|
rc.left = c->pt.x + nextEndCell->member.cell.pt.x;
|
2008-08-13 05:15:36 +02:00
|
|
|
/* FIXME: Native draws FROM the bottom of the table rather than
|
|
|
|
* TO the bottom of the table in this case, but just doing so here
|
2008-12-18 07:56:49 +01:00
|
|
|
* will cause the next row to erase the border. */
|
2008-08-13 05:15:36 +02:00
|
|
|
/*
|
|
|
|
rc.top = bottom;
|
|
|
|
rc.bottom = rc.top + width;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
if (rc.left < rc.right) {
|
|
|
|
if (cell->border.bottom.width > 0) {
|
2008-08-13 05:15:40 +02:00
|
|
|
brush = CreateSolidBrush(cell->border.bottom.colorRef);
|
2008-08-13 05:15:36 +02:00
|
|
|
} else {
|
|
|
|
brush = GetStockObject(LTGRAY_BRUSH);
|
|
|
|
}
|
|
|
|
rc.bottom = bottom;
|
|
|
|
rc.top = rc.bottom - width;
|
|
|
|
FillRect(c->hDC, &rc, brush);
|
2008-08-13 05:15:40 +02:00
|
|
|
if (cell->border.bottom.width > 0)
|
|
|
|
DeleteObject(brush);
|
2008-08-13 05:15:36 +02:00
|
|
|
}
|
|
|
|
rc.left = oldLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Right border only drawn if at the end of the table row. */
|
|
|
|
if (!cell->next_cell->member.cell.next_cell &&
|
|
|
|
!(para->nFlags & MEPF_ROWSTART))
|
|
|
|
{
|
|
|
|
rc.top = top;
|
|
|
|
rc.bottom = bottom;
|
|
|
|
if (cell->border.right.width > 0) {
|
2008-08-13 05:15:40 +02:00
|
|
|
color = cell->border.right.colorRef;
|
2008-08-13 05:15:36 +02:00
|
|
|
width = max(ME_twips2pointsX(c, cell->border.right.width), 1);
|
|
|
|
} else {
|
|
|
|
color = RGB(192,192,192);
|
|
|
|
width = 1;
|
|
|
|
}
|
|
|
|
logBrush.lbStyle = BS_SOLID;
|
|
|
|
logBrush.lbColor = color;
|
|
|
|
logBrush.lbHatch = 0;
|
|
|
|
pen = ExtCreatePen(PS_GEOMETRIC|PS_SOLID|PS_ENDCAP_FLAT|PS_JOIN_MITER,
|
|
|
|
width, &logBrush, 0, NULL);
|
|
|
|
oldPen = SelectObject(c->hDC, pen);
|
|
|
|
MoveToEx(c->hDC, rc.right - 1, rc.top, &oldPt);
|
|
|
|
LineTo(c->hDC, rc.right - 1, rc.bottom);
|
|
|
|
SelectObject(c->hDC, oldPen);
|
|
|
|
DeleteObject(pen);
|
|
|
|
MoveToEx(c->hDC, oldPt.x, oldPt.y, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else { /* v1.0 - 3.0 */
|
|
|
|
/* Draw simple table border */
|
2008-08-13 05:15:32 +02:00
|
|
|
if (para->pFmt->dwMask & PFM_TABLE && para->pFmt->wEffects & PFE_TABLE) {
|
|
|
|
HPEN pen = NULL, oldpen = NULL;
|
|
|
|
int i, firstX, startX, endX, rowY, rowBottom, nHeight;
|
|
|
|
POINT oldPt;
|
|
|
|
PARAFORMAT2 *pNextFmt;
|
|
|
|
|
2008-08-13 05:15:40 +02:00
|
|
|
pen = CreatePen(PS_SOLID, 0, para->border.top.colorRef);
|
2008-08-13 05:15:32 +02:00
|
|
|
oldpen = SelectObject(c->hDC, pen);
|
|
|
|
|
|
|
|
/* Find the start relative to the text */
|
2008-12-19 15:54:58 +01:00
|
|
|
firstX = c->pt.x + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x;
|
2008-08-13 05:15:32 +02:00
|
|
|
/* Go back by the horizontal gap, which is stored in dxOffset */
|
|
|
|
firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset);
|
|
|
|
/* The left edge, stored in dxStartIndent affected just the first edge */
|
|
|
|
startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent);
|
2008-12-19 15:54:58 +01:00
|
|
|
rowY = c->pt.y + para->pt.y;
|
2008-08-13 05:15:32 +02:00
|
|
|
if (para->pFmt->dwMask & PFM_SPACEBEFORE)
|
|
|
|
rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore);
|
|
|
|
nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight;
|
|
|
|
rowBottom = rowY + nHeight;
|
|
|
|
|
|
|
|
/* Draw horizontal lines */
|
|
|
|
MoveToEx(c->hDC, firstX, rowY, &oldPt);
|
|
|
|
i = para->pFmt->cTabCount - 1;
|
|
|
|
endX = startX + ME_twips2pointsX(c, para->pFmt->rgxTabs[i] & 0x00ffffff) + 1;
|
|
|
|
LineTo(c->hDC, endX, rowY);
|
|
|
|
pNextFmt = para->next_para->member.para.pFmt;
|
|
|
|
/* The bottom of the row only needs to be drawn if the next row is
|
|
|
|
* not a table. */
|
|
|
|
if (!(pNextFmt && pNextFmt->dwMask & PFM_TABLE && pNextFmt->wEffects &&
|
|
|
|
para->nRows == 1))
|
|
|
|
{
|
|
|
|
/* Decrement rowBottom to draw the bottom line within the row, and
|
|
|
|
* to not draw over this line when drawing the vertical lines. */
|
|
|
|
rowBottom--;
|
|
|
|
MoveToEx(c->hDC, firstX, rowBottom, NULL);
|
|
|
|
LineTo(c->hDC, endX, rowBottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw vertical lines */
|
|
|
|
MoveToEx(c->hDC, firstX, rowY, NULL);
|
|
|
|
LineTo(c->hDC, firstX, rowBottom);
|
|
|
|
for (i = 0; i < para->pFmt->cTabCount; i++)
|
|
|
|
{
|
|
|
|
int rightBoundary = para->pFmt->rgxTabs[i] & 0x00ffffff;
|
|
|
|
endX = startX + ME_twips2pointsX(c, rightBoundary);
|
|
|
|
MoveToEx(c->hDC, endX, rowY, NULL);
|
|
|
|
LineTo(c->hDC, endX, rowBottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
MoveToEx(c->hDC, oldPt.x, oldPt.y, NULL);
|
|
|
|
SelectObject(c->hDC, oldpen);
|
|
|
|
DeleteObject(pen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-14 00:25:51 +01:00
|
|
|
static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
2008-12-18 07:56:49 +01:00
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
int align = SetTextAlign(c->hDC, TA_BASELINE);
|
|
|
|
ME_DisplayItem *p;
|
|
|
|
ME_Run *run;
|
|
|
|
ME_Paragraph *para = NULL;
|
2008-08-13 05:15:25 +02:00
|
|
|
RECT rc, bounds;
|
2008-12-19 15:54:58 +01:00
|
|
|
int y;
|
2008-08-13 05:15:25 +02:00
|
|
|
int height = 0, baseline = 0, no=0;
|
2008-01-01 22:04:34 +01:00
|
|
|
BOOL visible = FALSE;
|
2008-01-01 22:04:46 +01:00
|
|
|
|
2008-12-19 15:54:58 +01:00
|
|
|
rc.left = c->pt.x;
|
2008-08-07 18:31:41 +02:00
|
|
|
rc.right = c->rcView.right;
|
2008-12-19 15:54:58 +01:00
|
|
|
|
|
|
|
assert(paragraph);
|
|
|
|
para = ¶graph->member.para;
|
|
|
|
y = c->pt.y + para->pt.y;
|
|
|
|
if (para->pCell)
|
|
|
|
{
|
|
|
|
ME_Cell *cell = ¶->pCell->member.cell;
|
|
|
|
rc.left = c->pt.x + cell->pt.x;
|
|
|
|
rc.right = rc.left + cell->nWidth;
|
|
|
|
}
|
|
|
|
if (para->nFlags & MEPF_ROWSTART) {
|
|
|
|
ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell;
|
|
|
|
rc.right = c->pt.x + cell->pt.x;
|
|
|
|
} else if (para->nFlags & MEPF_ROWEND) {
|
|
|
|
ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell;
|
|
|
|
rc.left = c->pt.x + cell->pt.x + cell->nWidth;
|
|
|
|
}
|
|
|
|
ME_DrawParaDecoration(c, para, y, &bounds);
|
|
|
|
y += bounds.top;
|
2009-01-14 19:24:02 +01:00
|
|
|
if (bounds.left || bounds.right) {
|
|
|
|
rc.left = max(rc.left, c->pt.x + bounds.left);
|
|
|
|
rc.right = min(rc.right, c->pt.x - bounds.right
|
|
|
|
+ max(c->editor->sizeWindow.cx,
|
|
|
|
c->editor->nTotalWidth));
|
|
|
|
}
|
2008-12-19 15:54:58 +01:00
|
|
|
|
|
|
|
for (p = paragraph->next; p != para->next_para; p = p->next)
|
|
|
|
{
|
2005-03-05 12:19:14 +01:00
|
|
|
switch(p->type) {
|
|
|
|
case diParagraph:
|
2008-12-19 15:54:58 +01:00
|
|
|
assert(FALSE);
|
2008-01-01 22:04:34 +01:00
|
|
|
break;
|
|
|
|
case diStartRow:
|
2005-03-05 12:19:14 +01:00
|
|
|
y += height;
|
2008-08-07 18:31:41 +02:00
|
|
|
rc.top = y;
|
2008-12-19 15:54:58 +01:00
|
|
|
if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) {
|
|
|
|
rc.bottom = y + para->nHeight;
|
2008-08-07 18:31:41 +02:00
|
|
|
} else {
|
2008-12-18 07:56:49 +01:00
|
|
|
rc.bottom = y + p->member.row.nHeight;
|
2008-08-07 18:31:41 +02:00
|
|
|
}
|
|
|
|
visible = RectVisible(c->hDC, &rc);
|
|
|
|
if (visible) {
|
2008-01-01 22:04:10 +01:00
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
if (bounds.right)
|
|
|
|
{
|
|
|
|
/* If scrolled to the right past the end of the text, then
|
|
|
|
* there may be space to the right of the paragraph border. */
|
|
|
|
RECT rcAfterBrdr = rc;
|
|
|
|
rcAfterBrdr.left = rc.right + bounds.right;
|
|
|
|
rcAfterBrdr.right = c->rcView.right;
|
|
|
|
if (RectVisible(c->hDC, &rcAfterBrdr))
|
|
|
|
FillRect(c->hDC, &rcAfterBrdr, c->editor->hbrBackground);
|
|
|
|
}
|
2005-03-05 12:19:14 +01:00
|
|
|
if (me_debug)
|
|
|
|
{
|
|
|
|
const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
|
|
|
|
WCHAR buf[128];
|
|
|
|
POINT pt = c->pt;
|
|
|
|
wsprintfW(buf, wszRowDebug, no);
|
|
|
|
pt.y = 12+y;
|
|
|
|
ME_DebugWrite(c->hDC, &pt, buf);
|
|
|
|
}
|
2008-08-13 05:15:36 +02:00
|
|
|
|
2005-03-05 12:19:14 +01:00
|
|
|
height = p->member.row.nHeight;
|
|
|
|
baseline = p->member.row.nBaseline;
|
|
|
|
break;
|
|
|
|
case diRun:
|
|
|
|
assert(para);
|
|
|
|
run = &p->member.run;
|
|
|
|
if (visible && me_debug) {
|
2008-12-19 15:54:58 +01:00
|
|
|
RECT rc;
|
|
|
|
rc.left = c->pt.x + run->pt.x;
|
2008-12-18 07:56:49 +01:00
|
|
|
rc.right = rc.left + run->nWidth;
|
2008-12-19 15:54:58 +01:00
|
|
|
rc.top = c->pt.y + para->pt.y + run->pt.y;
|
2011-08-06 01:48:38 +02:00
|
|
|
rc.bottom = rc.top + height;
|
2016-04-21 10:54:11 +02:00
|
|
|
TRACE("rc = %s\n", wine_dbgstr_rect(&rc));
|
2010-07-29 03:18:03 +02:00
|
|
|
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
if (visible)
|
2008-12-19 15:54:58 +01:00
|
|
|
ME_DrawRun(c, c->pt.x + run->pt.x,
|
|
|
|
c->pt.y + para->pt.y + run->pt.y + baseline, p, para);
|
2005-03-05 12:19:14 +01:00
|
|
|
if (me_debug)
|
|
|
|
{
|
|
|
|
const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
|
|
|
|
WCHAR buf[2560];
|
|
|
|
POINT pt;
|
2008-12-19 15:54:58 +01:00
|
|
|
pt.x = c->pt.x + run->pt.x;
|
|
|
|
pt.y = c->pt.y + para->pt.y + run->pt.y;
|
2013-01-30 16:10:20 +01:00
|
|
|
wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, get_text( &p->member.run, 0 ));
|
2005-03-05 12:19:14 +01:00
|
|
|
ME_DebugWrite(c->hDC, &pt, buf);
|
|
|
|
}
|
|
|
|
break;
|
2008-08-07 18:31:41 +02:00
|
|
|
case diCell:
|
|
|
|
/* Clear any space at the bottom of the cell after the text. */
|
2008-12-19 15:54:58 +01:00
|
|
|
if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND))
|
2008-08-07 18:31:41 +02:00
|
|
|
break;
|
|
|
|
y += height;
|
2008-12-19 15:54:58 +01:00
|
|
|
rc.top = c->pt.y + para->pt.y + para->nHeight;
|
|
|
|
rc.bottom = c->pt.y + p->member.cell.pt.y + p->member.cell.nHeight;
|
2008-08-07 18:31:41 +02:00
|
|
|
if (RectVisible(c->hDC, &rc))
|
|
|
|
{
|
|
|
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
|
|
|
}
|
2008-08-13 05:15:36 +02:00
|
|
|
break;
|
2005-03-05 12:19:14 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
no++;
|
|
|
|
}
|
2008-08-13 05:15:32 +02:00
|
|
|
|
|
|
|
ME_DrawTableBorders(c, paragraph);
|
|
|
|
|
2005-03-05 12:19:14 +01:00
|
|
|
SetTextAlign(c->hDC, align);
|
|
|
|
}
|
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
|
2005-03-05 12:19:14 +01:00
|
|
|
{
|
2008-09-18 07:17:45 +02:00
|
|
|
BOOL bScrollBarIsVisible, bScrollBarWillBeVisible;
|
2009-01-14 19:24:02 +01:00
|
|
|
int scrollX = 0, scrollY = 0;
|
|
|
|
|
|
|
|
if (editor->horz_si.nPos != x) {
|
|
|
|
x = min(x, editor->horz_si.nMax);
|
|
|
|
x = max(x, editor->horz_si.nMin);
|
|
|
|
scrollX = editor->horz_si.nPos - x;
|
|
|
|
editor->horz_si.nPos = x;
|
2009-07-22 03:06:00 +02:00
|
|
|
if (editor->horz_si.nMax > 0xFFFF) /* scale to 16-bit value */
|
|
|
|
x = MulDiv(x, 0xFFFF, editor->horz_si.nMax);
|
|
|
|
ITextHost_TxSetScrollPos(editor->texthost, SB_HORZ, x, TRUE);
|
2009-01-14 19:24:02 +01:00
|
|
|
}
|
2005-03-19 18:06:17 +01:00
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
if (editor->vert_si.nPos != y) {
|
|
|
|
y = min(y, editor->vert_si.nMax - (int)editor->vert_si.nPage);
|
|
|
|
y = max(y, editor->vert_si.nMin);
|
|
|
|
scrollY = editor->vert_si.nPos - y;
|
|
|
|
editor->vert_si.nPos = y;
|
2009-07-22 03:06:00 +02:00
|
|
|
if (editor->vert_si.nMax > 0xFFFF) /* scale to 16-bit value */
|
|
|
|
y = MulDiv(y, 0xFFFF, editor->vert_si.nMax);
|
|
|
|
ITextHost_TxSetScrollPos(editor->texthost, SB_VERT, y, TRUE);
|
2006-09-08 23:37:25 +02:00
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
|
|
|
|
if (abs(scrollX) > editor->sizeWindow.cx ||
|
|
|
|
abs(scrollY) > editor->sizeWindow.cy)
|
2009-01-20 07:41:32 +01:00
|
|
|
ITextHost_TxInvalidateRect(editor->texthost, NULL, TRUE);
|
2008-10-19 10:43:17 +02:00
|
|
|
else
|
2009-01-20 07:41:32 +01:00
|
|
|
ITextHost_TxScrollWindowEx(editor->texthost, scrollX, scrollY,
|
|
|
|
&editor->rcFormat, &editor->rcFormat,
|
|
|
|
NULL, NULL, SW_INVALIDATE);
|
2008-10-19 10:43:17 +02:00
|
|
|
ME_Repaint(editor);
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2009-01-20 07:41:36 +01:00
|
|
|
if (editor->hWnd)
|
|
|
|
{
|
|
|
|
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
|
2009-07-17 00:46:04 +02:00
|
|
|
if (editor->styleFlags & WS_HSCROLL)
|
|
|
|
{
|
|
|
|
bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
|
|
|
|
bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx
|
|
|
|
&& (editor->styleFlags & WS_HSCROLL))
|
|
|
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
|
|
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
|
|
|
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
|
|
|
|
bScrollBarWillBeVisible);
|
|
|
|
}
|
2009-01-20 07:41:36 +01:00
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (editor->styleFlags & WS_VSCROLL)
|
|
|
|
{
|
|
|
|
bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
|
|
|
|
bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy
|
|
|
|
&& (editor->styleFlags & WS_VSCROLL)
|
|
|
|
&& (editor->styleFlags & ES_MULTILINE))
|
|
|
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
|
|
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
|
|
|
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
|
|
|
bScrollBarWillBeVisible);
|
|
|
|
}
|
2009-01-20 07:41:36 +01:00
|
|
|
}
|
2006-09-08 23:37:25 +02:00
|
|
|
ME_UpdateScrollBar(editor);
|
2005-03-19 18:06:17 +01:00
|
|
|
}
|
2005-03-05 12:19:14 +01:00
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
void ME_HScrollAbs(ME_TextEditor *editor, int x)
|
2009-01-14 00:25:51 +01:00
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
ME_ScrollAbs(editor, x, editor->vert_si.nPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ME_VScrollAbs(ME_TextEditor *editor, int y)
|
|
|
|
{
|
|
|
|
ME_ScrollAbs(editor, editor->horz_si.nPos, y);
|
2009-01-14 00:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ME_ScrollUp(ME_TextEditor *editor, int cy)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
ME_VScrollAbs(editor, editor->vert_si.nPos - cy);
|
2009-01-14 00:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ME_ScrollDown(ME_TextEditor *editor, int cy)
|
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
ME_VScrollAbs(editor, editor->vert_si.nPos + cy);
|
2009-01-14 00:25:51 +01:00
|
|
|
}
|
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
void ME_ScrollLeft(ME_TextEditor *editor, int cx)
|
|
|
|
{
|
|
|
|
ME_HScrollAbs(editor, editor->horz_si.nPos - cx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ME_ScrollRight(ME_TextEditor *editor, int cx)
|
|
|
|
{
|
|
|
|
ME_HScrollAbs(editor, editor->horz_si.nPos + cx);
|
2009-01-14 00:25:51 +01:00
|
|
|
}
|
|
|
|
|
2011-08-02 22:20:32 +02:00
|
|
|
/* Calculates the visibility after a call to SetScrollRange or
|
2009-02-24 08:38:49 +01:00
|
|
|
* SetScrollInfo with SIF_RANGE. */
|
|
|
|
static BOOL ME_PostSetScrollRangeVisibility(SCROLLINFO *si)
|
|
|
|
{
|
|
|
|
if (si->fMask & SIF_DISABLENOSCROLL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* This must match the check in SetScrollInfo to determine whether
|
|
|
|
* to show or hide the scrollbars. */
|
|
|
|
return si->nMin < si->nMax - max(si->nPage - 1, 0);
|
|
|
|
}
|
|
|
|
|
2008-09-19 17:37:27 +02:00
|
|
|
void ME_UpdateScrollBar(ME_TextEditor *editor)
|
2009-01-14 19:24:02 +01:00
|
|
|
{
|
|
|
|
/* Note that this is the only function that should ever call
|
|
|
|
* SetScrollInfo with SIF_PAGE or SIF_RANGE. */
|
|
|
|
|
2005-03-19 18:06:17 +01:00
|
|
|
SCROLLINFO si;
|
2009-01-14 19:24:02 +01:00
|
|
|
BOOL bScrollBarWasVisible, bScrollBarWillBeVisible;
|
|
|
|
|
2006-09-08 23:37:25 +02:00
|
|
|
if (ME_WrapMarkedParagraphs(editor))
|
|
|
|
FIXME("ME_UpdateScrollBar had to call ME_WrapMarkedParagraphs\n");
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2005-03-19 18:06:17 +01:00
|
|
|
si.cbSize = sizeof(si);
|
2009-01-14 19:24:02 +01:00
|
|
|
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
|
2009-07-17 00:46:04 +02:00
|
|
|
si.nMin = 0;
|
2009-01-15 20:46:25 +01:00
|
|
|
if (editor->styleFlags & ES_DISABLENOSCROLL)
|
2009-01-14 19:24:02 +01:00
|
|
|
si.fMask |= SIF_DISABLENOSCROLL;
|
2009-01-05 19:14:18 +01:00
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
/* Update horizontal scrollbar */
|
|
|
|
bScrollBarWasVisible = editor->horz_si.nMax > editor->horz_si.nPage;
|
|
|
|
bScrollBarWillBeVisible = editor->nTotalWidth > editor->sizeWindow.cx;
|
|
|
|
if (editor->horz_si.nPos && !bScrollBarWillBeVisible)
|
2009-01-05 19:14:18 +01:00
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
ME_HScrollAbs(editor, 0);
|
|
|
|
/* ME_HScrollAbs will call this function,
|
2009-01-05 19:14:18 +01:00
|
|
|
* so nothing else needs to be done here. */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
si.nMax = editor->nTotalWidth;
|
|
|
|
si.nPos = editor->horz_si.nPos;
|
|
|
|
si.nPage = editor->sizeWindow.cx;
|
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (si.nMax != editor->horz_si.nMax ||
|
2009-01-14 19:24:02 +01:00
|
|
|
si.nPage != editor->horz_si.nPage)
|
2008-07-20 18:29:19 +02:00
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
|
|
|
editor->horz_si.nMax = si.nMax;
|
|
|
|
editor->horz_si.nPage = si.nPage;
|
2009-07-17 00:46:04 +02:00
|
|
|
if ((bScrollBarWillBeVisible || bScrollBarWasVisible) &&
|
|
|
|
editor->styleFlags & WS_HSCROLL)
|
|
|
|
{
|
2009-07-22 03:06:00 +02:00
|
|
|
if (si.nMax > 0xFFFF)
|
|
|
|
{
|
|
|
|
/* Native scales the scrollbar info to 16-bit external values. */
|
|
|
|
si.nPos = MulDiv(si.nPos, 0xFFFF, si.nMax);
|
|
|
|
si.nMax = 0xFFFF;
|
|
|
|
}
|
2009-01-20 07:41:36 +01:00
|
|
|
if (editor->hWnd) {
|
|
|
|
SetScrollInfo(editor->hWnd, SB_HORZ, &si, TRUE);
|
|
|
|
} else {
|
|
|
|
ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, si.nMin, si.nMax, FALSE);
|
|
|
|
ITextHost_TxSetScrollPos(editor->texthost, SB_HORZ, si.nPos, TRUE);
|
|
|
|
}
|
2009-02-24 08:38:49 +01:00
|
|
|
/* SetScrollInfo or SetScrollRange change scrollbar visibility. */
|
|
|
|
bScrollBarWasVisible = ME_PostSetScrollRangeVisibility(&si);
|
2009-01-20 07:41:36 +01:00
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
}
|
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (editor->styleFlags & WS_HSCROLL)
|
|
|
|
{
|
|
|
|
if (si.fMask & SIF_DISABLENOSCROLL) {
|
|
|
|
bScrollBarWillBeVisible = TRUE;
|
|
|
|
} else if (!(editor->styleFlags & WS_HSCROLL)) {
|
|
|
|
bScrollBarWillBeVisible = FALSE;
|
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
|
|
|
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible);
|
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
|
|
|
|
/* Update vertical scrollbar */
|
|
|
|
bScrollBarWasVisible = editor->vert_si.nMax > editor->vert_si.nPage;
|
2009-02-24 08:37:21 +01:00
|
|
|
bScrollBarWillBeVisible = editor->nTotalLength > editor->sizeWindow.cy &&
|
|
|
|
(editor->styleFlags & ES_MULTILINE);
|
2009-01-14 19:24:02 +01:00
|
|
|
|
|
|
|
if (editor->vert_si.nPos && !bScrollBarWillBeVisible)
|
|
|
|
{
|
|
|
|
ME_VScrollAbs(editor, 0);
|
|
|
|
/* ME_VScrollAbs will call this function,
|
|
|
|
* so nothing else needs to be done here. */
|
|
|
|
return;
|
2008-07-20 18:29:19 +02:00
|
|
|
}
|
|
|
|
|
2008-06-24 20:25:52 +02:00
|
|
|
si.nMax = editor->nTotalLength;
|
2008-09-18 04:02:08 +02:00
|
|
|
si.nPos = editor->vert_si.nPos;
|
2008-06-24 20:25:52 +02:00
|
|
|
si.nPage = editor->sizeWindow.cy;
|
2009-01-05 19:14:18 +01:00
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (si.nMax != editor->vert_si.nMax ||
|
2009-01-14 19:24:02 +01:00
|
|
|
si.nPage != editor->vert_si.nPage)
|
2008-07-20 18:29:19 +02:00
|
|
|
{
|
|
|
|
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
|
|
|
editor->vert_si.nMax = si.nMax;
|
|
|
|
editor->vert_si.nPage = si.nPage;
|
2009-07-17 00:46:04 +02:00
|
|
|
if ((bScrollBarWillBeVisible || bScrollBarWasVisible) &&
|
|
|
|
editor->styleFlags & WS_VSCROLL)
|
|
|
|
{
|
2009-07-22 03:06:00 +02:00
|
|
|
if (si.nMax > 0xFFFF)
|
|
|
|
{
|
|
|
|
/* Native scales the scrollbar info to 16-bit external values. */
|
|
|
|
si.nPos = MulDiv(si.nPos, 0xFFFF, si.nMax);
|
|
|
|
si.nMax = 0xFFFF;
|
|
|
|
}
|
2009-01-20 07:41:36 +01:00
|
|
|
if (editor->hWnd) {
|
|
|
|
SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE);
|
|
|
|
} else {
|
|
|
|
ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, si.nMin, si.nMax, FALSE);
|
|
|
|
ITextHost_TxSetScrollPos(editor->texthost, SB_VERT, si.nPos, TRUE);
|
|
|
|
}
|
2009-02-24 08:38:49 +01:00
|
|
|
/* SetScrollInfo or SetScrollRange change scrollbar visibility. */
|
|
|
|
bScrollBarWasVisible = ME_PostSetScrollRangeVisibility(&si);
|
2009-01-20 07:41:36 +01:00
|
|
|
}
|
2008-07-20 18:29:19 +02:00
|
|
|
}
|
2009-01-05 19:14:31 +01:00
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (editor->styleFlags & WS_VSCROLL)
|
|
|
|
{
|
|
|
|
if (si.fMask & SIF_DISABLENOSCROLL) {
|
|
|
|
bScrollBarWillBeVisible = TRUE;
|
|
|
|
} else if (!(editor->styleFlags & WS_VSCROLL)) {
|
|
|
|
bScrollBarWillBeVisible = FALSE;
|
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2009-07-17 00:46:04 +02:00
|
|
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
|
|
|
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
|
|
|
bScrollBarWillBeVisible);
|
|
|
|
}
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
2009-01-14 19:24:02 +01:00
|
|
|
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
2005-03-05 12:19:14 +01:00
|
|
|
{
|
2009-01-14 19:24:02 +01:00
|
|
|
ME_Run *pRun = &pCursor->pRun->member.run;
|
|
|
|
ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow);
|
2009-02-09 18:01:35 +01:00
|
|
|
ME_DisplayItem *pPara = pCursor->pPara;
|
2009-01-14 19:24:02 +01:00
|
|
|
int x, y, yheight;
|
2006-09-08 23:37:25 +02:00
|
|
|
|
2005-03-05 12:19:14 +01:00
|
|
|
assert(pRow);
|
|
|
|
assert(pPara);
|
2009-01-14 19:24:02 +01:00
|
|
|
|
2009-07-17 02:01:25 +02:00
|
|
|
if (editor->styleFlags & ES_AUTOHSCROLL)
|
|
|
|
{
|
2013-04-17 13:56:37 +02:00
|
|
|
x = pRun->pt.x + ME_PointFromChar(editor, pRun, pCursor->nOffset, TRUE);
|
2009-07-17 02:01:25 +02:00
|
|
|
if (x > editor->horz_si.nPos + editor->sizeWindow.cx)
|
|
|
|
x = x + 1 - editor->sizeWindow.cx;
|
|
|
|
else if (x > editor->horz_si.nPos)
|
|
|
|
x = editor->horz_si.nPos;
|
|
|
|
|
|
|
|
if (~editor->styleFlags & ES_AUTOVSCROLL)
|
2009-07-21 06:22:12 +02:00
|
|
|
{
|
2009-07-17 02:01:25 +02:00
|
|
|
ME_HScrollAbs(editor, x);
|
2009-07-21 06:22:12 +02:00
|
|
|
return;
|
|
|
|
}
|
2009-07-17 02:01:25 +02:00
|
|
|
} else {
|
|
|
|
if (~editor->styleFlags & ES_AUTOVSCROLL)
|
|
|
|
return;
|
2009-01-14 19:24:02 +01:00
|
|
|
x = editor->horz_si.nPos;
|
2009-07-17 02:01:25 +02:00
|
|
|
}
|
2009-01-14 19:24:02 +01:00
|
|
|
|
|
|
|
y = pPara->member.para.pt.y + pRow->member.row.pt.y;
|
2005-03-05 12:19:14 +01:00
|
|
|
yheight = pRow->member.row.nHeight;
|
2009-01-14 19:24:02 +01:00
|
|
|
|
|
|
|
if (y < editor->vert_si.nPos)
|
|
|
|
ME_ScrollAbs(editor, x, y);
|
|
|
|
else if (y + yheight > editor->vert_si.nPos + editor->sizeWindow.cy)
|
|
|
|
ME_ScrollAbs(editor, x, y + yheight - editor->sizeWindow.cy);
|
|
|
|
else if (x != editor->horz_si.nPos)
|
|
|
|
ME_ScrollAbs(editor, x, editor->vert_si.nPos);
|
2005-03-05 12:19:14 +01:00
|
|
|
}
|
2006-01-10 20:23:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ME_InvalidateSelection(ME_TextEditor *editor)
|
|
|
|
{
|
2012-05-09 09:13:31 +02:00
|
|
|
ME_DisplayItem *sel_start, *sel_end;
|
|
|
|
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
|
2006-08-07 17:27:16 +02:00
|
|
|
int nStart, nEnd;
|
|
|
|
int len = ME_GetTextLength(editor);
|
|
|
|
|
2009-08-12 15:05:46 +02:00
|
|
|
ME_GetSelectionOfs(editor, &nStart, &nEnd);
|
2006-08-07 17:27:16 +02:00
|
|
|
/* if both old and new selection are 0-char (= caret only), then
|
|
|
|
there's no (inverted) area to be repainted, neither old nor new */
|
|
|
|
if (nStart == nEnd && editor->nLastSelStart == editor->nLastSelEnd)
|
|
|
|
return;
|
2006-08-04 23:40:06 +02:00
|
|
|
ME_WrapMarkedParagraphs(editor);
|
2012-05-09 09:13:31 +02:00
|
|
|
ME_GetSelectionParas(editor, &sel_start, &sel_end);
|
|
|
|
assert(sel_start->type == diParagraph);
|
|
|
|
assert(sel_end->type == diParagraph);
|
2006-08-07 17:27:16 +02:00
|
|
|
/* last selection markers aren't always updated, which means
|
2009-02-06 07:10:06 +01:00
|
|
|
* they can point past the end of the document */
|
2007-12-08 06:31:10 +01:00
|
|
|
if (editor->nLastSelStart > len || editor->nLastSelEnd > len) {
|
2012-05-09 09:13:31 +02:00
|
|
|
repaint_start = ME_FindItemFwd(editor->pBuffer->pFirst, diParagraph);
|
2012-05-18 06:30:03 +02:00
|
|
|
repaint_end = editor->pBuffer->pLast->member.para.prev_para;
|
2007-12-08 06:31:10 +01:00
|
|
|
} else {
|
|
|
|
/* if the start part of selection is being expanded or contracted... */
|
|
|
|
if (nStart < editor->nLastSelStart) {
|
2012-05-09 09:13:31 +02:00
|
|
|
repaint_start = sel_start;
|
2012-05-18 06:30:03 +02:00
|
|
|
repaint_end = editor->pLastSelStartPara;
|
2009-02-06 07:10:06 +01:00
|
|
|
} else if (nStart > editor->nLastSelStart) {
|
2012-05-09 09:13:31 +02:00
|
|
|
repaint_start = editor->pLastSelStartPara;
|
2012-05-18 06:30:03 +02:00
|
|
|
repaint_end = sel_start;
|
2007-12-08 06:31:10 +01:00
|
|
|
}
|
2006-01-10 20:23:41 +01:00
|
|
|
|
2007-12-08 06:31:10 +01:00
|
|
|
/* if the end part of selection is being contracted or expanded... */
|
|
|
|
if (nEnd < editor->nLastSelEnd) {
|
2012-05-09 09:13:31 +02:00
|
|
|
if (!repaint_start) repaint_start = sel_end;
|
2012-05-18 06:30:03 +02:00
|
|
|
repaint_end = editor->pLastSelEndPara;
|
2009-02-06 07:10:06 +01:00
|
|
|
} else if (nEnd > editor->nLastSelEnd) {
|
2012-05-09 09:13:31 +02:00
|
|
|
if (!repaint_start) repaint_start = editor->pLastSelEndPara;
|
2012-05-18 06:30:03 +02:00
|
|
|
repaint_end = sel_end;
|
2007-12-08 06:31:10 +01:00
|
|
|
}
|
2006-01-10 20:23:41 +01:00
|
|
|
}
|
2006-08-07 17:27:16 +02:00
|
|
|
|
2012-05-18 06:30:03 +02:00
|
|
|
if (repaint_start)
|
|
|
|
ME_InvalidateParagraphRange(editor, repaint_start, repaint_end);
|
2006-08-07 17:27:16 +02:00
|
|
|
/* remember the last invalidated position */
|
2009-08-12 15:05:46 +02:00
|
|
|
ME_GetSelectionOfs(editor, &editor->nLastSelStart, &editor->nLastSelEnd);
|
2006-08-07 17:27:16 +02:00
|
|
|
ME_GetSelectionParas(editor, &editor->pLastSelStartPara, &editor->pLastSelEndPara);
|
|
|
|
assert(editor->pLastSelStartPara->type == diParagraph);
|
|
|
|
assert(editor->pLastSelEndPara->type == diParagraph);
|
2006-01-10 20:23:41 +01:00
|
|
|
}
|
|
|
|
|
2005-07-24 18:17:43 +02:00
|
|
|
BOOL
|
|
|
|
ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator)
|
|
|
|
{
|
|
|
|
/* TODO: Zoom images and objects */
|
|
|
|
|
2009-01-13 19:39:39 +01:00
|
|
|
if (numerator == 0 && denominator == 0)
|
2005-07-24 18:17:43 +02:00
|
|
|
{
|
2009-01-13 19:39:39 +01:00
|
|
|
editor->nZoomNumerator = editor->nZoomDenominator = 0;
|
|
|
|
return TRUE;
|
2005-07-24 18:17:43 +02:00
|
|
|
}
|
2009-01-13 19:39:39 +01:00
|
|
|
if (numerator <= 0 || denominator <= 0)
|
|
|
|
return FALSE;
|
|
|
|
if (numerator * 64 <= denominator || numerator / denominator >= 64)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-07-24 18:17:43 +02:00
|
|
|
editor->nZoomNumerator = numerator;
|
|
|
|
editor->nZoomDenominator = denominator;
|
2009-01-13 19:39:39 +01:00
|
|
|
|
2005-07-24 18:17:43 +02:00
|
|
|
ME_RewrapRepaint(editor);
|
|
|
|
return TRUE;
|
|
|
|
}
|