Rev 7924 | Rev 7945 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7924 | Rev 7941 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | int curcol_scheme; |
55 | int curcol_scheme; |
56 | int font_size; |
56 | int font_size; |
Line 57... | Line 57... | ||
57 | 57 | ||
Line 58... | Line 58... | ||
58 | #include "data.h" |
58 | #include "data.h" |
59 | 59 | ||
60 | #include "../txtread/search.h" |
60 | #include "search.h" |
Line 61... | Line 61... | ||
61 | #include "selection.h" |
61 | #include "selection.h" |
62 | #include "prepare_page.h" |
62 | #include "prepare_page.h" |
Line 70... | Line 70... | ||
70 | scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee, |
70 | scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee, |
71 | 0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
71 | 0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
Line 72... | Line 72... | ||
72 | 72 | ||
Line 73... | Line -... | ||
73 | char title[4196]; |
- | |
74 | - | ||
75 | bool help_opened = false; |
73 | char title[4196]; |
76 | 74 | ||
77 | int reopenin_mx, |
75 | int reopenin_mx, |
78 | theme_mx, |
76 | theme_mx, |
Line 195... | Line 193... | ||
195 | } |
193 | } |
196 | } |
194 | } |
Line 197... | Line 195... | ||
197 | 195 | ||
198 | void HandleKeyEvent() |
196 | void HandleKeyEvent() |
199 | { |
197 | { |
- | 198 | GetKeys(); |
|
200 | int new_y; |
199 | |
- | 200 | switch (key_scancode) |
|
- | 201 | { |
|
201 | if (help_opened) { |
202 | case SCAN_CODE_F1: |
- | 203 | EventShowInfo(); |
|
- | 204 | return; |
|
202 | help_opened = false; |
205 | case SCAN_CODE_ESC: |
- | 206 | search.hide(); |
|
- | 207 | return; |
|
- | 208 | case SCAN_CODE_ENTER: |
|
- | 209 | if (! search_box.flags & ed_focus) return; |
|
- | 210 | case SCAN_CODE_F3: |
|
203 | DrawPage(); |
211 | EventSearchNext(); |
204 | return; |
212 | return; |
- | 213 | } |
|
205 | } |
214 | |
Line 206... | Line 215... | ||
206 | GetKeys(); |
215 | if (search.edit_key()) return; |
207 | 216 | ||
208 | if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) { |
217 | if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) { |
209 | if (key.press(ECTRL + key_scancode)) return; |
218 | if (key.press(ECTRL + key_scancode)) return; |
- | 219 | switch (key_scancode) |
|
- | 220 | { |
|
- | 221 | case SCAN_CODE_KEY_A: |
|
- | 222 | selection.select_all(); |
|
210 | switch (key_scancode) |
223 | DrawPage(); |
211 | { |
224 | return; |
212 | case SCAN_CODE_KEY_X: |
225 | case SCAN_CODE_KEY_X: |
213 | EventCut(); |
226 | EventCut(); |
214 | return; |
227 | return; |
Line 228... | Line 241... | ||
228 | EventShowCharsetsList(); |
241 | EventShowCharsetsList(); |
229 | return; |
242 | return; |
230 | case SCAN_CODE_KEY_F: |
243 | case SCAN_CODE_KEY_F: |
231 | search.show(); |
244 | search.show(); |
232 | return; |
245 | return; |
233 | case SCAN_CODE_KEY_A: |
- | |
234 | selection.select_all(); |
- | |
235 | DrawPage(); |
- | |
236 | return; |
- | |
237 | } |
246 | } |
238 | } |
247 | } |
239 | switch (key_scancode) |
- | |
240 | { |
248 | |
241 | case SCAN_CODE_F1: |
- | |
242 | EventShowInfo(); |
- | |
243 | return; |
- | |
244 | case SCAN_CODE_ESC: |
- | |
245 | search.hide(); |
- | |
246 | return; |
- | |
247 | case SCAN_CODE_ENTER: |
- | |
248 | if (! search_box.flags & ed_focus) return; |
249 | if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) { |
249 | case SCAN_CODE_F3: |
- | |
250 | EventSearchNext(); |
250 | selection.set_start(); |
251 | return; |
- | |
252 | } |
- | |
253 | if (search.edit_key()) { |
- | |
254 | return; |
- | |
255 | } else { |
251 | } else { |
256 | if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_start(); |
- | |
257 | else selection.cancel(); |
252 | selection.cancel(); |
- | 253 | } |
|
- | 254 | ||
258 | if (list.ProcessKey(key_scancode)) { |
255 | if (list.ProcessKey(key_scancode)) { |
259 | if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_end(); |
256 | if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_end(); |
260 | DrawPage(); |
257 | DrawPage(); |
261 | } |
258 | } |
262 | return; |
- | |
263 | } |
- | |
264 | //EventInsertCharIntoText(); |
259 | //EventInsertCharIntoText(); |
265 | } |
260 | } |
Line 266... | Line 261... | ||
266 | 261 | ||
267 | void HandleMouseEvent() |
262 | void HandleMouseEvent() |
Line 282... | Line 277... | ||
282 | if (mouse.up) selection.set_end(); |
277 | if (mouse.up) selection.set_end(); |
283 | DrawPage(); |
278 | DrawPage(); |
284 | return; |
279 | return; |
285 | } |
280 | } |
Line -... | Line 281... | ||
- | 281 | ||
- | 282 | //as we have lines of variable width, we need to recalculate column_max |
|
- | 283 | list.column_max = lines.len(mouse.y - list.y / list.item_h + list.first); |
|
286 | 284 | ||
- | 285 | list.ProcessMouse(mouse.x, mouse.y); |
|
287 | list.ProcessMouse(mouse.x, mouse.y); |
286 | |
288 | if (mouse.down) { |
287 | if (mouse.down) { |
289 | selection.cancel(); |
288 | selection.cancel(); |
290 | selection.set_start(); |
289 | selection.set_start(); |
291 | } |
290 | } |
Line 311... | Line 310... | ||
311 | // // |
310 | // // |
312 | //===================================================// |
311 | //===================================================// |
Line 313... | Line 312... | ||
313 | 312 | ||
314 | bool EventSearchNext() |
313 | bool EventSearchNext() |
315 | { |
314 | { |
316 | int new_y = search.find_next(list.first, theme.bg); |
315 | int new_y = search.find_next(list.first); |
317 | if (new_y) { |
316 | if (new_y) { |
318 | list.first = new_y / list.item_h; |
317 | list.first = new_y / list.item_h; |
319 | list.CheckDoesValuesOkey(); |
318 | list.CheckDoesValuesOkey(); |
320 | DrawPage(); |
319 | DrawPage(); |