ReactOS 0.4.16-dev-937-g7afcd2a
row.c File Reference
#include "editor.h"
Include dependency graph for row.c:

Go to the source code of this file.

Functions

ME_Rowrow_next (ME_Row *row)
 
ME_Rowrow_next_all_paras (ME_Row *row)
 
ME_Rowrow_prev_all_paras (ME_Row *row)
 
ME_Runrow_first_run (ME_Row *row)
 
ME_Runrow_next_run (ME_Row *row, ME_Run *run)
 
ME_Rowrow_from_cursor (ME_Cursor *cursor)
 
void row_first_cursor (ME_Row *row, ME_Cursor *cursor)
 
void row_end_cursor (ME_Row *row, ME_Cursor *cursor, BOOL include_eop)
 
ME_Paragraphrow_para (ME_Row *row)
 
ME_Rowrow_from_row_number (ME_TextEditor *editor, int row_num)
 
int row_number_from_char_ofs (ME_TextEditor *editor, int ofs)
 

Function Documentation

◆ 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}
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
ME_DisplayItem * ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:66
static ME_DisplayItem * row_get_di(ME_Row *row)
Definition: editor.h:126
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:89
@ diStartRow
Definition: editstr.h:87
@ diRun
Definition: editstr.h:86
@ diStartRowOrParagraphOrEnd
Definition: editstr.h:92
const char cursor[]
Definition: icontest.c:13
static ATOM item
Definition: dde.c:856
union tagME_DisplayItem::@558 member

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}
#define assert(x)
Definition: debug.h:53
@ diRunOrStartRow
Definition: editstr.h:94

Referenced by row_cursor().

◆ row_from_cursor()

ME_Row * row_from_cursor ( ME_Cursor cursor)

Definition at line 74 of file row.c.

75{
77
79 return &item->member.row;
80}
static ME_DisplayItem * run_get_di(ME_Run *run)
Definition: editor.h:163

Referenced by cursor_coords(), cursor_move_line(), draw_run(), editor_ensure_visible(), editor_handle_message(), ME_ArrowEnd(), ME_ArrowHome(), ME_ArrowPageDown(), ME_ArrowPageUp(), ME_ExtendAnchorSelection(), and ME_SelectByType().

◆ 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}
#define NULL
Definition: types.h:112
ME_Paragraph * editor_first_para(ME_TextEditor *editor)
Definition: editor.c:279
ME_Row * para_first_row(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:132
ME_Paragraph * para_next(ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: para.c:57
GLuint GLuint GLsizei count
Definition: gl.h:1545
ME_Row * row_next(ME_Row *row)
Definition: row.c:27

Referenced by editor_handle_message().

◆ 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}
#define TRUE
Definition: types.h:120
int ME_GetCursorOfs(const ME_Cursor *cursor)
Definition: caret.c:889
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().