Commit d287e886 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

riched20: Declare some functions static.

parent 831290e9
...@@ -83,7 +83,6 @@ ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass); ...@@ -83,7 +83,6 @@ ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass); ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass); ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_FindItemFwdOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass); ME_DisplayItem *ME_FindItemFwdOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass);
BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_MakeDI(ME_DIType type); ME_DisplayItem *ME_MakeDI(ME_DIType type);
void ME_DestroyDisplayItem(ME_DisplayItem *item); void ME_DestroyDisplayItem(ME_DisplayItem *item);
void ME_DumpDocument(ME_TextBuffer *buffer); void ME_DumpDocument(ME_TextBuffer *buffer);
...@@ -222,12 +221,9 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp, ...@@ -222,12 +221,9 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
BOOL keepFirstParaFormat); BOOL keepFirstParaFormat);
void ME_DumpParaStyle(ME_Paragraph *s); void ME_DumpParaStyle(ME_Paragraph *s);
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]); void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]);
BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt);
BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt); BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt);
void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFORMAT2 *pFmt);
void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt); void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt);
/* marks from first up to (but not including) last */ /* marks from first up to (but not including) last */
void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last);
void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last); void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last);
void ME_MarkAllForWrapping(ME_TextEditor *editor); void ME_MarkAllForWrapping(ME_TextEditor *editor);
void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt); void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt);
...@@ -237,7 +233,6 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT * ...@@ -237,7 +233,6 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
void ME_Repaint(ME_TextEditor *editor); void ME_Repaint(ME_TextEditor *editor);
void ME_RewrapRepaint(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_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun); void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun);
void ME_InvalidateSelection(ME_TextEditor *editor); void ME_InvalidateSelection(ME_TextEditor *editor);
void ME_QueueInvalidateFromCursor(ME_TextEditor *editor, int nCursor); void ME_QueueInvalidateFromCursor(ME_TextEditor *editor, int nCursor);
...@@ -250,10 +245,8 @@ int ME_twips2pointsY(ME_Context *c, int y); ...@@ -250,10 +245,8 @@ int ME_twips2pointsY(ME_Context *c, int y);
void ME_ScrollAbs(ME_TextEditor *editor, int absY); void ME_ScrollAbs(ME_TextEditor *editor, int absY);
void ME_ScrollUp(ME_TextEditor *editor, int cy); void ME_ScrollUp(ME_TextEditor *editor, int cy);
void ME_ScrollDown(ME_TextEditor *editor, int cy); void ME_ScrollDown(ME_TextEditor *editor, int cy);
void ME_Scroll(ME_TextEditor *editor, int value, int type);
void ME_UpdateScrollBar(ME_TextEditor *editor); void ME_UpdateScrollBar(ME_TextEditor *editor);
int ME_GetYScrollPos(ME_TextEditor *editor); int ME_GetYScrollPos(ME_TextEditor *editor);
BOOL ME_GetYScrollVisible(ME_TextEditor *editor);
/* other functions in paint.c */ /* other functions in paint.c */
int ME_GetParaBorderWidth(ME_TextEditor *editor, int); int ME_GetParaBorderWidth(ME_TextEditor *editor, int);
......
...@@ -42,6 +42,27 @@ void ME_Remove(ME_DisplayItem *diWhere) ...@@ -42,6 +42,27 @@ void ME_Remove(ME_DisplayItem *diWhere)
diNext->prev = diPrev; diNext->prev = diPrev;
} }
static BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
{
if (type==nTypeOrClass)
return TRUE;
if (nTypeOrClass==diRunOrParagraph && (type==diRun || type==diParagraph))
return TRUE;
if (nTypeOrClass==diRunOrStartRow && (type==diRun || type==diStartRow))
return TRUE;
if (nTypeOrClass==diParagraphOrEnd && (type==diTextEnd || type==diParagraph))
return TRUE;
if (nTypeOrClass==diStartRowOrParagraph && (type==diStartRow || type==diParagraph))
return TRUE;
if (nTypeOrClass==diStartRowOrParagraphOrEnd
&& (type==diStartRow || type==diParagraph || type==diTextEnd))
return TRUE;
if (nTypeOrClass==diRunOrParagraphOrEnd
&& (type==diRun || type==diParagraph || type==diTextEnd))
return TRUE;
return FALSE;
}
ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass)
{ {
if (!di) if (!di)
...@@ -87,27 +108,6 @@ ME_DisplayItem *ME_FindItemFwdOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass) ...@@ -87,27 +108,6 @@ ME_DisplayItem *ME_FindItemFwdOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass)
return NULL; return NULL;
} }
BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
{
if (type==nTypeOrClass)
return TRUE;
if (nTypeOrClass==diRunOrParagraph && (type==diRun || type==diParagraph))
return TRUE;
if (nTypeOrClass==diRunOrStartRow && (type==diRun || type==diStartRow))
return TRUE;
if (nTypeOrClass==diParagraphOrEnd && (type==diTextEnd || type==diParagraph))
return TRUE;
if (nTypeOrClass==diStartRowOrParagraph && (type==diStartRow || type==diParagraph))
return TRUE;
if (nTypeOrClass==diStartRowOrParagraphOrEnd
&& (type==diStartRow || type==diParagraph || type==diTextEnd))
return TRUE;
if (nTypeOrClass==diRunOrParagraphOrEnd
&& (type==diRun || type==diParagraph || type==diTextEnd))
return TRUE;
return FALSE;
}
void ME_DestroyDisplayItem(ME_DisplayItem *item) { void ME_DestroyDisplayItem(ME_DisplayItem *item) {
/* TRACE("type=%s\n", ME_GetDITypeName(item->type)); */ /* TRACE("type=%s\n", ME_GetDITypeName(item->type)); */
if (item->type==diParagraph || item->type == diUndoSetParagraphFormat) { if (item->type==diParagraph || item->type == diUndoSetParagraphFormat) {
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit); WINE_DEFAULT_DEBUG_CHANNEL(richedit);
static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph);
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate)
{ {
ME_DisplayItem *item; ME_DisplayItem *item;
...@@ -878,7 +880,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) ...@@ -878,7 +880,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
} }
} }
void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
{ {
int align = SetTextAlign(c->hDC, TA_BASELINE); int align = SetTextAlign(c->hDC, TA_BASELINE);
ME_DisplayItem *p; ME_DisplayItem *p;
...@@ -997,22 +999,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) ...@@ -997,22 +999,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
SetTextAlign(c->hDC, align); SetTextAlign(c->hDC, align);
} }
void ME_ScrollAbs(ME_TextEditor *editor, int absY) static void ME_Scroll(ME_TextEditor *editor, int value, int type)
{
ME_Scroll(editor, absY, 1);
}
void ME_ScrollUp(ME_TextEditor *editor, int cy)
{
ME_Scroll(editor, cy, 2);
}
void ME_ScrollDown(ME_TextEditor *editor, int cy)
{
ME_Scroll(editor, cy, 3);
}
void ME_Scroll(ME_TextEditor *editor, int value, int type)
{ {
SCROLLINFO si; SCROLLINFO si;
int nOrigPos, nNewPos, nActualScroll; int nOrigPos, nNewPos, nActualScroll;
...@@ -1065,7 +1052,26 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type) ...@@ -1065,7 +1052,26 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type)
ME_UpdateScrollBar(editor); ME_UpdateScrollBar(editor);
} }
void ME_ScrollAbs(ME_TextEditor *editor, int absY)
{
ME_Scroll(editor, absY, 1);
}
void ME_ScrollUp(ME_TextEditor *editor, int cy)
{
ME_Scroll(editor, cy, 2);
}
void ME_ScrollDown(ME_TextEditor *editor, int cy)
{
ME_Scroll(editor, cy, 3);
}
static BOOL ME_GetYScrollVisible(ME_TextEditor *editor)
{ /* Returns true if the scrollbar is visible */
return (editor->vert_si.nMax - editor->vert_si.nMin > editor->vert_si.nPage);
}
void ME_UpdateScrollBar(ME_TextEditor *editor) void ME_UpdateScrollBar(ME_TextEditor *editor)
{ {
/* Note that this is the only function that should ever call SetScrolLInfo /* Note that this is the only function that should ever call SetScrolLInfo
...@@ -1125,11 +1131,6 @@ int ME_GetYScrollPos(ME_TextEditor *editor) ...@@ -1125,11 +1131,6 @@ int ME_GetYScrollPos(ME_TextEditor *editor)
return editor->vert_si.nPos; return editor->vert_si.nPos;
} }
BOOL ME_GetYScrollVisible(ME_TextEditor *editor)
{ /* Returns true if the scrollbar is visible */
return (editor->vert_si.nMax - editor->vert_si.nMin > editor->vert_si.nPage);
}
void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun) void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun)
{ {
ME_DisplayItem *pRow = ME_FindItemBack(pRun, diStartRow); ME_DisplayItem *pRow = ME_FindItemBack(pRun, diStartRow);
......
...@@ -80,13 +80,8 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor) ...@@ -80,13 +80,8 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
ME_DestroyContext(&c, editor->hWnd); ME_DestroyContext(&c, editor->hWnd);
} }
void ME_MarkAllForWrapping(ME_TextEditor *editor)
{
ME_MarkForWrapping(editor, editor->pBuffer->pFirst->member.para.next_para, editor->pBuffer->pLast);
}
void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last) static void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last)
{ {
while(first != last) while(first != last)
{ {
...@@ -95,6 +90,11 @@ void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_D ...@@ -95,6 +90,11 @@ void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_D
} }
} }
void ME_MarkAllForWrapping(ME_TextEditor *editor)
{
ME_MarkForWrapping(editor, editor->pBuffer->pFirst->member.para.next_para, editor->pBuffer->pLast);
}
void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last) void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last)
{ {
while(first != last && first) while(first != last && first)
...@@ -123,6 +123,67 @@ static void ME_UpdateTableFlags(ME_DisplayItem *para) ...@@ -123,6 +123,67 @@ static void ME_UpdateTableFlags(ME_DisplayItem *para)
para->member.para.pFmt->wEffects &= ~PFE_TABLE; para->member.para.pFmt->wEffects &= ~PFE_TABLE;
} }
static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt)
{
PARAFORMAT2 copy;
assert(sizeof(*para->member.para.pFmt) == sizeof(PARAFORMAT2));
ME_AddUndoItem(editor, diUndoSetParagraphFormat, para);
copy = *para->member.para.pFmt;
#define COPY_FIELD(m, f) \
if (pFmt->dwMask & (m)) { \
para->member.para.pFmt->dwMask |= m; \
para->member.para.pFmt->f = pFmt->f; \
}
COPY_FIELD(PFM_NUMBERING, wNumbering);
#define EFFECTS_MASK (PFM_RTLPARA|PFM_KEEP|PFM_KEEPNEXT|PFM_PAGEBREAKBEFORE| \
PFM_NOLINENUMBER|PFM_NOWIDOWCONTROL|PFM_DONOTHYPHEN|PFM_SIDEBYSIDE| \
PFM_TABLE)
/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
if (pFmt->dwMask & EFFECTS_MASK) {
para->member.para.pFmt->dwMask |= pFmt->dwMask & EFFECTS_MASK;
para->member.para.pFmt->wEffects &= ~HIWORD(pFmt->dwMask);
para->member.para.pFmt->wEffects |= pFmt->wEffects & HIWORD(pFmt->dwMask);
}
#undef EFFECTS_MASK
COPY_FIELD(PFM_STARTINDENT, dxStartIndent);
if (pFmt->dwMask & PFM_OFFSETINDENT)
para->member.para.pFmt->dxStartIndent += pFmt->dxStartIndent;
COPY_FIELD(PFM_RIGHTINDENT, dxRightIndent);
COPY_FIELD(PFM_OFFSET, dxOffset);
COPY_FIELD(PFM_ALIGNMENT, wAlignment);
if (pFmt->dwMask & PFM_TABSTOPS)
{
para->member.para.pFmt->cTabCount = pFmt->cTabCount;
memcpy(para->member.para.pFmt->rgxTabs, pFmt->rgxTabs, pFmt->cTabCount*sizeof(LONG));
}
COPY_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
COPY_FIELD(PFM_SPACEAFTER, dySpaceAfter);
COPY_FIELD(PFM_LINESPACING, dyLineSpacing);
COPY_FIELD(PFM_STYLE, sStyle);
COPY_FIELD(PFM_LINESPACING, bLineSpacingRule);
COPY_FIELD(PFM_SHADING, wShadingWeight);
COPY_FIELD(PFM_SHADING, wShadingStyle);
COPY_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
COPY_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
COPY_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
COPY_FIELD(PFM_BORDER, wBorderSpace);
COPY_FIELD(PFM_BORDER, wBorderWidth);
COPY_FIELD(PFM_BORDER, wBorders);
para->member.para.pFmt->dwMask |= pFmt->dwMask;
#undef COPY_FIELD
if (memcmp(&copy, para->member.para.pFmt, sizeof(PARAFORMAT2)))
para->member.para.nFlags |= MEPF_REWRAP;
return TRUE;
}
/* split paragraph at the beginning of the run */ /* split paragraph at the beginning of the run */
ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
ME_Style *style, int numCR, int numLF, ME_Style *style, int numCR, int numLF,
...@@ -439,68 +500,6 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]) ...@@ -439,68 +500,6 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
#undef DUMP_EFFECT #undef DUMP_EFFECT
} }
BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt)
{
PARAFORMAT2 copy;
assert(sizeof(*para->member.para.pFmt) == sizeof(PARAFORMAT2));
ME_AddUndoItem(editor, diUndoSetParagraphFormat, para);
copy = *para->member.para.pFmt;
#define COPY_FIELD(m, f) \
if (pFmt->dwMask & (m)) { \
para->member.para.pFmt->dwMask |= m; \
para->member.para.pFmt->f = pFmt->f; \
}
COPY_FIELD(PFM_NUMBERING, wNumbering);
#define EFFECTS_MASK (PFM_RTLPARA|PFM_KEEP|PFM_KEEPNEXT|PFM_PAGEBREAKBEFORE| \
PFM_NOLINENUMBER|PFM_NOWIDOWCONTROL|PFM_DONOTHYPHEN|PFM_SIDEBYSIDE| \
PFM_TABLE)
/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
if (pFmt->dwMask & EFFECTS_MASK) {
para->member.para.pFmt->dwMask |= pFmt->dwMask & EFFECTS_MASK;
para->member.para.pFmt->wEffects &= ~HIWORD(pFmt->dwMask);
para->member.para.pFmt->wEffects |= pFmt->wEffects & HIWORD(pFmt->dwMask);
}
#undef EFFECTS_MASK
COPY_FIELD(PFM_STARTINDENT, dxStartIndent);
if (pFmt->dwMask & PFM_OFFSETINDENT)
para->member.para.pFmt->dxStartIndent += pFmt->dxStartIndent;
COPY_FIELD(PFM_RIGHTINDENT, dxRightIndent);
COPY_FIELD(PFM_OFFSET, dxOffset);
COPY_FIELD(PFM_ALIGNMENT, wAlignment);
if (pFmt->dwMask & PFM_TABSTOPS)
{
para->member.para.pFmt->cTabCount = pFmt->cTabCount;
memcpy(para->member.para.pFmt->rgxTabs, pFmt->rgxTabs, pFmt->cTabCount*sizeof(LONG));
}
COPY_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
COPY_FIELD(PFM_SPACEAFTER, dySpaceAfter);
COPY_FIELD(PFM_LINESPACING, dyLineSpacing);
COPY_FIELD(PFM_STYLE, sStyle);
COPY_FIELD(PFM_LINESPACING, bLineSpacingRule);
COPY_FIELD(PFM_SHADING, wShadingWeight);
COPY_FIELD(PFM_SHADING, wShadingStyle);
COPY_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
COPY_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
COPY_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
COPY_FIELD(PFM_BORDER, wBorderSpace);
COPY_FIELD(PFM_BORDER, wBorderWidth);
COPY_FIELD(PFM_BORDER, wBorders);
para->member.para.pFmt->dwMask |= pFmt->dwMask;
#undef COPY_FIELD
if (memcmp(&copy, para->member.para.pFmt, sizeof(PARAFORMAT2)))
para->member.para.nFlags |= MEPF_REWRAP;
return TRUE;
}
void void
ME_GetSelectionParas(ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayItem **para_end) ME_GetSelectionParas(ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayItem **para_end)
{ {
...@@ -541,7 +540,7 @@ BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt) ...@@ -541,7 +540,7 @@ BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt)
return TRUE; return TRUE;
} }
void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFORMAT2 *pFmt) static void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFORMAT2 *pFmt)
{ {
if (pFmt->cbSize >= sizeof(PARAFORMAT2)) if (pFmt->cbSize >= sizeof(PARAFORMAT2))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment