ReactOS 0.4.16-dev-981-g80eb313
editor.h File Reference
#include "editstr.h"
Include dependency graph for editor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RUN_IS_HIDDEN(run)
 
#define InitFormatEtc(fe, cf, med)
 
#define CP_UNICODE   1200
 
#define TXTHOST_VTABLE(This)   (This)->lpVtbl
 
#define ITextHost_TxGetDC(This)   TXTHOST_VTABLE(This)->TxGetDC(This)
 
#define ITextHost_TxReleaseDC(This, a)   TXTHOST_VTABLE(This)->TxReleaseDC(This,a)
 
#define ITextHost_TxShowScrollBar(This, a, b)   TXTHOST_VTABLE(This)->TxShowScrollBar(This,a,b)
 
#define ITextHost_TxEnableScrollBar(This, a, b)   TXTHOST_VTABLE(This)->TxEnableScrollBar(This,a,b)
 
#define ITextHost_TxSetScrollRange(This, a, b, c, d)   TXTHOST_VTABLE(This)->TxSetScrollRange(This,a,b,c,d)
 
#define ITextHost_TxSetScrollPos(This, a, b, c)   TXTHOST_VTABLE(This)->TxSetScrollPos(This,a,b,c)
 
#define ITextHost_TxInvalidateRect(This, a, b)   TXTHOST_VTABLE(This)->TxInvalidateRect(This,a,b)
 
#define ITextHost_TxViewChange(This, a)   TXTHOST_VTABLE(This)->TxViewChange(This,a)
 
#define ITextHost_TxCreateCaret(This, a, b, c)   TXTHOST_VTABLE(This)->TxCreateCaret(This,a,b,c)
 
#define ITextHost_TxShowCaret(This, a)   TXTHOST_VTABLE(This)->TxShowCaret(This,a)
 
#define ITextHost_TxSetCaretPos(This, a, b)   TXTHOST_VTABLE(This)->TxSetCaretPos(This,a,b)
 
#define ITextHost_TxSetTimer(This, a, b)   TXTHOST_VTABLE(This)->TxSetTimer(This,a,b)
 
#define ITextHost_TxKillTimer(This, a)   TXTHOST_VTABLE(This)->TxKillTimer(This,a)
 
#define ITextHost_TxScrollWindowEx(This, a, b, c, d, e, f, g)   TXTHOST_VTABLE(This)->TxScrollWindowEx(This,a,b,c,d,e,f,g)
 
#define ITextHost_TxSetCapture(This, a)   TXTHOST_VTABLE(This)->TxSetCapture(This,a)
 
#define ITextHost_TxSetFocus(This)   TXTHOST_VTABLE(This)->TxSetFocus(This)
 
#define ITextHost_TxSetCursor(This, a, b)   TXTHOST_VTABLE(This)->TxSetCursor(This,a,b)
 
#define ITextHost_TxScreenToClient(This, a)   TXTHOST_VTABLE(This)->TxScreenToClient(This,a)
 
#define ITextHost_TxClientToScreen(This, a)   TXTHOST_VTABLE(This)->TxClientToScreen(This,a)
 
#define ITextHost_TxActivate(This, a)   TXTHOST_VTABLE(This)->TxActivate(This,a)
 
#define ITextHost_TxDeactivate(This, a)   TXTHOST_VTABLE(This)->TxDeactivate(This,a)
 
#define ITextHost_TxGetClientRect(This, a)   TXTHOST_VTABLE(This)->TxGetClientRect(This,a)
 
#define ITextHost_TxGetViewInset(This, a)   TXTHOST_VTABLE(This)->TxGetViewInset(This,a)
 
#define ITextHost_TxGetCharFormat(This, a)   TXTHOST_VTABLE(This)->TxGetCharFormat(This,a)
 
#define ITextHost_TxGetParaFormat(This, a)   TXTHOST_VTABLE(This)->TxGetParaFormat(This,a)
 
#define ITextHost_TxGetSysColor(This, a)   TXTHOST_VTABLE(This)->TxGetSysColor(This,a)
 
#define ITextHost_TxGetBackStyle(This, a)   TXTHOST_VTABLE(This)->TxGetBackStyle(This,a)
 
#define ITextHost_TxGetMaxLength(This, a)   TXTHOST_VTABLE(This)->TxGetMaxLength(This,a)
 
#define ITextHost_TxGetScrollBars(This, a)   TXTHOST_VTABLE(This)->TxGetScrollBars(This,a)
 
#define ITextHost_TxGetPasswordChar(This, a)   TXTHOST_VTABLE(This)->TxGetPasswordChar(This,a)
 
#define ITextHost_TxGetAcceleratorPos(This, a)   TXTHOST_VTABLE(This)->TxGetAcceleratorPos(This,a)
 
#define ITextHost_TxGetExtent(This, a)   TXTHOST_VTABLE(This)->TxGetExtent(This,a)
 
#define ITextHost_OnTxCharFormatChange(This, a)   TXTHOST_VTABLE(This)->OnTxCharFormatChange(This,a)
 
#define ITextHost_OnTxParaFormatChange(This, a)   TXTHOST_VTABLE(This)->OnTxParaFormatChange(This,a)
 
#define ITextHost_TxGetPropertyBits(This, a, b)   TXTHOST_VTABLE(This)->TxGetPropertyBits(This,a,b)
 
#define ITextHost_TxNotify(This, a, b)   TXTHOST_VTABLE(This)->TxNotify(This,a,b)
 
#define ITextHost_TxImmGetContext(This)   TXTHOST_VTABLE(This)->TxImmGetContext(This)
 
#define ITextHost_TxImmReleaseContext(This, a)   TXTHOST_VTABLE(This)->TxImmReleaseContext(This,a)
 
#define ITextHost_TxGetSelectionBarWidth(This, a)   TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)
 
#define ITextHost2_TxIsDoubleClickPending(This)   TXTHOST_VTABLE(This)->TxIsDoubleClickPending(This)
 
#define ITextHost2_TxGetWindow(This, a)   TXTHOST_VTABLE(This)->TxGetWindow(This,a)
 
#define ITextHost2_TxSetForegroundWindow(This)   TXTHOST_VTABLE(This)->TxSetForegroundWindow(This)
 
#define ITextHost2_TxGetPalette(This)   TXTHOST_VTABLE(This)->TxGetPalette(This)
 
#define ITextHost2_TxGetEastAsianFlags(This, a)   TXTHOST_VTABLE(This)->TxGetEastAsianFlags(This,a)
 
#define ITextHost2_TxSetCursor2(This, a, b)   TXTHOST_VTABLE(This)->TxSetCursor2(This,a,b)
 
#define ITextHost2_TxFreeTextServicesNotification(This)   TXTHOST_VTABLE(This)->TxFreeTextServicesNotification(This)
 
#define ITextHost2_TxGetEditStyle(This, a, b)   TXTHOST_VTABLE(This)->TxGetEditStyle(This,a,b)
 
#define ITextHost2_TxGetWindowStyles(This, a, b)   TXTHOST_VTABLE(This)->TxGetWindowStyles(This,a,b)
 
#define ITextHost2_TxShowDropCaret(This, a, b, c)   TXTHOST_VTABLE(This)->TxShowDropCaret(This,a,b,c)
 
#define ITextHost2_TxDestroyCaret(This)   TXTHOST_VTABLE(This)->TxDestroyCaret(This)
 
#define ITextHost2_TxGetHorzExtent(This, a)   TXTHOST_VTABLE(This)->TxGetHorzExtent(This,a)
 
#define TXTSERV_VTABLE(This)   (This)->lpVtbl
 
#define ITextServices_TxSendMessage(This, a, b, c, d)   TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)
 
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)   TXTSERV_VTABLE(This)->TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l)
 
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)
 
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)
 
#define ITextServices_OnTxSetCursor(This, a, b, c, d, e, f, g, h, i)   TXTSERV_VTABLE(This)->OnTxSetCursor(This,a,b,c,d,e,f,g,h,i)
 
#define ITextServices_TxQueryHitPoint(This, a, b, c, d, e, f, g, h, i, j)   TXTSERV_VTABLE(This)->TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j)
 
#define ITextServices_OnTxInPlaceActivate(This, a)   TXTSERV_VTABLE(This)->OnTxInPlaceActivate(This,a)
 
#define ITextServices_OnTxInPlaceDeactivate(This)   TXTSERV_VTABLE(This)->OnTxInPlaceDeactivate(This)
 
#define ITextServices_OnTxUIActivate(This)   TXTSERV_VTABLE(This)->OnTxUIActivate(This)
 
#define ITextServices_OnTxUIDeactivate(This)   TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)
 
#define ITextServices_TxGetText(This, a)   TXTSERV_VTABLE(This)->TxGetText(This,a)
 
#define ITextServices_TxSetText(This, a)   TXTSERV_VTABLE(This)->TxSetText(This,a)
 
#define ITextServices_TxGetCurTargetX(This, a)   TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)
 
#define ITextServices_TxGetBaseLinePos(This, a)   TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)
 
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)   TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h)
 
#define ITextServices_TxGetDropTarget(This, a)   TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)
 
#define ITextServices_OnTxPropertyBitsChange(This, a, b)   TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)
 
#define ITextServices_TxGetCachedSize(This, a, b)   TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)
 

Functions

static WCHARget_text (const ME_Run *run, int offset)
 
static const chardebugstr_run (const ME_Run *run)
 
ME_Stylestyle_get_insert_style (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_StyleME_MakeStyle (CHARFORMAT2W *style) DECLSPEC_HIDDEN
 
void ME_AddRefStyle (ME_Style *item) DECLSPEC_HIDDEN
 
void ME_DestroyStyle (ME_Style *item) DECLSPEC_HIDDEN
 
void ME_ReleaseStyle (ME_Style *item) DECLSPEC_HIDDEN
 
ME_StyleME_ApplyStyle (ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN
 
void select_style (ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN
 
void ME_InitCharFormat2W (CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SaveTempStyle (ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN
 
void ME_ClearTempStyle (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_DumpStyleToBuf (CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN
 
void ME_DumpStyle (ME_Style *s) DECLSPEC_HIDDEN
 
BOOL cfany_to_cf2w (CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
 
BOOL cf2w_to_cfany (CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
 
void ME_CopyCharFormat (CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN
 
void ME_CharFormatFromLogFont (HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
 
void ME_InsertBefore (ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN
 
void ME_Remove (ME_DisplayItem *diWhere) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemBack (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemFwd (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemBackOrHere (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_MakeDI (ME_DIType type) DECLSPEC_HIDDEN
 
void ME_DestroyDisplayItem (ME_DisplayItem *item) DECLSPEC_HIDDEN
 
void ME_DumpDocument (ME_TextBuffer *buffer) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringN (LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringR (WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringConst (const WCHAR *str, int len) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringEmpty (int len) DECLSPEC_HIDDEN
 
void ME_DestroyString (ME_String *s) DECLSPEC_HIDDEN
 
BOOL ME_AppendString (ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN
 
ME_StringME_VSplitString (ME_String *orig, int nVPos) DECLSPEC_HIDDEN
 
int ME_FindNonWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
int ME_CallWordBreakProc (ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) DECLSPEC_HIDDEN
 
void ME_StrDeleteV (ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN
 
BOOL ME_InsertString (ME_String *s, int ofs, const WCHAR *insert, int len) DECLSPEC_HIDDEN
 
LPWSTR ME_ToUnicode (LONG codepage, LPVOID psz, INT *len) DECLSPEC_HIDDEN
 
void ME_EndToUnicode (LONG codepage, LPVOID psz) DECLSPEC_HIDDEN
 
static int ME_IsWSpace (WCHAR ch)
 
static int ME_CharCompare (WCHAR a, WCHAR b, int caseSensitive)
 
int ME_ReverseFindNonWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
int ME_ReverseFindWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
void row_end_cursor (ME_Row *row, ME_Cursor *cursor, BOOL include_eop) DECLSPEC_HIDDEN
 
void row_first_cursor (ME_Row *row, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_Runrow_first_run (ME_Row *row) DECLSPEC_HIDDEN
 
ME_Rowrow_from_cursor (ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_Rowrow_from_row_number (ME_TextEditor *editor, int row_num) DECLSPEC_HIDDEN
 
ME_Rowrow_next (ME_Row *row) DECLSPEC_HIDDEN
 
ME_Rowrow_next_all_paras (ME_Row *row) DECLSPEC_HIDDEN
 
ME_Runrow_next_run (ME_Row *row, ME_Run *run) DECLSPEC_HIDDEN
 
int row_number_from_char_ofs (ME_TextEditor *editor, int ofs) DECLSPEC_HIDDEN
 
ME_Paragraphrow_para (ME_Row *row) DECLSPEC_HIDDEN
 
ME_Rowrow_prev_all_paras (ME_Row *row) DECLSPEC_HIDDEN
 
static ME_DisplayItemrow_get_di (ME_Row *row)
 
void cursor_from_char_ofs (ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
BOOL cursor_next_run (ME_Cursor *cursor, BOOL all_para) DECLSPEC_HIDDEN
 
BOOL cursor_prev_run (ME_Cursor *cursor, BOOL all_para) DECLSPEC_HIDDEN
 
void editor_propagate_char_ofs (ME_Paragraph *para, ME_Run *run, int shift) DECLSPEC_HIDDEN
 
int run_char_ofs (ME_Run *run, int ofs) DECLSPEC_HIDDEN
 
ME_Runrun_create (ME_Style *s, int nFlags) DECLSPEC_HIDDEN
 
ME_Runrun_insert (ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags) DECLSPEC_HIDDEN
 
void ME_CheckCharOffsets (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
int ME_CharFromPointContext (ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_CharFromPoint (ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_PointFromCharContext (ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_PointFromChar (ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
 
BOOL ME_CanJoinRuns (const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN
 
void run_join (ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN
 
ME_Runrun_next (ME_Run *run) DECLSPEC_HIDDEN
 
ME_Runrun_next_all_paras (ME_Run *run) DECLSPEC_HIDDEN
 
ME_Runrun_prev (ME_Run *run) DECLSPEC_HIDDEN
 
ME_Runrun_prev_all_paras (ME_Run *run) DECLSPEC_HIDDEN
 
ME_Runrun_split (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
void ME_UpdateRunFlags (ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN
 
SIZE ME_GetRunSizeCommon (ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx, int *pAscent, int *pDescent) DECLSPEC_HIDDEN
 
void ME_SetCharFormat (ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SetSelectionCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetCharFormat (ME_TextEditor *editor, const ME_Cursor *from, const ME_Cursor *to, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetSelectionCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetDefaultCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SetDefaultCharFormat (ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN
 
static ME_DisplayItemrun_get_di (ME_Run *run)
 
void cursor_coords (ME_TextEditor *editor, ME_Cursor *cursor, int *x, int *y, int *height) DECLSPEC_HIDDEN
 
void ME_SetCursorToStart (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
int set_selection_cursors (ME_TextEditor *editor, int from, int to) DECLSPEC_HIDDEN
 
BOOL ME_MoveCursorWords (ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) DECLSPEC_HIDDEN
 
void hide_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void show_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void update_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void create_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
BOOL ME_CharFromPos (ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact) DECLSPEC_HIDDEN
 
void ME_LButtonDown (ME_TextEditor *editor, int x, int y, int clickNum) DECLSPEC_HIDDEN
 
void ME_MouseMove (ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN
 
BOOL ME_DeleteTextAtCursor (ME_TextEditor *editor, int nCursor, int nChars) DECLSPEC_HIDDEN
 
void ME_InsertTextFromCursor (ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style) DECLSPEC_HIDDEN
 
void ME_InsertEndRowFromCursor (ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN
 
int ME_MoveCursorChars (ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop) DECLSPEC_HIDDEN
 
BOOL ME_ArrowKey (ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl) DECLSPEC_HIDDEN
 
int ME_GetCursorOfs (const ME_Cursor *cursor) DECLSPEC_HIDDEN
 
int ME_GetSelectionOfs (ME_TextEditor *editor, int *from, int *to) DECLSPEC_HIDDEN
 
int ME_GetSelection (ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DECLSPEC_HIDDEN
 
BOOL ME_IsSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_DeleteSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_SendSelChange (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InsertOLEFromCursor (ME_TextEditor *editor, const REOBJECT *reo, int nCursor) DECLSPEC_HIDDEN
 
BOOL ME_InternalDeleteText (ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN
 
int ME_GetTextLength (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
int ME_GetTextLengthEx (ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN
 
ME_StyleME_GetSelectionInsertStyle (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InitContext (ME_Context *c, ME_TextEditor *editor, HDC hDC) DECLSPEC_HIDDEN
 
void ME_DestroyContext (ME_Context *c) DECLSPEC_HIDDEN
 
BOOL ME_WrapMarkedParagraphs (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void para_range_invalidate (ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para) DECLSPEC_HIDDEN
 
void ME_SendRequestResize (ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN
 
BOOL wrap_marked_paras_dc (ME_TextEditor *editor, HDC hdc, BOOL invalidate) DECLSPEC_HIDDEN
 
void editor_get_selection_paras (ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end) DECLSPEC_HIDDEN
 
void editor_get_selection_para_fmt (ME_TextEditor *editor, PARAFORMAT2 *fmt) DECLSPEC_HIDDEN
 
void editor_mark_rewrap_all (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void editor_set_default_para_fmt (ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
 
BOOL editor_set_selection_para_fmt (ME_TextEditor *editor, const PARAFORMAT2 *fmt) DECLSPEC_HIDDEN
 
void ME_MakeFirstParagraph (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_DumpParaStyle (ME_Paragraph *s) DECLSPEC_HIDDEN
 
void ME_DumpParaStyleToBuf (const PARAFORMAT2 *pFmt, char buf[2048]) DECLSPEC_HIDDEN
 
int get_total_width (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_Cellpara_cell (ME_Paragraph *para) DECLSPEC_HIDDEN
 
void para_destroy (ME_TextEditor *editor, ME_Paragraph *item) DECLSPEC_HIDDEN
 
ME_Rowpara_end_row (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Runpara_end_run (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Rowpara_first_row (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Runpara_first_run (ME_Paragraph *para) DECLSPEC_HIDDEN
 
BOOL para_in_table (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Paragraphpara_join (ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt) DECLSPEC_HIDDEN
 
void para_mark_add (ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
 
void para_mark_remove (ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
 
void para_mark_rewrap (ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Paragraphpara_next (ME_Paragraph *para) DECLSPEC_HIDDEN
 
void para_num_clear (struct para_num *pn) DECLSPEC_HIDDEN
 
void para_num_init (ME_Context *c, ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Paragraphpara_prev (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Paragraphpara_split (ME_TextEditor *editor, ME_Run *run, ME_Style *style, const WCHAR *eol_str, int eol_len, int paraFlags) DECLSPEC_HIDDEN
 
static ME_DisplayItempara_get_di (ME_Paragraph *para)
 
void editor_draw (ME_TextEditor *editor, HDC hDC, const RECT *update) DECLSPEC_HIDDEN
 
void ME_Repaint (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_RewrapRepaint (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_UpdateRepaint (ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN
 
void editor_ensure_visible (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
void ME_InvalidateSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_SetZoom (ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN
 
int ME_twips2pointsX (const ME_Context *c, int x) DECLSPEC_HIDDEN
 
int ME_twips2pointsY (const ME_Context *c, int y) DECLSPEC_HIDDEN
 
void scroll_abs (ME_TextEditor *editor, int x, int y, BOOL notify) DECLSPEC_HIDDEN
 
void scroll_h_abs (ME_TextEditor *editor, int x, BOOL notify) DECLSPEC_HIDDEN
 
void scroll_v_abs (ME_TextEditor *editor, int y, BOOL notify) DECLSPEC_HIDDEN
 
void ME_ScrollUp (ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
 
void ME_ScrollDown (ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
 
void ME_ScrollLeft (ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
 
void ME_ScrollRight (ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
 
void ME_UpdateScrollBar (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
int ME_GetParaBorderWidth (const ME_Context *c, int flags) DECLSPEC_HIDDEN
 
void draw_ole (ME_Context *c, int x, int y, ME_Run *run, BOOL selected) DECLSPEC_HIDDEN
 
void ME_GetOLEObjectSize (const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN
 
void ME_CopyReObject (REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN
 
void ME_DeleteReObject (struct re_object *re_object) DECLSPEC_HIDDEN
 
void richole_release_children (struct text_services *services) DECLSPEC_HIDDEN
 
ME_TextEditorME_MakeEditor (ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN
 
void ME_DestroyEditor (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
LRESULT editor_handle_message (ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam, HRESULT *phresult) DECLSPEC_HIDDEN
 
int ME_GetTextW (ME_TextEditor *editor, WCHAR *buffer, int buflen, const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP) DECLSPEC_HIDDEN
 
void ME_RTFCharAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFParAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFTblAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFSpecialCharHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_StreamInFill (ME_InStream *stream) DECLSPEC_HIDDEN
 
void ME_ReplaceSel (ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len) DECLSPEC_HIDDEN
 
int set_selection (ME_TextEditor *editor, int to, int from) DECLSPEC_HIDDEN
 
HRESULT editor_copy_or_cut (ME_TextEditor *editor, BOOL cut, ME_Cursor *start, int count, IDataObject **data_out) DECLSPEC_HIDDEN
 
ME_Paragrapheditor_end_para (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_Paragrapheditor_first_para (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void editor_set_cursor (ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN
 
void link_notify (ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN
 
ME_Cellcell_create (void) DECLSPEC_HIDDEN
 
ME_Paragraphcell_end_para (ME_Cell *cell) DECLSPEC_HIDDEN
 
ME_Paragraphcell_first_para (ME_Cell *cell) DECLSPEC_HIDDEN
 
ME_Cellcell_next (ME_Cell *cell) DECLSPEC_HIDDEN
 
ME_Cellcell_prev (ME_Cell *cell) DECLSPEC_HIDDEN
 
ME_Paragraphtable_append_row (ME_TextEditor *editor, ME_Paragraph *table_row) DECLSPEC_HIDDEN
 
void table_handle_tab (ME_TextEditor *editor, BOOL selected_row) DECLSPEC_HIDDEN
 
ME_Paragraphtable_insert_cell (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_Paragraphtable_insert_row_end (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_Paragraphtable_insert_row_start (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
ME_Paragraphtable_insert_row_start_at_para (ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
 
void table_move_from_row_start (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_Paragraphtable_outer_para (ME_Paragraph *para) DECLSPEC_HIDDEN
 
void table_protect_partial_deletion (ME_TextEditor *editor, ME_Cursor *c, int *num_chars) DECLSPEC_HIDDEN
 
ME_Paragraphtable_row_end (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Celltable_row_end_cell (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Celltable_row_first_cell (ME_Paragraph *para) DECLSPEC_HIDDEN
 
ME_Paragraphtable_row_start (ME_Paragraph *para) DECLSPEC_HIDDEN
 
struct RTFTableME_MakeTableDef (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InitTableDef (ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN
 
static ME_DisplayItemcell_get_di (ME_Cell *cell)
 
BOOL add_undo_insert_run (ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style) DECLSPEC_HIDDEN
 
BOOL add_undo_delete_run (ME_TextEditor *, int pos, int len) DECLSPEC_HIDDEN
 
BOOL add_undo_set_para_fmt (ME_TextEditor *, const ME_Paragraph *para) DECLSPEC_HIDDEN
 
BOOL add_undo_set_char_fmt (ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
 
BOOL add_undo_join_paras (ME_TextEditor *, int pos) DECLSPEC_HIDDEN
 
BOOL add_undo_split_para (ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell) DECLSPEC_HIDDEN
 
void ME_CommitUndo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_ContinueCoalescingTransaction (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_CommitCoalescingUndo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_Undo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_Redo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_EmptyUndoStack (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
HRESULT create_text_services (IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10) DECLSPEC_HIDDEN
 
LRESULT ME_StreamOutRange (ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream) DECLSPEC_HIDDEN
 
LRESULT ME_StreamOut (ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) DECLSPEC_HIDDEN
 
HRESULT ME_GetDataObject (ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj) DECLSPEC_HIDDEN
 
void release_typelib (void) DECLSPEC_HIDDEN
 

Variables

HINSTANCE dll_instance DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ CP_UNICODE

#define CP_UNICODE   1200

Definition at line 93 of file editor.h.

◆ InitFormatEtc

#define InitFormatEtc (   fe,
  cf,
  med 
)
Value:
{\
(fe).cfFormat=cf;\
(fe).dwAspect=DVASPECT_CONTENT;\
(fe).ptd=NULL;\
(fe).tymed=med;\
(fe).lindex=-1;\
};
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition: cvt.cpp:355
#define NULL
Definition: types.h:112
static DWORD tymed
Definition: url.c:174

Definition at line 33 of file editor.h.

◆ ITextHost2_TxDestroyCaret

#define ITextHost2_TxDestroyCaret (   This)    TXTHOST_VTABLE(This)->TxDestroyCaret(This)

Definition at line 383 of file editor.h.

◆ ITextHost2_TxFreeTextServicesNotification

#define ITextHost2_TxFreeTextServicesNotification (   This)    TXTHOST_VTABLE(This)->TxFreeTextServicesNotification(This)

Definition at line 379 of file editor.h.

◆ ITextHost2_TxGetEastAsianFlags

#define ITextHost2_TxGetEastAsianFlags (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetEastAsianFlags(This,a)

Definition at line 377 of file editor.h.

◆ ITextHost2_TxGetEditStyle

#define ITextHost2_TxGetEditStyle (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxGetEditStyle(This,a,b)

Definition at line 380 of file editor.h.

◆ ITextHost2_TxGetHorzExtent

#define ITextHost2_TxGetHorzExtent (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetHorzExtent(This,a)

Definition at line 384 of file editor.h.

◆ ITextHost2_TxGetPalette

#define ITextHost2_TxGetPalette (   This)    TXTHOST_VTABLE(This)->TxGetPalette(This)

Definition at line 376 of file editor.h.

◆ ITextHost2_TxGetWindow

#define ITextHost2_TxGetWindow (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetWindow(This,a)

Definition at line 374 of file editor.h.

◆ ITextHost2_TxGetWindowStyles

#define ITextHost2_TxGetWindowStyles (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxGetWindowStyles(This,a,b)

Definition at line 381 of file editor.h.

◆ ITextHost2_TxIsDoubleClickPending

#define ITextHost2_TxIsDoubleClickPending (   This)    TXTHOST_VTABLE(This)->TxIsDoubleClickPending(This)

Definition at line 373 of file editor.h.

◆ ITextHost2_TxSetCursor2

#define ITextHost2_TxSetCursor2 (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetCursor2(This,a,b)

Definition at line 378 of file editor.h.

◆ ITextHost2_TxSetForegroundWindow

#define ITextHost2_TxSetForegroundWindow (   This)    TXTHOST_VTABLE(This)->TxSetForegroundWindow(This)

Definition at line 375 of file editor.h.

◆ ITextHost2_TxShowDropCaret

#define ITextHost2_TxShowDropCaret (   This,
  a,
  b,
  c 
)    TXTHOST_VTABLE(This)->TxShowDropCaret(This,a,b,c)

Definition at line 382 of file editor.h.

◆ ITextHost_OnTxCharFormatChange

#define ITextHost_OnTxCharFormatChange (   This,
  a 
)    TXTHOST_VTABLE(This)->OnTxCharFormatChange(This,a)

Definition at line 365 of file editor.h.

◆ ITextHost_OnTxParaFormatChange

#define ITextHost_OnTxParaFormatChange (   This,
  a 
)    TXTHOST_VTABLE(This)->OnTxParaFormatChange(This,a)

Definition at line 366 of file editor.h.

◆ ITextHost_TxActivate

#define ITextHost_TxActivate (   This,
  a 
)    TXTHOST_VTABLE(This)->TxActivate(This,a)

Definition at line 352 of file editor.h.

◆ ITextHost_TxClientToScreen

#define ITextHost_TxClientToScreen (   This,
  a 
)    TXTHOST_VTABLE(This)->TxClientToScreen(This,a)

Definition at line 351 of file editor.h.

◆ ITextHost_TxCreateCaret

#define ITextHost_TxCreateCaret (   This,
  a,
  b,
  c 
)    TXTHOST_VTABLE(This)->TxCreateCaret(This,a,b,c)

Definition at line 341 of file editor.h.

◆ ITextHost_TxDeactivate

#define ITextHost_TxDeactivate (   This,
  a 
)    TXTHOST_VTABLE(This)->TxDeactivate(This,a)

Definition at line 353 of file editor.h.

◆ ITextHost_TxEnableScrollBar

#define ITextHost_TxEnableScrollBar (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxEnableScrollBar(This,a,b)

Definition at line 336 of file editor.h.

◆ ITextHost_TxGetAcceleratorPos

#define ITextHost_TxGetAcceleratorPos (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetAcceleratorPos(This,a)

Definition at line 363 of file editor.h.

◆ ITextHost_TxGetBackStyle

#define ITextHost_TxGetBackStyle (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetBackStyle(This,a)

Definition at line 359 of file editor.h.

◆ ITextHost_TxGetCharFormat

#define ITextHost_TxGetCharFormat (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetCharFormat(This,a)

Definition at line 356 of file editor.h.

◆ ITextHost_TxGetClientRect

#define ITextHost_TxGetClientRect (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetClientRect(This,a)

Definition at line 354 of file editor.h.

◆ ITextHost_TxGetDC

#define ITextHost_TxGetDC (   This)    TXTHOST_VTABLE(This)->TxGetDC(This)

Definition at line 333 of file editor.h.

◆ ITextHost_TxGetExtent

#define ITextHost_TxGetExtent (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetExtent(This,a)

Definition at line 364 of file editor.h.

◆ ITextHost_TxGetMaxLength

#define ITextHost_TxGetMaxLength (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetMaxLength(This,a)

Definition at line 360 of file editor.h.

◆ ITextHost_TxGetParaFormat

#define ITextHost_TxGetParaFormat (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetParaFormat(This,a)

Definition at line 357 of file editor.h.

◆ ITextHost_TxGetPasswordChar

#define ITextHost_TxGetPasswordChar (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetPasswordChar(This,a)

Definition at line 362 of file editor.h.

◆ ITextHost_TxGetPropertyBits

#define ITextHost_TxGetPropertyBits (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxGetPropertyBits(This,a,b)

Definition at line 367 of file editor.h.

◆ ITextHost_TxGetScrollBars

#define ITextHost_TxGetScrollBars (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetScrollBars(This,a)

Definition at line 361 of file editor.h.

◆ ITextHost_TxGetSelectionBarWidth

#define ITextHost_TxGetSelectionBarWidth (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)

Definition at line 371 of file editor.h.

◆ ITextHost_TxGetSysColor

#define ITextHost_TxGetSysColor (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetSysColor(This,a)

Definition at line 358 of file editor.h.

◆ ITextHost_TxGetViewInset

#define ITextHost_TxGetViewInset (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetViewInset(This,a)

Definition at line 355 of file editor.h.

◆ ITextHost_TxImmGetContext

#define ITextHost_TxImmGetContext (   This)    TXTHOST_VTABLE(This)->TxImmGetContext(This)

Definition at line 369 of file editor.h.

◆ ITextHost_TxImmReleaseContext

#define ITextHost_TxImmReleaseContext (   This,
  a 
)    TXTHOST_VTABLE(This)->TxImmReleaseContext(This,a)

Definition at line 370 of file editor.h.

◆ ITextHost_TxInvalidateRect

#define ITextHost_TxInvalidateRect (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxInvalidateRect(This,a,b)

Definition at line 339 of file editor.h.

◆ ITextHost_TxKillTimer

#define ITextHost_TxKillTimer (   This,
  a 
)    TXTHOST_VTABLE(This)->TxKillTimer(This,a)

Definition at line 345 of file editor.h.

◆ ITextHost_TxNotify

#define ITextHost_TxNotify (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxNotify(This,a,b)

Definition at line 368 of file editor.h.

◆ ITextHost_TxReleaseDC

#define ITextHost_TxReleaseDC (   This,
  a 
)    TXTHOST_VTABLE(This)->TxReleaseDC(This,a)

Definition at line 334 of file editor.h.

◆ ITextHost_TxScreenToClient

#define ITextHost_TxScreenToClient (   This,
  a 
)    TXTHOST_VTABLE(This)->TxScreenToClient(This,a)

Definition at line 350 of file editor.h.

◆ ITextHost_TxScrollWindowEx

#define ITextHost_TxScrollWindowEx (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g 
)    TXTHOST_VTABLE(This)->TxScrollWindowEx(This,a,b,c,d,e,f,g)

Definition at line 346 of file editor.h.

◆ ITextHost_TxSetCapture

#define ITextHost_TxSetCapture (   This,
  a 
)    TXTHOST_VTABLE(This)->TxSetCapture(This,a)

Definition at line 347 of file editor.h.

◆ ITextHost_TxSetCaretPos

#define ITextHost_TxSetCaretPos (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetCaretPos(This,a,b)

Definition at line 343 of file editor.h.

◆ ITextHost_TxSetCursor

#define ITextHost_TxSetCursor (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetCursor(This,a,b)

Definition at line 349 of file editor.h.

◆ ITextHost_TxSetFocus

#define ITextHost_TxSetFocus (   This)    TXTHOST_VTABLE(This)->TxSetFocus(This)

Definition at line 348 of file editor.h.

◆ ITextHost_TxSetScrollPos

#define ITextHost_TxSetScrollPos (   This,
  a,
  b,
  c 
)    TXTHOST_VTABLE(This)->TxSetScrollPos(This,a,b,c)

Definition at line 338 of file editor.h.

◆ ITextHost_TxSetScrollRange

#define ITextHost_TxSetScrollRange (   This,
  a,
  b,
  c,
  d 
)    TXTHOST_VTABLE(This)->TxSetScrollRange(This,a,b,c,d)

Definition at line 337 of file editor.h.

◆ ITextHost_TxSetTimer

#define ITextHost_TxSetTimer (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetTimer(This,a,b)

Definition at line 344 of file editor.h.

◆ ITextHost_TxShowCaret

#define ITextHost_TxShowCaret (   This,
  a 
)    TXTHOST_VTABLE(This)->TxShowCaret(This,a)

Definition at line 342 of file editor.h.

◆ ITextHost_TxShowScrollBar

#define ITextHost_TxShowScrollBar (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxShowScrollBar(This,a,b)

Definition at line 335 of file editor.h.

◆ ITextHost_TxViewChange

#define ITextHost_TxViewChange (   This,
  a 
)    TXTHOST_VTABLE(This)->TxViewChange(This,a)

Definition at line 340 of file editor.h.

◆ ITextServices_OnTxInPlaceActivate

#define ITextServices_OnTxInPlaceActivate (   This,
  a 
)    TXTSERV_VTABLE(This)->OnTxInPlaceActivate(This,a)

Definition at line 414 of file editor.h.

◆ ITextServices_OnTxInPlaceDeactivate

#define ITextServices_OnTxInPlaceDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxInPlaceDeactivate(This)

Definition at line 415 of file editor.h.

◆ ITextServices_OnTxPropertyBitsChange

#define ITextServices_OnTxPropertyBitsChange (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)

Definition at line 424 of file editor.h.

◆ ITextServices_OnTxSetCursor

#define ITextServices_OnTxSetCursor (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    TXTSERV_VTABLE(This)->OnTxSetCursor(This,a,b,c,d,e,f,g,h,i)

Definition at line 412 of file editor.h.

◆ ITextServices_OnTxUIActivate

#define ITextServices_OnTxUIActivate (   This)    TXTSERV_VTABLE(This)->OnTxUIActivate(This)

Definition at line 416 of file editor.h.

◆ ITextServices_OnTxUIDeactivate

#define ITextServices_OnTxUIDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)

Definition at line 417 of file editor.h.

◆ ITextServices_TxDraw

#define ITextServices_TxDraw (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l 
)    TXTSERV_VTABLE(This)->TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l)

Definition at line 409 of file editor.h.

◆ ITextServices_TxGetBaseLinePos

#define ITextServices_TxGetBaseLinePos (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)

Definition at line 421 of file editor.h.

◆ ITextServices_TxGetCachedSize

#define ITextServices_TxGetCachedSize (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)

Definition at line 425 of file editor.h.

◆ ITextServices_TxGetCurTargetX

#define ITextServices_TxGetCurTargetX (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)

Definition at line 420 of file editor.h.

◆ ITextServices_TxGetDropTarget

#define ITextServices_TxGetDropTarget (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)

Definition at line 423 of file editor.h.

◆ ITextServices_TxGetHScroll

#define ITextServices_TxGetHScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)

Definition at line 410 of file editor.h.

◆ ITextServices_TxGetNaturalSize

#define ITextServices_TxGetNaturalSize (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h)

Definition at line 422 of file editor.h.

◆ ITextServices_TxGetText

#define ITextServices_TxGetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetText(This,a)

Definition at line 418 of file editor.h.

◆ ITextServices_TxGetVScroll

#define ITextServices_TxGetVScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)

Definition at line 411 of file editor.h.

◆ ITextServices_TxQueryHitPoint

#define ITextServices_TxQueryHitPoint (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j 
)    TXTSERV_VTABLE(This)->TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j)

Definition at line 413 of file editor.h.

◆ ITextServices_TxSendMessage

#define ITextServices_TxSendMessage (   This,
  a,
  b,
  c,
  d 
)    TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)

Definition at line 408 of file editor.h.

◆ ITextServices_TxSetText

#define ITextServices_TxSetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxSetText(This,a)

Definition at line 419 of file editor.h.

◆ RUN_IS_HIDDEN

#define RUN_IS_HIDDEN (   run)
Value:
((run)->style->fmt.dwMask & CFM_HIDDEN \
&& (run)->style->fmt.dwEffects & CFE_HIDDEN)
Arabic default style
Definition: afstyles.h:94
#define CFE_HIDDEN
Definition: richedit.h:418
#define CFM_HIDDEN
Definition: richedit.h:340

Definition at line 30 of file editor.h.

◆ TXTHOST_VTABLE

#define TXTHOST_VTABLE (   This)    (This)->lpVtbl

Definition at line 330 of file editor.h.

◆ TXTSERV_VTABLE

#define TXTSERV_VTABLE (   This)    (This)->lpVtbl

Definition at line 406 of file editor.h.

Function Documentation

◆ add_undo_delete_run()

BOOL add_undo_delete_run ( ME_TextEditor editor,
int  pos,
int  len 
)

Definition at line 204 of file undo.c.

205{
206 struct undo_item *undo = add_undo( editor, undo_delete_run );
207 if (!undo) return FALSE;
208
209 undo->u.delete_run.pos = pos;
210 undo->u.delete_run.len = len;
211
212 return TRUE;
213}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ undo_delete_run
Definition: editstr.h:289
GLenum GLsizei len
Definition: glext.h:6722
struct delete_run_item delete_run
Definition: editstr.h:347
union undo_item::@561 u
static struct undo_item * add_undo(ME_TextEditor *editor, enum undo_type type)
Definition: undo.c:72

Referenced by run_insert().

◆ add_undo_insert_run()

BOOL add_undo_insert_run ( ME_TextEditor editor,
int  pos,
const WCHAR str,
int  len,
int  flags,
ME_Style style 
)

Definition at line 131 of file undo.c.

132{
133 struct undo_item *undo = add_undo( editor, undo_insert_run );
134 if (!undo) return FALSE;
135
136 undo->u.insert_run.str = heap_alloc( (len + 1) * sizeof(WCHAR) );
137 if (!undo->u.insert_run.str)
138 {
139 ME_EmptyUndoStack( editor );
140 return FALSE;
141 }
142 memcpy( undo->u.insert_run.str, str, len * sizeof(WCHAR) );
143 undo->u.insert_run.str[len] = 0;
144 undo->u.insert_run.pos = pos;
145 undo->u.insert_run.len = len;
146 undo->u.insert_run.flags = flags;
147 undo->u.insert_run.style = style;
149 return TRUE;
150}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:454
@ undo_insert_run
Definition: editstr.h:288
GLbitfield flags
Definition: glext.h:7161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const WCHAR * str
struct insert_run_item insert_run
Definition: editstr.h:346
void ME_EmptyUndoStack(ME_TextEditor *editor)
Definition: undo.c:53
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ME_InternalDeleteText().

◆ add_undo_join_paras()

BOOL add_undo_join_paras ( ME_TextEditor editor,
int  pos 
)

Definition at line 176 of file undo.c.

177{
178 struct undo_item *undo = add_undo( editor, undo_join_paras );
179 if (!undo) return FALSE;
180
181 undo->u.join_paras.pos = pos;
182 return TRUE;
183}
@ undo_join_paras
Definition: editstr.h:290
struct join_paras_item join_paras
Definition: editstr.h:348

Referenced by para_split().

◆ add_undo_set_char_fmt()

BOOL add_undo_set_char_fmt ( ME_TextEditor editor,
int  pos,
int  len,
const CHARFORMAT2W fmt 
)

Definition at line 164 of file undo.c.

165{
166 struct undo_item *undo = add_undo( editor, undo_set_char_fmt );
167 if (!undo) return FALSE;
168
169 undo->u.set_char_fmt.pos = pos;
170 undo->u.set_char_fmt.len = len;
171 undo->u.set_char_fmt.fmt = *fmt;
172
173 return TRUE;
174}
@ undo_set_char_fmt
Definition: editstr.h:293
Definition: dsound.c:943
struct set_char_fmt_item set_char_fmt
Definition: editstr.h:351

Referenced by ME_SetCharFormat().

◆ add_undo_set_para_fmt()

BOOL add_undo_set_para_fmt ( ME_TextEditor editor,
const ME_Paragraph para 
)

Definition at line 152 of file undo.c.

153{
154 struct undo_item *undo = add_undo( editor, undo_set_para_fmt );
155 if (!undo) return FALSE;
156
157 undo->u.set_para_fmt.pos = para->nCharOfs;
158 undo->u.set_para_fmt.fmt = para->fmt;
159 undo->u.set_para_fmt.border = para->border;
160
161 return TRUE;
162}
@ undo_set_para_fmt
Definition: editstr.h:292
ME_BorderRect border
Definition: editstr.h:207
PARAFORMAT2 fmt
Definition: editstr.h:203
struct set_para_fmt_item set_para_fmt
Definition: editstr.h:350

Referenced by ME_PlayUndoItem(), para_join(), and para_set_fmt().

◆ add_undo_split_para()

BOOL add_undo_split_para ( ME_TextEditor editor,
const ME_Paragraph para,
ME_String eol_str,
const ME_Cell cell 
)

Definition at line 185 of file undo.c.

186{
187 struct undo_item *undo = add_undo( editor, undo_split_para );
188 if (!undo) return FALSE;
189
190 undo->u.split_para.pos = para->nCharOfs - eol_str->nLen;
191 undo->u.split_para.eol_str = eol_str;
192 undo->u.split_para.fmt = para->fmt;
193 undo->u.split_para.border = para->border;
194 undo->u.split_para.flags = para->prev_para->member.para.nFlags & ~MEPF_CELL;
195
196 if (cell)
197 {
198 undo->u.split_para.cell_border = cell->border;
199 undo->u.split_para.cell_right_boundary = cell->nRightBoundary;
200 }
201 return TRUE;
202}
@ undo_split_para
Definition: editstr.h:291
int nRightBoundary
Definition: editstr.h:223
ME_BorderRect border
Definition: editstr.h:224
struct tagME_DisplayItem * prev_para
Definition: editstr.h:216
int nLen
Definition: editstr.h:56
struct split_para_item split_para
Definition: editstr.h:349

Referenced by para_join().

◆ cell_create()

ME_Cell * cell_create ( void  )

Definition at line 186 of file table.c.

187{
189 return &item->member.cell;
190}
ME_DisplayItem * ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN
Definition: list.c:133
@ diCell
Definition: editstr.h:85
static ATOM item
Definition: dde.c:856

Referenced by para_split().

◆ cell_end_para()

ME_Paragraph * cell_end_para ( ME_Cell cell)

Definition at line 207 of file table.c.

208{
209 ME_Cell *next = cell_next( cell );
210
211 if (!next) return cell_first_para( cell ); /* End of row */
212
214}
ME_Paragraph * cell_first_para(ME_Cell *cell)
Definition: table.c:202
ME_Cell * cell_next(ME_Cell *cell)
Definition: table.c:192
ME_DisplayItem * ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:66
static ME_DisplayItem * cell_get_di(ME_Cell *cell)
Definition: editor.h:319
@ diParagraph
Definition: editstr.h:84
static unsigned __int64 next
Definition: rand_nt.c:6
union tagME_DisplayItem::@560 member
ME_Paragraph para
Definition: editstr.h:261

Referenced by adjust_para_y(), cursor_move_line(), draw_table_borders(), editor_draw(), and table_select_next_cell_or_append().

◆ cell_first_para()

ME_Paragraph * cell_first_para ( ME_Cell cell)

Definition at line 202 of file table.c.

203{
204 return &ME_FindItemFwd( cell_get_di( cell ), diParagraph )->member.para;
205}
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:89

Referenced by cell_end_para(), cursor_move_line(), draw_table_borders(), editor_draw(), ME_RTFSpecialCharHook(), pixel_pos_in_table_row(), and table_select_next_cell_or_append().

◆ cell_get_di()

static ME_DisplayItem * cell_get_di ( ME_Cell cell)
inlinestatic

Definition at line 319 of file editor.h.

320{
322}
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define offsetof(TYPE, MEMBER)

Referenced by cell_end_para(), cell_first_para(), para_join(), para_split(), table_outer_para(), table_row_end(), and table_row_start().

◆ cell_next()

◆ cell_prev()

ME_Cell * cell_prev ( ME_Cell cell)

Definition at line 197 of file table.c.

198{
199 return cell->prev_cell;
200}
struct tagME_Cell * prev_cell
Definition: editstr.h:228

Referenced by adjust_para_y(), cursor_move_line(), ME_BeginRow(), ME_RTFSpecialCharHook(), para_join(), para_split(), and table_row_start().

◆ cf2w_to_cfany()

BOOL cf2w_to_cfany ( CHARFORMAT2W to,
const CHARFORMAT2W from 
)

Definition at line 79 of file style.c.

80{
81 assert(from->cbSize == sizeof(CHARFORMAT2W));
82 if (to->cbSize == sizeof(CHARFORMATA))
83 {
84 CHARFORMATA *t = (CHARFORMATA *)to;
86 WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
87 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
88 t->dwMask &= CFM_ALL;
89 t->dwEffects &= CFM_EFFECTS;
90 return TRUE;
91 }
92 if (to->cbSize == sizeof(CHARFORMATW))
93 {
94 CHARFORMATW *t = (CHARFORMATW *)to;
95 CopyMemory(t, from, sizeof(*t));
96 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
97 t->dwMask &= CFM_ALL;
98 t->dwEffects &= CFM_EFFECTS;
99 return TRUE;
100 }
101 if (to->cbSize == sizeof(CHARFORMAT2A))
102 {
103 CHARFORMAT2A *t = (CHARFORMAT2A *)to;
104 /* copy the A structure without face name */
105 CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
106 /* convert face name */
107 WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
108 /* copy the rest of the 2A structure to 2W */
109 CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight));
110 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
111 return TRUE;
112 }
113 if (to->cbSize == sizeof(CHARFORMAT2W))
114 {
115 CopyMemory(to, from, sizeof(CHARFORMAT2W));
116 return TRUE;
117 }
118 return FALSE;
119}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble t
Definition: gl.h:2047
#define CFM_EFFECTS
Definition: richedit.h:364
#define CFM_ALL
Definition: richedit.h:387
CardRegion * from
Definition: spigame.cpp:19
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define CopyMemory
Definition: winbase.h:1741

Referenced by editor_handle_message().

◆ cfany_to_cf2w()

BOOL cfany_to_cf2w ( CHARFORMAT2W to,
const CHARFORMAT2W from 
)

Definition at line 36 of file style.c.

37{
38 if (from->cbSize == sizeof(CHARFORMATA))
39 {
41 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
42 to->cbSize = sizeof(CHARFORMAT2W);
43 if (f->dwMask & CFM_FACE) {
44 MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
45 }
46 return TRUE;
47 }
48 if (from->cbSize == sizeof(CHARFORMATW))
49 {
51 CopyMemory(to, f, sizeof(*f));
52 /* theoretically, we don't need to zero the remaining memory */
54 to->cbSize = sizeof(CHARFORMAT2W);
55 return TRUE;
56 }
57 if (from->cbSize == sizeof(CHARFORMAT2A))
58 {
60 /* copy the A structure without face name */
61 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
62 /* convert face name */
63 if (f->dwMask & CFM_FACE)
64 MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
65 /* copy the rest of the 2A structure to 2W */
66 CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight));
67 to->cbSize = sizeof(CHARFORMAT2W);
68 return TRUE;
69 }
70 if (from->cbSize == sizeof(CHARFORMAT2W))
71 {
72 CopyMemory(to, from, sizeof(CHARFORMAT2W));
73 return TRUE;
74 }
75
76 return FALSE;
77}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MultiByteToWideChar
Definition: compat.h:110
GLfloat f
Definition: glext.h:7540
struct _charformat2w CHARFORMAT2W
#define CFM_FACE
Definition: richedit.h:360
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:313
WORD wWeight
Definition: richedit.h:314
#define ZeroMemory
Definition: winbase.h:1743

Referenced by handle_EM_SETCHARFORMAT(), and ME_MakeFirstParagraph().

◆ create_caret()

void create_caret ( ME_TextEditor ed)

Definition at line 251 of file caret.c.

252{
253 int x, y, height;
254
255 cursor_coords( editor, &editor->pCursors[0], &x, &y, &height );
256 ITextHost_TxCreateCaret(editor->texthost, NULL, 0, height);
257 editor->caret_height = height;
258 editor->caret_hidden = TRUE;
259}
void cursor_coords(ME_TextEditor *editor, ME_Cursor *cursor, int *x, int *y, int *height)
Definition: caret.c:221
#define ITextHost_TxCreateCaret(This, a, b, c)
Definition: editor.h:341
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by editor_handle_message(), and update_caret().

◆ create_text_services()

HRESULT create_text_services ( IUnknown outer,
ITextHost *  text_host,
IUnknown **  unk,
BOOL  emulate_10 
)

Definition at line 577 of file txtsrv.c.

578{
579 struct text_services *services;
580
581 TRACE( "%p %p --> %p\n", outer, text_host, unk );
582 if (text_host == NULL) return E_POINTER;
583
584 services = CoTaskMemAlloc( sizeof(*services) );
585 if (services == NULL) return E_OUTOFMEMORY;
586 services->ref = 1;
587 services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
588 services->ITextServices_iface.lpVtbl = &textservices_vtbl;
589 services->IRichEditOle_iface.lpVtbl = &re_ole_vtbl;
590 services->ITextDocument2Old_iface.lpVtbl = &text_doc2old_vtbl;
591 services->editor = ME_MakeEditor( text_host, emulate_10 );
592 services->editor->richole = &services->IRichEditOle_iface;
593
594 if (outer) services->outer_unk = outer;
595 else services->outer_unk = &services->IUnknown_inner;
596
597 services->text_selection = NULL;
598 list_init( &services->rangelist );
599 list_init( &services->clientsites );
600
601 *unk = &services->IUnknown_inner;
602 return S_OK;
603}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
ME_TextEditor * ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
Definition: editor.c:2933
const IRichEditOleVtbl re_ole_vtbl
Definition: richole.c:1408
const ITextDocument2OldVtbl text_doc2old_vtbl
Definition: richole.c:4469
static const IUnknownVtbl textservices_inner_vtbl
Definition: txtsrv.c:90
static const ITextServicesVtbl textservices_vtbl
Definition: txtsrv.c:552
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4
#define E_POINTER
Definition: winerror.h:2365

Referenced by create_windowed_editor(), and CreateTextServices().

◆ cursor_coords()

void cursor_coords ( ME_TextEditor editor,
ME_Cursor cursor,
int x,
int y,
int height 
)

Definition at line 221 of file caret.c.

223{
224 ME_Row *row;
225 ME_Run *run = cursor->run;
226 ME_Paragraph *para = cursor->para;
227 ME_Run *size_run = run, *prev;
229 int run_x;
230 HDC hdc = ITextHost_TxGetDC( editor->texthost );
231
232 assert(~para->nFlags & MEPF_REWRAP);
233
235
236 ME_InitContext( &c, editor, hdc );
237
238 if (!cursor->nOffset && (prev = run_prev( run ))) size_run = prev;
239
240 run_x = ME_PointFromCharContext( &c, run, cursor->nOffset, TRUE );
241
242 *height = size_run->nAscent + size_run->nDescent;
243 *x = c.rcView.left + run->pt.x + run_x - editor->horz_si.nPos;
244 *y = c.rcView.top + para->pt.y + row->nBaseline
245 + run->pt.y - size_run->nAscent - editor->vert_si.nPos;
248 return;
249}
void ME_DestroyContext(ME_Context *c)
Definition: context.c:44
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
Definition: context.c:23
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
Definition: run.c:608
ME_Row * row_from_cursor(ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: row.c:74
#define ITextHost_TxGetDC(This)
Definition: editor.h:333
#define ITextHost_TxReleaseDC(This, a)
Definition: editor.h:334
ME_Run * run_prev(ME_Run *run) DECLSPEC_HIDDEN
Definition: run.c:82
#define MEPF_REWRAP
Definition: editstr.h:140
const GLubyte * c
Definition: glext.h:8905
const char cursor[]
Definition: icontest.c:13
#define c
Definition: ke_i.h:80
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
int nAscent
Definition: editstr.h:165
POINT pt
Definition: editstr.h:166
int nDescent
Definition: editstr.h:165
SCROLLINFO vert_si
Definition: editstr.h:440
ITextHost2 * texthost
Definition: editstr.h:384
SCROLLINFO horz_si
Definition: editstr.h:440
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by create_caret(), ITextRange_fnScrollIntoView(), and update_caret().

◆ cursor_from_char_ofs()

void cursor_from_char_ofs ( ME_TextEditor editor,
int  char_ofs,
ME_Cursor cursor 
)

Definition at line 240 of file run.c.

241{
242 ME_Paragraph *para;
243 ME_Run *run;
244
245 char_ofs = min( max( char_ofs, 0 ), ME_GetTextLength( editor ) );
246
247 /* Find the paragraph at the offset. */
248 for (para = editor_first_para( editor );
249 para_next( para )->nCharOfs <= char_ofs;
250 para = para_next( para ))
251 ;
252
253 char_ofs -= para->nCharOfs;
254
255 /* Find the run at the offset. */
256 for (run = para_first_run( para );
257 run_next( run ) && run_next( run )->nCharOfs <= char_ofs;
258 run = run_next( run ))
259 ;
260
261 char_ofs -= run->nCharOfs;
262
263 cursor->para = para;
264 cursor->run = run;
265 cursor->nOffset = char_ofs;
266}
int ME_GetTextLength(ME_TextEditor *editor)
Definition: caret.c:83
ME_Paragraph * editor_first_para(ME_TextEditor *editor)
Definition: editor.c:279
ME_Run * run_next(ME_Run *run)
Definition: run.c:68
ME_Run * para_first_run(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:104
ME_Paragraph * para_next(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:57
#define min(a, b)
Definition: monoChain.cc:55
int nCharOfs
Definition: editstr.h:161
#define max(a, b)
Definition: svc.c:63

Referenced by editor_handle_message(), fnTextSrv_TxGetText(), get_textfont_prop_for_pos(), IRichEditOle_fnGetClipboardData(), IRichEditOle_fnGetObject(), ITextRange_fnGetChar(), ITextRange_fnGetText(), ITextRange_fnScrollIntoView(), ITextRange_fnSetText(), ME_FindText(), ME_GetSelectionType(), ME_InternalDeleteText(), ME_PlayUndoItem(), ME_StreamIn(), set_selection_cursors(), set_textfont_prop(), textrange_copy_or_cut(), textrange_endof(), textrange_move(), textrange_moveend(), textrange_movestart(), and textrange_set_font().

◆ cursor_next_run()

BOOL cursor_next_run ( ME_Cursor cursor,
BOOL  all_para 
)

Definition at line 30 of file run.c.

31{
33
34 while (p->type != diTextEnd)
35 {
36 if (p->type == diParagraph && !all_para) return FALSE;
37 else if (p->type == diRun)
38 {
39 cursor->run = &p->member.run;
40 cursor->para = cursor->run->para;
41 cursor->nOffset = 0;
42 return TRUE;
43 }
44 p = p->next;
45 }
46 return FALSE;
47}
static ME_DisplayItem * run_get_di(ME_Run *run)
Definition: editor.h:163
@ diTextEnd
Definition: editstr.h:88
@ diRun
Definition: editstr.h:86
GLfloat GLfloat p
Definition: glext.h:8902
struct define * next
Definition: compiler.c:65
struct tagME_DisplayItem * next
Definition: editstr.h:256

Referenced by ME_FindNextURLCandidate(), ME_StreamOutRTF(), run_next(), and run_next_all_paras().

◆ cursor_prev_run()

BOOL cursor_prev_run ( ME_Cursor cursor,
BOOL  all_para 
)

Definition at line 49 of file run.c.

50{
52
53 while (p->type != diTextStart)
54 {
55 if (p->type == diParagraph && !all_para) return FALSE;
56 else if (p->type == diRun)
57 {
58 cursor->run = &p->member.run;
59 cursor->para = cursor->run->para;
60 cursor->nOffset = 0;
61 return TRUE;
62 }
63 p = p->prev;
64 }
65 return FALSE;
66}
@ diTextStart
Definition: editstr.h:83
struct tagME_DisplayItem * prev
Definition: editstr.h:256

Referenced by run_prev(), and run_prev_all_paras().

◆ debugstr_run()

static const char * debugstr_run ( const ME_Run run)
inlinestatic

Definition at line 47 of file editor.h.

48{
49 return debugstr_wn( get_text( run, 0 ), run->len );
50}
static WCHAR * get_text(const ME_Run *run, int offset)
Definition: editor.h:42
#define debugstr_wn
Definition: kernel32.h:33
int len
Definition: editstr.h:162

Referenced by itemize_para(), ME_CheckCharOffsets(), ME_DumpDocument(), ME_InternalDeleteText(), ME_MaximizeSplit(), ME_SplitByBacktracking(), and split_run_extents().

◆ draw_ole()

void draw_ole ( ME_Context c,
int  x,
int  y,
ME_Run run,
BOOL  selected 
)

Definition at line 5726 of file richole.c.

5727{
5728 IDataObject* ido;
5729 FORMATETC fmt;
5730 STGMEDIUM stgm;
5731 DIBSECTION dibsect;
5732 ENHMETAHEADER emh;
5733 HDC hMemDC;
5734 SIZE sz;
5735 BOOL has_size;
5736 HBITMAP old_bm;
5737 RECT rc;
5738
5739 assert(run->nFlags & MERF_GRAPHICS);
5740 assert(run->reobj);
5741 if (IOleObject_QueryInterface(run->reobj->obj.poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
5742 {
5743 FIXME("Couldn't get interface\n");
5744 return;
5745 }
5746 has_size = run->reobj->obj.sizel.cx != 0 || run->reobj->obj.sizel.cy != 0;
5747 fmt.cfFormat = CF_BITMAP;
5748 fmt.ptd = NULL;
5749 fmt.dwAspect = DVASPECT_CONTENT;
5750 fmt.lindex = -1;
5751 fmt.tymed = TYMED_GDI;
5752 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5753 {
5754 fmt.cfFormat = CF_ENHMETAFILE;
5755 fmt.tymed = TYMED_ENHMF;
5756 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5757 {
5758 FIXME("Couldn't get storage medium\n");
5759 IDataObject_Release(ido);
5760 return;
5761 }
5762 }
5763 IDataObject_Release(ido);
5764
5765 switch (stgm.tymed)
5766 {
5767 case TYMED_GDI:
5768 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
5769 hMemDC = CreateCompatibleDC(c->hDC);
5770 old_bm = SelectObject(hMemDC, stgm.u.hBitmap);
5771 if (has_size)
5772 {
5773 convert_sizel(c, &run->reobj->obj.sizel, &sz);
5774 } else {
5775 sz.cx = dibsect.dsBm.bmWidth;
5776 sz.cy = dibsect.dsBm.bmHeight;
5777 }
5778 if (c->editor->nZoomNumerator != 0)
5779 {
5780 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5781 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5782 }
5783 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
5784 hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
5785
5786 SelectObject(hMemDC, old_bm);
5787 DeleteDC(hMemDC);
5788 break;
5789 case TYMED_ENHMF:
5790 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
5791 if (has_size)
5792 {
5793 convert_sizel(c, &run->reobj->obj.sizel, &sz);
5794 } else {
5795 sz.cx = emh.rclBounds.right - emh.rclBounds.left;
5796 sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
5797 }
5798 if (c->editor->nZoomNumerator != 0)
5799 {
5800 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5801 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5802 }
5803
5804 rc.left = x;
5805 rc.top = y - sz.cy;
5806 rc.right = x + sz.cx;
5807 rc.bottom = y;
5808 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
5809 break;
5810 default:
5811 FIXME("Unsupported tymed %d\n", stgm.tymed);
5812 selected = FALSE;
5813 break;
5814 }
5815 ReleaseStgMedium(&stgm);
5816
5817 if (selected && !c->editor->bHideSelection)
5818 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
5819}
#define CF_BITMAP
Definition: constants.h:397
#define CF_ENHMETAFILE
Definition: constants.h:409
#define FIXME(fmt,...)
Definition: precomp.h:53
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
static void convert_sizel(const ME_Context *c, const SIZEL *szl, SIZE *sz)
Definition: richole.c:5637
#define MERF_GRAPHICS
Definition: editstr.h:104
unsigned int BOOL
Definition: ntddk_ex.h:94
static HBITMAP
Definition: button.c:44
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
const GUID IID_IDataObject
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LONG bmHeight
Definition: wingdi.h:1423
LONG bmWidth
Definition: wingdi.h:1422
BITMAP dsBm
Definition: wingdi.h:1669
RECTL rclBounds
Definition: wingdi.h:2322
struct re_object * reobj
Definition: editstr.h:167
int nFlags
Definition: editstr.h:164
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
#define DSTINVERT
Definition: wingdi.h:327
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)

Referenced by draw_run().

◆ editor_copy_or_cut()

HRESULT editor_copy_or_cut ( ME_TextEditor editor,
BOOL  cut,
ME_Cursor start,
int  count,
IDataObject **  data_out 
)

Definition at line 2355 of file editor.c.

2357{
2358 HRESULT hr;
2359
2360 if (cut && (editor->props & TXTBIT_READONLY))
2361 {
2362 return E_ACCESSDENIED;
2363 }
2364
2365 hr = editor_copy( editor, start, count, data_out );
2366 if (SUCCEEDED(hr) && cut)
2367 {
2369 ME_CommitUndo( editor );
2370 ME_UpdateRepaint( editor, TRUE );
2371 }
2372 return hr;
2373}
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce)
Definition: caret.c:339
static HRESULT editor_copy(ME_TextEditor *editor, ME_Cursor *start, int chars, IDataObject **data_out)
Definition: editor.c:2325
void ME_CommitUndo(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:227
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN
Definition: paint.c:129
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183
#define TXTBIT_READONLY
Definition: textserv.h:187
#define E_ACCESSDENIED
Definition: winerror.h:2849

Referenced by copy_or_cut(), and textrange_copy_or_cut().

◆ editor_draw()

void editor_draw ( ME_TextEditor editor,
HDC  hDC,
const RECT update 
)

Definition at line 33 of file paint.c.

34{
35 ME_Paragraph *para;
37 ME_Cell *cell;
38 int ys, ye;
39 HRGN oldRgn;
40 RECT rc, client;
42
43 ME_InitContext( &c, editor, hDC );
44 if (!update)
45 {
46 client = c.rcView;
47 client.left -= editor->selofs;
48 update = &client;
49 }
50
51 oldRgn = CreateRectRgn(0, 0, 0, 0);
52 if (!GetClipRgn(hDC, oldRgn))
53 {
54 DeleteObject(oldRgn);
55 oldRgn = NULL;
56 }
57 IntersectClipRect( hDC, update->left, update->top, update->right, update->bottom );
58
59 brush = SelectObject( hDC, brush );
61
62 para = editor_first_para( editor );
63 /* This context point is an offset for the paragraph positions stored
64 * during wrapping. It shouldn't be modified during painting. */
65 c.pt.x = c.rcView.left - editor->horz_si.nPos;
66 c.pt.y = c.rcView.top - editor->vert_si.nPos;
67 while (para_next( para ))
68 {
69 ys = c.pt.y + para->pt.y;
70 cell = para_cell( para );
71 if (cell && para == cell_end_para( cell ))
72 ye = c.pt.y + cell->pt.y + cell->nHeight;
73 else ye = ys + para->nHeight;
74
75 if (cell && !(para->nFlags & MEPF_ROWEND) && para == cell_first_para( cell ))
76 {
77 /* the border shifts the text down */
78 ys -= para_cell( para )->yTextOffset;
79 }
80
81 /* Draw the paragraph if any of the paragraph is in the update region. */
82 if (ys < update->bottom && ye > update->top)
83 draw_paragraph( &c, para );
84 para = para_next( para );
85 }
86 if (editor_opaque( editor ))
87 {
88 if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
89 { /* space after the end of the text */
90 rc.top = c.pt.y + editor->nTotalLength;
91 rc.left = c.rcView.left;
92 rc.bottom = c.rcView.bottom;
93 rc.right = c.rcView.right;
94 if (IntersectRect( &rc, &rc, update ))
95 PatBlt(hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
96 }
97 if (editor->selofs)
98 { /* selection bar */
99 rc.left = c.rcView.left - editor->selofs;
100 rc.top = c.rcView.top;
101 rc.right = c.rcView.left;
102 rc.bottom = c.rcView.bottom;
103 if (IntersectRect( &rc, &rc, update ))
104 PatBlt( hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
105 }
106 }
107
108 DeleteObject( SelectObject( hDC, brush ) );
109 SelectClipRgn( hDC, oldRgn );
110 if (oldRgn) DeleteObject( oldRgn );
112
113 if (editor->nTotalLength != editor->nLastTotalLength || editor->nTotalWidth != editor->nLastTotalWidth)
115 editor->nLastTotalLength = editor->nTotalLength;
116 editor->nLastTotalWidth = editor->nTotalWidth;
117}
static HDC hDC
Definition: 3dtext.c:33
static void draw_paragraph(ME_Context *c, ME_Paragraph *para)
Definition: paint.c:931
static BOOL editor_opaque(ME_TextEditor *editor)
Definition: paint.c:28
ME_Paragraph * cell_end_para(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:207
ME_Cell * para_cell(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:127
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN
Definition: wrap.c:1128
#define ITextHost_TxGetSysColor(This, a)
Definition: editor.h:358
ME_Paragraph * cell_first_para(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:202
#define MEPF_ROWEND
Definition: editstr.h:144
pKey DeleteObject()
GLint GLint bottom
Definition: glext.h:7726
static FILE * client
Definition: client.c:41
POINT pt
Definition: editstr.h:225
int nHeight
Definition: editstr.h:226
int yTextOffset
Definition: editstr.h:227
int nLastTotalWidth
Definition: editstr.h:398
int nLastTotalLength
Definition: editstr.h:397
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define TRANSPARENT
Definition: wingdi.h:950
#define PATCOPY
Definition: wingdi.h:335
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define COLOR_WINDOW
Definition: winuser.h:929
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by fnTextSrv_TxDraw().

◆ editor_end_para()

ME_Paragraph * editor_end_para ( ME_TextEditor editor)

Definition at line 285 of file editor.c.

286{
287 return &editor->pBuffer->pLast->member.para;
288}
ME_DisplayItem * pLast
Definition: editstr.h:267
ME_TextBuffer * pBuffer
Definition: editstr.h:388

Referenced by editor_handle_message(), editor_mark_rewrap_all(), ME_ArrowPageDown(), ME_GetTextW(), ME_InvalidateSelection(), and ME_SetCursorToEnd().

◆ editor_ensure_visible()

void editor_ensure_visible ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 1206 of file paint.c.

1207{
1208 ME_Run *run = cursor->run;
1210 ME_Paragraph *para = cursor->para;
1211 int x, y, yheight;
1212
1213
1214 if (editor->scrollbars & ES_AUTOHSCROLL)
1215 {
1216 x = run->pt.x + ME_PointFromChar( editor, run, cursor->nOffset, TRUE );
1217 if (x > editor->horz_si.nPos + editor->sizeWindow.cx)
1218 x = x + 1 - editor->sizeWindow.cx;
1219 else if (x > editor->horz_si.nPos)
1220 x = editor->horz_si.nPos;
1221
1222 if (~editor->scrollbars & ES_AUTOVSCROLL)
1223 {
1224 scroll_h_abs( editor, x, TRUE );
1225 return;
1226 }
1227 }
1228 else
1229 {
1230 if (~editor->scrollbars & ES_AUTOVSCROLL) return;
1231 x = editor->horz_si.nPos;
1232 }
1233
1234 y = para->pt.y + row->pt.y;
1235 yheight = row->nHeight;
1236
1237 if (y < editor->vert_si.nPos)
1238 scroll_abs( editor, x, y, TRUE );
1239 else if (y + yheight > editor->vert_si.nPos + editor->sizeWindow.cy)
1240 scroll_abs( editor, x, y + yheight - editor->sizeWindow.cy, TRUE );
1241 else if (x != editor->horz_si.nPos)
1242 scroll_abs( editor, x, editor->vert_si.nPos, TRUE );
1243}
void scroll_h_abs(ME_TextEditor *editor, int x, BOOL notify)
Definition: paint.c:1117
void scroll_abs(ME_TextEditor *editor, int x, int y, BOOL notify)
Definition: paint.c:1087
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
Definition: run.c:649
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_AUTOHSCROLL
Definition: pedump.c:672
DWORD scrollbars
Definition: editstr.h:394

Referenced by editor_handle_message(), ME_ArrowKey(), ME_MouseMove(), and ME_UpdateRepaint().

◆ editor_first_para()

◆ editor_get_selection_para_fmt()

void editor_get_selection_para_fmt ( ME_TextEditor editor,
PARAFORMAT2 fmt 
)

Definition at line 905 of file para.c.

906{
907 ME_Paragraph *para, *para_end;
908
909 if (fmt->cbSize < sizeof(PARAFORMAT))
910 {
911 fmt->dwMask = 0;
912 return;
913 }
914
915 editor_get_selection_paras( editor, &para, &para_end );
916
917 para_copy_fmt( para, fmt );
918
919 /* Invalidate values that change across the selected paragraphs. */
920 while (para != para_end)
921 {
922 para = para_next( para );
923
924#define CHECK_FIELD(m, f) \
925 if (fmt->f != para->fmt.f) fmt->dwMask &= ~(m);
926
927 CHECK_FIELD(PFM_NUMBERING, wNumbering);
928 CHECK_FIELD(PFM_STARTINDENT, dxStartIndent);
929 CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent);
930 CHECK_FIELD(PFM_OFFSET, dxOffset);
931 CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
932 if (fmt->dwMask & PFM_TABSTOPS)
933 {
934 if (fmt->cTabCount != para->fmt.cTabCount ||
935 memcmp(fmt->rgxTabs, para->fmt.rgxTabs, para->fmt.cTabCount * sizeof(int) ))
936 fmt->dwMask &= ~PFM_TABSTOPS;
937 }
938
939 if (fmt->cbSize >= sizeof(PARAFORMAT2))
940 {
941 fmt->dwMask &= ~((fmt->wEffects ^ para->fmt.wEffects) << 16);
942 CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
943 CHECK_FIELD(PFM_SPACEAFTER, dySpaceAfter);
944 CHECK_FIELD(PFM_LINESPACING, dyLineSpacing);
945 CHECK_FIELD(PFM_STYLE, sStyle);
946 CHECK_FIELD(PFM_SPACEAFTER, bLineSpacingRule);
947 CHECK_FIELD(PFM_SHADING, wShadingWeight);
948 CHECK_FIELD(PFM_SHADING, wShadingStyle);
949 CHECK_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
950 CHECK_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
951 CHECK_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
952 CHECK_FIELD(PFM_BORDER, wBorderSpace);
953 CHECK_FIELD(PFM_BORDER, wBorderWidth);
954 CHECK_FIELD(PFM_BORDER, wBorders);
955 }
956#undef CHECK_FIELD
957 }
958}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CHECK_FIELD(m, f)
void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end)
Definition: para.c:850
ME_Paragraph * para_next(ME_Paragraph *para)
Definition: para.c:57
static void para_copy_fmt(const ME_Paragraph *para, PARAFORMAT2 *fmt)
Definition: para.c:891
#define PFM_SPACEBEFORE
Definition: richedit.h:847
#define PFM_NUMBERING
Definition: richedit.h:843
#define PFM_NUMBERINGSTYLE
Definition: richedit.h:853
#define PFM_LINESPACING
Definition: richedit.h:849
#define PFM_OFFSET
Definition: richedit.h:840
#define PFM_SHADING
Definition: richedit.h:852
#define PFM_RIGHTINDENT
Definition: richedit.h:839
#define PFM_BORDER
Definition: richedit.h:851
#define PFM_ALIGNMENT
Definition: richedit.h:841
#define PFM_TABSTOPS
Definition: richedit.h:842
#define PFM_STYLE
Definition: richedit.h:850
#define PFM_SPACEAFTER
Definition: richedit.h:848
#define PFM_STARTINDENT
Definition: richedit.h:838
#define PFM_NUMBERINGSTART
Definition: richedit.h:855
#define PFM_NUMBERINGTAB
Definition: richedit.h:854
LONG rgxTabs[MAX_TAB_STOPS]
Definition: richedit.h:675
SHORT cTabCount
Definition: richedit.h:674
WORD wEffects
Definition: richedit.h:669

Referenced by editor_handle_message(), and ME_RTFParAttrHook().

◆ editor_get_selection_paras()

void editor_get_selection_paras ( ME_TextEditor editor,
ME_Paragraph **  para,
ME_Paragraph **  para_end 
)

Definition at line 850 of file para.c.

851{
852 ME_Cursor *pEndCursor = &editor->pCursors[1];
853
854 *para = editor->pCursors[0].para;
855 *para_end = editor->pCursors[1].para;
856 if (*para == *para_end)
857 return;
858
859 if ((*para_end)->nCharOfs < (*para)->nCharOfs)
860 {
861 ME_Paragraph *tmp = *para;
862
863 *para = *para_end;
864 *para_end = tmp;
865 pEndCursor = &editor->pCursors[0];
866 }
867
868 /* The paragraph at the end of a non-empty selection isn't included
869 * if the selection ends at the start of the paragraph. */
870 if (!pEndCursor->run->nCharOfs && !pEndCursor->nOffset)
871 *para_end = para_prev( *para_end );
872}
ME_Paragraph * para_prev(ME_Paragraph *para)
Definition: para.c:63
ME_Paragraph * para
Definition: editstr.h:274
int nOffset
Definition: editstr.h:276
ME_Run * run
Definition: editstr.h:275
ME_Cursor * pCursors
Definition: editstr.h:389

Referenced by editor_get_selection_para_fmt(), editor_set_selection_para_fmt(), and ME_InvalidateSelection().

◆ editor_handle_message()

LRESULT editor_handle_message ( ME_TextEditor editor,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
HRESULT phresult 
)

Definition at line 3256 of file editor.c.

3258{
3259 *phresult = S_OK;
3260
3261 switch(msg) {
3262
3285
3286/* Messages specific to Richedit controls */
3287
3288 case EM_STREAMIN:
3289 return ME_StreamIn(editor, wParam, (EDITSTREAM*)lParam, TRUE);
3290 case EM_STREAMOUT:
3291 return ME_StreamOut(editor, wParam, (EDITSTREAM *)lParam);
3292 case EM_EMPTYUNDOBUFFER:
3293 ME_EmptyUndoStack(editor);
3294 return 0;
3295 case EM_GETSEL:
3296 {
3297 /* Note: wParam/lParam can be NULL */
3298 UINT from, to;
3299 PUINT pfrom = wParam ? (PUINT)wParam : &from;
3300 PUINT pto = lParam ? (PUINT)lParam : &to;
3301 ME_GetSelectionOfs(editor, (int *)pfrom, (int *)pto);
3302 if ((*pfrom|*pto) & 0xFFFF0000)
3303 return -1;
3304 return MAKELONG(*pfrom,*pto);
3305 }
3306 case EM_EXGETSEL:
3307 {
3308 CHARRANGE *pRange = (CHARRANGE *)lParam;
3309 ME_GetSelectionOfs(editor, &pRange->cpMin, &pRange->cpMax);
3310 TRACE("EM_EXGETSEL = (%d,%d)\n", pRange->cpMin, pRange->cpMax);
3311 return 0;
3312 }
3313 case EM_SETUNDOLIMIT:
3314 {
3315 if ((int)wParam < 0)
3317 else
3318 editor->nUndoLimit = min(wParam, STACK_SIZE_MAX);
3319 /* Setting a max stack size keeps wine from getting killed
3320 for hogging memory. Windows allocates all this memory at once, so
3321 no program would realistically set a value above our maximum. */
3322 return editor->nUndoLimit;
3323 }
3324 case EM_CANUNDO:
3325 return !list_empty( &editor->undo_stack );
3326 case EM_CANREDO:
3327 return !list_empty( &editor->redo_stack );
3328 case WM_UNDO: /* FIXME: actually not the same */
3329 case EM_UNDO:
3330 return ME_Undo(editor);
3331 case EM_REDO:
3332 return ME_Redo(editor);
3333 case EM_SETFONTSIZE:
3334 {
3336 LONG tmp_size, size;
3337 BOOL is_increase = ((LONG)wParam > 0);
3338
3339 if (editor->mode & TM_PLAINTEXT)
3340 return FALSE;
3341
3342 cf.cbSize = sizeof(cf);
3343 cf.dwMask = CFM_SIZE;
3344 ME_GetSelectionCharFormat(editor, &cf);
3345 tmp_size = (cf.yHeight / 20) + wParam;
3346
3347 if (tmp_size <= 1)
3348 size = 1;
3349 else if (tmp_size > 12 && tmp_size < 28 && tmp_size % 2)
3350 size = tmp_size + (is_increase ? 1 : -1);
3351 else if (tmp_size > 28 && tmp_size < 36)
3352 size = is_increase ? 36 : 28;
3353 else if (tmp_size > 36 && tmp_size < 48)
3354 size = is_increase ? 48 : 36;
3355 else if (tmp_size > 48 && tmp_size < 72)
3356 size = is_increase ? 72 : 48;
3357 else if (tmp_size > 72 && tmp_size < 80)
3358 size = is_increase ? 80 : 72;
3359 else if (tmp_size > 80 && tmp_size < 1638)
3360 size = 10 * (is_increase ? (tmp_size / 10 + 1) : (tmp_size / 10));
3361 else if (tmp_size >= 1638)
3362 size = 1638;
3363 else
3364 size = tmp_size;
3365
3366 cf.yHeight = size * 20; /* convert twips to points */
3367 ME_SetSelectionCharFormat(editor, &cf);
3368 ME_CommitUndo(editor);
3370 ME_UpdateScrollBar(editor);
3371
3372 return TRUE;
3373 }
3374 case EM_SETSEL:
3375 {
3376 return set_selection( editor, wParam, lParam );
3377 }
3378 case EM_SETSCROLLPOS:
3379 {
3380 POINT *point = (POINT *)lParam;
3381 scroll_abs( editor, point->x, point->y, TRUE );
3382 return 0;
3383 }
3384 case EM_AUTOURLDETECT:
3385 {
3386 if (wParam==1 || wParam ==0)
3387 {
3389 return 0;
3390 }
3391 return E_INVALIDARG;
3392 }
3394 {
3395 return editor->AutoURLDetect_bEnable;
3396 }
3397 case EM_EXSETSEL:
3398 {
3400
3401 return set_selection( editor, range.cpMin, range.cpMax );
3402 }
3403 case EM_SETTEXTEX:
3404 {
3405 LPWSTR wszText;
3406 SETTEXTEX *pStruct = (SETTEXTEX *)wParam;
3407 int from, to, len;
3408 ME_Style *style;
3409 BOOL bRtf, bUnicode, bSelection, bUTF8;
3410 int oldModify = editor->nModifyStep;
3411 static const char utf8_bom[] = {0xef, 0xbb, 0xbf};
3412
3413 if (!pStruct) return 0;
3414
3415 /* If we detect ascii rtf at the start of the string,
3416 * we know it isn't unicode. */
3417 bRtf = (lParam && (!strncmp((char *)lParam, "{\\rtf", 5) ||
3418 !strncmp((char *)lParam, "{\\urtf", 6)));
3419 bUnicode = !bRtf && pStruct->codepage == CP_UNICODE;
3420 bUTF8 = (lParam && (!strncmp((char *)lParam, utf8_bom, 3)));
3421
3422 TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n",
3424 pStruct->flags, pStruct->codepage);
3425
3426 bSelection = (pStruct->flags & ST_SELECTION) != 0;
3427 if (bSelection) {
3428 int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
3430 ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to - from, FALSE);
3431 } else {
3433 ME_SetCursorToStart(editor, &start);
3435 style = editor->pBuffer->pDefaultStyle;
3436 }
3437
3438 if (bRtf) {
3439 ME_StreamInRTFString(editor, bSelection, (char *)lParam);
3440 if (bSelection) {
3441 /* FIXME: The length returned doesn't include the rtf control
3442 * characters, only the actual text. */
3443 len = lParam ? strlen((char *)lParam) : 0;
3444 }
3445 } else {
3446 if (bUTF8 && !bUnicode) {
3447 wszText = ME_ToUnicode(CP_UTF8, (void *)(lParam+3), &len);
3448 ME_InsertTextFromCursor(editor, 0, wszText, len, style);
3449 ME_EndToUnicode(CP_UTF8, wszText);
3450 } else {
3451 wszText = ME_ToUnicode(pStruct->codepage, (void *)lParam, &len);
3452 ME_InsertTextFromCursor(editor, 0, wszText, len, style);
3453 ME_EndToUnicode(pStruct->codepage, wszText);
3454 }
3455 }
3456
3457 if (bSelection) {
3460 } else {
3462 len = 1;
3463 ME_SetCursorToStart(editor, &cursor);
3465 }
3466 ME_CommitUndo(editor);
3467 if (!(pStruct->flags & ST_KEEPUNDO))
3468 {
3469 editor->nModifyStep = oldModify;
3470 ME_EmptyUndoStack(editor);
3471 }
3472 ME_UpdateRepaint(editor, FALSE);
3473 return len;
3474 }
3475 case EM_SELECTIONTYPE:
3476 return ME_GetSelectionType(editor);
3477 case EM_GETMODIFY:
3478 return editor->nModifyStep == 0 ? 0 : -1;
3479 case EM_SETMODIFY:
3480 {
3481 if (wParam)
3482 editor->nModifyStep = 1;
3483 else
3484 editor->nModifyStep = 0;
3485
3486 return 0;
3487 }
3488 case EM_SETEVENTMASK:
3489 {
3490 DWORD nOldMask = editor->nEventMask;
3491
3492 editor->nEventMask = lParam;
3493 return nOldMask;
3494 }
3495 case EM_GETEVENTMASK:
3496 return editor->nEventMask;
3497 case EM_SETCHARFORMAT:
3498 return handle_EM_SETCHARFORMAT( editor, wParam, (CHARFORMAT2W *)lParam );
3499 case EM_GETCHARFORMAT:
3500 {
3502 if (dst->cbSize != sizeof(CHARFORMATA) &&
3503 dst->cbSize != sizeof(CHARFORMATW) &&
3504 dst->cbSize != sizeof(CHARFORMAT2A) &&
3505 dst->cbSize != sizeof(CHARFORMAT2W))
3506 return 0;
3507 tmp.cbSize = sizeof(tmp);
3508 if (!wParam)
3509 ME_GetDefaultCharFormat(editor, &tmp);
3510 else
3511 ME_GetSelectionCharFormat(editor, &tmp);
3512 cf2w_to_cfany(dst, &tmp);
3513 return tmp.dwMask;
3514 }
3515 case EM_SETPARAFORMAT:
3516 {
3519 ME_UpdateScrollBar(editor);
3520 ME_CommitUndo(editor);
3521 return result;
3522 }
3523 case EM_GETPARAFORMAT:
3525 return ((PARAFORMAT2 *)lParam)->dwMask;
3527 {
3528 ME_Paragraph *para = editor_first_para( editor );
3529 ME_Row *row;
3530 int y = editor->vert_si.nPos;
3531 int count = 0;
3532
3533 while (para_next( para ))
3534 {
3535 if (y < para->pt.y + para->nHeight) break;
3536 count += para->nRows;
3537 para = para_next( para );
3538 }
3539
3540 row = para_first_row( para );
3541 while (row)
3542 {
3543 if (y < para->pt.y + row->pt.y + row->nHeight) break;
3544 count++;
3545 row = row_next( row );
3546 }
3547 return count;
3548 }
3549 case EM_HIDESELECTION:
3550 {
3551 editor->bHideSelection = (wParam != 0);
3552 ME_InvalidateSelection(editor);
3553 return 0;
3554 }
3555 case EM_LINESCROLL:
3556 {
3557 if (!(editor->props & TXTBIT_MULTILINE))
3558 return FALSE;
3559 ME_ScrollDown( editor, lParam * get_default_line_height( editor ) );
3560 return TRUE;
3561 }
3562 case WM_CLEAR:
3563 {
3564 int from, to;
3565 int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
3566 ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE);
3567 ME_CommitUndo(editor);
3568 ME_UpdateRepaint(editor, TRUE);
3569 return 0;
3570 }
3571 case EM_REPLACESEL:
3572 {
3573 WCHAR *text = (WCHAR *)lParam;
3574 int len = text ? lstrlenW( text ) : 0;
3575
3576 TRACE( "EM_REPLACESEL - %s\n", debugstr_w( text ) );
3577 ME_ReplaceSel( editor, !!wParam, text, len );
3578 return len;
3579 }
3580 case EM_SCROLLCARET:
3581 editor_ensure_visible( editor, &editor->pCursors[0] );
3582 return 0;
3583 case WM_SETFONT:
3584 {
3585 LOGFONTW lf;
3587 HDC hDC;
3588 BOOL bRepaint = LOWORD(lParam);
3589
3590 if (!wParam)
3592
3593 if (!GetObjectW((HGDIOBJ)wParam, sizeof(LOGFONTW), &lf))
3594 return 0;
3595
3596 hDC = ITextHost_TxGetDC(editor->texthost);
3599 if (editor->mode & TM_RICHTEXT) {
3601 ME_SetCursorToStart(editor, &start);
3602 ME_SetCharFormat(editor, &start, NULL, &fmt);
3603 }
3604 ME_SetDefaultCharFormat(editor, &fmt);
3605
3606 ME_CommitUndo(editor);
3607 editor_mark_rewrap_all( editor );
3609 ME_UpdateScrollBar(editor);
3610 if (bRepaint)
3611 ME_Repaint(editor);
3612#ifdef __REACTOS__
3614 {
3615 HIMC hIMC = ImmGetContext(editor->hWnd);
3616 ImmSetCompositionFontW(hIMC, &lf);
3617 ImmReleaseContext(editor->hWnd, hIMC);
3618 }
3619#endif
3620 return 0;
3621 }
3622 case WM_SETTEXT:
3623 {
3625 ME_SetCursorToStart(editor, &cursor);
3627 if (lParam)
3628 {
3629 TRACE("WM_SETTEXT lParam==%lx\n",lParam);
3630 if (!strncmp((char *)lParam, "{\\rtf", 5) ||
3631 !strncmp((char *)lParam, "{\\urtf", 6))
3632 {
3633 /* Undocumented: WM_SETTEXT supports RTF text */
3634 ME_StreamInRTFString(editor, 0, (char *)lParam);
3635 }
3636 else
3637 ME_SetText( editor, (void*)lParam, TRUE );
3638 }
3639 else
3640 TRACE("WM_SETTEXT - NULL\n");
3641 ME_SetCursorToStart(editor, &cursor);
3643 set_selection_cursors(editor, 0, 0);
3644 editor->nModifyStep = 0;
3645 ME_CommitUndo(editor);
3646 ME_EmptyUndoStack(editor);
3647 ME_UpdateRepaint(editor, FALSE);
3648 return 1;
3649 }
3650 case EM_CANPASTE:
3651 return paste_special( editor, 0, NULL, TRUE );
3652 case WM_PASTE:
3653 case WM_MBUTTONDOWN:
3654 wParam = 0;
3655 lParam = 0;
3656 /* fall through */
3657 case EM_PASTESPECIAL:
3659 return 0;
3660 case WM_CUT:
3661 case WM_COPY:
3662 copy_or_cut(editor, msg == WM_CUT);
3663 return 0;
3664 case WM_GETTEXTLENGTH:
3665 {
3666 GETTEXTLENGTHEX how;
3667 how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS;
3668 how.codepage = CP_UNICODE;
3669 return ME_GetTextLengthEx(editor, &how);
3670 }
3671 case EM_GETTEXTLENGTHEX:
3672 return ME_GetTextLengthEx(editor, (GETTEXTLENGTHEX *)wParam);
3673 case WM_GETTEXT:
3674 {
3675 GETTEXTEX ex;
3676 ex.cb = wParam * sizeof(WCHAR);
3677 ex.flags = GT_USECRLF;
3678 ex.codepage = CP_UNICODE;
3679 ex.lpDefaultChar = NULL;
3680 ex.lpUsedDefChar = NULL;
3681 return ME_GetTextEx(editor, &ex, lParam);
3682 }
3683 case EM_GETTEXTEX:
3684 return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam);
3685 case EM_GETSELTEXT:
3686 {
3687 int nFrom, nTo, nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo);
3688 ME_Cursor *from = &editor->pCursors[nStartCur];
3689 return get_text_range( editor, (WCHAR *)lParam, from, nTo - nFrom );
3690 }
3691 case EM_GETSCROLLPOS:
3692 {
3693 POINT *point = (POINT *)lParam;
3694 point->x = editor->horz_si.nPos;
3695 point->y = editor->vert_si.nPos;
3696 /* 16-bit scaled value is returned as stored in scrollinfo */
3697 if (editor->horz_si.nMax > 0xffff)
3698 point->x = MulDiv(point->x, 0xffff, editor->horz_si.nMax);
3699 if (editor->vert_si.nMax > 0xffff)
3700 point->y = MulDiv(point->y, 0xffff, editor->vert_si.nMax);
3701 return 1;
3702 }
3703 case EM_GETTEXTRANGE:
3704 {
3705 TEXTRANGEW *rng = (TEXTRANGEW *)lParam;
3707 int nStart = rng->chrg.cpMin;
3708 int nEnd = rng->chrg.cpMax;
3709 int textlength = ME_GetTextLength(editor);
3710
3711 TRACE( "EM_GETTEXTRANGE min = %d max = %d textlength = %d\n", rng->chrg.cpMin, rng->chrg.cpMax, textlength );
3712 if (nStart < 0) return 0;
3713 if ((nStart == 0 && nEnd == -1) || nEnd > textlength)
3714 nEnd = textlength;
3715 if (nStart >= nEnd) return 0;
3716
3717 cursor_from_char_ofs( editor, nStart, &start );
3718 return get_text_range( editor, rng->lpstrText, &start, nEnd - nStart );
3719 }
3720 case EM_GETLINE:
3721 {
3722 ME_Row *row;
3723 ME_Run *run;
3724 const unsigned int nMaxChars = *(WORD *) lParam;
3725 unsigned int nCharsLeft = nMaxChars;
3726 char *dest = (char *) lParam;
3728
3729 TRACE( "EM_GETLINE: row=%d, nMaxChars=%d\n", (int)wParam, nMaxChars );
3730
3731 row = row_from_row_number( editor, wParam );
3732 if (row == NULL) return 0;
3733
3735 row_end_cursor( row, &end, TRUE );
3736 run = start.run;
3737 while (nCharsLeft)
3738 {
3739 WCHAR *str;
3740 unsigned int nCopy;
3741 int ofs = (run == start.run) ? start.nOffset : 0;
3742 int len = (run == end.run) ? end.nOffset : run->len;
3743
3744 str = get_text( run, ofs );
3745 nCopy = min( nCharsLeft, len );
3746
3747 memcpy(dest, str, nCopy * sizeof(WCHAR));
3748 dest += nCopy * sizeof(WCHAR);
3749 nCharsLeft -= nCopy;
3750 if (run == end.run) break;
3751 run = row_next_run( row, run );
3752 }
3753
3754 /* append line termination, space allowing */
3755 if (nCharsLeft > 0) *((WCHAR *)dest) = '\0';
3756
3757 TRACE("EM_GETLINE: got %u characters\n", nMaxChars - nCharsLeft);
3758 return nMaxChars - nCharsLeft;
3759 }
3760 case EM_GETLINECOUNT:
3761 {
3762 int count = editor->total_rows;
3763 ME_Run *prev_run, *last_run;
3764
3765 last_run = para_end_run( para_prev( editor_end_para( editor ) ) );
3766 prev_run = run_prev_all_paras( last_run );
3767
3768 if (editor->bEmulateVersion10 && prev_run && last_run->nCharOfs == 0 &&
3769 prev_run->len == 1 && *get_text( prev_run, 0 ) == '\r')
3770 {
3771 /* In 1.0 emulation, the last solitary \r at the very end of the text
3772 (if one exists) is NOT a line break.
3773 FIXME: this is an ugly hack. This should have a more regular model. */
3774 count--;
3775 }
3776
3777 count = max(1, count);
3778 TRACE("EM_GETLINECOUNT: count==%d\n", count);
3779 return count;
3780 }
3781 case EM_LINEFROMCHAR:
3782 {
3783 if (wParam == -1) wParam = ME_GetCursorOfs( editor->pCursors + 1 );
3784 return row_number_from_char_ofs( editor, wParam );
3785 }
3786 case EM_EXLINEFROMCHAR:
3787 {
3788 if (lParam == -1) lParam = ME_GetCursorOfs( editor->pCursors + 1 );
3789 return row_number_from_char_ofs( editor, lParam );
3790 }
3791 case EM_LINEINDEX:
3792 {
3793 ME_Row *row;
3795 int ofs;
3796
3797 if (wParam == -1) row = row_from_cursor( editor->pCursors );
3798 else row = row_from_row_number( editor, wParam );
3799 if (!row) return -1;
3800
3802 ofs = ME_GetCursorOfs( &cursor );
3803 TRACE( "EM_LINEINDEX: nCharOfs==%d\n", ofs );
3804 return ofs;
3805 }
3806 case EM_LINELENGTH:
3807 {
3808 ME_Row *row;
3809 int start_ofs, end_ofs;
3811
3812 if (wParam > ME_GetTextLength(editor))
3813 return 0;
3814 if (wParam == -1)
3815 {
3816 FIXME("EM_LINELENGTH: returning number of unselected characters on lines with selection unsupported.\n");
3817 return 0;
3818 }
3819 cursor_from_char_ofs( editor, wParam, &cursor );
3822 start_ofs = ME_GetCursorOfs( &cursor );
3824 end_ofs = ME_GetCursorOfs( &cursor );
3825 TRACE( "EM_LINELENGTH(%ld)==%d\n", wParam, end_ofs - start_ofs );
3826 return end_ofs - start_ofs;
3827 }
3828 case EM_EXLIMITTEXT:
3829 {
3830 if ((int)lParam < 0)
3831 return 0;
3832 if (lParam == 0)
3833 editor->nTextLimit = 65536;
3834 else
3835 editor->nTextLimit = (int) lParam;
3836 return 0;
3837 }
3838 case EM_LIMITTEXT:
3839 {
3840 if (wParam == 0)
3841 editor->nTextLimit = 65536;
3842 else
3843 editor->nTextLimit = (int) wParam;
3844 return 0;
3845 }
3846 case EM_GETLIMITTEXT:
3847 {
3848 return editor->nTextLimit;
3849 }
3850 case EM_FINDTEXT:
3851 case EM_FINDTEXTW:
3852 {
3853 FINDTEXTW *ft = (FINDTEXTW *)lParam;
3854 return ME_FindText(editor, wParam, &ft->chrg, ft->lpstrText, NULL);
3855 }
3856 case EM_FINDTEXTEX:
3857 case EM_FINDTEXTEXW:
3858 {
3860 return ME_FindText(editor, wParam, &ex->chrg, ex->lpstrText, &ex->chrgText);
3861 }
3862 case EM_GETZOOM:
3863 if (!wParam || !lParam)
3864 return FALSE;
3865 *(int *)wParam = editor->nZoomNumerator;
3866 *(int *)lParam = editor->nZoomDenominator;
3867 return TRUE;
3868 case EM_SETZOOM:
3869 return ME_SetZoom(editor, wParam, lParam);
3870 case EM_CHARFROMPOS:
3871 {
3873 if (ME_CharFromPos(editor, ((POINTL *)lParam)->x, ((POINTL *)lParam)->y,
3874 &cursor, NULL))
3875 return ME_GetCursorOfs(&cursor);
3876 else
3877 return -1;
3878 }
3879 case EM_POSFROMCHAR:
3880 {
3882 int nCharOfs, nLength;
3883 POINTL pt = {0,0};
3884
3885 nCharOfs = wParam;
3886 /* detect which API version we're dealing with */
3887 if (wParam >= 0x40000)
3888 nCharOfs = lParam;
3889 nLength = ME_GetTextLength(editor);
3890 nCharOfs = min(nCharOfs, nLength);
3891 nCharOfs = max(nCharOfs, 0);
3892
3893 cursor_from_char_ofs( editor, nCharOfs, &cursor );
3894 pt.y = cursor.run->pt.y;
3895 pt.x = cursor.run->pt.x +
3896 ME_PointFromChar( editor, cursor.run, cursor.nOffset, TRUE );
3897 pt.y += cursor.para->pt.y + editor->rcFormat.top;
3898 pt.x += editor->rcFormat.left;
3899
3900 pt.x -= editor->horz_si.nPos;
3901 pt.y -= editor->vert_si.nPos;
3902
3903 if (wParam >= 0x40000) *(POINTL *)wParam = pt;
3904
3905 return (wParam >= 0x40000) ? 0 : MAKELONG( pt.x, pt.y );
3906 }
3907 case WM_LBUTTONDBLCLK:
3908 case WM_LBUTTONDOWN:
3909 {
3910 ME_CommitUndo(editor); /* End coalesced undos for typed characters */
3912 ME_LButtonDown(editor, (short)LOWORD(lParam), (short)HIWORD(lParam),
3915 editor->bMouseCaptured = TRUE;
3916 link_notify( editor, msg, wParam, lParam );
3917 break;
3918 }
3919 case WM_MOUSEMOVE:
3920 if (editor->bMouseCaptured)
3921 ME_MouseMove(editor, (short)LOWORD(lParam), (short)HIWORD(lParam));
3922 else
3923 link_notify( editor, msg, wParam, lParam );
3924 break;
3925 case WM_LBUTTONUP:
3926 if (editor->bMouseCaptured) {
3928 editor->bMouseCaptured = FALSE;
3929 }
3930 if (editor->nSelectionType == stDocument)
3931 editor->nSelectionType = stPosition;
3932 else
3933 {
3934 link_notify( editor, msg, wParam, lParam );
3935 }
3936 break;
3937 case WM_RBUTTONUP:
3938 case WM_RBUTTONDOWN:
3939 case WM_RBUTTONDBLCLK:
3940 ME_CommitUndo(editor); /* End coalesced undos for typed characters */
3941 link_notify( editor, msg, wParam, lParam );
3942 goto do_default;
3943 case WM_CONTEXTMENU:
3944 if (!ME_ShowContextMenu(editor, (short)LOWORD(lParam), (short)HIWORD(lParam)))
3945 goto do_default;
3946 break;
3947 case WM_SETFOCUS:
3948 editor->bHaveFocus = TRUE;
3949 create_caret(editor);
3950 update_caret(editor);
3952 if (!editor->bHideSelection && (editor->props & TXTBIT_HIDESELECTION))
3953 ME_InvalidateSelection( editor );
3954 return 0;
3955 case WM_KILLFOCUS:
3956 ME_CommitUndo(editor); /* End coalesced undos for typed characters */
3957 editor->bHaveFocus = FALSE;
3958 editor->wheel_remain = 0;
3959 hide_caret(editor);
3960 DestroyCaret();
3962 if (!editor->bHideSelection && (editor->props & TXTBIT_HIDESELECTION))
3963 ME_InvalidateSelection( editor );
3964 return 0;
3965 case WM_COMMAND:
3966 TRACE("editor wnd command = %d\n", LOWORD(wParam));
3967 return 0;
3968 case WM_KEYDOWN:
3969 if (ME_KeyDown(editor, LOWORD(wParam)))
3970 return 0;
3971 goto do_default;
3972 case WM_CHAR:
3973 return handle_wm_char( editor, wParam, lParam );
3974 case WM_UNICHAR:
3975 if (wParam == UNICODE_NOCHAR) return TRUE;
3976 if (wParam <= 0x000fffff)
3977 {
3978 if (wParam > 0xffff) /* convert to surrogates */
3979 {
3980 wParam -= 0x10000;
3981 handle_wm_char( editor, (wParam >> 10) + 0xd800, 0 );
3982 handle_wm_char( editor, (wParam & 0x03ff) + 0xdc00, 0 );
3983 }
3984 else
3985 handle_wm_char( editor, wParam, 0 );
3986 }
3987 return 0;
3988 case EM_STOPGROUPTYPING:
3989 ME_CommitUndo(editor); /* End coalesced undos for typed characters */
3990 return 0;
3991 case WM_HSCROLL:
3992 {
3993 const int scrollUnit = 7;
3994
3995 switch(LOWORD(wParam))
3996 {
3997 case SB_LEFT:
3998 scroll_abs( editor, 0, 0, TRUE );
3999 break;
4000 case SB_RIGHT:
4001 scroll_abs( editor, editor->horz_si.nMax - (int)editor->horz_si.nPage,
4002 editor->vert_si.nMax - (int)editor->vert_si.nPage, TRUE );
4003 break;
4004 case SB_LINELEFT:
4005 ME_ScrollLeft(editor, scrollUnit);
4006 break;
4007 case SB_LINERIGHT:
4008 ME_ScrollRight(editor, scrollUnit);
4009 break;
4010 case SB_PAGELEFT:
4011 ME_ScrollLeft(editor, editor->sizeWindow.cx);
4012 break;
4013 case SB_PAGERIGHT:
4014 ME_ScrollRight(editor, editor->sizeWindow.cx);
4015 break;
4016 case SB_THUMBTRACK:
4017 case SB_THUMBPOSITION:
4018 {
4019 int pos = HIWORD(wParam);
4020 if (editor->horz_si.nMax > 0xffff)
4021 pos = MulDiv(pos, editor->horz_si.nMax, 0xffff);
4022 scroll_h_abs( editor, pos, FALSE );
4023 break;
4024 }
4025 }
4026 break;
4027 }
4028 case EM_SCROLL: /* fall through */
4029 case WM_VSCROLL:
4030 {
4031 int origNPos;
4032 int lineHeight = get_default_line_height( editor );
4033
4034 origNPos = editor->vert_si.nPos;
4035
4036 switch(LOWORD(wParam))
4037 {
4038 case SB_TOP:
4039 scroll_abs( editor, 0, 0, TRUE );
4040 break;
4041 case SB_BOTTOM:
4042 scroll_abs( editor, editor->horz_si.nMax - (int)editor->horz_si.nPage,
4043 editor->vert_si.nMax - (int)editor->vert_si.nPage, TRUE );
4044 break;
4045 case SB_LINEUP:
4046 ME_ScrollUp(editor,lineHeight);
4047 break;
4048 case SB_LINEDOWN:
4049 ME_ScrollDown(editor,lineHeight);
4050 break;
4051 case SB_PAGEUP:
4052 ME_ScrollUp(editor,editor->sizeWindow.cy);
4053 break;
4054 case SB_PAGEDOWN:
4055 ME_ScrollDown(editor,editor->sizeWindow.cy);
4056 break;
4057 case SB_THUMBTRACK:
4058 case SB_THUMBPOSITION:
4059 {
4060 int pos = HIWORD(wParam);
4061 if (editor->vert_si.nMax > 0xffff)
4062 pos = MulDiv(pos, editor->vert_si.nMax, 0xffff);
4063 scroll_v_abs( editor, pos, FALSE );
4064 break;
4065 }
4066 }
4067 if (msg == EM_SCROLL)
4068 return 0x00010000 | (((editor->vert_si.nPos - origNPos)/lineHeight) & 0xffff);
4069 break;
4070 }
4071 case WM_MOUSEWHEEL:
4072 {
4073 int delta = GET_WHEEL_DELTA_WPARAM( wParam );
4074 BOOL ctrl_is_down = GetKeyState( VK_CONTROL ) & 0x8000;
4075
4076 /* if scrolling changes direction, ignore left overs */
4077 if ((delta < 0 && editor->wheel_remain < 0) ||
4078 (delta > 0 && editor->wheel_remain > 0))
4079 editor->wheel_remain += delta;
4080 else
4081 editor->wheel_remain = delta;
4082
4083 if (editor->wheel_remain)
4084 {
4085 if (ctrl_is_down) {
4086 int numerator;
4087 if (!editor->nZoomNumerator || !editor->nZoomDenominator)
4088 {
4089 numerator = 100;
4090 } else {
4091 numerator = editor->nZoomNumerator * 100 / editor->nZoomDenominator;
4092 }
4093 numerator += calc_wheel_change( &editor->wheel_remain, 10 );
4094 if (numerator >= 10 && numerator <= 500)
4095 ME_SetZoom(editor, numerator, 100);
4096 } else {
4097 UINT max_lines = 3;
4098 int lines = 0;
4099
4100 SystemParametersInfoW( SPI_GETWHEELSCROLLLINES, 0, &max_lines, 0 );
4101 if (max_lines)
4102 lines = calc_wheel_change( &editor->wheel_remain, (int)max_lines );
4103 if (lines)
4104 ME_ScrollDown( editor, -lines * get_default_line_height( editor ) );
4105 }
4106 }
4107 break;
4108 }
4109 case EM_REQUESTRESIZE:
4110 ME_SendRequestResize(editor, TRUE);
4111 return 0;
4112#ifndef __REACTOS__
4113 /* IME messages to make richedit controls IME aware */
4114#endif
4115 case WM_IME_SETCONTEXT:
4116#ifdef __REACTOS__
4117 {
4118 if (FALSE) /* FIXME: Condition */
4119 lParam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
4120
4121 if (wParam)
4122 {
4123 HIMC hIMC = ImmGetContext(editor->hWnd);
4125 if (pIC)
4126 {
4127 pIC->dwUIFlags &= ~0x40000;
4128 ImmUnlockIMC(hIMC);
4129 }
4130 if (FALSE) /* FIXME: Condition */
4132 ImmReleaseContext(editor->hWnd, hIMC);
4133 }
4134
4135 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4136 }
4137#endif
4138 case WM_IME_CONTROL:
4139#ifdef __REACTOS__
4140 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4141#endif
4142 case WM_IME_SELECT:
4143#ifdef __REACTOS__
4144 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4145#endif
4147 return 0;
4148 case WM_IME_STARTCOMPOSITION:
4149 {
4150#ifdef __REACTOS__
4151 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4152#else
4153 editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]);
4154 ME_DeleteSelection(editor);
4155 ME_CommitUndo(editor);
4156 ME_UpdateRepaint(editor, FALSE);
4157#endif
4158 return 0;
4159 }
4160 case WM_IME_COMPOSITION:
4161 {
4162 HIMC hIMC;
4163
4164 ME_Style *style = style_get_insert_style( editor, editor->pCursors );
4165 hIMC = ITextHost_TxImmGetContext(editor->texthost);
4166 ME_DeleteSelection(editor);
4167 ME_SaveTempStyle(editor, style);
4169 {
4170 LPWSTR lpCompStr = NULL;
4172 DWORD dwIndex = lParam & GCS_RESULTSTR;
4173 if (!dwIndex)
4174 dwIndex = GCS_COMPSTR;
4175
4176 dwBufLen = ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0);
4177 lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
4178 ImmGetCompositionStringW(hIMC, dwIndex, lpCompStr, dwBufLen);
4179 lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
4180#ifndef __REACTOS__
4181 ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style);
4182#endif
4183 HeapFree(GetProcessHeap(), 0, lpCompStr);
4184
4185#ifndef __REACTOS__
4186 if (dwIndex == GCS_COMPSTR)
4187 set_selection_cursors(editor,editor->imeStartIndex,
4188 editor->imeStartIndex + dwBufLen/sizeof(WCHAR));
4189#endif
4190 }
4192 ME_CommitUndo(editor);
4193 ME_UpdateRepaint(editor, FALSE);
4194#ifdef __REACTOS__
4195 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4196#else
4197 return 0;
4198#endif
4199 }
4200 case WM_IME_ENDCOMPOSITION:
4201 {
4202#ifdef __REACTOS__
4203 return DefWindowProcW(editor->hWnd, msg, wParam, lParam);
4204#else
4205 ME_DeleteSelection(editor);
4206 editor->imeStartIndex=-1;
4207 return 0;
4208#endif
4209 }
4210 case EM_GETOLEINTERFACE:
4211 IRichEditOle_AddRef( editor->richole );
4212 *(IRichEditOle **)lParam = editor->richole;
4213 return 1;
4214
4215 case EM_SETOLECALLBACK:
4216 if(editor->lpOleCallback)
4217 IRichEditOleCallback_Release(editor->lpOleCallback);
4219 if(editor->lpOleCallback)
4220 IRichEditOleCallback_AddRef(editor->lpOleCallback);
4221 return TRUE;
4223 return (LRESULT)editor->pfnWordBreak;
4225 {
4226 EDITWORDBREAKPROCW pfnOld = editor->pfnWordBreak;
4227
4229 return (LRESULT)pfnOld;
4230 }
4231 case EM_GETTEXTMODE:
4232 return editor->mode;
4233 case EM_SETTEXTMODE:
4234 {
4235 int mask = 0;
4236 int changes = 0;
4237
4238 if (ME_GetTextLength(editor) ||
4239 !list_empty( &editor->undo_stack ) || !list_empty( &editor->redo_stack ))
4240 return E_UNEXPECTED;
4241
4242 /* Check for mutually exclusive flags in adjacent bits of wParam */
4245 return E_INVALIDARG;
4246
4248 {
4251 if (wParam & TM_PLAINTEXT) {
4252 /* Clear selection since it should be possible to select the
4253 * end of text run for rich text */
4254 ME_InvalidateSelection(editor);
4255 ME_SetCursorToStart(editor, &editor->pCursors[0]);
4256 editor->pCursors[1] = editor->pCursors[0];
4257 /* plain text can only have the default style. */
4258 ME_ClearTempStyle(editor);
4260 ME_ReleaseStyle( editor->pCursors[0].run->style );
4261 editor->pCursors[0].run->style = editor->pBuffer->pDefaultStyle;
4262 }
4263 }
4264 /* FIXME: Currently no support for undo level and code page options */
4265 editor->mode = (editor->mode & ~mask) | changes;
4266 return 0;
4267 }
4268 case EM_SETTARGETDEVICE:
4269 if (wParam == 0)
4270 {
4271 BOOL new = (lParam == 0 && (editor->props & TXTBIT_MULTILINE));
4272 if (editor->nAvailWidth || editor->bWordWrap != new)
4273 {
4274 editor->bWordWrap = new;
4275 editor->nAvailWidth = 0; /* wrap to client area */
4276 ME_RewrapRepaint(editor);
4277 }
4278 } else {
4279 int width = max(0, lParam);
4280 if ((editor->props & TXTBIT_MULTILINE) &&
4281 (!editor->bWordWrap || editor->nAvailWidth != width))
4282 {
4283 editor->nAvailWidth = width;
4284 editor->bWordWrap = TRUE;
4285 ME_RewrapRepaint(editor);
4286 }
4287 FIXME("EM_SETTARGETDEVICE doesn't use non-NULL target devices\n");
4288 }
4289 return TRUE;
4290 default:
4291 do_default:
4292 *phresult = S_FALSE;
4293 break;
4294 }
4295 return 0L;
4296}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define msg(x)
Definition: auth_time.c:54
static int list_empty(struct list_entry *head)
Definition: list.h:58
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:899
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD HIMC
Definition: dimm.idl:75
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1744
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:880
BOOL WINAPI ImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD_PTR dwValue)
Definition: ime.c:907
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1067
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1045
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1086
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1058
const WCHAR * text
Definition: package.c:1794
#define CP_UNICODE
Definition: stg_prop.c:74
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:27
void ME_DeleteSelection(ME_TextEditor *editor)
Definition: caret.c:1406
int ME_GetCursorOfs(const ME_Cursor *cursor)
Definition: caret.c:889
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style)
Definition: caret.c:553
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
Definition: caret.c:1137
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
Definition: caret.c:91
void hide_caret(ME_TextEditor *editor)
Definition: caret.c:267
void ME_MouseMove(ME_TextEditor *editor, int x, int y)
Definition: caret.c:1199
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact)
Definition: caret.c:1039
int set_selection_cursors(ME_TextEditor *editor, int from, int to)
Definition: caret.c:132
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to)
Definition: caret.c:42
void create_caret(ME_TextEditor *editor)
Definition: caret.c:251
void update_caret(ME_TextEditor *editor)
Definition: caret.c:277
ME_Style * ME_GetSelectionInsertStyle(ME_TextEditor *editor)
Definition: caret.c:1415
static void ME_StreamInRTFString(ME_TextEditor *editor, BOOL selection, char *string)
Definition: editor.c:1829
static BOOL paste_special(ME_TextEditor *editor, UINT cf, REPASTESPECIAL *ps, BOOL check_only)
Definition: editor.c:2278
#define UNSUPPORTED_MSG(e)
Definition: editor.c:3245
static int ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCHAR *text, CHARRANGE *chrgText)
Definition: editor.c:1844
static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stream, BOOL stripLastCR)
Definition: editor.c:1575
static void ME_SetText(ME_TextEditor *editor, void *text, BOOL unicode)
Definition: editor.c:3185
void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len)
Definition: editor.c:3161
static void ME_UpdateSelectionLinkAttribute(ME_TextEditor *editor)
Definition: editor.c:2391
static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
Definition: editor.c:2911
#define STACK_SIZE_MAX
Definition: editor.c:247
static LRESULT handle_EM_SETCHARFORMAT(ME_TextEditor *editor, WPARAM flags, const CHARFORMAT2W *fmt_in)
Definition: editor.c:3195
static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
Definition: editor.c:2087
static int calc_wheel_change(int *remain, int amount_per_click)
Definition: editor.c:3115
static int get_text_range(ME_TextEditor *editor, WCHAR *buffer, const ME_Cursor *start, int len)
Definition: editor.c:2139
#define STACK_SIZE_DEFAULT
Definition: editor.c:246
static BOOL copy_or_cut(ME_TextEditor *editor, BOOL cut)
Definition: editor.c:2375
static int get_default_line_height(ME_TextEditor *editor)
Definition: editor.c:3104
static LONG ME_GetSelectionType(ME_TextEditor *editor)
Definition: editor.c:2872
static BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, ME_Cursor *start, int nChars)
Definition: editor.c:4547
static LRESULT handle_wm_char(ME_TextEditor *editor, WCHAR wstr, LPARAM flags)
Definition: editor.c:2683
static BOOL ME_KeyDown(ME_TextEditor *editor, WORD nKey)
Definition: editor.c:2560
void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:3122
ME_Paragraph * editor_end_para(ME_TextEditor *editor)
Definition: editor.c:285
static int ME_CalculateClickCount(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:2769
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define pt(x, y)
Definition: drawing.c:79
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:462
BOOL editor_set_selection_para_fmt(ME_TextEditor *editor, const PARAFORMAT2 *fmt) DECLSPEC_HIDDEN
Definition: para.c:875
#define ITextHost_TxSetFocus(This)
Definition: editor.h:348
void scroll_h_abs(ME_TextEditor *editor, int x, BOOL notify) DECLSPEC_HIDDEN
Definition: paint.c:1117
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: wrap.c:1094
void row_first_cursor(ME_Row *row, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: row.c:82
void ME_ScrollRight(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
Definition: paint.c:1142
void editor_mark_rewrap_all(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: para.c:237
void ME_SaveTempStyle(ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN
Definition: style.c:498
int row_number_from_char_ofs(ME_TextEditor *editor, int ofs) DECLSPEC_HIDDEN
Definition: row.c:131
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN
Definition: paint.c:1304
void cursor_from_char_ofs(ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: run.c:240
ME_Row * para_first_row(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:132
BOOL ME_Redo(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:448
void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:1147
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:53
void scroll_v_abs(ME_TextEditor *editor, int y, BOOL notify) DECLSPEC_HIDDEN
Definition: paint.c:1122
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: run.c:842
#define ITextHost_TxSetCapture(This, a)
Definition: editor.h:347
ME_Style * style_get_insert_style(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: style.c:476
ME_Run * row_next_run(ME_Row *row, ME_Run *run) DECLSPEC_HIDDEN
Definition: row.c:63
#define ITextHost_TxNotify(This, a, b)
Definition: editor.h:368
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
Definition: style.c:331
ME_Row * row_next(ME_Row *row) DECLSPEC_HIDDEN
Definition: row.c:27
void ME_EndToUnicode(LONG codepage, LPVOID psz) DECLSPEC_HIDDEN
Definition: string.c:248
ME_Run * run_prev_all_paras(ME_Run *run) DECLSPEC_HIDDEN
Definition: run.c:110
void ME_ScrollLeft(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
Definition: paint.c:1137
ME_Row * row_from_row_number(ME_TextEditor *editor, int row_num) DECLSPEC_HIDDEN
Definition: row.c:111
void ME_ScrollUp(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
Definition: paint.c:1127
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:1247
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: run.c:853
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:156
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN
Definition: style.c:524
void editor_ensure_visible(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: paint.c:1206
ME_Paragraph * para_prev(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:63
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: run.c:748
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: style.c:507
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:119
#define ITextHost_TxImmGetContext(This)
Definition: editor.h:369
ME_Run * para_end_run(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:117
void row_end_cursor(ME_Row *row, ME_Cursor *cursor, BOOL include_eop) DECLSPEC_HIDDEN
Definition: row.c:92
void editor_get_selection_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *fmt) DECLSPEC_HIDDEN
Definition: para.c:905
void ME_ScrollDown(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
Definition: paint.c:1132
BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
Definition: style.c:79
LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len) DECLSPEC_HIDDEN
Definition: string.c:226
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) DECLSPEC_HIDDEN
Definition: writer.c:1195
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: run.c:777
void scroll_abs(ME_TextEditor *editor, int x, int y, BOOL notify) DECLSPEC_HIDDEN
Definition: paint.c:1087
BOOL ME_Undo(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:410
@ stPosition
Definition: editstr.h:356
@ stDocument
Definition: editstr.h:360
POINTL point
Definition: edittest.c:50
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLint * range
Definition: glext.h:7539
GLenum GLenum dst
Definition: glext.h:6340
GLuint64EXT * result
Definition: glext.h:11304
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
#define CPS_CANCEL
Definition: imm.h:181
#define GCS_RESULTSTR
Definition: imm.h:234
#define GCS_COMPSTR
Definition: imm.h:227
#define NI_COMPOSITIONSTR
Definition: immdev.h:403
#define INT_MAX
Definition: intsafe.h:150
JSAMPARRAY JDIMENSION max_lines
Definition: jpeglib.h:1058
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static char * dest
Definition: rtl.c:135
#define set_selection(hctl, start, end)
unsigned int * PUINT
Definition: ndis.h:50
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
#define TM_RICHTEXT
Definition: richedit.h:1029
#define TM_MULTILEVELUNDO
Definition: richedit.h:1031
#define EM_GETAUTOURLDETECT
Definition: richedit.h:126
#define EM_CANREDO
Definition: richedit.h:118
#define EM_SCROLLCARET
Definition: richedit.h:81
#define EM_SETPALETTE
Definition: richedit.h:127
#define EM_SETOLECALLBACK
Definition: richedit.h:103
#define EM_GETREDONAME
Definition: richedit.h:120
#define GTL_CLOSE
Definition: richedit.h:1057
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define EM_REDO
Definition: richedit.h:117
#define EM_REQUESTRESIZE
Definition: richedit.h:98
#define EM_GETSELTEXT
Definition: richedit.h:95
#define EM_SETBIDIOPTIONS
Definition: richedit.h:154
#define EM_AUTOURLDETECT
Definition: richedit.h:125
#define EM_FORMATRANGE
Definition: richedit.h:90
#define EM_SETZOOM
Definition: richedit.h:170
#define EM_STREAMIN
Definition: richedit.h:106
#define EM_SETSCROLLPOS
Definition: richedit.h:166
#define ST_SELECTION
Definition: richedit.h:1072
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define EM_CANPASTE
Definition: richedit.h:83
#define WM_UNICHAR
Definition: richedit.h:67
#define ST_KEEPUNDO
Definition: richedit.h:1071
#define EM_GETUNDONAME
Definition: richedit.h:119
#define EM_GETTEXTMODE
Definition: richedit.h:124
#define EM_GETWORDBREAKPROCEX
Definition: richedit.h:113
#define EM_GETBIDIOPTIONS
Definition: richedit.h:155
#define EM_SETTEXTEX
Definition: richedit.h:131
#define EM_HIDESELECTION
Definition: richedit.h:96
#define EM_POSFROMCHAR
Definition: richedit.h:77
#define EM_GETCHARFORMAT
Definition: richedit.h:91
#define GTL_NUMCHARS
Definition: richedit.h:1058
#define TM_SINGLECODEPAGE
Definition: richedit.h:1032
struct _charformatw CHARFORMATW
#define EM_SETCHARFORMAT
Definition: richedit.h:101
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define EM_SETFONTSIZE
Definition: richedit.h:168
#define EM_GETLANGOPTIONS
Definition: richedit.h:144
#define EM_GETPARAFORMAT
Definition: richedit.h:94
#define EM_SETWORDBREAKPROCEX
Definition: richedit.h:114
#define EM_DISPLAYBAND
Definition: richedit.h:84
#define EM_SETLANGOPTIONS
Definition: richedit.h:143
#define EM_CHARFROMPOS
Definition: richedit.h:78
#define EM_GETEDITSTYLE
Definition: richedit.h:161
#define EM_GETTEXTRANGE
Definition: richedit.h:108
#define EM_SETTEXTMODE
Definition: richedit.h:123
#define CFM_SIZE
Definition: richedit.h:362
#define EM_FINDTEXTW
Definition: richedit.h:147
#define EM_GETZOOM
Definition: richedit.h:169
#define EM_EXSETSEL
Definition: richedit.h:88
#define EM_GETSCROLLPOS
Definition: richedit.h:165
#define EM_EXLIMITTEXT
Definition: richedit.h:86
#define EM_PASTESPECIAL
Definition: richedit.h:97
#define EM_SELECTIONTYPE
Definition: richedit.h:99
#define EM_FINDTEXT
Definition: richedit.h:89
#define TM_PLAINTEXT
Definition: richedit.h:1028
#define EM_STOPGROUPTYPING
Definition: richedit.h:121
#define EM_SETTYPOGRAPHYOPTIONS
Definition: richedit.h:157
#define EM_GETTEXTLENGTHEX
Definition: richedit.h:129
#define EM_SETTARGETDEVICE
Definition: richedit.h:105
#define EM_GETLIMITTEXT
Definition: richedit.h:74
#define EM_EXLINEFROMCHAR
Definition: richedit.h:87
#define GT_USECRLF
Definition: richedit.h:1037
#define EM_GETIMECOMPMODE
Definition: richedit.h:145
#define EM_GETOLEINTERFACE
Definition: richedit.h:93
#define EM_GETTEXTEX
Definition: richedit.h:128
#define EM_SETPARAFORMAT
Definition: richedit.h:104
#define EM_FINDTEXTEXW
Definition: richedit.h:148
#define TM_SINGLELEVELUNDO
Definition: richedit.h:1030
#define EM_EXGETSEL
Definition: richedit.h:85
#define EM_GETTYPOGRAPHYOPTIONS
Definition: richedit.h:158
#define EM_FINDTEXTEX
Definition: richedit.h:112
#define EM_SETUNDOLIMIT
Definition: richedit.h:116
#define GTL_USECRLF
Definition: richedit.h:1055
#define EM_FINDWORDBREAK
Definition: richedit.h:109
#define TM_MULTICODEPAGE
Definition: richedit.h:1033
#define EM_SETEDITSTYLE
Definition: richedit.h:160
#define EM_STREAMOUT
Definition: richedit.h:107
#define CP_UTF8
Definition: nls.h:20
static char utf8_bom[3]
Definition: file.c:108
static CHANGE * changes
Definition: io.c:49
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
DWORD dwMask
Definition: richedit.h:306
LONG cpMax
Definition: richedit.h:501
LONG cpMin
Definition: richedit.h:500
CHARRANGE chrg
Definition: richedit.h:586
LPCWSTR lpstrText
Definition: richedit.h:587
UINT codepage
Definition: richedit.h:1066
DWORD flags
Definition: richedit.h:1065
CHARRANGE chrg
Definition: richedit.h:514
LPWSTR lpstrText
Definition: richedit.h:515
Definition: comerr.c:44
ME_Style * style
Definition: editstr.h:159
ME_Style * pDefaultStyle
Definition: editstr.h:269
EDITWORDBREAKPROCW pfnWordBreak
Definition: editstr.h:417
struct list redo_stack
Definition: editstr.h:405
int nZoomNumerator
Definition: editstr.h:413
ME_SelectionType nSelectionType
Definition: editstr.h:434
BOOL AutoURLDetect_bEnable
Definition: editstr.h:426
LPRICHEDITOLECALLBACK lpOleCallback
Definition: editstr.h:419
int nZoomDenominator
Definition: editstr.h:413
IRichEditOle * richole
Definition: editstr.h:418
BOOL bMouseCaptured
Definition: editstr.h:446
unsigned int bEmulateVersion10
Definition: editstr.h:385
struct list undo_stack
Definition: editstr.h:404
BOOL bHideSelection
Definition: editstr.h:425
#define TXTBIT_MULTILINE
Definition: textserv.h:186
#define TXTBIT_HIDESELECTION
Definition: textserv.h:190
#define WM_MOUSEWHEEL
Definition: treelist.c:96
eMaj lines
Definition: tritemp.h:206
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
_In_ DWORD nLength
Definition: wincon.h:473
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4246
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define S_FALSE
Definition: winerror.h:2357
#define E_UNEXPECTED
Definition: winerror.h:2456
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define SYSTEM_FONT
Definition: wingdi.h:911
#define EM_GETIMESTATUS
Definition: winuser.h:1998
#define WM_GETTEXTLENGTH
Definition: winuser.h:1630
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
#define EM_LIMITTEXT
Definition: winuser.h:2011
#define SB_THUMBTRACK
Definition: winuser.h:573
#define EM_LINEFROMCHAR
Definition: winuser.h:2012
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1754
#define WM_PASTE
Definition: winuser.h:1874
#define EN_KILLFOCUS
Definition: winuser.h:2036
#define EM_GETWORDBREAKPROC
Definition: winuser.h:2010
#define EM_FMTLINES
Definition: winuser.h:1997
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_VSCROLL
Definition: winuser.h:1755
#define EM_SETIMESTATUS
Definition: winuser.h:2021
#define EM_GETSEL
Definition: winuser.h:2008
#define EN_SETFOCUS
Definition: winuser.h:2038
#define EM_GETMODIFY
Definition: winuser.h:2005
#define SB_PAGERIGHT
Definition: winuser.h:571
#define EM_EMPTYUNDOBUFFER
Definition: winuser.h:1996
#define SB_LEFT
Definition: winuser.h:575
#define SB_BOTTOM
Definition: winuser.h:577
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1789
#define WM_COMMAND
Definition: winuser.h:1751
#define EM_REPLACESEL
Definition: winuser.h:2017
#define VK_CONTROL
Definition: winuser.h:2214
#define WM_RBUTTONUP
Definition: winuser.h:1791
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1792
#define WM_SETFOCUS
Definition: winuser.h:1624
#define WM_MOUSEMOVE
Definition: winuser.h:1786
#define WM_GETTEXT
Definition: winuser.h:1629
#define WM_CUT
Definition: winuser.h:1872
#define SB_LINERIGHT
Definition: winuser.h:567
#define WM_LBUTTONDOWN
Definition: winuser.h:1787
#define EM_LINEINDEX
Definition: winuser.h:2013
#define EM_LINESCROLL
Definition: winuser.h:2015
#define EM_GETFIRSTVISIBLELINE
Definition: winuser.h:1999
#define WM_UNDO
Definition: winuser.h:1876
#define WM_IME_SETCONTEXT
Definition: winuser.h:1840
#define WM_RBUTTONDOWN
Definition: winuser.h:1790
#define WM_SETTEXT
Definition: winuser.h:1628
#define EM_CANUNDO
Definition: winuser.h:1994
#define EM_LINELENGTH
Definition: winuser.h:2014
#define EM_GETLINE
Definition: winuser.h:2002
#define SB_LINELEFT
Definition: winuser.h:566
#define WM_SETFONT
Definition: winuser.h:1661
#define EM_UNDO
Definition: winuser.h:2032
#define EM_SCROLL
Definition: winuser.h:2018
#define SB_PAGEDOWN
Definition: winuser.h:569
#define EM_SETWORDBREAKPROC
Definition: winuser.h:2031
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2029
int(CALLBACK * EDITWORDBREAKPROCW)(LPWSTR, int, int, int)
Definition: winuser.h:2916
#define WM_LBUTTONUP
Definition: winuser.h:1788
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1843
#define WM_CHAR
Definition: winuser.h:1728
#define SB_TOP
Definition: winuser.h:578
#define WM_COPY
Definition: winuser.h:1873
#define WM_IME_CONTROL
Definition: winuser.h:1842
#define EM_SETTABSTOPS
Definition: winuser.h:2030
#define WM_IME_SELECT
Definition: winuser.h:1844
#define WM_CLEAR
Definition: winuser.h:1875
#define WM_KEYDOWN
Definition: winuser.h:1726
#define EM_GETLINECOUNT
Definition: winuser.h:2003
#define SB_RIGHT
Definition: winuser.h:576
BOOL WINAPI DestroyCaret(void)
Definition: caret.c:35
#define EM_SETMARGINS
Definition: winuser.h:2023
#define WM_KILLFOCUS
Definition: winuser.h:1625
#define SB_PAGEUP
Definition: winuser.h:568
#define WM_MBUTTONDOWN
Definition: winuser.h:1793
#define EM_SETMODIFY
Definition: winuser.h:2024
SHORT WINAPI GetKeyState(_In_ int)
#define SB_PAGELEFT
Definition: winuser.h:570
#define SB_THUMBPOSITION
Definition: winuser.h:572
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by fnTextSrv_TxSendMessage().

◆ editor_mark_rewrap_all()

void editor_mark_rewrap_all ( ME_TextEditor editor)

Definition at line 237 of file para.c.

238{
239 para_mark_rewrap_paras( editor, editor_first_para( editor ), editor_end_para( editor ) );
240}
static void para_mark_rewrap_paras(ME_TextEditor *editor, ME_Paragraph *first, const ME_Paragraph *end)
Definition: para.c:228

Referenced by editor_handle_message(), fnTextSrv_TxDraw(), fnTextSrv_TxGetNaturalSize(), ME_RewrapRepaint(), and ME_SetDefaultCharFormat().

◆ editor_propagate_char_ofs()

void editor_propagate_char_ofs ( ME_Paragraph para,
ME_Run run,
int  shift 
)

Definition at line 147 of file run.c.

148{
149 assert( !para ^ !run );
150
151 if (run)
152 {
153 para = para_next( run->para );
154 do
155 {
156 run->nCharOfs += shift;
157 run = run_next( run );
158 } while (run);
159 }
160
161 do
162 {
163 para->nCharOfs += shift;
164 para = para_next( para );
165 } while (para);
166}
#define shift
Definition: input.c:1755
struct tagME_Paragraph * para
Definition: editstr.h:160

Referenced by ME_InternalDeleteText(), para_join(), para_split(), and run_insert().

◆ editor_set_cursor()

void editor_set_cursor ( ME_TextEditor editor,
int  x,
int  y 
)

Definition at line 2824 of file editor.c.

2825{
2826 ME_Cursor pos;
2827 BOOL is_exact;
2828 static HCURSOR cursor_arrow, cursor_hand, cursor_ibeam, cursor_reverse;
2830
2831 if (!cursor_arrow)
2832 {
2833 cursor_arrow = LoadCursorW( NULL, MAKEINTRESOURCEW( IDC_ARROW ) );
2834 cursor_hand = LoadCursorW( NULL, MAKEINTRESOURCEW( IDC_HAND ) );
2835 cursor_ibeam = LoadCursorW( NULL, MAKEINTRESOURCEW( IDC_IBEAM ) );
2836 cursor_reverse = LoadCursorW( dll_instance, MAKEINTRESOURCEW( OCR_REVERSE ) );
2837 }
2838
2839 cursor = cursor_ibeam;
2840
2841 if ((editor->nSelectionType == stLine && editor->bMouseCaptured) ||
2842 (!editor->bEmulateVersion10 && y < editor->rcFormat.top && x < editor->rcFormat.left))
2843 cursor = cursor_reverse;
2844 else if (y < editor->rcFormat.top || y > editor->rcFormat.bottom)
2845 {
2846 if (editor->bEmulateVersion10) cursor = cursor_arrow;
2847 else cursor = cursor_ibeam;
2848 }
2849 else if (x < editor->rcFormat.left) cursor = cursor_reverse;
2850 else
2851 {
2852 ME_CharFromPos( editor, x, y, &pos, &is_exact );
2853 if (is_exact)
2854 {
2855 ME_Run *run = pos.run;
2856
2857 if (is_link( run )) cursor = cursor_hand;
2858
2859 else if (ME_IsSelection( editor ))
2860 {
2861 int start, end, offset = ME_GetCursorOfs( &pos );
2862
2863 ME_GetSelectionOfs( editor, &start, &end );
2864 if (start <= offset && end >= offset) cursor = cursor_arrow;
2865 }
2866 }
2867 }
2868
2869 ITextHost_TxSetCursor( editor->texthost, cursor, cursor == cursor_ibeam );
2870}
BOOL ME_IsSelection(ME_TextEditor *editor)
Definition: caret.c:1400
HINSTANCE dll_instance
Definition: editor.c:255
static BOOL is_link(ME_Run *run)
Definition: editor.c:2819
#define ITextHost_TxSetCursor(This, a, b)
Definition: editor.h:349
@ stLine
Definition: editstr.h:358
GLintptr offset
Definition: glext.h:5920
#define OCR_REVERSE
Definition: res.h:23
HICON HCURSOR
Definition: windef.h:299
#define IDC_ARROW
Definition: winuser.h:695
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2442
#define IDC_IBEAM
Definition: winuser.h:696
#define IDC_HAND
Definition: winuser.h:706
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by fnTextSrv_OnTxSetCursor().

◆ editor_set_default_para_fmt()

void editor_set_default_para_fmt ( ME_TextEditor editor,
PARAFORMAT2 pFmt 
)

Definition at line 960 of file para.c.

961{
962 const PARAFORMAT2 *host_fmt;
963 HRESULT hr;
964
965 ZeroMemory(pFmt, sizeof(PARAFORMAT2));
966 pFmt->cbSize = sizeof(PARAFORMAT2);
967 pFmt->dwMask = PFM_ALL2;
968 pFmt->wAlignment = PFA_LEFT;
969 pFmt->sStyle = -1;
970 pFmt->bOutlineLevel = TRUE;
971
972 hr = ITextHost_TxGetParaFormat( editor->texthost, (const PARAFORMAT **)&host_fmt );
973 if (SUCCEEDED(hr))
974 {
975 /* Just use the alignment for now */
976 if (host_fmt->dwMask & PFM_ALIGNMENT)
977 pFmt->wAlignment = host_fmt->wAlignment;
979 }
980}
#define ITextHost_OnTxParaFormatChange(This, a)
Definition: editor.h:366
#define ITextHost_TxGetParaFormat(This, a)
Definition: editor.h:357
#define PFA_LEFT
Definition: richedit.h:921
#define PFM_ALL2
Definition: richedit.h:892
struct _paraformat2 PARAFORMAT2
BYTE bOutlineLevel
Definition: richedit.h:678
WORD wAlignment
Definition: richedit.h:673
DWORD dwMask
Definition: richedit.h:667
SHORT sStyle
Definition: richedit.h:677
UINT cbSize
Definition: richedit.h:666

Referenced by handle_enter(), ME_InternalDeleteText(), ME_StreamIn(), and para_create().

◆ editor_set_selection_para_fmt()

BOOL editor_set_selection_para_fmt ( ME_TextEditor editor,
const PARAFORMAT2 fmt 
)

Definition at line 875 of file para.c.

876{
877 ME_Paragraph *para, *para_end;
878
879 editor_get_selection_paras( editor, &para, &para_end );
880
881 do
882 {
883 para_set_fmt( editor, para, fmt );
884 if (para == para_end) break;
885 para = para_next( para );
886 } while(1);
887
888 return TRUE;
889}
static BOOL para_set_fmt(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *pFmt)
Definition: para.c:458

Referenced by editor_handle_message(), and SpecialChar().

◆ get_text()

◆ get_total_width()

int get_total_width ( ME_TextEditor editor)

Definition at line 69 of file para.c.

70{
71 ME_Paragraph *para;
72 int total_width = 0;
73
74 if (editor->pBuffer->pFirst && editor->pBuffer->pLast)
75 {
76 para = &editor->pBuffer->pFirst->next->member.para;
77 while (para != &editor->pBuffer->pLast->member.para && para->next_para)
78 {
79 total_width = max(total_width, para->nWidth);
80 para = &para->next_para->member.para;
81 }
82 }
83
84 return total_width;
85}
struct tagME_DisplayItem * next_para
Definition: editstr.h:216

Referenced by para_destroy(), and wrap_marked_paras_dc().

◆ hide_caret()

void hide_caret ( ME_TextEditor ed)

Definition at line 267 of file caret.c.

268{
269 /* calls to HideCaret are cumulative; do so only once */
270 if (!editor->caret_hidden)
271 {
272 ITextHost_TxShowCaret(editor->texthost, FALSE);
273 editor->caret_hidden = TRUE;
274 }
275}
#define ITextHost_TxShowCaret(This, a)
Definition: editor.h:342

Referenced by editor_handle_message(), ME_ArrowKey(), and update_caret().

◆ link_notify()

void link_notify ( ME_TextEditor editor,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 3122 of file editor.c.

3123{
3124 int x,y;
3125 BOOL isExact;
3126 ME_Cursor cursor; /* The start of the clicked text. */
3127 ME_Run *run;
3128 ENLINK info;
3129
3130 x = (short)LOWORD(lParam);
3131 y = (short)HIWORD(lParam);
3132 ME_CharFromPos(editor, x, y, &cursor, &isExact);
3133 if (!isExact) return;
3134
3135 if (is_link( cursor.run ))
3136 { /* The clicked run has CFE_LINK set */
3137 info.nmhdr.hwndFrom = NULL;
3138 info.nmhdr.idFrom = 0;
3139 info.nmhdr.code = EN_LINK;
3140 info.msg = msg;
3141 info.wParam = wParam;
3142 info.lParam = lParam;
3143 cursor.nOffset = 0;
3144
3145 /* find the first contiguous run with CFE_LINK set */
3146 info.chrg.cpMin = ME_GetCursorOfs(&cursor);
3147 run = cursor.run;
3148 while ((run = run_prev( run )) && is_link( run ))
3149 info.chrg.cpMin -= run->len;
3150
3151 /* find the last contiguous run with CFE_LINK set */
3152 info.chrg.cpMax = ME_GetCursorOfs(&cursor) + cursor.run->len;
3153 run = cursor.run;
3154 while ((run = run_next( run )) && is_link( run ))
3155 info.chrg.cpMax += run->len;
3156
3157 ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
3158 }
3159}
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
ME_Run * run_next(ME_Run *run) DECLSPEC_HIDDEN
Definition: run.c:68
#define EN_LINK
Definition: richedit.h:202

Referenced by editor_handle_message(), and fnTextSrv_OnTxSetCursor().

◆ ME_AddRefStyle()

void ME_AddRefStyle ( ME_Style item)

Definition at line 454 of file style.c.

455{
456 assert(s->nRefs>0); /* style with 0 references isn't supposed to exist */
457 s->nRefs++;
458 all_refs++;
459 TRACE_(richedit_style)("ME_AddRefStyle %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs);
460}
#define TRACE_(x)
Definition: compat.h:76
static int all_refs
Definition: style.c:26
GLdouble s
Definition: gl.h:2039

Referenced by add_undo_insert_run(), editor_handle_message(), ME_ApplyStyle(), ME_RTFReadHook(), ME_SaveTempStyle(), ME_StreamIn(), para_num_init(), RTFUngetToken(), run_create(), and style_get_insert_style().

◆ ME_AppendString()

BOOL ME_AppendString ( ME_String s,
const WCHAR append,
int  len 
)

Definition at line 126 of file string.c.

127{
128 return ME_InsertString( s, s->nLen, append, len );
129}
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
Definition: string.c:103
static void append(struct dump_context *dc, const void *data, unsigned size)
Definition: minidump.c:397

Referenced by para_join(), and para_split().

◆ ME_ApplyStyle()

ME_Style * ME_ApplyStyle ( ME_TextEditor ed,
ME_Style sSrc,
CHARFORMAT2W style 
)

Definition at line 156 of file style.c.

157{
158 CHARFORMAT2W fmt = sSrc->fmt;
159 ME_Style *s;
160
161 assert(mod->cbSize == sizeof(CHARFORMAT2W));
162 COPY_STYLE_ITEM(CFM_ANIMATION, bAnimation);
163 COPY_STYLE_ITEM(CFM_BACKCOLOR, crBackColor);
164 COPY_STYLE_ITEM(CFM_CHARSET, bCharSet);
165 COPY_STYLE_ITEM(CFM_COLOR, crTextColor);
166 COPY_STYLE_ITEM_MEMCPY(CFM_FACE, szFaceName);
167 COPY_STYLE_ITEM(CFM_KERNING, wKerning);
170 COPY_STYLE_ITEM(CFM_REVAUTHOR, bRevAuthor);
171 if (mod->dwMask & CFM_SIZE) {
172 fmt.dwMask |= CFM_SIZE;
173 fmt.yHeight = min(mod->yHeight, yHeightCharPtsMost * 20);
174 }
175 COPY_STYLE_ITEM(CFM_SPACING, sSpacing);
176 COPY_STYLE_ITEM(CFM_STYLE, sStyle);
177 COPY_STYLE_ITEM(CFM_WEIGHT, wWeight);
178 /* FIXME: this is not documented this way, but that's the more logical */
179 COPY_STYLE_ITEM(CFM_FACE, bPitchAndFamily);
180
181 fmt.dwEffects &= ~(mod->dwMask);
182 fmt.dwEffects |= mod->dwEffects & mod->dwMask;
183 fmt.dwMask |= mod->dwMask;
184 if (mod->dwMask & CFM_COLOR)
185 {
186 if (mod->dwEffects & CFE_AUTOCOLOR)
187 fmt.dwEffects |= CFE_AUTOCOLOR;
188 else
189 fmt.dwEffects &= ~CFE_AUTOCOLOR;
190 }
191
192 COPY_STYLE_ITEM(CFM_UNDERLINETYPE, bUnderlineType);
193 /* If the CFM_UNDERLINE effect is not specified, set it appropriately */
194 if ((mod->dwMask & CFM_UNDERLINETYPE) && !(mod->dwMask & CFM_UNDERLINE))
195 {
196 fmt.dwMask |= CFM_UNDERLINE;
197 if (mod->bUnderlineType == CFU_UNDERLINENONE)
198 fmt.dwEffects &= ~CFE_UNDERLINE;
199 else
200 fmt.dwEffects |= CFE_UNDERLINE;
201 }
202
203 if (mod->dwMask & CFM_BOLD && !(mod->dwMask & CFM_WEIGHT))
204 {
205 fmt.wWeight = (mod->dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL;
206 } else if (mod->dwMask & CFM_WEIGHT && !(mod->dwMask & CFM_BOLD)) {
207 if (mod->wWeight > FW_NORMAL)
208 fmt.dwEffects |= CFE_BOLD;
209 else
210 fmt.dwEffects &= ~CFE_BOLD;
211 }
212
213 LIST_FOR_EACH_ENTRY(s, &editor->style_list, ME_Style, entry)
214 {
215 if (!memcmp( &s->fmt, &fmt, sizeof(fmt) ))
216 {
217 TRACE_(richedit_style)("found existing style %p\n", s);
218 ME_AddRefStyle( s );
219 return s;
220 }
221 }
222
223 s = ME_MakeStyle( &fmt );
224 if (s)
225 list_add_head( &editor->style_list, &s->entry );
226 TRACE_(richedit_style)("created new style %p\n", s);
227 return s;
228}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
int yOffset
Definition: appswitch.c:59
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define COPY_STYLE_ITEM(mask, member)
Definition: style.c:138
ME_Style * ME_MakeStyle(CHARFORMAT2W *style)
Definition: style.c:121
void ME_AddRefStyle(ME_Style *s)
Definition: style.c:454
#define COPY_STYLE_ITEM_MEMCPY(mask, member)
Definition: style.c:144
uint32_t entry
Definition: isohybrid.c:63
#define yHeightCharPtsMost
Definition: richedit.h:214
#define CFE_BOLD
Definition: richedit.h:406
#define CFM_STYLE
Definition: richedit.h:351
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define CFM_OFFSET
Definition: richedit.h:359
#define CFM_WEIGHT
Definition: richedit.h:354
#define CFM_SPACING
Definition: richedit.h:353
#define CFM_CHARSET
Definition: richedit.h:358
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFM_BACKCOLOR
Definition: richedit.h:357
#define CFM_KERNING
Definition: richedit.h:352
#define CFM_LCID
Definition: richedit.h:356
#define CFM_REVAUTHOR
Definition: richedit.h:347
#define CFM_ANIMATION
Definition: richedit.h:350
#define CFM_BOLD
Definition: richedit.h:332
#define CFM_UNDERLINETYPE
Definition: richedit.h:355
#define CFU_UNDERLINENONE
Definition: richedit.h:427
#define CFM_UNDERLINE
Definition: richedit.h:334
#define CFM_COLOR
Definition: richedit.h:361
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
CHARFORMAT2W fmt
Definition: editstr.h:72
#define FW_BOLD
Definition: wingdi.h:378
#define FW_NORMAL
Definition: wingdi.h:373

Referenced by ME_RTFCharAttrHook(), ME_SetCharFormat(), ME_SetDefaultCharFormat(), ME_SetSelectionCharFormat(), and para_num_init().

◆ ME_ArrowKey()

BOOL ME_ArrowKey ( ME_TextEditor ed,
int  nVKey,
BOOL  extend,
BOOL  ctrl 
)

Definition at line 1452 of file caret.c.

1453{
1454 int nCursor = 0;
1455 ME_Cursor *p = &editor->pCursors[nCursor];
1456 ME_Cursor tmp_curs = *p;
1457 BOOL success = FALSE;
1458
1459 ME_CheckCharOffsets(editor);
1460 switch(nVKey) {
1461 case VK_LEFT:
1462 if (ctrl)
1463 success = ME_MoveCursorWords(editor, &tmp_curs, -1);
1464 else
1465 success = ME_MoveCursorChars(editor, &tmp_curs, -1, extend);
1466 break;
1467 case VK_RIGHT:
1468 if (ctrl)
1469 success = ME_MoveCursorWords(editor, &tmp_curs, +1);
1470 else
1471 success = ME_MoveCursorChars(editor, &tmp_curs, +1, extend);
1472 break;
1473 case VK_UP:
1474 cursor_move_line( editor, &tmp_curs, TRUE, extend );
1475 break;
1476 case VK_DOWN:
1477 cursor_move_line( editor, &tmp_curs, FALSE, extend );
1478 break;
1479 case VK_PRIOR:
1480 ME_ArrowPageUp(editor, &tmp_curs);
1481 break;
1482 case VK_NEXT:
1483 ME_ArrowPageDown(editor, &tmp_curs);
1484 break;
1485 case VK_HOME: {
1486 if (ctrl)
1487 ME_ArrowCtrlHome(editor, &tmp_curs);
1488 else
1489 ME_ArrowHome(editor, &tmp_curs);
1490 break;
1491 }
1492 case VK_END:
1493 if (ctrl)
1494 ME_ArrowCtrlEnd(editor, &tmp_curs);
1495 else
1496 ME_ArrowEnd(editor, &tmp_curs);
1497 break;
1498 }
1499
1500 if (!extend)
1501 editor->pCursors[1] = tmp_curs;
1502 *p = tmp_curs;
1503
1504 ME_InvalidateSelection(editor);
1505 ME_Repaint(editor);
1506 hide_caret(editor);
1507 editor_ensure_visible( editor, &tmp_curs );
1508 update_caret(editor);
1509 ME_SendSelChange(editor);
1510 return success;
1511}
static void cursor_move_line(ME_TextEditor *editor, ME_Cursor *cursor, BOOL up, BOOL extend)
Definition: caret.c:1246
static void ME_ArrowHome(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:1376
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop)
Definition: caret.c:678
BOOL ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
Definition: caret.c:758
static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1395
void ME_SendSelChange(ME_TextEditor *editor)
Definition: caret.c:1420
static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:1312
static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:1345
static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1383
static void ME_ArrowEnd(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: caret.c:1388
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: run.c:173
#define ctrl
Definition: input.c:1756
#define success(from, fromstr, to, tostr)
#define VK_UP
Definition: winuser.h:2236
#define VK_NEXT
Definition: winuser.h:2232
#define VK_END
Definition: winuser.h:2233
#define VK_HOME
Definition: winuser.h:2234
#define VK_LEFT
Definition: winuser.h:2235
#define VK_RIGHT
Definition: winuser.h:2237
#define VK_DOWN
Definition: winuser.h:2238
#define VK_PRIOR
Definition: winuser.h:2231

Referenced by ME_KeyDown().

◆ ME_CallWordBreakProc()

int ME_CallWordBreakProc ( ME_TextEditor editor,
WCHAR str,
INT  len,
INT  start,
INT  code 
)

Definition at line 204 of file string.c.

205{
206 if (!editor->pfnWordBreak) {
207 return ME_WordBreakProc(str, start, len, code);
208 } else if (!editor->bEmulateVersion10) {
209 /* MSDN lied about the third parameter for EditWordBreakProc being the number
210 * of characters, it is actually the number of bytes of the string. */
211 return editor->pfnWordBreak(str, start, len * sizeof(WCHAR), code);
212 } else {
213 int result;
215 NULL, 0, NULL, NULL);
217 if (!buffer) return 0;
222 return result;
223 }
224}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static int ME_WordBreakProc(LPWSTR s, INT start, INT len, INT code)
Definition: string.c:162
GLuint buffer
Definition: glext.h:5915
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: inflate.c:139

Referenced by ME_MoveCursorWords().

◆ ME_CanJoinRuns()

BOOL ME_CanJoinRuns ( const ME_Run run1,
const ME_Run run2 
)

Definition at line 129 of file run.c.

130{
131 if ((run1->nFlags | run2->nFlags) & MERF_NOJOIN)
132 return FALSE;
133 if (run1->style != run2->style)
134 return FALSE;
135 if ((run1->nFlags & MERF_STYLEFLAGS) != (run2->nFlags & MERF_STYLEFLAGS))
136 return FALSE;
137 return TRUE;
138}
#define MERF_STYLEFLAGS
Definition: editstr.h:102
#define MERF_NOJOIN
Definition: editstr.h:130

Referenced by ME_PrepareParagraphForWrapping().

◆ ME_CharCompare()

static int ME_CharCompare ( WCHAR  a,
WCHAR  b,
int  caseSensitive 
)
inlinestatic

Definition at line 104 of file editor.h.

105{
106 return caseSensitive ? (a == b) : (towupper(a) == towupper(b));
107}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define towupper(c)
Definition: wctype.h:99

Referenced by ME_FindText().

◆ ME_CharFormatFromLogFont()

void ME_CharFormatFromLogFont ( HDC  hDC,
const LOGFONTW lf,
CHARFORMAT2W fmt 
)

Definition at line 331 of file style.c.

332{
333 int ry;
334
337 lstrcpyW(fmt->szFaceName, lf->lfFaceName);
338 fmt->dwEffects = 0;
340 fmt->wWeight = lf->lfWeight;
341 fmt->yHeight = -lf->lfHeight*1440/ry;
342 if (lf->lfWeight > FW_NORMAL) fmt->dwEffects |= CFM_BOLD;
343 if (lf->lfItalic) fmt->dwEffects |= CFM_ITALIC;
344 if (lf->lfUnderline) fmt->dwEffects |= CFM_UNDERLINE;
345 fmt->bUnderlineType = CFU_UNDERLINE;
346 if (lf->lfStrikeOut) fmt->dwEffects |= CFM_STRIKEOUT;
347 fmt->bPitchAndFamily = lf->lfPitchAndFamily;
348 fmt->bCharSet = lf->lfCharSet;
349}
#define lstrcpyW
Definition: compat.h:749
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt)
Definition: style.c:150
#define CFM_STRIKEOUT
Definition: richedit.h:335
#define CFM_ITALIC
Definition: richedit.h:333
#define CFU_UNDERLINE
Definition: richedit.h:428
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719

Referenced by editor_handle_message().

◆ ME_CharFromPoint()

int ME_CharFromPoint ( ME_TextEditor editor,
int  cx,
ME_Run run,
BOOL  closest,
BOOL  visual_order 
)

Definition at line 570 of file run.c.

571{
573 int ret;
574 HDC hdc = ITextHost_TxGetDC( editor->texthost );
575
576 ME_InitContext( &c, editor, hdc );
577 ret = ME_CharFromPointContext( &c, cx, run, closest, visual_order );
580 return ret;
581}
int ME_CharFromPointContext(ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order)
Definition: run.c:511
_Out_opt_ int * cx
Definition: commctrl.h:585
int ret

Referenced by row_cursor().

◆ ME_CharFromPointContext()

int ME_CharFromPointContext ( ME_Context c,
int  cx,
ME_Run run,
BOOL  closest,
BOOL  visual_order 
)

Definition at line 511 of file run.c.

512{
513 ME_String *mask_text = NULL;
514 WCHAR *str;
515 int fit = 0;
516 SIZE sz, sz2, sz3;
517 if (!run->len || cx <= 0)
518 return 0;
519
520 if (run->nFlags & (MERF_TAB | MERF_ENDCELL))
521 {
522 if (!closest || cx < run->nWidth / 2) return 0;
523 return 1;
524 }
525
526 if (run->nFlags & MERF_GRAPHICS)
527 {
528 SIZE sz;
529 ME_GetOLEObjectSize(c, run, &sz);
530 if (!closest || cx < sz.cx / 2) return 0;
531 return 1;
532 }
533
534 if (run->para->nFlags & MEPF_COMPLEX)
535 {
536 int cp, trailing;
537 if (visual_order && run->script_analysis.fRTL) cx = run->nWidth - cx - 1;
538
539 ScriptXtoCP( cx, run->len, run->num_glyphs, run->clusters, run->vis_attrs, run->advances, &run->script_analysis,
540 &cp, &trailing );
541 TRACE("x %d cp %d trailing %d (run width %d) rtl %d log order %d\n", cx, cp, trailing, run->nWidth,
543 return closest ? cp + trailing : cp;
544 }
545
546 if (c->editor->password_char)
547 {
548 mask_text = ME_MakeStringR( c->editor->password_char, run->len );
549 str = mask_text->szData;
550 }
551 else
552 str = get_text( run, 0 );
553
554 select_style(c, run->style);
555 GetTextExtentExPointW(c->hDC, str, run->len,
556 cx, &fit, NULL, &sz);
557 if (closest && fit != run->len)
558 {
559 GetTextExtentPoint32W(c->hDC, str, fit, &sz2);
560 GetTextExtentPoint32W(c->hDC, str, fit + 1, &sz3);
561 if (cx >= (sz2.cx+sz3.cx)/2)
562 fit = fit + 1;
563 }
564
565 ME_DestroyString( mask_text );
566
567 return fit;
568}
HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing)
Definition: usp10.c:2854
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN
Definition: richole.c:5649
void select_style(ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN
Definition: style.c:369
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN
Definition: string.c:96
ME_String * ME_MakeStringR(WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN
Definition: string.c:85
#define MERF_TAB
Definition: editstr.h:106
#define MERF_ENDCELL
Definition: editstr.h:108
#define MEPF_COMPLEX
Definition: editstr.h:145
POINT cp
Definition: magnifier.c:59
int num_glyphs
Definition: editstr.h:170
SCRIPT_VISATTR * vis_attrs
Definition: editstr.h:172
int * advances
Definition: editstr.h:173
SCRIPT_ANALYSIS script_analysis
Definition: editstr.h:169
int nWidth
Definition: editstr.h:163
WORD * clusters
Definition: editstr.h:176
WCHAR * szData
Definition: editstr.h:55
WORD fLogicalOrder
Definition: usp10.h:144
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

Referenced by find_split_point(), and ME_CharFromPoint().

◆ ME_CharFromPos()

BOOL ME_CharFromPos ( ME_TextEditor editor,
int  x,
int  y,
ME_Cursor cursor,
BOOL isExact 
)

Definition at line 1039 of file caret.c.

1041{
1042 RECT rc;
1043 BOOL bResult;
1044
1045 ITextHost_TxGetClientRect(editor->texthost, &rc);
1046 if (x < 0 || y < 0 || x >= rc.right || y >= rc.bottom) {
1047 if (isExact) *isExact = FALSE;
1048 return FALSE;
1049 }
1050 x += editor->horz_si.nPos;
1051 y += editor->vert_si.nPos;
1052 bResult = cursor_from_virtual_coords( editor, x, y, cursor, FALSE );
1053 if (isExact) *isExact = bResult;
1054 return TRUE;
1055}
static BOOL cursor_from_virtual_coords(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL final_eop)
Definition: caret.c:978
#define ITextHost_TxGetClientRect(This, a)
Definition: editor.h:354

Referenced by editor_handle_message(), editor_set_cursor(), and link_notify().

◆ ME_CheckCharOffsets()

void ME_CheckCharOffsets ( ME_TextEditor editor)

Definition at line 173 of file run.c.

174{
175 ME_DisplayItem *p = editor->pBuffer->pFirst;
176 int ofs = 0, ofsp = 0;
177
178 if (!TRACE_ON(richedit_check))
179 return;
180
181 TRACE_(richedit_check)("Checking begin\n");
182 if(TRACE_ON(richedit_lists))
183 {
184 TRACE_(richedit_lists)("---\n");
185 ME_DumpDocument(editor->pBuffer);
186 }
187 do {
189 switch(p->type) {
190 case diTextEnd:
191 TRACE_(richedit_check)("tend, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
192 assert(ofsp+ofs == p->member.para.nCharOfs);
193 TRACE_(richedit_check)("Checking finished\n");
194 return;
195 case diParagraph:
196 TRACE_(richedit_check)("para, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
197 assert(ofsp+ofs == p->member.para.nCharOfs);
198 ofsp = p->member.para.nCharOfs;
199 ofs = 0;
200 break;
201 case diRun:
202 TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08x\n",
203 p->member.run.nCharOfs, p->member.run.nCharOfs+ofsp, ofsp+ofs,
204 p->member.run.len, debugstr_run( &p->member.run ),
205 p->member.run.nFlags,
206 p->member.run.style->fmt.dwMask & p->member.run.style->fmt.dwEffects);
207 assert(ofs == p->member.run.nCharOfs);
208 assert(p->member.run.len);
209 ofs += p->member.run.len;
210 break;
211 case diCell:
212 TRACE_(richedit_check)("cell\n");
213 break;
214 default:
215 assert(0);
216 }
217 } while(1);
218 TRACE_(richedit_check)("Checking finished\n");
219}
#define TRACE_ON(x)
Definition: compat.h:75
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN
Definition: list.c:142
static const char * debugstr_run(const ME_Run *run)
Definition: editor.h:47
@ diRunOrParagraphOrEnd
Definition: editstr.h:96

Referenced by ME_ArrowKey(), ME_InternalDeleteText(), ME_KeyDown(), ME_MakeEditor(), para_join(), run_join(), and split_run_extents().

◆ ME_ClearTempStyle()

void ME_ClearTempStyle ( ME_TextEditor editor)

Definition at line 507 of file style.c.

508{
509 if (!editor->pBuffer->pCharStyle) return;
511 editor->pBuffer->pCharStyle = NULL;
512}
void ME_ReleaseStyle(ME_Style *s)
Definition: style.c:462
ME_Style * pCharStyle
Definition: editstr.h:268

Referenced by editor_handle_message(), ME_DestroyEditor(), ME_ReplaceSel(), ME_SendSelChange(), and ME_StreamIn().

◆ ME_CommitCoalescingUndo()

void ME_CommitCoalescingUndo ( ME_TextEditor editor)

Commits preceding changes into a undo transaction that can be expanded.

This function allows the transaction to be reopened with ME_ContinueCoalescingTransaction in order to continue the transaction. If an undo item is added to the undo stack as a result of a change without the transaction being reopened, then the transaction will be ended, and the changes will become a part of the next transaction.

This is used to allow typed characters to be grouped together since each typed character results in a single event, and each event adding undo items must be committed. Using this function as opposed to ME_CommitUndo allows multiple events to be grouped, and undone together.

Definition at line 301 of file undo.c.

302{
303 struct undo_item *item;
304 struct list *head;
305
306 if (editor->nUndoMode == umIgnore)
307 return;
308
309 assert(editor->nUndoMode == umAddToUndo);
310
311 head = list_head( &editor->undo_stack );
312 if (!head) return;
313
314 /* no need to commit empty transactions */
315 item = LIST_ENTRY( head, struct undo_item, entry );
316 if (item->type == undo_end_transaction ||
318 return;
319
321}
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: list.h:37
@ umAddToUndo
Definition: editstr.h:280
@ umIgnore
Definition: editstr.h:282
@ undo_end_transaction
Definition: editstr.h:294
@ undo_potential_end_transaction
Definition: editstr.h:295
Definition: list.h:15
ME_UndoMode nUndoMode
Definition: editstr.h:408
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by handle_enter(), handle_wm_char(), and ME_KeyDown().

◆ ME_CommitUndo()

void ME_CommitUndo ( ME_TextEditor editor)

Commits preceding changes into a transaction that can be undone together.

This should be called after all the changes occur associated with an event so that the group of changes can be undone atomically as a transaction.

This will have no effect the undo mode is set to ignore changes, or if no changes preceded calling this function before the last time it was called.

This can also be used to conclude a coalescing transaction (used for grouping typed characters).

Definition at line 227 of file undo.c.

228{
229 struct undo_item *item;
230 struct list *head;
231
232 if (editor->nUndoMode == umIgnore)
233 return;
234
235 assert(editor->nUndoMode == umAddToUndo);
236
237 /* no transactions, no need to commit */
238 head = list_head( &editor->undo_stack );
239 if (!head) return;
240
241 /* no need to commit empty transactions */
242 item = LIST_ENTRY( head, struct undo_item, entry );
243 if (item->type == undo_end_transaction) return;
244
246 {
248 return;
249 }
250
252}

Referenced by editor_copy_or_cut(), editor_handle_message(), handle_EM_SETCHARFORMAT(), handle_enter(), handle_wm_char(), IRichEditOle_fnInsertObject(), ME_KeyDown(), ME_ReplaceSel(), ME_StreamIn(), and paste_emf().

◆ ME_ContinueCoalescingTransaction()

void ME_ContinueCoalescingTransaction ( ME_TextEditor editor)

Groups subsequent changes with previous ones for an undo if coalescing.

Has no effect if the previous changes were followed by a ME_CommitUndo. This function will only have an affect if the previous changes were followed by a call to ME_CommitCoalescingUndo, which allows the transaction to be continued.

This allows multiple consecutively typed characters to be grouped together to be undone by a single undo operation.

Definition at line 265 of file undo.c.

266{
267 struct undo_item *item;
268 struct list *head;
269
270 if (editor->nUndoMode == umIgnore)
271 return;
272
273 assert(editor->nUndoMode == umAddToUndo);
274
275 head = list_head( &editor->undo_stack );
276 if (!head) return;
277
278 item = LIST_ENTRY( head, struct undo_item, entry );
280 {
281 list_remove( &item->entry );
282 editor->nUndoStackSize--;
284 }
285}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
int nUndoStackSize
Definition: editstr.h:406
static void destroy_undo_item(struct undo_item *undo)
Definition: undo.c:25

Referenced by handle_enter(), handle_wm_char(), and ME_KeyDown().

◆ ME_CopyCharFormat()

void ME_CopyCharFormat ( CHARFORMAT2W pDest,
const CHARFORMAT2W pSrc 
)

Definition at line 230 of file style.c.

231{
232 /* using this with non-2W structs is forbidden */
233 assert(pSrc->cbSize == sizeof(CHARFORMAT2W));
234 assert(pDest->cbSize == sizeof(CHARFORMAT2W));
235 *pDest = *pSrc;
236}

Referenced by ME_GetDefaultCharFormat(), ME_GetSelectionCharFormat(), and run_copy_char_fmt().

◆ ME_CopyReObject()

void ME_CopyReObject ( REOBJECT dst,
const REOBJECT src,
DWORD  flags 
)

Definition at line 5829 of file richole.c.

5830{
5831 *dst = *src;
5832 dst->poleobj = NULL;
5833 dst->pstg = NULL;
5834 dst->polesite = NULL;
5835
5836 if ((flags & REO_GETOBJ_POLEOBJ) && src->poleobj)
5837 {
5838 dst->poleobj = src->poleobj;
5839 IOleObject_AddRef(dst->poleobj);
5840 }
5841 if ((flags & REO_GETOBJ_PSTG) && src->pstg)
5842 {
5843 dst->pstg = src->pstg;
5844 IStorage_AddRef(dst->pstg);
5845 }
5846 if ((flags & REO_GETOBJ_POLESITE) && src->polesite)
5847 {
5848 dst->polesite = src->polesite;
5849 IOleClientSite_AddRef(dst->polesite);
5850 }
5851}
GLenum src
Definition: glext.h:6340

Referenced by create_re_object(), and IRichEditOle_fnGetObject().

◆ ME_DeleteReObject()

void ME_DeleteReObject ( struct re_object re_object)

Definition at line 5821 of file richole.c.

5822{
5823 if (reobj->obj.poleobj) IOleObject_Release(reobj->obj.poleobj);
5824 if (reobj->obj.pstg) IStorage_Release(reobj->obj.pstg);
5825 if (reobj->obj.polesite) IOleClientSite_Release(reobj->obj.polesite);
5826 heap_free(reobj);
5827}

Referenced by ME_DestroyDisplayItem().

◆ ME_DeleteSelection()

void ME_DeleteSelection ( ME_TextEditor editor)

Definition at line 1406 of file caret.c.

1407{
1408 int from, to;
1409 int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
1410 int nEndCursor = nStartCursor ^ 1;
1411 ME_DeleteTextAtCursor(editor, nStartCursor, to - from);
1412 editor->pCursors[nEndCursor] = editor->pCursors[nStartCursor];
1413}
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
Definition: caret.c:481

Referenced by editor_handle_message(), ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), ME_InsertTextFromCursor(), and ME_KeyDown().

◆ ME_DeleteTextAtCursor()

BOOL ME_DeleteTextAtCursor ( ME_TextEditor editor,
int  nCursor,
int  nChars 
)

Definition at line 481 of file caret.c.

482{
483 assert(nCursor>=0 && nCursor<editor->nCursors);
484 /* text operations set modified state */
485 editor->nModifyStep = 1;
486 return ME_InternalDeleteText(editor, &editor->pCursors[nCursor],
487 nChars, FALSE);
488}

Referenced by ME_DeleteSelection(), and ME_KeyDown().

◆ ME_DestroyContext()

void ME_DestroyContext ( ME_Context c)

Definition at line 44 of file context.c.

45{
47 if (c->hDC) ITextHost_TxReleaseDC( c->editor->texthost, c->hDC );
48}

Referenced by cursor_coords(), editor_draw(), ME_CharFromPoint(), ME_MakeFirstParagraph(), ME_PointFromChar(), stream_out_graphics(), and wrap_marked_paras_dc().

◆ ME_DestroyDisplayItem()

void ME_DestroyDisplayItem ( ME_DisplayItem item)

Definition at line 115 of file list.c.

116{
117 if (0)
118 TRACE("type=%s\n", ME_GetDITypeName(item->type));
119 if (item->type==diRun)
120 {
121 if (item->member.run.reobj)
122 {
123 list_remove(&item->member.run.reobj->entry);
124 ME_DeleteReObject(item->member.run.reobj);
125 }
126 heap_free( item->member.run.glyphs );
127 heap_free( item->member.run.clusters );
128 ME_ReleaseStyle(item->member.run.style);
129 }
131}
static const char * ME_GetDITypeName(ME_DIType type)
Definition: list.c:101
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN
Definition: richole.c:5821

Referenced by ME_DestroyEditor(), ME_InternalDeleteText(), ME_PrepareParagraphForWrapping(), para_destroy(), para_join(), and run_join().

◆ ME_DestroyEditor()

void ME_DestroyEditor ( ME_TextEditor editor)

Definition at line 3066 of file editor.c.

3067{
3068 ME_DisplayItem *p = editor->pBuffer->pFirst, *pNext = NULL;
3069 ME_Style *s, *cursor2;
3070 int i;
3071
3072 ME_ClearTempStyle(editor);
3073 ME_EmptyUndoStack(editor);
3074 editor->pBuffer->pFirst = NULL;
3075 while(p)
3076 {
3077 pNext = p->next;
3078 if (p->type == diParagraph)
3079 para_destroy( editor, &p->member.para );
3080 else
3082 p = pNext;
3083 }
3084
3085 LIST_FOR_EACH_ENTRY_SAFE( s, cursor2, &editor->style_list, ME_Style, entry )
3086 ME_DestroyStyle( s );
3087
3089 for (i=0; i<HFONT_CACHE_SIZE; i++)
3090 {
3091 if (editor->pFontCache[i].hFont)
3092 DeleteObject(editor->pFontCache[i].hFont);
3093 }
3094 if(editor->lpOleCallback)
3095 IRichEditOleCallback_Release(editor->lpOleCallback);
3096
3098
3099 heap_free(editor->pBuffer);
3100 heap_free(editor->pCursors);
3101 heap_free(editor);
3102}
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
void ME_DestroyStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:442
void para_destroy(ME_TextEditor *editor, ME_Paragraph *item) DECLSPEC_HIDDEN
Definition: para.c:42
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN
Definition: list.c:115
#define HFONT_CACHE_SIZE
Definition: editstr.h:68
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]
Definition: editstr.h:412
struct list style_list
Definition: editstr.h:449

Referenced by ITextServicesImpl_Release().

◆ ME_DestroyString()

void ME_DestroyString ( ME_String s)

Definition at line 96 of file string.c.

97{
98 if (!s) return;
99 if (s->free) s->free( s );
100 heap_free( s );
101}

Referenced by destroy_undo_item(), draw_text(), ME_CharFromPointContext(), ME_GetRunSizeCommon(), ME_PointFromCharContext(), para_destroy(), and para_num_clear().

◆ ME_DestroyStyle()

void ME_DestroyStyle ( ME_Style item)

Definition at line 442 of file style.c.

443{
444 list_remove( &s->entry );
445 if (s->font_cache)
446 {
447 release_font_cache( s->font_cache );
448 s->font_cache = NULL;
449 }
450 ScriptFreeCache( &s->script_cache );
451 heap_free(s);
452}
static void release_font_cache(ME_FontCacheItem *item)
Definition: style.c:360
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080

Referenced by ME_DestroyEditor(), and ME_ReleaseStyle().

◆ ME_DumpDocument()

void ME_DumpDocument ( ME_TextBuffer buffer)

Definition at line 142 of file list.c.

143{
144 /* FIXME this is useless, */
145 ME_DisplayItem *pItem = buffer->pFirst;
146 TRACE("DOCUMENT DUMP START\n");
147 while(pItem) {
148 switch(pItem->type)
149 {
150 case diTextStart:
151 TRACE("Start\n");
152 break;
153 case diCell:
154 TRACE("Cell(level=%d%s)\n", pItem->member.cell.nNestingLevel,
155 !pItem->member.cell.next_cell ? ", END" :
156 (!pItem->member.cell.prev_cell ? ", START" :""));
157 break;
158 case diParagraph:
159 TRACE("Paragraph(ofs=%d)\n", pItem->member.para.nCharOfs);
160 if (pItem->member.para.nFlags & MEPF_ROWSTART)
161 TRACE(" - (Table Row Start)\n");
162 if (pItem->member.para.nFlags & MEPF_ROWEND)
163 TRACE(" - (Table Row End)\n");
164 break;
165 case diStartRow:
166 TRACE(" - StartRow\n");
167 break;
168 case diRun:
169 TRACE(" - Run(%s, %d, flags=%x)\n", debugstr_run( &pItem->member.run ),
170 pItem->member.run.nCharOfs, pItem->member.run.nFlags);
171 break;
172 case diTextEnd:
173 TRACE("End(ofs=%d)\n", pItem->member.para.nCharOfs);
174 break;
175 default:
176 break;
177 }
178 pItem = pItem->next;
179 }
180 TRACE("DOCUMENT DUMP END\n");
181}
#define MEPF_ROWSTART
Definition: editstr.h:143
@ diStartRow
Definition: editstr.h:87
int nNestingLevel
Definition: editstr.h:222
ME_DIType type
Definition: editstr.h:255
ME_Cell cell
Definition: editstr.h:260

Referenced by ME_CheckCharOffsets().

◆ ME_DumpParaStyle()

void ME_DumpParaStyle ( ME_Paragraph s)

◆ ME_DumpParaStyleToBuf()

void ME_DumpParaStyleToBuf ( const PARAFORMAT2 pFmt,
char  buf[2048] 
)

Definition at line 787 of file para.c.

788{
789 char *p;
790 p = buf;
791
792#define DUMP(mask, name, fmt, field) \
793 if (pFmt->dwMask & (mask)) p += sprintf(p, "%-22s" fmt "\n", name, pFmt->field); \
794 else p += sprintf(p, "%-22sN/A\n", name);
795
796/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
797#define DUMP_EFFECT(mask, name) \
798 p += sprintf(p, "%-22s%s\n", name, (pFmt->dwMask & (mask)) ? ((pFmt->wEffects & ((mask) >> 16)) ? "yes" : "no") : "N/A");
799
800 DUMP(PFM_NUMBERING, "Numbering:", "%u", wNumbering);
801 DUMP_EFFECT(PFM_DONOTHYPHEN, "Disable auto-hyphen:");
802 DUMP_EFFECT(PFM_KEEP, "No page break in para:");
803 DUMP_EFFECT(PFM_KEEPNEXT, "No page break in para & next:");
804 DUMP_EFFECT(PFM_NOLINENUMBER, "No line number:");
805 DUMP_EFFECT(PFM_NOWIDOWCONTROL, "No widow & orphan:");
806 DUMP_EFFECT(PFM_PAGEBREAKBEFORE, "Page break before:");
807 DUMP_EFFECT(PFM_RTLPARA, "RTL para:");
808 DUMP_EFFECT(PFM_SIDEBYSIDE, "Side by side:");
809 DUMP_EFFECT(PFM_TABLE, "Table:");
810 DUMP(PFM_OFFSETINDENT, "Offset indent:", "%d", dxStartIndent);
811 DUMP(PFM_STARTINDENT, "Start indent:", "%d", dxStartIndent);
812 DUMP(PFM_RIGHTINDENT, "Right indent:", "%d", dxRightIndent);
813 DUMP(PFM_OFFSET, "Offset:", "%d", dxOffset);
814 if (pFmt->dwMask & PFM_ALIGNMENT) {
815 switch (pFmt->wAlignment) {
816 case PFA_LEFT : p += sprintf(p, "Alignment: left\n"); break;
817 case PFA_RIGHT : p += sprintf(p, "Alignment: right\n"); break;
818 case PFA_CENTER : p += sprintf(p, "Alignment: center\n"); break;
819 case PFA_JUSTIFY: p += sprintf(p, "Alignment: justify\n"); break;
820 default : p += sprintf(p, "Alignment: incorrect %d\n", pFmt->wAlignment); break;
821 }
822 }
823 else p += sprintf(p, "Alignment: N/A\n");
824 DUMP(PFM_TABSTOPS, "Tab Stops:", "%d", cTabCount);
825 if (pFmt->dwMask & PFM_TABSTOPS) {
826 int i;
827 p += sprintf(p, "\t");
828 for (i = 0; i < pFmt->cTabCount; i++) p += sprintf(p, "%x ", pFmt->rgxTabs[i]);
829 p += sprintf(p, "\n");
830 }
831 DUMP(PFM_SPACEBEFORE, "Space Before:", "%d", dySpaceBefore);
832 DUMP(PFM_SPACEAFTER, "Space After:", "%d", dySpaceAfter);
833 DUMP(PFM_LINESPACING, "Line spacing:", "%d", dyLineSpacing);
834 DUMP(PFM_STYLE, "Text style:", "%d", sStyle);
835 DUMP(PFM_LINESPACING, "Line spacing rule:", "%u", bLineSpacingRule);
836 /* bOutlineLevel should be 0 */
837 DUMP(PFM_SHADING, "Shading Weight:", "%u", wShadingWeight);
838 DUMP(PFM_SHADING, "Shading Style:", "%u", wShadingStyle);
839 DUMP(PFM_NUMBERINGSTART, "Numbering Start:", "%u", wNumberingStart);
840 DUMP(PFM_NUMBERINGSTYLE, "Numbering Style:", "0x%x", wNumberingStyle);
841 DUMP(PFM_NUMBERINGTAB, "Numbering Tab:", "%u", wNumberingStyle);
842 DUMP(PFM_BORDER, "Border Space:", "%u", wBorderSpace);
843 DUMP(PFM_BORDER, "Border Width:", "%u", wBorderWidth);
844 DUMP(PFM_BORDER, "Borders:", "%u", wBorders);
845
846#undef DUMP
847#undef DUMP_EFFECT
848}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define DUMP(mask, name, fmt, field)
#define DUMP_EFFECT(mask, name)
#define PFA_RIGHT
Definition: richedit.h:922
#define PFA_CENTER
Definition: richedit.h:923
#define PFM_OFFSETINDENT
Definition: richedit.h:844
#define PFM_NOLINENUMBER
Definition: richedit.h:860
#define PFM_KEEPNEXT
Definition: richedit.h:858
#define PFM_DONOTHYPHEN
Definition: richedit.h:862
#define PFM_TABLE
Definition: richedit.h:870
#define PFM_NOWIDOWCONTROL
Definition: richedit.h:861
#define PFM_PAGEBREAKBEFORE
Definition: richedit.h:859
#define PFM_SIDEBYSIDE
Definition: richedit.h:863
#define PFA_JUSTIFY
Definition: richedit.h:924
#define PFM_KEEP
Definition: richedit.h:857
#define PFM_RTLPARA
Definition: richedit.h:856

◆ ME_DumpStyle()

void ME_DumpStyle ( ME_Style s)

Definition at line 243 of file style.c.

244{
245 char buf[2048];
246 ME_DumpStyleToBuf(&s->fmt, buf);
247 TRACE_(richedit_style)("%s\n", buf);
248}
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048])
Definition: style.c:250

◆ ME_DumpStyleToBuf()

void ME_DumpStyleToBuf ( CHARFORMAT2W pFmt,
char  buf[2048] 
)

Definition at line 250 of file style.c.

251{
252 /* FIXME only CHARFORMAT styles implemented */
253 /* this function sucks, doesn't check for buffer overruns but it's "good enough" as for debug code */
254 char *p;
255 p = buf;
256 p += sprintf(p, "Font face: ");
257 if (pFmt->dwMask & CFM_FACE) {
258 WCHAR *q = pFmt->szFaceName;
259 while(*q) {
260 *p++ = (*q > 255) ? '?' : *q;
261 q++;
262 }
263 } else
264 p += sprintf(p, "N/A");
265
266 if (pFmt->dwMask & CFM_SIZE)
267 p += sprintf(p, "\nFont size: %d\n", pFmt->yHeight);
268 else
269 p += sprintf(p, "\nFont size: N/A\n");
270
271 if (pFmt->dwMask & CFM_OFFSET)
272 p += sprintf(p, "Char offset: %d\n", pFmt->yOffset);
273 else
274 p += sprintf(p, "Char offset: N/A\n");
275
276 if (pFmt->dwMask & CFM_CHARSET)
277 p += sprintf(p, "Font charset: %d\n", (int)pFmt->bCharSet);
278 else
279 p += sprintf(p, "Font charset: N/A\n");
280
281 /* I'm assuming CFM_xxx and CFE_xxx are the same values, fortunately it IS true wrt used flags*/
282 ME_DumpStyleEffect(&p, "Font bold:", pFmt, CFM_BOLD);
283 ME_DumpStyleEffect(&p, "Font italic:", pFmt, CFM_ITALIC);
284 ME_DumpStyleEffect(&p, "Font underline:", pFmt, CFM_UNDERLINE);
285 ME_DumpStyleEffect(&p, "Font strikeout:", pFmt, CFM_STRIKEOUT);
286 ME_DumpStyleEffect(&p, "Hidden text:", pFmt, CFM_HIDDEN);
287 p += sprintf(p, "Text color: ");
288 if (pFmt->dwMask & CFM_COLOR)
289 {
290 if (pFmt->dwEffects & CFE_AUTOCOLOR)
291 p += sprintf(p, "auto\n");
292 else
293 p += sprintf(p, "%06x\n", (int)pFmt->crTextColor);
294 }
295 else
296 p += sprintf(p, "N/A\n");
297 ME_DumpStyleEffect(&p, "Text protected:", pFmt, CFM_PROTECTED);
298}
static void ME_DumpStyleEffect(char **p, const char *name, const CHARFORMAT2W *fmt, int mask)
Definition: style.c:238
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define CFM_PROTECTED
Definition: richedit.h:336
BYTE bCharSet
Definition: richedit.h:311
LONG yOffset
Definition: richedit.h:309
DWORD dwEffects
Definition: richedit.h:307
LONG yHeight
Definition: richedit.h:308
COLORREF crTextColor
Definition: richedit.h:310

Referenced by ME_DumpStyle(), and ME_KeyDown().

◆ ME_EmptyUndoStack()

void ME_EmptyUndoStack ( ME_TextEditor editor)

Definition at line 53 of file undo.c.

54{
55 struct undo_item *cursor, *cursor2;
56 if (editor->nUndoMode == umIgnore)
57 return;
58
59 TRACE("Emptying undo stack\n");
60
61 editor->nUndoStackSize = 0;
62
63 LIST_FOR_EACH_ENTRY_SAFE( cursor, cursor2, &editor->undo_stack, struct undo_item, entry )
64 {
65 list_remove( &cursor->entry );
67 }
68
69 empty_redo_stack( editor );
70}
static void empty_redo_stack(ME_TextEditor *editor)
Definition: undo.c:43

Referenced by add_undo_insert_run(), editor_handle_message(), fnTextSrv_TxSetText(), ME_DestroyEditor(), ME_ReplaceSel(), and ME_StreamIn().

◆ ME_EndToUnicode()

void ME_EndToUnicode ( LONG  codepage,
LPVOID  psz 
)

Definition at line 248 of file string.c.

249{
250 if (codepage != CP_UNICODE)
251 heap_free( psz );
252}
int codepage
Definition: win_iconv.c:156

Referenced by editor_handle_message(), ME_SetText(), and RichEditWndProc_common().

◆ ME_FindItemBack()

ME_DisplayItem * ME_FindItemBack ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 66 of file list.c.

67{
68 if (!di)
69 return NULL;
70 di = di->prev;
71 while(di!=NULL) {
72 if (ME_DITypesEqual(di->type, nTypeOrClass))
73 return di;
74 di = di->prev;
75 }
76 return NULL;
77}
static BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
Definition: list.c:45

Referenced by cell_end_para(), para_end_row(), row_end_cursor(), row_from_cursor(), row_next_run(), row_prev_all_paras(), table_outer_para(), and table_row_start().

◆ ME_FindItemBackOrHere()

ME_DisplayItem * ME_FindItemBackOrHere ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 79 of file list.c.

80{
81 while(di!=NULL) {
82 if (ME_DITypesEqual(di->type, nTypeOrClass))
83 return di;
84 di = di->prev;
85 }
86 return NULL;
87}

◆ ME_FindItemFwd()

ME_DisplayItem * ME_FindItemFwd ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 89 of file list.c.

90{
91 if (!di) return NULL;
92 di = di->next;
93 while(di!=NULL) {
94 if (ME_DITypesEqual(di->type, nTypeOrClass))
95 return di;
96 di = di->next;
97 }
98 return NULL;
99}

Referenced by cell_first_para(), ME_CheckCharOffsets(), para_first_row(), row_end_cursor(), row_first_cursor(), row_first_run(), row_next(), row_next_all_paras(), row_next_run(), and table_row_end().

◆ ME_FindNonWhitespaceV()

int ME_FindNonWhitespaceV ( const ME_String s,
int  nVChar 
)

◆ ME_GetCharFormat()

void ME_GetCharFormat ( ME_TextEditor editor,
const ME_Cursor from,
const ME_Cursor to,
CHARFORMAT2W pFmt 
)

Definition at line 871 of file run.c.

873{
874 ME_Run *run, *run_end, *prev_run;
875 CHARFORMAT2W tmp;
876
877 run = from->run;
878 /* special case - if selection is empty, take previous char's formatting */
879 if (from->run == to->run && from->nOffset == to->nOffset)
880 {
881 if (!from->nOffset && (prev_run = run_prev( run ))) run = prev_run;
882 run_copy_char_fmt( run, fmt );
883 return;
884 }
885
886 run_end = to->run;
887 if (!to->nOffset) run_end = run_prev_all_paras( run_end );
888
889 run_copy_char_fmt( run, fmt );
890
891 if (run == run_end) return;
892
893 do {
894 /* FIXME add more style feature comparisons */
897
898 run = run_next_all_paras( run );
899
900 memset( &tmp, 0, sizeof(tmp) );
901 tmp.cbSize = sizeof(tmp);
902 run_copy_char_fmt( run, &tmp );
903
904 assert((tmp.dwMask & dwAttribs) == dwAttribs);
905 /* reset flags that differ */
906
907 if (fmt->yHeight != tmp.yHeight) fmt->dwMask &= ~CFM_SIZE;
908 if (fmt->dwMask & CFM_FACE)
909 {
910 if (!(tmp.dwMask & CFM_FACE))
911 fmt->dwMask &= ~CFM_FACE;
912 else if (wcscmp( fmt->szFaceName, tmp.szFaceName ) ||
913 fmt->bPitchAndFamily != tmp.bPitchAndFamily)
914 fmt->dwMask &= ~CFM_FACE;
915 }
916 if (fmt->yHeight != tmp.yHeight) fmt->dwMask &= ~CFM_SIZE;
917 if (fmt->bUnderlineType != tmp.bUnderlineType) fmt->dwMask &= ~CFM_UNDERLINETYPE;
918 if (fmt->dwMask & CFM_COLOR)
919 {
920 if (!((fmt->dwEffects&CFE_AUTOCOLOR) & (tmp.dwEffects&CFE_AUTOCOLOR)))
921 {
922 if (fmt->crTextColor != tmp.crTextColor)
923 fmt->dwMask &= ~CFM_COLOR;
924 }
925 }
926
927 fmt->dwMask &= ~((fmt->dwEffects ^ tmp.dwEffects) & dwEffects);
928 fmt->dwEffects = tmp.dwEffects;
929
930 } while(run != run_end);
931}
ME_Run * run_prev(ME_Run *run)
Definition: run.c:82
static void run_copy_char_fmt(ME_Run *run, CHARFORMAT2W *fmt)
Definition: run.c:831
ME_Run * run_prev_all_paras(ME_Run *run)
Definition: run.c:110
ME_Run * run_next_all_paras(ME_Run *run)
Definition: run.c:96
#define CFM_LINK
Definition: richedit.h:337
#define CFM_SUPERSCRIPT
Definition: richedit.h:349
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define memset(x, y, z)
Definition: compat.h:39
BYTE bUnderlineType
Definition: richedit.h:321
BYTE bPitchAndFamily
Definition: richedit.h:312

Referenced by get_textfont_prop_for_pos(), ME_GetSelectionCharFormat(), ME_StreamIn(), and ME_UpdateLinkAttribute().

◆ ME_GetCursorOfs()

◆ ME_GetDataObject()

HRESULT ME_GetDataObject ( ME_TextEditor editor,
const ME_Cursor start,
int  nChars,
LPDATAOBJECT lplpdataobj 
)

◆ ME_GetDefaultCharFormat()

void ME_GetDefaultCharFormat ( ME_TextEditor editor,
CHARFORMAT2W pFmt 
)

Definition at line 842 of file run.c.

843{
844 ME_CopyCharFormat(pFmt, &editor->pBuffer->pDefaultStyle->fmt);
845}
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN
Definition: style.c:230

Referenced by editor_handle_message().

◆ ME_GetOLEObjectSize()

void ME_GetOLEObjectSize ( const ME_Context c,
ME_Run run,
SIZE pSize 
)

Definition at line 5649 of file richole.c.

5650{
5651 IDataObject* ido;
5652 FORMATETC fmt;
5653 STGMEDIUM stgm;
5654 DIBSECTION dibsect;
5655 ENHMETAHEADER emh;
5656
5657 assert(run->nFlags & MERF_GRAPHICS);
5658 assert(run->reobj);
5659
5660 if (run->reobj->obj.sizel.cx != 0 || run->reobj->obj.sizel.cy != 0)
5661 {
5662 convert_sizel(c, &run->reobj->obj.sizel, pSize);
5663 if (c->editor->nZoomNumerator != 0)
5664 {
5665 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5666 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5667 }
5668 return;
5669 }
5670
5671 if (!run->reobj->obj.poleobj)
5672 {
5673 pSize->cx = pSize->cy = 0;
5674 return;
5675 }
5676
5677 if (IOleObject_QueryInterface(run->reobj->obj.poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
5678 {
5679 FIXME("Query Interface IID_IDataObject failed!\n");
5680 pSize->cx = pSize->cy = 0;
5681 return;
5682 }
5683 fmt.cfFormat = CF_BITMAP;
5684 fmt.ptd = NULL;
5685 fmt.dwAspect = DVASPECT_CONTENT;
5686 fmt.lindex = -1;
5687 fmt.tymed = TYMED_GDI;
5688 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5689 {
5690 fmt.cfFormat = CF_ENHMETAFILE;
5691 fmt.tymed = TYMED_ENHMF;
5692 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5693 {
5694 FIXME("unsupported format\n");
5695 pSize->cx = pSize->cy = 0;
5696 IDataObject_Release(ido);
5697 return;
5698 }
5699 }
5700 IDataObject_Release(ido);
5701
5702 switch (stgm.tymed)
5703 {
5704 case TYMED_GDI:
5705 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
5706 pSize->cx = dibsect.dsBm.bmWidth;
5707 pSize->cy = dibsect.dsBm.bmHeight;
5708 break;
5709 case TYMED_ENHMF:
5710 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
5711 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
5712 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
5713 break;
5714 default:
5715 FIXME("Unsupported tymed %d\n", stgm.tymed);
5716 break;
5717 }
5718 ReleaseStgMedium(&stgm);
5719 if (c->editor->nZoomNumerator != 0)
5720 {
5721 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5722 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5723 }
5724}

Referenced by ME_CharFromPointContext(), ME_GetRunSizeCommon(), and ME_PointFromCharContext().

◆ ME_GetParaBorderWidth()

int ME_GetParaBorderWidth ( const ME_Context c,
int  flags 
)

Definition at line 537 of file paint.c.

538{
539 int idx = (flags >> 8) & 0xF;
540 int width;
541
543 {
544 FIXME("Unsupported border value %d\n", idx);
545 return 0;
546 }
548 if (border_details[idx].dble) width = width * 2 + 1;
549 return width;
550}
unsigned int idx
Definition: utils.c:41
static int ME_GetBorderPenWidth(const ME_Context *c, int idx)
Definition: paint.c:524
static const struct @562 border_details[]
unsigned width
Definition: paint.c:498
unsigned dble
Definition: paint.c:498

Referenced by ME_DrawParaDecoration(), and ME_WrapTextParagraph().

◆ ME_GetRunSizeCommon()

SIZE ME_GetRunSizeCommon ( ME_Context c,
const ME_Paragraph para,
ME_Run run,
int  nLen,
int  startx,
int pAscent,
int pDescent 
)

Definition at line 669 of file run.c.

671{
672 SIZE size;
673
674 nLen = min( nLen, run->len );
675
676 if (run->nFlags & MERF_ENDPARA)
677 {
678 nLen = min( nLen, 1 );
679 ME_GetTextExtent( c, L" ", nLen, run->style, &size );
680 }
681 else if (para->nFlags & MEPF_COMPLEX)
682 {
683 size.cx = run->nWidth;
684 }
685 else if (c->editor->password_char)
686 {
687 ME_String *szMasked = ME_MakeStringR( c->editor->password_char, nLen );
688 ME_GetTextExtent(c, szMasked->szData, nLen,run->style, &size);
689 ME_DestroyString(szMasked);
690 }
691 else
692 {
693 ME_GetTextExtent(c, get_text( run, 0 ), nLen, run->style, &size);
694 }
695 *pAscent = run->style->tm.tmAscent;
696 *pDescent = run->style->tm.tmDescent;
697 size.cy = *pAscent + *pDescent;
698
699 if (run->nFlags & MERF_TAB)
700 {
701 int pos = 0, i = 0, ppos, shift = 0;
702 const PARAFORMAT2 *pFmt = &para->fmt;
703
704 if (c->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
705 pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
706 /* The horizontal gap shifts the tab positions to leave the gap. */
707 shift = pFmt->dxOffset * 2;
708 do {
709 if (i < pFmt->cTabCount)
710 {
711 /* Only one side of the horizontal gap is needed at the end of
712 * the table row. */
713 if (i == pFmt->cTabCount -1)
714 shift = shift >> 1;
715 pos = shift + (pFmt->rgxTabs[i]&0x00FFFFFF);
716 i++;
717 }
718 else
719 {
721 }
722 ppos = ME_twips2pointsX(c, pos);
723 if (ppos > startx + run->pt.x) {
724 size.cx = ppos - startx - run->pt.x;
725 break;
726 }
727 } while(1);
728 size.cy = *pAscent + *pDescent;
729 return size;
730 }
731 if (run->nFlags & MERF_GRAPHICS)
732 {
733 ME_GetOLEObjectSize(c, run, &size);
734 if (size.cy > *pAscent)
735 *pAscent = size.cy;
736 /* descent is unchanged */
737 return size;
738 }
739 return size;
740}
static void ME_GetTextExtent(ME_Context *c, LPCWSTR szText, int nChars, ME_Style *s, SIZE *size)
Definition: run.c:588
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN
Definition: paint.c:167
#define MERF_ENDPARA
Definition: editstr.h:121
#define lDefaultTab
Definition: richedit.h:215
#define PFE_TABLE
Definition: richedit.h:944
LONG dxOffset
Definition: richedit.h:672
TEXTMETRICW tm
Definition: editstr.h:75
LONG tmAscent
Definition: wingdi.h:2384
LONG tmDescent
Definition: wingdi.h:2385

Referenced by calc_run_extent().

◆ ME_GetSelection()

int ME_GetSelection ( ME_TextEditor editor,
ME_Cursor **  from,
ME_Cursor **  to 
)

Definition at line 57 of file caret.c.

58{
59 int from_ofs = ME_GetCursorOfs( &editor->pCursors[0] );
60 int to_ofs = ME_GetCursorOfs( &editor->pCursors[1] );
61 BOOL swap = (from_ofs > to_ofs);
62
63 if (from_ofs == to_ofs)
64 {
65 /* If cursor[0] is at the beginning of a run and cursor[1] at the end
66 of the prev run then we need to swap. */
67 if (editor->pCursors[0].nOffset < editor->pCursors[1].nOffset)
68 swap = TRUE;
69 }
70
71 if (!swap)
72 {
73 *from = &editor->pCursors[0];
74 *to = &editor->pCursors[1];
75 return 0;
76 } else {
77 *from = &editor->pCursors[1];
78 *to = &editor->pCursors[0];
79 return 1;
80 }
81}
#define swap(a, b)
Definition: qsort.c:63

Referenced by IRichEditOle_fnGetObject(), ITextSelection_fnGetChar(), ITextSelection_fnGetText(), ME_GetSelectionCharFormat(), ME_SetSelectionCharFormat(), ME_StreamIn(), ME_UpdateSelectionLinkAttribute(), and style_get_insert_style().

◆ ME_GetSelectionCharFormat()

void ME_GetSelectionCharFormat ( ME_TextEditor editor,
CHARFORMAT2W pFmt 
)

Definition at line 853 of file run.c.

854{
855 ME_Cursor *from, *to;
856 if (!ME_IsSelection(editor) && editor->pBuffer->pCharStyle)
857 {
858 ME_CopyCharFormat(pFmt, &editor->pBuffer->pCharStyle->fmt);
859 return;
860 }
861 ME_GetSelection(editor, &from, &to);
862 ME_GetCharFormat(editor, from, to, pFmt);
863}
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to)
Definition: caret.c:57
void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from, const ME_Cursor *to, CHARFORMAT2W *fmt)
Definition: run.c:871

Referenced by editor_handle_message(), ME_KeyDown(), and update_caret().

◆ ME_GetSelectionInsertStyle()

ME_Style * ME_GetSelectionInsertStyle ( ME_TextEditor editor)

Definition at line 1415 of file caret.c.

1416{
1417 return style_get_insert_style( editor, editor->pCursors );
1418}

Referenced by editor_handle_message(), ME_ReplaceSel(), and ME_StreamIn().

◆ ME_GetSelectionOfs()

◆ ME_GetTextLength()

◆ ME_GetTextLengthEx()

int ME_GetTextLengthEx ( ME_TextEditor editor,
const GETTEXTLENGTHEX how 
)

Definition at line 91 of file caret.c.

92{
93 int length;
94
95 if (how->flags & GTL_PRECISE && how->flags & GTL_CLOSE)
96 return E_INVALIDARG;
97 if (how->flags & GTL_NUMCHARS && how->flags & GTL_NUMBYTES)
98 return E_INVALIDARG;
99
100 length = ME_GetTextLength(editor);
101
102 if ((editor->props & TXTBIT_MULTILINE)
103 && (how->flags & GTL_USECRLF)
104 && !editor->bEmulateVersion10) /* Ignore GTL_USECRLF flag in 1.0 emulation */
105 length += editor->nParagraphs - 1;
106
107 if (how->flags & GTL_NUMBYTES ||
108 (how->flags & GTL_PRECISE && /* GTL_PRECISE seems to imply GTL_NUMBYTES */
109 !(how->flags & GTL_NUMCHARS))) /* unless GTL_NUMCHARS is given */
110 {
111 CPINFO cpinfo;
112
113 if (how->codepage == 1200)
114 return length * 2;
115 if (how->flags & GTL_PRECISE)
116 FIXME("GTL_PRECISE flag unsupported. Using GTL_CLOSE\n");
117 if (GetCPInfo(how->codepage, &cpinfo))
118 return length * cpinfo.MaxCharSize;
119 ERR("Invalid codepage %u\n", how->codepage);
120 return E_INVALIDARG;
121 }
122 return length;
123}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2144
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define GTL_PRECISE
Definition: richedit.h:1056
#define GTL_NUMBYTES
Definition: richedit.h:1059
UINT MaxCharSize
Definition: winnls.h:583

Referenced by editor_handle_message().

◆ ME_GetTextW()

int ME_GetTextW ( ME_TextEditor editor,
WCHAR buffer,
int  buflen,
const ME_Cursor start,
int  srcChars,
BOOL  bCRLF,
BOOL  bEOP 
)

Definition at line 4310 of file editor.c.

4313{
4314 ME_Run *run, *next_run;
4315 const WCHAR *pStart = buffer;
4316 const WCHAR *str;
4317 int nLen;
4318
4319 /* bCRLF flag is only honored in 2.0 and up. 1.0 must always return text verbatim */
4320 if (editor->bEmulateVersion10) bCRLF = FALSE;
4321
4322 run = start->run;
4323 next_run = run_next_all_paras( run );
4324
4325 nLen = run->len - start->nOffset;
4326 str = get_text( run, start->nOffset );
4327
4328 while (srcChars && buflen && next_run)
4329 {
4330 if (bCRLF && run->nFlags & MERF_ENDPARA && ~run->nFlags & MERF_ENDCELL)
4331 {
4332 if (buflen == 1) break;
4333 /* FIXME: native fails to reduce srcChars here for WM_GETTEXT or
4334 * EM_GETTEXTEX, however, this is done for copying text which
4335 * also uses this function. */
4336 srcChars -= min(nLen, srcChars);
4337 nLen = 2;
4338 str = L"\r\n";
4339 }
4340 else
4341 {
4342 nLen = min(nLen, srcChars);
4343 srcChars -= nLen;
4344 }
4345
4346 nLen = min(nLen, buflen);
4347 buflen -= nLen;
4348
4349 CopyMemory(buffer, str, sizeof(WCHAR) * nLen);
4350
4351 buffer += nLen;
4352
4353 run = next_run;
4354 next_run = run_next_all_paras( run );
4355
4356 nLen = run->len;
4357 str = get_text( run, 0 );
4358 }
4359 /* append '\r' to the last paragraph. */
4360#ifdef __REACTOS__
4361 if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP && buflen)
4362#else
4363 if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP)
4364#endif
4365 {
4366 *buffer = '\r';
4367 buffer ++;
4368 }
4369 *buffer = 0;
4370 return buffer - pStart;
4371}
ME_Run * run_next_all_paras(ME_Run *run) DECLSPEC_HIDDEN
Definition: run.c:96

Referenced by fnTextSrv_TxGetText(), get_text_range(), get_unicode_text(), ITextRange_fnGetText(), ITextSelection_fnGetText(), ME_GetTextEx(), ME_IsCandidateAnURL(), ME_StreamIn(), and range_GetChar().

◆ ME_InitCharFormat2W()

void ME_InitCharFormat2W ( CHARFORMAT2W pFmt)

Definition at line 150 of file style.c.

151{
152 ZeroMemory(pFmt, sizeof(CHARFORMAT2W));
153 pFmt->cbSize = sizeof(CHARFORMAT2W);
154}

Referenced by ME_CharFormatFromLogFont(), and para_join().

◆ ME_InitContext()

void ME_InitContext ( ME_Context c,
ME_TextEditor editor,
HDC  hDC 
)

Definition at line 23 of file context.c.

24{
25 c->hDC = hDC;
26 c->editor = editor;
27 c->pt.x = 0;
28 c->pt.y = 0;
29 c->rcView = editor->rcFormat;
30 c->current_style = NULL;
31 c->orig_font = NULL;
32 if (hDC) {
33 c->dpi.cx = GetDeviceCaps(hDC, LOGPIXELSX);
34 c->dpi.cy = GetDeviceCaps(hDC, LOGPIXELSY);
35 } else {
36 c->dpi.cx = c->dpi.cy = 96;
37 }
38 if (editor->nAvailWidth)
39 c->nAvailWidth = ME_twips2pointsX(c, editor->nAvailWidth);
40 else
41 c->nAvailWidth = c->rcView.right - c->rcView.left;
42}
#define LOGPIXELSX
Definition: wingdi.h:718

Referenced by cursor_coords(), editor_draw(), ME_CharFromPoint(), ME_MakeFirstParagraph(), ME_PointFromChar(), stream_out_graphics(), and wrap_marked_paras_dc().

◆ ME_InitTableDef()

void ME_InitTableDef ( ME_TextEditor editor,
struct RTFTable tableDef 
)

Definition at line 556 of file table.c.

557{
558 ZeroMemory(tableDef->cells, sizeof(tableDef->cells));
559 ZeroMemory(tableDef->border, sizeof(tableDef->border));
560 tableDef->numCellsDefined = 0;
561 tableDef->leftEdge = 0;
562 if (!editor->bEmulateVersion10) /* v4.1 */
563 tableDef->gapH = 10;
564 else /* v1.0 - 3.0 */
565 tableDef->gapH = 0;
566}
RTFCell cells[MAX_TABLE_CELLS]
Definition: rtf.h:1027
int numCellsDefined
Definition: rtf.h:1028
int gapH
Definition: rtf.h:1030
RTFBorder border[6]
Definition: rtf.h:1032
int leftEdge
Definition: rtf.h:1030

Referenced by ME_RTFTblAttrHook().

◆ ME_InsertBefore()

void ME_InsertBefore ( ME_DisplayItem diWhere,
ME_DisplayItem diWhat 
)

Definition at line 26 of file list.c.

27{
28 diWhat->next = diWhere;
29 diWhat->prev = diWhere->prev;
30
31 diWhere->prev->next = diWhat;
32 diWhat->next->prev = diWhat;
33}

Referenced by ME_InsertRowStart(), ME_MakeFirstParagraph(), para_split(), run_insert(), and run_split().

◆ ME_InsertEndRowFromCursor()

void ME_InsertEndRowFromCursor ( ME_TextEditor editor,
int  nCursor 
)

Definition at line 537 of file caret.c.

538{
539 const WCHAR space = ' ';
540 ME_Cursor *cursor = editor->pCursors + nCursor;
542
543 /* FIXME no no no */
544 if (ME_IsSelection(editor))
545 ME_DeleteSelection(editor);
546
547 run_insert( editor, cursor, style, &space, 1, MERF_ENDROW );
548
550}
ME_Run * run_insert(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags) DECLSPEC_HIDDEN
Definition: run.c:375
#define MERF_ENDROW
Definition: editstr.h:123

Referenced by handle_enter(), and SpecialChar().

◆ ME_InsertOLEFromCursor()

void ME_InsertOLEFromCursor ( ME_TextEditor editor,
const REOBJECT reo,
int  nCursor 
)

Definition at line 503 of file caret.c.

504{
505 ME_Run *run, *prev;
506 const WCHAR space = ' ';
507 struct re_object *reobj_prev = NULL;
508 ME_Cursor *cursor = editor->pCursors + nCursor;
510
511 /* FIXME no no no */
512 if (ME_IsSelection(editor))
513 ME_DeleteSelection(editor);
514
515 run = run_insert( editor, cursor, style, &space, 1, MERF_GRAPHICS );
516
517 run->reobj = create_re_object( reo );
518
519 prev = run;
520 while ((prev = run_prev_all_paras( prev )))
521 {
522 if (prev->reobj)
523 {
524 reobj_prev = prev->reobj;
525 break;
526 }
527 }
528 if (reobj_prev)
529 list_add_after(&reobj_prev->entry, &run->reobj->entry);
530 else
531 list_add_head(&editor->reobj_list, &run->reobj->entry);
532
534}
static struct re_object * create_re_object(const REOBJECT *reo)
Definition: caret.c:490
__WINE_SERVER_LIST_INLINE void list_add_after(struct list *elem, struct list *to_add)
Definition: list.h:78
struct list entry
Definition: editstr.h:153
struct list reobj_list
Definition: editstr.h:450

Referenced by insert_static_object(), and IRichEditOle_fnInsertObject().

◆ ME_InsertString()

BOOL ME_InsertString ( ME_String s,
int  ofs,
const WCHAR insert,
int  len 
)

Definition at line 103 of file string.c.

104{
105 DWORD new_len = s->nLen + len + 1;
106 WCHAR *new;
107
108 assert( s->nBuffer ); /* Not a const string */
109 assert( ofs <= s->nLen );
110
111 if( new_len > s->nBuffer )
112 {
113 s->nBuffer = ME_GetOptimalBuffer( new_len );
114 new = heap_realloc( s->szData, s->nBuffer * sizeof(WCHAR) );
115 if (!new) return FALSE;
116 s->szData = new;
117 }
118
119 memmove( s->szData + ofs + len, s->szData + ofs, (s->nLen - ofs + 1) * sizeof(WCHAR) );
120 memcpy( s->szData + ofs, insert, len * sizeof(WCHAR) );
121 s->nLen += len;
122
123 return TRUE;
124}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
static int ME_GetOptimalBuffer(int nLen)
Definition: string.c:25
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static int insert
Definition: xmllint.c:138

Referenced by ME_AppendString(), and run_insert().

◆ ME_InsertTextFromCursor()

void ME_InsertTextFromCursor ( ME_TextEditor editor,
int  nCursor,
const WCHAR str,
int  len,
ME_Style style 
)

Definition at line 553 of file caret.c.

555{
556 const WCHAR *pos;
557 ME_Cursor *cursor = editor->pCursors + nCursor;
558 int oldLen;
559
560 /* FIXME really HERE ? */
561 if (ME_IsSelection(editor))
562 ME_DeleteSelection(editor);
563
564 oldLen = ME_GetTextLength(editor);
565
566 /* text operations set modified state */
567 editor->nModifyStep = 1;
568
569 assert(style);
570
571 if (len == -1) len = lstrlenW( str );
572
573 /* grow the text limit to fit our text */
574 if (editor->nTextLimit < oldLen + len) editor->nTextLimit = oldLen + len;
575
576 pos = str;
577
578 while (len)
579 {
580 /* FIXME this sucks - no respect for unicode (what else can be a line separator in unicode?) */
581 while (pos - str < len && *pos != '\r' && *pos != '\n' && *pos != '\t')
582 pos++;
583
584 if (pos != str) /* handle text */
585 run_insert( editor, cursor, style, str, pos - str, 0 );
586 else if (*pos == '\t') /* handle tabs */
587 {
588 const WCHAR tab = '\t';
589 run_insert( editor, cursor, style, &tab, 1, MERF_TAB );
590 pos++;
591 }
592 else /* handle EOLs */
593 {
594 ME_Run *end_run, *run, *prev;
595 ME_Paragraph *new_para;
596 int eol_len = 0;
597
598 /* Check if new line is allowed for this control */
599 if (!(editor->props & TXTBIT_MULTILINE))
600 break;
601
602 /* Find number of CR and LF in end of paragraph run */
603 if (*pos =='\r')
604 {
605 if (len > 1 && pos[1] == '\n')
606 eol_len = 2;
607 else if (len > 2 && pos[1] == '\r' && pos[2] == '\n')
608 eol_len = 3;
609 else
610 eol_len = 1;
611 }
612 else
613 {
614 assert(*pos == '\n');
615 eol_len = 1;
616 }
617 pos += eol_len;
618
619 if (!editor->bEmulateVersion10 && eol_len == 3)
620 {
621 /* handle special \r\r\n sequence (richedit 2.x and higher only) */
622 const WCHAR space = ' ';
623 run_insert( editor, cursor, style, &space, 1, 0 );
624 }
625 else
626 {
627 const WCHAR cr = '\r', *eol_str = str;
628
629 if (!editor->bEmulateVersion10)
630 {
631 eol_str = &cr;
632 eol_len = 1;
633 }
634
635 if (cursor->nOffset == cursor->run->len)
636 {
637 run = run_next( cursor->run );
638 if (!run) run = cursor->run;
639 }
640 else
641 {
642 if (cursor->nOffset) run_split( editor, cursor );
643 run = cursor->run;
644 }
645
646 new_para = para_split( editor, run, style, eol_str, eol_len, 0 );
647 end_run = para_end_run( para_prev( new_para ) );
648
649 /* Move any cursors that were at the end of the previous run to the beginning of the new para */
650 prev = run_prev( end_run );
651 if (prev)
652 {
653 int i;
654 for (i = 0; i < editor->nCursors; i++)
655 {
656 if (editor->pCursors[i].run == prev &&
657 editor->pCursors[i].nOffset == prev->len)
658 {
659 editor->pCursors[i].para = new_para;
660 editor->pCursors[i].run = run;
661 editor->pCursors[i].nOffset = 0;
662 }
663 }
664 }
665
666 }
667 }
668 len -= pos - str;
669 str = pos;
670 }
671}
ME_Paragraph * para_split(ME_TextEditor *editor, ME_Run *run, ME_Style *style, const WCHAR *eol_str, int eol_len, int paraFlags) DECLSPEC_HIDDEN
Definition: para.c:540
ME_Run * run_split(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: run.c:305
static struct wctab tab[]

Referenced by editor_handle_message(), fnTextSrv_TxSetText(), handle_enter(), handle_wm_char(), ITextRange_fnSetText(), ME_ReplaceSel(), ME_RTFParAttrHook(), ME_RTFSpecialCharHook(), ME_SetText(), ME_StreamInText(), RTFFlushUnicodeOutputBuffer(), and table_append_row().

◆ ME_InternalDeleteText()

BOOL ME_InternalDeleteText ( ME_TextEditor editor,
ME_Cursor start,
int  nChars,
BOOL  bForce 
)

Definition at line 339 of file caret.c.

341{
342 ME_Cursor c = *start;
343 int nOfs = ME_GetCursorOfs(start), text_len = ME_GetTextLength( editor );
344 int shift = 0;
345 int totalChars = nChars;
346 ME_Paragraph *start_para;
347 BOOL delete_all = FALSE;
348
349 /* Prevent deletion past last end of paragraph run. */
350 nChars = min(nChars, text_len - nOfs);
351 if (nChars == text_len) delete_all = TRUE;
352 start_para = c.para;
353
354 if (!bForce)
355 {
356 table_protect_partial_deletion( editor, &c, &nChars );
357 if (nChars == 0) return FALSE;
358 }
359
360 while (nChars > 0)
361 {
362 ME_Run *run;
363 cursor_from_char_ofs( editor, nOfs + nChars, &c );
364 if (!c.nOffset)
365 {
366 /* We aren't deleting anything in this run, so we will go back to the
367 * last run we are deleting text in. */
368 c.run = run_prev_all_paras( c.run );
369 c.para = c.run->para;
370 c.nOffset = c.run->len;
371 }
372 run = c.run;
373 if (run->nFlags & MERF_ENDPARA)
374 {
375 int eollen = c.run->len;
376 BOOL keepFirstParaFormat;
377
378 if (!para_next( para_next( c.para ) )) return TRUE;
379
380 keepFirstParaFormat = (totalChars == nChars && nChars <= eollen &&
381 run->nCharOfs);
382 if (!editor->bEmulateVersion10) /* v4.1 */
383 {
384 ME_Paragraph *this_para = run->para;
385 ME_Paragraph *next_para = para_next( this_para );
386
387 /* The end of paragraph before a table row is only deleted if there
388 * is nothing else on the line before it. */
389 if (this_para == start_para && next_para->nFlags & MEPF_ROWSTART)
390 {
391 /* If the paragraph will be empty, then it should be deleted, however
392 * it still might have text right now which would inherit the
393 * MEPF_STARTROW property if we joined it right now.
394 * Instead we will delete it after the preceding text is deleted. */
395 if (nOfs > this_para->nCharOfs)
396 {
397 /* Skip this end of line. */
398 nChars -= (eollen < nChars) ? eollen : nChars;
399 continue;
400 }
401 keepFirstParaFormat = TRUE;
402 }
403 }
404 para_join( editor, c.para, keepFirstParaFormat );
405 /* ME_SkipAndPropagateCharOffset(p->pRun, shift); */
406 ME_CheckCharOffsets(editor);
407 nChars -= (eollen < nChars) ? eollen : nChars;
408 continue;
409 }
410 else
411 {
413 int nCharsToDelete = min(nChars, c.nOffset);
414 int i;
415
416 c.nOffset -= nCharsToDelete;
417
418 para_mark_rewrap( editor, c.run->para );
419
420 cursor = c;
421 /* nChars is the number of characters that should be deleted from the
422 PRECEDING runs (these BEFORE cursor.pRun)
423 nCharsToDelete is a number of chars to delete from THIS run */
424 nChars -= nCharsToDelete;
425 shift -= nCharsToDelete;
426 TRACE("Deleting %d (remaining %d) chars at %d in %s (%d)\n",
427 nCharsToDelete, nChars, c.nOffset,
428 debugstr_run( run ), run->len);
429
430 /* nOfs is a character offset (from the start of the document
431 to the current (deleted) run */
432 add_undo_insert_run( editor, nOfs + nChars, get_text( run, c.nOffset ), nCharsToDelete, run->nFlags, run->style );
433
434 ME_StrDeleteV(run->para->text, run->nCharOfs + c.nOffset, nCharsToDelete);
435 run->len -= nCharsToDelete;
436 TRACE("Post deletion string: %s (%d)\n", debugstr_run( run ), run->len);
437 TRACE("Shift value: %d\n", shift);
438
439 /* update cursors (including c) */
440 for (i=-1; i<editor->nCursors; i++) {
441 ME_Cursor *pThisCur = editor->pCursors + i;
442 if (i == -1) pThisCur = &c;
443 if (pThisCur->run == cursor.run) {
444 if (pThisCur->nOffset > cursor.nOffset) {
445 if (pThisCur->nOffset-cursor.nOffset < nCharsToDelete)
446 pThisCur->nOffset = cursor.nOffset;
447 else
448 pThisCur->nOffset -= nCharsToDelete;
449 assert(pThisCur->nOffset >= 0);
450 assert(pThisCur->nOffset <= run->len);
451 }
452 if (pThisCur->nOffset == run->len)
453 {
454 pThisCur->run = run_next( pThisCur->run );
455 assert( pThisCur->run );
456 pThisCur->nOffset = 0;
457 }
458 }
459 }
460
461 /* c = updated data now */
462
463 if (c.run == cursor.run) c.run->nCharOfs -= shift;
465
466 if (!cursor.run->len)
467 {
468 TRACE("Removing empty run\n");
469 ME_Remove( run_get_di( cursor.run ));
471 }
472
473 shift = 0;
474 continue;
475 }
476 }
477 if (delete_all) editor_set_default_para_fmt( editor, &start_para->fmt );
478 return TRUE;
479}
BOOL add_undo_insert_run(ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style) DECLSPEC_HIDDEN
Definition: undo.c:131
ME_Paragraph * para_join(ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt) DECLSPEC_HIDDEN
Definition: para.c:683
void table_protect_partial_deletion(ME_TextEditor *editor, ME_Cursor *c, int *num_chars) DECLSPEC_HIDDEN
Definition: table.c:217
void editor_propagate_char_ofs(ME_Paragraph *para, ME_Run *run, int shift) DECLSPEC_HIDDEN
Definition: run.c:147
void para_mark_rewrap(ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:26
void editor_set_default_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
Definition: para.c:960
void ME_Remove(ME_DisplayItem *diWhere) DECLSPEC_HIDDEN
Definition: list.c:35
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN
Definition: string.c:147

Referenced by editor_copy_or_cut(), editor_handle_message(), fnTextSrv_TxSetText(), ITextRange_fnSetText(), ME_DeleteTextAtCursor(), ME_PlayUndoItem(), ME_ReplaceSel(), ME_RTFSpecialCharHook(), and ME_StreamIn().

◆ ME_InvalidateSelection()

void ME_InvalidateSelection ( ME_TextEditor editor)

Definition at line 1247 of file paint.c.

1248{
1249 ME_Paragraph *sel_start, *sel_end;
1250 ME_Paragraph *repaint_start = NULL, *repaint_end = NULL;
1251 int nStart, nEnd;
1252 int len = ME_GetTextLength(editor);
1253
1254 ME_GetSelectionOfs(editor, &nStart, &nEnd);
1255 /* if both old and new selection are 0-char (= caret only), then
1256 there's no (inverted) area to be repainted, neither old nor new */
1257 if (nStart == nEnd && editor->nLastSelStart == editor->nLastSelEnd)
1258 return;
1260 editor_get_selection_paras( editor, &sel_start, &sel_end );
1261
1262 /* last selection markers aren't always updated, which means
1263 * they can point past the end of the document */
1264 if (editor->nLastSelStart > len || editor->nLastSelEnd > len)
1265 {
1266 repaint_start = editor_first_para( editor );
1267 repaint_end = para_prev( editor_end_para( editor ) );
1268 }
1269 else
1270 {
1271 /* if the start part of selection is being expanded or contracted... */
1272 if (nStart < editor->nLastSelStart)
1273 {
1274 repaint_start = sel_start;
1275 repaint_end = editor->last_sel_start_para;
1276 }
1277 else if (nStart > editor->nLastSelStart)
1278 {
1279 repaint_start = editor->last_sel_start_para;
1280 repaint_end = sel_start;
1281 }
1282
1283 /* if the end part of selection is being contracted or expanded... */
1284 if (nEnd < editor->nLastSelEnd)
1285 {
1286 if (!repaint_start) repaint_start = sel_end;
1287 repaint_end = editor->last_sel_end_para;
1288 }
1289 else if (nEnd > editor->nLastSelEnd)
1290 {
1291 if (!repaint_start) repaint_start = editor->last_sel_end_para;
1292 repaint_end = sel_end;
1293 }
1294 }
1295
1296 if (repaint_start)
1297 para_range_invalidate( editor, repaint_start, repaint_end );
1298 /* remember the last invalidated position */
1299 ME_GetSelectionOfs(editor, &editor->nLastSelStart, &editor->nLastSelEnd);
1301}
void para_range_invalidate(ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para) DECLSPEC_HIDDEN
Definition: wrap.c:1102
void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end) DECLSPEC_HIDDEN
Definition: para.c:850
ME_Paragraph * last_sel_end_para
Definition: editstr.h:411
ME_Paragraph * last_sel_start_para
Definition: editstr.h:411

Referenced by editor_handle_message(), fnTextSrv_OnTxPropertyBitsChange(), ME_ArrowKey(), ME_LButtonDown(), ME_MouseMove(), set_selection(), and table_handle_tab().

◆ ME_IsSelection()

◆ ME_IsWSpace()

static int ME_IsWSpace ( WCHAR  ch)
inlinestatic

Definition at line 99 of file editor.h.

100{
101 return ch > '\0' && ch <= ' ';
102}

Referenced by find_non_whitespace(), ME_UpdateRunFlags(), ME_WordBreakProc(), reverse_find_non_whitespace(), reverse_find_whitespace(), run_is_entirely_ws(), and run_is_splittable().

◆ ME_LButtonDown()

void ME_LButtonDown ( ME_TextEditor editor,
int  x,
int  y,
int  clickNum 
)

Definition at line 1137 of file caret.c.

1138{
1139 ME_Cursor tmp_cursor;
1140 BOOL is_selection = FALSE, is_shift;
1141
1142 editor->nUDArrowX = -1;
1143
1144 x += editor->horz_si.nPos;
1145 y += editor->vert_si.nPos;
1146
1147 tmp_cursor = editor->pCursors[0];
1148 is_selection = ME_IsSelection(editor);
1149 is_shift = GetKeyState(VK_SHIFT) < 0;
1150
1151 cursor_from_virtual_coords( editor, x, y, &editor->pCursors[0], FALSE );
1152
1153 if (x >= editor->rcFormat.left || is_shift)
1154 {
1155 if (clickNum > 1)
1156 {
1157 editor->pCursors[1] = editor->pCursors[0];
1158 if (is_shift) {
1159 if (x >= editor->rcFormat.left)
1160 ME_SelectByType(editor, stWord);
1161 else
1163 } else if (clickNum % 2 == 0) {
1164 ME_SelectByType(editor, stWord);
1165 } else {
1167 }
1168 }
1169 else if (!is_shift)
1170 {
1171 editor->nSelectionType = stPosition;
1172 editor->pCursors[1] = editor->pCursors[0];
1173 }
1174 else if (!is_selection)
1175 {
1176 editor->nSelectionType = stPosition;
1177 editor->pCursors[1] = tmp_cursor;
1178 }
1179 else if (editor->nSelectionType != stPosition)
1180 {
1182 }
1183 }
1184 else
1185 {
1186 if (clickNum < 2) {
1187 ME_SelectByType(editor, stLine);
1188 } else if (clickNum % 2 == 0 || is_shift) {
1190 } else {
1191 ME_SelectByType(editor, stDocument);
1192 }
1193 }
1194 ME_InvalidateSelection(editor);
1195 update_caret(editor);
1196 ME_SendSelChange(editor);
1197}
static void ME_ExtendAnchorSelection(ME_TextEditor *editor)
Definition: caret.c:1069
static void ME_SelectByType(ME_TextEditor *editor, ME_SelectionType selectionType)
Definition: caret.c:841
@ stWord
Definition: editstr.h:357
@ stParagraph
Definition: editstr.h:359
#define VK_SHIFT
Definition: winuser.h:2213

Referenced by editor_handle_message().

◆ ME_MakeDI()

ME_DisplayItem * ME_MakeDI ( ME_DIType  type)

Definition at line 133 of file list.c.

134{
135 ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
136
137 item->type = type;
138 item->prev = item->next = NULL;
139 return item;
140}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by cell_create(), ME_MakeText(), para_create(), row_create(), and run_create().

◆ ME_MakeEditor()

ME_TextEditor * ME_MakeEditor ( ITextHost *  texthost,
BOOL  bEmulateVersion10 
)

Definition at line 2933 of file editor.c.

2934{
2935 ME_TextEditor *ed = heap_alloc(sizeof(*ed));
2936 int i;
2937 LONG selbarwidth;
2938 HRESULT hr;
2939
2940 ed->sizeWindow.cx = ed->sizeWindow.cy = 0;
2941 if (ITextHost_QueryInterface( texthost, &IID_ITextHost2, (void **)&ed->texthost ) == S_OK)
2942 {
2943 ITextHost_Release( texthost );
2944 ed->have_texthost2 = TRUE;
2945 }
2946 else
2947 {
2948 ed->texthost = (ITextHost2 *)texthost;
2949 ed->have_texthost2 = FALSE;
2950 }
2951
2952 ed->bEmulateVersion10 = bEmulateVersion10;
2953 ed->in_place_active = FALSE;
2954 ed->total_rows = 0;
2959 &ed->props );
2961 ed->pBuffer = ME_MakeText();
2962 ed->nZoomNumerator = ed->nZoomDenominator = 0;
2963 ed->nAvailWidth = 0; /* wrap to client area */
2964 list_init( &ed->style_list );
2966 /* The four cursors are for:
2967 * 0 - The position where the caret is shown
2968 * 1 - The anchored end of the selection (for normal selection)
2969 * 2 & 3 - The anchored start and end respectively for word, line,
2970 * or paragraph selection.
2971 */
2972 ed->nCursors = 4;
2973 ed->pCursors = heap_alloc(ed->nCursors * sizeof(*ed->pCursors));
2974 ME_SetCursorToStart(ed, &ed->pCursors[0]);
2975 ed->pCursors[1] = ed->pCursors[0];
2976 ed->pCursors[2] = ed->pCursors[0];
2977 ed->pCursors[3] = ed->pCursors[1];
2978 ed->nLastTotalLength = ed->nTotalLength = 0;
2979 ed->nLastTotalWidth = ed->nTotalWidth = 0;
2980 ed->nUDArrowX = -1;
2981 ed->nEventMask = 0;
2982 ed->nModifyStep = 0;
2984 list_init( &ed->undo_stack );
2985 list_init( &ed->redo_stack );
2986 ed->nUndoStackSize = 0;
2988 ed->nUndoMode = umAddToUndo;
2989 ed->nParagraphs = 1;
2990 ed->nLastSelStart = ed->nLastSelEnd = 0;
2992 ed->bHideSelection = FALSE;
2993 ed->pfnWordBreak = NULL;
2994 ed->richole = NULL;
2995 ed->lpOleCallback = NULL;
2999 ed->bHaveFocus = FALSE;
3000 ed->bMouseCaptured = FALSE;
3001 ed->caret_hidden = FALSE;
3002 ed->caret_height = 0;
3003 for (i=0; i<HFONT_CACHE_SIZE; i++)
3004 {
3005 ed->pFontCache[i].nRefs = 0;
3006 ed->pFontCache[i].nAge = 0;
3007 ed->pFontCache[i].hFont = NULL;
3008 }
3009
3011 SetRectEmpty(&ed->rcFormat);
3012 hr = ITextHost_TxGetSelectionBarWidth( ed->texthost, &selbarwidth );
3013 /* FIXME: Convert selbarwidth from HIMETRIC to pixels */
3014 if (hr == S_OK && selbarwidth) ed->selofs = SELECTIONBAR_WIDTH;
3015 else ed->selofs = 0;
3017
3018 ed->password_char = 0;
3019 if (ed->props & TXTBIT_USEPASSWORD)
3021
3022 ed->bWordWrap = (ed->props & TXTBIT_WORDWRAP) && (ed->props & TXTBIT_MULTILINE);
3023
3024 ed->notified_cr.cpMin = ed->notified_cr.cpMax = 0;
3025
3026 /* Default scrollbar information */
3027 ed->vert_si.cbSize = sizeof(SCROLLINFO);
3028 ed->vert_si.nMin = 0;
3029 ed->vert_si.nMax = 0;
3030 ed->vert_si.nPage = 0;
3031 ed->vert_si.nPos = 0;
3032 ed->vert_sb_enabled = 0;
3033
3034 ed->horz_si.cbSize = sizeof(SCROLLINFO);
3035 ed->horz_si.nMin = 0;
3036 ed->horz_si.nMax = 0;
3037 ed->horz_si.nPage = 0;
3038 ed->horz_si.nPos = 0;
3039 ed->horz_sb_enabled = 0;
3040
3042 {
3043 if (ed->scrollbars & WS_VSCROLL)
3044 {
3047 }
3048 if (ed->scrollbars & WS_HSCROLL)
3049 {
3052 }
3053 }
3054
3055 ed->wheel_remain = 0;
3056
3059
3060 list_init( &ed->reobj_list );
3062
3063 return ed;
3064}
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
static ME_TextBuffer * ME_MakeText(void)
Definition: editor.c:259
#define TEXT_LIMIT_DEFAULT
Definition: editor.c:249
#define ITextHost_TxSetScrollRange(This, a, b, c, d)
Definition: editor.h:337
#define ITextHost_TxGetPropertyBits(This, a, b)
Definition: editor.h:367
#define ITextHost_TxGetBackStyle(This, a)
Definition: editor.h:359
void ME_MakeFirstParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: para.c:151
#define ITextHost_TxGetScrollBars(This, a)
Definition: editor.h:361
#define ITextHost_TxGetSelectionBarWidth(This, a)
Definition: editor.h:371
#define ITextHost_TxGetPasswordChar(This, a)
Definition: editor.h:362
#define ITextHost_TxEnableScrollBar(This, a, b)
Definition: editor.h:336
#define SELECTIONBAR_WIDTH
Definition: editstr.h:99
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
#define ES_DISABLENOSCROLL
Definition: richedit.h:224
unsigned int horz_sb_enabled
Definition: editstr.h:442
unsigned int have_texthost2
Definition: editstr.h:387
unsigned int vert_sb_enabled
Definition: editstr.h:441
TXTBACKSTYLE back_style
Definition: editstr.h:448
WCHAR password_char
Definition: editstr.h:427
CHARRANGE notified_cr
Definition: editstr.h:437
BOOL caret_hidden
Definition: editstr.h:445
unsigned int in_place_active
Definition: editstr.h:386
#define TXTBIT_AUTOWORDSEL
Definition: textserv.h:192
#define TXTBIT_WORDWRAP
Definition: textserv.h:195
#define TXTBIT_VERTICAL
Definition: textserv.h:193
#define TXTBIT_ALLOWBEEP
Definition: textserv.h:196
#define TXTBIT_SAVESELECTION
Definition: textserv.h:191
@ TXTBACK_OPAQUE
Definition: textserv.h:165
#define TXTBIT_RICHTEXT
Definition: textserv.h:185
#define TXTBIT_USEPASSWORD
Definition: textserv.h:189
EXTERN_C const IID IID_ITextHost2
Definition: textserv.h:38
#define TXTBIT_DISABLEDRAG
Definition: textserv.h:197
struct tagSCROLLINFO SCROLLINFO
#define SB_VERT
Definition: winuser.h:553
#define ESB_DISABLE_BOTH
Definition: winuser.h:556
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define SB_HORZ
Definition: winuser.h:552

Referenced by create_text_services().

◆ ME_MakeFirstParagraph()

void ME_MakeFirstParagraph ( ME_TextEditor editor)

Definition at line 151 of file para.c.

152{
155 const CHARFORMATW *host_cf;
156 LOGFONTW lf;
157 HFONT hf;
158 ME_TextBuffer *text = editor->pBuffer;
159 ME_Paragraph *para = para_create( editor );
160 ME_Run *run;
162 int eol_len;
163 HDC hdc = ITextHost_TxGetDC( editor->texthost );
164
165 ME_InitContext( &c, editor, hdc );
166
168 assert(hf);
169 GetObjectW(hf, sizeof(LOGFONTW), &lf);
170 ZeroMemory(&cf, sizeof(cf));
171 cf.cbSize = sizeof(cf);
178
179 cf.dwEffects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
180 lstrcpyW(cf.szFaceName, lf.lfFaceName);
181 /* Convert system font height from logical units to twips for cf.yHeight */
182 cf.yHeight = (lf.lfHeight * 72 * 1440) / (c.dpi.cy * c.dpi.cy);
183 if (lf.lfWeight > FW_NORMAL) cf.dwEffects |= CFE_BOLD;
184 cf.wWeight = lf.lfWeight;
185 if (lf.lfItalic) cf.dwEffects |= CFE_ITALIC;
186 if (lf.lfUnderline) cf.dwEffects |= CFE_UNDERLINE;
187 cf.bUnderlineType = CFU_UNDERLINE;
188 if (lf.lfStrikeOut) cf.dwEffects |= CFE_STRIKEOUT;
189 cf.bPitchAndFamily = lf.lfPitchAndFamily;
190 cf.bCharSet = lf.lfCharSet;
191 cf.lcid = GetSystemDefaultLCID();
192
194 text->pDefaultStyle = style;
195
196 if (ITextHost_TxGetCharFormat(editor->texthost, &host_cf) == S_OK)
197 {
198 ZeroMemory(&cf, sizeof(cf));
199 cf.cbSize = sizeof(cf);
200 cfany_to_cf2w(&cf, (CHARFORMAT2W *)host_cf);
201 ME_SetDefaultCharFormat(editor, &cf);
202 }
203
204 eol_len = editor->bEmulateVersion10 ? 2 : 1;
205 para->text = ME_MakeStringN( L"\r\n", eol_len );
206
207 run = run_create( style, MERF_ENDPARA );
208 run->nCharOfs = 0;
209 run->len = eol_len;
210 run->para = para;
211 para->eop_run = run;
212
213 ME_InsertBefore( text->pLast, para_get_di( para) );
214 ME_InsertBefore( text->pLast, run_get_di( run ) );
215 para->prev_para = text->pFirst;
216 para->next_para = text->pLast;
217 text->pFirst->member.para.next_para = para_get_di( para );
218 text->pLast->member.para.prev_para = para_get_di( para );
219
220 text->pLast->member.para.nCharOfs = editor->bEmulateVersion10 ? 2 : 1;
221
223 para_mark_add( editor, para );
226}
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1230
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
Definition: style.c:36
ME_Run * run_create(ME_Style *s, int nFlags) DECLSPEC_HIDDEN
Definition: run.c:343
static ME_DisplayItem * para_get_di(ME_Paragraph *para)
Definition: editor.h:237
ME_Style * ME_MakeStyle(CHARFORMAT2W *style) DECLSPEC_HIDDEN
Definition: style.c:121
ME_String * ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN
Definition: string.c:75
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN
Definition: list.c:26
#define ITextHost_TxGetCharFormat(This, a)
Definition: editor.h:356
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static ME_Paragraph * para_create(ME_TextEditor *editor)
Definition: para.c:32
void para_mark_add(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:99
static int para_mark_compare(const void *key, const struct wine_rb_entry *entry)
Definition: para.c:87
#define CFM_SMALLCAPS
Definition: richedit.h:338
#define CFE_STRIKEOUT
Definition: richedit.h:409
#define CFM_SHADOW
Definition: richedit.h:342
#define CFM_IMPRINT
Definition: richedit.h:344
#define CFE_ITALIC
Definition: richedit.h:407
#define CFM_OUTLINE
Definition: richedit.h:341
#define CFM_EMBOSS
Definition: richedit.h:343
#define CFM_SUBSCRIPT
Definition: richedit.h:348
#define CFM_DISABLED
Definition: richedit.h:345
#define CFM_REVISED
Definition: richedit.h:346
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
#define CFM_ALLCAPS
Definition: richedit.h:339
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
ME_String * text
Definition: editstr.h:204
ME_Run * eop_run
Definition: editstr.h:215
struct wine_rb_tree marked_paras
Definition: editstr.h:451

Referenced by ME_MakeEditor().

◆ ME_MakeStringConst()

ME_String * ME_MakeStringConst ( const WCHAR str,
int  len 
)

Definition at line 41 of file string.c.

42{
44 if (!s) return NULL;
45
46 s->szData = (WCHAR *)str;
47 s->nLen = len;
48 s->nBuffer = 0;
49 return s;
50}
static ME_String * make_string(void(*free)(ME_String *))
Definition: string.c:30

Referenced by para_num_init().

◆ ME_MakeStringEmpty()

ME_String * ME_MakeStringEmpty ( int  len)

Definition at line 58 of file string.c.

59{
61
62 if (!s) return NULL;
63 s->nLen = nMaxChars;
64 s->nBuffer = ME_GetOptimalBuffer(s->nLen + 1);
65 s->szData = heap_alloc( s->nBuffer * sizeof(WCHAR) );
66 if (!s->szData)
67 {
68 heap_free( s );
69 return NULL;
70 }
71 s->szData[s->nLen] = 0;
72 return s;
73}
static void heap_string_free(ME_String *s)
Definition: string.c:52

Referenced by ME_MakeStringN(), ME_MakeStringR(), and para_num_get_str().

◆ ME_MakeStringN()

ME_String * ME_MakeStringN ( LPCWSTR  szText,
int  nMaxChars 
)

Definition at line 75 of file string.c.

76{
77 ME_String *s = ME_MakeStringEmpty(nMaxChars);
78
79 if (!s) return NULL;
80 memcpy(s->szData, szText, s->nLen * sizeof(WCHAR));
81 return s;
82}
ME_String * ME_MakeStringEmpty(int nMaxChars)
Definition: string.c:58

Referenced by ME_MakeFirstParagraph(), and ME_VSplitString().

◆ ME_MakeStringR()

ME_String * ME_MakeStringR ( WCHAR  cRepeat,
int  nMaxChars 
)

Definition at line 85 of file string.c.

86{
87 int i;
88 ME_String *s = ME_MakeStringEmpty(nMaxChars);
89
90 if (!s) return NULL;
91 for (i = 0; i < nMaxChars; i++)
92 s->szData[i] = cRepeat;
93 return s;
94}

Referenced by draw_text(), ME_CharFromPointContext(), ME_GetRunSizeCommon(), and ME_PointFromCharContext().

◆ ME_MakeStyle()

ME_Style * ME_MakeStyle ( CHARFORMAT2W style)

Definition at line 121 of file style.c.

122{
123 ME_Style *s = heap_alloc(sizeof(*s));
124
125 assert(style->cbSize == sizeof(CHARFORMAT2W));
126 s->fmt = *style;
127 s->nRefs = 1;
128 s->font_cache = NULL;
129 memset(&s->tm, 0, sizeof(s->tm));
130 s->tm.tmAscent = -1;
131 s->script_cache = NULL;
132 list_init(&s->entry);
133 all_refs++;
134 TRACE_(richedit_style)("ME_MakeStyle %p, total refs=%d\n", s, all_refs);
135 return s;
136}

Referenced by ME_ApplyStyle(), and ME_MakeFirstParagraph().

◆ ME_MakeTableDef()

struct RTFTable * ME_MakeTableDef ( ME_TextEditor editor)

Definition at line 547 of file table.c.

548{
549 RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
550
551 if (!editor->bEmulateVersion10) /* v4.1 */
552 tableDef->gapH = 10;
553 return tableDef;
554}
Definition: rtf.h:1026

Referenced by ME_RTFTblAttrHook().

◆ ME_MouseMove()

void ME_MouseMove ( ME_TextEditor editor,
int  x,
int  y 
)

Definition at line 1199 of file caret.c.

1200{
1201 ME_Cursor tmp_cursor;
1202
1203 if (editor->nSelectionType == stDocument)
1204 return;
1205 x += editor->horz_si.nPos;
1206 y += editor->vert_si.nPos;
1207
1208 tmp_cursor = editor->pCursors[0];
1209 /* FIXME: do something with the return value of cursor_from_virtual_coords */
1210 cursor_from_virtual_coords( editor, x, y, &tmp_cursor, TRUE );
1211
1212 ME_InvalidateSelection(editor);
1213 editor->pCursors[0] = tmp_cursor;
1215
1216 if (editor->nSelectionType != stPosition &&
1217 memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor)))
1218 /* The scroll the cursor towards the other end, since it was the one
1219 * extended by ME_ExtendAnchorSelection */
1220 editor_ensure_visible( editor, &editor->pCursors[1] );
1221 else
1222 editor_ensure_visible( editor, &editor->pCursors[0] );
1223
1224 ME_InvalidateSelection(editor);
1225 update_caret(editor);
1226 ME_SendSelChange(editor);
1227}

Referenced by editor_handle_message().

◆ ME_MoveCursorChars()

int ME_MoveCursorChars ( ME_TextEditor editor,
ME_Cursor cursor,
int  nRelOfs,
BOOL  final_eop 
)

Definition at line 678 of file caret.c.

679{
680 cursor->nOffset += nRelOfs;
681 if (cursor->nOffset < 0)
682 {
683 cursor->nOffset += cursor->run->nCharOfs;
684 if (cursor->nOffset >= 0)
685 {
686 /* new offset in the same paragraph */
687 do {
688 cursor->run = run_prev( cursor->run );
689 } while (cursor->nOffset < cursor->run->nCharOfs);
690 cursor->nOffset -= cursor->run->nCharOfs;
691 return nRelOfs;
692 }
693
694 cursor->nOffset += cursor->para->nCharOfs;
695 if (cursor->nOffset <= 0)
696 {
697 /* moved to the start of the text */
698 nRelOfs -= cursor->nOffset;
700 return nRelOfs;
701 }
702
703 /* new offset in a previous paragraph */
704 do {
705 cursor->para = para_prev( cursor->para );
706 } while (cursor->nOffset < cursor->para->nCharOfs);
707 cursor->nOffset -= cursor->para->nCharOfs;
708
709 cursor->run = para_end_run( cursor->para );
710 while (cursor->nOffset < cursor->run->nCharOfs)
711 cursor->run = run_prev( cursor->run );
712 cursor->nOffset -= cursor->run->nCharOfs;
713 }
714 else if (cursor->nOffset >= cursor->run->len)
715 {
716 ME_Paragraph *next_para;
717 int new_offset;
718
719 new_offset = ME_GetCursorOfs(cursor);
720 next_para = para_next( cursor->para );
721 if (new_offset < next_para->nCharOfs)
722 {
723 /* new offset in the same paragraph */
724 do {
725 cursor->nOffset -= cursor->run->len;
726 cursor->run = run_next( cursor->run );
727 } while (cursor->nOffset >= cursor->run->len);
728 return nRelOfs;
729 }
730
731 if (new_offset >= ME_GetTextLength(editor) + (final_eop ? 1 : 0))
732 {
733 /* new offset at the end of the text */
734 ME_SetCursorToEnd(editor, cursor, final_eop);
735 nRelOfs -= new_offset - (ME_GetTextLength(editor) + (final_eop ? 1 : 0));
736 return nRelOfs;
737 }
738
739 /* new offset in a following paragraph */
740 do {
741 cursor->para = next_para;
742 next_para = para_next( next_para );
743 } while (new_offset >= next_para->nCharOfs);
744
745 cursor->nOffset = new_offset - cursor->para->nCharOfs;
746 cursor->run = para_first_run( cursor->para );
747 while (cursor->nOffset >= cursor->run->len)
748 {
749 cursor->nOffset -= cursor->run->len;
750 cursor->run = run_next( cursor->run );
751 }
752 } /* else new offset is in the same run */
753 return nRelOfs;
754}

Referenced by get_textfont_prop_for_pos(), ME_ArrowKey(), ME_FindText(), ME_PlayUndoItem(), ME_StreamIn(), ME_StreamOutRTF(), set_selection_cursors(), table_protect_partial_deletion(), textrange_endof(), textrange_move(), textrange_moveend(), and textrange_movestart().

◆ ME_MoveCursorWords()

BOOL ME_MoveCursorWords ( ME_TextEditor editor,
ME_Cursor cursor,
int  nRelOfs 
)

Definition at line 758 of file caret.c.

759{
760 ME_Run *run = cursor->run, *other_run;
761 ME_Paragraph *para = cursor->para;
762 int nOffset = cursor->nOffset;
763
764 if (nRelOfs == -1)
765 {
766 /* Backward movement */
767 while (TRUE)
768 {
769 nOffset = ME_CallWordBreakProc( editor, get_text( run, 0 ), run->len, nOffset, WB_MOVEWORDLEFT );
770 if (nOffset) break;
771 other_run = run_prev( run );
772 if (other_run)
773 {
774 if (ME_CallWordBreakProc( editor, get_text( other_run, 0 ), other_run->len, other_run->len - 1, WB_ISDELIMITER )
775 && !(run->nFlags & MERF_ENDPARA)
776 && !(cursor->run == run && cursor->nOffset == 0)
777 && !ME_CallWordBreakProc( editor, get_text( run, 0 ), run->len, 0, WB_ISDELIMITER ))
778 break;
779 run = other_run;
780 nOffset = other_run->len;
781 }
782 else
783 {
784 if (cursor->run == run && cursor->nOffset == 0)
785 {
786 para = run->para;
787 /* Skip empty start of table row paragraph */
788 if (para_prev( para ) && para_prev( para )->nFlags & MEPF_ROWSTART)
789 para = para_prev( para );
790 /* Paragraph breaks are treated as separate words */
791 if (!para_prev( para )) return FALSE;
792 para = para_prev( para );
793 run = para_end_run( para );
794 }
795 break;
796 }
797 }
798 }
799 else
800 {
801 /* Forward movement */
802 BOOL last_delim = FALSE;
803
804 while (TRUE)
805 {
806 if (last_delim && !ME_CallWordBreakProc( editor, get_text( run, 0 ), run->len, nOffset, WB_ISDELIMITER ))
807 break;
808 nOffset = ME_CallWordBreakProc( editor, get_text( run, 0 ), run->len, nOffset, WB_MOVEWORDRIGHT );
809 if (nOffset < run->len) break;
810 other_run = run_next( run );
811 if (other_run)
812 {
813 last_delim = ME_CallWordBreakProc( editor, get_text( run, 0 ), run->len, nOffset - 1, WB_ISDELIMITER );
814 run = other_run;
815 nOffset = 0;
816 }
817 else
818 {
819 para = para_next( para );
820 if (!para_next( para ))
821 {
822 if (cursor->run == run) return FALSE;
823 nOffset = 0;
824 break;
825 }
826 if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
827 if (cursor->run == run) run = para_first_run( para );
828 nOffset = 0;
829 break;
830 }
831 }
832 }
833 cursor->para = para;
834 cursor->run = run;
835 cursor->nOffset = nOffset;
836 return TRUE;
837}
int ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) DECLSPEC_HIDDEN
Definition: string.c:204
#define WB_MOVEWORDRIGHT
Definition: richedit.h:1002
#define WB_MOVEWORDLEFT
Definition: richedit.h:1000
#define WB_ISDELIMITER
Definition: winuser.h:549

Referenced by handle_EM_SETCHARFORMAT(), ME_ArrowKey(), ME_ExtendAnchorSelection(), and ME_SelectByType().

◆ ME_PointFromChar()

int ME_PointFromChar ( ME_TextEditor editor,
ME_Run pRun,
int  nOffset,
BOOL  visual_order 
)

Definition at line 649 of file run.c.

650{
652 int ret;
653 HDC hdc = ITextHost_TxGetDC( editor->texthost );
654
655 ME_InitContext( &c, editor, hdc );
656 ret = ME_PointFromCharContext( &c, pRun, nOffset, visual_order );
659
660 return ret;
661}
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order)
Definition: run.c:608

Referenced by editor_ensure_visible(), editor_handle_message(), and ME_GetXForArrow().

◆ ME_PointFromCharContext()

int ME_PointFromCharContext ( ME_Context c,
ME_Run pRun,
int  nOffset,
BOOL  visual_order 
)

Definition at line 608 of file run.c.

609{
610 SIZE size;
611 ME_String *mask_text = NULL;
612 WCHAR *str;
613
614 if (pRun->nFlags & MERF_GRAPHICS)
615 {
616 if (nOffset)
617 ME_GetOLEObjectSize(c, pRun, &size);
618 return nOffset != 0;
619 } else if (pRun->nFlags & MERF_ENDPARA) {
620 nOffset = 0;
621 }
622
623 if (pRun->para->nFlags & MEPF_COMPLEX)
624 {
625 int x;
626 ScriptCPtoX( nOffset, FALSE, pRun->len, pRun->num_glyphs, pRun->clusters,
627 pRun->vis_attrs, pRun->advances, &pRun->script_analysis, &x );
628 if (visual_order && pRun->script_analysis.fRTL) x = pRun->nWidth - x - 1;
629 return x;
630 }
631 if (c->editor->password_char)
632 {
633 mask_text = ME_MakeStringR( c->editor->password_char, pRun->len );
634 str = mask_text->szData;
635 }
636 else
637 str = get_text( pRun, 0 );
638
639 ME_GetTextExtent(c, str, nOffset, pRun->style, &size);
640 ME_DestroyString( mask_text );
641 return size.cx;
642}
HRESULT WINAPI ScriptCPtoX(int iCP, BOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX)
Definition: usp10.c:2650

Referenced by cursor_coords(), get_selection_rect(), ME_InsertRowStart(), and ME_PointFromChar().

◆ ME_Redo()

BOOL ME_Redo ( ME_TextEditor editor)

Definition at line 448 of file undo.c.

449{
450 ME_UndoMode nMode = editor->nUndoMode;
451 struct list *head;
452 struct undo_item *undo, *cursor2;
453
454 assert(nMode == umAddToUndo || nMode == umIgnore);
455
456 if (editor->nUndoMode == umIgnore) return FALSE;
457
458 head = list_head( &editor->redo_stack );
459 if (!head) return FALSE;
460
461 /* watch out for uncommitted transactions ! */
462 undo = LIST_ENTRY( head, struct undo_item, entry );
463 assert( undo->type == undo_end_transaction );
464
465 editor->nUndoMode = umAddBackToUndo;
466 list_remove( &undo->entry );
467 destroy_undo_item( undo );
468
469 LIST_FOR_EACH_ENTRY_SAFE( undo, cursor2, &editor->redo_stack, struct undo_item, entry )
470 {
471 if (undo->type == undo_end_transaction) break;
472 ME_PlayUndoItem( editor, undo );
473 list_remove( &undo->entry );
474 destroy_undo_item( undo );
475 }
478 editor->nUndoMode = nMode;
479 ME_UpdateRepaint(editor, FALSE);
480 return TRUE;
481}
void table_move_from_row_start(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: table.c:531
ME_UndoMode
Definition: editstr.h:279
@ umAddBackToUndo
Definition: editstr.h:283
struct list entry
Definition: editstr.h:342
enum undo_type type
Definition: editstr.h:343
static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
Definition: undo.c:323

Referenced by editor_handle_message(), and ME_KeyDown().

◆ ME_ReleaseStyle()

void ME_ReleaseStyle ( ME_Style item)

Definition at line 462 of file style.c.

463{
464 s->nRefs--;
465 all_refs--;
466 if (s->nRefs==0)
467 TRACE_(richedit_style)("destroy style %p, total refs=%d\n", s, all_refs);
468 else
469 TRACE_(richedit_style)("release style %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs);
470 if (!all_refs) TRACE("all style references freed (good!)\n");
471 assert(s->nRefs>=0);
472 if (!s->nRefs)
474}
void ME_DestroyStyle(ME_Style *s)
Definition: style.c:442

Referenced by destroy_undo_item(), editor_handle_message(), handle_enter(), handle_wm_char(), ITextRange_fnSetText(), ME_ClearTempStyle(), ME_DestroyDisplayItem(), ME_DestroyEditor(), ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), ME_ReplaceSel(), ME_RTFCharAttrHook(), ME_RTFReadHook(), ME_SaveTempStyle(), ME_SetCharFormat(), ME_SetDefaultCharFormat(), ME_SetSelectionCharFormat(), ME_StreamIn(), para_num_clear(), and table_insert_end_para().

◆ ME_Remove()

void ME_Remove ( ME_DisplayItem diWhere)

Definition at line 35 of file list.c.

36{
37 ME_DisplayItem *diNext = diWhere->next;
38 ME_DisplayItem *diPrev = diWhere->prev;
39 assert(diNext);
40 assert(diPrev);
41 diPrev->next = diNext;
42 diNext->prev = diPrev;
43}

Referenced by ME_InternalDeleteText(), ME_PrepareParagraphForWrapping(), para_join(), and run_join().

◆ ME_Repaint()

void ME_Repaint ( ME_TextEditor editor)

Definition at line 119 of file paint.c.

120{
121 if (ME_WrapMarkedParagraphs(editor))
122 {
123 ME_UpdateScrollBar(editor);
124 FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
125 }
127}
void ME_UpdateScrollBar(ME_TextEditor *editor)
Definition: paint.c:1147
#define ITextHost_TxViewChange(This, a)
Definition: editor.h:340

Referenced by editor_handle_message(), ME_ArrowKey(), ME_RewrapRepaint(), scroll_abs(), and table_handle_tab().

◆ ME_ReplaceSel()

void ME_ReplaceSel ( ME_TextEditor editor,
BOOL  can_undo,
const WCHAR str,
int  len 
)

Definition at line 3161 of file editor.c.

3162{
3163 int from, to, nStartCursor;
3164 ME_Style *style;
3165
3166 nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
3168 ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE);
3169 ME_InsertTextFromCursor(editor, 0, str, len, style);
3171 /* drop temporary style if line end */
3172 /*
3173 * FIXME question: does abc\n mean: put abc,
3174 * clear temp style, put \n? (would require a change)
3175 */
3176 if (len>0 && str[len-1] == '\n')
3177 ME_ClearTempStyle(editor);
3178 ME_CommitUndo(editor);
3180 if (!can_undo)
3181 ME_EmptyUndoStack(editor);
3182 ME_UpdateRepaint(editor, FALSE);
3183}

Referenced by editor_handle_message(), and ITextSelection_fnSetText().

◆ ME_ReverseFindNonWhitespaceV()

int ME_ReverseFindNonWhitespaceV ( const ME_String s,
int  nVChar 
)

◆ ME_ReverseFindWhitespaceV()

int ME_ReverseFindWhitespaceV ( const ME_String s,
int  nVChar 
)

◆ ME_RewrapRepaint()

void ME_RewrapRepaint ( ME_TextEditor editor)

Definition at line 156 of file paint.c.

157{
158 /* RewrapRepaint should be called whenever the control has changed in
159 * looks, but not content. Like resizing. */
160
161 editor_mark_rewrap_all( editor );
163 ME_UpdateScrollBar(editor);
164 ME_Repaint(editor);
165}
void ME_Repaint(ME_TextEditor *editor)
Definition: paint.c:119

Referenced by editor_handle_message(), fnTextSrv_OnTxInPlaceActivate(), fnTextSrv_OnTxPropertyBitsChange(), and ME_SetZoom().

◆ ME_RTFCharAttrHook()

void ME_RTFCharAttrHook ( struct _RTF_Info info)

Definition at line 428 of file editor.c.

429{
431 fmt.cbSize = sizeof(fmt);
432 fmt.dwMask = 0;
433 fmt.dwEffects = 0;
434
435 switch(info->rtfMinor)
436 {
437 case rtfPlain:
438 /* FIXME add more flags once they're implemented */
441 fmt.dwEffects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
442 fmt.yHeight = 12*20; /* 12pt */
443 fmt.wWeight = FW_NORMAL;
444 fmt.bUnderlineType = CFU_UNDERLINE;
445 break;
446 case rtfBold:
447 fmt.dwMask = CFM_BOLD | CFM_WEIGHT;
448 fmt.dwEffects = info->rtfParam ? CFE_BOLD : 0;
449 fmt.wWeight = info->rtfParam ? FW_BOLD : FW_NORMAL;
450 break;
451 case rtfItalic:
452 fmt.dwMask = CFM_ITALIC;
453 fmt.dwEffects = info->rtfParam ? fmt.dwMask : 0;
454 break;
455 case rtfUnderline:
457 fmt.bUnderlineType = CFU_UNDERLINE;
458 fmt.dwEffects = info->rtfParam ? CFE_UNDERLINE : 0;
459 break;
460 case rtfDotUnderline:
462 fmt.bUnderlineType = CFU_UNDERLINEDOTTED;
463 fmt.dwEffects = info->rtfParam ? CFE_UNDERLINE : 0;
464 break;
465 case rtfDbUnderline:
467 fmt.bUnderlineType = CFU_UNDERLINEDOUBLE;
468 fmt.dwEffects = info->rtfParam ? CFE_UNDERLINE : 0;
469 break;
470 case rtfWordUnderline:
472 fmt.bUnderlineType = CFU_UNDERLINEWORD;
473 fmt.dwEffects = info->rtfParam ? CFE_UNDERLINE : 0;
474 break;
475 case rtfNoUnderline:
476 fmt.dwMask = CFM_UNDERLINE;
477 fmt.dwEffects = 0;
478 break;
479 case rtfStrikeThru:
480 fmt.dwMask = CFM_STRIKEOUT;
481 fmt.dwEffects = info->rtfParam ? fmt.dwMask : 0;
482 break;
483 case rtfSubScript:
484 case rtfSuperScript:
485 case rtfSubScrShrink:
487 case rtfNoSuperSub:
489 if (info->rtfMinor == rtfSubScrShrink) fmt.dwEffects = CFE_SUBSCRIPT;
490 if (info->rtfMinor == rtfSuperScrShrink) fmt.dwEffects = CFE_SUPERSCRIPT;
491 if (info->rtfMinor == rtfNoSuperSub) fmt.dwEffects = 0;
492 break;
493 case rtfInvisible:
494 fmt.dwMask = CFM_HIDDEN;
495 fmt.dwEffects = info->rtfParam ? fmt.dwMask : 0;
496 break;
497 case rtfBackColor:
498 fmt.dwMask = CFM_BACKCOLOR;
499 fmt.dwEffects = 0;
500 if (info->rtfParam == 0)
501 fmt.dwEffects = CFE_AUTOBACKCOLOR;
502 else if (info->rtfParam != rtfNoParam)
503 {
504 RTFColor *c = RTFGetColor(info, info->rtfParam);
505 if (c && c->rtfCBlue >= 0)
506 fmt.crBackColor = (c->rtfCBlue<<16)|(c->rtfCGreen<<8)|(c->rtfCRed);
507 else
508 fmt.dwEffects = CFE_AUTOBACKCOLOR;
509 }
510 break;
511 case rtfForeColor:
512 fmt.dwMask = CFM_COLOR;
513 fmt.dwEffects = 0;
514 if (info->rtfParam == 0)
515 fmt.dwEffects = CFE_AUTOCOLOR;
516 else if (info->rtfParam != rtfNoParam)
517 {
518 RTFColor *c = RTFGetColor(info, info->rtfParam);
519 if (c && c->rtfCBlue >= 0)
520 fmt.crTextColor = (c->rtfCBlue<<16)|(c->rtfCGreen<<8)|(c->rtfCRed);
521 else {
522 fmt.dwEffects = CFE_AUTOCOLOR;
523 }
524 }
525 break;
526 case rtfFontNum:
527 if (info->rtfParam != rtfNoParam)
528 {
529 RTFFont *f = RTFGetFont(info, info->rtfParam);
530 if (f)
531 {
532 MultiByteToWideChar(CP_ACP, 0, f->rtfFName, -1, fmt.szFaceName, ARRAY_SIZE(fmt.szFaceName));
533 fmt.szFaceName[ARRAY_SIZE(fmt.szFaceName)-1] = '\0';
534 fmt.bCharSet = f->rtfFCharSet;
535 fmt.dwMask = CFM_FACE | CFM_CHARSET;
536 fmt.bPitchAndFamily = f->rtfFPitch | (f->rtfFFamily << 4);
537 }
538 }
539 break;
540 case rtfFontSize:
541 fmt.dwMask = CFM_SIZE;
542 if (info->rtfParam != rtfNoParam)
543 fmt.yHeight = info->rtfParam*10;
544 break;
545 }
546 if (fmt.dwMask) {
547 ME_Style *style2;
549 /* FIXME too slow ? how come ? */
550 style2 = ME_ApplyStyle(info->editor, info->style, &fmt);
551 ME_ReleaseStyle(info->style);
552 info->style = style2;
553 info->styleChanged = TRUE;
554 }
555}
RTFFont * RTFGetFont(const RTF_Info *info, int num)
Definition: reader.c:1222
void RTFFlushOutputBuffer(RTF_Info *info)
Definition: reader.c:2626
RTFColor * RTFGetColor(const RTF_Info *info, int num)
Definition: reader.c:1237
ME_Style * ME_ApplyStyle(ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN
Definition: style.c:156
#define CFU_UNDERLINEDOUBLE
Definition: richedit.h:430
#define CFU_UNDERLINEWORD
Definition: richedit.h:429
#define CFE_SUPERSCRIPT
Definition: richedit.h:413
#define CFE_SUBSCRIPT
Definition: richedit.h:412
#define CFU_UNDERLINEDOTTED
Definition: richedit.h:431
#define rtfUnderline
Definition: rtf.h:583
#define rtfSuperScrShrink
Definition: rtf.h:589
#define rtfWordUnderline
Definition: rtf.h:587
#define rtfDbUnderline
Definition: rtf.h:585
#define rtfSubScrShrink
Definition: rtf.h:568
#define rtfSuperScript
Definition: rtf.h:588
#define rtfNoUnderline
Definition: rtf.h:586
#define rtfStrikeThru
Definition: rtf.h:582
#define rtfItalic
Definition: rtf.h:575
#define rtfPlain
Definition: rtf.h:563
#define rtfForeColor
Definition: rtf.h:591
#define rtfSubScript
Definition: rtf.h:567
#define rtfNoParam
Definition: rtf.h:62
#define rtfBold
Definition: rtf.h:564
#define rtfFontSize
Definition: rtf.h:574
#define rtfBackColor
Definition: rtf.h:592
#define rtfNoSuperSub
Definition: rtf.h:569
#define rtfInvisible
Definition: rtf.h:590
#define rtfFontNum
Definition: rtf.h:573
#define rtfDotUnderline
Definition: rtf.h:584
Definition: rtf.h:979
Definition: rtf.h:960

Referenced by ControlClass().

◆ ME_RTFParAttrHook()

void ME_RTFParAttrHook ( struct _RTF_Info info)

Definition at line 559 of file editor.c.

560{
561 switch(info->rtfMinor)
562 {
563 case rtfParDef: /* restores default paragraph attributes */
564 if (!info->editor->bEmulateVersion10) /* v4.1 */
565 info->borderType = RTFBorderParaLeft;
566 else /* v1.0 - 3.0 */
567 info->borderType = RTFBorderParaTop;
572 /* TODO: shading */
573 info->fmt.wAlignment = PFA_LEFT;
574 info->fmt.cTabCount = 0;
575 info->fmt.dxOffset = info->fmt.dxStartIndent = info->fmt.dxRightIndent = 0;
576 info->fmt.wBorderWidth = info->fmt.wBorders = 0;
577 info->fmt.wBorderSpace = 0;
578 info->fmt.bLineSpacingRule = 0;
579 info->fmt.dySpaceBefore = info->fmt.dySpaceAfter = 0;
580 info->fmt.dyLineSpacing = 0;
581 info->fmt.wEffects &= ~PFE_RTLPARA;
582 info->fmt.wNumbering = 0;
583 info->fmt.wNumberingStart = 0;
584 info->fmt.wNumberingStyle = 0;
585 info->fmt.wNumberingTab = 0;
586
587 if (!info->editor->bEmulateVersion10) /* v4.1 */
588 {
589 if (info->tableDef && info->tableDef->row_start &&
590 info->tableDef->row_start->nFlags & MEPF_ROWEND)
591 {
593 ME_Paragraph *para;
594 /* We are just after a table row. */
596 cursor = info->editor->pCursors[0];
597 para = cursor.para;
598 if (para == para_next( info->tableDef->row_start )
599 && !cursor.nOffset && !cursor.run->nCharOfs)
600 {
601 /* Since the table row end, no text has been inserted, and the \intbl
602 * control word has not be used. We can confirm that we are not in a
603 * table anymore.
604 */
605 info->tableDef->row_start = NULL;
606 info->canInheritInTbl = FALSE;
607 }
608 }
609 }
610 else /* v1.0 - v3.0 */
611 {
612 info->fmt.dwMask |= PFM_TABLE;
613 info->fmt.wEffects &= ~PFE_TABLE;
614 }
615 break;
616 case rtfNestLevel:
617 if (!info->editor->bEmulateVersion10) /* v4.1 */
618 {
619 while (info->rtfParam > info->nestingLevel)
620 {
621 RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
622 tableDef->parent = info->tableDef;
623 info->tableDef = tableDef;
624
626 if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
627 {
628 ME_Paragraph *para = para_next( tableDef->row_start );
629 tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
630 }
631 else
632 {
634 cursor = info->editor->pCursors[0];
635 if (cursor.nOffset || cursor.run->nCharOfs)
636 ME_InsertTextFromCursor(info->editor, 0, L"\r", 1, info->style);
637 tableDef->row_start = table_insert_row_start( info->editor, info->editor->pCursors );
638 }
639
640 info->nestingLevel++;
641 }
642 info->canInheritInTbl = FALSE;
643 }
644 break;
645 case rtfInTable:
646 {
647 if (!info->editor->bEmulateVersion10) /* v4.1 */
648 {
649 if (info->nestingLevel < 1)
650 {
651 RTFTable *tableDef;
652 ME_Paragraph *para;
653
654 if (!info->tableDef)
655 info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
656 tableDef = info->tableDef;
658 if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
659 para = para_next( tableDef->row_start );
660 else
661 para = info->editor->pCursors[0].para;
662
663 tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
664
665 info->nestingLevel = 1;
666 info->canInheritInTbl = TRUE;
667 }
668 return;
669 } else { /* v1.0 - v3.0 */
670 info->fmt.dwMask |= PFM_TABLE;
671 info->fmt.wEffects |= PFE_TABLE;
672 }
673 break;
674 }
675 case rtfFirstIndent:
676 case rtfLeftIndent:
677 if ((info->fmt.dwMask & (PFM_STARTINDENT | PFM_OFFSET)) != (PFM_STARTINDENT | PFM_OFFSET))
678 {
680 fmt.cbSize = sizeof(fmt);
682 info->fmt.dwMask |= PFM_STARTINDENT | PFM_OFFSET;
683 info->fmt.dxStartIndent = fmt.dxStartIndent;
684 info->fmt.dxOffset = fmt.dxOffset;
685 }
686 if (info->rtfMinor == rtfFirstIndent)
687 {
688 info->fmt.dxStartIndent += info->fmt.dxOffset + info->rtfParam;
689 info->fmt.dxOffset = -info->rtfParam;
690 }
691 else
692 info->fmt.dxStartIndent = info->rtfParam - info->fmt.dxOffset;
693 break;
694 case rtfRightIndent:
695 info->fmt.dwMask |= PFM_RIGHTINDENT;
696 info->fmt.dxRightIndent = info->rtfParam;
697 break;
698 case rtfQuadLeft:
699 case rtfQuadJust:
700 info->fmt.dwMask |= PFM_ALIGNMENT;
701 info->fmt.wAlignment = PFA_LEFT;
702 break;
703 case rtfQuadRight:
704 info->fmt.dwMask |= PFM_ALIGNMENT;
705 info->fmt.wAlignment = PFA_RIGHT;
706 break;
707 case rtfQuadCenter:
708 info->fmt.dwMask |= PFM_ALIGNMENT;
709 info->fmt.wAlignment = PFA_CENTER;
710 break;
711 case rtfTabPos:
712 if (!(info->fmt.dwMask & PFM_TABSTOPS))
713 {
715 fmt.cbSize = sizeof(fmt);
717 memcpy(info->fmt.rgxTabs, fmt.rgxTabs,
718 fmt.cTabCount * sizeof(fmt.rgxTabs[0]));
719 info->fmt.cTabCount = fmt.cTabCount;
720 info->fmt.dwMask |= PFM_TABSTOPS;
721 }
722 if (info->fmt.cTabCount < MAX_TAB_STOPS && info->rtfParam < 0x1000000)
723 info->fmt.rgxTabs[info->fmt.cTabCount++] = info->rtfParam;
724 break;
725 case rtfKeep:
726 info->fmt.dwMask |= PFM_KEEP;
727 info->fmt.wEffects |= PFE_KEEP;
728 break;
730 info->fmt.dwMask |= PFM_NOWIDOWCONTROL;
731 info->fmt.wEffects |= PFE_NOWIDOWCONTROL;
732 break;
733 case rtfKeepNext:
734 info->fmt.dwMask |= PFM_KEEPNEXT;
735 info->fmt.wEffects |= PFE_KEEPNEXT;
736 break;
737 case rtfSpaceAfter:
738 info->fmt.dwMask |= PFM_SPACEAFTER;
739 info->fmt.dySpaceAfter = info->rtfParam;
740 break;
741 case rtfSpaceBefore:
742 info->fmt.dwMask |= PFM_SPACEBEFORE;
743 info->fmt.dySpaceBefore = info->rtfParam;
744 break;
745 case rtfSpaceBetween:
746 info->fmt.dwMask |= PFM_LINESPACING;
747 if ((int)info->rtfParam > 0)
748 {
749 info->fmt.dyLineSpacing = info->rtfParam;
750 info->fmt.bLineSpacingRule = 3;
751 }
752 else
753 {
754 info->fmt.dyLineSpacing = info->rtfParam;
755 info->fmt.bLineSpacingRule = 4;
756 }
757 break;
758 case rtfSpaceMultiply:
759 info->fmt.dwMask |= PFM_LINESPACING;
760 info->fmt.dyLineSpacing = info->rtfParam * 20;
761 info->fmt.bLineSpacingRule = 5;
762 break;
763 case rtfParBullet:
764 info->fmt.dwMask |= PFM_NUMBERING;
765 info->fmt.wNumbering = PFN_BULLET;
766 break;
767 case rtfParSimple:
768 info->fmt.dwMask |= PFM_NUMBERING;
769 info->fmt.wNumbering = 2; /* FIXME: MSDN says it's not used ?? */
770 break;
771 case rtfBorderLeft:
772 info->borderType = RTFBorderParaLeft;
773 info->fmt.wBorders |= 1;
774 info->fmt.dwMask |= PFM_BORDER;
775 break;
776 case rtfBorderRight:
777 info->borderType = RTFBorderParaRight;
778 info->fmt.wBorders |= 2;
779 info->fmt.dwMask |= PFM_BORDER;
780 break;
781 case rtfBorderTop:
782 info->borderType = RTFBorderParaTop;
783 info->fmt.wBorders |= 4;
784 info->fmt.dwMask |= PFM_BORDER;
785 break;
786 case rtfBorderBottom:
787 info->borderType = RTFBorderParaBottom;
788 info->fmt.wBorders |= 8;
789 info->fmt.dwMask |= PFM_BORDER;
790 break;
791 case rtfBorderSingle:
792 info->fmt.wBorders &= ~0x700;
793 info->fmt.wBorders |= 1 << 8;
794 info->fmt.dwMask |= PFM_BORDER;
795 break;
796 case rtfBorderThick:
797 info->fmt.wBorders &= ~0x700;
798 info->fmt.wBorders |= 2 << 8;
799 info->fmt.dwMask |= PFM_BORDER;
800 break;
801 case rtfBorderShadow:
802 info->fmt.wBorders &= ~0x700;
803 info->fmt.wBorders |= 10 << 8;
804 info->fmt.dwMask |= PFM_BORDER;
805 break;
806 case rtfBorderDouble:
807 info->fmt.wBorders &= ~0x700;
808 info->fmt.wBorders |= 7 << 8;
809 info->fmt.dwMask |= PFM_BORDER;
810 break;
811 case rtfBorderDot:
812 info->fmt.wBorders &= ~0x700;
813 info->fmt.wBorders |= 11 << 8;
814 info->fmt.dwMask |= PFM_BORDER;
815 break;
816 case rtfBorderWidth:
817 {
818 int borderSide = info->borderType & RTFBorderSideMask;
819 RTFTable *tableDef = info->tableDef;
820 if ((info->borderType & RTFBorderTypeMask) == RTFBorderTypeCell)
821 {
823 if (!tableDef || tableDef->numCellsDefined >= MAX_TABLE_CELLS)
824 break;
825 border = &tableDef->cells[tableDef->numCellsDefined].border[borderSide];
826 border->width = info->rtfParam;
827 break;
828 }
829 info->fmt.wBorderWidth = info->rtfParam;
830 info->fmt.dwMask |= PFM_BORDER;
831 break;
832 }
833 case rtfBorderSpace:
834 info->fmt.wBorderSpace = info->rtfParam;
835 info->fmt.dwMask |= PFM_BORDER;
836 break;
837 case rtfBorderColor:
838 {
839 RTFTable *tableDef = info->tableDef;
840 int borderSide = info->borderType & RTFBorderSideMask;
841 int borderType = info->borderType & RTFBorderTypeMask;
842 switch(borderType)
843 {
845 if (!info->editor->bEmulateVersion10) /* v4.1 */
846 break;
847 /* v1.0 - 3.0 treat paragraph and row borders the same. */
848 case RTFBorderTypeRow:
849 if (tableDef) {
850 tableDef->border[borderSide].color = info->rtfParam;
851 }
852 break;
854 if (tableDef && tableDef->numCellsDefined < MAX_TABLE_CELLS) {
855 tableDef->cells[tableDef->numCellsDefined].border[borderSide].color = info->rtfParam;
856 }
857 break;
858 }
859 break;
860 }
861 case rtfRTLPar:
862 info->fmt.dwMask |= PFM_RTLPARA;
863 info->fmt.wEffects |= PFE_RTLPARA;
864 break;
865 case rtfLTRPar:
866 info->fmt.dwMask |= PFM_RTLPARA;
867 info->fmt.wEffects &= ~PFE_RTLPARA;
868 break;
869 }
870}
ME_Paragraph * table_insert_row_start_at_para(ME_TextEditor *editor, ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: table.c:80
ME_Paragraph * table_insert_row_start(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: table.c:72
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: gl.h:1546
#define MAX_TAB_STOPS
Definition: richedit.h:218
#define PFE_RTLPARA
Definition: richedit.h:932
#define PFE_KEEP
Definition: richedit.h:933
#define MAX_TABLE_CELLS
Definition: richedit.h:220
#define PFE_NOWIDOWCONTROL
Definition: richedit.h:937
#define PFN_BULLET
Definition: richedit.h:905
#define PFE_KEEPNEXT
Definition: richedit.h:934
#define rtfBorderWidth
Definition: rtf.h:542
#define rtfBorderDouble
Definition: rtf.h:538
#define rtfKeepNext
Definition: rtf.h:462
#define rtfQuadLeft
Definition: rtf.h:467
#define rtfQuadRight
Definition: rtf.h:468
#define RTFBorderTypeMask
Definition: rtf.h:1052
#define rtfBorderRight
Definition: rtf.h:531
#define rtfNoWidowControl
Definition: rtf.h:461
#define rtfLTRPar
Definition: rtf.h:480
#define rtfBorderShadow
Definition: rtf.h:537
#define rtfParBullet
Definition: rtf.h:493
#define rtfKeep
Definition: rtf.h:460
#define RTFBorderParaRight
Definition: rtf.h:1069
#define rtfBorderSingle
Definition: rtf.h:535
#define rtfQuadCenter
Definition: rtf.h:470
#define rtfBorderBottom
Definition: rtf.h:529
#define rtfBorderLeft
Definition: rtf.h:530
#define rtfQuadJust
Definition: rtf.h:469
#define rtfParDef
Definition: rtf.h:456
#define rtfBorderColor
Definition: rtf.h:543
#define rtfSpaceMultiply
Definition: rtf.h:477
#define RTFBorderSideMask
Definition: rtf.h:1063
#define RTFBorderParaTop
Definition: rtf.h:1066
#define rtfParSimple
Definition: rtf.h:494
#define rtfNestLevel
Definition: rtf.h:560
#define rtfRightIndent
Definition: rtf.h:473
#define rtfRTLPar
Definition: rtf.h:479
#define rtfSpaceBetween
Definition: rtf.h:476
#define RTFBorderParaBottom
Definition: rtf.h:1068
#define rtfSpaceBefore
Definition: rtf.h:474
#define rtfBorderTop
Definition: rtf.h:528
#define rtfInTable
Definition: rtf.h:459
#define RTFBorderTypePara
Definition: rtf.h:1049
#define RTFBorderTypeRow
Definition: rtf.h:1050
#define rtfBorderThick
Definition: rtf.h:536
#define RTFBorderTypeCell
Definition: rtf.h:1051
#define rtfFirstIndent
Definition: rtf.h:471
#define rtfBorderDot
Definition: rtf.h:539
#define rtfTabPos
Definition: rtf.h:481
#define rtfSpaceAfter
Definition: rtf.h:475
#define RTFBorderParaLeft
Definition: rtf.h:1067
#define rtfBorderSpace
Definition: rtf.h:544
#define rtfLeftIndent
Definition: rtf.h:472
int color
Definition: rtf.h:1015
int width
Definition: rtf.h:1014
RTFBorder border[4]
Definition: rtf.h:1021
ME_Paragraph * row_start
Definition: rtf.h:1041
RTFTable * parent
Definition: rtf.h:1044

Referenced by ControlClass().

◆ ME_RTFSpecialCharHook()

void ME_RTFSpecialCharHook ( struct _RTF_Info info)

Definition at line 946 of file editor.c.

947{
948 RTFTable *tableDef = info->tableDef;
949 switch (info->rtfMinor)
950 {
951 case rtfNestCell:
952 if (info->editor->bEmulateVersion10) /* v1.0 - v3.0 */
953 break;
954 /* else fall through since v4.1 treats rtfNestCell and rtfCell the same */
955 case rtfCell:
956 if (!tableDef)
957 break;
959 if (!info->editor->bEmulateVersion10) /* v4.1 */
960 {
961 if (tableDef->row_start)
962 {
963 if (!info->nestingLevel && tableDef->row_start->nFlags & MEPF_ROWEND)
964 {
965 ME_Paragraph *para = para_next( tableDef->row_start );
966 tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
967 info->nestingLevel = 1;
968 }
969 table_insert_cell( info->editor, info->editor->pCursors );
970 }
971 }
972 else /* v1.0 - v3.0 */
973 {
974 ME_Paragraph *para = info->editor->pCursors[0].para;
975
976 if (para_in_table( para ) && tableDef->numCellsInserted < tableDef->numCellsDefined)
977 {
978 WCHAR tab = '\t';
979 ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
980 tableDef->numCellsInserted++;
981 }
982 }
983 break;
984 case rtfNestRow:
985 if (info->editor->bEmulateVersion10) /* v1.0 - v3.0 */
986 break;
987 /* else fall through since v4.1 treats rtfNestRow and rtfRow the same */
988 case rtfRow:
989 {
990 ME_Run *run;
991 ME_Paragraph *para;
992 ME_Cell *cell;
993 int i;
994
995 if (!tableDef)
996 break;
998 if (!info->editor->bEmulateVersion10) /* v4.1 */
999 {
1000 if (!tableDef->row_start) break;
1001 if (!info->nestingLevel && tableDef->row_start->nFlags & MEPF_ROWEND)
1002 {
1003 para = para_next( tableDef->row_start );
1004 tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
1005 info->nestingLevel++;
1006 }
1007 para = tableDef->row_start;
1008 cell = table_row_first_cell( para );
1009 assert( cell && !cell_prev( cell ) );
1010 if (tableDef->numCellsDefined < 1)
1011 {
1012 /* 2000 twips appears to be the cell size that native richedit uses
1013 * when no cell sizes are specified. */
1014 const int default_size = 2000;
1015 int right_boundary = default_size;
1016 cell->nRightBoundary = right_boundary;
1017 while (cell_next( cell ))
1018 {
1019 cell = cell_next( cell );
1020 right_boundary += default_size;
1021 cell->nRightBoundary = right_boundary;
1022 }
1023 para = table_insert_cell( info->editor, info->editor->pCursors );
1024 cell = para_cell( para );
1025 cell->nRightBoundary = right_boundary;
1026 }
1027 else
1028 {
1029 for (i = 0; i < tableDef->numCellsDefined; i++)
1030 {
1031 RTFCell *cellDef = &tableDef->cells[i];
1032 cell->nRightBoundary = cellDef->rightBoundary;
1033 ME_ApplyBorderProperties( info, &cell->border, cellDef->border );
1034 cell = cell_next( cell );
1035 if (!cell)
1036 {
1037 para = table_insert_cell( info->editor, info->editor->pCursors );
1038 cell = para_cell( para );
1039 }
1040 }
1041 /* Cell for table row delimiter is empty */
1042 cell->nRightBoundary = tableDef->cells[i - 1].rightBoundary;
1043 }
1044
1045 run = para_first_run( cell_first_para( cell ) );
1046 if (info->editor->pCursors[0].run != run || info->editor->pCursors[0].nOffset)
1047 {
1048 int nOfs, nChars;
1049 /* Delete inserted cells that aren't defined. */
1050 info->editor->pCursors[1].run = run;
1051 info->editor->pCursors[1].para = run->para;
1052 info->editor->pCursors[1].nOffset = 0;
1053 nOfs = ME_GetCursorOfs(&info->editor->pCursors[1]);
1054 nChars = ME_GetCursorOfs(&info->editor->pCursors[0]) - nOfs;
1055 ME_InternalDeleteText(info->editor, &info->editor->pCursors[1],
1056 nChars, TRUE);
1057 }
1058
1059 para = table_insert_row_end( info->editor, info->editor->pCursors );
1060 para->fmt.dxOffset = abs(info->tableDef->gapH);
1061 para->fmt.dxStartIndent = info->tableDef->leftEdge;
1062 ME_ApplyBorderProperties( info, &para->border, tableDef->border );
1063 info->nestingLevel--;
1064 if (!info->nestingLevel)
1065 {
1066 if (info->canInheritInTbl) tableDef->row_start = para;
1067 else
1068 {
1069 while (info->tableDef)
1070 {
1071 tableDef = info->tableDef;
1072 info->tableDef = tableDef->parent;
1073 heap_free(tableDef);
1074 }
1075 }
1076 }
1077 else
1078 {
1079 info->tableDef = tableDef->parent;
1080 heap_free(tableDef);
1081 }
1082 }
1083 else /* v1.0 - v3.0 */
1084 {
1085 para = info->editor->pCursors[0].para;
1086 para->fmt.dxOffset = info->tableDef->gapH;
1087 para->fmt.dxStartIndent = info->tableDef->leftEdge;
1088
1089 ME_ApplyBorderProperties( info, &para->border, tableDef->border );
1090 while (tableDef->numCellsInserted < tableDef->numCellsDefined)
1091 {
1092 WCHAR tab = '\t';
1093 ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
1094 tableDef->numCellsInserted++;
1095 }
1096 para->fmt.cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS);
1097 if (!tableDef->numCellsDefined) para->fmt.wEffects &= ~PFE_TABLE;
1098 ME_InsertTextFromCursor(info->editor, 0, L"\r", 1, info->style);
1099 tableDef->numCellsInserted = 0;
1100 }
1101 break;
1102 }
1103 case rtfTab:
1104 case rtfPar:
1105 if (info->editor->bEmulateVersion10) /* v1.0 - 3.0 */
1106 {
1107 ME_Paragraph *para;
1108
1110 para = info->editor->pCursors[0].para;
1111 if (para_in_table( para ))
1112 {
1113 /* rtfPar is treated like a space within a table. */
1114 info->rtfClass = rtfText;
1115 info->rtfMajor = ' ';
1116 }
1117 else if (info->rtfMinor == rtfPar && tableDef)
1118 tableDef->numCellsInserted = 0;
1119 }
1120 break;
1121 }
1122}
static void ME_ApplyBorderProperties(RTF_Info *info, ME_BorderRect *borderRect, RTFBorder *borderDef)
Definition: editor.c:402
ME_Paragraph * table_insert_cell(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: table.c:112
BOOL para_in_table(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:122
ME_Cell * table_row_first_cell(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: table.c:170
ME_Paragraph * table_insert_row_end(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
Definition: table.c:119
ME_Cell * cell_next(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:192
ME_Cell * cell_prev(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:197
#define abs(i)
Definition: fconv.c:206
#define rtfPar
Definition: rtf.h:237
#define rtfCell
Definition: rtf.h:235
#define rtfText
Definition: rtf.h:80
#define rtfRow
Definition: rtf.h:236
#define rtfTab
Definition: rtf.h:246
#define rtfNestRow
Definition: rtf.h:269
#define rtfNestCell
Definition: rtf.h:268
Definition: rtf.h:1019
int rightBoundary
Definition: rtf.h:1020
int numCellsInserted
Definition: rtf.h:1035
LONG dxStartIndent
Definition: richedit.h:670

Referenced by ControlClass(), and ME_StreamIn().

◆ ME_RTFTblAttrHook()

void ME_RTFTblAttrHook ( struct _RTF_Info info)

Definition at line 872 of file editor.c.

873{
874 switch (info->rtfMinor)
875 {
876 case rtfRowDef:
877 {
878 if (!info->editor->bEmulateVersion10) /* v4.1 */
879 info->borderType = 0; /* Not sure */
880 else /* v1.0 - 3.0 */
881 info->borderType = RTFBorderRowTop;
882 if (!info->tableDef) {
883 info->tableDef = ME_MakeTableDef(info->editor);
884 } else {
885 ME_InitTableDef(info->editor, info->tableDef);
886 }
887 break;
888 }
889 case rtfCellPos:
890 {
891 int cellNum;
892 if (!info->tableDef)
893 {
894 info->tableDef = ME_MakeTableDef(info->editor);
895 }
896 cellNum = info->tableDef->numCellsDefined;
897 if (cellNum >= MAX_TABLE_CELLS)
898 break;
899 info->tableDef->cells[cellNum].rightBoundary = info->rtfParam;
900 if (cellNum < MAX_TAB_STOPS)
901 {
902 /* Tab stops were used to store cell positions before v4.1 but v4.1
903 * still seems to set the tabstops without using them. */
904 PARAFORMAT2 *fmt = &info->editor->pCursors[0].para->fmt;
905 fmt->rgxTabs[cellNum] &= ~0x00FFFFFF;
906 fmt->rgxTabs[cellNum] |= 0x00FFFFFF & info->rtfParam;
907 }
908 info->tableDef->numCellsDefined++;
909 break;
910 }
911 case rtfRowBordTop:
912 info->borderType = RTFBorderRowTop;
913 break;
914 case rtfRowBordLeft:
915 info->borderType = RTFBorderRowLeft;
916 break;
917 case rtfRowBordBottom:
918 info->borderType = RTFBorderRowBottom;
919 break;
920 case rtfRowBordRight:
921 info->borderType = RTFBorderRowRight;
922 break;
923 case rtfCellBordTop:
924 info->borderType = RTFBorderCellTop;
925 break;
926 case rtfCellBordLeft:
927 info->borderType = RTFBorderCellLeft;
928 break;
930 info->borderType = RTFBorderCellBottom;
931 break;
932 case rtfCellBordRight:
933 info->borderType = RTFBorderCellRight;
934 break;
935 case rtfRowGapH:
936 if (info->tableDef)
937 info->tableDef->gapH = info->rtfParam;
938 break;
939 case rtfRowLeftEdge:
940 if (info->tableDef)
941 info->tableDef->leftEdge = info->rtfParam;
942 break;
943 }
944}
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN
Definition: table.c:556
struct RTFTable * ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: table.c:547
#define rtfRowGapH
Definition: rtf.h:416
#define RTFBorderRowTop
Definition: rtf.h:1070
#define rtfRowBordLeft
Definition: rtf.h:430
#define rtfRowBordTop
Definition: rtf.h:429
#define rtfCellBordBottom
Definition: rtf.h:435
#define RTFBorderCellTop
Definition: rtf.h:1076
#define rtfRowBordBottom
Definition: rtf.h:431
#define rtfRowDef
Definition: rtf.h:415
#define RTFBorderCellRight
Definition: rtf.h:1079
#define rtfRowLeftEdge
Definition: rtf.h:423
#define rtfCellBordRight
Definition: rtf.h:438
#define rtfCellBordLeft
Definition: rtf.h:437
#define RTFBorderCellLeft
Definition: rtf.h:1077
#define rtfCellPos
Definition: rtf.h:417
#define RTFBorderRowBottom
Definition: rtf.h:1072
#define RTFBorderRowLeft
Definition: rtf.h:1071
#define rtfCellBordTop
Definition: rtf.h:436
#define RTFBorderRowRight
Definition: rtf.h:1073
#define rtfRowBordRight
Definition: rtf.h:432
#define RTFBorderCellBottom
Definition: rtf.h:1078

Referenced by ControlClass().

◆ ME_SaveTempStyle()

void ME_SaveTempStyle ( ME_TextEditor editor,
ME_Style style 
)

Definition at line 498 of file style.c.

499{
500 ME_Style *old_style = editor->pBuffer->pCharStyle;
501
502 if (style) ME_AddRefStyle( style );
503 editor->pBuffer->pCharStyle = style;
504 if (old_style) ME_ReleaseStyle( old_style );
505}

Referenced by editor_handle_message(), and handle_enter().

◆ ME_ScrollDown()

void ME_ScrollDown ( ME_TextEditor editor,
int  cy 
)

Definition at line 1132 of file paint.c.

1133{
1134 scroll_v_abs( editor, editor->vert_si.nPos + cy, TRUE );
1135}
void scroll_v_abs(ME_TextEditor *editor, int y, BOOL notify)
Definition: paint.c:1122
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586

Referenced by editor_handle_message(), and ME_ArrowPageDown().

◆ ME_ScrollLeft()

void ME_ScrollLeft ( ME_TextEditor editor,
int  cx 
)

Definition at line 1137 of file paint.c.

1138{
1139 scroll_h_abs( editor, editor->horz_si.nPos - cx, TRUE );
1140}

Referenced by editor_handle_message().

◆ ME_ScrollRight()

void ME_ScrollRight ( ME_TextEditor editor,
int  cx 
)

Definition at line 1142 of file paint.c.

1143{
1144 scroll_h_abs( editor, editor->horz_si.nPos + cx, TRUE );
1145}

Referenced by editor_handle_message().

◆ ME_ScrollUp()

void ME_ScrollUp ( ME_TextEditor editor,
int  cy 
)

Definition at line 1127 of file paint.c.

1128{
1129 scroll_v_abs( editor, editor->vert_si.nPos - cy, TRUE );
1130}

Referenced by editor_handle_message(), and ME_ArrowPageUp().

◆ ME_SendRequestResize()

void ME_SendRequestResize ( ME_TextEditor editor,
BOOL  force 
)

Definition at line 1128 of file wrap.c.

1129{
1130 if (editor->nEventMask & ENM_REQUESTRESIZE)
1131 {
1132 RECT rc;
1133
1134 ITextHost_TxGetClientRect(editor->texthost, &rc);
1135
1136 if (force || rc.bottom != editor->nTotalLength)
1137 {
1139
1140 info.nmhdr.hwndFrom = NULL;
1141 info.nmhdr.idFrom = 0;
1142 info.nmhdr.code = EN_REQUESTRESIZE;
1143 info.rc = rc;
1144 info.rc.right = editor->nTotalWidth;
1145 info.rc.bottom = editor->nTotalLength;
1146
1147 editor->nEventMask &= ~ENM_REQUESTRESIZE;
1148 ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
1149 editor->nEventMask |= ENM_REQUESTRESIZE;
1150 }
1151 }
1152}
#define EN_REQUESTRESIZE
Definition: richedit.h:192
#define ENM_REQUESTRESIZE
Definition: richedit.h:477

Referenced by editor_draw(), editor_handle_message(), ME_KeyDown(), and ME_StreamIn().

◆ ME_SendSelChange()

void ME_SendSelChange ( ME_TextEditor editor)

Definition at line 1420 of file caret.c.

1421{
1422 SELCHANGE sc;
1423
1424 sc.nmhdr.hwndFrom = NULL;
1425 sc.nmhdr.idFrom = 0;
1426 sc.nmhdr.code = EN_SELCHANGE;
1427 ME_GetSelectionOfs(editor, &sc.chrg.cpMin, &sc.chrg.cpMax);
1428 sc.seltyp = SEL_EMPTY;
1429 if (sc.chrg.cpMin != sc.chrg.cpMax)
1430 sc.seltyp |= SEL_TEXT;
1431 if (sc.chrg.cpMin < sc.chrg.cpMax+1) /* what were RICHEDIT authors thinking ? */
1432 sc.seltyp |= SEL_MULTICHAR;
1433
1434 if (sc.chrg.cpMin != editor->notified_cr.cpMin || sc.chrg.cpMax != editor->notified_cr.cpMax)
1435 {
1436 ME_ClearTempStyle(editor);
1437
1438 editor->notified_cr = sc.chrg;
1439
1440 if (editor->nEventMask & ENM_SELCHANGE)
1441 {
1442 TRACE("cpMin=%d cpMax=%d seltyp=%d (%s %s)\n",
1443 sc.chrg.cpMin, sc.chrg.cpMax, sc.seltyp,
1444 (sc.seltyp & SEL_TEXT) ? "SEL_TEXT" : "",
1445 (sc.seltyp & SEL_MULTICHAR) ? "SEL_MULTICHAR" : "");
1446 ITextHost_TxNotify(editor->texthost, sc.nmhdr.code, &sc);
1447 }
1448 }
1449}
#define SEL_EMPTY
Definition: richedit.h:822
#define SEL_MULTICHAR
Definition: richedit.h:825
#define EN_SELCHANGE
Definition: richedit.h:193
#define SEL_TEXT
Definition: richedit.h:823
#define ENM_SELCHANGE
Definition: richedit.h:478
NMHDR nmhdr
Definition: richedit.h:685
WORD seltyp
Definition: richedit.h:687
CHARRANGE chrg
Definition: richedit.h:686
UINT_PTR idFrom
Definition: winuser.h:3169
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168

Referenced by ME_ArrowKey(), ME_LButtonDown(), ME_MouseMove(), ME_StreamIn(), ME_UpdateRepaint(), set_selection(), and table_handle_tab().

◆ ME_SetCharFormat()

void ME_SetCharFormat ( ME_TextEditor editor,
ME_Cursor start,
ME_Cursor end,
CHARFORMAT2W pFmt 
)

Definition at line 777 of file run.c.

778{
779 ME_Run *run, *start_run = start->run, *end_run = NULL;
780
781 if (end && start->run == end->run && start->nOffset == end->nOffset)
782 return;
783
784 if (start->nOffset == start->run->len)
785 start_run = run_next_all_paras( start->run );
786 else if (start->nOffset)
787 {
788 /* run_split() may or may not update the cursors, depending on whether they
789 * are selection cursors, but we need to make sure they are valid. */
790 int split_offset = start->nOffset;
791 ME_Run *split_run = run_split( editor, start );
792 start_run = start->run;
793 if (end && end->run == split_run)
794 {
795 end->run = start->run;
796 end->nOffset -= split_offset;
797 }
798 }
799
800 if (end)
801 {
802 if (end->nOffset == end->run->len)
803 end_run = run_next_all_paras( end->run );
804 else
805 {
806 if (end->nOffset) run_split( editor, end );
807 end_run = end->run;
808 }
809 }
810
811 for (run = start_run; run != end_run; run = run_next_all_paras( run ))
812 {
813 ME_Style *new_style = ME_ApplyStyle( editor, run->style, fmt );
814 ME_Paragraph *para = run->para;
815
816 add_undo_set_char_fmt( editor, para->nCharOfs + run->nCharOfs,
817 run->len, &run->style->fmt );
818 ME_ReleaseStyle( run->style );
819 run->style = new_style;
820
821 /* The para numbering style depends on the eop style */
822 if ((run->nFlags & MERF_ENDPARA) && para->para_num.style)
823 {
824 ME_ReleaseStyle(para->para_num.style);
825 para->para_num.style = NULL;
826 }
827 para_mark_rewrap( editor, para );
828 }
829}
ME_Run * run_split(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: run.c:305
BOOL add_undo_set_char_fmt(ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
Definition: undo.c:164
struct para_num para_num
Definition: editstr.h:214

Referenced by editor_handle_message(), handle_EM_SETCHARFORMAT(), ME_PlayUndoItem(), ME_SetSelectionCharFormat(), ME_UpdateLinkAttribute(), para_join(), set_textfont_prop(), and textrange_set_font().

◆ ME_SetCursorToStart()

◆ ME_SetDefaultCharFormat()

void ME_SetDefaultCharFormat ( ME_TextEditor editor,
CHARFORMAT2W mod 
)

Definition at line 524 of file style.c.

525{
526 ME_Style *style, *def = editor->pBuffer->pDefaultStyle;
527
528 assert(mod->cbSize == sizeof(CHARFORMAT2W));
529 style = ME_ApplyStyle(editor, def, mod);
530 def->fmt = style->fmt;
531 def->tm = style->tm;
532 if (def->font_cache)
533 {
535 def->font_cache = NULL;
536 }
539 editor_mark_rewrap_all( editor );
540}
ME_Style * ME_ApplyStyle(ME_TextEditor *editor, ME_Style *sSrc, CHARFORMAT2W *mod)
Definition: style.c:156
SCRIPT_CACHE script_cache
Definition: editstr.h:77
ME_FontCacheItem * font_cache
Definition: editstr.h:74

Referenced by editor_handle_message(), handle_EM_SETCHARFORMAT(), and ME_MakeFirstParagraph().

◆ ME_SetSelectionCharFormat()

void ME_SetSelectionCharFormat ( ME_TextEditor editor,
CHARFORMAT2W pFmt 
)

Definition at line 748 of file run.c.

749{
750 if (!ME_IsSelection(editor))
751 {
752 ME_Style *s;
753 if (!editor->pBuffer->pCharStyle)
754 editor->pBuffer->pCharStyle = style_get_insert_style( editor, editor->pCursors );
755 s = ME_ApplyStyle(editor, editor->pBuffer->pCharStyle, pFmt);
757 editor->pBuffer->pCharStyle = s;
758 } else {
759 ME_Cursor *from, *to;
760 ME_GetSelection(editor, &from, &to);
761 ME_SetCharFormat(editor, from, to, pFmt);
762 }
763}
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *fmt)
Definition: run.c:777

Referenced by editor_handle_message(), handle_EM_SETCHARFORMAT(), and ME_StreamIn().

◆ ME_SetZoom()

BOOL ME_SetZoom ( ME_TextEditor editor,
int  numerator,
int  denominator 
)

Definition at line 1304 of file paint.c.

1305{
1306 /* TODO: Zoom images and objects */
1307
1308 if (numerator == 0 && denominator == 0)
1309 {
1310 editor->nZoomNumerator = editor->nZoomDenominator = 0;
1311 return TRUE;
1312 }
1313 if (numerator <= 0 || denominator <= 0)
1314 return FALSE;
1315 if (numerator * 64 <= denominator || numerator / denominator >= 64)
1316 return FALSE;
1317
1318 editor->nZoomNumerator = numerator;
1319 editor->nZoomDenominator = denominator;
1320
1321 ME_RewrapRepaint(editor);
1322 return TRUE;
1323}
void ME_RewrapRepaint(ME_TextEditor *editor)
Definition: paint.c:156

Referenced by editor_handle_message().

◆ ME_StrDeleteV()

void ME_StrDeleteV ( ME_String s,
int  nVChar,
int  nChars 
)

Definition at line 147 of file string.c.

148{
149 int end_ofs = nVChar + nChars;
150
151 assert(s->nBuffer); /* Not a const string */
152 assert(nChars >= 0);
153 assert(nVChar >= 0);
154 assert(end_ofs <= s->nLen);
155
156 memmove(s->szData + nVChar, s->szData + end_ofs,
157 (s->nLen - end_ofs + 1) * sizeof(WCHAR));
158 s->nLen -= nChars;
159}

Referenced by ME_InternalDeleteText().

◆ ME_StreamInFill()

void ME_StreamInFill ( ME_InStream stream)

Definition at line 1566 of file editor.c.

1567{
1568 stream->editstream->dwError = stream->editstream->pfnCallback(stream->editstream->dwCookie,
1569 (BYTE *)stream->buffer,
1570 sizeof(stream->buffer),
1571 (LONG *)&stream->dwSize);
1572 stream->dwUsed = 0;
1573}
Definition: parse.h:23
unsigned char BYTE
Definition: xxhash.c:193

Referenced by _RTFGetChar(), ME_StreamIn(), and ME_StreamInText().

◆ ME_StreamOut()

LRESULT ME_StreamOut ( ME_TextEditor editor,
DWORD  dwFormat,
EDITSTREAM stream 
)

Definition at line 1195 of file writer.c.

1196{
1198 int nChars;
1199
1200 if (dwFormat & SFF_SELECTION) {
1201 int nStart, nTo;
1202 start = editor->pCursors[ME_GetSelectionOfs(editor, &nStart, &nTo)];
1203 nChars = nTo - nStart;
1204 } else {
1205 ME_SetCursorToStart(editor, &start);
1206 nChars = ME_GetTextLength(editor);
1207 /* Generate an end-of-paragraph at the end of SCF_ALL RTF output */
1208 if (dwFormat & SF_RTF)
1209 nChars++;
1210 }
1211 return ME_StreamOutRange(editor, dwFormat, &start, nChars, stream);
1212}
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream)
Definition: writer.c:1179
#define SFF_SELECTION
Definition: richedit.h:979
#define SF_RTF
Definition: richedit.h:721

Referenced by editor_handle_message().

◆ ME_StreamOutRange()

LRESULT ME_StreamOutRange ( ME_TextEditor editor,
DWORD  dwFormat,
const ME_Cursor start,
int  nChars,
EDITSTREAM stream 
)

Definition at line 1179 of file writer.c.

1182{
1183 ME_OutStream *pStream = ME_StreamOutInit(editor, stream);
1184
1185 if (dwFormat & SF_RTF)
1186 ME_StreamOutRTF(editor, pStream, start, nChars, dwFormat);
1187 else if (dwFormat & SF_TEXT || dwFormat & SF_TEXTIZED)
1188 ME_StreamOutText(editor, pStream, start, nChars, dwFormat);
1189 if (!pStream->stream->dwError)
1190 ME_StreamOutFlush(pStream);
1191 return ME_StreamOutFree(pStream);
1192}
static LONG ME_StreamOutFree(ME_OutStream *pStream)
Definition: writer.c:92
static ME_OutStream * ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
Definition: writer.c:55
static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream, const ME_Cursor *start, int nChars, DWORD dwFormat)
Definition: writer.c:1121
static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, const ME_Cursor *start, int nChars, int dwFormat)
Definition: writer.c:997
static BOOL ME_StreamOutFlush(ME_OutStream *pStream)
Definition: writer.c:69
#define SF_TEXT
Definition: richedit.h:720
#define SF_TEXTIZED
Definition: richedit.h:723
DWORD dwError
Definition: richedit.h:523
EDITSTREAM * stream
Definition: writer.c:34

Referenced by get_rtf_text(), and ME_StreamOut().

◆ ME_ToUnicode()

LPWSTR ME_ToUnicode ( LONG  codepage,
LPVOID  psz,
INT len 
)

Definition at line 226 of file string.c.

227{
228 *len = 0;
229 if (!psz) return NULL;
230
231 if (codepage == CP_UNICODE)
232 {
233 *len = lstrlenW(psz);
234 return psz;
235 }
236 else {
237 WCHAR *tmp;
238 int nChars = MultiByteToWideChar(codepage, 0, psz, -1, NULL, 0);
239
240 if(!nChars) return NULL;
241
242 if((tmp = heap_alloc( nChars * sizeof(WCHAR) )) != NULL)
243 *len = MultiByteToWideChar(codepage, 0, psz, -1, tmp, nChars) - 1;
244 return tmp;
245 }
246}

Referenced by editor_handle_message(), ME_SetText(), and RichEditWndProc_common().

◆ ME_twips2pointsX()

int ME_twips2pointsX ( const ME_Context c,
int  x 
)

Definition at line 167 of file paint.c.

168{
169 if (c->editor->nZoomNumerator == 0)
170 return x * c->dpi.cx / 1440;
171 else
172 return x * c->dpi.cx * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
173}

Referenced by adjust_para_y(), draw_table_borders(), ME_BeginRow(), ME_GetRunSizeCommon(), ME_InitContext(), and ME_WrapTextParagraph().

◆ ME_twips2pointsY()

int ME_twips2pointsY ( const ME_Context c,
int  y 
)

Definition at line 175 of file paint.c.

176{
177 if (c->editor->nZoomNumerator == 0)
178 return y * c->dpi.cy / 1440;
179 else
180 return y * c->dpi.cy * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
181}

Referenced by adjust_para_y(), calc_y_offset(), draw_table_borders(), ME_DrawParaDecoration(), ME_GetParaLineSpace(), ME_LogFontFromStyle(), and ME_WrapTextParagraph().

◆ ME_Undo()

BOOL ME_Undo ( ME_TextEditor editor)

Definition at line 410 of file undo.c.

411{
412 ME_UndoMode nMode = editor->nUndoMode;
413 struct list *head;
414 struct undo_item *undo, *cursor2;
415
416 if (editor->nUndoMode == umIgnore) return FALSE;
417 assert(nMode == umAddToUndo || nMode == umIgnore);
418
419 head = list_head( &editor->undo_stack );
420 if (!head) return FALSE;
421
422 /* watch out for uncommitted transactions ! */
423 undo = LIST_ENTRY( head, struct undo_item, entry );
426
427 editor->nUndoMode = umAddToRedo;
428
429 list_remove( &undo->entry );
430 destroy_undo_item( undo );
431
432 LIST_FOR_EACH_ENTRY_SAFE( undo, cursor2, &editor->undo_stack, struct undo_item, entry )
433 {
434 if (undo->type == undo_end_transaction) break;
435 ME_PlayUndoItem( editor, undo );
436 list_remove( &undo->entry );
437 destroy_undo_item( undo );
438 }
439
442 editor->nUndoStackSize--;
443 editor->nUndoMode = nMode;
444 ME_UpdateRepaint(editor, FALSE);
445 return TRUE;
446}
@ umAddToRedo
Definition: editstr.h:281

Referenced by editor_handle_message(), and ME_KeyDown().

◆ ME_UpdateRepaint()

void ME_UpdateRepaint ( ME_TextEditor editor,
BOOL  update_now 
)

Definition at line 129 of file paint.c.

130{
131 /* Should be called whenever the contents of the control have changed */
132 BOOL wrappedParagraphs;
133
134 wrappedParagraphs = ME_WrapMarkedParagraphs(editor);
135 if (wrappedParagraphs)
136 ME_UpdateScrollBar(editor);
137
138 /* Ensure that the cursor is visible */
139 editor_ensure_visible( editor, &editor->pCursors[0] );
140
141 update_caret( editor );
142
143 ITextHost_TxViewChange(editor->texthost, update_now);
144
145 ME_SendSelChange(editor);
146
147 if(editor->nEventMask & ENM_CHANGE)
148 {
149 editor->nEventMask &= ~ENM_CHANGE;
151 editor->nEventMask |= ENM_CHANGE;
152 }
153}
void editor_ensure_visible(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: paint.c:1206
#define ENM_CHANGE
Definition: richedit.h:468
#define EN_CHANGE
Definition: winuser.h:2033

Referenced by editor_copy_or_cut(), editor_handle_message(), fnTextSrv_TxSetText(), handle_enter(), handle_wm_char(), IRichEditOle_fnInsertObject(), ME_KeyDown(), ME_Redo(), ME_ReplaceSel(), ME_StreamIn(), ME_Undo(), and paste_emf().

◆ ME_UpdateRunFlags()

void ME_UpdateRunFlags ( ME_TextEditor editor,
ME_Run run 
)

Definition at line 462 of file run.c.

463{
464 assert(run->nCharOfs >= 0);
465
466 if (RUN_IS_HIDDEN(run) || run->nFlags & MERF_TABLESTART)
467 run->nFlags |= MERF_HIDDEN;
468 else
469 run->nFlags &= ~MERF_HIDDEN;
470
471 if (run_is_splittable( run ))
472 run->nFlags |= MERF_SPLITTABLE;
473 else
474 run->nFlags &= ~MERF_SPLITTABLE;
475
476 if (!(run->nFlags & MERF_NOTEXT))
477 {
478 if (run_is_entirely_ws( run ))
480 else
481 {
482 run->nFlags &= ~MERF_WHITESPACE;
483
484 if (ME_IsWSpace( *get_text( run, 0 ) ))
485 run->nFlags |= MERF_STARTWHITE;
486 else
487 run->nFlags &= ~MERF_STARTWHITE;
488
489 if (ME_IsWSpace( *get_text( run, run->len - 1 ) ))
490 run->nFlags |= MERF_ENDWHITE;
491 else
492 run->nFlags &= ~MERF_ENDWHITE;
493 }
494 }
495 else
497}
static BOOL run_is_splittable(const ME_Run *run)
Definition: run.c:426
static BOOL run_is_entirely_ws(const ME_Run *run)
Definition: run.c:444
static int ME_IsWSpace(WCHAR ch)
Definition: editor.h:99
#define RUN_IS_HIDDEN(run)
Definition: editor.h:30
#define MERF_STARTWHITE
Definition: editstr.h:115
#define MERF_NOTEXT
Definition: editstr.h:132
#define MERF_ENDWHITE
Definition: editstr.h:117
#define MERF_HIDDEN
Definition: editstr.h:125
#define MERF_SPLITTABLE
Definition: editstr.h:113
#define MERF_TABLESTART
Definition: editstr.h:127
#define MERF_WHITESPACE
Definition: editstr.h:119

Referenced by ME_SplitByBacktracking(), ME_WrapSizeRun(), run_join(), and run_split().

◆ ME_UpdateScrollBar()

void ME_UpdateScrollBar ( ME_TextEditor editor)

Definition at line 1147 of file paint.c.

1148{
1149 /* Note that this is the only function that should ever call
1150 * SetScrollInfo with SIF_PAGE or SIF_RANGE. */
1151 BOOL enable;
1152
1153 if (ME_WrapMarkedParagraphs(editor))
1154 FIXME("ME_UpdateScrollBar had to call ME_WrapMarkedParagraphs\n");
1155
1156 /* Update horizontal scrollbar */
1157 enable = editor->nTotalWidth > editor->sizeWindow.cx;
1158 if (editor->horz_si.nPos && !enable)
1159 {
1160 scroll_h_abs( editor, 0, TRUE );
1161 /* ME_HScrollAbs will call this function, so nothing else needs to be done here. */
1162 return;
1163 }
1164
1165 if (editor->scrollbars & WS_HSCROLL && !enable ^ !editor->horz_sb_enabled)
1166 {
1167 editor->horz_sb_enabled = enable;
1169 }
1170
1171 if (editor->horz_si.nMax != editor->nTotalWidth || editor->horz_si.nPage != editor->sizeWindow.cx)
1172 {
1173 editor->horz_si.nMax = editor->nTotalWidth;
1174 editor->horz_si.nPage = editor->sizeWindow.cx;
1175 TRACE( "min = %d max = %d page = %d\n", editor->horz_si.nMin, editor->horz_si.nMax, editor->horz_si.nPage );
1176 if ((enable || editor->horz_sb_enabled) && editor->scrollbars & WS_HSCROLL)
1177 set_scroll_range_pos( editor, SB_HORZ, &editor->horz_si, TRUE, TRUE );
1178 }
1179
1180 /* Update vertical scrollbar */
1181 enable = editor->nTotalLength > editor->sizeWindow.cy && (editor->props & TXTBIT_MULTILINE);
1182
1183 if (editor->vert_si.nPos && !enable)
1184 {
1185 scroll_v_abs( editor, 0, TRUE );
1186 /* ME_VScrollAbs will call this function, so nothing else needs to be done here. */
1187 return;
1188 }
1189
1190 if (editor->scrollbars & WS_VSCROLL && !enable ^ !editor->vert_sb_enabled)
1191 {
1192 editor->vert_sb_enabled = enable;
1194 }
1195
1196 if (editor->vert_si.nMax != editor->nTotalLength || editor->vert_si.nPage != editor->sizeWindow.cy)
1197 {
1198 editor->vert_si.nMax = editor->nTotalLength;
1199 editor->vert_si.nPage = editor->sizeWindow.cy;
1200 TRACE( "min = %d max = %d page = %d\n", editor->vert_si.nMin, editor->vert_si.nMax, editor->vert_si.nPage );
1201 if ((enable || editor->vert_sb_enabled) && editor->scrollbars & WS_VSCROLL)
1202 set_scroll_range_pos( editor, SB_VERT, &editor->vert_si, TRUE, TRUE );
1203 }
1204}
static void enable_show_scrollbar(ME_TextEditor *editor, INT bar, BOOL enable)
Definition: paint.c:1062
static void set_scroll_range_pos(ME_TextEditor *editor, INT bar, SCROLLINFO *info, BOOL set_range, BOOL notify)
Definition: paint.c:1070
GLboolean enable
Definition: glext.h:11120

Referenced by editor_handle_message(), handle_EM_SETCHARFORMAT(), ME_Repaint(), ME_RewrapRepaint(), ME_UpdateRepaint(), and scroll_abs().

◆ ME_VSplitString()

ME_String * ME_VSplitString ( ME_String orig,
int  nVPos 
)

Definition at line 131 of file string.c.

132{
133 ME_String *s;
134
135 assert(orig->nBuffer); /* Not a const string */
136 assert(charidx>=0);
137 assert(charidx<=orig->nLen);
138
139 s = ME_MakeStringN(orig->szData+charidx, orig->nLen-charidx);
140 if (!s) return NULL;
141
142 orig->nLen = charidx;
143 orig->szData[charidx] = '\0';
144 return s;
145}
ME_String * ME_MakeStringN(LPCWSTR szText, int nMaxChars)
Definition: string.c:75
int nBuffer
Definition: editstr.h:56

Referenced by para_join(), and para_split().

◆ ME_WrapMarkedParagraphs()

BOOL ME_WrapMarkedParagraphs ( ME_TextEditor editor)

Definition at line 1094 of file wrap.c.

1095{
1096 HDC hdc = ITextHost_TxGetDC( editor->texthost );
1097 BOOL ret = wrap_marked_paras_dc( editor, hdc, TRUE );
1099 return ret;
1100}
BOOL wrap_marked_paras_dc(ME_TextEditor *editor, HDC hdc, BOOL invalidate)
Definition: wrap.c:1023

Referenced by editor_handle_message(), handle_EM_SETCHARFORMAT(), ME_InvalidateSelection(), ME_Repaint(), ME_RewrapRepaint(), ME_UpdateRepaint(), ME_UpdateScrollBar(), and table_select_next_cell_or_append().

◆ para_cell()

◆ para_destroy()

void para_destroy ( ME_TextEditor editor,
ME_Paragraph item 
)

Definition at line 42 of file para.c.

43{
44 if (para->nWidth == editor->nTotalWidth)
45 {
46 para->nWidth = 0;
47 editor->nTotalWidth = get_total_width(editor);
48 }
49 editor->total_rows -= para->nRows;
50 ME_DestroyString( para->text );
51 para_num_clear( &para->para_num );
52 para_mark_remove( editor, para );
54}
void para_mark_remove(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:94
void para_num_clear(struct para_num *pn)
Definition: para.c:436
int get_total_width(ME_TextEditor *editor)
Definition: para.c:69

Referenced by ME_DestroyEditor(), and para_join().

◆ para_end_row()

ME_Row * para_end_row ( ME_Paragraph para)

Definition at line 141 of file para.c.

142{
144
145 para = para_next( para );
147 if (!item || item->type != diStartRow) return NULL;
148 return &item->member.row;
149}
@ diStartRowOrParagraph
Definition: editstr.h:91

Referenced by cursor_from_virtual_coords(), cursor_move_line(), and ME_ArrowPageDown().

◆ para_end_run()

◆ para_first_row()

ME_Row * para_first_row ( ME_Paragraph para)

◆ para_first_run()

◆ para_get_di()

◆ para_in_table()

◆ para_join()

ME_Paragraph * para_join ( ME_TextEditor editor,
ME_Paragraph para,
BOOL  use_first_fmt 
)

Definition at line 683 of file para.c.

684{
685 ME_Paragraph *next = para_next( para );
686 ME_Run *end_run, *next_first_run, *tmp_run;
687 ME_Cell *cell = NULL;
688 int i, end_len;
690 ME_Cursor startCur, endCur;
691 ME_String *eol_str;
692
693 assert( next && para_next( next ) );
694
695 /* Clear any cached para numbering following this paragraph */
696 if (para->fmt.wNumbering) para_num_clear_list( editor, para, &para->fmt );
697
698 end_run = para_end_run( para );
699 next_first_run = para_first_run( next );
700
701 end_len = end_run->len;
702 eol_str = ME_VSplitString( para->text, end_run->nCharOfs );
703 ME_AppendString( para->text, next->text->szData, next->text->nLen );
704
705 /* null char format operation to store the original char format for the ENDPARA run */
707 startCur.para = para;
708 startCur.run = end_run;
709 endCur.para = next;
710 endCur.run = next_first_run;
711 startCur.nOffset = endCur.nOffset = 0;
712
713 ME_SetCharFormat(editor, &startCur, &endCur, &fmt);
714
715 if (!editor->bEmulateVersion10) /* v4.1 */
716 {
717 /* Remove cell boundary if it is between the end paragraph run and the next
718 * paragraph display item. */
719 if (para->cell != next->cell) cell = next->cell;
720
721 /* Table cell/row properties are always moved over from the removed para. */
722 para->nFlags = next->nFlags;
723 para->cell = next->cell;
724 }
725
726 add_undo_split_para( editor, next, eol_str, cell );
727
728 if (cell)
729 {
730 ME_Remove( cell_get_di( cell ) );
731 if (cell_prev( cell )) cell_prev( cell )->next_cell = cell_next( cell );
732 if (cell_next( cell )) cell_next( cell )->prev_cell = cell_prev( cell );
734 }
735
736 if (!use_first_fmt)
737 {
738 add_undo_set_para_fmt( editor, para );
739 para->fmt = next->fmt;
740 para->border = next->border;
741 }
742
743 /* Update selection cursors so they don't point to the removed end
744 * paragraph run, and point to the correct paragraph. */
745 for (i = 0; i < editor->nCursors; i++)
746 {
747 if (editor->pCursors[i].run == end_run)
748 {
749 editor->pCursors[i].run = next_first_run;
750 editor->pCursors[i].nOffset = 0;
751 }
752 else if (editor->pCursors[i].para == next)
753 editor->pCursors[i].para = para;
754 }
755
756 for (tmp_run = next_first_run; tmp_run; tmp_run = run_next( tmp_run ))
757 {
758 tmp_run->nCharOfs += next->nCharOfs - para->nCharOfs - end_len;
759 tmp_run->para = para;
760 }
761
762 /* Fix up the para's eop_run ptr */
763 para->eop_run = next->eop_run;
764
765 ME_Remove( run_get_di( end_run ) );
767
768 if (editor->last_sel_start_para == next)
769 editor->last_sel_start_para = para;
770 if (editor->last_sel_end_para == next)
771 editor->last_sel_end_para = para;
772
773 para->next_para = next->next_para;
774 next->next_para->member.para.prev_para = para_get_di( para );
776 para_destroy( editor, next );
777
778 editor_propagate_char_ofs( para_next( para ), NULL, -end_len );
779
780 ME_CheckCharOffsets(editor);
781
782 editor->nParagraphs--;
783 para_mark_rewrap( editor, para );
784 return para;
785}
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: style.c:150
BOOL ME_AppendString(ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN
Definition: string.c:126
BOOL add_undo_set_para_fmt(ME_TextEditor *, const ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: undo.c:152
BOOL add_undo_split_para(ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell) DECLSPEC_HIDDEN
Definition: undo.c:185
ME_String * ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN
Definition: string.c:131
ME_Run * para_end_run(ME_Paragraph *para)
Definition: para.c:117
void para_mark_rewrap(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:26
ME_Run * para_first_run(ME_Paragraph *para)
Definition: para.c:104
void para_destroy(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:42
static void para_num_clear_list(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *orig_fmt)
Definition: para.c:447
WORD wNumbering
Definition: richedit.h:668

Referenced by ME_InternalDeleteText(), and ME_PlayUndoItem().

◆ para_mark_add()

void para_mark_add ( ME_TextEditor editor,
ME_Paragraph para 
)

Definition at line 99 of file para.c.

100{
101 wine_rb_put( &editor->marked_paras, &para->nCharOfs, &para->marked_entry );
102}
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
struct wine_rb_entry marked_entry
Definition: editstr.h:217

Referenced by ME_MakeFirstParagraph(), and para_mark_rewrap().

◆ para_mark_remove()

void para_mark_remove ( ME_TextEditor editor,
ME_Paragraph para 
)

Definition at line 94 of file para.c.

95{
96 wine_rb_remove_key( &editor->marked_paras, &para->nCharOfs );
97}
static void wine_rb_remove_key(struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:392

Referenced by para_destroy().

◆ para_mark_rewrap()

◆ para_next()

◆ para_num_clear()

void para_num_clear ( struct para_num pn)

Definition at line 436 of file para.c.

437{
438 if (pn->style)
439 {
440 ME_ReleaseStyle( pn->style );
441 pn->style = NULL;
442 }
443 ME_DestroyString( pn->text );
444 pn->text = NULL;
445}
static int pints_t pn[]
Definition: server.c:129

Referenced by para_destroy(), and para_num_clear_list().

◆ para_num_init()

void para_num_init ( ME_Context c,
ME_Paragraph para 
)

Definition at line 392 of file para.c.

393{
396 SIZE sz;
397
398 if (!para->fmt.wNumbering) return;
399 if (para->para_num.style && para->para_num.text) return;
400
401 if (!para->para_num.style)
402 {
403 style = para->eop_run->style;
404
405 if (para->fmt.wNumbering == PFN_BULLET)
406 {
407 cf.cbSize = sizeof(cf);
408 cf.dwMask = CFM_FACE | CFM_CHARSET;
409 lstrcpyW( cf.szFaceName, L"Symbol" );
410 cf.bCharSet = SYMBOL_CHARSET;
411 style = ME_ApplyStyle( c->editor, style, &cf );
412 }
413 else
414 {
416 }
417
418 para->para_num.style = style;
419 }
420
421 if (!para->para_num.text)
422 {
423 if (para->fmt.wNumbering != PFN_BULLET)
424 para->para_num.text = para_num_get_str( para, para_num_get_num( para ) );
425 else
426 para->para_num.text = ME_MakeStringConst( L"\x00b7", 1 );
427 }
428
429 select_style( c, para->para_num.style );
430 GetTextExtentPointW( c->hDC, para->para_num.text->szData, para->para_num.text->nLen, &sz );
431 para->para_num.width = sz.cx;
432 GetTextExtentPointW( c->hDC, L" ", 1, &sz );
433 para->para_num.width += sz.cx;
434}
ME_String * ME_MakeStringConst(const WCHAR *str, int len) DECLSPEC_HIDDEN
Definition: string.c:41
static ME_String * para_num_get_str(ME_Paragraph *para, WORD num)
Definition: para.c:279
static int para_num_get_num(ME_Paragraph *para)
Definition: para.c:266
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
#define SYMBOL_CHARSET
Definition: wingdi.h:385

Referenced by ME_WrapTextParagraph().

◆ para_prev()

◆ para_range_invalidate()

void para_range_invalidate ( ME_TextEditor editor,
ME_Paragraph start_para,
ME_Paragraph last_para 
)

Definition at line 1102 of file wrap.c.

1104{
1105 RECT rc;
1106 int ofs;
1107
1108 rc = editor->rcFormat;
1109 ofs = editor->vert_si.nPos;
1110
1111 if (start_para)
1112 {
1113 start_para = table_outer_para( start_para );
1114 last_para = table_outer_para( last_para );
1115 rc.top += start_para->pt.y - ofs;
1116 } else {
1117 rc.top += editor->nTotalLength - ofs;
1118 }
1119 if (editor->nTotalLength < editor->nLastTotalLength)
1120 rc.bottom = editor->rcFormat.top + editor->nLastTotalLength - ofs;
1121 else
1122 rc.bottom = editor->rcFormat.top + last_para->pt.y + last_para->nHeight - ofs;
1124}
ME_Paragraph * table_outer_para(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: table.c:158
#define ITextHost_TxInvalidateRect(This, a, b)
Definition: editor.h:339

Referenced by ME_InvalidateSelection(), and wrap_marked_paras_dc().

◆ para_split()

ME_Paragraph * para_split ( ME_TextEditor editor,
ME_Run run,
ME_Style style,
const WCHAR eol_str,
int  eol_len,
int  paraFlags 
)

Definition at line 540 of file para.c.

542{
543 ME_Paragraph *new_para = para_create( editor ), *old_para, *next_para;
544 ME_Run *end_run, *next_run;
545 int ofs, i;
546 int run_flags = MERF_ENDPARA;
547
548 if (!editor->bEmulateVersion10) /* v4.1 */
549 {
550 /* At most 1 of MEPF_CELL, MEPF_ROWSTART, or MEPF_ROWEND should be set. */
551 assert( !(paraFlags & ~(MEPF_CELL | MEPF_ROWSTART | MEPF_ROWEND)) );
552 assert( !(paraFlags & (paraFlags-1)) );
553 if (paraFlags == MEPF_CELL)
554 run_flags |= MERF_ENDCELL;
555 else if (paraFlags == MEPF_ROWSTART)
556 run_flags |= MERF_TABLESTART | MERF_HIDDEN;
557 }
558 else /* v1.0 - v3.0 */
559 assert( !(paraFlags & (MEPF_CELL |MEPF_ROWSTART | MEPF_ROWEND)) );
560
561 old_para = run->para;
562 assert( old_para->fmt.cbSize == sizeof(PARAFORMAT2) );
563
564 /* Clear any cached para numbering following this paragraph */
565 if (old_para->fmt.wNumbering)
566 para_num_clear_list( editor, old_para, &old_para->fmt );
567
568 new_para->text = ME_VSplitString( old_para->text, run->nCharOfs );
569
570 end_run = run_create( style, run_flags );
571 ofs = end_run->nCharOfs = run->nCharOfs;
572 end_run->len = eol_len;
573 end_run->para = run->para;
574 ME_AppendString( old_para->text, eol_str, eol_len );
575 next_para = &old_para->next_para->member.para;
576
577 add_undo_join_paras( editor, old_para->nCharOfs + ofs );
578
579 /* Update selection cursors to point to the correct paragraph. */
580 for (i = 0; i < editor->nCursors; i++)
581 {
582 if (editor->pCursors[i].para == old_para &&
583 run->nCharOfs <= editor->pCursors[i].run->nCharOfs)
584 {
585 editor->pCursors[i].para = new_para;
586 }
587 }
588
589 /* the new paragraph will have a different starting offset, so update its runs */
590 for (next_run = run; next_run; next_run = run_next( next_run ))
591 {
592 next_run->nCharOfs -= ofs;
593 next_run->para = new_para;
594 }
595
596 new_para->nCharOfs = old_para->nCharOfs + ofs;
597 new_para->nCharOfs += eol_len;
598 new_para->nFlags = 0;
599 para_mark_rewrap( editor, new_para );
600
601 /* FIXME initialize format style and call ME_SetParaFormat blah blah */
602 new_para->fmt = old_para->fmt;
603 new_para->border = old_para->border;
604
605 /* insert paragraph into paragraph double linked list */
606 new_para->prev_para = para_get_di( old_para );
607 new_para->next_para = para_get_di( next_para );
608 old_para->next_para = para_get_di( new_para );
609 next_para->prev_para = para_get_di( new_para );
610
611 /* insert end run of the old paragraph, and new paragraph, into DI double linked list */
612 ME_InsertBefore( run_get_di( run ), para_get_di( new_para ) );
613 ME_InsertBefore( para_get_di( new_para ), run_get_di( end_run ) );
614
615 /* Fix up the paras' eop_run ptrs */
616 new_para->eop_run = old_para->eop_run;
617 old_para->eop_run = end_run;
618
619 if (!editor->bEmulateVersion10) /* v4.1 */
620 {
621 if (paraFlags & (MEPF_ROWSTART | MEPF_CELL))
622 {
623 ME_Cell *cell = cell_create();
624 ME_InsertBefore( para_get_di( new_para ), cell_get_di( cell ) );
625 new_para->cell = cell;
626 cell->next_cell = NULL;
627 if (paraFlags & MEPF_ROWSTART)
628 {
629 old_para->nFlags |= MEPF_ROWSTART;
630 cell->prev_cell = NULL;
631 cell->parent_cell = old_para->cell;
632 if (para_cell( old_para ))
633 cell->nNestingLevel = para_cell( old_para )->nNestingLevel + 1;
634 else
635 cell->nNestingLevel = 1;
636 }
637 else
638 {
639 cell->prev_cell = old_para->cell;
640 cell_prev( cell )->next_cell = cell;
641 assert( old_para->nFlags & MEPF_CELL );
642 assert( !(old_para->nFlags & MEPF_ROWSTART) );
643 cell->nNestingLevel = cell_prev( cell )->nNestingLevel;
644 cell->parent_cell = cell_prev( cell )->parent_cell;
645 }
646 }
647 else if (paraFlags & MEPF_ROWEND)
648 {
649 old_para->nFlags |= MEPF_ROWEND;
650 old_para->cell = old_para->cell->parent_cell;
651 new_para->cell = old_para->cell;
652 assert( para_prev( old_para )->nFlags & MEPF_CELL );
653 assert( !(para_prev( old_para )->nFlags & MEPF_ROWSTART) );
654 if (new_para->cell != para_next( new_para )->cell
655 && para_next( new_para )->cell
656 && !cell_prev( para_next( new_para )->cell ))
657 {
658 /* Row starts just after the row that was ended. */
659 new_para->nFlags |= MEPF_ROWSTART;
660 }
661 }
662 else new_para->cell = old_para->cell;
663
664 table_update_flags( old_para );
665 table_update_flags( new_para );
666 }
667
668 /* force rewrap of the */
669 if (old_para->prev_para->type == diParagraph)
670 para_mark_rewrap( editor, &old_para->prev_para->member.para );
671
672 para_mark_rewrap( editor, &new_para->prev_para->member.para );
673
674 /* we've added the end run, so we need to modify nCharOfs in the next paragraphs */
675 editor_propagate_char_ofs( next_para, NULL, eol_len );
676 editor->nParagraphs++;
677
678 return new_para;
679}
ME_Cell * cell_create(void) DECLSPEC_HIDDEN
Definition: table.c:186
BOOL add_undo_join_paras(ME_TextEditor *, int pos) DECLSPEC_HIDDEN
Definition: undo.c:176
#define MEPF_CELL
Definition: editstr.h:142
ME_Cell * para_cell(ME_Paragraph *para)
Definition: para.c:127
static void table_update_flags(ME_Paragraph *para)
Definition: para.c:242
struct tagME_Cell * parent_cell
Definition: editstr.h:228

Referenced by ME_InsertTextFromCursor(), ME_PlayUndoItem(), and table_insert_end_para().

◆ release_typelib()

void release_typelib ( void  )

Definition at line 159 of file apps.c.

160{
161 unsigned i;
162
163 for (i = 0; i < ARRAY_SIZE(typeinfo); i++)
164 if (typeinfo[i])
165 ITypeInfo_Release(typeinfo[i]);
166
167 if (typelib)
168 ITypeLib_Release(typelib);
169}

◆ richole_release_children()

void richole_release_children ( struct text_services services)

Definition at line 5853 of file richole.c.

5854{
5857
5858 if (services->text_selection)
5859 {
5860 services->text_selection->services = NULL;
5861 ITextSelection_Release( &services->text_selection->ITextSelection_iface );
5862 }
5863
5864 LIST_FOR_EACH_ENTRY( range, &services->rangelist, ITextRangeImpl, child.entry )
5865 range->child.reole = NULL;
5866
5868 site->child.reole = NULL;
5869}
static IActiveScriptSite * site
Definition: script.c:149
static HWND child
Definition: cursoricon.c:298
IWbemServices * services
Definition: locator.c:1514

Referenced by ITextServicesImpl_Release().

◆ row_end_cursor()

void row_end_cursor ( ME_Row row,
ME_Cursor cursor,
BOOL  include_eop 
)

Definition at line 92 of file row.c.

93{
94 ME_DisplayItem *item, *run;
95
97 run = ME_FindItemBack( item, diRun );
98 cursor->run = &run->member.run;
99 cursor->para = cursor->run->para;
100 cursor->nOffset = (item->type == diStartRow || include_eop) ? cursor->run->len : 0;
101}
static ME_DisplayItem * row_get_di(ME_Row *row)
Definition: editor.h:126
@ diStartRowOrParagraphOrEnd
Definition: editstr.h:92

Referenced by editor_handle_message(), ME_ArrowEnd(), ME_ExtendAnchorSelection(), ME_SelectByType(), and row_number_from_char_ofs().

◆ row_first_cursor()

void row_first_cursor ( ME_Row row,
ME_Cursor cursor 
)

Definition at line 82 of file row.c.

83{
85
87 cursor->run = &item->member.run;
88 cursor->para = cursor->run->para;
89 cursor->nOffset = 0;
90}

Referenced by editor_handle_message(), ME_ArrowHome(), ME_ExtendAnchorSelection(), ME_SelectByType(), and row_para().

◆ row_first_run()

ME_Run * row_first_run ( ME_Row row)

Definition at line 54 of file row.c.

55{
57
59 assert( item->type == diRun );
60 return &item->member.run;
61}
@ diRunOrStartRow
Definition: editstr.h:94

Referenced by row_cursor().

◆ row_from_cursor()

◆ row_from_row_number()

ME_Row * row_from_row_number ( ME_TextEditor editor,
int  row_num 
)

Definition at line 111 of file row.c.

112{
113 ME_Paragraph *para = editor_first_para( editor );
114 ME_Row *row;
115 int count = 0;
116
117 while (para_next( para ) && count + para->nRows <= row_num)
118 {
119 count += para->nRows;
120 para = para_next( para );
121 }
122 if (!para_next( para )) return NULL;
123
124 for (row = para_first_row( para ); row && count < row_num; count++)
125 row = row_next( row );
126
127 return row;
128}
ME_Row * row_next(ME_Row *row)
Definition: row.c:27

Referenced by editor_handle_message().

◆ row_get_di()

static ME_DisplayItem * row_get_di ( ME_Row row)
inlinestatic

◆ row_next()

ME_Row * row_next ( ME_Row row)

Definition at line 27 of file row.c.

28{
30
32 if (!item || item->type != diStartRow) return NULL;
33 return &item->member.row;
34}

Referenced by cursor_from_virtual_coords(), editor_handle_message(), row_from_row_number(), and row_number_from_char_ofs().

◆ row_next_all_paras()

ME_Row * row_next_all_paras ( ME_Row row)

Definition at line 36 of file row.c.

37{
39
41 if (!item) return NULL;
42 return &item->member.row;
43}

Referenced by cursor_move_line(), and ME_ArrowPageDown().

◆ row_next_run()

ME_Run * row_next_run ( ME_Row row,
ME_Run run 
)

Definition at line 63 of file row.c.

64{
66
68
70 if (!item || item->type == diStartRow) return NULL;
71 return &item->member.run;
72}

Referenced by editor_handle_message(), and row_cursor().

◆ row_number_from_char_ofs()

int row_number_from_char_ofs ( ME_TextEditor editor,
int  ofs 
)

Definition at line 131 of file row.c.

132{
133 ME_Paragraph *para = editor_first_para( editor );
134 ME_Row *row;
136 int row_num = 0;
137
138 while (para_next( para ) && para_next( para )->nCharOfs <= ofs)
139 {
140 row_num += para->nRows;
141 para = para_next( para );
142 }
143
144 if (para_next( para ))
145 {
146 for (row = para_first_row( para ); row; row = row_next( row ))
147 {
149 if (ME_GetCursorOfs( &cursor ) > ofs ) break;
150 row_num++;
151 }
152 }
153
154 return row_num;
155}
void row_end_cursor(ME_Row *row, ME_Cursor *cursor, BOOL include_eop)
Definition: row.c:92

Referenced by editor_handle_message().

◆ row_para()

ME_Paragraph * row_para ( ME_Row row)

Definition at line 103 of file row.c.

104{
106
108 return cursor.para;
109}
void row_first_cursor(ME_Row *row, ME_Cursor *cursor)
Definition: row.c:82

Referenced by cursor_move_line(), ME_ArrowPageDown(), and ME_ArrowPageUp().

◆ row_prev_all_paras()

ME_Row * row_prev_all_paras ( ME_Row row)

Definition at line 45 of file row.c.

46{
48
50 if (!item) return NULL;
51 return &item->member.row;
52}

Referenced by cursor_move_line(), and ME_ArrowPageUp().

◆ run_char_ofs()

int run_char_ofs ( ME_Run run,
int  ofs 
)

Definition at line 228 of file run.c.

229{
230 return run->para->nCharOfs + run->nCharOfs + ofs;
231}

Referenced by draw_run().

◆ run_create()

ME_Run * run_create ( ME_Style s,
int  nFlags 
)

Definition at line 343 of file run.c.

344{
346 ME_Run *run = &item->member.run;
347
348 if (!item) return NULL;
349
350 ME_AddRefStyle( s );
351 run->style = s;
352 run->reobj = NULL;
353 run->nFlags = flags;
354 run->nCharOfs = -1;
355 run->len = 0;
356 run->para = NULL;
357 run->num_glyphs = 0;
358 run->max_glyphs = 0;
359 run->glyphs = NULL;
360 run->vis_attrs = NULL;
361 run->advances = NULL;
362 run->offsets = NULL;
363 run->max_clusters = 0;
364 run->clusters = NULL;
365 return run;
366}
GOFFSET * offsets
Definition: editstr.h:174
int max_clusters
Definition: editstr.h:175
WORD * glyphs
Definition: editstr.h:171
int max_glyphs
Definition: editstr.h:170

Referenced by ME_MakeFirstParagraph(), para_split(), run_insert(), and run_split().

◆ run_get_di()

◆ run_insert()

ME_Run * run_insert ( ME_TextEditor editor,
ME_Cursor cursor,
ME_Style style,
const WCHAR str,
int  len,
int  flags 
)

Definition at line 375 of file run.c.

377{
378 ME_Run *insert_before = cursor->run, *run, *prev;
379
380 if (cursor->nOffset)
381 {
382 if (cursor->nOffset == insert_before->len)
383 {
384 insert_before = run_next_all_paras( insert_before );
385 if (!insert_before) insert_before = cursor->run; /* Always insert before the final eop run */
386 }
387 else
388 {
389 run_split( editor, cursor );
390 insert_before = cursor->run;
391 }
392 }
393
394 add_undo_delete_run( editor, insert_before->para->nCharOfs + insert_before->nCharOfs, len );
395
396 run = run_create( style, flags );
397 run->nCharOfs = insert_before->nCharOfs;
398 run->len = len;
399 run->para = insert_before->para;
400 ME_InsertString( run->para->text, run->nCharOfs, str, len );
401 ME_InsertBefore( run_get_di( insert_before ), run_get_di( run ) );
402 TRACE("Shift length:%d\n", len);
403 editor_propagate_char_ofs( NULL, insert_before, len );
404 para_mark_rewrap( editor, insert_before->para );
405
406 /* Move any cursors that were at the end of the previous run to the end of the inserted run */
407 prev = run_prev_all_paras( run );
408 if (prev)
409 {
410 int i;
411
412 for (i = 0; i < editor->nCursors; i++)
413 {
414 if (editor->pCursors[i].run == prev &&
415 editor->pCursors[i].nOffset == prev->len)
416 {
417 editor->pCursors[i].run = run;
418 editor->pCursors[i].nOffset = len;
419 }
420 }
421 }
422
423 return run;
424}
ME_Run * run_create(ME_Style *s, int flags)
Definition: run.c:343
void editor_propagate_char_ofs(ME_Paragraph *para, ME_Run *run, int shift)
Definition: run.c:147
BOOL add_undo_delete_run(ME_TextEditor *, int pos, int len) DECLSPEC_HIDDEN
Definition: undo.c:204
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len) DECLSPEC_HIDDEN
Definition: string.c:103

Referenced by ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), ME_InsertTextFromCursor(), and ME_PlayUndoItem().

◆ run_join()

void run_join ( ME_TextEditor editor,
ME_Run run 
)

Definition at line 273 of file run.c.

274{
275 ME_Run *next = run_next( run );
276 int i;
277
278 assert( run );
279 assert( run->nCharOfs != -1 );
280 para_mark_rewrap( editor, run->para );
281
282 /* Update all cursors so that they don't contain the soon deleted run */
283 for (i = 0; i < editor->nCursors; i++)
284 {
285 if (editor->pCursors[i].run == next)
286 {
287 editor->pCursors[i].run = run;
288 editor->pCursors[i].nOffset += run->len;
289 }
290 }
291
292 run->len += next->len;
295 ME_UpdateRunFlags( editor, run );
296 ME_CheckCharOffsets( editor );
297}
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
Definition: run.c:462
void ME_CheckCharOffsets(ME_TextEditor *editor)
Definition: run.c:173

Referenced by ME_PrepareParagraphForWrapping().

◆ run_next()

◆ run_next_all_paras()

ME_Run * run_next_all_paras ( ME_Run run)

Definition at line 96 of file run.c.

97{
99
100 cursor.run = run;
101 cursor.para = run->para;
102 cursor.nOffset = 0;
103
104 if (cursor_next_run( &cursor, TRUE ))
105 return cursor.run;
106
107 return NULL;
108}

Referenced by ME_FindText(), ME_GetCharFormat(), ME_GetTextW(), ME_SetCharFormat(), ME_StreamOutText(), ME_UpdateLinkAttribute(), run_insert(), stream_out_font_and_colour_tbls(), and table_select_next_cell_or_append().

◆ run_prev()

ME_Run * run_prev ( ME_Run run)

Definition at line 82 of file run.c.

83{
85
86 cursor.run = run;
87 cursor.para = run->para;
88 cursor.nOffset = 0;
89
91 return cursor.run;
92
93 return NULL;
94}
BOOL cursor_prev_run(ME_Cursor *cursor, BOOL all_para)
Definition: run.c:49

Referenced by cursor_coords(), layout_row(), link_notify(), ME_GetCharFormat(), ME_InsertRowStart(), ME_InsertTextFromCursor(), ME_MaximizeSplit(), ME_MoveCursorChars(), ME_MoveCursorWords(), ME_WrapHandleRun(), style_get_insert_style(), and table_handle_tab().

◆ run_prev_all_paras()

ME_Run * run_prev_all_paras ( ME_Run run)

Definition at line 110 of file run.c.

111{
113
114 cursor.run = run;
115 cursor.para = run->para;
116 cursor.nOffset = 0;
117
118 if (cursor_prev_run( &cursor, TRUE ))
119 return cursor.run;
120
121 return NULL;
122}

Referenced by editor_handle_message(), ME_FindText(), ME_GetCharFormat(), ME_InsertOLEFromCursor(), ME_InternalDeleteText(), and run_insert().

◆ run_split()

ME_Run * run_split ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 305 of file run.c.

306{
307 ME_Run *run = cursor->run, *new_run;
308 int i;
309 int nOffset = cursor->nOffset;
310
311 assert( !(run->nFlags & MERF_NONTEXT) );
312
313 new_run = run_create( run->style, run->nFlags & MERF_SPLITMASK );
314 new_run->nCharOfs = run->nCharOfs + nOffset;
315 new_run->len = run->len - nOffset;
316 new_run->para = run->para;
317 run->len = nOffset;
318 cursor->run = new_run;
319 cursor->nOffset = 0;
320
321 ME_InsertBefore( run_get_di( run )->next, run_get_di( new_run ) );
322
323 ME_UpdateRunFlags( editor, run );
324 ME_UpdateRunFlags( editor, new_run );
325 for (i = 0; i < editor->nCursors; i++)
326 {
327 if (editor->pCursors[i].run == run &&
328 editor->pCursors[i].nOffset >= nOffset)
329 {
330 editor->pCursors[i].run = new_run;
331 editor->pCursors[i].nOffset -= nOffset;
332 }
333 }
334 para_mark_rewrap( editor, run->para );
335 return run;
336}
#define MERF_NONTEXT
Definition: editstr.h:110
#define MERF_SPLITMASK
Definition: editstr.h:135

Referenced by itemize_para(), ME_InsertTextFromCursor(), ME_PlayUndoItem(), ME_SetCharFormat(), run_insert(), split_run_extents(), and table_insert_end_para().

◆ scroll_abs()

void scroll_abs ( ME_TextEditor editor,
int  x,
int  y,
BOOL  notify 
)

Definition at line 1087 of file paint.c.

1088{
1089 int scrollX = 0, scrollY = 0;
1090
1091 if (editor->horz_si.nPos != x) {
1092 x = min(x, editor->horz_si.nMax);
1093 x = max(x, editor->horz_si.nMin);
1094 scrollX = editor->horz_si.nPos - x;
1095 editor->horz_si.nPos = x;
1096 set_scroll_range_pos( editor, SB_HORZ, &editor->horz_si, FALSE, notify );
1097 }
1098
1099 if (editor->vert_si.nPos != y) {
1100 y = min(y, editor->vert_si.nMax - (int)editor->vert_si.nPage);
1101 y = max(y, editor->vert_si.nMin);
1102 scrollY = editor->vert_si.nPos - y;
1103 editor->vert_si.nPos = y;
1104 set_scroll_range_pos( editor, SB_VERT, &editor->vert_si, FALSE, notify );
1105 }
1106
1107 if (abs(scrollX) > editor->sizeWindow.cx || abs(scrollY) > editor->sizeWindow.cy)
1109 else
1110 ITextHost_TxScrollWindowEx(editor->texthost, scrollX, scrollY,
1111 &editor->rcFormat, &editor->rcFormat,
1113 ME_UpdateScrollBar(editor);
1114 ME_Repaint(editor);
1115}
#define ITextHost_TxScrollWindowEx(This, a, b, c, d, e, f, g)
Definition: editor.h:346
int notify
Definition: msacm.c:1366
#define SW_INVALIDATE
Definition: winuser.h:2590

Referenced by editor_ensure_visible(), editor_handle_message(), ITextRange_fnScrollIntoView(), scroll_h_abs(), and scroll_v_abs().

◆ scroll_h_abs()

void scroll_h_abs ( ME_TextEditor editor,
int  x,
BOOL  notify 
)

Definition at line 1117 of file paint.c.

1118{
1119 scroll_abs( editor, x, editor->vert_si.nPos, notify );
1120}

Referenced by editor_ensure_visible(), editor_handle_message(), ME_ScrollLeft(), ME_ScrollRight(), and ME_UpdateScrollBar().

◆ scroll_v_abs()

void scroll_v_abs ( ME_TextEditor editor,
int  y,
BOOL  notify 
)

Definition at line 1122 of file paint.c.

1123{
1124 scroll_abs( editor, editor->horz_si.nPos, y, notify );
1125}

Referenced by editor_handle_message(), ME_ScrollDown(), ME_ScrollUp(), and ME_UpdateScrollBar().

◆ select_style()

void select_style ( ME_Context c,
ME_Style s 
)

Definition at line 369 of file style.c.

370{
371 HFONT old_font;
372 LOGFONTW lf;
373 int i, empty, age = 0x7FFFFFFF;
375
376 if (c->current_style == s) return;
377
378 if (s)
379 {
380 ME_LogFontFromStyle( c, &lf, s );
381
382 for (i = 0; i < HFONT_CACHE_SIZE; i++)
383 c->editor->pFontCache[i].nAge++;
384 for (i = 0, empty = -1, age = 0; i < HFONT_CACHE_SIZE; i++)
385 {
386 item = &c->editor->pFontCache[i];
387 if (!item->nRefs)
388 {
389 if (item->nAge > age)
390 {
391 empty = i;
392 age = item->nAge;
393 }
394 }
395
396 if (item->hFont && ME_IsFontEqual( &item->lfSpecs, &lf ))
397 break;
398 }
399
400 if (i < HFONT_CACHE_SIZE) /* found */
401 {
402 item = &c->editor->pFontCache[i];
403 TRACE_(richedit_style)( "font reused %d\n", i );
404 item->nRefs++;
405 }
406 else
407 {
408 assert(empty != -1);
409 item = &c->editor->pFontCache[empty];
410 if (item->hFont)
411 {
412 TRACE_(richedit_style)( "font deleted %d\n", empty );
413 DeleteObject(item->hFont);
414 item->hFont = NULL;
415 }
416 item->hFont = CreateFontIndirectW( &lf );
417 TRACE_(richedit_style)( "font created %d\n", empty );
418 item->nRefs = 1;
419 item->lfSpecs = lf;
420 }
421 s->font_cache = item;
422 old_font = SelectObject( c->hDC, item->hFont );
423 GetTextMetricsW( c->hDC, &s->tm );
424 if (!c->orig_font) c->orig_font = old_font;
425 }
426 else
427 {
428 SelectObject( c->hDC, c->orig_font );
429 c->orig_font = NULL;
430 }
431
432 if (c->current_style)
433 {
434 release_font_cache( c->current_style->font_cache );
435 c->current_style->font_cache = NULL;
436 }
437 c->current_style = s;
438
439 return;
440}
static const WCHAR empty[]
Definition: main.c:47
static void ME_LogFontFromStyle(ME_Context *c, LOGFONTW *lf, const ME_Style *s)
Definition: style.c:302
static BOOL ME_IsFontEqual(const LOGFONTW *p1, const LOGFONTW *p2)
Definition: style.c:351
#define for
Definition: utility.h:88
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

Referenced by draw_para_number(), draw_space(), draw_text_with_style(), ME_CharFromPointContext(), ME_DestroyContext(), ME_GetTextExtent(), para_num_init(), and shape_run().

◆ set_selection()

int set_selection ( ME_TextEditor editor,
int  to,
int  from 
)

Definition at line 2146 of file editor.c.

2147{
2148 int end;
2149
2150 TRACE("%d - %d\n", to, from );
2151
2152 if (!editor->bHideSelection) ME_InvalidateSelection( editor );
2153 end = set_selection_cursors( editor, to, from );
2154 if (!editor->bHideSelection) ME_InvalidateSelection( editor );
2155 update_caret( editor );
2156 ME_SendSelChange( editor );
2157
2158 return end;
2159}

◆ set_selection_cursors()

int set_selection_cursors ( ME_TextEditor editor,
int  from,
int  to 
)

Definition at line 132 of file caret.c.

133{
134 int selectionEnd = 0;
135 const int len = ME_GetTextLength(editor);
136
137 /* all negative values are effectively the same */
138 if (from < 0)
139 from = -1;
140 if (to < 0)
141 to = -1;
142
143 /* select all */
144 if (from == 0 && to == -1)
145 {
146 ME_SetCursorToStart(editor, &editor->pCursors[1]);
147 ME_SetCursorToEnd(editor, &editor->pCursors[0], TRUE);
148 return len + 1;
149 }
150
151 /* if both values are equal and also out of bound, that means to */
152 /* put the selection at the end of the text */
153 if ((from == to) && (to < 0 || to > len))
154 {
155 selectionEnd = 1;
156 }
157 else
158 {
159 /* if from is negative and to is positive then selection is */
160 /* deselected and caret moved to end of the current selection */
161 if (from < 0)
162 {
163 int start, end;
164 ME_GetSelectionOfs(editor, &start, &end);
165 if (start != end)
166 {
167 if (end > len)
168 {
169 editor->pCursors[0].nOffset = 0;
170 end --;
171 }
172 editor->pCursors[1] = editor->pCursors[0];
173 }
174 return end;
175 }
176
177 /* adjust to if it's a negative value */
178 if (to < 0)
179 to = len + 1;
180
181 /* flip from and to if they are reversed */
182 if (from>to)
183 {
184 int tmp = from;
185 from = to;
186 to = tmp;
187 }
188
189 /* after fiddling with the values, we find from > len && to > len */
190 if (from > len)
191 selectionEnd = 1;
192 /* special case with to too big */
193 else if (to > len)
194 to = len + 1;
195 }
196
197 if (selectionEnd)
198 {
199 ME_SetCursorToEnd(editor, &editor->pCursors[0], FALSE);
200 editor->pCursors[1] = editor->pCursors[0];
201 return len;
202 }
203
204 cursor_from_char_ofs( editor, from, &editor->pCursors[1] );
205 editor->pCursors[0] = editor->pCursors[1];
206 ME_MoveCursorChars(editor, &editor->pCursors[0], to - from, FALSE);
207 /* Selection is not allowed in the middle of an end paragraph run. */
208 if (editor->pCursors[1].run->nFlags & MERF_ENDPARA)
209 editor->pCursors[1].nOffset = 0;
210 if (editor->pCursors[0].run->nFlags & MERF_ENDPARA)
211 {
212 if (to > len)
213 editor->pCursors[0].nOffset = editor->pCursors[0].run->len;
214 else
215 editor->pCursors[0].nOffset = 0;
216 }
217 return to;
218}

Referenced by editor_handle_message(), fnTextSrv_TxSetText(), ME_StreamIn(), and set_selection().

◆ show_caret()

void show_caret ( ME_TextEditor ed)

Definition at line 261 of file caret.c.

262{
263 ITextHost_TxShowCaret(editor->texthost, TRUE);
264 editor->caret_hidden = FALSE;
265}

Referenced by update_caret().

◆ style_get_insert_style()

ME_Style * style_get_insert_style ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 476 of file style.c.

477{
479 ME_Cursor *from, *to;
480 ME_Run *prev;
481
482 if (ME_IsSelection( editor ))
483 {
484 ME_GetSelection( editor, &from, &to );
485 style = from->run->style;
486 }
487 else if (editor->pBuffer->pCharStyle)
488 style = editor->pBuffer->pCharStyle;
489 else if (!cursor->nOffset && (prev = run_prev( cursor->run )))
490 style = prev->style;
491 else
492 style = cursor->run->style;
493
495 return style;
496}

Referenced by editor_handle_message(), handle_enter(), handle_wm_char(), ITextRange_fnSetText(), ME_GetSelectionInsertStyle(), ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), ME_SetSelectionCharFormat(), and table_insert_end_para().

◆ table_append_row()

ME_Paragraph * table_append_row ( ME_TextEditor editor,
ME_Paragraph table_row 
)

Definition at line 327 of file table.c.

328{
329 WCHAR endl = '\r', tab = '\t';
330 ME_Run *run;
331 int i;
332
333 if (!editor->bEmulateVersion10) /* v4.1 */
334 {
335 ME_Cell *new_cell, *cell;
336 ME_Paragraph *para, *prev_table_end, *new_row_start;
337
338 cell = table_row_first_cell( table_row );
339 prev_table_end = table_row_end( table_row );
340 para = para_next( prev_table_end );
341 run = para_first_run( para );
342 editor->pCursors[0].para = para;
343 editor->pCursors[0].run = run;
344 editor->pCursors[0].nOffset = 0;
345 editor->pCursors[1] = editor->pCursors[0];
346 new_row_start = table_insert_row_start( editor, editor->pCursors );
347 new_cell = table_row_first_cell( new_row_start );
348 /* Copy cell properties */
349 new_cell->nRightBoundary = cell->nRightBoundary;
350 new_cell->border = cell->border;
351 while (cell_next( cell ))
352 {
353 cell = cell_next( cell );
354 para = table_insert_cell( editor, editor->pCursors );
355 new_cell = para_cell( para );
356 /* Copy cell properties */
357 new_cell->nRightBoundary = cell->nRightBoundary;
358 new_cell->border = cell->border;
359 };
360 para = table_insert_row_end( editor, editor->pCursors );
361 para->fmt = prev_table_end->fmt;
362 /* return the table row start for the inserted paragraph */
363 return new_row_start;
364 }
365 else /* v1.0 - 3.0 */
366 {
367 run = para_end_run( table_row );
368 assert( para_in_table( table_row ) );
369 editor->pCursors[0].para = table_row;
370 editor->pCursors[0].run = run;
371 editor->pCursors[0].nOffset = 0;
372 editor->pCursors[1] = editor->pCursors[0];
373 ME_InsertTextFromCursor( editor, 0, &endl, 1, run->style );
374 run = editor->pCursors[0].run;
375 for (i = 0; i < table_row->fmt.cTabCount; i++)
376 ME_InsertTextFromCursor( editor, 0, &tab, 1, run->style );
377
378 return para_next( table_row );
379 }
380}
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
ME_Paragraph * table_insert_row_end(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: table.c:119
ME_Cell * table_row_first_cell(ME_Paragraph *para)
Definition: table.c:170
ME_Paragraph * table_insert_row_start(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: table.c:72
ME_Paragraph * table_row_end(ME_Paragraph *para)
Definition: table.c:127
ME_Paragraph * table_insert_cell(ME_TextEditor *editor, ME_Cursor *cursor)
Definition: table.c:112

Referenced by handle_enter(), and table_select_next_cell_or_append().

◆ table_handle_tab()

void table_handle_tab ( ME_TextEditor editor,
BOOL  selected_row 
)

Definition at line 473 of file table.c.

474{
475 /* FIXME: Shift tab should move to the previous cell. */
476 ME_Cursor fromCursor, toCursor;
478 {
479 int from, to;
480 from = ME_GetCursorOfs(&editor->pCursors[0]);
481 to = ME_GetCursorOfs(&editor->pCursors[1]);
482 if (from <= to)
483 {
484 fromCursor = editor->pCursors[0];
485 toCursor = editor->pCursors[1];
486 }
487 else
488 {
489 fromCursor = editor->pCursors[1];
490 toCursor = editor->pCursors[0];
491 }
492 }
493 if (!editor->bEmulateVersion10) /* v4.1 */
494 {
495 if (!para_in_table( toCursor.para ))
496 {
497 editor->pCursors[0] = toCursor;
498 editor->pCursors[1] = toCursor;
499 }
500 else table_select_next_cell_or_append( editor, toCursor.run );
501 }
502 else /* v1.0 - 3.0 */
503 {
504 if (!para_in_table( fromCursor.para ))
505 {
506 editor->pCursors[0] = fromCursor;
507 editor->pCursors[1] = fromCursor;
508 /* FIXME: For some reason the caret is shown at the start of the
509 * previous paragraph in v1.0 to v3.0 */
510 }
511 else if ((selected_row || !para_in_table( toCursor.para )))
512 table_select_next_cell_or_append( editor, fromCursor.run );
513 else
514 {
515 ME_Run *run = run_prev( toCursor.run );
516
517 if (ME_IsSelection(editor) && !toCursor.nOffset && run && run->nFlags & MERF_TAB)
519 else
520 table_select_next_cell_or_append( editor, toCursor.run );
521 }
522 }
524 ME_Repaint(editor);
525 update_caret(editor);
526 ME_SendSelChange(editor);
527}
static void table_select_next_cell_or_append(ME_TextEditor *editor, ME_Run *run)
Definition: table.c:383

Referenced by handle_wm_char().

◆ table_insert_cell()

ME_Paragraph * table_insert_cell ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 112 of file table.c.

113{
114 WCHAR tab = '\t';
115
116 return table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL );
117}
static ME_Paragraph * table_insert_end_para(ME_TextEditor *editor, ME_Cursor *cursor, const WCHAR *eol_str, int eol_len, int para_flags)
Definition: table.c:57

Referenced by ME_RTFSpecialCharHook(), and table_append_row().

◆ table_insert_row_end()

ME_Paragraph * table_insert_row_end ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 119 of file table.c.

120{
121 ME_Paragraph *para;
122
123 para = table_insert_end_para( editor, cursor, L"\r\n", 2, MEPF_ROWEND );
124 return para_prev( para );
125}

Referenced by ME_RTFSpecialCharHook(), and table_append_row().

◆ table_insert_row_start()

ME_Paragraph * table_insert_row_start ( ME_TextEditor editor,
ME_Cursor cursor 
)

Definition at line 72 of file table.c.

73{
74 ME_Paragraph *para;
75
76 para = table_insert_end_para( editor, cursor, L"\r\n", 2, MEPF_ROWSTART );
77 return para_prev( para );
78}

Referenced by ME_RTFParAttrHook(), table_append_row(), and table_insert_row_start_at_para().

◆ table_insert_row_start_at_para()

ME_Paragraph * table_insert_row_start_at_para ( ME_TextEditor editor,
ME_Paragraph para 
)

Definition at line 80 of file table.c.

81{
82 ME_Paragraph *prev_para, *end_para, *start_row;
84
85 cursor.para = para;
86 cursor.run = para_first_run( para );
87 cursor.nOffset = 0;
88
89 start_row = table_insert_row_start( editor, &cursor );
90
91 end_para = para_next( editor->pCursors[0].para );
92 prev_para = para_next( start_row );
93 para = para_next( prev_para );
94
95 while (para != end_para)
96 {
97 para->cell = para_cell( prev_para );
98 para->nFlags |= MEPF_CELL;
99 para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND);
101 para->fmt.wEffects |= PFE_TABLE;
102 para->fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
103 prev_para = para;
104 para = para_next( para );
105 }
106 return start_row;
107}
#define PFM_TABLEROWDELIMITER
Definition: richedit.h:868

Referenced by ME_RTFParAttrHook(), and ME_RTFSpecialCharHook().

◆ table_move_from_row_start()

void table_move_from_row_start ( ME_TextEditor editor)

Definition at line 531 of file table.c.

532{
533 ME_Paragraph *para = editor->pCursors[0].para;
534
535 if (para == editor->pCursors[1].para && para->nFlags & MEPF_ROWSTART)
536 {
537 /* The cursors should not be at the hidden start row paragraph without
538 * a selection, so the cursor is moved into the first cell. */
539 para = para_next( para );
540 editor->pCursors[0].para = para;
541 editor->pCursors[0].run = para_first_run( para );
542 editor->pCursors[0].nOffset = 0;
543 editor->pCursors[1] = editor->pCursors[0];
544 }
545}

Referenced by ME_KeyDown(), ME_Redo(), and ME_Undo().

◆ table_outer_para()

ME_Paragraph * table_outer_para ( ME_Paragraph para)

Definition at line 158 of file table.c.

159{
160 if (para->nFlags & MEPF_ROWEND) para = para_prev( para );
161 while (para_cell( para ))
162 {
163 para = table_row_start( para );
164 if (!para_cell( para )) break;
166 }
167 return para;
168}
ME_Paragraph * table_row_start(ME_Paragraph *para)
Definition: table.c:142

Referenced by para_range_invalidate(), and wrap_marked_paras_dc().

◆ table_protect_partial_deletion()

void table_protect_partial_deletion ( ME_TextEditor editor,
ME_Cursor c,
int num_chars 
)

Definition at line 217 of file table.c.

218{
219 int start_ofs = ME_GetCursorOfs( c );
220 ME_Cursor c2 = *c;
221 ME_Paragraph *this_para = c->para, *end_para;
222
223 ME_MoveCursorChars( editor, &c2, *num_chars, FALSE );
224 end_para = c2.para;
225 if (c2.run->nFlags & MERF_ENDPARA)
226 {
227 /* End offset might be in the middle of the end paragraph run.
228 * If this is the case, then we need to use the next paragraph as the last
229 * paragraphs.
230 */
231 int remaining = start_ofs + *num_chars - c2.run->nCharOfs - end_para->nCharOfs;
232 if (remaining)
233 {
234 assert( remaining < c2.run->len );
235 end_para = para_next( end_para );
236 }
237 }
238 if (!editor->bEmulateVersion10) /* v4.1 */
239 {
240 if (para_cell( this_para ) != para_cell( end_para ) ||
241 ((this_para->nFlags | end_para->nFlags) & (MEPF_ROWSTART | MEPF_ROWEND)))
242 {
243 while (this_para != end_para)
244 {
245 ME_Paragraph *next_para = para_next( this_para );
246 BOOL truancate_del = FALSE;
247 if (this_para->nFlags & MEPF_ROWSTART)
248 {
249 /* The following while loop assumes that next_para is MEPF_ROWSTART,
250 * so moving back one paragraph lets it be processed as the start
251 * of the row. */
252 next_para = this_para;
253 this_para = para_prev( this_para );
254 }
255 else if (para_cell( next_para) != para_cell( this_para ) || this_para->nFlags & MEPF_ROWEND)
256 {
257 /* Start of the deletion from after the start of the table row. */
258 truancate_del = TRUE;
259 }
260 while (!truancate_del && next_para->nFlags & MEPF_ROWSTART)
261 {
262 next_para = para_next( table_row_end( next_para ) );
263 if (next_para->nCharOfs > start_ofs + *num_chars)
264 {
265 /* End of deletion is not past the end of the table row. */
266 next_para = para_next( this_para );
267 /* Delete the end paragraph preceding the table row if the
268 * preceding table row will be empty. */
269 if (this_para->nCharOfs >= start_ofs) next_para = para_next( next_para );
270 truancate_del = TRUE;
271 }
272 else this_para = para_prev( next_para );
273 }
274 if (truancate_del)
275 {
276 ME_Run *end_run = para_end_run( para_prev( next_para ) );
277 int new_chars = next_para->nCharOfs - start_ofs - end_run->len;
278 new_chars = max( new_chars, 0 );
279 assert( new_chars <= *num_chars);
280 *num_chars = new_chars;
281 break;
282 }
283 this_para = next_para;
284 }
285 }
286 }
287 else /* v1.0 - 3.0 */
288 {
289 ME_Run *run;
290 int chars_to_boundary;
291
292 if ((this_para->nCharOfs != start_ofs || this_para == end_para) && para_in_table( this_para ))
293 {
294 run = c->run;
295 /* Find the next tab or end paragraph to use as a delete boundary */
296 while (!(run->nFlags & (MERF_TAB | MERF_ENDPARA)))
297 run = run_next( run );
298 chars_to_boundary = run->nCharOfs - c->run->nCharOfs - c->nOffset;
299 *num_chars = min( *num_chars, chars_to_boundary );
300 }
301 else if (para_in_table( end_para ))
302 {
303 /* The deletion starts from before the row, so don't join it with
304 * previous non-empty paragraphs. */
305 ME_Paragraph *cur_para;
306 run = NULL;
307 if (start_ofs > this_para->nCharOfs)
308 {
309 cur_para = para_prev( end_para );
310 run = para_end_run( cur_para );
311 }
312 if (!run)
313 {
314 cur_para = end_para;
315 run = para_first_run( end_para );
316 }
317 if (run)
318 {
319 chars_to_boundary = cur_para->nCharOfs + run->nCharOfs - start_ofs;
320 if (chars_to_boundary >= 0) *num_chars = min( *num_chars, chars_to_boundary );
321 }
322 }
323 if (*num_chars < 0) *num_chars = 0;
324 }
325}

Referenced by ME_InternalDeleteText().

◆ table_row_end()

ME_Paragraph * table_row_end ( ME_Paragraph para)

Definition at line 127 of file table.c.

128{
129 ME_Cell *cell;
130
131 if (para->nFlags & MEPF_ROWEND) return para;
132 if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
133 cell = para_cell( para );
134 while (cell_next( cell ))
135 cell = cell_next( cell );
136
137 para = &ME_FindItemFwd( cell_get_di( cell ), diParagraph )->member.para;
138 assert( para && para->nFlags & MEPF_ROWEND );
139 return para;
140}

Referenced by adjust_para_y(), cursor_from_virtual_coords(), cursor_move_line(), draw_table_borders(), ME_BeginRow(), ME_WrapTextParagraph(), pixel_pos_in_table_row(), stream_out_table_props(), table_append_row(), table_protect_partial_deletion(), table_row_end_cell(), and table_select_next_cell_or_append().

◆ table_row_end_cell()

ME_Cell * table_row_end_cell ( ME_Paragraph para)

Definition at line 178 of file table.c.

179{
180 if (!para_in_table( para )) return NULL;
181
182 para = para_prev( table_row_end( para ));
183 return cell_next( para_cell( para ) );
184}

Referenced by adjust_para_y(), cursor_move_line(), draw_paragraph(), draw_table_borders(), and ME_BeginRow().

◆ table_row_first_cell()

ME_Cell * table_row_first_cell ( ME_Paragraph para)

Definition at line 170 of file table.c.

171{
172 if (!para_in_table( para )) return NULL;
173
174 para = para_next( table_row_start( para ) );
175 return para_cell( para );
176}

Referenced by adjust_para_y(), cursor_move_line(), draw_paragraph(), ME_RTFSpecialCharHook(), pixel_pos_in_table_row(), stream_out_table_props(), and table_append_row().

◆ table_row_start()

ME_Paragraph * table_row_start ( ME_Paragraph para)

Definition at line 142 of file table.c.

143{
144 ME_Cell *cell;
145
146 if (para->nFlags & MEPF_ROWSTART) return para;
147 if (para->nFlags & MEPF_ROWEND) para = para_prev( para );
148 cell = para_cell( para );
149
150 while (cell_prev( cell ))
151 cell = cell_prev( cell );
152
154 assert( para && para->nFlags & MEPF_ROWSTART );
155 return para;
156}
ME_Cell * cell_prev(ME_Cell *cell)
Definition: table.c:197

Referenced by adjust_para_y(), cursor_move_line(), table_outer_para(), table_row_first_cell(), and table_select_next_cell_or_append().

◆ update_caret()

void update_caret ( ME_TextEditor ed)

Definition at line 277 of file caret.c.

278{
279 int x, y, height;
280
281 if (!editor->bHaveFocus) return;
282 if (!ME_IsSelection(editor))
283 {
284 cursor_coords( editor, &editor->pCursors[0], &x, &y, &height );
285 if (height != editor->caret_height) create_caret(editor);
286 x = min(x, editor->rcFormat.right-1);
287 ITextHost_TxSetCaretPos(editor->texthost, x, y);
288 show_caret(editor);
289 }
290 else
291 hide_caret(editor);
292#ifdef __REACTOS__
294 {
295 HIMC hIMC = ImmGetContext(editor->hWnd);
296 if (hIMC)
297 {
299 LOGFONTW lf;
300 COMPOSITIONFORM CompForm;
301 POINT pt = { x, y };
302
303 CompForm.ptCurrentPos = pt;
304 if (editor->styleFlags & ES_MULTILINE)
305 {
306 CompForm.dwStyle = CFS_RECT;
307 CompForm.rcArea = editor->rcFormat;
308 }
309 else
310 {
311 CompForm.dwStyle = CFS_POINT;
312 SetRectEmpty(&CompForm.rcArea);
313 }
314 ImmSetCompositionWindow(hIMC, &CompForm);
315
316 fmt.cbSize = sizeof(fmt);
318
319 ZeroMemory(&lf, sizeof(lf));
321 if (fmt.dwMask & CFM_SIZE)
322 {
324 lf.lfHeight = -MulDiv(fmt.yHeight, GetDeviceCaps(hdc, LOGPIXELSY), 1440);
325 DeleteDC(hdc);
326 }
327 if (fmt.dwMask & CFM_CHARSET)
328 lf.lfCharSet = fmt.bCharSet;
329 if (fmt.dwMask & CFM_FACE)
330 lstrcpynW(lf.lfFaceName, fmt.szFaceName, ARRAY_SIZE(lf.lfFaceName));
331 ImmSetCompositionFontW(hIMC, &lf);
332
333 ImmReleaseContext(editor->hWnd, hIMC);
334 }
335 }
336#endif
337}
#define lstrcpynW
Definition: compat.h:738
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1583
void show_caret(ME_TextEditor *editor)
Definition: caret.c:261
#define ITextHost_TxSetCaretPos(This, a, b)
Definition: editor.h:343
#define CFS_RECT
Definition: imm.h:324
#define CFS_POINT
Definition: imm.h:325
#define ES_MULTILINE
Definition: pedump.c:667
RECT rcArea
Definition: dimm.idl:88
DWORD dwStyle
Definition: dimm.idl:86
POINT ptCurrentPos
Definition: dimm.idl:87
#define DEFAULT_CHARSET
Definition: wingdi.h:384

Referenced by editor_handle_message(), ME_ArrowKey(), ME_LButtonDown(), ME_MouseMove(), ME_UpdateRepaint(), set_selection(), and table_handle_tab().

◆ wrap_marked_paras_dc()

BOOL wrap_marked_paras_dc ( ME_TextEditor editor,
HDC  hdc,
BOOL  invalidate 
)

Definition at line 1023 of file wrap.c.

1024{
1025 ME_Paragraph *para, *next;
1026 struct wine_rb_entry *entry, *next_entry = NULL;
1027 ME_Context c;
1028 int totalWidth = editor->nTotalWidth, prev_width;
1029 struct repaint_range repaint = { NULL, NULL };
1030
1031 if (!editor->marked_paras.root) return FALSE;
1032
1033 ME_InitContext( &c, editor, hdc );
1034
1035 entry = wine_rb_head( editor->marked_paras.root );
1036 while (entry)
1037 {
1038 para = WINE_RB_ENTRY_VALUE( entry, ME_Paragraph, marked_entry );
1039
1040 /* If the first entry lies inside a table, go back to the start
1041 of the table to ensure cell heights are kept in sync. */
1042 if (!next_entry && para_in_table( para ) && para != table_outer_para( para ))
1043 {
1044 para = table_outer_para( para );
1045 next_entry = entry;
1046 }
1047 else
1048 next_entry = wine_rb_next( entry );
1049
1050 c.pt = para->pt;
1051 prev_width = para->nWidth;
1052 ME_WrapTextParagraph( editor, &c, para );
1053 if (prev_width == totalWidth && para->nWidth < totalWidth)
1054 totalWidth = get_total_width(editor);
1055 else
1056 totalWidth = max(totalWidth, para->nWidth);
1057
1058 update_repaint( para, &repaint );
1059 adjust_para_y( para, &c, &repaint );
1060
1061 if (para_next( para ))
1062 {
1063 if (c.pt.x != para_next( para )->pt.x || c.pt.y != para_next( para )->pt.y ||
1064 para_in_table( para ))
1065 {
1066 next = para;
1067 while (para_next( next ) && &next->marked_entry != next_entry &&
1068 next != &editor->pBuffer->pLast->member.para)
1069 {
1070 update_repaint( para_next( next ), &repaint );
1071 para_next( next )->pt = c.pt;
1072 adjust_para_y( para_next( next ), &c, &repaint );
1073 next = para_next( next );
1074 }
1075 }
1076 }
1077 entry = next_entry;
1078 }
1079 wine_rb_clear( &editor->marked_paras, NULL, NULL );
1080
1081 editor->sizeWindow.cx = c.rcView.right-c.rcView.left;
1082 editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top;
1083
1084 editor->nTotalLength = editor->pBuffer->pLast->member.para.pt.y;
1085 editor->nTotalWidth = totalWidth;
1086
1088
1089 if (invalidate && (repaint.start || editor->nTotalLength < editor->nLastTotalLength))
1090 para_range_invalidate( editor, repaint.start, repaint.end);
1091 return !!repaint.start;
1092}
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: para.c:69
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
static struct wine_rb_entry * wine_rb_head(struct wine_rb_entry *iter)
Definition: rbtree.h:103
static void wine_rb_clear(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:191
static struct wine_rb_entry * wine_rb_next(struct wine_rb_entry *iter)
Definition: rbtree.h:117
ME_Paragraph * start
Definition: wrap.c:910
ME_Paragraph * end
Definition: wrap.c:910
Definition: rbtree.h:36
static void invalidate()
static void ME_WrapTextParagraph(ME_TextEditor *editor, ME_Context *c, ME_Paragraph *para)
Definition: wrap.c:817
static void update_repaint(ME_Paragraph *para, struct repaint_range *repaint)
Definition: wrap.c:913
void para_range_invalidate(ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para)
Definition: wrap.c:1102
static void adjust_para_y(ME_Paragraph *para, ME_Context *c, struct repaint_range *repaint)
Definition: wrap.c:919

Referenced by fnTextSrv_TxDraw(), fnTextSrv_TxGetNaturalSize(), and ME_WrapMarkedParagraphs().

Variable Documentation

◆ DECLSPEC_HIDDEN

BOOL me_debug DECLSPEC_HIDDEN
extern

Definition at line 28 of file editor.h.