Subversion Repositories Kolibri OS

Rev

Rev 7945 | Go to most recent revision | Details | 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
	void draw_found();
12
	int height();
13
	bool edit_key();
14
	bool edit_mouse();
15
	void clear();
16
	int find_next();
17
} search;
18
19
 
20
21
 
22
edit_box search_box = {250, 10, NULL, 0xffffff,
23
0x94AECE, 0xffffff, 0xffffff,0x10000000,sizeof(search_text)-1,#search_text};
24
25
 
26
 
27
{
28
	visible = true;
29
	search_box.flags = ed_focus;
30
	draw_window();
31
}
32
33
 
34
{
35
	visible = false;
36
	draw_window();
37
}
38
39
 
40
{
41
	return visible * SEARCH_H;
42
}
43
44
 
45
{
46
	if (visible) && (search_box.flags & ed_focus) {
47
		EAX = key_editbox;
48
		edit_box_key stdcall(#search_box);
49
		return true;
50
	}
51
	return false;
52
}
53
54
 
55
{
56
	if (visible) {
57
		edit_box_mouse stdcall(#search_box);
58
		if (search_box.flags & ed_focus) return true;
59
	}
60
	return false;
61
}
62
63
 
64
{
65
	char matches[30];
66
	sprintf(#matches, T_MATCHES, found_count);
67
	WriteTextWithBg(search_box.left+search_box.width+14+110,
68
		search_box.top+3, 0xD0, sc.work_text, #matches, sc.work);
69
}
70
71
 
72
{
73
	if (!visible) return false;
74
	DrawBar(0, _y, Form.cwidth, 1, sc.work_graph);
75
	DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work);
76
77
 
78
	search_box.width = math.min(Form.width - 200, 250);
79
80
 
81
82
 
83
84
 
85
		TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT);
86
87
 
88
89
 
90
		TOOLBAR_ICON_HEIGHT+1, _btn_hide);
91
	WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x");
92
	return true;
93
}
94
95
 
96
{
97
	visible = false;
98
	found_text[0] = '\0';
99
	found_count = 0;
100
}
101
102
 
103
{
104
	int i;
105
	if (!search_text[0]) return false;
106
107
 
108
	//highlight(0xFF0000, _bg_color);
109
	found_count = strnum(io.buffer_data, #found_text);
110
	draw_found();
111
112
 
113
		if (strstri(lines.get(i),#search_text)!=-1) return atoi(lines.get(i));
114
	}
115
	return false;
116
}
117