mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
Sync to Wine-0_9_1:
Phil Krylov <phil@newstar.rinet.ru> - Added support for EM_REQUESTRESIZE message, EN_REQUESTRESIZE notification, and ENM_REQUESTRESIZE event mask. - Cache background color brush instead of recreating it at each screen update. Mike McCormack <mike@codeweavers.com> - Convert all RTFPanic and RTFMsg calls to ERR calls. svn path=/trunk/; revision=19315
This commit is contained in:
parent
1cae6cbce7
commit
6f80f1c062
8 changed files with 85 additions and 114 deletions
|
@ -1097,6 +1097,7 @@ BOOL ME_ArrowKey(ME_TextEditor *editor, int nVKey, int nCtrl)
|
||||||
editor->bCaretAtEnd = FALSE; /* FIXME or maybe not */
|
editor->bCaretAtEnd = FALSE; /* FIXME or maybe not */
|
||||||
ME_DeleteSelection(editor);
|
ME_DeleteSelection(editor);
|
||||||
ME_UpdateRepaint(editor);
|
ME_UpdateRepaint(editor);
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (ME_ArrowLeft(editor, p)) {
|
if (ME_ArrowLeft(editor, p)) {
|
||||||
|
@ -1105,6 +1106,7 @@ BOOL ME_ArrowKey(ME_TextEditor *editor, int nVKey, int nCtrl)
|
||||||
ME_MoveCaret(editor);
|
ME_MoveCaret(editor);
|
||||||
ME_DeleteTextAtCursor(editor, nCursor, 1);
|
ME_DeleteTextAtCursor(editor, nCursor, 1);
|
||||||
ME_UpdateRepaint(editor);
|
ME_UpdateRepaint(editor);
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1117,11 +1119,13 @@ BOOL ME_ArrowKey(ME_TextEditor *editor, int nVKey, int nCtrl)
|
||||||
ME_DeleteSelection(editor);
|
ME_DeleteSelection(editor);
|
||||||
ME_ClearTempStyle(editor);
|
ME_ClearTempStyle(editor);
|
||||||
ME_UpdateRepaint(editor);
|
ME_UpdateRepaint(editor);
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
ME_DeleteTextAtCursor(editor, nCursor, 1);
|
ME_DeleteTextAtCursor(editor, nCursor, 1);
|
||||||
ME_ClearTempStyle(editor);
|
ME_ClearTempStyle(editor);
|
||||||
ME_UpdateRepaint(editor);
|
ME_UpdateRepaint(editor);
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case VK_HOME: {
|
case VK_HOME: {
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
- EM_PASTESPECIAL
|
- EM_PASTESPECIAL
|
||||||
+ EM_POSFROMCHAR
|
+ EM_POSFROMCHAR
|
||||||
+ EM_REDO 2.0
|
+ EM_REDO 2.0
|
||||||
- EM_REQUESTRESIZE
|
+ EM_REQUESTRESIZE
|
||||||
+ EM_REPLACESEL (proper style?) ANSI&Unicode
|
+ EM_REPLACESEL (proper style?) ANSI&Unicode
|
||||||
- EM_SCROLL
|
- EM_SCROLL
|
||||||
- EM_SCROLLCARET
|
- EM_SCROLLCARET
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
- EN_MSGFILTER
|
- EN_MSGFILTER
|
||||||
- EN_OLEOPFAILED
|
- EN_OLEOPFAILED
|
||||||
- EN_PROTECTED
|
- EN_PROTECTED
|
||||||
- EN_REQUESTRESIZE
|
+ EN_REQUESTRESIZE
|
||||||
- EN_SAVECLIPBOARD
|
- EN_SAVECLIPBOARD
|
||||||
+ EN_SELCHANGE
|
+ EN_SELCHANGE
|
||||||
+ EN_SETFOCUS
|
+ EN_SETFOCUS
|
||||||
|
@ -633,6 +633,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
}
|
}
|
||||||
ME_MoveCaret(editor);
|
ME_MoveCaret(editor);
|
||||||
ME_SendSelChange(editor);
|
ME_SendSelChange(editor);
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -820,6 +821,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) {
|
||||||
ed->nUDArrowX = -1;
|
ed->nUDArrowX = -1;
|
||||||
ed->nSequence = 0;
|
ed->nSequence = 0;
|
||||||
ed->rgbBackColor = -1;
|
ed->rgbBackColor = -1;
|
||||||
|
ed->hbrBackground = GetSysColorBrush(COLOR_WINDOW);
|
||||||
ed->bCaretAtEnd = FALSE;
|
ed->bCaretAtEnd = FALSE;
|
||||||
ed->nEventMask = 0;
|
ed->nEventMask = 0;
|
||||||
ed->nModifyStep = 0;
|
ed->nModifyStep = 0;
|
||||||
|
@ -925,6 +927,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
|
||||||
if (editor->pFontCache[i].hFont)
|
if (editor->pFontCache[i].hFont)
|
||||||
DeleteObject(editor->pFontCache[i].hFont);
|
DeleteObject(editor->pFontCache[i].hFont);
|
||||||
}
|
}
|
||||||
|
DeleteObject(editor->hbrBackground);
|
||||||
|
|
||||||
FREE_OBJ(editor);
|
FREE_OBJ(editor);
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1137,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
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)
|
||||||
UNSUPPORTED_MSG(EM_REQUESTRESIZE)
|
|
||||||
UNSUPPORTED_MSG(EM_SCROLL)
|
UNSUPPORTED_MSG(EM_SCROLL)
|
||||||
UNSUPPORTED_MSG(EM_SCROLLCARET)
|
UNSUPPORTED_MSG(EM_SCROLLCARET)
|
||||||
UNSUPPORTED_MSG(EM_SELECTIONTYPE)
|
UNSUPPORTED_MSG(EM_SELECTIONTYPE)
|
||||||
|
@ -1265,10 +1267,18 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
case EM_SETBKGNDCOLOR:
|
case EM_SETBKGNDCOLOR:
|
||||||
{
|
{
|
||||||
LRESULT lColor = ME_GetBackColor(editor);
|
LRESULT lColor = ME_GetBackColor(editor);
|
||||||
|
if (editor->rgbBackColor != -1)
|
||||||
|
DeleteObject(editor->hbrBackground);
|
||||||
if (wParam)
|
if (wParam)
|
||||||
|
{
|
||||||
editor->rgbBackColor = -1;
|
editor->rgbBackColor = -1;
|
||||||
|
editor->hbrBackground = GetSysColorBrush(COLOR_WINDOW);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
editor->rgbBackColor = lParam;
|
editor->rgbBackColor = lParam;
|
||||||
|
editor->hbrBackground = CreateSolidBrush(editor->rgbBackColor);
|
||||||
|
}
|
||||||
if (editor->bRedraw)
|
if (editor->bRedraw)
|
||||||
{
|
{
|
||||||
InvalidateRect(hWnd, NULL, TRUE);
|
InvalidateRect(hWnd, NULL, TRUE);
|
||||||
|
@ -1792,12 +1802,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
{
|
{
|
||||||
HDC hDC = (HDC)wParam;
|
HDC hDC = (HDC)wParam;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
COLORREF rgbBG = ME_GetBackColor(editor);
|
|
||||||
if (GetUpdateRect(hWnd,&rc,TRUE))
|
if (GetUpdateRect(hWnd,&rc,TRUE))
|
||||||
{
|
{
|
||||||
HBRUSH hbr = CreateSolidBrush(rgbBG);
|
FillRect(hDC, &rc, editor->hbrBackground);
|
||||||
FillRect(hDC, &rc, hbr);
|
|
||||||
DeleteObject(hbr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1974,6 +1981,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
ME_RewrapRepaint(editor);
|
ME_RewrapRepaint(editor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case EM_REQUESTRESIZE:
|
||||||
|
ME_SendRequestResize(editor, TRUE);
|
||||||
|
return 0;
|
||||||
case WM_SETREDRAW:
|
case WM_SETREDRAW:
|
||||||
editor->bRedraw = wParam;
|
editor->bRedraw = wParam;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -173,6 +173,7 @@ ME_DisplayItem *ME_MakeRow(int height, int baseline, int width);
|
||||||
void ME_InsertRowStart(ME_WrapContext *wc, ME_DisplayItem *pEnd);
|
void ME_InsertRowStart(ME_WrapContext *wc, ME_DisplayItem *pEnd);
|
||||||
void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp);
|
void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp);
|
||||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor);
|
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor);
|
||||||
|
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force);
|
||||||
|
|
||||||
/* para.c */
|
/* para.c */
|
||||||
ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run);
|
ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run);
|
||||||
|
|
|
@ -270,6 +270,7 @@ typedef struct tagME_TextEditor
|
||||||
int nSequence;
|
int nSequence;
|
||||||
int nOldSelFrom, nOldSelTo;
|
int nOldSelFrom, nOldSelTo;
|
||||||
COLORREF rgbBackColor;
|
COLORREF rgbBackColor;
|
||||||
|
HBRUSH hbrBackground;
|
||||||
BOOL bCaretAtEnd;
|
BOOL bCaretAtEnd;
|
||||||
int nEventMask;
|
int nEventMask;
|
||||||
int nModifyStep;
|
int nModifyStep;
|
||||||
|
|
|
@ -78,18 +78,17 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, RECT *rcUpda
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ye>ys) {
|
if (ye>ys) {
|
||||||
HBRUSH hbr;
|
|
||||||
hbr = CreateSolidBrush(ME_GetBackColor(c.editor));
|
|
||||||
rc.left = xs;
|
rc.left = xs;
|
||||||
rc.top = ys;
|
rc.top = ys;
|
||||||
rc.right = xe;
|
rc.right = xe;
|
||||||
rc.bottom = ye;
|
rc.bottom = ye;
|
||||||
FillRect(hDC, &rc, hbr);
|
FillRect(hDC, &rc, c.editor->hbrBackground);
|
||||||
DeleteObject(hbr);
|
|
||||||
}
|
}
|
||||||
if (ys == c.pt.y) /* don't overwrite the top bar */
|
if (ys == c.pt.y) /* don't overwrite the top bar */
|
||||||
ys++;
|
ys++;
|
||||||
}
|
}
|
||||||
|
if (editor->nTotalLength != editor->nLastTotalLength)
|
||||||
|
ME_SendRequestResize(editor, FALSE);
|
||||||
editor->nLastTotalLength = editor->nTotalLength;
|
editor->nLastTotalLength = editor->nTotalLength;
|
||||||
ME_DestroyContext(&c);
|
ME_DestroyContext(&c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ void RTFInit(RTF_Info *info)
|
||||||
info->rtfTextBuf = RTFAlloc (rtfBufSiz);
|
info->rtfTextBuf = RTFAlloc (rtfBufSiz);
|
||||||
info->pushedTextBuf = RTFAlloc (rtfBufSiz);
|
info->pushedTextBuf = RTFAlloc (rtfBufSiz);
|
||||||
if (info->rtfTextBuf == NULL || info->pushedTextBuf == NULL)
|
if (info->rtfTextBuf == NULL || info->pushedTextBuf == NULL)
|
||||||
RTFPanic (info,"Cannot allocate text buffers.");
|
ERR ("Cannot allocate text buffers.");
|
||||||
info->rtfTextBuf[0] = info->pushedTextBuf[0] = '\0';
|
info->rtfTextBuf[0] = info->pushedTextBuf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ void RTFSetInputName(RTF_Info *info, char *name)
|
||||||
|
|
||||||
info->inputName = RTFStrSave (name);
|
info->inputName = RTFStrSave (name);
|
||||||
if (info->inputName == NULL)
|
if (info->inputName == NULL)
|
||||||
RTFPanic (info,"RTFSetInputName: out of memory");
|
ERR ("RTFSetInputName: out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ void RTFSetOutputName(RTF_Info *info, char *name)
|
||||||
|
|
||||||
info->outputName = RTFStrSave (name);
|
info->outputName = RTFStrSave (name);
|
||||||
if (info->outputName == NULL)
|
if (info->outputName == NULL)
|
||||||
RTFPanic (info, "RTFSetOutputName: out of memory");
|
ERR ("RTFSetOutputName: out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void RTFRouteToken(RTF_Info *info)
|
||||||
|
|
||||||
if (info->rtfClass < 0 || info->rtfClass >= rtfMaxClass) /* watchdog */
|
if (info->rtfClass < 0 || info->rtfClass >= rtfMaxClass) /* watchdog */
|
||||||
{
|
{
|
||||||
RTFPanic (info,"Unknown class %d: %s (reader malfunction)",
|
ERR( "Unknown class %d: %s (reader malfunction)",
|
||||||
info->rtfClass, info->rtfTextBuf);
|
info->rtfClass, info->rtfTextBuf);
|
||||||
}
|
}
|
||||||
if (RTFCheckCM (info, rtfControl, rtfDestination))
|
if (RTFCheckCM (info, rtfControl, rtfDestination))
|
||||||
|
@ -490,9 +490,9 @@ void RTFUngetToken(RTF_Info *info)
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (info->pushedClass >= 0) /* there's already an ungotten token */
|
if (info->pushedClass >= 0) /* there's already an ungotten token */
|
||||||
RTFPanic (info,"cannot unget two tokens");
|
ERR ("cannot unget two tokens");
|
||||||
if (info->rtfClass < 0)
|
if (info->rtfClass < 0)
|
||||||
RTFPanic (info,"no token to unget");
|
ERR ("no token to unget");
|
||||||
info->pushedClass = info->rtfClass;
|
info->pushedClass = info->rtfClass;
|
||||||
info->pushedMajor = info->rtfMajor;
|
info->pushedMajor = info->rtfMajor;
|
||||||
info->pushedMinor = info->rtfMinor;
|
info->pushedMinor = info->rtfMinor;
|
||||||
|
@ -600,7 +600,7 @@ RTFCharSetToCodePage(RTF_Info *info, int charset)
|
||||||
/* FIXME: TranslateCharsetInfo does not work as good as it
|
/* FIXME: TranslateCharsetInfo does not work as good as it
|
||||||
* should, so let's use it only when all else fails */
|
* should, so let's use it only when all else fails */
|
||||||
if (!TranslateCharsetInfo(&n, &csi, TCI_SRCCHARSET))
|
if (!TranslateCharsetInfo(&n, &csi, TCI_SRCCHARSET))
|
||||||
RTFMsg(info, "%s: unknown charset %u\n", __FUNCTION__, charset);
|
ERR("%s: unknown charset %u\n", __FUNCTION__, charset);
|
||||||
else
|
else
|
||||||
return csi.ciACP;
|
return csi.ciACP;
|
||||||
}
|
}
|
||||||
|
@ -893,19 +893,19 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
else if (RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
else if (RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
||||||
old = 0; /* brace */
|
old = 0; /* brace */
|
||||||
else /* can't tell! */
|
else /* can't tell! */
|
||||||
RTFPanic (info, "%s: Cannot determine format", fn);
|
ERR ( "%s: Cannot determine format", fn);
|
||||||
}
|
}
|
||||||
if (old == 0) /* need to find "{" here */
|
if (old == 0) /* need to find "{" here */
|
||||||
{
|
{
|
||||||
if (!RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
if (!RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
||||||
RTFPanic (info, "%s: missing \"{\"", fn);
|
ERR ( "%s: missing \"{\"", fn);
|
||||||
RTFGetToken (info); /* yes, skip to next token */
|
RTFGetToken (info); /* yes, skip to next token */
|
||||||
if (info->rtfClass == rtfEOF)
|
if (info->rtfClass == rtfEOF)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fp = New (RTFFont);
|
fp = New (RTFFont);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
RTFPanic (info, "%s: cannot allocate font entry", fn);
|
ERR ( "%s: cannot allocate font entry", fn);
|
||||||
|
|
||||||
fp->rtfNextFont = info->fontList;
|
fp->rtfNextFont = info->fontList;
|
||||||
info->fontList = fp;
|
info->fontList = fp;
|
||||||
|
@ -929,7 +929,7 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
/* ignore token but announce it */
|
/* ignore token but announce it */
|
||||||
RTFMsg (info,"%s: unknown token \"%s\"\n",
|
ERR ("%s: unknown token \"%s\"\n",
|
||||||
fn, info->rtfTextBuf);
|
fn, info->rtfTextBuf);
|
||||||
break;
|
break;
|
||||||
case rtfFontFamily:
|
case rtfFontFamily:
|
||||||
|
@ -991,7 +991,7 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
*bp = '\0';
|
*bp = '\0';
|
||||||
fp->rtfFName = RTFStrSave (buf);
|
fp->rtfFName = RTFStrSave (buf);
|
||||||
if (fp->rtfFName == NULL)
|
if (fp->rtfFName == NULL)
|
||||||
RTFPanic (info, "%s: cannot allocate font name", fn);
|
ERR ( "%s: cannot allocate font name", fn);
|
||||||
/* already have next token; don't read one */
|
/* already have next token; don't read one */
|
||||||
/* at bottom of loop */
|
/* at bottom of loop */
|
||||||
continue;
|
continue;
|
||||||
|
@ -999,7 +999,7 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* ignore token but announce it */
|
/* ignore token but announce it */
|
||||||
RTFMsg (info, "%s: unknown token \"%s\"\n",
|
ERR ( "%s: unknown token \"%s\"\n",
|
||||||
fn,info->rtfTextBuf);
|
fn,info->rtfTextBuf);
|
||||||
}
|
}
|
||||||
RTFGetToken (info);
|
RTFGetToken (info);
|
||||||
|
@ -1012,7 +1012,7 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
{
|
{
|
||||||
RTFGetToken (info);
|
RTFGetToken (info);
|
||||||
if (!RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
if (!RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
||||||
RTFPanic (info, "%s: missing \"}\"", fn);
|
ERR ( "%s: missing \"}\"", fn);
|
||||||
if (info->rtfClass == rtfEOF)
|
if (info->rtfClass == rtfEOF)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ static void ReadFontTbl(RTF_Info *info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fp->rtfFNum == -1)
|
if (fp->rtfFNum == -1)
|
||||||
RTFPanic (info,"%s: missing font number", fn);
|
ERR( "%s: missing font number", fn);
|
||||||
/*
|
/*
|
||||||
* Could check other pieces of structure here, too, I suppose.
|
* Could check other pieces of structure here, too, I suppose.
|
||||||
*/
|
*/
|
||||||
|
@ -1068,7 +1068,7 @@ static void ReadColorTbl(RTF_Info *info)
|
||||||
break;
|
break;
|
||||||
cp = New (RTFColor);
|
cp = New (RTFColor);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
RTFPanic (info,"%s: cannot allocate color entry", fn);
|
ERR ( "%s: cannot allocate color entry", fn);
|
||||||
cp->rtfCNum = cnum++;
|
cp->rtfCNum = cnum++;
|
||||||
cp->rtfCRed = cp->rtfCGreen = cp->rtfCBlue = -1;
|
cp->rtfCRed = cp->rtfCGreen = cp->rtfCBlue = -1;
|
||||||
cp->rtfNextColor = info->colorList;
|
cp->rtfNextColor = info->colorList;
|
||||||
|
@ -1086,7 +1086,7 @@ static void ReadColorTbl(RTF_Info *info)
|
||||||
if (info->rtfClass == rtfEOF)
|
if (info->rtfClass == rtfEOF)
|
||||||
break;
|
break;
|
||||||
if (!RTFCheckCM (info, rtfText, ';'))
|
if (!RTFCheckCM (info, rtfText, ';'))
|
||||||
RTFPanic (info,"%s: malformed entry", fn);
|
ERR ("%s: malformed entry", fn);
|
||||||
}
|
}
|
||||||
RTFRouteToken (info); /* feed "}" back to router */
|
RTFRouteToken (info); /* feed "}" back to router */
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
break;
|
break;
|
||||||
sp = New (RTFStyle);
|
sp = New (RTFStyle);
|
||||||
if (sp == NULL)
|
if (sp == NULL)
|
||||||
RTFPanic (info,"%s: cannot allocate stylesheet entry", fn);
|
ERR ( "%s: cannot allocate stylesheet entry", fn);
|
||||||
sp->rtfSName = NULL;
|
sp->rtfSName = NULL;
|
||||||
sp->rtfSNum = -1;
|
sp->rtfSNum = -1;
|
||||||
sp->rtfSType = rtfParStyle;
|
sp->rtfSType = rtfParStyle;
|
||||||
|
@ -1128,7 +1128,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
sp->rtfExpanding = 0;
|
sp->rtfExpanding = 0;
|
||||||
info->styleList = sp;
|
info->styleList = sp;
|
||||||
if (!RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
if (!RTFCheckCM (info, rtfGroup, rtfBeginGroup))
|
||||||
RTFPanic (info,"%s: missing \"{\"", fn);
|
ERR ( "%s: missing \"{\"", fn);
|
||||||
real_style = TRUE;
|
real_style = TRUE;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -1140,7 +1140,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
{
|
{
|
||||||
if (RTFCheckMM (info, rtfSpecialChar, rtfOptDest)) {
|
if (RTFCheckMM (info, rtfSpecialChar, rtfOptDest)) {
|
||||||
RTFGetToken(info);
|
RTFGetToken(info);
|
||||||
RTFPanic(info, "%s: skipping optional destination", fn);
|
ERR( "%s: skipping optional destination", fn);
|
||||||
RTFSkipGroup(info);
|
RTFSkipGroup(info);
|
||||||
info->rtfClass = rtfGroup;
|
info->rtfClass = rtfGroup;
|
||||||
info->rtfMajor = rtfEndGroup;
|
info->rtfMajor = rtfEndGroup;
|
||||||
|
@ -1182,14 +1182,14 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
}
|
}
|
||||||
sep = New (RTFStyleElt);
|
sep = New (RTFStyleElt);
|
||||||
if (sep == NULL)
|
if (sep == NULL)
|
||||||
RTFPanic (info,"%s: cannot allocate style element", fn);
|
ERR ( "%s: cannot allocate style element", fn);
|
||||||
sep->rtfSEClass = info->rtfClass;
|
sep->rtfSEClass = info->rtfClass;
|
||||||
sep->rtfSEMajor = info->rtfMajor;
|
sep->rtfSEMajor = info->rtfMajor;
|
||||||
sep->rtfSEMinor = info->rtfMinor;
|
sep->rtfSEMinor = info->rtfMinor;
|
||||||
sep->rtfSEParam = info->rtfParam;
|
sep->rtfSEParam = info->rtfParam;
|
||||||
sep->rtfSEText = RTFStrSave (info->rtfTextBuf);
|
sep->rtfSEText = RTFStrSave (info->rtfTextBuf);
|
||||||
if (sep->rtfSEText == NULL)
|
if (sep->rtfSEText == NULL)
|
||||||
RTFPanic (info,"%s: cannot allocate style element text", fn);
|
ERR ( "%s: cannot allocate style element text", fn);
|
||||||
if (sepLast == NULL)
|
if (sepLast == NULL)
|
||||||
sp->rtfSSEList = sep; /* first element */
|
sp->rtfSSEList = sep; /* first element */
|
||||||
else /* add to end */
|
else /* add to end */
|
||||||
|
@ -1203,7 +1203,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
* This passes over "{\*\keycode ... }, among
|
* This passes over "{\*\keycode ... }, among
|
||||||
* other things. A temporary (perhaps) hack.
|
* other things. A temporary (perhaps) hack.
|
||||||
*/
|
*/
|
||||||
RTFPanic(info, "%s: skipping begin", fn);
|
ERR( "%s: skipping begin", fn);
|
||||||
RTFSkipGroup (info);
|
RTFSkipGroup (info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1224,19 +1224,19 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
*bp = '\0';
|
*bp = '\0';
|
||||||
sp->rtfSName = RTFStrSave (buf);
|
sp->rtfSName = RTFStrSave (buf);
|
||||||
if (sp->rtfSName == NULL)
|
if (sp->rtfSName == NULL)
|
||||||
RTFPanic (info, "%s: cannot allocate style name", fn);
|
ERR ( "%s: cannot allocate style name", fn);
|
||||||
}
|
}
|
||||||
else /* unrecognized */
|
else /* unrecognized */
|
||||||
{
|
{
|
||||||
/* ignore token but announce it */
|
/* ignore token but announce it */
|
||||||
RTFMsg (info, "%s: unknown token \"%s\"\n",
|
ERR ( "%s: unknown token \"%s\"\n",
|
||||||
fn, info->rtfTextBuf);
|
fn, info->rtfTextBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (real_style) {
|
if (real_style) {
|
||||||
RTFGetToken (info);
|
RTFGetToken (info);
|
||||||
if (!RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
if (!RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
||||||
RTFPanic (info, "%s: missing \"}\"", fn);
|
ERR ( "%s: missing \"}\"", fn);
|
||||||
/*
|
/*
|
||||||
* Check over the style structure. A name is a must.
|
* Check over the style structure. A name is a must.
|
||||||
* If no style number was specified, check whether it's the
|
* If no style number was specified, check whether it's the
|
||||||
|
@ -1248,12 +1248,12 @@ static void ReadStyleSheet(RTF_Info *info)
|
||||||
* Some German RTF writers use "Standard" instead of "Normal".
|
* Some German RTF writers use "Standard" instead of "Normal".
|
||||||
*/
|
*/
|
||||||
if (sp->rtfSName == NULL)
|
if (sp->rtfSName == NULL)
|
||||||
RTFPanic (info,"%s: missing style name", fn);
|
ERR ( "%s: missing style name", fn);
|
||||||
if (sp->rtfSNum < 0)
|
if (sp->rtfSNum < 0)
|
||||||
{
|
{
|
||||||
if (strncmp (buf, "Normal", 6) != 0
|
if (strncmp (buf, "Normal", 6) != 0
|
||||||
&& strncmp (buf, "Standard", 8) != 0)
|
&& strncmp (buf, "Standard", 8) != 0)
|
||||||
RTFPanic (info,"%s: missing style number", fn);
|
ERR ( "%s: missing style number", fn);
|
||||||
sp->rtfSNum = rtfNormalStyleNum;
|
sp->rtfSNum = rtfNormalStyleNum;
|
||||||
}
|
}
|
||||||
if (sp->rtfSNextPar == -1) /* if \snext not given, */
|
if (sp->rtfSNextPar == -1) /* if \snext not given, */
|
||||||
|
@ -1359,7 +1359,7 @@ void RTFExpandStyle(RTF_Info *info, int n)
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return;
|
return;
|
||||||
if (s->rtfExpanding != 0)
|
if (s->rtfExpanding != 0)
|
||||||
RTFPanic (info,"Style expansion loop, style %d", n);
|
ERR ("Style expansion loop, style %d", n);
|
||||||
s->rtfExpanding = 1; /* set expansion flag for loop detection */
|
s->rtfExpanding = 1; /* set expansion flag for loop detection */
|
||||||
/*
|
/*
|
||||||
* Expand "based-on" style (unless it's the same as the current
|
* Expand "based-on" style (unless it's the same as the current
|
||||||
|
@ -2443,63 +2443,6 @@ int RTFHexToChar(int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print message.
|
|
||||||
*
|
|
||||||
* Message should include linefeeds as necessary.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void RTFMsg (RTF_Info *info, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
char buf[rtfBufSiz];
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start (args,fmt);
|
|
||||||
vsprintf (buf, fmt, args);
|
|
||||||
va_end (args);
|
|
||||||
MESSAGE( "%s", buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process termination. Print error message and exit. Also prints
|
|
||||||
* current token, and current input line number and position within
|
|
||||||
* line if any input has been read from the current file. (No input
|
|
||||||
* has been read if prevChar is EOF).
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void DefaultPanicProc(RTF_Info *info, char *s)
|
|
||||||
{
|
|
||||||
MESSAGE( "%s", s);
|
|
||||||
/*exit (1);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void RTFPanic(RTF_Info *info, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
char buf[rtfBufSiz];
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start (args,fmt);
|
|
||||||
vsprintf (buf, fmt, args);
|
|
||||||
va_end (args);
|
|
||||||
lstrcatA (buf, "\n");
|
|
||||||
if (info->prevChar != EOF && info->rtfTextBuf != NULL)
|
|
||||||
{
|
|
||||||
sprintf (buf + lstrlenA (buf),
|
|
||||||
"Last token read was \"%s\" near line %ld, position %d.\n",
|
|
||||||
info->rtfTextBuf, info->rtfLineNum, info->rtfLinePos);
|
|
||||||
}
|
|
||||||
DefaultPanicProc(info, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2594,7 +2537,7 @@ CharAttr(RTF_Info *info)
|
||||||
TRACE("font %d codepage %d\n", info->rtfParam, info->codePage);
|
TRACE("font %d codepage %d\n", info->rtfParam, info->codePage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RTFMsg(info, "unknown font %d\n", info->rtfParam);
|
ERR( "unknown font %d\n", info->rtfParam);
|
||||||
break;
|
break;
|
||||||
case rtfUnicodeLength:
|
case rtfUnicodeLength:
|
||||||
info->unicodeLength = info->rtfParam;
|
info->unicodeLength = info->rtfParam;
|
||||||
|
|
|
@ -1093,8 +1093,6 @@ struct _RTF_Info {
|
||||||
|
|
||||||
RTFFuncPtr readHook;
|
RTFFuncPtr readHook;
|
||||||
|
|
||||||
RTFFuncPtr panicProc;
|
|
||||||
|
|
||||||
DWORD dwOutputCount;
|
DWORD dwOutputCount;
|
||||||
WCHAR OutputBuffer[0x1000];
|
WCHAR OutputBuffer[0x1000];
|
||||||
|
|
||||||
|
@ -1140,18 +1138,6 @@ RTFColor *RTFGetColor (RTF_Info *, int);
|
||||||
RTFStyle *RTFGetStyle (RTF_Info *, int);
|
RTFStyle *RTFGetStyle (RTF_Info *, int);
|
||||||
int RTFCharToHex ( char);
|
int RTFCharToHex ( char);
|
||||||
int RTFHexToChar ( int );
|
int RTFHexToChar ( int );
|
||||||
void RTFSetMsgProc ( RTFFuncPtr );
|
|
||||||
void RTFSetPanicProc ( RTF_Info *, RTFFuncPtr);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following messing around is used to allow RTFMsg() and RTFPanic()
|
|
||||||
* to be variable-argument functions that are declared publicly but
|
|
||||||
* without generating prototype-mismatch errors on systems that have
|
|
||||||
* stdarg.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void RTFMsg (RTF_Info *, const char *fmt, ...);
|
|
||||||
void RTFPanic (RTF_Info *, const char *fmt, ...);
|
|
||||||
|
|
||||||
void RTFFlushOutputBuffer( RTF_Info *info );
|
void RTFFlushOutputBuffer( RTF_Info *info );
|
||||||
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream);
|
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream);
|
||||||
|
|
|
@ -448,9 +448,36 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
|
||||||
}
|
}
|
||||||
editor->sizeWindow.cx = c.rcView.right-c.rcView.left;
|
editor->sizeWindow.cx = c.rcView.right-c.rcView.left;
|
||||||
editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top;
|
editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top;
|
||||||
|
|
||||||
editor->nTotalLength = c.pt.y;
|
editor->nTotalLength = c.pt.y;
|
||||||
|
|
||||||
ME_DestroyContext(&c);
|
ME_DestroyContext(&c);
|
||||||
ReleaseDC(hWnd, hDC);
|
ReleaseDC(hWnd, hDC);
|
||||||
return bModified;
|
return bModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ME_SendRequestResize(ME_TextEditor *editor, BOOL force)
|
||||||
|
{
|
||||||
|
if (editor->nEventMask & ENM_REQUESTRESIZE)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
|
||||||
|
GetClientRect(editor->hWnd, &rc);
|
||||||
|
|
||||||
|
if (force || rc.bottom != editor->nTotalLength)
|
||||||
|
{
|
||||||
|
REQRESIZE info;
|
||||||
|
|
||||||
|
info.nmhdr.hwndFrom = editor->hWnd;
|
||||||
|
info.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID);
|
||||||
|
info.nmhdr.code = EN_REQUESTRESIZE;
|
||||||
|
info.rc = rc;
|
||||||
|
info.rc.bottom = editor->nTotalLength;
|
||||||
|
|
||||||
|
SendMessageW(GetParent(editor->hWnd), WM_NOTIFY,
|
||||||
|
info.nmhdr.idFrom, (LPARAM)&info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue