Subversion Repositories Kolibri OS

Rev

Rev 7935 | Rev 8439 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7935 Rev 7960
1
void ParseAndPaint()
1
void ParseAndPaint()
2
{
2
{
3
	//search.clear();
3
	list.count=0;
4
	list.count=0;
-
 
5
	selection.cancel();
4
	selection.cancel();
6
 
5
 
7
	Parse();
6
	Parse();
8
 
7
 
9
	list.visible = list.h / list.item_h;
8
	list.visible = list.h / list.item_h;
10
	DrawBuf.Init(list.x, list.y, list.w, list.visible+1*list.item_h);
9
	DrawBuf.Init(list.x, list.y, list.w, list.visible+1*list.item_h);
11
	DrawPage();	
10
	DrawPage();	
12
}
11
}
13
 
12
 
14
void Parse()
13
void Parse()
15
{
14
{
16
dword off;
15
dword off;
17
int line_end;
16
int line_end;
18
dword line_length=0;
17
dword line_length=0;
19
dword line_start = io.buffer_data;
18
dword line_start = io.buffer_data;
20
dword buflen = strlen(io.buffer_data) + io.buffer_data;
19
dword buflen = strlen(io.buffer_data) + io.buffer_data;
21
 
20
 
22
	lines.drop();
21
	lines.drop();
23
	lines.add(io.buffer_data);
22
	lines.add(io.buffer_data);
24
 
23
 
25
	for (off = io.buffer_data; off < buflen; off++)
24
	for (off = io.buffer_data; off < buflen; off++)
26
	{
25
	{
27
		line_length += list.font_w;
26
		line_length += list.font_w;
28
		if (line_length + 30 >= list.w) || (ESBYTE[off] == 10)
27
		if (line_length + 30 >= list.w) || (ESBYTE[off] == 10)
29
		{
28
		{
30
			//searching a 'white' for a normal word-break
29
			//searching a 'white' for a normal word-break
31
			for(line_end = off; line_end != line_start; line_end--) 
30
			for(line_end = off; line_end != line_start; line_end--) 
32
			{
31
			{
33
				if (__isWhite(ESBYTE[line_end])) { off=line_end+1; break; }
32
				if (__isWhite(ESBYTE[line_end])) { off=line_end+1; break; }
34
			}
33
			}
35
			line_length = off - line_start * list.font_w;
34
			line_length = off - line_start * list.font_w;
36
			list.count++;
35
			list.count++;
37
			lines.add(off);
36
			lines.add(off);
38
			line_start = off;
37
			line_start = off;
39
			line_length = 0;
38
			line_length = 0;
40
		}
39
		}
41
	}
40
	}
42
	lines.add(buflen);
41
	lines.add(buflen);
43
	list.count++;
42
	list.count++;
44
}
43
}
45
 
44
 
46
void PaintVisible()
45
void PaintVisible()
47
{
46
{
48
	int i;
47
	int i, ff;
49
	dword ydraw, absolute_y;
48
	signed s1, s2;
-
 
49
	dword ydraw, absolute_y;
50
	dword line_bg;
50
	dword line_bg;
51
	bool swapped_selection = false;
51
	bool swapped_selection = false;
52
 
52
 
53
	list.column_max = lines.len(list.cur_y);
53
	list.column_max = lines.len(list.cur_y);
54
	list.CheckDoesValuesOkey();
54
	list.CheckDoesValuesOkey();
55
	if (selection.end_offset < selection.start_offset) {
55
	if (selection.end_offset < selection.start_offset) {
56
		swapped_selection = selection.swap_start_end();
56
		swapped_selection = selection.swap_start_end();
57
	}
57
	}
58
 
58
 
59
	for ( i=0; i < list.visible+1; i++)
59
	for ( i=0; i < list.visible+1; i++)
60
	{
60
	{
61
		ydraw = i * list.item_h;
61
		ydraw = i * list.item_h;
62
		absolute_y = i + list.first;
62
		absolute_y = i + list.first;
63
		line_bg = theme.bg;
63
		line_bg = theme.bg;
64
 
64
 
65
		if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color;
65
		if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color;
66
		DrawBuf.DrawBar(0, ydraw, list.w, list.item_h, line_bg);
66
		DrawBuf.DrawBar(0, ydraw, list.w, list.item_h, line_bg);
67
 
67
 
68
		selection.draw(absolute_y);
68
		selection.draw(absolute_y);
69
 
69
 
-
 
70
		if (search.visible) for (ff=0; ff
-
 
71
			s1 = search.found.get(ff) - lines.get(absolute_y);
-
 
72
			s2 = search.found.get(ff) - lines.get(absolute_y+1);
-
 
73
 
-
 
74
			if (s2 > 0) break;
-
 
75
 
-
 
76
			if (s1 > 0) && (s2 < 0) {
-
 
77
				DrawBuf.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3,
-
 
78
					ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found);
-
 
79
			}
-
 
80
		}
-
 
81
 
70
		if (absolute_y
82
		if (absolute_y
71
			lines.get(absolute_y), lines.len(absolute_y));
83
			lines.get(absolute_y), lines.len(absolute_y));
72
	}
84
	}
73
 
85
 
74
	PutPaletteImage(buf_data+8, DrawBuf.bufw, list.h, list.x, list.y, 32, 0);
86
	PutPaletteImage(buf_data+8, DrawBuf.bufw, list.h, list.x, list.y, 32, 0);
75
 
87
 
76
	if (swapped_selection) selection.swap_start_end();
88
	if (swapped_selection) selection.swap_start_end();
77
}
89
}
78
90
79
-