shell32: Localize 'new folder' string.
[wine/wine-kai.git] / dlls / riched20 / paint.c
blob7c40814f88b4e4f89053511787374ea6ce709542
1 /*
2 * RichEdit - painting functions
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2005 by Phil Krylov
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "editor.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
26 void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) {
27 ME_DisplayItem *item;
28 ME_Context c;
29 int yoffset;
31 editor->nSequence++;
32 yoffset = ME_GetYScrollPos(editor);
33 ME_InitContext(&c, editor, hDC);
34 SetBkMode(hDC, TRANSPARENT);
35 ME_MoveCaret(editor);
36 item = editor->pBuffer->pFirst->next;
37 c.pt.y -= yoffset;
38 while(item != editor->pBuffer->pLast) {
39 int ye;
40 assert(item->type == diParagraph);
41 ye = c.pt.y + item->member.para.nHeight;
42 if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT))
44 BOOL bPaint = (rcUpdate == NULL);
45 if (rcUpdate)
46 bPaint = c.pt.y<rcUpdate->bottom &&
47 c.pt.y+item->member.para.nHeight>rcUpdate->top;
48 if (bPaint)
50 ME_DrawParagraph(&c, item);
51 if (!rcUpdate || (rcUpdate->top<=c.pt.y && rcUpdate->bottom>=ye))
52 item->member.para.nFlags &= ~MEPF_REPAINT;
55 c.pt.y = ye;
56 item = item->member.para.next_para;
58 if (c.pt.y<c.rcView.bottom) {
59 RECT rc;
60 int xs = c.rcView.left, xe = c.rcView.right;
61 int ys = c.pt.y, ye = c.rcView.bottom;
63 if (bOnlyNew)
65 int y1 = editor->nTotalLength-yoffset, y2 = editor->nLastTotalLength-yoffset;
66 if (y1<y2)
67 ys = y1, ye = y2+1;
68 else
69 ys = ye;
72 if (rcUpdate && ys!=ye)
74 xs = rcUpdate->left, xe = rcUpdate->right;
75 if (rcUpdate->top > ys)
76 ys = rcUpdate->top;
77 if (rcUpdate->bottom < ye)
78 ye = rcUpdate->bottom;
81 if (ye>ys) {
82 rc.left = xs;
83 rc.top = ys;
84 rc.right = xe;
85 rc.bottom = ye;
86 FillRect(hDC, &rc, c.editor->hbrBackground);
88 if (ys == c.pt.y) /* don't overwrite the top bar */
89 ys++;
91 if (editor->nTotalLength != editor->nLastTotalLength)
92 ME_SendRequestResize(editor, FALSE);
93 editor->nLastTotalLength = editor->nTotalLength;
94 ME_DestroyContext(&c);
97 void ME_Repaint(ME_TextEditor *editor)
99 if (ME_WrapMarkedParagraphs(editor))
101 ME_UpdateScrollBar(editor);
102 FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
104 ME_SendOldNotify(editor, EN_UPDATE);
105 UpdateWindow(editor->hWnd);
108 void ME_UpdateRepaint(ME_TextEditor *editor)
110 /* Should be called whenever the contents of the control have changed */
111 ME_Cursor *pCursor;
113 if (ME_WrapMarkedParagraphs(editor))
114 ME_UpdateScrollBar(editor);
116 /* Ensure that the cursor is visible */
117 pCursor = &editor->pCursors[0];
118 ME_EnsureVisible(editor, pCursor->pRun);
120 /* send EN_CHANGE if the event mask asks for it */
121 if(editor->nEventMask & ENM_CHANGE)
123 editor->nEventMask &= ~ENM_CHANGE;
124 ME_SendOldNotify(editor, EN_CHANGE);
125 editor->nEventMask |= ENM_CHANGE;
127 ME_Repaint(editor);
128 ME_SendSelChange(editor);
131 void
132 ME_RewrapRepaint(ME_TextEditor *editor)
134 /* RewrapRepaint should be called whenever the control has changed in
135 * looks, but not content. Like resizing. */
137 ME_MarkAllForWrapping(editor);
138 ME_WrapMarkedParagraphs(editor);
139 ME_UpdateScrollBar(editor);
141 ME_Repaint(editor);
145 static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChars,
146 ME_Style *s, int *width, int nSelFrom, int nSelTo, int ymin, int cy) {
147 HDC hDC = c->hDC;
148 HGDIOBJ hOldFont;
149 COLORREF rgbOld, rgbBack;
150 int yOffset = 0, yTwipsOffset = 0;
151 hOldFont = ME_SelectStyleFont(c->editor, hDC, s);
152 rgbBack = ME_GetBackColor(c->editor);
153 if ((s->fmt.dwMask & CFM_LINK) && (s->fmt.dwEffects & CFE_LINK))
154 rgbOld = SetTextColor(hDC, RGB(0,0,255));
155 else if ((s->fmt.dwMask & CFM_COLOR) && (s->fmt.dwEffects & CFE_AUTOCOLOR))
156 rgbOld = SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
157 else
158 rgbOld = SetTextColor(hDC, s->fmt.crTextColor);
159 if ((s->fmt.dwMask & s->fmt.dwEffects) & CFM_OFFSET) {
160 yTwipsOffset = s->fmt.yOffset;
162 if ((s->fmt.dwMask & s->fmt.dwEffects) & (CFM_SUPERSCRIPT | CFM_SUBSCRIPT)) {
163 if (s->fmt.dwEffects & CFE_SUPERSCRIPT) yTwipsOffset = s->fmt.yHeight/3;
164 if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12;
166 if (yTwipsOffset)
168 int numerator = 1;
169 int denominator = 1;
171 if (c->editor->nZoomNumerator)
173 numerator = c->editor->nZoomNumerator;
174 denominator = c->editor->nZoomDenominator;
176 yOffset = yTwipsOffset * GetDeviceCaps(hDC, LOGPIXELSY) * numerator / denominator / 1440;
178 ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL);
179 if (width) {
180 SIZE sz;
181 GetTextExtentPoint32W(hDC, szText, nChars, &sz);
182 *width = sz.cx;
184 if (nSelFrom < nChars && nSelTo >= 0 && nSelFrom<nSelTo)
186 SIZE sz;
187 if (nSelFrom < 0) nSelFrom = 0;
188 if (nSelTo > nChars) nSelTo = nChars;
189 GetTextExtentPoint32W(hDC, szText, nSelFrom, &sz);
190 x += sz.cx;
191 GetTextExtentPoint32W(hDC, szText+nSelFrom, nSelTo-nSelFrom, &sz);
193 /* Invert selection if not hidden by EM_HIDESELECTION */
194 if (c->editor->bHideSelection == FALSE)
195 PatBlt(hDC, x, ymin, sz.cx, cy, DSTINVERT);
197 SetTextColor(hDC, rgbOld);
198 ME_UnselectStyleFont(c->editor, hDC, s, hOldFont);
201 static void ME_DebugWrite(HDC hDC, const POINT *pt, LPCWSTR szText) {
202 int align = SetTextAlign(hDC, TA_LEFT|TA_TOP);
203 HGDIOBJ hFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
204 COLORREF color = SetTextColor(hDC, RGB(128,128,128));
205 TextOutW(hDC, pt->x, pt->y, szText, lstrlenW(szText));
206 SelectObject(hDC, hFont);
207 SetTextAlign(hDC, align);
208 SetTextColor(hDC, color);
211 static void ME_DrawGraphics(ME_Context *c, int x, int y, ME_Run *run,
212 ME_Paragraph *para, BOOL selected) {
213 SIZE sz;
214 int xs, ys, xe, ye, h, ym, width, eyes;
215 ME_GetGraphicsSize(c->editor, run, &sz);
216 xs = run->pt.x;
217 ys = y-sz.cy;
218 xe = xs+sz.cx;
219 ye = y;
220 h = ye-ys;
221 ym = ys+h/4;
222 width = sz.cx;
223 eyes = width/8;
224 /* draw a smiling face :) */
225 Ellipse(c->hDC, xs, ys, xe, ye);
226 Ellipse(c->hDC, xs+width/8, ym, x+width/8+eyes, ym+eyes);
227 Ellipse(c->hDC, xs+7*width/8-eyes, ym, xs+7*width/8, ym+eyes);
228 MoveToEx(c->hDC, xs+width/8, ys+3*h/4-eyes, NULL);
229 LineTo(c->hDC, xs+width/8, ys+3*h/4);
230 LineTo(c->hDC, xs+7*width/8, ys+3*h/4);
231 LineTo(c->hDC, xs+7*width/8, ys+3*h/4-eyes);
232 if (selected)
234 /* descent is usually (always?) 0 for graphics */
235 PatBlt(c->hDC, x, y-run->nAscent, sz.cx, run->nAscent+run->nDescent, DSTINVERT);
239 static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para)
241 ME_Run *run = &rundi->member.run;
242 ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow);
243 int runofs = run->nCharOfs+para->nCharOfs;
244 int nSelFrom, nSelTo;
245 const WCHAR wszSpace[] = {' ', 0};
247 if (run->nFlags & MERF_HIDDEN)
248 return;
250 ME_GetSelection(c->editor, &nSelFrom, &nSelTo);
252 /* Draw selected end-of-paragraph mark */
253 if (run->nFlags & MERF_ENDPARA && runofs >= nSelFrom && runofs < nSelTo)
254 ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, NULL, 0, 1,
255 c->pt.y + start->member.row.nYPos,
256 start->member.row.nHeight);
258 /* you can always comment it out if you need visible paragraph marks */
259 if (run->nFlags & (MERF_ENDPARA | MERF_TAB | MERF_CELL))
260 return;
262 if (run->nFlags & MERF_GRAPHICS)
263 ME_DrawGraphics(c, x, y, run, para, (runofs >= nSelFrom) && (runofs < nSelTo));
264 else
266 if (c->editor->cPasswordMask)
268 ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask,ME_StrVLen(run->strText));
269 ME_DrawTextWithStyle(c, x, y,
270 szMasked->szData, ME_StrVLen(szMasked), run->style, NULL,
271 nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
272 ME_DestroyString(szMasked);
274 else
275 ME_DrawTextWithStyle(c, x, y,
276 run->strText->szData, ME_StrVLen(run->strText), run->style, NULL,
277 nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
281 COLORREF ME_GetBackColor(const ME_TextEditor *editor)
283 /* Looks like I was seriously confused
284 return GetSysColor((GetWindowLong(editor->hWnd, GWL_STYLE) & ES_READONLY) ? COLOR_3DFACE: COLOR_WINDOW);
286 if (editor->rgbBackColor == -1)
287 return GetSysColor(COLOR_WINDOW);
288 else
289 return editor->rgbBackColor;
292 void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) {
293 int align = SetTextAlign(c->hDC, TA_BASELINE);
294 ME_DisplayItem *p;
295 ME_Run *run;
296 ME_Paragraph *para = NULL;
297 RECT rc, rcPara;
298 int y = c->pt.y;
299 int height = 0, baseline = 0, no=0, pno = 0;
300 int xs, xe;
301 int visible = 0;
302 int nMargWidth = 0;
304 c->pt.x = c->rcView.left;
305 rcPara.left = c->rcView.left;
306 rcPara.right = c->rcView.right;
307 for (p = paragraph; p!=paragraph->member.para.next_para; p = p->next) {
308 switch(p->type) {
309 case diParagraph:
310 para = &p->member.para;
311 break;
312 case diStartRow:
313 assert(para);
314 nMargWidth = (pno==0?para->nFirstMargin:para->nLeftMargin);
315 xs = c->rcView.left+nMargWidth;
316 xe = c->rcView.right-para->nRightMargin;
317 y += height;
318 rcPara.top = y;
319 rcPara.bottom = y+p->member.row.nHeight;
320 visible = RectVisible(c->hDC, &rcPara);
321 if (visible) {
322 HBRUSH hbr;
323 hbr = CreateSolidBrush(ME_GetBackColor(c->editor));
324 /* left margin */
325 rc.left = c->rcView.left;
326 rc.right = c->rcView.left+nMargWidth;
327 rc.top = y;
328 rc.bottom = y+p->member.row.nHeight;
329 FillRect(c->hDC, &rc, hbr/* c->hbrMargin */);
330 /* right margin */
331 rc.left = xe;
332 rc.right = c->rcView.right;
333 FillRect(c->hDC, &rc, hbr/* c->hbrMargin */);
334 rc.left = c->rcView.left+nMargWidth;
335 rc.right = xe;
336 FillRect(c->hDC, &rc, hbr);
337 DeleteObject(hbr);
339 if (me_debug)
341 const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
342 WCHAR buf[128];
343 POINT pt = c->pt;
344 wsprintfW(buf, wszRowDebug, no);
345 pt.y = 12+y;
346 ME_DebugWrite(c->hDC, &pt, buf);
349 height = p->member.row.nHeight;
350 baseline = p->member.row.nBaseline;
351 pno++;
352 break;
353 case diRun:
354 assert(para);
355 run = &p->member.run;
356 if (visible && me_debug) {
357 rc.left = c->rcView.left+run->pt.x;
358 rc.right = c->rcView.left+run->pt.x+run->nWidth;
359 rc.top = c->pt.y+run->pt.y;
360 rc.bottom = c->pt.y+run->pt.y+height;
361 TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom);
362 if (run->nFlags & MERF_SKIPPED)
363 DrawFocusRect(c->hDC, &rc);
364 else
365 FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
367 if (visible)
368 ME_DrawRun(c, run->pt.x, c->pt.y+run->pt.y+baseline, p, &paragraph->member.para);
369 if (me_debug)
371 /* I'm using %ls, hope wsprintfW is not going to use wrong (4-byte) WCHAR version */
372 const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
373 WCHAR buf[2560];
374 POINT pt;
375 pt.x = run->pt.x;
376 pt.y = c->pt.y + run->pt.y;
377 wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, p->member.run.strText->szData);
378 ME_DebugWrite(c->hDC, &pt, buf);
380 /* c->pt.x += p->member.run.nWidth; */
381 break;
382 default:
383 break;
385 no++;
387 SetTextAlign(c->hDC, align);
390 void ME_ScrollAbs(ME_TextEditor *editor, int absY)
392 ME_Scroll(editor, absY, 1);
395 void ME_ScrollUp(ME_TextEditor *editor, int cy)
397 ME_Scroll(editor, cy, 2);
400 void ME_ScrollDown(ME_TextEditor *editor, int cy)
402 ME_Scroll(editor, cy, 3);
405 void ME_Scroll(ME_TextEditor *editor, int value, int type)
407 SCROLLINFO si;
408 int nOrigPos, nNewPos, nActualScroll;
410 nOrigPos = ME_GetYScrollPos(editor);
412 si.cbSize = sizeof(SCROLLINFO);
413 si.fMask = SIF_POS;
415 switch (type)
417 case 1:
418 /*Scroll absolutly*/
419 si.nPos = value;
420 break;
421 case 2:
422 /* Scroll up - towards the beginning of the document */
423 si.nPos = nOrigPos - value;
424 break;
425 case 3:
426 /* Scroll down - towards the end of the document */
427 si.nPos = nOrigPos + value;
428 break;
429 default:
430 FIXME("ME_Scroll called incorrectly\n");
431 si.nPos = 0;
434 nNewPos = SetScrollInfo(editor->hWnd, SB_VERT, &si, editor->bRedraw);
435 nActualScroll = nOrigPos - nNewPos;
436 if (editor->bRedraw)
438 if (abs(nActualScroll) > editor->sizeWindow.cy)
439 InvalidateRect(editor->hWnd, NULL, TRUE);
440 else
441 ScrollWindowEx(editor->hWnd, 0, nActualScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
442 ME_Repaint(editor);
445 ME_UpdateScrollBar(editor);
449 void ME_UpdateScrollBar(ME_TextEditor *editor)
451 /* Note that this is the only funciton that should ever call SetScrolLInfo
452 * with SIF_PAGE or SIF_RANGE. SetScrollPos and SetScrollRange should never
453 * be used at all. */
455 HWND hWnd;
456 SCROLLINFO si;
457 BOOL bScrollBarWasVisible,bScrollBarWillBeVisible;
459 if (ME_WrapMarkedParagraphs(editor))
460 FIXME("ME_UpdateScrollBar had to call ME_WrapMarkedParagraphs\n");
462 hWnd = editor->hWnd;
463 si.cbSize = sizeof(si);
464 bScrollBarWasVisible = ME_GetYScrollVisible(editor);
465 bScrollBarWillBeVisible = editor->nHeight > editor->sizeWindow.cy;
467 if (bScrollBarWasVisible != bScrollBarWillBeVisible)
469 ShowScrollBar(hWnd, SB_VERT, bScrollBarWillBeVisible);
470 ME_MarkAllForWrapping(editor);
471 ME_WrapMarkedParagraphs(editor);
474 si.fMask = SIF_PAGE | SIF_RANGE;
475 if (GetWindowLongW(hWnd, GWL_STYLE) & ES_DISABLENOSCROLL)
476 si.fMask |= SIF_DISABLENOSCROLL;
478 si.nMin = 0;
479 si.nMax = editor->nTotalLength;
481 si.nPage = editor->sizeWindow.cy;
483 TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
484 SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
487 int ME_GetYScrollPos(ME_TextEditor *editor)
489 SCROLLINFO si;
490 si.cbSize = sizeof(si);
491 si.fMask = SIF_POS;
492 GetScrollInfo(editor->hWnd, SB_VERT, &si);
493 return si.nPos;
496 BOOL ME_GetYScrollVisible(ME_TextEditor *editor)
497 { /* Returns true if the scrollbar is visible */
498 SCROLLBARINFO sbi;
499 sbi.cbSize = sizeof(sbi);
500 GetScrollBarInfo(editor->hWnd, OBJID_VSCROLL, &sbi);
501 return ((sbi.rgstate[0] & STATE_SYSTEM_INVISIBLE) == 0);
504 void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun)
506 ME_DisplayItem *pRow = ME_FindItemBack(pRun, diStartRow);
507 ME_DisplayItem *pPara = ME_FindItemBack(pRun, diParagraph);
508 int y, yrel, yheight, yold;
510 assert(pRow);
511 assert(pPara);
513 y = pPara->member.para.nYPos+pRow->member.row.nYPos;
514 yheight = pRow->member.row.nHeight;
515 yold = ME_GetYScrollPos(editor);
516 yrel = y - yold;
518 if (y < yold)
519 ME_ScrollAbs(editor,y);
520 else if (yrel + yheight > editor->sizeWindow.cy)
521 ME_ScrollAbs(editor,y+yheight-editor->sizeWindow.cy);
525 void
526 ME_InvalidateFromOfs(ME_TextEditor *editor, int nCharOfs)
528 RECT rc;
529 int x, y, height;
530 ME_Cursor tmp;
532 ME_RunOfsFromCharOfs(editor, nCharOfs, &tmp.pRun, &tmp.nOffset);
533 ME_GetCursorCoordinates(editor, &tmp, &x, &y, &height);
535 rc.left = 0;
536 rc.top = y;
537 rc.bottom = y + height;
538 rc.right = editor->rcFormat.right;
539 InvalidateRect(editor->hWnd, &rc, FALSE);
543 void
544 ME_InvalidateSelection(ME_TextEditor *editor)
546 ME_DisplayItem *para1, *para2;
547 int nStart, nEnd;
548 int len = ME_GetTextLength(editor);
550 ME_GetSelection(editor, &nStart, &nEnd);
551 /* if both old and new selection are 0-char (= caret only), then
552 there's no (inverted) area to be repainted, neither old nor new */
553 if (nStart == nEnd && editor->nLastSelStart == editor->nLastSelEnd)
554 return;
555 ME_WrapMarkedParagraphs(editor);
556 ME_GetSelectionParas(editor, &para1, &para2);
557 assert(para1->type == diParagraph);
558 assert(para2->type == diParagraph);
559 /* last selection markers aren't always updated, which means
560 they can point past the end of the document */
561 if (editor->nLastSelStart > len)
562 editor->nLastSelEnd = len;
563 if (editor->nLastSelEnd > len)
564 editor->nLastSelEnd = len;
566 /* if the start part of selection is being expanded or contracted... */
567 if (nStart < editor->nLastSelStart) {
568 ME_MarkForPainting(editor, para1, ME_FindItemFwd(editor->pLastSelStartPara, diParagraphOrEnd));
569 } else
570 if (nStart > editor->nLastSelStart) {
571 ME_MarkForPainting(editor, editor->pLastSelStartPara, ME_FindItemFwd(para1, diParagraphOrEnd));
574 /* if the end part of selection is being contracted or expanded... */
575 if (nEnd < editor->nLastSelEnd) {
576 ME_MarkForPainting(editor, para2, ME_FindItemFwd(editor->pLastSelEndPara, diParagraphOrEnd));
577 } else
578 if (nEnd > editor->nLastSelEnd) {
579 ME_MarkForPainting(editor, editor->pLastSelEndPara, ME_FindItemFwd(para2, diParagraphOrEnd));
582 ME_InvalidateMarkedParagraphs(editor);
583 /* remember the last invalidated position */
584 ME_GetSelection(editor, &editor->nLastSelStart, &editor->nLastSelEnd);
585 ME_GetSelectionParas(editor, &editor->pLastSelStartPara, &editor->pLastSelEndPara);
586 assert(editor->pLastSelStartPara->type == diParagraph);
587 assert(editor->pLastSelEndPara->type == diParagraph);
590 void
591 ME_QueueInvalidateFromCursor(ME_TextEditor *editor, int nCursor)
593 editor->nInvalidOfs = ME_GetCursorOfs(editor, nCursor);
597 BOOL
598 ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator)
600 /* TODO: Zoom images and objects */
602 if (numerator != 0)
604 if (denominator == 0)
605 return FALSE;
606 if (1.0 / 64.0 > (float)numerator / (float)denominator
607 || (float)numerator / (float)denominator > 64.0)
608 return FALSE;
611 editor->nZoomNumerator = numerator;
612 editor->nZoomDenominator = denominator;
614 ME_RewrapRepaint(editor);
615 return TRUE;