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