Subversion Repositories Kolibri OS

Rev

Rev 7941 | Rev 7960 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7941 leency 1
 
2
3
 
4
 
5
{
6
	bool visible;
7
	int found_count;
8
	void show();
9
	void hide();
10
	bool draw();
11
	bool edit_key();
12
	bool edit_mouse();
13
	void clear();
14
	int find_next();
15
} search;
16
17
 
18
19
 
20
edit_box search_box = {250, 10, NULL, 0xffffff,
21
0x94AECE, 0xffffff, 0xffffff,0x10000000,sizeof(search_text)-1,#search_text};
22
23
 
24
 
25
{
26
	visible = true;
27
	search_box.flags = ed_focus;
28
	draw_window();
29
}
30
31
 
32
{
33
	visible = false;
34
	draw_window();
35
}
36
37
 
38
{
39
	if (visible) && (search_box.flags & ed_focus) {
40
		EAX = key_editbox;
41
		edit_box_key stdcall(#search_box);
42
		return true;
43
	}
44
	return false;
45
}
46
47
 
48
{
49
	if (visible) {
50
		edit_box_mouse stdcall(#search_box);
51
		if (search_box.flags & ed_focus) return true;
52
	}
53
	return false;
54
}
55
56
 
7945 leency 57
{
7941 leency 58
	char matches[30];
59
	if (!visible) return false;
60
	DrawBar(0, _y, Form.cwidth, 1, sc.work_graph);
61
	DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work);
62
63
 
64
	search_box.width = math.min(Form.width - 200, 250);
65
66
 
67
68
 
69
70
 
71
		TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT);
72
73
 
7945 leency 74
	WriteTextWithBg(search_box.left+search_box.width+14+110,
75
		search_box.top+3, 0xD0, sc.work_text, #matches, sc.work);
76
7941 leency 77
 
78
		TOOLBAR_ICON_HEIGHT+1, _btn_hide);
79
	WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x");
80
	return true;
81
}
82
83
 
84
{
85
	visible = false;
86
	found_text[0] = '\0';
87
	found_count = 0;
88
}
89
90
 
91
{
92
	int i;
93
	if (!search_text[0]) return false;
94
95
 
96
	found_count = strinum(io.buffer_data, #found_text);
7945 leency 97
	draw_window();
98
7941 leency 99
 
100
		if (strstri(lines.get(i),#search_text)) return i;
7945 leency 101
	}
7941 leency 102
	return false;
103
}
104