Added EM_GETZOOM and EM_SETZOOM RichEdit message handlers.
This commit is contained in:
parent
05b2c1cc81
commit
8759b5fead
|
@ -73,7 +73,7 @@
|
||||||
- EM_GETWORDBREAKPROC
|
- EM_GETWORDBREAKPROC
|
||||||
- EM_GETWORDBREAKPROCEX
|
- EM_GETWORDBREAKPROCEX
|
||||||
- EM_GETWORDWRAPMODE 1.0asian
|
- EM_GETWORDWRAPMODE 1.0asian
|
||||||
- EM_SETZOOM 3.0
|
+ EM_GETZOOM 3.0
|
||||||
- EM_HIDESELECTION
|
- EM_HIDESELECTION
|
||||||
- EM_LIMITTEXT
|
- EM_LIMITTEXT
|
||||||
+ EM_LINEFROMCHAR
|
+ EM_LINEFROMCHAR
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
- EM_SETWORDBREAKPROC
|
- EM_SETWORDBREAKPROC
|
||||||
- EM_SETWORDBREAKPROCEX
|
- EM_SETWORDBREAKPROCEX
|
||||||
- EM_SETWORDWRAPMODE 1.0asian
|
- EM_SETWORDWRAPMODE 1.0asian
|
||||||
- EM_SETZOOM 3.0
|
+ EM_SETZOOM 3.0
|
||||||
- EM_SHOWSCROLLBAR 2.0
|
- EM_SHOWSCROLLBAR 2.0
|
||||||
- EM_STOPGROUPTYPING 2.0
|
- EM_STOPGROUPTYPING 2.0
|
||||||
+ EM_STREAMIN
|
+ EM_STREAMIN
|
||||||
|
@ -747,6 +747,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) {
|
||||||
ed->nParagraphs = 1;
|
ed->nParagraphs = 1;
|
||||||
ed->nLastSelStart = ed->nLastSelEnd = 0;
|
ed->nLastSelStart = ed->nLastSelEnd = 0;
|
||||||
ed->nScrollPosY = 0;
|
ed->nScrollPosY = 0;
|
||||||
|
ed->nZoomNumerator = ed->nZoomDenominator = 0;
|
||||||
for (i=0; i<HFONT_CACHE_SIZE; i++)
|
for (i=0; i<HFONT_CACHE_SIZE; i++)
|
||||||
{
|
{
|
||||||
ed->pFontCache[i].nRefs = 0;
|
ed->pFontCache[i].nRefs = 0;
|
||||||
|
@ -1051,7 +1052,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
UNSUPPORTED_MSG(EM_GETUNDONAME)
|
UNSUPPORTED_MSG(EM_GETUNDONAME)
|
||||||
UNSUPPORTED_MSG(EM_GETWORDBREAKPROC)
|
UNSUPPORTED_MSG(EM_GETWORDBREAKPROC)
|
||||||
UNSUPPORTED_MSG(EM_GETWORDBREAKPROCEX)
|
UNSUPPORTED_MSG(EM_GETWORDBREAKPROCEX)
|
||||||
UNSUPPORTED_MSG(EM_GETZOOM)
|
|
||||||
UNSUPPORTED_MSG(EM_HIDESELECTION)
|
UNSUPPORTED_MSG(EM_HIDESELECTION)
|
||||||
UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */
|
UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */
|
||||||
UNSUPPORTED_MSG(EM_PASTESPECIAL)
|
UNSUPPORTED_MSG(EM_PASTESPECIAL)
|
||||||
|
@ -1079,7 +1079,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
UNSUPPORTED_MSG(EM_SETWORDBREAKPROC)
|
UNSUPPORTED_MSG(EM_SETWORDBREAKPROC)
|
||||||
UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX)
|
UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX)
|
||||||
UNSUPPORTED_MSG(EM_SHOWSCROLLBAR)
|
UNSUPPORTED_MSG(EM_SHOWSCROLLBAR)
|
||||||
UNSUPPORTED_MSG(EM_SETZOOM)
|
|
||||||
UNSUPPORTED_MSG(WM_SETFONT)
|
UNSUPPORTED_MSG(WM_SETFONT)
|
||||||
UNSUPPORTED_MSG(WM_STYLECHANGING)
|
UNSUPPORTED_MSG(WM_STYLECHANGING)
|
||||||
UNSUPPORTED_MSG(WM_STYLECHANGED)
|
UNSUPPORTED_MSG(WM_STYLECHANGED)
|
||||||
|
@ -1580,6 +1579,14 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
FINDTEXTEXW *ex = (FINDTEXTEXW *)lParam;
|
FINDTEXTEXW *ex = (FINDTEXTEXW *)lParam;
|
||||||
return ME_FindText(editor, wParam, &ex->chrg, ex->lpstrText, &ex->chrgText);
|
return ME_FindText(editor, wParam, &ex->chrg, ex->lpstrText, &ex->chrgText);
|
||||||
}
|
}
|
||||||
|
case EM_GETZOOM:
|
||||||
|
if (!wParam || !lParam)
|
||||||
|
return FALSE;
|
||||||
|
*(int *)wParam = editor->nZoomNumerator;
|
||||||
|
*(int *)lParam = editor->nZoomDenominator;
|
||||||
|
return TRUE;
|
||||||
|
case EM_SETZOOM:
|
||||||
|
return ME_SetZoom(editor, wParam, lParam);
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
ME_CommitUndo(editor);
|
ME_CommitUndo(editor);
|
||||||
ME_WrapMarkedParagraphs(editor);
|
ME_WrapMarkedParagraphs(editor);
|
||||||
|
@ -1736,10 +1743,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
}
|
}
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
ME_MarkAllForWrapping(editor);
|
ME_RewrapRepaint(editor);
|
||||||
ME_WrapMarkedParagraphs(editor);
|
|
||||||
ME_UpdateScrollBar(editor);
|
|
||||||
ME_Repaint(editor);
|
|
||||||
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
case EM_GETOLEINTERFACE:
|
case EM_GETOLEINTERFACE:
|
||||||
|
@ -1755,6 +1759,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* RichEdit10ANSIWndProc (RICHED20.9)
|
* RichEdit10ANSIWndProc (RICHED20.9)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -191,6 +191,7 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor);
|
||||||
/* paint.c */
|
/* paint.c */
|
||||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, RECT *rcUpdate);
|
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, RECT *rcUpdate);
|
||||||
void ME_Repaint(ME_TextEditor *editor);
|
void ME_Repaint(ME_TextEditor *editor);
|
||||||
|
void ME_RewrapRepaint(ME_TextEditor *editor);
|
||||||
void ME_UpdateRepaint(ME_TextEditor *editor);
|
void ME_UpdateRepaint(ME_TextEditor *editor);
|
||||||
void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph);
|
void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph);
|
||||||
void ME_UpdateScrollBar(ME_TextEditor *editor);
|
void ME_UpdateScrollBar(ME_TextEditor *editor);
|
||||||
|
@ -198,6 +199,7 @@ int ME_GetYScrollPos(ME_TextEditor *editor);
|
||||||
void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun);
|
void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun);
|
||||||
COLORREF ME_GetBackColor(ME_TextEditor *editor);
|
COLORREF ME_GetBackColor(ME_TextEditor *editor);
|
||||||
void ME_Scroll(ME_TextEditor *editor, int cx, int cy);
|
void ME_Scroll(ME_TextEditor *editor, int cx, int cy);
|
||||||
|
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator);
|
||||||
|
|
||||||
/* richole.c */
|
/* richole.c */
|
||||||
extern LRESULT CreateIRichEditOle(LPVOID *);
|
extern LRESULT CreateIRichEditOle(LPVOID *);
|
||||||
|
|
|
@ -269,6 +269,7 @@ typedef struct tagME_TextEditor
|
||||||
ME_OutStream *pStream;
|
ME_OutStream *pStream;
|
||||||
BOOL bScrollX, bScrollY;
|
BOOL bScrollX, bScrollY;
|
||||||
int nScrollPosY;
|
int nScrollPosY;
|
||||||
|
int nZoomNumerator, nZoomDenominator;
|
||||||
} ME_TextEditor;
|
} ME_TextEditor;
|
||||||
|
|
||||||
typedef struct tagME_Context
|
typedef struct tagME_Context
|
||||||
|
|
|
@ -173,6 +173,17 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
|
||||||
ME_SendSelChange(editor);
|
ME_SendSelChange(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ME_RewrapRepaint(ME_TextEditor *editor)
|
||||||
|
{
|
||||||
|
ME_MarkAllForWrapping(editor);
|
||||||
|
ME_WrapMarkedParagraphs(editor);
|
||||||
|
ME_UpdateScrollBar(editor);
|
||||||
|
ME_Repaint(editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChars,
|
static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChars,
|
||||||
ME_Style *s, int *width, int nSelFrom, int nSelTo, int ymin, int cy) {
|
ME_Style *s, int *width, int nSelFrom, int nSelTo, int ymin, int cy) {
|
||||||
HDC hDC = c->hDC;
|
HDC hDC = c->hDC;
|
||||||
|
@ -193,7 +204,17 @@ static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, in
|
||||||
if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12;
|
if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12;
|
||||||
}
|
}
|
||||||
if (yTwipsOffset)
|
if (yTwipsOffset)
|
||||||
yOffset = yTwipsOffset*GetDeviceCaps(hDC, LOGPIXELSY)/1440;
|
{
|
||||||
|
int numerator = 1;
|
||||||
|
int denominator = 1;
|
||||||
|
|
||||||
|
if (c->editor->nZoomNumerator)
|
||||||
|
{
|
||||||
|
numerator = c->editor->nZoomNumerator;
|
||||||
|
denominator = c->editor->nZoomDenominator;
|
||||||
|
}
|
||||||
|
yOffset = yTwipsOffset * GetDeviceCaps(hDC, LOGPIXELSY) * numerator / denominator / 1440;
|
||||||
|
}
|
||||||
ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL);
|
ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL);
|
||||||
if (width) {
|
if (width) {
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
|
@ -484,3 +505,25 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun)
|
||||||
UpdateWindow(hWnd);
|
UpdateWindow(hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator)
|
||||||
|
{
|
||||||
|
/* TODO: Zoom images and objects */
|
||||||
|
|
||||||
|
if (numerator != 0)
|
||||||
|
{
|
||||||
|
if (denominator == 0)
|
||||||
|
return FALSE;
|
||||||
|
if (1.0 / 64.0 > (float)numerator / (float)denominator
|
||||||
|
|| (float)numerator / (float)denominator > 64.0)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
editor->nZoomNumerator = numerator;
|
||||||
|
editor->nZoomDenominator = denominator;
|
||||||
|
|
||||||
|
ME_RewrapRepaint(editor);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -249,14 +249,23 @@ void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048])
|
||||||
ME_DumpStyleEffect(&p, "Text protected:", pFmt, CFM_PROTECTED);
|
ME_DumpStyleEffect(&p, "Text protected:", pFmt, CFM_PROTECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ME_LogFontFromStyle(HDC hDC, LOGFONTW *lf, ME_Style *s)
|
|
||||||
|
static void
|
||||||
|
ME_LogFontFromStyle(HDC hDC, LOGFONTW *lf, ME_Style *s, int nZoomNumerator, int nZoomDenominator)
|
||||||
{
|
{
|
||||||
int rx, ry;
|
int rx, ry;
|
||||||
rx = GetDeviceCaps(hDC, LOGPIXELSX);
|
rx = GetDeviceCaps(hDC, LOGPIXELSX);
|
||||||
ry = GetDeviceCaps(hDC, LOGPIXELSY);
|
ry = GetDeviceCaps(hDC, LOGPIXELSY);
|
||||||
ZeroMemory(lf, sizeof(LOGFONTW));
|
ZeroMemory(lf, sizeof(LOGFONTW));
|
||||||
lstrcpyW(lf->lfFaceName, s->fmt.szFaceName);
|
lstrcpyW(lf->lfFaceName, s->fmt.szFaceName);
|
||||||
lf->lfHeight = -s->fmt.yHeight*ry/1440;
|
|
||||||
|
if (nZoomNumerator == 0)
|
||||||
|
{
|
||||||
|
nZoomNumerator = 1;
|
||||||
|
nZoomDenominator = 1;
|
||||||
|
}
|
||||||
|
lf->lfHeight = -s->fmt.yHeight*ry*nZoomNumerator/nZoomDenominator/1440;
|
||||||
|
|
||||||
lf->lfWeight = 400;
|
lf->lfWeight = 400;
|
||||||
if (s->fmt.dwEffects & s->fmt.dwMask & CFM_BOLD)
|
if (s->fmt.dwEffects & s->fmt.dwMask & CFM_BOLD)
|
||||||
lf->lfWeight = 700;
|
lf->lfWeight = 700;
|
||||||
|
@ -294,7 +303,7 @@ HFONT ME_SelectStyleFont(ME_TextEditor *editor, HDC hDC, ME_Style *s)
|
||||||
assert(hDC);
|
assert(hDC);
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
ME_LogFontFromStyle(hDC, &lf, s);
|
ME_LogFontFromStyle(hDC, &lf, s, editor->nZoomNumerator, editor->nZoomDenominator);
|
||||||
|
|
||||||
for (i=0; i<HFONT_CACHE_SIZE; i++)
|
for (i=0; i<HFONT_CACHE_SIZE; i++)
|
||||||
editor->pFontCache[i].nAge++;
|
editor->pFontCache[i].nAge++;
|
||||||
|
|
Loading…
Reference in New Issue