Subversion Repositories Kolibri OS

Rev

Rev 824 | Rev 987 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 824 Rev 826
Line 1... Line 1...
1
diff16 'tp-key.asm',0,$
1
diff16 'tp-key.asm',0,$
Line 2... Line 2...
2
 
2
 
3
key:
3
key:
4
	mov	ecx,1
4
	mov	ecx,1
-
 
5
	mcall	66,3
5
	mcall	66,3
6
	mov	[shi],eax
6
	xor	ebx,ebx
7
	xor	ebx,ebx
7
	test	al,0x03
8
	test	al,0x03
8
	jz	@f
9
	jz	@f
9
	or	ebx,KM_SHIFT
10
	or	ebx,KM_SHIFT
10
    @@: test	al,0x0C
11
    @@: test	al,0x0C
11
	jz	@f
12
	jz	@f
12
	or	ebx,KM_CTRL
13
	or	ebx,KM_CTRL
13
    @@: test	al,0x30
14
    @@: test	al,0x30
14
	jz	@f
15
	jz	@f
15
	or	ebx,KM_ALT
16
	or	ebx,KM_ALT
16
    @@: mov	[shi],ebx
17
    @@: mov	edx,ebx
17
	test	al,0x03
18
	test	al,0x03
18
	jz	@f
19
	jz	@f
19
	inc	cl
20
	inc	cl
20
    @@: mcall	26,2,,key1
-
 
21
 
21
    @@:
22
	mcall	2
22
	mcall	2
23
	cmp	al,0
23
	cmp	al,0
24
	jne	still.skip_write
24
	jne	still.skip_write
25
	shr	eax,8
25
	shr	eax,8
Line 32... Line 32...
32
	mov	[ext],0x02
32
	mov	[ext],0x02
33
	jmp	still.skip_write
33
	jmp	still.skip_write
34
    @@:
34
    @@:
35
	mov	ah,[ext]
35
	mov	ah,[ext]
36
	mov	[ext],0
36
	mov	[ext],0
37
	or	eax,[shi]
-
 
Line -... Line 37...
-
 
37
 
-
 
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
38
 
60
 
39
	test	al,0x80
61
  .lp0: test	al,0x80
-
 
62
	jnz	still.skip_write
-
 
63
 
-
 
64
	push	eax
-
 
65
	mcall	26,2,,key1
-
 
66
	pop	eax
40
	jnz	still.skip_write
67
 
Line 41... Line 68...
41
	mov	[chr],al
68
	mov	[chr],eax
42
 
69
 
43
	cmp	[bot_mode],0
70
	cmp	[bot_mode],0
44
	je	@f
71
	je	@f
Line 58... Line 85...
58
  .lp1: mov	[s_status],0
85
  .lp1: mov	[s_status],0
59
	call	dword[esi+4]
86
	call	dword[esi+4]
60
	call	editor_check_for_changes
87
	call	editor_check_for_changes
61
	jmp	still
88
	jmp	still
62
    @@: add	esi,8
89
    @@: add	esi,8
63
	cmp	byte[esi],0
90
	cmp	dword[esi],0
64
	jne	.acc
91
	jne	.acc
Line 65... Line 92...
65
 
92
 
66
	test	dword[shi],KM_CTRLALT
93
	test	[chr],KM_CTRLALT
Line 67... Line 94...
67
	jnz	still.skip_write
94
	jnz	still.skip_write
Line 68... Line 95...
68
 
95
 
69
	mov	[s_status],0
96
	mov	[s_status],0
70
 
97
 
71
	movzx	eax,[chr]
98
	movzx	eax,byte[chr]
72
	movzx	eax,[eax+key0]
99
	movzx	eax,[eax+key0]
73
	or	al,al
100
	or	al,al
Line 301... Line 328...
301
	jmp	.lp2
328
	jmp	.lp2
302
    @@:
329
    @@:
303
	inc	edx
330
	inc	edx
304
	mov	[cur_editor.Caret.Y],ebx
