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