181 int ofs = 0, ofsp = 0;
186 TRACE_(richedit_check)(
"Checking begin\n");
189 TRACE_(richedit_lists)(
"---\n");
196 TRACE_(richedit_check)(
"tend, real ofsp = %d, counted = %d\n",
p->member.para.nCharOfs, ofsp+ofs);
197 assert(ofsp+ofs ==
p->member.para.nCharOfs);
198 TRACE_(richedit_check)(
"Checking finished\n");
201 TRACE_(richedit_check)(
"para, real ofsp = %d, counted = %d\n",
p->member.para.nCharOfs, ofsp+ofs);
202 assert(ofsp+ofs ==
p->member.para.nCharOfs);
203 ofsp =
p->member.para.nCharOfs;
207 TRACE_(richedit_check)(
"run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08lx\n",
208 p->member.run.nCharOfs,
p->member.run.nCharOfs+ofsp, ofsp+ofs,
210 p->member.run.nFlags,
211 p->member.run.style->fmt.dwMask &
p->member.run.style->fmt.dwEffects);
212 assert(ofs ==
p->member.run.nCharOfs);
214 ofs +=
p->member.run.len;
217 TRACE_(richedit_check)(
"cell\n");
223 TRACE_(richedit_check)(
"Checking finished\n");
270 cursor->nOffset = char_ofs;
314 int nOffset =
cursor->nOffset;
319 new_run->nCharOfs = run->
nCharOfs + nOffset;
320 new_run->len = run->
len - nOffset;
321 new_run->para = run->
para;
387 if (
cursor->nOffset == insert_before->
len)
390 if (!insert_before) insert_before =
cursor->run;
395 insert_before =
cursor->run;
402 run->nCharOfs = insert_before->
nCharOfs;
404 run->para = insert_before->
para;
441 if (found_ink)
return TRUE;
474 run->
nFlags &= ~MERF_HIDDEN;
479 run->
nFlags &= ~MERF_SPLITTABLE;
487 run->
nFlags &= ~MERF_WHITESPACE;
492 run->
nFlags &= ~MERF_STARTWHITE;
497 run->
nFlags &= ~MERF_ENDWHITE;
522 if (!run->
len ||
cx <= 0)
527 if (!closest || cx < run->nWidth / 2)
return 0;
535 if (!closest ||
cx < sz.
cx / 2)
return 0;
551 if (
c->editor->password_char)
562 if (closest && fit != run->
len)
566 if (
cx >= (sz2.
cx+sz3.
cx)/2)
636 if (
c->editor->password_char)
675 int startx,
int *pAscent,
int *pDescent)
679 nLen =
min( nLen, run->
len );
683 nLen =
min( nLen, 1 );
690 else if (
c->editor->password_char)
702 size.cy = *pAscent + *pDescent;
709 if (
c->editor->bEmulateVersion10 &&
714 if (i < pFmt->cTabCount)
728 if (ppos > startx + run->
pt.
x) {
729 size.cx = ppos - startx - run->
pt.
x;
733 size.cy = *pAscent + *pDescent;
739 if (
size.cy > *pAscent)
791 else if (
start->nOffset)
795 int split_offset =
start->nOffset;
797 start_run =
start->run;
798 if (
end &&
end->run == split_run)
801 end->nOffset -= split_offset;
807 if (
end->nOffset ==
end->run->len)
824 run->
style = new_style;
879 ME_Run *run, *run_end, *prev_run;
886 if (!
from->nOffset && (prev_run =
run_prev( run ))) run = prev_run;
896 if (run == run_end)
return;
905 memset( &tmp, 0,
sizeof(tmp) );
915 fmt->dwMask &= ~CFM_FACE;
918 fmt->dwMask &= ~CFM_FACE;
927 fmt->dwMask &= ~CFM_COLOR;
934 }
while(run != run_end);
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define WINE_DECLARE_DEBUG_CHANNEL(x)
BOOL ME_IsSelection(ME_TextEditor *editor)
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to)
int ME_GetTextLength(ME_TextEditor *editor)
void ME_DestroyContext(ME_Context *c)
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
ME_Paragraph * editor_first_para(ME_TextEditor *editor)
ME_Run * run_next(ME_Run *run)
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order)
static void ME_GetTextExtent(ME_Context *c, LPCWSTR szText, int nChars, ME_Style *s, SIZE *size)
int ME_CharFromPointContext(ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order)
static BOOL run_is_splittable(const ME_Run *run)
int run_char_ofs(ME_Run *run, int ofs)
BOOL cursor_next_run(ME_Cursor *cursor, BOOL all_para)
void editor_propagate_char_ofs(ME_TextEditor *editor, ME_Paragraph *para, ME_Run *run, int shift)
ME_Run * run_insert(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags)
ME_Run * run_prev(ME_Run *run)
void run_join(ME_TextEditor *editor, ME_Run *run)
void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from, const ME_Cursor *to, CHARFORMAT2W *fmt)
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
static void run_copy_char_fmt(ME_Run *run, CHARFORMAT2W *fmt)
static BOOL run_is_entirely_ws(const ME_Run *run)
ME_Run * run_prev_all_paras(ME_Run *run)
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order)
ME_Run * run_create(ME_Style *s, int flags)
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx, int *pAscent, int *pDescent)
BOOL cursor_prev_run(ME_Cursor *cursor, BOOL all_para)
BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2)
void cursor_from_char_ofs(ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor)
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *fmt)
ME_Run * run_split(ME_TextEditor *editor, ME_Cursor *cursor)
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
void ME_CheckCharOffsets(ME_TextEditor *editor)
ME_Run * run_next_all_paras(ME_Run *run)
int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order)
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
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)
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)
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
BOOL add_undo_delete_run(ME_TextEditor *, int pos, int len)
void ME_AddRefStyle(ME_Style *item)
void ME_Remove(ME_DisplayItem *diWhere)
ME_Style * style_get_insert_style(ME_TextEditor *editor, ME_Cursor *cursor)
void ME_ReleaseStyle(ME_Style *item)
void ME_DestroyString(ME_String *s)
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc)
ME_Style * ME_ApplyStyle(ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style)
void para_mark_remove(ME_TextEditor *editor, ME_Paragraph *para)
int ME_twips2pointsX(const ME_Context *c, int x)
static ME_DisplayItem * run_get_di(ME_Run *run)
void ME_DumpDocument(ME_TextBuffer *buffer)
void para_mark_add(ME_TextEditor *editor, ME_Paragraph *para)
#define ITextHost_TxGetDC(This)
static int ME_IsWSpace(WCHAR ch)
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize)
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass)
#define ITextHost_TxReleaseDC(This, a)
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat)
void para_mark_rewrap(ME_TextEditor *editor, ME_Paragraph *para)
void select_style(ME_Context *c, ME_Style *s)
ME_Run * para_first_run(ME_Paragraph *para)
#define RUN_IS_HIDDEN(run)
ME_String * ME_MakeStringR(WCHAR cRepeat, int nMaxChars)
static WCHAR * get_text(const ME_Run *run, int offset)
void ME_DestroyDisplayItem(ME_DisplayItem *item)
ME_Paragraph * para_next(ME_Paragraph *para)
ME_DisplayItem * ME_MakeDI(ME_DIType type)
BOOL add_undo_set_char_fmt(ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt)
static const char * debugstr_run(const ME_Run *run)
GLint GLint GLint GLint GLint x
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
static unsigned __int64 next
#define CFM_UNDERLINETYPE
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct tagME_DisplayItem * prev
struct tagME_DisplayItem * next
SCRIPT_VISATTR * vis_attrs
struct tagME_Paragraph * para
SCRIPT_ANALYSIS script_analysis
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)