ReactOS  0.4.13-dev-257-gfabbd7c
list.c File Reference
#include "editor.h"
Include dependency graph for list.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (richedit_lists)
 
void ME_InsertBefore (ME_DisplayItem *diWhere, ME_DisplayItem *diWhat)
 
void ME_Remove (ME_DisplayItem *diWhere)
 
static BOOL ME_DITypesEqual (ME_DIType type, ME_DIType nTypeOrClass)
 
BOOL ME_NextRun (ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para)
 
BOOL ME_PrevRun (ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para)
 
ME_DisplayItemME_FindItemBack (ME_DisplayItem *di, ME_DIType nTypeOrClass)
 
ME_DisplayItemME_FindItemBackOrHere (ME_DisplayItem *di, ME_DIType nTypeOrClass)
 
ME_DisplayItemME_FindItemFwd (ME_DisplayItem *di, ME_DIType nTypeOrClass)
 
static const charME_GetDITypeName (ME_DIType type)
 
void ME_DestroyDisplayItem (ME_DisplayItem *item)
 
ME_DisplayItemME_MakeDI (ME_DIType type)
 
void ME_DumpDocument (ME_TextBuffer *buffer)
 

Function Documentation

◆ ME_DestroyDisplayItem()

void ME_DestroyDisplayItem ( ME_DisplayItem item)

Definition at line 160 of file list.c.

