Rev 7945 | Rev 7975 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7945 | Rev 7960 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | struct SEARCH |
4 | struct SEARCH |
5 | { |
5 | { |
6 | bool visible; |
6 | bool visible; |
7 | int found_count; |
7 | int found_count; |
- | 8 | collection_int found; |
|
8 | void show(); |
9 | void show(); |
9 | void hide(); |
10 | void hide(); |
10 | bool draw(); |
11 | bool draw(); |
11 | bool edit_key(); |
12 | bool edit_key(); |
12 | bool edit_mouse(); |
13 | bool edit_mouse(); |
13 | void clear(); |
14 | int find_all(); |
14 | int find_next(); |
15 | int find_next(); |
15 | } search; |
16 | } search; |
Line 16... | Line 17... | ||
16 | 17 | ||
Line 69... | Line 70... | ||
69 | 70 | ||
Line 70... | Line 71... | ||
70 | DrawCaptButton(search_box.left+search_box.width+14, search_box.top-1, 90, |
71 | DrawCaptButton(search_box.left+search_box.width+14, search_box.top-1, 90, |
71 | TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT); |
72 | TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT); |
Line 72... | Line 73... | ||
72 | 73 | ||
73 | sprintf(#matches, T_MATCHES, found_count); |
74 | sprintf(#matches, T_MATCHES, found.count); |
74 | WriteTextWithBg(search_box.left+search_box.width+14+110, |
75 | WriteTextWithBg(search_box.left+search_box.width+14+110, |
Line 75... | Line 76... | ||
75 | search_box.top+3, 0xD0, sc.work_text, #matches, sc.work); |
76 | search_box.top+3, 0xD0, sc.work_text, #matches, sc.work); |
76 | 77 | ||
77 | DefineHiddenButton(Form.cwidth-26, search_box.top-1, TOOLBAR_ICON_HEIGHT+1, |
78 | DefineHiddenButton(Form.cwidth-26, search_box.top-1, TOOLBAR_ICON_HEIGHT+1, |
78 | TOOLBAR_ICON_HEIGHT+1, _btn_hide); |
79 | TOOLBAR_ICON_HEIGHT+1, _btn_hide); |
79 | WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x"); |
80 | WriteText(Form.cwidth-26+7, search_box.top+2, 0x81, sc.work_graph, "x"); |
Line 80... | Line 81... | ||
80 | return true; |
81 | return true; |
81 | } |
82 | } |
82 | 83 | ||
83 | void SEARCH::clear() |
84 | int SEARCH::find_all() |
84 | { |
85 | { |
- | 86 | dword haystack = io.buffer_data; |
|
- | 87 | int needle_len = strlen(#found_text); |
|
- | 88 | found.drop(); |
|
- | 89 | loop() { |
|
- | 90 | if (! haystack = strstri(haystack, #found_text)) break; |
|
85 | visible = false; |
91 | found.add(haystack - needle_len); |
Line 86... | Line 92... | ||
86 | found_text[0] = '\0'; |
92 | haystack += needle_len; |
87 | found_count = 0; |
93 | } |
88 | } |
94 | } |
89 | 95 | ||
Line -... | Line 96... | ||
- | 96 | int SEARCH::find_next(int _cur_pos) |
|
90 | int SEARCH::find_next(int _cur_pos) |
97 | { |
91 | { |
98 | int i; |
- | 99 | if (!search_text[0]) return false; |
|
92 | int i; |
100 | |
Line 93... | Line 101... | ||
93 | if (!search_text[0]) return false; |
101 | if (!streq(#found_text, #search_text)) { |
94 | 102 | strcpy(#found_text, #search_text); |
|
95 | strcpy(#found_text, #search_text); |
103 | find_all(); |
96 | found_count = strinum(io.buffer_data, #found_text); |
104 | } |
97 | draw_window(); |
105 | draw_window(); |