Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7818 leency 1
 
2
3
 
4
5
 
6
 
7
{
8
	bool visible;
9
	int found_count;
10
	collection lines;
11
	collection pos;
12
	void show();
13
	void hide();
14
	bool draw();
15
	void draw_found();
16
	int height();
17
	bool edit_key();
18
	bool edit_mouse();
19
	void add();
20
	void clear();
21
	int find_next();
22
	int highlight();
23
} search;
24
25
 
26
char found_text[64];
27
edit_box search_box = {250, 10, NULL, 0xffffff,
28
0x94AECE, 0xffffff, 0xffffff,0x10000000,sizeof(search_text)-1,#search_text};
29
30
 
31
 
32
{
33
	visible = true;
34
	search_box.flags = ed_focus;
35
	draw_window();
36
}
37
38
 
39
{
40
	visible = false;
41
	draw_window();
42
}
43
44
 
45
{
46
	return visible * SEARCH_H;
47
}
48
49
 
50
{
51
	if (visible) && (search_box.flags & ed_focus) {
52
		EAX = key_editbox;
53
		edit_box_key stdcall(#search_box);
54
		return true;
55
	}
56
	return false;
57
}
58
59
 
60
{
61
	if (visible) {
62
		edit_box_mouse stdcall(#search_box);
63
		if (search_box.flags & ed_focus) return true;
64
	}
65
	return false;
66
}
67
68
 
69
{
70
	char matches[30];
7872 leency 71
	strcpy(#matches, "Matches: ");
72
	strcat(#matches, itoa(found_count));
73
	strcat(#matches, "   ");
74
	WriteTextWithBg(search_box.left+search_box.width+14+110, search_box.top+3, 0xD0, sc.work_text, #matches, sc.work);
75
}
7818 leency 76
77
 
7872 leency 78
{
7818 leency 79
	if (!visible) return false;
80
	DrawBar(0, _y, Form.cwidth, 1, sc.work_graph);
7872 leency 81
	DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work);
82
7818 leency 83
 
7872 leency 84
	search_box.width = math.min(Form.width - 200, 250);
7818 leency 85
86
 
87
88
 
89
90
 
91
		TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, "Find next");
92
93
 
94
95
 
96
		TOOLBAR_ICON_HEIGHT+1, _btn_hide);
97
	WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x");
98
	return true;
99
}
100
101
 
102
{
103
	pos.drop();
104
	lines.drop();
105
	visible = false;
106
	found_text[0] = '\0';
107
	found_count = 0;
108
}
109
110
 
111
{
112
	pos.add(itoa(_pos));
113
	lines.add(_line);
114
}
115
116
 
117
{
118
	int i;
119
	if (!search_text[0]) return false;
120
121
 
122
		highlight(0xFF0000, _bg_color);
123
		draw_found();
124
125
 
126
		if (strstri(lines.get(i),#search_text)!=-1) return atoi(pos.get(i));
127
	}
128
	return false;
129
}
130
131
 
132
{
133
	int i;
134
	dword col;
135
	found_count = 0;
136
	for (i=0; i
137
		if (strstri(lines.get(i),#search_text)==-1) {
138
			col=_bg_color;
139
		} else {
140
			col=_color;
141
			found_count++;
142
		}
143
		//draw_bar(0, atoi(pos.get(i)), 3, list.item_h, col);
7895 leency 144
	}
7818 leency 145
}
146
147
 
7872 leency 148
{
7818 leency 149
	int i;
150
	for (i = _y*list.w+_x*4+kfont.raw ; i<_y*list.w+_x+_w*4+kfont.raw ; i+=4)
7872 leency 151
	{
7818 leency 152
		ESDWORD[i] = _color;
153
	}
154
	if (_h>0) draw_bar(dword _x, _y+1, _w, _h-1, _color);
155
}
156