Go to most recent revision | 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 | strcpy(#param, "Matches: "); |
||
71 | strcat(#param, itoa(found_count)); |
||
72 | strcat(#param, " "); |
||
73 | WriteTextWithBg(search_box.left+search_box.width+14+110, search_box.top+3, 0xD0, sc.work_text, #param, sc.work); |
||
74 | } |
||
75 | |||
76 | |||
77 | { |
||
78 | if (!visible) return false; |
||
79 | DrawBar(0,Form.cheight - SEARCH_H, Form.cwidth, 1, sc.work_graph); |
||
80 | DrawBar(0,Form.cheight - SEARCH_H+1, Form.cwidth, SEARCH_H-1, sc.work); |
||
81 | |||
82 | |||
83 | search_box.width = math.min(Form.width - 200, 250); |
||
84 | |||
85 | |||
86 | |||
87 | |||
88 | |||
89 | |||
90 | TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, "Find next"); |
||
91 | |||
92 | |||
93 | |||
94 | |||
95 | TOOLBAR_ICON_HEIGHT+1, _btn_hide); |
||
96 | WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x"); |
||
97 | return true; |
||
98 | } |
||
99 | |||
100 | |||
101 | { |
||
102 | pos.drop(); |
||
103 | lines.drop(); |
||
104 | visible = false; |
||
105 | found_text[0] = '\0'; |
||
106 | found_count = 0; |
||
107 | } |
||
108 | |||
109 | |||
110 | { |
||
111 | pos.add(itoa(_pos)); |
||
112 | lines.add(_line); |
||
113 | } |
||
114 | |||
115 | |||
116 | { |
||
117 | int i; |
||
118 | if (!search_text[0]) return false; |
||
119 | |||
120 | |||
121 | highlight(0xFF0000, _bg_color); |
||
122 | draw_found(); |
||
123 | |||
124 | |||
125 | if (strstri(lines.get(i),#search_text)!=-1) return atoi(pos.get(i)); |
||
126 | } |
||
127 | return false; |
||
128 | } |
||
129 | |||
130 | |||
131 | { |
||
132 | int i; |
||
133 | dword col; |
||
134 | found_count = 0; |
||
135 | for (i=0; i |
||
136 | if (strstri(lines.get(i),#search_text)==-1) { |
||
137 | col=_bg_color; |
||
138 | } else { |
||
139 | col=_color; |
||
140 | found_count++; |
||
141 | } |
||
142 | draw_bar(0, atoi(pos.get(i)), 3, list.item_h, col); |
||
143 | } |
||
144 | } |
||
145 | |||
146 | |||
147 | { |
||
148 | int i; |
||
149 | for (i = _y*list.w+_x*KFONT_BPP+kfont.raw ; i<_y*list.w+_x+_w*KFONT_BPP+kfont.raw ; i+=KFONT_BPP) |
||
150 | { |
||
151 | ESDWORD[i] = _color; |
||
152 | } |
||
153 | if (_h>0) draw_bar(dword _x, _y+1, _w, _h-1, _color); |
||
154 | } |
||
155 |