Rev 8913 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8913 | Rev 9597 | ||
---|---|---|---|
1 | void ParseAndPaint() |
1 | void ParseAndPaint() |
2 | { |
2 | { |
3 | Parse(); |
3 | Parse(); |
4 | DrawPage(); |
4 | DrawPage(); |
5 | } |
5 | } |
6 | 6 | ||
7 | void Parse() |
7 | void Parse() |
8 | { |
8 | { |
9 | dword ptr; |
9 | dword ptr; |
10 | int line_end; |
10 | int line_end; |
11 | 11 | ||
12 | list.count=0; |
12 | list.count=0; |
13 | selection.cancel(); |
13 | selection.cancel(); |
14 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); |
14 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.h); |
15 | 15 | ||
16 | lines.drop(); |
16 | lines.drop(); |
17 | lines.add(textbuf.p); |
17 | lines.add(textbuf.p); |
18 | 18 | ||
19 | for (ptr = textbuf.p; ptr < textbuf.p + textbuf.len; ptr++) |
19 | for (ptr = textbuf.p; ptr < textbuf.p + textbuf.len; ptr++) |
20 | { |
20 | { |
21 | if (ptr - lines.get_last() * list.font_w + 16 >= list.w) |
21 | if (ptr - lines.get_last() * list.font_w + 16 >= list.w) |
22 | { |
22 | { |
23 | //searching a 'white' for a normal word-break |
23 | //searching a 'white' for a normal word-break |
24 | for(line_end = ptr; line_end != lines.get_last(); line_end--) { |
24 | for(line_end = ptr; line_end != lines.get_last(); line_end--) { |
25 | if (__isWhite(ESBYTE[line_end])) { |
25 | if (__isWhite(ESBYTE[line_end])) { |
26 | ptr = line_end + 1; |
26 | ptr = line_end + 1; |
27 | break; |
27 | break; |
28 | } |
28 | } |
29 | } |
29 | } |
30 | list.count++; |
30 | list.count++; |
31 | lines.add(ptr); |
31 | lines.add(ptr); |
32 | } else if (ESBYTE[ptr] == '\x0D') { |
32 | } else if (ESBYTE[ptr] == '\x0D') { |
33 | if (ESBYTE[ptr+1] == '\x0A') ptr++; |
33 | if (ESBYTE[ptr+1] == '\x0A') ptr++; |
34 | list.count++; |
34 | list.count++; |
35 | lines.add(ptr+1); |
35 | lines.add(ptr+1); |
36 | } else if (ESBYTE[ptr] == '\x0A') { |
36 | } else if (ESBYTE[ptr] == '\x0A') { |
37 | list.count++; |
37 | list.count++; |
38 | lines.add(ptr+1); |
38 | lines.add(ptr+1); |
39 | } |
39 | } |
40 | } |
40 | } |
41 | lines.add(ptr); |
41 | lines.add(ptr); |
42 | list.count++; |
42 | list.count++; |
43 | } |
43 | } |
44 | 44 | ||
45 | void DrawPage() |
45 | void DrawPage() |
46 | { |
46 | { |
47 | char t[64]; |
47 | char t[64]; |
48 | scroll.max_area = list.count; |
48 | scroll.max_area = list.count; |
49 | scroll.cur_area = list.visible; |
49 | scroll.cur_area = list.visible; |
50 | scroll.position = list.first; |
50 | scroll.position = list.first; |
51 | scroll.all_redraw = 0; |
51 | scroll.all_redraw = 0; |
52 | scroll.start_x = list.x + list.w; |
52 | scroll.start_x = list.x + list.w; |
53 | scroll.start_y = list.y; |
53 | scroll.start_y = list.y; |
54 | scroll.size_y = list.h; |
54 | scroll.size_y = list.h; |
55 | 55 | ||
56 | if (list.count <= list.visible) { |
56 | if (list.count <= list.visible) { |
57 | DrawBar(scroll.start_x, scroll.start_y, scroll.size_x, |
57 | DrawBar(scroll.start_x, scroll.start_y, scroll.size_x, |
58 | scroll.size_y, theme.bg); |
58 | scroll.size_y, theme.bg); |
59 | } else { |
59 | } else { |
60 | scrollbar_v_draw(#scroll); |
60 | scrollbar_v_draw(#scroll); |
61 | } |
61 | } |
62 | DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, |
62 | DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, |
63 | scroll.size_y-1, scroll.bckg_col); |
63 | scroll.size_y-1, scroll.bckg_col); |
64 | 64 | ||
65 | PaintVisible(); |
65 | PaintVisible(); |
66 | 66 | ||
67 | sprintf(#t, #chars_selected, math.abs(selection.end_offset - selection.start_offset)); |
67 | sprintf(#t, #chars_selected, math.abs(selection.end_offset - selection.start_offset)); |
68 | if (selection.is_active()) DrawStatusBar(#t); else DrawStatusBar(" "); |
68 | if (selection.is_active()) DrawStatusBar(#t); else DrawStatusBar(" "); |
69 | } |
69 | } |
70 | 70 | ||
71 | void PaintVisible() |
71 | void PaintVisible() |
72 | { |
72 | { |
73 | int i, ff; |
73 | int i, ff; |
74 | signed s1, s2; |
74 | signed s1, s2; |
75 | dword ydraw, absolute_y; |
75 | dword ydraw, absolute_y; |
76 | dword line_bg; |
76 | dword line_bg; |
77 | bool swapped_selection = false; |
77 | bool swapped_selection = false; |
78 | 78 | ||
79 | list.column_max = lines.len(list.cur_y); |
79 | list.column_max = lines.len(list.cur_y); |
80 | list.CheckDoesValuesOkey(); |
80 | list.CheckDoesValuesOkey(); |
81 | if (selection.end_offset < selection.start_offset) { |
81 | if (selection.end_offset < selection.start_offset) { |
82 | swapped_selection = selection.swap_start_end(); |
82 | swapped_selection = selection.swap_start_end(); |
83 | } |
83 | } |
84 | 84 | ||
85 | for ( i=0; i < list.visible+1; i++) |
85 | for ( i=0; i < list.visible+1; i++) |
86 | { |
86 | { |
87 | ydraw = i * list.item_h; |
87 | ydraw = i * list.item_h; |
88 | absolute_y = i + list.first; |
88 | absolute_y = i + list.first; |
89 | line_bg = theme.bg; |
89 | line_bg = theme.bg; |
90 | 90 | ||
91 | if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color; |
91 | if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color; |
92 | canvas.DrawBar(0, ydraw, list.w, list.item_h, line_bg); |
92 | canvas.DrawBar(0, ydraw, list.w, list.item_h, line_bg); |
93 | 93 | ||
94 | selection.draw(absolute_y); |
94 | selection.draw(absolute_y); |
95 | 95 | ||
96 | if (search.visible) || (search_next) for (ff=0; ff |
96 | if (search.visible) || (search_next) for (ff=0; ff |
97 | s1 = search.found.get(ff) - lines.get(absolute_y); |
97 | s1 = search.found.get(ff) - lines.get(absolute_y); |
98 | s2 = search.found.get(ff) - lines.get(absolute_y+1); |
98 | s2 = search.found.get(ff) - lines.get(absolute_y+1); |
99 | 99 | ||
100 | if (s2 > 0) break; |
100 | if (s2 > 0) break; |
101 | 101 | ||
102 | if (s1 > 0) && (s2 < 0) { |
102 | if (s1 > 0) && (s2 < 0) { |
103 | canvas.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3, |
103 | canvas.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3, |
104 | ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found); |
104 | ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found); |
105 | search_next = false; |
105 | search_next = false; |
106 | } |
106 | } |
107 | } |
107 | } |
108 | 108 | ||
109 | if (absolute_y |
109 | if (absolute_y |
110 | lines.get(absolute_y), lines.len(absolute_y)); |
110 | lines.get(absolute_y), lines.len(absolute_y)); |
111 | } |
111 | } |
112 | 112 | ||
113 | PutPaletteImage(buf_data+8, canvas.bufw, list.h, list.x, list.y, 32, 0); |
113 | PutPaletteImage(buf_data+8, canvas.bufw, list.h, list.x, list.y, 32, 0); |
114 | 114 | ||
115 | if (swapped_selection) selection.swap_start_end(); |
115 | if (swapped_selection) selection.swap_start_end(); |
116 | }>>>>=>> |
116 | }>>>>=>> |