161 {
162  if (0)
163  TRACE("type=%s\n", ME_GetDITypeName(item->type));
164  if (item->type==diRun)
165  {
166  if (item->member.run.reobj)
167  {
168  list_remove(&item->member.run.reobj->entry);
169  ME_DeleteReObject(item->member.run.reobj);
170  }
171  heap_free( item->member.run.glyphs );
172  heap_free( item->member.run.clusters );
173  ME_ReleaseStyle(item->member.run.style);
174  }
175  heap_free(item);
176 }
static const char * ME_GetDITypeName(ME_DIType type)
Definition: list.c:146
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN
Definition: richole.c:5904
Definition: editstr.h:91
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:443
static ATOM item
Definition: dde.c:856
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by destroy_para(), ME_DestroyEditor(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_JoinRuns(), and ME_PrepareParagraphForWrapping().

◆ ME_DITypesEqual()

static BOOL ME_DITypesEqual ( ME_DIType  type,
ME_DIType  nTypeOrClass 
)
static

Definition at line 45 of file list.c.

46 {
47  switch (nTypeOrClass)
48  {
49  case diRunOrParagraph:
50  return type == diRun || type == diParagraph;
51  case diRunOrStartRow:
52  return type == diRun || type == diStartRow;
53  case diParagraphOrEnd:
54  return type == diTextEnd || type == diParagraph;
56  return type == diStartRow || type == diParagraph;
58  return type == diStartRow || type == diParagraph || type == diTextEnd;
60  return type == diRun || type == diParagraph || type == diTextEnd;
61  default:
62  return type == nTypeOrClass;
63  }
64 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: editstr.h:91

Referenced by ME_FindItemBack(), ME_FindItemBackOrHere(), and ME_FindItemFwd().

◆ ME_DumpDocument()

void ME_DumpDocument ( ME_TextBuffer buffer)

Definition at line 187 of file list.c.

188 {
189  /* FIXME this is useless, */
190  ME_DisplayItem *pItem = buffer->pFirst;
191  TRACE("DOCUMENT DUMP START\n");
192  while(pItem) {
193  switch(pItem->type)
194  {
195  case diTextStart:
196  TRACE("Start\n");
197  break;
198  case diCell:
199  TRACE("Cell(level=%d%s)\n", pItem->member.cell.nNestingLevel,
200  !pItem->member.cell.next_cell ? ", END" :
201  (!pItem->member.cell.prev_cell ? ", START" :""));
202  break;
203  case diParagraph:
204  TRACE("Paragraph(ofs=%d)\n", pItem->member.para.nCharOfs);
205  if (pItem->member.para.nFlags & MEPF_ROWSTART)
206  TRACE(" - (Table Row Start)\n");
207  if (pItem->member.para.nFlags & MEPF_ROWEND)
208  TRACE(" - (Table Row End)\n");
209  break;
210  case diStartRow:
211  TRACE(" - StartRow\n");
212  break;
213  case diRun:
214  TRACE(" - Run(%s, %d, flags=%x)\n", debugstr_run( &pItem->member.run ),
215  pItem->member.run.nCharOfs, pItem->member.run.nFlags);
216  break;
217  case diTextEnd:
218  TRACE("End(ofs=%d)\n", pItem->member.para.nCharOfs);
219  break;
220  default:
221  break;
222  }
223  pItem = pItem->next;
224  }
225  TRACE("DOCUMENT DUMP END\n");
226 }
ME_DIType type
Definition: editstr.h:260
#define MEPF_ROWEND
Definition: editstr.h:149
ME_Paragraph para
Definition: editstr.h:266
union tagME_DisplayItem::@503 member
GLuint buffer
Definition: glext.h:5915
int nCharOfs
Definition: editstr.h:166
int nNestingLevel
Definition: editstr.h:227
static const char * debugstr_run(const ME_Run *run)
Definition: editor.h:47
struct tagME_DisplayItem * next
Definition: editstr.h:261
Definition: editstr.h:91
#define TRACE(s)
Definition: solgame.cpp:4
int nFlags
Definition: editstr.h:169
#define MEPF_ROWSTART
Definition: editstr.h:148
Definition: editstr.h:90
ME_Cell cell
Definition: editstr.h:265
struct tagME_DisplayItem * next_cell
Definition: editstr.h:233
struct tagME_DisplayItem * prev_cell
Definition: editstr.h:233

Referenced by ME_CheckCharOffsets(), and ME_CheckTablesForCorruption().

◆ ME_FindItemBack()

◆ ME_FindItemBackOrHere()

ME_DisplayItem* ME_FindItemBackOrHere ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 124 of file list.c.

125 {
126  while(di!=NULL) {
127  if (ME_DITypesEqual(di->type, nTypeOrClass))
128  return di;
129  di = di->prev;
130  }
131  return NULL;
132 }
ME_DIType type
Definition: editstr.h:260
smooth NULL
Definition: ftsmooth.c:416
static BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
Definition: list.c:45
struct tagME_DisplayItem * prev
Definition: editstr.h:261

Referenced by ME_GetParagraph(), and ME_RowStart().

◆ ME_FindItemFwd()

ME_DisplayItem* ME_FindItemFwd ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 134 of file list.c.

135 {
136  if (!di) return NULL;
137  di = di->next;
138  while(di!=NULL) {
139  if (ME_DITypesEqual(di->type, nTypeOrClass))
140  return di;
141  di = di->next;
142  }
143  return NULL;
144 }
ME_DIType type
Definition: editstr.h:260
struct tagME_DisplayItem * next
Definition: editstr.h:261
smooth NULL
Definition: ftsmooth.c:416
static BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
Definition: list.c:45

Referenced by adjust_para_y(), handle_enter(), ME_AppendTableRow(), ME_ArrowEnd(), ME_ArrowHome(), ME_ArrowPageDown(), ME_ArrowPageUp(), ME_Char(), ME_CheckCharOffsets(), ME_DrawTableBorders(), ME_ExtendAnchorSelection(), ME_FindPixelPos(), ME_FindPixelPosInTableRow(), ME_FindRowWithNumber(), ME_FindRunInRow(), ME_FindText(), ME_GetCharFormat(), ME_GetCursorCoordinates(), ME_GetTableRowEnd(), ME_GetTextW(), ME_HandleMessage(), ME_InsertEndParaFromCursor(), ME_InsertRunAtCursor(), ME_InsertTableRowStartAtParagraph(), ME_InsertTextFromCursor(), ME_InternalDeleteText(), ME_InvalidateSelection(), ME_JoinParagraphs(), ME_MoveCursorChars(), ME_MoveCursorFromTableRowStartParagraph(), ME_MoveCursorLines(), ME_MoveCursorWords(), ME_PropagateCharOffset(), ME_ProtectPartialTableDeletion(), ME_RowNumberFromCharOfs(), ME_RTFSpecialCharHook(), ME_RunOfsFromCharOfs(), ME_SelectByType(), ME_SelectOrInsertNextCell(), ME_SetCharFormat(), ME_SetCursorToStart(), ME_SkipAndPropagateCharOffset(), ME_SplitParagraph(), ME_StreamIn(), ME_StreamOutRTFFontAndColorTbl(), ME_StreamOutText(), ME_UpdateLinkAttribute(), and ME_UpdateSelectionLinkAttribute().

◆ ME_GetDITypeName()

static const char* ME_GetDITypeName ( ME_DIType  type)
static

Definition at line 146 of file list.c.

147 {
148  switch(type)
149  {
150  case diParagraph: return "diParagraph";
151  case diRun: return "diRun";
152  case diCell: return "diCell";
153  case diTextStart: return "diTextStart";
154  case diTextEnd: return "diTextEnd";
155  case diStartRow: return "diStartRow";
156  default: return "?";
157  }
158 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: editstr.h:91
Definition: editstr.h:90

Referenced by ME_DestroyDisplayItem().

◆ 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 }
struct tagME_DisplayItem * next
Definition: editstr.h:261
struct tagME_DisplayItem * prev
Definition: editstr.h:261

Referenced by ME_InsertRowStart(), ME_InsertRunAtCursor(), ME_MakeFirstParagraph(), ME_SplitParagraph(), and ME_SplitRunSimple().

◆ ME_MakeDI()

ME_DisplayItem* ME_MakeDI ( ME_DIType  type)

Definition at line 178 of file list.c.

179 {
180  ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
181 
182  item->type = type;
183  item->prev = item->next = NULL;
184  return item;
185 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
static ATOM item
Definition: dde.c:856

Referenced by make_para(), ME_MakeRow(), ME_MakeRun(), ME_MakeText(), and ME_SplitParagraph().

◆ ME_NextRun()

BOOL ME_NextRun ( ME_DisplayItem **  para,
ME_DisplayItem **  run,
BOOL  all_para 
)

Definition at line 71 of file list.c.

72 {
73  ME_DisplayItem *p = (*run)->next;
74  while (p->type != diTextEnd)
75  {
76  if (p->type == diParagraph) {
77  if (!all_para) return FALSE;
78  *para = p;
79  } else if (p->type == diRun) {
80  *run = p;
81  return TRUE;
82  }
83  p = p->next;
84  }
85  return FALSE;
86 }
#define TRUE
Definition: types.h:120
struct tagME_DisplayItem * next
Definition: editstr.h:261
Definition: editstr.h:91
struct define * next
Definition: wpp.c:35
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ME_FindNextURLCandidate(), ME_FindText(), ME_LinkNotify(), and ME_StreamOutRTF().

◆ ME_PrevRun()

BOOL ME_PrevRun ( ME_DisplayItem **  para,
ME_DisplayItem **  run,
BOOL  all_para 
)

Definition at line 93 of file list.c.

94 {
95  ME_DisplayItem *p = (*run)->prev;
96  while (p->type != diTextStart)
97  {
98  if (p->type == diParagraph) {
99  if (!all_para) return FALSE;
100  if (para && p->member.para.prev_para->type == diParagraph)
101  *para = p->member.para.prev_para;
102  } else if (p->type == diRun) {
103  *run = p;
104  return TRUE;
105  }
106  p = p->prev;
107  }
108  return FALSE;
109 }
ME_Paragraph para
Definition: editstr.h:266
#define TRUE
Definition: types.h:120
union tagME_DisplayItem::@503 member
struct tagME_DisplayItem * prev_para
Definition: editstr.h:221
Definition: editstr.h:91
GLfloat GLfloat p
Definition: glext.h:8902
struct tagME_DisplayItem * prev
Definition: editstr.h:261

Referenced by ME_FindText(), ME_InsertOLEFromCursor(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_LinkNotify(), and ME_MoveCursorLines().

◆ 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 }
#define assert(x)
Definition: debug.h:53
struct tagME_DisplayItem * next
Definition: editstr.h:261
struct tagME_DisplayItem * prev
Definition: editstr.h:261

Referenced by ME_InternalDeleteText(), ME_JoinParagraphs(), ME_JoinRuns(), and ME_PrepareParagraphForWrapping().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( richedit_lists  )