331
	mov	[cur_editor.Caret.Y],ebx
305
	mov	[cur_editor.Caret.X],edx
332
	mov	[cur_editor.Caret.X],edx
306
	test	byte[shi+2],0x01
333
	test	[chr],KM_SHIFT
307
	jnz	@f
334
	jnz	@f
308
	mov	[cur_editor.SelStart.Y],ebx
335
	mov	[cur_editor.SelStart.Y],ebx
309
	mov	[cur_editor.SelStart.X],edx
336
	mov	[cur_editor.SelStart.X],edx
310
    @@: sub	ebx,[cur_editor.TopLeft.Y]
337
    @@: sub	ebx,[cur_editor.TopLeft.Y]
311
	jge	@f
338
	jge	@f
Line 387... Line 414...
387
	xor	edx,edx
414
	xor	edx,edx
388
	jmp	.lp2
415
	jmp	.lp2
389
    @@:
416
    @@:
390
	mov	[cur_editor.Caret.Y],ebx
417
	mov	[cur_editor.Caret.Y],ebx
391
	mov	[cur_editor.Caret.X],edx
418
	mov	[cur_editor.Caret.X],edx
392
	test	byte[shi+2],0x01
419
	test	[chr],KM_SHIFT
393
	jnz	@f
420
	jnz	@f
394
	mov	[cur_editor.SelStart.Y],ebx
421
	mov	[cur_editor.SelStart.Y],ebx
395
	mov	[cur_editor.SelStart.X],edx
422
	mov	[cur_editor.SelStart.X],edx
396
    @@: sub	ebx,[cur_editor.TopLeft.Y]
423
    @@: sub	ebx,[cur_editor.TopLeft.Y]
397
	cmp	ebx,[lines.scr]
424
	cmp	ebx,[lines.scr]
Line 729... Line 756...
729
	cmp	eax,ecx
756
	cmp	eax,ecx
730
	jae	@f
757
	jae	@f
731
	dec	ecx
758
	dec	ecx
732
	jns	@f
759
	jns	@f
733
	xor	ecx,ecx
760
	xor	ecx,ecx
734
    @@: test	byte[shi+2],0x01
761
    @@: test	[chr],KM_SHIFT
735
	jnz	@f
762
	jnz	@f
736
	mov	[cur_editor.SelStart.Y],eax
763
	mov	[cur_editor.SelStart.Y],eax
737
    @@: mov	[cur_editor.Caret.Y],eax
764
    @@: mov	[cur_editor.Caret.Y],eax
738
	mov	[cur_editor.TopLeft.Y],ecx
765
	mov	[cur_editor.TopLeft.Y],ecx
Line 759... Line 786...
759
	mov	edx,eax
786
	mov	edx,eax
760
	sub	edx,ecx
787
	sub	edx,ecx
761
	cmp	edx,[lines.scr]
788
	cmp	edx,[lines.scr]
762
	jb	@f
789
	jb	@f
763
	inc	ecx
790
	inc	ecx
764
    @@: test	byte[shi+2],0x01
791
    @@: test	[chr],KM_SHIFT
765
	jnz	@f
792
	jnz	@f
766
	mov	[cur_editor.SelStart.Y],eax
793
	mov	[cur_editor.SelStart.Y],eax
767
    @@: mov	[cur_editor.Caret.Y],eax
794
    @@: mov	[cur_editor.Caret.Y],eax
768
	mov	[cur_editor.TopLeft.Y],ecx
795
	mov	[cur_editor.TopLeft.Y],ecx
Line 781... Line 808...
781
;-----------------------------------------------------------------------------
808
;-----------------------------------------------------------------------------
782
	mov	eax,[cur_editor.Caret.X]
809
	mov	eax,[cur_editor.Caret.X]
783
	dec	eax
810
	dec	eax
784
	jns	@f
811
	jns	@f
785
	inc	eax
812
	inc	eax
786
    @@: test	byte[shi+2],0x01
813
    @@: test	[chr],KM_SHIFT
