29 :
ScrollWindow(p->GetScreen(), ax, ay, aw, ah, aid, astyle, p)
34 sprintf_s(buf,
"RichTextBox %d",
id);
44 sprintf_s(buf,
"RichTextBox %d",
id);
82 label_rect.
x = border_size;
83 label_rect.
y = border_size;
84 label_rect.
w -= border_size * 2;
85 label_rect.
h -= border_size * 2;
90 if (line_height < font->
Height())
103 while (text[index] && isspace(text[index]) &&
104 (text[index] !=
'\t') &&
105 (text[index] !=
'\n') &&
106 (text[index] !=
'<'))
115 if (text[index] ==
'\n' || text[index] ==
'\t' || text[index] ==
'<')
119 while (text[index] && isspace(text[index]))
123 while (text[index] && !isspace(text[index]) &&
124 (text[index] !=
'-') &&
125 (text[index] !=
'<'))
129 if (text[index] !=
'-')
141 return 10 + tolower(c) -
'a';
151 if (text[index] ==
'<') {
155 while (text[index] && (text[index] !=
'>'))
156 tag[i++] = text[index++];
158 if (text[index] ==
'>')
159 tag[i++] = text[index++];
165 case 'C':
if (_strnicmp(tag+1,
"color", 5) == 0) {
181 case 'F':
if (_strnicmp(tag+1,
"font", 4) == 0) {
201 for (
int i = 0; i < 10; i++) {
206 return (xpos / 20) * 20 + 20;
216 if (clip_rect.
w < 1 || clip_rect.
h < 1)
226 int curr_word_end = -1;
227 int next_word_end = 0;
241 y_offset = (int) ((1-fraction) * (rich_font->
Height() +
leading));
245 while (block_start < count) {
246 bool found_tag =
false;
251 if (t[block_start] ==
'<') {
252 block_start =
process_tag(t, block_start, rich_font);
256 else if (t[block_start] ==
'\t') {
260 if (x_offset > text_rect.
w) {
271 else if (t[block_start] ==
'\r') {
274 if (t[block_start] ==
'\n')
286 else if (t[block_start] ==
'\n') {
289 if (t[block_start] ==
'\r')
305 if (!next_word_end || next_word_end == curr_word_end) {
309 else if (t[next_word_end] ==
'\n') {
310 eol_index = curr_word_end = next_word_end;
315 int word_len = next_word_end - block_start + 1;
317 length = rich_font->
StringWidth(t+block_start, word_len);
320 if (x_offset + length > text_rect.
w) {
329 curr_word_end = next_word_end;
333 const char* eol = &t[curr_word_end+1];
334 while (*eol && isspace(*eol) && *eol !=
'\n')
343 block_count = curr_word_end - block_start + 1;
345 if (block_count > 0) {
346 length = rich_font->
StringWidth(t+block_start, block_count);
351 block_count = next_word_end - block_start + 1;
352 length = rich_font->
StringWidth(t+block_start, block_count);
353 curr_word_end = next_word_end;
357 int x1 = text_rect.
x + x_offset +
rect.
x;
358 int y1 = text_rect.
y + y_offset +
rect.
y;
360 rich_font->
DrawString(t+block_start, block_count, x1, y1, clip_rect);
371 else if (length < 1 ||
text[next_word_end] ==
'-') {
380 curr_word_end = eol_index;