Rev 8511 | Rev 8913 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8511 | Rev 8584 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | void ParseAndPaint() |
1 | void ParseAndPaint() |
2 | { |
2 | { |
3 | list.count=0; |
- | |
4 | selection.cancel(); |
- | |
5 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); |
- | |
6 | Parse(); |
3 | Parse(); |
7 | DrawPage(); |
4 | DrawPage(); |
8 | } |
5 | } |
Line 9... | Line 6... | ||
9 | 6 | ||
10 | void Parse() |
7 | void Parse() |
11 | { |
8 | { |
12 | dword off; |
9 | dword ptr; |
13 | int line_end; |
10 | int line_end; |
14 | dword line_length=0; |
11 | dword line_length = 0; |
- | 12 | dword line_start = textbuf.p; |
|
- | 13 | ||
- | 14 | list.count=0; |
|
15 | dword line_start = io.buffer_data; |
15 | selection.cancel(); |
Line 16... | Line 16... | ||
16 | dword buflen = strlen(io.buffer_data) + io.buffer_data; |
16 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); |
17 | 17 | ||
Line 18... | Line 18... | ||
18 | lines.drop(); |
18 | lines.drop(); |
19 | lines.add(io.buffer_data); |
19 | lines.add(textbuf.p); |
20 | 20 | ||
21 | for (off = io.buffer_data; off < buflen; off++) |
21 | for (ptr = textbuf.p; ptr < textbuf.p + textbuf.len; ptr++) |
22 | { |
22 | { |
- | 23 | line_length += list.font_w; |
|
- | 24 | if (line_length + 30 >= list.w) || (ESBYTE[ptr] == '\n') |
|
23 | line_length += list.font_w; |
25 | { |
24 | if (line_length + 30 >= list.w) || (ESBYTE[off] == 10) |
26 | //if (ESBYTE[ptr+1] == '\r') ptr++; |
25 | { |
27 | |
26 | //searching a 'white' for a normal word-break |
28 | //searching a 'white' for a normal word-break |
27 | for(line_end = off; line_end != line_start; line_end--) |
29 | for(line_end = ptr; line_end != line_start; line_end--) |
28 | { |
30 | { |
29 | if (__isWhite(ESBYTE[line_end])) { off=line_end+1; break; } |
31 | if (__isWhite(ESBYTE[line_end])) { ptr=line_end+1; break; } |
30 | } |
32 | } |
31 | line_length = off - line_start * list.font_w; |
33 | line_length = ptr - line_start * list.font_w; |
32 | list.count++; |
34 | list.count++; |
33 | lines.add(off); |
35 | lines.add(ptr); |
34 | line_start = off; |
36 | line_start = ptr; |
35 | line_length = 0; |
37 | line_length = 0; |
36 | } |
38 | } |
37 | } |
39 | } |
Line -... | Line 40... | ||
- | 40 | lines.add(ptr); |
|
- | 41 | list.count++; |
|
- | 42 | } |
|
- | 43 | ||
- | 44 | void DrawPage() |
|
- | 45 | { |
|
- | 46 | char t[64]; |
|
- | 47 | scroll.max_area = list.count; |
|
- | 48 | scroll.cur_area = list.visible; |
|
- | 49 | scroll.position = list.first; |
|
- | 50 | scroll.all_redraw = 0; |
|
- | 51 | scroll.start_x = list.x + list.w; |
|
- | 52 | scroll.start_y = list.y; |
|
- | 53 | scroll.size_y = list.h; |
|
- | 54 | ||
- | 55 | if (list.count <= list.visible) { |
|
- | 56 | DrawBar(scroll.start_x, scroll.start_y, scroll.size_x, |
|
- | 57 | scroll.size_y, theme.bg); |
|
- | 58 | } else { |
|
- | 59 | scrollbar_v_draw(#scroll); |
|
- | 60 | } |
|
- | 61 | DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, |
|
- | 62 | scroll.size_y-1, scroll.bckg_col); |
|
- | 63 | ||
- | 64 | PaintVisible(); |
|
- | 65 | ||
38 | lines.add(buflen); |
66 | sprintf(#t, #chars_selected, math.abs(selection.end_offset - selection.start_offset)); |
39 | list.count++; |
67 | if (selection.is_active()) DrawStatusBar(#t); else DrawStatusBar(" "); |
40 | } |
68 | } |
41 | 69 | ||
42 | void PaintVisible() |
70 | void PaintVisible() |