787
	jnz	@f
814
	jnz	@f
788
	mov	[cur_editor.SelStart.X],eax
815
	mov	[cur_editor.SelStart.X],eax
789
    @@: mov	[cur_editor.Caret.X],eax
816
    @@: mov	[cur_editor.Caret.X],eax
Line 790... Line 817...
790
 
817
 
Line 803... Line 830...
803
	mov	eax,[cur_editor.Caret.X]
830
	mov	eax,[cur_editor.Caret.X]
804
	inc	eax
831
	inc	eax
805
	cmp	eax,[cur_editor.Columns.Count]
832
	cmp	eax,[cur_editor.Columns.Count]
806
	jbe	@f
833
	jbe	@f
807
	dec	eax
834
	dec	eax
808
    @@: test	byte[shi+2],0x01
835
    @@: test	[chr],KM_SHIFT
809
	jnz	@f
836
	jnz	@f
810
	mov	[cur_editor.SelStart.X],eax
837
	mov	[cur_editor.SelStart.X],eax
811
    @@: mov	[cur_editor.Caret.X],eax
838
    @@: mov	[cur_editor.Caret.X],eax
Line 812... Line 839...
812
 
839
 
Line 830... Line 857...
830
	jns	@f
857
	jns	@f
831
	xor	eax,eax
858
	xor	eax,eax
832
    @@: sub	ecx,edx
859
    @@: sub	ecx,edx
833
	jns	@f
860
	jns	@f
834
	xor	ecx,ecx
861
	xor	ecx,ecx
835
    @@: test	byte[shi+2],0x01
862
    @@: test	[chr],KM_SHIFT
836
	jnz	@f
863
	jnz	@f
837
	mov	[cur_editor.SelStart.Y],eax
864
	mov	[cur_editor.SelStart.Y],eax
838
    @@: mov	[cur_editor.Caret.Y],eax
865
    @@: mov	[cur_editor.Caret.Y],eax
839
	mov	[cur_editor.TopLeft.Y],ecx
866
	mov	[cur_editor.TopLeft.Y],ecx
Line 858... Line 885...
858
	add	ecx,edx
885
	add	ecx,edx
859
	cmp	eax,[cur_editor.Lines.Count]
886
	cmp	eax,[cur_editor.Lines.Count]
860
	jb	@f
887
	jb	@f
861
	mov	eax,[cur_editor.Lines.Count]
888
	mov	eax,[cur_editor.Lines.Count]
862
	dec	eax
889
	dec	eax
863
    @@: test	byte[shi+2],0x01
890
    @@: test	[chr],KM_SHIFT
864
	jnz	@f
891
	jnz	@f
865
	mov	[cur_editor.SelStart.Y],eax
892
	mov	[cur_editor.SelStart.Y],eax
866
    @@: mov	[cur_editor.Caret.Y],eax
893
    @@: mov	[cur_editor.Caret.Y],eax
867
	mov	[cur_editor.TopLeft.Y],ecx
894
	mov	[cur_editor.TopLeft.Y],ecx
Line 877... Line 904...
877
 
904
 
878
;-----------------------------------------------------------------------------
905
;-----------------------------------------------------------------------------
879
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
906
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
880
;-----------------------------------------------------------------------------
907
;-----------------------------------------------------------------------------
881
	mov	[cur_editor.Caret.X],0
908
	mov	[cur_editor.Caret.X],0
882
	test	byte[shi+2],0x01
909
	test	[chr],KM_SHIFT
883
	jnz	@f
910
	jnz	@f
884
	mov	[cur_editor.SelStart.X],0
911
	mov	[cur_editor.SelStart.X],0
Line 885... Line 912...
885
    @@:
912
    @@:
Line 898... Line 925...
898
;-----------------------------------------------------------------------------
925
;-----------------------------------------------------------------------------
899
	mov	ecx,[cur_editor.Caret.Y]
926
	mov	ecx,[cur_editor.Caret.Y]
900
	call	get_line_offset
