Rev 824 | Rev 987 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
824 | mikedld | 1 | diff16 'tp-key.asm',0,$ |
2 | |||
178 | heavyiron | 3 | key: |
4 | mov ecx,1 |
||
5 | mcall 66,3 |
||
826 | mikedld | 6 | mov [shi],eax |
178 | heavyiron | 7 | xor ebx,ebx |
8 | test al,0x03 |
||
9 | jz @f |
||
10 | or ebx,KM_SHIFT |
||
11 | @@: test al,0x0C |
||
12 | jz @f |
||
13 | or ebx,KM_CTRL |
||
14 | @@: test al,0x30 |
||
15 | jz @f |
||
16 | or ebx,KM_ALT |
||
826 | mikedld | 17 | @@: mov edx,ebx |
178 | heavyiron | 18 | test al,0x03 |
19 | jz @f |
||
20 | inc cl |
||
826 | mikedld | 21 | @@: |
178 | heavyiron | 22 | mcall 2 |
23 | cmp al,0 |
||
24 | jne still.skip_write |
||
25 | shr eax,8 |
||
26 | cmp al,224 |
||
27 | jne @f |
||
28 | mov [ext],0x01 |
||
29 | jmp still.skip_write |
||
30 | @@: cmp al,225 |
||
31 | jne @f |
||
32 | mov [ext],0x02 |
||
33 | jmp still.skip_write |
||
34 | @@: |
||
35 | mov ah,[ext] |
||
36 | mov [ext],0 |
||
37 | |||
826 | mikedld | 38 | mov esi,numpad_table_off |
39 | test [shi], 0x00000080 ; NumLock is on? |
||
40 | jz .num |
||
41 | mov esi,numpad_table_on |
||
42 | .num: cmp eax,[esi] |
||
43 | jne @f |
||
44 | mov eax,[esi+4] |
||
45 | mov ebx,eax |
||
46 | or eax,edx |
||
47 | shr ebx,8 |
||
48 | or ebx,0x0000FFFF |
||
49 | and eax,ebx |
||
50 | mov ecx,eax |
||
51 | shr ecx,16 |
||
52 | and cl,1 |
||
53 | inc cl |
||
54 | jmp .lp0 |
||
55 | @@: add esi,8 |
||
56 | cmp dword[esi],0 |
||
57 | jne .num |
||
58 | |||
59 | or eax,edx |
||
60 | |||
61 | .lp0: test al,0x80 |
||
178 | heavyiron | 62 | jnz still.skip_write |
63 | |||
826 | mikedld | 64 | push eax |
65 | mcall 26,2,,key1 |
||
66 | pop eax |
||
67 | |||
68 | mov [chr],eax |
||
69 | |||
178 | heavyiron | 70 | cmp [bot_mode],0 |
71 | je @f |
||
72 | mov ebx,eax |
||
73 | mov al,2 |
||
74 | call [bot_dlg_handler] |
||
75 | jmp still |
||
76 | @@: |
||
77 | |||
267 | mikedld | 78 | mov esi,accel_table_main |
178 | heavyiron | 79 | .acc: cmp eax,[esi] |
80 | jne @f |
||
81 | test [options],OPTS_SECURESEL |
||
82 | jz .lp1 |
||
297 | mikedld | 83 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
84 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
178 | heavyiron | 85 | .lp1: mov [s_status],0 |
86 | call dword[esi+4] |
||
297 | mikedld | 87 | call editor_check_for_changes |
178 | heavyiron | 88 | jmp still |
89 | @@: add esi,8 |
||
826 | mikedld | 90 | cmp dword[esi],0 |
178 | heavyiron | 91 | jne .acc |
92 | |||
826 | mikedld | 93 | test [chr],KM_CTRLALT |
178 | heavyiron | 94 | jnz still.skip_write |
95 | |||
96 | mov [s_status],0 |
||
97 | |||
826 | mikedld | 98 | movzx eax,byte[chr] |
178 | heavyiron | 99 | movzx eax,[eax+key0] |
100 | or al,al |
||
101 | jz still.skip_write |
||
102 | movzx eax,[eax+key1] |
||
103 | push eax |
||
104 | |||
105 | test [options],OPTS_SECURESEL |
||
106 | jz .lp2 |
||
297 | mikedld | 107 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
108 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
178 | heavyiron | 109 | jmp .put |
110 | .lp2: call delete_selection |
||
111 | |||
112 | test [options],OPTS_AUTOBRACES |
||
113 | jz .put |
||
114 | cmp al,'[' |
||
115 | jne @f |
||
116 | mov al,']' |
||
117 | call .lp3 |
||
297 | mikedld | 118 | dec [cur_editor.Caret.X] |
178 | heavyiron | 119 | jmp .put |
120 | @@: cmp al,'(' |
||
121 | jne @f |
||
122 | mov al,')' |
||
123 | call .lp3 |
||
297 | mikedld | 124 | dec [cur_editor.Caret.X] |
178 | heavyiron | 125 | jmp .put |
126 | @@: cmp al,'{' |
||
127 | jne .put |
||
128 | mov al,'}' |
||
129 | call .lp3 |
||
297 | mikedld | 130 | dec [cur_editor.Caret.X] |
178 | heavyiron | 131 | |
132 | .put: pop eax |
||
297 | mikedld | 133 | push still editor_check_for_changes |
134 | inc [cur_editor.SelStart.X] |
||
135 | .lp3: push [cur_editor.Caret.X] eax |
||
178 | heavyiron | 136 | inc dword[esp+4] |
137 | mov eax,1 |
||
138 | jmp key.tab.direct |
||
139 | |||
140 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 141 | proc key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////////////////// |
178 | heavyiron | 142 | ;----------------------------------------------------------------------------- |
143 | xor eax,eax |
||
297 | mikedld | 144 | mov [cur_editor.SelStart.X],eax |
145 | mov [cur_editor.SelStart.Y],eax |
||
146 | mov ecx,[cur_editor.Lines.Count] |
||
178 | heavyiron | 147 | dec ecx |
297 | mikedld | 148 | mov [cur_editor.Caret.Y],ecx |
178 | heavyiron | 149 | call get_line_offset |
150 | call get_real_length |
||
297 | mikedld | 151 | mov [cur_editor.Caret.X],eax |
152 | call draw_editor |
||
178 | heavyiron | 153 | ret |
617 | mikedld | 154 | endp |
178 | heavyiron | 155 | |
156 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 157 | proc key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////////////////// |
178 | heavyiron | 158 | ;----------------------------------------------------------------------------- |
629 | mikedld | 159 | mov [bot_mode2],0 |
178 | heavyiron | 160 | |
161 | .direct: |
||
629 | mikedld | 162 | cmp [bot_mode2], 2 |
595 | Rus | 163 | je .ask |
178 | heavyiron | 164 | mov [s_status],s_enter_filename |
595 | Rus | 165 | jmp .ask1 |
178 | heavyiron | 166 | |
595 | Rus | 167 | .ask: |
168 | mov [s_status],s_ask_save |
||
169 | .ask1: |
||
178 | heavyiron | 170 | mov [bot_mode],1 |
171 | mov [bot_dlg_height],16*2+4*2-1 |
||
172 | mov [bot_dlg_handler],osdlg_handler |
||
173 | mov [focused_tb],tb_opensave |
||
174 | |||
175 | @@: mov al,[tb_opensave.length] |
||
176 | mov [tb_opensave.pos.x],al |
||
177 | mov [tb_opensave.sel.x],0 |
||
267 | mikedld | 178 | mov [tb_casesen],0;1 |
178 | heavyiron | 179 | call drawwindow |
180 | ret |
||
617 | mikedld | 181 | endp |
178 | heavyiron | 182 | |
183 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 184 | proc key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// |
178 | heavyiron | 185 | ;----------------------------------------------------------------------------- |
595 | Rus | 186 | cmp [cur_editor.FilePath], 0 |
187 | je key.shift_ctrl_s |
||
297 | mikedld | 188 | cmp [cur_editor.Modified],0 |
178 | heavyiron | 189 | je .exit |
190 | call save_file |
||
191 | call drawwindow |
||
192 | .exit: |
||
193 | ret |
||
194 | |||
195 | key.shift_ctrl_s: |
||
629 | mikedld | 196 | mov [bot_mode2],1 |
178 | heavyiron | 197 | jmp key.ctrl_o.direct |
617 | mikedld | 198 | endp |
178 | heavyiron | 199 | |
200 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 201 | proc key.ctrl_n ;///// CREATE NEW FILE (TAB) ///////////////////////////////// |
178 | heavyiron | 202 | ;----------------------------------------------------------------------------- |
259 | mikedld | 203 | call create_tab |
178 | heavyiron | 204 | ret |
617 | mikedld | 205 | endp |
178 | heavyiron | 206 | |
207 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 208 | proc key.ctrl_f ;///// ENTER KEYWORD TO FIND ///////////////////////////////// |
178 | heavyiron | 209 | ;----------------------------------------------------------------------------- |
629 | mikedld | 210 | mov [bot_mode2],0 |
178 | heavyiron | 211 | mov [bot_dlg_height],16*2+4*2-1 |
212 | |||
213 | mov [s_status],s_enter_text_to_find |
||
214 | |||
215 | .direct: |
||
216 | mov [bot_mode],1 |
||
217 | mov [bot_dlg_handler],finddlg_handler |
||
218 | mov [focused_tb],tb_find |
||
219 | |||
220 | mov ecx,[s_search.size] |
||
221 | mov [tb_find.length],cl |
||
222 | jecxz @f |
||
223 | mov esi,s_search |
||
224 | mov edi,tb_find.text |
||
225 | cld |
||
226 | rep movsb |
||
227 | |||
228 | @@: mov al,[tb_find.length] |
||
229 | mov [tb_find.pos.x],al |
||
230 | mov [tb_find.sel.x],0 |
||
231 | mov [tb_casesen],0 |
||
232 | call drawwindow |
||
233 | ret |
||
617 | mikedld | 234 | endp |
178 | heavyiron | 235 | |
617 | mikedld | 236 | proc key.ctrl_h |
629 | mikedld | 237 | mov [bot_mode2],1 |
178 | heavyiron | 238 | mov [bot_dlg_height],16*3+4*2+1 |
239 | |||
240 | mov [s_status],s_enter_text_to_replace |
||
241 | |||
242 | jmp key.ctrl_f.direct |
||
617 | mikedld | 243 | endp |
178 | heavyiron | 244 | |
617 | mikedld | 245 | proc key.ctrl_g |
178 | heavyiron | 246 | ret |
297 | mikedld | 247 | @^ |
629 | mikedld | 248 | mov [bot_mode2],0 |
178 | heavyiron | 249 | mov [bot_dlg_height],16*2+4*2-1 |
250 | |||
251 | mov [bot_mode],1 |
||
252 | mov [bot_dlg_handler],gotodlg_handler |
||
253 | mov [focused_tb],tb_gotorow |
||
254 | |||
255 | mov al,[tb_gotorow.length] |
||
256 | mov [tb_gotorow.pos.x],al |
||
257 | mov [tb_gotorow.sel.x],0 |
||
258 | mov [tb_casesen],0 |
||
259 | call drawwindow |
||
260 | ret |
||
297 | mikedld | 261 | ^@ |
617 | mikedld | 262 | endp |
178 | heavyiron | 263 | |
264 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 265 | proc key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// |
178 | heavyiron | 266 | ;----------------------------------------------------------------------------- |
267 | call clear_selection |
||
268 | |||
269 | ;----------------------------------------------------------------------------- |
||
270 | key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION ///////// |
||
271 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 272 | mov ebx,[cur_editor.Caret.Y] |
273 | mov edx,[cur_editor.Caret.X] |
||
178 | heavyiron | 274 | cld |
275 | mov ecx,ebx |
||
276 | call get_line_offset |
||
277 | .lp1: cmp dx,[esi] |
||
278 | jle @f |
||
279 | movzx edx,word[esi] |
||
280 | @@: dec edx |
||
281 | jl .nx1 |
||
282 | add esi,4 |
||
283 | add esi,edx |
||
284 | mov ecx,edx |
||
285 | @@: push ecx |
||
286 | mov edi,symbols_ex |
||
287 | mov ecx,symbols_ex.size+symbols.size |
||
288 | mov al,[esi] |
||
289 | dec esi |
||
290 | repne scasb |
||
291 | pop ecx |
||
292 | jne @f |
||
293 | dec edx |
||
294 | dec ecx |
||
295 | jnz @b |
||
296 | .nx1: dec ebx |
||
297 | js .exit.2 |
||
298 | mov ecx,ebx |
||
299 | call get_line_offset |
||
300 | movzx edx,word[esi] |
||
301 | dec edx |
||
302 | jmp .lp1 |
||
303 | @@: |
||
304 | mov ecx,ebx |
||
305 | call get_line_offset |
||
306 | .lp2: cmp dx,[esi] |
||
307 | jle @f |
||
308 | movzx edx,word[esi] |
||
309 | @@: or edx,edx |
||
310 | jl .nx2 |
||
311 | add esi,4 |
||
312 | add esi,edx |
||
313 | @@: mov edi,symbols_ex |
||
314 | mov ecx,symbols_ex.size+symbols.size |
||
315 | mov al,[esi] |
||
316 | dec esi |
||
317 | repne scasb |
||
318 | je @f |
||
319 | dec edx |
||
320 | jns @b |
||
321 | jmp @f |
||
322 | .nx2: dec ebx |
||
323 | js .exit.2 |
||
324 | mov ecx,ebx |
||
325 | call get_line_offset |
||
326 | movzx edx,word[esi] |
||
327 | dec edx |
||
328 | jmp .lp2 |
||
329 | @@: |
||
330 | inc edx |
||
297 | mikedld | 331 | mov [cur_editor.Caret.Y],ebx |
332 | mov [cur_editor.Caret.X],edx |
||
826 | mikedld | 333 | test [chr],KM_SHIFT |
178 | heavyiron | 334 | jnz @f |
297 | mikedld | 335 | mov [cur_editor.SelStart.Y],ebx |
336 | mov [cur_editor.SelStart.X],edx |
||
337 | @@: sub ebx,[cur_editor.TopLeft.Y] |
||
178 | heavyiron | 338 | jge @f |
297 | mikedld | 339 | add [cur_editor.TopLeft.Y],ebx |
178 | heavyiron | 340 | @@: mov eax,edx |
297 | mikedld | 341 | sub eax,[cur_editor.TopLeft.X] |
178 | heavyiron | 342 | cmp eax,[columns.scr] |
343 | jl @f |
||
344 | sub eax,[columns.scr] |
||
345 | inc eax |
||
297 | mikedld | 346 | add [cur_editor.TopLeft.X],eax |
178 | heavyiron | 347 | jmp .exit |
297 | mikedld | 348 | @@: cmp edx,[cur_editor.TopLeft.X] |
178 | heavyiron | 349 | jge .exit |
297 | mikedld | 350 | mov [cur_editor.TopLeft.X],edx |
178 | heavyiron | 351 | .exit: |
297 | mikedld | 352 | call editor_check_for_changes |
178 | heavyiron | 353 | .exit.2: |
354 | ret |
||
617 | mikedld | 355 | endp |
178 | heavyiron | 356 | |
357 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 358 | proc key.ctrl_right ;///// GO TO NEXT WORD /////////////////////////////////// |
178 | heavyiron | 359 | ;----------------------------------------------------------------------------- |
360 | call clear_selection |
||
361 | |||
362 | ;----------------------------------------------------------------------------- |
||
363 | key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION //////////// |
||
364 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 365 | mov ebx,[cur_editor.Caret.Y] |
366 | mov edx,[cur_editor.Caret.X] |
||
178 | heavyiron | 367 | cld |
368 | .lp1: mov ecx,ebx |
||
369 | call get_line_offset |
||
370 | movzx ecx,word[esi] |
||
371 | cmp edx,ecx |
||
372 | jge .nx1 |
||
373 | add esi,4 |
||
374 | add esi,edx |
||
375 | sub ecx,edx |
||
376 | @@: push ecx |
||
377 | mov edi,symbols_ex |
||
378 | mov ecx,symbols_ex.size+symbols.size |
||
379 | lodsb |
||
380 | repne scasb |
||
381 | pop ecx |
||
382 | je @f |
||
383 | inc edx |
||
384 | dec ecx |
||
385 | jnz @b |
||
386 | .nx1: inc ebx |
||
297 | mikedld | 387 | cmp ebx,[cur_editor.Lines.Count] |
178 | heavyiron | 388 | jge .exit.2 |
389 | xor edx,edx |
||
390 | jmp .lp1 |
||
391 | @@: |
||
392 | |||
393 | .lp2: mov ecx,ebx |
||
394 | call get_line_offset |
||
395 | movzx ecx,word[esi] |
||
396 | cmp edx,ecx |
||
397 | jge .nx2 |
||
398 | add esi,4 |
||
399 | add esi,edx |
||
400 | sub ecx,edx |
||
401 | @@: push ecx |
||
402 | mov edi,symbols_ex |
||
403 | mov ecx,symbols_ex.size+symbols.size |
||
404 | lodsb |
||
405 | repne scasb |
||
406 | pop ecx |
||
407 | jne @f |
||
408 | inc edx |
||
409 | dec ecx |
||
410 | jnz @b |
||
411 | .nx2: inc ebx |
||
297 | mikedld | 412 | cmp ebx,[cur_editor.Lines.Count] |
178 | heavyiron | 413 | jge .exit.2 |
414 | xor edx,edx |
||
415 | jmp .lp2 |
||
416 | @@: |
||
297 | mikedld | 417 | mov [cur_editor.Caret.Y],ebx |
418 | mov [cur_editor.Caret.X],edx |
||
826 | mikedld | 419 | test [chr],KM_SHIFT |
178 | heavyiron | 420 | jnz @f |
297 | mikedld | 421 | mov [cur_editor.SelStart.Y],ebx |
422 | mov [cur_editor.SelStart.X],edx |
||
423 | @@: sub ebx,[cur_editor.TopLeft.Y] |
||
178 | heavyiron | 424 | cmp ebx,[lines.scr] |
425 | jl @f |
||
426 | sub ebx,[lines.scr] |
||
427 | inc ebx |
||
297 | mikedld | 428 | add [cur_editor.TopLeft.Y],ebx |
178 | heavyiron | 429 | @@: mov eax,edx |
297 | mikedld | 430 | sub eax,[cur_editor.TopLeft.X] |
178 | heavyiron | 431 | cmp eax,[columns.scr] |
432 | jl @f |
||
433 | sub eax,[columns.scr] |
||
434 | inc eax |
||
297 | mikedld | 435 | add [cur_editor.TopLeft.X],eax |
178 | heavyiron | 436 | jmp .exit |
297 | mikedld | 437 | @@: cmp edx,[cur_editor.TopLeft.X] |
178 | heavyiron | 438 | jge .exit |
297 | mikedld | 439 | mov [cur_editor.TopLeft.X],edx |
178 | heavyiron | 440 | .exit: |
297 | mikedld | 441 | call editor_check_for_changes |
178 | heavyiron | 442 | .exit.2: |
443 | ret |
||
617 | mikedld | 444 | endp |
178 | heavyiron | 445 | |
446 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 447 | proc key.ctrl_x |
178 | heavyiron | 448 | cmp [sel.selected],0 |
449 | je @f |
||
450 | call key.ctrl_c |
||
451 | call key.del |
||
297 | mikedld | 452 | mov [cur_editor.Modified],1 |
178 | heavyiron | 453 | @@: ret |
617 | mikedld | 454 | endp |
178 | heavyiron | 455 | |
456 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 457 | proc key.ctrl_c |
178 | heavyiron | 458 | mov [copy_size],0 |
459 | cmp [sel.selected],0 |
||
460 | je .exit |
||
259 | mikedld | 461 | |
462 | call get_selection_size |
||
617 | mikedld | 463 | stdcall mem.ReAlloc,[copy_buf],eax |
259 | mikedld | 464 | mov [copy_buf],eax |
465 | |||
178 | heavyiron | 466 | cld |
467 | mov eax,[sel.begin.y] |
||
468 | cmp eax,[sel.end.y] |
||
469 | je .single_line |
||
470 | mov ecx,[sel.begin.y] |
||
471 | call get_line_offset |
||
472 | inc ecx |
||
473 | push ecx |
||
297 | mikedld | 474 | mov edi,[copy_buf] |
178 | heavyiron | 475 | call get_real_length |
476 | sub eax,[sel.begin.x] |
||
477 | jge @f |
||
478 | xor eax,eax |
||
479 | @@: add esi,[sel.begin.x] |
||
480 | add esi,4 |
||
481 | stosd |
||
482 | mov ecx,eax |
||
483 | jecxz @f |
||
484 | rep movsb |
||
485 | @@: mov ecx,[sel.end.y] |
||
486 | call get_line_offset |
||
487 | pop ecx |
||
488 | cmp ecx,[sel.end.y] |
||
489 | je @f |
||
490 | mov eax,esi |
||
491 | call get_line_offset |
||
492 | sub eax,esi |
||
493 | mov ecx,eax |
||
494 | rep movsb |
||
495 | mov ecx,[sel.end.y] |
||
496 | @@: call get_line_offset |
||
497 | movzx eax,word[esi] |
||
498 | add esi,4 |
||
499 | cmp eax,[sel.end.x] |
||
500 | jle @f |
||
501 | mov eax,[sel.end.x] |
||
502 | @@: mov ebx,edi |
||
503 | stosd |
||
504 | mov ecx,eax |
||
505 | jecxz @f |
||
506 | rep movsb |
||
507 | sub eax,[sel.end.x] |
||
508 | jz @f |
||
509 | neg eax |
||
510 | mov ecx,eax |
||
511 | add [ebx],eax |
||
512 | mov al,' ' |
||
513 | rep stosb |
||
297 | mikedld | 514 | @@: sub edi,[copy_buf] |
178 | heavyiron | 515 | mov [copy_size],edi |
516 | mov eax,[sel.end.y] |
||
517 | sub eax,[sel.begin.y] |
||
518 | inc eax |
||
519 | mov [copy_count],eax |
||
520 | .exit: |
||
521 | ret |
||
522 | |||
523 | .single_line: |
||
524 | mov eax,[sel.end.x] |
||
525 | sub eax,[sel.begin.x] |
||
297 | mikedld | 526 | mov edi,[copy_buf] |
178 | heavyiron | 527 | stosd |
528 | mov ecx,[sel.begin.y] |
||
529 | call get_line_offset |
||
530 | mov ebx,[sel.begin.x] |
||
531 | mov ecx,[sel.end.x] |
||
532 | cmp ebx,[esi] |
||
533 | jge .add_spaces |
||
534 | cmp ecx,[esi] |
||
535 | jle .lp1 |
||
536 | mov ecx,[esi] |
||
537 | .lp1: sub ecx,[sel.begin.x] |
||
538 | sub eax,ecx |
||
539 | lea esi,[esi+ebx+4] |
||
540 | rep movsb |
||
541 | |||
542 | .add_spaces: |
||
543 | mov ecx,eax |
||
544 | mov al,' ' |
||
545 | jecxz @b |
||
546 | rep stosb |
||
547 | jmp @b |
||
617 | mikedld | 548 | endp |
178 | heavyiron | 549 | |
550 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 551 | proc key.ctrl_v |
178 | heavyiron | 552 | cmp [copy_size],0 |
553 | je .exit |
||
554 | |||
555 | call delete_selection |
||
556 | |||
280 | mikedld | 557 | mov eax,[copy_size] |
558 | call editor_realloc_lines |
||
559 | |||
560 | mov ebx,[cur_editor.Lines.Size] |
||
561 | add ebx,[copy_size] |
||
562 | mov [cur_editor.Lines.Size],ebx |
||
617 | mikedld | 563 | stdcall mem.ReAlloc,[cur_editor.Lines],ebx |
280 | mikedld | 564 | mov [cur_editor.Lines],eax |
565 | |||
297 | mikedld | 566 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 567 | call get_line_offset |
568 | pushd [esi] esi |
||
297 | mikedld | 569 | mov ecx,[cur_editor.Caret.X] |
178 | heavyiron | 570 | call line_add_spaces |
297 | mikedld | 571 | add [esp],eax |
572 | add esi,eax |
||
178 | heavyiron | 573 | mov ecx,[copy_size] |
574 | sub ecx,4 |
||
297 | mikedld | 575 | mov edi,[cur_editor.Lines] |
824 | mikedld | 576 | add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4] |
259 | mikedld | 577 | dec edi |
178 | heavyiron | 578 | mov eax,esi |
579 | mov esi,edi |
||
580 | sub esi,ecx |
||
581 | lea ecx,[eax+4] |
||
297 | mikedld | 582 | add ecx,[cur_editor.Caret.X] |
178 | heavyiron | 583 | neg ecx |
584 | lea ecx,[esi+ecx+1] |
||
585 | std |
||
586 | rep movsb |
||
587 | |||
588 | mov ecx,[copy_count] |
||
589 | dec ecx |
||
590 | jz .single_line |
||
591 | |||
592 | cld |
||
593 | pop edi |
||
594 | add edi,4 |
||
297 | mikedld | 595 | mov esi,[copy_buf] |
178 | heavyiron | 596 | lodsd |
597 | |||
297 | mikedld | 598 | mov ebx,[cur_editor.Caret.X] |
178 | heavyiron | 599 | add eax,ebx |
600 | mov [edi-4],ax |
||
280 | mikedld | 601 | mov byte[edi-4+2],0x0001 |
178 | heavyiron | 602 | sub eax,ebx |
603 | call .check_columns |
||
604 | add edi,ebx |
||
605 | @@: push ecx |
||
606 | mov ecx,eax |
||
607 | rep movsb |
||
608 | lodsd |
||
609 | and eax,0x0000FFFF |
||
610 | stosd |
||
280 | mikedld | 611 | mov byte[edi-4+2],0x0001 |
178 | heavyiron | 612 | pop ecx |
613 | loop @b |
||
614 | |||
615 | pop ecx |
||
616 | sub ecx,ebx |
||
617 | add [edi-4],cx |
||
618 | call .check_columns |
||
619 | mov ecx,eax |
||
620 | rep movsb |
||
621 | |||
297 | mikedld | 622 | mov [cur_editor.Caret.X],eax |
623 | mov [cur_editor.SelStart.X],eax |
||
178 | heavyiron | 624 | mov eax,[copy_count] |
625 | dec eax |
||
297 | mikedld | 626 | add [cur_editor.Caret.Y],eax |
627 | add [cur_editor.SelStart.Y],eax |
||
628 | add [cur_editor.Lines.Count],eax |
||
178 | heavyiron | 629 | |
297 | mikedld | 630 | mov [cur_editor.Modified],1 |
178 | heavyiron | 631 | jmp .exit |
632 | |||
633 | .single_line: |
||
634 | cld |
||
635 | pop edi |
||
636 | add edi,4 |
||
297 | mikedld | 637 | mov esi,[copy_buf] |
178 | heavyiron | 638 | lodsd |
639 | add [edi-4],ax |
||
640 | and dword[edi-4],not 0x00020000 |
||
641 | or dword[edi-4],0x00010000 |
||
642 | call .check_columns |
||
297 | mikedld | 643 | add edi,[cur_editor.Caret.X] |
178 | heavyiron | 644 | add esp,4 |
645 | mov ecx,eax |
||
646 | rep movsb |
||
647 | |||
297 | mikedld | 648 | add [cur_editor.Caret.X],eax |
649 | add [cur_editor.SelStart.X],eax |
||
178 | heavyiron | 650 | |
297 | mikedld | 651 | mov [cur_editor.Modified],1 |
178 | heavyiron | 652 | |
653 | .exit: |
||
654 | ret |
||
655 | |||
656 | .check_columns: |
||
657 | push eax |
||
658 | movzx eax,word[edi-4] |
||
297 | mikedld | 659 | cmp eax,[cur_editor.Columns.Count] |
178 | heavyiron | 660 | jbe @f |
297 | mikedld | 661 | mov [cur_editor.Columns.Count],eax |
178 | heavyiron | 662 | @@: pop eax |
663 | ret |
||
617 | mikedld | 664 | endp |
178 | heavyiron | 665 | |
666 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 667 | proc key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////////////////// |
178 | heavyiron | 668 | ;----------------------------------------------------------------------------- |
280 | mikedld | 669 | mov eax,94 |
670 | call editor_realloc_lines |
||
671 | |||
297 | mikedld | 672 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 673 | call get_line_offset |
674 | mov ebx,esi |
||
675 | |||
297 | mikedld | 676 | mov ecx,[cur_editor.Lines.Count] |
178 | heavyiron | 677 | call get_line_offset |
678 | lea edi,[esi+90+4] |
||
679 | lea ecx,[esi+4] |
||
680 | sub ecx,ebx |
||
681 | std |
||
682 | rep movsb |
||
683 | |||
684 | lea edi,[ebx+5] |
||
685 | mov word[ebx],90 |
||
686 | mov al,ASEPC |
||
687 | mov ecx,79 |
||
688 | cld |
||
689 | rep stosb |
||
690 | mov al,' ' |
||
691 | mov ecx,10 |
||
692 | rep stosb |
||
693 | mov byte[ebx+4],';' |
||
694 | |||
297 | mikedld | 695 | inc [cur_editor.Lines.Count] |
696 | inc [cur_editor.Caret.Y] |
||
697 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
178 | heavyiron | 698 | |
297 | mikedld | 699 | mov [cur_editor.Modified],1 |
178 | heavyiron | 700 | |
701 | .exit: |
||
702 | ret |
||
617 | mikedld | 703 | endp |
178 | heavyiron | 704 | |
705 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 706 | proc key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////////////////// |
178 | heavyiron | 707 | ;----------------------------------------------------------------------------- |
297 | mikedld | 708 | mov eax,[cur_editor.Caret.Y] |
178 | heavyiron | 709 | inc eax |
297 | mikedld | 710 | cmp eax,[cur_editor.Lines.Count] |
178 | heavyiron | 711 | jge .exit |
712 | |||
297 | mikedld | 713 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 714 | call get_line_offset |
715 | mov edi,esi |
||
716 | lodsd |
||
280 | mikedld | 717 | and eax,0x0000FFFF |
178 | heavyiron | 718 | add esi,eax |
280 | mikedld | 719 | push eax |
178 | heavyiron | 720 | |
297 | mikedld | 721 | dec [cur_editor.Lines.Count] |
280 | mikedld | 722 | mov ecx,[cur_editor.Lines] |
824 | mikedld | 723 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
178 | heavyiron | 724 | sub ecx,esi |
297 | mikedld | 725 | shr ecx,2 |
178 | heavyiron | 726 | cld |
727 | rep movsd |
||
280 | mikedld | 728 | |
729 | pop eax |
||
730 | add eax,4 |
||
731 | neg eax |
||
732 | call editor_realloc_lines |
||
733 | |||
734 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
||
735 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
736 | |||
297 | mikedld | 737 | mov [cur_editor.Modified],1 |
178 | heavyiron | 738 | |
739 | .exit: |
||
740 | ret |
||
617 | mikedld | 741 | endp |
178 | heavyiron | 742 | |
743 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 744 | proc key.up ;///// GO TO PREVIOUS LINE /////////////////////////////////////// |
178 | heavyiron | 745 | ;----------------------------------------------------------------------------- |
746 | call clear_selection |
||
747 | |||
748 | ;----------------------------------------------------------------------------- |
||
749 | key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION //////////////// |
||
750 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 751 | mov eax,[cur_editor.Caret.Y] |
178 | heavyiron | 752 | dec eax |
753 | jns @f |
||
754 | xor eax,eax |
||
297 | mikedld | 755 | @@: mov ecx,[cur_editor.TopLeft.Y] |
178 | heavyiron | 756 | cmp eax,ecx |
757 | jae @f |
||
758 | dec ecx |
||
759 | jns @f |
||
760 | xor ecx,ecx |
||
826 | mikedld | 761 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 762 | jnz @f |
297 | mikedld | 763 | mov [cur_editor.SelStart.Y],eax |
764 | @@: mov [cur_editor.Caret.Y],eax |
||
765 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 766 | |
767 | .exit: |
||
768 | ret |
||
617 | mikedld | 769 | endp |
178 | heavyiron | 770 | |
771 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 772 | proc key.down ;///// GO TO NEXT LINE ///////////////////////////////////////// |
178 | heavyiron | 773 | ;----------------------------------------------------------------------------- |
774 | call clear_selection |
||
775 | |||
776 | ;----------------------------------------------------------------------------- |
||
777 | key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION ////////////////// |
||
778 | ;----------------------------------------------------------------------------- |
||
779 | |||
297 | mikedld | 780 | mov eax,[cur_editor.Caret.Y] |
178 | heavyiron | 781 | inc eax |
297 | mikedld | 782 | cmp eax,[cur_editor.Lines.Count] |
178 | heavyiron | 783 | jb @f |
784 | dec eax |
||
297 | mikedld | 785 | @@: mov ecx,[cur_editor.TopLeft.Y] |
178 | heavyiron | 786 | mov edx,eax |
787 | sub edx,ecx |
||
788 | cmp edx,[lines.scr] |
||
789 | jb @f |
||
790 | inc ecx |
||
826 | mikedld | 791 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 792 | jnz @f |
297 | mikedld | 793 | mov [cur_editor.SelStart.Y],eax |
794 | @@: mov [cur_editor.Caret.Y],eax |
||
795 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 796 | |
797 | .exit: |
||
798 | ret |
||
617 | mikedld | 799 | endp |
178 | heavyiron | 800 | |
801 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 802 | proc key.left ;///// GO TO PREVIOUS CHAR ///////////////////////////////////// |
178 | heavyiron | 803 | ;----------------------------------------------------------------------------- |
804 | call clear_selection |
||
805 | |||
806 | ;----------------------------------------------------------------------------- |
||
807 | key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION ////////////// |
||
808 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 809 | mov eax,[cur_editor.Caret.X] |
178 | heavyiron | 810 | dec eax |
811 | jns @f |
||
812 | inc eax |
||
826 | mikedld | 813 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 814 | jnz @f |
297 | mikedld | 815 | mov [cur_editor.SelStart.X],eax |
816 | @@: mov [cur_editor.Caret.X],eax |
||
178 | heavyiron | 817 | |
818 | .exit: |
||
819 | ret |
||
617 | mikedld | 820 | endp |
178 | heavyiron | 821 | |
822 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 823 | proc key.right ;///// GO TO NEXT CHAR //////////////////////////////////////// |
178 | heavyiron | 824 | ;----------------------------------------------------------------------------- |
825 | call clear_selection |
||
826 | |||
827 | ;----------------------------------------------------------------------------- |
||
828 | key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION ///////////////// |
||
829 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 830 | mov eax,[cur_editor.Caret.X] |
178 | heavyiron | 831 | inc eax |
297 | mikedld | 832 | cmp eax,[cur_editor.Columns.Count] |
178 | heavyiron | 833 | jbe @f |
834 | dec eax |
||
826 | mikedld | 835 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 836 | jnz @f |
297 | mikedld | 837 | mov [cur_editor.SelStart.X],eax |
838 | @@: mov [cur_editor.Caret.X],eax |
||
178 | heavyiron | 839 | |
840 | .exit: |
||
841 | ret |
||
617 | mikedld | 842 | endp |
178 | heavyiron | 843 | |
844 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 845 | proc key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////////////////// |
178 | heavyiron | 846 | ;----------------------------------------------------------------------------- |
847 | call clear_selection |
||
848 | |||
849 | ;----------------------------------------------------------------------------- |
||
850 | key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION ////////////// |
||
851 | ;----------------------------------------------------------------------------- |
||
852 | mov edx,[lines.scr] |
||
853 | dec edx |
||
297 | mikedld | 854 | mov eax,[cur_editor.Caret.Y] |
855 | mov ecx,[cur_editor.TopLeft.Y] |
||
178 | heavyiron | 856 | sub eax,edx |
857 | jns @f |
||
858 | xor eax,eax |
||
859 | @@: sub ecx,edx |
||
860 | jns @f |
||
861 | xor ecx,ecx |
||
826 | mikedld | 862 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 863 | jnz @f |
297 | mikedld | 864 | mov [cur_editor.SelStart.Y],eax |
865 | @@: mov [cur_editor.Caret.Y],eax |
||
866 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 867 | |
868 | .exit: |
||
869 | ret |
||
617 | mikedld | 870 | endp |
178 | heavyiron | 871 | |
872 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 873 | proc key.pgdn ;///// GO TO NEXT PAGE ///////////////////////////////////////// |
178 | heavyiron | 874 | ;----------------------------------------------------------------------------- |
875 | call clear_selection |
||
876 | |||
877 | ;----------------------------------------------------------------------------- |
||
878 | key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION ////////////////// |
||
879 | ;----------------------------------------------------------------------------- |
||
880 | mov edx,[lines.scr] |
||
881 | dec edx |
||
297 | mikedld | 882 | mov eax,[cur_editor.Caret.Y] |
883 | mov ecx,[cur_editor.TopLeft.Y] |
||
178 | heavyiron | 884 | add eax,edx |
885 | add ecx,edx |
||
297 | mikedld | 886 | cmp eax,[cur_editor.Lines.Count] |
178 | heavyiron | 887 | jb @f |
297 | mikedld | 888 | mov eax,[cur_editor.Lines.Count] |
178 | heavyiron | 889 | dec eax |
826 | mikedld | 890 | @@: test [chr],KM_SHIFT |
178 | heavyiron | 891 | jnz @f |
297 | mikedld | 892 | mov [cur_editor.SelStart.Y],eax |
893 | @@: mov [cur_editor.Caret.Y],eax |
||
894 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 895 | |
896 | .exit: |
||
897 | ret |
||
617 | mikedld | 898 | endp |
178 | heavyiron | 899 | |
900 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 901 | proc key.home ;///// GO TO LINE START //////////////////////////////////////// |
178 | heavyiron | 902 | ;----------------------------------------------------------------------------- |
903 | call clear_selection |
||
904 | |||
905 | ;----------------------------------------------------------------------------- |
||
906 | key.shift_home: ;///// GO TO LINE START, WITH SELECTION ///////////////// |
||
907 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 908 | mov [cur_editor.Caret.X],0 |
826 | mikedld | 909 | test [chr],KM_SHIFT |
178 | heavyiron | 910 | jnz @f |
297 | mikedld | 911 | mov [cur_editor.SelStart.X],0 |
912 | @@: |
||
178 | heavyiron | 913 | |
914 | .exit: |
||
915 | ret |
||
617 | mikedld | 916 | endp |
178 | heavyiron | 917 | |
918 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 919 | proc key.end ;///// GO TO LINE END /////////////////////////////////////////// |
178 | heavyiron | 920 | ;----------------------------------------------------------------------------- |
921 | call clear_selection |
||
922 | |||
923 | ;----------------------------------------------------------------------------- |
||
924 | key.shift_end: ;///// GO TO LINE END, WITH SELECTION //////////////////// |
||
925 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 926 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 927 | call get_line_offset |
928 | call get_real_length |
||
297 | mikedld | 929 | mov [cur_editor.Caret.X],eax |
826 | mikedld | 930 | test [chr],KM_SHIFT |
178 | heavyiron | 931 | jnz @f |
297 | mikedld | 932 | mov [cur_editor.SelStart.X],eax |
933 | @@: |
||
178 | heavyiron | 934 | |
935 | .exit: |
||
936 | ret |
||
617 | mikedld | 937 | endp |
178 | heavyiron | 938 | |
939 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 940 | proc key.ctrl_home ;///// GO TO PAGE START /////////////////////////////////// |
178 | heavyiron | 941 | ;----------------------------------------------------------------------------- |
942 | call clear_selection |
||
943 | |||
944 | ;----------------------------------------------------------------------------- |
||
945 | key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION //////////// |
||
946 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 947 | mov eax,[cur_editor.TopLeft.Y] |
178 | heavyiron | 948 | mov ecx,eax |
826 | mikedld | 949 | test [chr],KM_SHIFT |
178 | heavyiron | 950 | jnz @f |
297 | mikedld | 951 | mov [cur_editor.SelStart.Y],eax |
952 | @@: mov [cur_editor.Caret.Y],eax |
||
953 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 954 | |
955 | .exit: |
||
956 | ret |
||
617 | mikedld | 957 | endp |
178 | heavyiron | 958 | |
959 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 960 | proc key.ctrl_end ;///// GO TO PAGE END ////////////////////////////////////// |
178 | heavyiron | 961 | ;----------------------------------------------------------------------------- |
962 | call clear_selection |
||
963 | |||
964 | ;----------------------------------------------------------------------------- |
||
965 | key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION /////////////// |
||
966 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 967 | mov ecx,[cur_editor.TopLeft.Y] |
178 | heavyiron | 968 | mov eax,[lines.scr] |
297 | mikedld | 969 | cmp eax,[cur_editor.Lines.Count] |
178 | heavyiron | 970 | jle @f |
297 | mikedld | 971 | mov eax,[cur_editor.Lines.Count] |
178 | heavyiron | 972 | @@: add eax,ecx |
973 | dec eax |
||
826 | mikedld | 974 | test [chr],KM_SHIFT |
178 | heavyiron | 975 | jnz @f |
297 | mikedld | 976 | mov [cur_editor.SelStart.Y],eax |
977 | @@: mov [cur_editor.Caret.Y],eax |
||
978 | mov [cur_editor.TopLeft.Y],ecx |
||
178 | heavyiron | 979 | |
980 | .exit: |
||
981 | ret |
||
617 | mikedld | 982 | endp |
178 | heavyiron | 983 | |
984 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 985 | proc key.ctrl_pgup ;///// GO TO DOCUMENT START /////////////////////////////// |
178 | heavyiron | 986 | ;----------------------------------------------------------------------------- |
987 | call clear_selection |
||
988 | |||
989 | ;----------------------------------------------------------------------------- |
||
990 | key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION //////// |
||
991 | ;----------------------------------------------------------------------------- |
||
992 | xor eax,eax |
||
297 | mikedld | 993 | mov [cur_editor.TopLeft.Y],eax |
994 | mov [cur_editor.Caret.Y],eax |
||
826 | mikedld | 995 | test [chr],KM_SHIFT |
178 | heavyiron | 996 | jnz @f |
297 | mikedld | 997 | mov [cur_editor.SelStart.Y],eax |
998 | @@: |
||
178 | heavyiron | 999 | |
1000 | .exit: |
||
1001 | ret |
||
617 | mikedld | 1002 | endp |
178 | heavyiron | 1003 | |
1004 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1005 | proc key.ctrl_pgdn ;///// GO TO DOCUMENT END ///////////////////////////////// |
178 | heavyiron | 1006 | ;----------------------------------------------------------------------------- |
1007 | call clear_selection |
||
1008 | |||
1009 | ;----------------------------------------------------------------------------- |
||
1010 | key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION ////////// |
||
1011 | ;----------------------------------------------------------------------------- |
||
297 | mikedld | 1012 | mov eax,[cur_editor.Lines.Count] |
1013 | mov [cur_editor.Caret.Y],eax |
||
1014 | sub eax,[lines.scr] |
||
178 | heavyiron | 1015 | jns @f |
1016 | xor eax,eax |
||
297 | mikedld | 1017 | @@: mov [cur_editor.TopLeft.Y],eax |
1018 | dec [cur_editor.Caret.Y] |
||
826 | mikedld | 1019 | test [chr],KM_SHIFT |
178 | heavyiron | 1020 | jnz @f |
267 | mikedld | 1021 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
297 | mikedld | 1022 | @@: |
178 | heavyiron | 1023 | |
1024 | .exit: |
||
1025 | ret |
||
617 | mikedld | 1026 | endp |
178 | heavyiron | 1027 | |
1028 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1029 | proc key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// |
178 | heavyiron | 1030 | ;----------------------------------------------------------------------------- |
1031 | call delete_selection |
||
297 | mikedld | 1032 | jnc .exit |
178 | heavyiron | 1033 | |
297 | mikedld | 1034 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 1035 | call get_line_offset |
1036 | and dword[esi],not 0x00020000 |
||
1037 | or dword[esi],0x00010000 |
||
1038 | lea ebx,[esi+4] |
||
1039 | mov ebp,esi |
||
1040 | |||
1041 | call get_real_length |
||
1042 | or eax,eax |
||
1043 | je .line_up |
||
1044 | |||
297 | mikedld | 1045 | mov ecx,[cur_editor.Caret.X] |
178 | heavyiron | 1046 | cmp ecx,eax |
1047 | jae .line_up |
||
1048 | lea edi,[ebx+ecx] |
||
1049 | neg ecx |
||
1050 | movzx eax,word[ebp] |
||
1051 | add ecx,eax;[ebp] |
||
1052 | repe scasb |
||
1053 | je .line_up |
||
1054 | |||
1055 | mov edi,ebx |
||
297 | mikedld | 1056 | mov ecx,[cur_editor.Caret.X] |
178 | heavyiron | 1057 | add edi,ecx |
1058 | lea esi,[edi+1] |
||
1059 | neg ecx |
||
1060 | movzx eax,word[ebp] |
||
1061 | add ecx,eax;[ebp] |
||
1062 | dec ecx |
||
1063 | rep movsb |
||
1064 | mov byte[edi],' ' |
||
1065 | |||
297 | mikedld | 1066 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
1067 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
1068 | mov [cur_editor.Modified],1 |
||
178 | heavyiron | 1069 | ret |
1070 | |||
1071 | .line_up: |
||
297 | mikedld | 1072 | mov eax,[cur_editor.Lines.Count] |
178 | heavyiron | 1073 | dec eax |
297 | mikedld | 1074 | cmp eax,[cur_editor.Caret.Y] |
178 | heavyiron | 1075 | je .exit |
297 | mikedld | 1076 | mov edi,[temp_buf] |
259 | mikedld | 1077 | add edi,4 |
178 | heavyiron | 1078 | mov esi,ebx |
297 | mikedld | 1079 | mov ecx,[cur_editor.Caret.X] |
178 | heavyiron | 1080 | rep movsb |
297 | mikedld | 1081 | mov ecx,[cur_editor.Caret.X] |
259 | mikedld | 1082 | mov eax,[temp_buf] |
297 | mikedld | 1083 | mov [eax],ecx |
178 | heavyiron | 1084 | cmp cx,[ebp] |
1085 | jbe @f |
||
1086 | movzx eax,word[ebp] |
||
297 | mikedld | 1087 | sub ecx,eax |
178 | heavyiron | 1088 | sub edi,ecx |
1089 | mov al,' ' |
||
1090 | rep stosb |
||
1091 | @@: lea esi,[ebx+4] |
||
1092 | movzx eax,word[ebp] |
||
297 | mikedld | 1093 | add esi,eax |
178 | heavyiron | 1094 | movzx ecx,word[esi-4] |
259 | mikedld | 1095 | mov eax,[temp_buf] |
297 | mikedld | 1096 | add [eax],ecx |
1097 | or dword[eax],0x00010000 |
||
178 | heavyiron | 1098 | rep movsb |
1099 | |||
297 | mikedld | 1100 | mov ecx,edi |
259 | mikedld | 1101 | sub ecx,[temp_buf] |
178 | heavyiron | 1102 | |
297 | mikedld | 1103 | mov esi,[temp_buf] |
178 | heavyiron | 1104 | call get_real_length |
297 | mikedld | 1105 | cmp eax,[cur_editor.Columns.Count] |
178 | heavyiron | 1106 | jbe @f |
297 | mikedld | 1107 | mov [cur_editor.Columns.Count],eax |
178 | heavyiron | 1108 | @@: |
1109 | push ecx |
||
297 | mikedld | 1110 | mov edi,[cur_editor.Lines] |
824 | mikedld | 1111 | add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4] |
259 | mikedld | 1112 | dec edi |
178 | heavyiron | 1113 | lea esi,[edi+8] |
1114 | sub esi,ecx |
||
1115 | movzx eax,word[ebp] |
||
297 | mikedld | 1116 | add esi,eax |
178 | heavyiron | 1117 | movzx eax,word[ebp] |
1118 | movzx eax,word[ebp+eax+4] |
||
297 | mikedld | 1119 | add esi,eax |
178 | heavyiron | 1120 | lea ecx,[esi-4] |
1121 | sub ecx,ebp |
||
1122 | std |
||
1123 | cmp esi,edi |
||
1124 | jb @f |
||
1125 | jz .lp1 |
||
1126 | mov edi,ebp |
||
1127 | add edi,[esp] |
||
1128 | lea esi,[ebp+8] |
||
1129 | movzx eax,word[esi-8] |
||
297 | mikedld | 1130 | add esi,eax |
178 | heavyiron | 1131 | movzx eax,word[esi-4] |
297 | mikedld | 1132 | add esi,eax |
1133 | mov ecx,[cur_editor.Lines] |
||
824 | mikedld | 1134 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
178 | heavyiron | 1135 | sub ecx,esi |
1136 | cld |
||
1137 | @@: rep movsb |
||
1138 | .lp1: pop ecx |
||
297 | mikedld | 1139 | mov esi,[temp_buf] |
178 | heavyiron | 1140 | mov edi,ebp |
1141 | cld |
||
1142 | rep movsb |
||
1143 | |||
1144 | .ok.dec.lines: |
||
297 | mikedld | 1145 | dec [cur_editor.Lines.Count] |
1146 | mov eax,[cur_editor.Lines.Count] |
||
1147 | cmp [cur_editor.Caret.Y],eax |
||
178 | heavyiron | 1148 | jb @f |
1149 | dec eax |
||
297 | mikedld | 1150 | mov [cur_editor.Caret.Y],eax |
1151 | @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
||
1152 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
178 | heavyiron | 1153 | |
280 | mikedld | 1154 | mov ecx,[cur_editor.Lines.Count] |
1155 | call get_line_offset |
||
1156 | movzx eax,word[esi] |
||
1157 | lea esi,[esi+eax+4] |
||
1158 | mov eax,[cur_editor.Lines] |
||
824 | mikedld | 1159 | add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4] |
280 | mikedld | 1160 | sub esi,eax |
1161 | lea eax,[esi+4096] |
||
1162 | call editor_realloc_lines |
||
1163 | |||
297 | mikedld | 1164 | mov [cur_editor.Modified],1 |
178 | heavyiron | 1165 | |
1166 | .exit: |
||
1167 | ret |
||
617 | mikedld | 1168 | endp |
178 | heavyiron | 1169 | |
1170 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1171 | proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE ///////////////////////////// |
1172 | ;----------------------------------------------------------------------------- |
||
178 | heavyiron | 1173 | xor [ins_mode],1 |
297 | mikedld | 1174 | mov eax,[cur_editor.Caret.Y] |
1175 | mov ebx,eax |
||
1176 | call draw_editor_text.part |
||
1177 | call draw_editor_caret |
||
178 | heavyiron | 1178 | ret |
617 | mikedld | 1179 | endp |
178 | heavyiron | 1180 | |
1181 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1182 | proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// |
178 | heavyiron | 1183 | ;----------------------------------------------------------------------------- |
1184 | call delete_selection |
||
297 | mikedld | 1185 | jnc key.del.exit |
178 | heavyiron | 1186 | |
297 | mikedld | 1187 | mov eax,[cur_editor.Caret.X] |
178 | heavyiron | 1188 | dec eax |
1189 | js .line_up |
||
1190 | |||
297 | mikedld | 1191 | dec [cur_editor.Caret.X] |
1192 | mov ecx,[cur_editor.Caret.Y] |
||
178 | heavyiron | 1193 | call get_line_offset |
1194 | and dword[esi],not 0x00020000 |
||
1195 | or dword[esi],0x00010000 |
||
1196 | |||
1197 | mov ebx,eax |
||
1198 | call get_real_length |
||
297 | mikedld | 1199 | cmp eax,[cur_editor.Caret.X] |
178 | heavyiron | 1200 | jae @f |
297 | mikedld | 1201 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
1202 | mov [cur_editor.Modified],1 |
||
178 | heavyiron | 1203 | ret |
1204 | |||
1205 | @@: lea edi,[esi+4+ebx] |
||
1206 | mov ecx,ebx |
||
1207 | neg ecx |
||
1208 | movzx eax,word[esi] |
||
297 | mikedld | 1209 | add ecx,eax |
178 | heavyiron | 1210 | dec ecx |
1211 | lea esi,[edi+1] |
||
1212 | cld |
||
1213 | rep movsb |
||
1214 | mov byte[edi],' ' |
||
1215 | |||
297 | mikedld | 1216 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
1217 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
1218 | mov [cur_editor.Modified],1 |
||
178 | heavyiron | 1219 | ret |
1220 | |||
1221 | .line_up: |
||
297 | mikedld | 1222 | cmp [cur_editor.Caret.Y],0 |
178 | heavyiron | 1223 | jne @f |
1224 | ret |
||
297 | mikedld | 1225 | @@: mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 1226 | dec ecx |
1227 | call get_line_offset |
||
1228 | and dword[esi],not 0x00020000 |
||
1229 | or dword[esi],0x00010000 |
||
1230 | |||
1231 | mov ebp,esi |
||
1232 | lea ebx,[esi+4] |
||
1233 | movzx ecx,word[ebp] |
||
1234 | @@: cmp byte[ebx+ecx-1],' ' |
||
1235 | jne @f |
||
1236 | dec ecx |
||
1237 | jg @b |
||
297 | mikedld | 1238 | @@: mov [cur_editor.Caret.X],ecx |
1239 | dec [cur_editor.Caret.Y] |
||
178 | heavyiron | 1240 | cld |
1241 | jmp key.del.line_up |
||
617 | mikedld | 1242 | endp |
178 | heavyiron | 1243 | |
1244 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1245 | proc key.tab ;///// TABULATE ///////////////////////////////////////////////// |
178 | heavyiron | 1246 | ;----------------------------------------------------------------------------- |
1247 | call delete_selection |
||
297 | mikedld | 1248 | mov eax,[cur_editor.Caret.X] |
178 | heavyiron | 1249 | |
1250 | mov ecx,eax |
||
1251 | add eax,ATABW |
||
1252 | and eax,not(ATABW-1) |
||
1253 | push eax ' ' |
||
1254 | sub eax,ecx |
||
1255 | .direct: |
||
280 | mikedld | 1256 | push eax |
1257 | call editor_realloc_lines |
||
1258 | pop eax |
||
297 | mikedld | 1259 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 1260 | call get_line_offset |
1261 | and dword[esi],not 0x00020000 |
||
1262 | or dword[esi],0x00010000 |
||
1263 | |||
1264 | xchg eax,ecx |
||
1265 | |||
1266 | call get_real_length |
||
297 | mikedld | 1267 | cmp eax,[cur_editor.Caret.X] |
178 | heavyiron | 1268 | jae @f |
297 | mikedld | 1269 | mov eax,[cur_editor.Caret.X] |
178 | heavyiron | 1270 | @@: movzx edx,word[esi] |
1271 | sub edx,eax |
||
1272 | cmp ecx,edx |
||
1273 | jl @f |
||
280 | mikedld | 1274 | push eax |
1275 | mov eax,10 |
||
1276 | call editor_realloc_lines |
||
1277 | add esi,eax |
||
1278 | pop eax |
||
297 | mikedld | 1279 | pushad |
1280 | mov ecx,[cur_editor.Lines] |
||
824 | mikedld | 1281 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
259 | mikedld | 1282 | dec ecx |
297 | mikedld | 1283 | mov edi,ecx |
259 | mikedld | 1284 | add ecx,-10+1 |
178 | heavyiron | 1285 | movzx eax,word[esi] |
280 | mikedld | 1286 | lea eax,[esi+eax+4] |
178 | heavyiron | 1287 | sub ecx,eax |
297 | mikedld | 1288 | lea esi,[edi-10] |
178 | heavyiron | 1289 | std |
1290 | rep movsb |
||
1291 | mov ecx,10 |
||
1292 | mov al,' ' |
||
1293 | rep stosb |
||
297 | mikedld | 1294 | popad |
178 | heavyiron | 1295 | add word[esi],10 |
1296 | jmp @b |
||
1297 | @@: lea ebx,[esi+4] |
||
1298 | push ecx |
||
1299 | movzx edi,word[esi] |
||
1300 | lea edi,[ebx+edi-1] |
||
1301 | mov esi,edi |
||
1302 | sub esi,ecx |
||
1303 | lea ecx,[esi+1] |
||
1304 | sub ecx,ebx |
||
297 | mikedld | 1305 | sub ecx,[cur_editor.Caret.X] |
178 | heavyiron | 1306 | std |
1307 | rep movsb |
||
297 | mikedld | 1308 | .ok: pop ecx |
178 | heavyiron | 1309 | pop eax |
1310 | rep stosb |
||
1311 | cld |
||
297 | mikedld | 1312 | pop [cur_editor.Caret.X] |
178 | heavyiron | 1313 | lea esi,[ebx-4] |
1314 | call get_real_length |
||
297 | mikedld | 1315 | cmp eax,[cur_editor.Caret.X] |
178 | heavyiron | 1316 | jae @f |
297 | mikedld | 1317 | mov eax,[cur_editor.Caret.X] |
1318 | @@: cmp eax,[cur_editor.Columns.Count] |
||
178 | heavyiron | 1319 | jbe @f |
297 | mikedld | 1320 | mov [cur_editor.Columns.Count],eax |
1321 | @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
||
1322 | m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
||
1323 | mov [cur_editor.Modified],1 |
||
178 | heavyiron | 1324 | |
1325 | .exit: |
||
1326 | ret |
||
617 | mikedld | 1327 | endp |
178 | heavyiron | 1328 | |
1329 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1330 | proc key.return ;///// CARRIAGE RETURN /////////////////////////////////////// |
178 | heavyiron | 1331 | ;----------------------------------------------------------------------------- |
1332 | call delete_selection |
||
1333 | |||
280 | mikedld | 1334 | mov eax,14 |
1335 | call editor_realloc_lines |
||
1336 | |||
297 | mikedld | 1337 | mov ecx,[cur_editor.Caret.Y] |
178 | heavyiron | 1338 | call get_line_offset |
1339 | |||
297 | mikedld | 1340 | mov ebx,[cur_editor.Caret.X] |
178 | heavyiron | 1341 | cmp bx,[esi] |
1342 | jb @f |
||
1343 | movzx ebx,word[esi] |
||
1344 | dec ebx |
||
1345 | jns @f |
||
1346 | xor ebx,ebx |
||
1347 | @@: |
||
1348 | cld |
||
1349 | |||
297 | mikedld | 1350 | mov edi,[temp_buf] |
178 | heavyiron | 1351 | mov ebp,esi |
259 | mikedld | 1352 | lea ecx,[ebx+1] |
178 | heavyiron | 1353 | @@: dec ecx |
1354 | jz @f |
||
1355 | cmp byte[esi+ecx+4-1],' ' |
||
1356 | je @b |
||
1357 | @@: lea eax,[ecx+10] |
||
1358 | or eax,0x00010000 |
||
1359 | stosd |
||
1360 | jecxz @f |
||
1361 | push esi |
||
1362 | add esi,4 |
||
1363 | rep movsb |
||
1364 | pop esi |
||
1365 | @@: mov al,' ' |
||
1366 | mov ecx,10 |
||
1367 | rep stosb |
||
1368 | |||
1369 | movzx ecx,word[esi] |
||
297 | mikedld | 1370 | sub ecx,ebx |
1371 | add esi,ebx |
||
178 | heavyiron | 1372 | add esi,4 |
1373 | inc ecx |
||
1374 | @@: dec ecx |
||
1375 | jz @f |
||
1376 | cmp byte[esi+ecx-1],' ' |
||
1377 | je @b |
||
1378 | @@: jz .lp1 |
||
1379 | @@: cmp byte[esi],' ' |
||
1380 | jne .lp1 |
||
1381 | inc esi |
||
1382 | loop @b |
||
1383 | .lp1: test [options],OPTS_AUTOINDENT |
||
1384 | jz .lp2 |
||
1385 | push edi ecx |
||
1386 | movzx ecx,word[ebp] |
||
1387 | lea edi,[ebp+4] |
||
1388 | mov al,' ' |
||
1389 | repe scasb |
||
1390 | mov eax,ecx |
||
1391 | pop ecx edi |
||
1392 | je .lp2 |
||
1393 | neg eax |
||
1394 | movzx edx,word[ebp] |
||
1395 | add eax,edx;[ebp] |
||
1396 | dec eax |
||
1397 | jmp @f |
||
1398 | .lp2: xor eax,eax |
||
1399 | @@: mov edx,edi |
||
1400 | add edi,4 |
||
297 | mikedld | 1401 | mov [cur_editor.Caret.X],eax |
178 | heavyiron | 1402 | jecxz @f |
1403 | push ecx |
||
1404 | mov ecx,eax |
||
1405 | mov al,' ' |
||
1406 | rep stosb |
||
1407 | pop ecx |
||
1408 | @@: jecxz @f |
||
1409 | rep movsb |
||
1410 | @@: mov ecx,10 |
||
1411 | mov al,' ' |
||
1412 | rep stosb |
||
1413 | |||
1414 | lea eax,[edi-4] |
||
1415 | sub eax,edx |
||
1416 | or eax,0x00010000 |
||
1417 | mov [edx],eax |
||
1418 | |||
297 | mikedld | 1419 | mov ecx,edi |
259 | mikedld | 1420 | sub ecx,[temp_buf] |
178 | heavyiron | 1421 | |
1422 | push ecx |
||
297 | mikedld | 1423 | mov edi,[cur_editor.Lines] |
824 | mikedld | 1424 | add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4] |
259 | mikedld | 1425 | dec edi |
178 | heavyiron | 1426 | lea esi,[edi+4] |
1427 | sub esi,ecx |
||
1428 | movzx ecx,word[ebp] |
||
297 | mikedld | 1429 | add esi,ecx |
178 | heavyiron | 1430 | lea ecx,[esi-4] |
1431 | sub ecx,ebp |
||
1432 | std |
||
1433 | cmp esi,edi |
||
1434 | jb @f |
||
1435 | je .lp3 |
||
1436 | lea esi,[ebp+4] |
||
1437 | mov eax,[esp] |
||
1438 | lea edi,[esi+eax-4] |
||
1439 | movzx ecx,word[ebp] |
||
297 | mikedld | 1440 | add esi,ecx |
1441 | mov ecx,[cur_editor.Lines] |
||
824 | mikedld | 1442 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
178 | heavyiron | 1443 | sub ecx,esi |
1444 | cld |
||
1445 | @@: rep movsb |
||
1446 | .lp3: pop ecx |
||
297 | mikedld | 1447 | mov esi,[temp_buf] |
178 | heavyiron | 1448 | mov edi,ebp |
1449 | cld |
||
1450 | rep movsb |
||
1451 | |||
297 | mikedld | 1452 | inc [cur_editor.Caret.Y] |
1453 | inc [cur_editor.SelStart.Y] |
||
1454 | inc [cur_editor.Lines.Count] |
||
178 | heavyiron | 1455 | |
297 | mikedld | 1456 | m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
178 | heavyiron | 1457 | |
297 | mikedld | 1458 | mov [cur_editor.Modified],1 |
178 | heavyiron | 1459 | |
1460 | .exit: |
||
1461 | ret |
||
617 | mikedld | 1462 | endp |
259 | mikedld | 1463 | |
1464 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1465 | proc key.ctrl_tab ;///// SWITCH TO NEXT TAB ////////////////////////////////// |
259 | mikedld | 1466 | ;----------------------------------------------------------------------------- |
1467 | cmp [tab_bar.Items.Count],1 |
||
1468 | je .exit |
||
1469 | xor eax,eax |
||
1470 | mov ebp,[tab_bar.Items] |
||
1471 | @@: cmp ebp,[tab_bar.Current.Ptr] |
||
1472 | je @f |
||
1473 | inc eax |
||
1474 | add ebp,sizeof.TABITEM |
||
1475 | jmp @b |
||
1476 | @@: add ebp,sizeof.TABITEM |
||
1477 | inc eax |
||
1478 | cmp eax,[tab_bar.Items.Count] |
||
1479 | jb @f |
||
1480 | mov ebp,[tab_bar.Items] |
||
1481 | @@: call set_cur_tab |
||
267 | mikedld | 1482 | call make_tab_visible |
259 | mikedld | 1483 | call align_editor_in_tab |
1484 | call draw_editor |
||
1485 | call draw_tabctl |
||
297 | mikedld | 1486 | call update_caption |
259 | mikedld | 1487 | .exit: |
1488 | ret |
||
617 | mikedld | 1489 | endp |
259 | mikedld | 1490 | |
1491 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1492 | proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB //////////////////////// |
259 | mikedld | 1493 | ;----------------------------------------------------------------------------- |
1494 | cmp [tab_bar.Items.Count],1 |
||
1495 | je .exit |
||
1496 | xor eax,eax |
||
1497 | mov ebp,[tab_bar.Items] |
||
1498 | @@: cmp ebp,[tab_bar.Current.Ptr] |
||
1499 | je @f |
||
1500 | inc eax |
||
1501 | add ebp,sizeof.TABITEM |
||
1502 | jmp @b |
||
1503 | @@: add ebp,-sizeof.TABITEM |
||
1504 | dec eax |
||
1505 | jge @f |
||
1506 | imul eax,[tab_bar.Items.Count],sizeof.TABITEM |
||
1507 | add eax,[tab_bar.Items] |
||
1508 | lea ebp,[eax-sizeof.TABITEM] |
||
1509 | @@: call set_cur_tab |
||
267 | mikedld | 1510 | call make_tab_visible |
259 | mikedld | 1511 | call align_editor_in_tab |
1512 | call draw_editor |
||
1513 | call draw_tabctl |
||
297 | mikedld | 1514 | call update_caption |
259 | mikedld | 1515 | .exit: |
1516 | ret |
||
617 | mikedld | 1517 | endp |
267 | mikedld | 1518 | |
1519 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1520 | proc key.ctrl_f4 ;///// CLOSE CURRENT TAB //////////////////////////////////// |
267 | mikedld | 1521 | ;----------------------------------------------------------------------------- |
629 | mikedld | 1522 | cmp [cur_editor.Modified],0 |
595 | Rus | 1523 | je .close |
629 | mikedld | 1524 | mov [bot_mode2],2 |
595 | Rus | 1525 | jmp key.ctrl_o.direct |
1526 | .close: |
||
297 | mikedld | 1527 | mov [do_not_draw],1 |
1528 | push [tab_bar.Current.Ptr] |
||
1529 | cmp [tab_bar.Items.Count],1 |
||
267 | mikedld | 1530 | jne @f |
595 | Rus | 1531 | ;call create_tab |
1532 | jmp key.alt_x.close ; close program |
||
297 | mikedld | 1533 | @@: pop ebp |
1534 | call delete_tab |
||
1535 | dec [do_not_draw] |
||
1536 | call align_editor_in_tab |
||
1537 | call draw_editor |
||
1538 | call draw_tabctl |
||
1539 | call draw_statusbar |
||
1540 | ret |
||
617 | mikedld | 1541 | endp |
280 | mikedld | 1542 | |
1543 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1544 | proc key.shift_f9 ;///// SET DEFAULT TAB ///////////////////////////////////// |
280 | mikedld | 1545 | ;----------------------------------------------------------------------------- |
1546 | mov eax,[tab_bar.Current.Ptr] |
||
1547 | cmp eax,[tab_bar.Default.Ptr] |
||
1548 | jne @f |
||
1549 | xor eax,eax |
||
1550 | @@: mov [tab_bar.Default.Ptr],eax |
||
1551 | mov ebp,[tab_bar.Current.Ptr] |
||
1552 | call make_tab_visible |
||
1553 | cmp [tab_bar.Style],2 |
||
1554 | jbe @f |
||
1555 | call align_editor_in_tab |
||
1556 | call draw_editor |
||
1557 | @@: call draw_tabctl |
||
1558 | ret |
||
617 | mikedld | 1559 | endp |
297 | mikedld | 1560 | |
1561 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1562 | proc key.f3 ;///// FIND NEXT MATCH /////////////////////////////////////////// |
297 | mikedld | 1563 | ;----------------------------------------------------------------------------- |
1564 | call search |
||
1565 | jc @f |
||
1566 | @@: ret |
||
617 | mikedld | 1567 | endp |
297 | mikedld | 1568 | |
1569 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1570 | proc key.f9 ;///// COMPILE AND RUN /////////////////////////////////////////// |
297 | mikedld | 1571 | ;----------------------------------------------------------------------------- |
1572 | mov bl,1 |
||
1573 | call start_fasm |
||
1574 | ret |
||
617 | mikedld | 1575 | endp |
297 | mikedld | 1576 | |
1577 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1578 | proc key.ctrl_f9 ;///// COMPILE ////////////////////////////////////////////// |
297 | mikedld | 1579 | ;----------------------------------------------------------------------------- |
1580 | mov bl,0 |
||
1581 | call start_fasm |
||
1582 | ret |
||
617 | mikedld | 1583 | endp |
297 | mikedld | 1584 | |
1585 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 1586 | proc key.alt_x ;///// EXIT PROGRAM /////////////////////////////////////////// |
297 | mikedld | 1587 | ;----------------------------------------------------------------------------- |
629 | mikedld | 1588 | mov [main_closing],1 |
1589 | mov eax,[tab_bar.Items] |
||
1590 | mov [exit_tab_item],eax |
||
1591 | mov eax,[tab_bar.Items.Count] |
||
1592 | mov [exit_tab_num],eax |
||
1593 | .direct: |
||
1594 | call try_to_close_tabs |
||
1595 | or eax,eax |
||
1596 | jz .close |
||
1597 | mov [bot_mode2],2 |
||
1598 | jmp key.ctrl_o.direct |
||
1599 | |||
1600 | .close: |
||
297 | mikedld | 1601 | mov esi,self_path |
1602 | mov byte[esi+PATHL-1],0 |
||
1603 | mov edi,f_info.path |
||
1604 | cld |
||
1605 | @@: lodsb |
||
1606 | stosb |
||
1607 | or al,al |
||
1608 | jnz @b |
||
1609 | |||
1610 | mov [f_info70+0],2 |
||
1611 | mov [f_info70+4],0 |
||
1612 | mov [f_info70+8],0 |
||
1613 | mov [f_info70+12],TINYPAD_END |
||
1614 | mov [f_info70+16],0 |
||
1615 | mov byte[f_info70+20],0 |
||
1616 | mov [f_info70+21],f_info.path |
||
1617 | mcall 70,f_info70 |
||
1618 | |||
1619 | mov [main_closed],1 |
||
1620 | mcall -1 |
||
617 | mikedld | 1621 | endp |
629 | mikedld | 1622 | |
1623 | ;----------------------------------------------------------------------------- |
||
1624 | proc try_to_close_tabs ;///// FIND TABS TO BE SAVED BEFORE CLOSE ///////////// |
||
1625 | ;----------------------------------------------------------------------------- |
||
1626 | push ecx ebp |
||
1627 | call flush_cur_tab |
||
1628 | mov ebp,[exit_tab_item] ; [tab_bar.Items] |
||
1629 | add ebp,-sizeof.TABITEM |
||
1630 | @@: dec [exit_tab_num] |
||
1631 | js .ok |
||
1632 | add ebp,sizeof.TABITEM |
||
1633 | mov al,[ebp+TABITEM.Editor.Modified] |
||
1634 | cmp [ebp+TABITEM.Editor.Modified],0 |
||
1635 | je @b |
||
1636 | mov [exit_tab_item],ebp |
||
1637 | call set_cur_tab |
||
1638 | call make_tab_visible |
||
1639 | xor eax,eax |
||
1640 | inc eax |
||
1641 | @@: pop ebp ecx |
||
1642 | ret |
||
1643 | .ok: xor eax,eax |
||
1644 | jmp @b |
||
1645 | endp |