927
	call	get_line_offset
901
	call	get_real_length
928
	call	get_real_length
902
	mov	[cur_editor.Caret.X],eax
929
	mov	[cur_editor.Caret.X],eax
903
	test	byte[shi+2],0x01
930
	test	[chr],KM_SHIFT
904
	jnz	@f
931
	jnz	@f
905
	mov	[cur_editor.SelStart.X],eax
932
	mov	[cur_editor.SelStart.X],eax
906
    @@:
933
    @@:
Line 907... Line 934...
907
 
934
 
Line 917... Line 944...
917
;-----------------------------------------------------------------------------
944
;-----------------------------------------------------------------------------
918
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
945
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
919
;-----------------------------------------------------------------------------
946
;-----------------------------------------------------------------------------
920
	mov	eax,[cur_editor.TopLeft.Y]
947
	mov	eax,[cur_editor.TopLeft.Y]
921
	mov	ecx,eax
948
	mov	ecx,eax
922
	test	byte[shi+2],0x01
949
	test	[chr],KM_SHIFT
923
	jnz	@f
950
	jnz	@f
924
	mov	[cur_editor.SelStart.Y],eax
951
	mov	[cur_editor.SelStart.Y],eax
925
    @@: mov	[cur_editor.Caret.Y],eax
952
    @@: mov	[cur_editor.Caret.Y],eax
926
	mov	[cur_editor.TopLeft.Y],ecx
953
	mov	[cur_editor.TopLeft.Y],ecx
Line 942... Line 969...
942
	cmp	eax,[cur_editor.Lines.Count]
969
	cmp	eax,[cur_editor.Lines.Count]
943
	jle	@f
970
	jle	@f
944
	mov	eax,[cur_editor.Lines.Count]
971
	mov	eax,[cur_editor.Lines.Count]
945
    @@: add	eax,ecx
972
    @@: add	eax,ecx
946
	dec	eax
973
	dec	eax
947
	test	byte[shi+2],0x01
974
	test	[chr],KM_SHIFT
948
	jnz	@f
975
	jnz	@f
949
	mov	[cur_editor.SelStart.Y],eax
976
	mov	[cur_editor.SelStart.Y],eax
950
    @@: mov	[cur_editor.Caret.Y],eax
977
    @@: mov	[cur_editor.Caret.Y],eax
951
	mov	[cur_editor.TopLeft.Y],ecx
978
	mov	[cur_editor.TopLeft.Y],ecx
Line 963... Line 990...
963
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
990
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
964
;-----------------------------------------------------------------------------
991
;-----------------------------------------------------------------------------
965
	xor	eax,eax
992
	xor	eax,eax
966
	mov	[cur_editor.TopLeft.Y],eax
993
	mov	[cur_editor.TopLeft.Y],eax
967
	mov	[cur_editor.Caret.Y],eax
994
	mov	[cur_editor.Caret.Y],eax
968
	test	byte[shi+2],0x01
995
	test	[chr],KM_SHIFT
969
	jnz	@f
996
	jnz	@f
970
	mov	[cur_editor.SelStart.Y],eax
997
	mov	[cur_editor.SelStart.Y],eax
971
    @@:
998
    @@:
Line 972... Line 999...
972
 
999
 
Line 987... Line 1014...
987
	sub	eax,[lines.scr]
1014
	sub	eax,[lines.scr]
988
	jns	@f
1015
	jns	@f
989
	xor	eax,eax
1016
	xor	eax,eax
990
    @@: mov	[cur_editor.TopLeft.Y],eax
1017
    @@: mov	[cur_editor.TopLeft.Y],eax
991
	dec	[cur_editor.Caret.Y]
1018
	dec	[cur_editor.Caret.Y]
992
	test	byte[shi+2],0x01
1019
	test	[chr],KM_SHIFT
993
	jnz	@f
1020
	jnz	@f
994
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
1021
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
995
    @@:
1022
    @@:
Line 996... Line 1023...
996
 
1023