Subversion Repositories Kolibri OS

Rev

Rev 4987 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4987 Rev 4988
Line 1... Line 1...
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 27.06.2014 IgorA
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 28.06.2014 IgorA
4
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
4
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
Line 5... Line 5...
5
 
5
 
6
;input:
6
;input:
7
; edi = pointer to tedit struct
7
; edi = pointer to tedit struct
Line 25... Line 25...
25
TED_PANEL_NULL	 equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
25
TED_PANEL_NULL	 equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
26
TED_PANEL_FIND	 equ 1 ;¯ ­¥«ì ¯®¨áª 
26
TED_PANEL_FIND	 equ 1 ;¯ ­¥«ì ¯®¨áª 
27
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
27
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
28
TED_PANEL_WIDTH  equ 150 ;è¨à¨­  ¯ ­¥«¨
28
TED_PANEL_WIDTH  equ 150 ;è¨à¨­  ¯ ­¥«¨
Line -... Line 29...
-
 
29
 
29
 
30
TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥
30
MAX_COLOR_WORD_LEN equ 40
31
MAX_COLOR_WORD_LEN equ 40
31
;------------------------------------------------------------------------------
32
;------------------------------------------------------------------------------
32
struct TexSelect
33
struct TexSelect
33
  x0 dd ?
34
	x0 dd ?
Line 157... Line 158...
157
		mov dword[ebx+sb_offs_line_col],ecx
158
		mov dword[ebx+sb_offs_line_col],ecx
158
	@@:
159
	@@:
159
	bt dword[opt],2 ; ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â  ?
160
	bt dword[opt],2 ; ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â  ?
160
	jae .doc_resize
161
	jae .doc_resize
161
		call ted_get_num_lines
162
		call ted_get_num_lines
162
		cmp eax,100
163
		cmp eax,TED_LINES_IN_NEW_FILE
163
		jge @f
164
		jge @f
164
			mov eax,100
165
			mov eax,TED_LINES_IN_NEW_FILE
165
		@@:
166
		@@:
166
		mov dword[esi+sb_offs_max_area],eax
167
		mov dword[esi+sb_offs_max_area],eax
167
	.doc_resize:
168
	.doc_resize:
168
	bt dword[opt],1 ; ¨§¬¥­¨«¨áì à §¬¥àë ®ª­  ?
169
	bt dword[opt],1 ; ¨§¬¥­¨«¨áì à §¬¥àë ®ª­  ?
169
	jae .no_size
170
	jae .no_size
Line 241... Line 242...
241
		jmp .end_key_fun
242
		jmp .end_key_fun
242
	@@:
243
	@@:
Line 243... Line 244...
243
 
244
 
244
	test esi,KM_CTRL ;Ctrl+...
245
	test esi,KM_CTRL ;Ctrl+...
-
 
246
	jz .key_Ctrl
245
	jz .key_Ctrl
247
		; *** ¢ë§®¢ ¢­¥è­¨å ä㭪権 ª®â®àë¥ âॡãîâ ®ª­  ®âªàëâ¨ï/á®åà ­¥­¨ï/¯®¨áª /...
246
		cmp ah,24 ;Ctrl+O
248
		cmp ah,24 ;Ctrl+O
247
		jne @f
249
		jne @f
248
			cmp ted_fun_on_key_ctrl_o,0
250
			cmp ted_fun_on_key_ctrl_o,0
249
			je @f
251
			je @f
Line 261... Line 263...
261
		je @f
263
		je @f
262
			cmp ted_fun_on_key_ctrl_f,0
264
			cmp ted_fun_on_key_ctrl_f,0
263
			je @f
265
			je @f
264
				call ted_fun_on_key_ctrl_f
266
				call ted_fun_on_key_ctrl_f
265
		@@:
267
		@@:
-
 
268
		cmp ah,49 ;Ctrl+N
-
 
269
		jne @f
-
 
270
			cmp ted_fun_on_key_ctrl_n,0
-
 
271
			je @f
-
 
272
				call ted_fun_on_key_ctrl_n
-
 
273
		@@:
-
 
274
		; *** ¢ë§®¢ ¢­ãâ७­¨å ä㭪権
-
 
275
		cmp ah,30 ;Ctrl+A
-
 
276
		jne @f
-
 
277
			call ted_sel_all
-
 
278
		@@:
266
		cmp ah,44 ;Ctrl+Z
279
		cmp ah,44 ;Ctrl+Z
267
		jne @f
280
		jne @f
268
			stdcall ted_but_undo,edi
281
			stdcall ted_but_undo,edi
269
		@@:
282
		@@:
270
		cmp ah,46 ;Ctrl+C
283
		cmp ah,46 ;Ctrl+C
Line 273... Line 286...
273
		@@:
286
		@@:
274
		cmp ah,47 ;Ctrl+V
287
		cmp ah,47 ;Ctrl+V
275
		jne @f
288
		jne @f
276
			stdcall ted_but_paste,edi
289
			stdcall ted_but_paste,edi
277
		@@:
290
		@@:
278
		cmp ah,49 ;Ctrl+N
-
 
279
		jne @f
-
 
280
			cmp ted_fun_on_key_ctrl_n,0
-
 
281
			je @f
-
 
282
				call ted_fun_on_key_ctrl_n
-
 
283
		@@:
-
 
284
		cmp ah,199 ;Ctrl+Home
291
		cmp ah,199 ;Ctrl+Home
285
		jne @f
292
		jne @f
286
			call ted_key_ctrl_home
293
			call ted_key_ctrl_home
287
		@@:
294
		@@:
-
 
295
		cmp ah,207 ;Ctrl+End
-
 
296
		jne @f
-
 
297
			call ted_key_ctrl_end
-
 
298
		@@:
288
		jmp .end_key_fun
299
		jmp .end_key_fun
289
	.key_Ctrl:
300
	.key_Ctrl:
Line 290... Line 301...
290
 
301
 
291
	test esi,KM_SHIFT ;Shift+...
302
	test esi,KM_SHIFT ;Shift+...
Line 644... Line 655...
644
	@@:
655
	@@:
645
	ret
656
	ret
646
endp
657
endp
Line 647... Line 658...
647
 
658
 
-
 
659
;input:
-
 
660
; edi = pointer to tedit struct
-
 
661
;description:
-
 
662
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¢ë¤¥«¥­¨¨ ¢á¥£® ¤®ªã¬¥­â 
-
 
663
align 4
-
 
664
proc ted_sel_all
-
 
665
	push eax
-
 
666
		xor eax,eax
-
 
667
		mov ted_sel_x0,eax
-
 
668
		mov ted_sel_y0,eax
-
 
669
 
-
 
670
		mov ted_sel_x1,eax ;???
-
 
671
		call ted_get_num_lines
-
 
672
		mov ted_sel_y1,eax
-
 
673
	pop eax
-
 
674
	stdcall ted_draw,edi
-
 
675
	cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy)
-
 
676
	je @f
-
 
677
		call ted_fun_draw_panel_buttons
-
 
678
	@@:
-
 
679
	ret
-
 
680
endp
-
 
681
 
648
;input:
682
;input:
649
; cl_al_mem = 1 - clear all memory
683
; cl_al_mem = 1 - clear all memory
650
align 4
684
align 4
651
proc ted_clear, edit:dword, cl_al_mem:dword
685
proc ted_clear, edit:dword, cl_al_mem:dword
652
	push ecx edi
686
	push ecx edi
Line 849... Line 883...
849
			mov dword[edx+14],0
883
			mov dword[edx+14],0
850
		jmp @b
884
		jmp @b
851
	@@:
885
	@@:
Line 852... Line 886...
852
 
886
 
853
	call ted_get_num_lines
887
	call ted_get_num_lines
854
	cmp eax,100
888
	cmp eax,TED_LINES_IN_NEW_FILE
855
	jge @f
889
	jge @f
856
		mov eax,100
890
		mov eax,TED_LINES_IN_NEW_FILE
857
	@@:
891
	@@:
858
	mov esi,ted_scr_w
892
	mov esi,ted_scr_w
859
	mov dword[esi+sb_offs_max_area],eax
893
	mov dword[esi+sb_offs_max_area],eax
Line 1009... Line 1043...
1009
    jne @f
1043
		jne @f
1010
    cmp edx,ted_tex_1
1044
		cmp edx,ted_tex_1
1011
    jle @f
1045
		jle @f
1012
    jmp @b
1046
		jmp @b
1013
  @@:
1047
	@@:
1014
  ;call ted_iterat_next
-
 
1015
  ret
1048
	ret
Line 1016... Line 1049...
1016
 
1049
 
1017
;input:
1050
;input:
1018
; edx = pointer to symbol struct
1051
; edx = pointer to symbol struct
Line 2849... Line 2882...
2849
	ret
2882
	ret
Line 2850... Line 2883...
2850
 
2883
 
2851
;input:
2884
;input:
2852
; edi = pointer to tedit struct
2885
; edi = pointer to tedit struct
-
 
2886
align 4
-
 
2887
ted_key_ctrl_end:
-
 
2888
	push eax ebx
-
 
2889
		call ted_get_num_lines
-
 
2890
		mov ebx,ted_scr_w
-
 
2891
		mov dword[ebx+sb_offs_position],eax ;áâ ¢¨¬ ¯®«§ã­®ª ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
-
 
2892
		cmp eax,dword[ebx+sb_offs_cur_area]
-
 
2893
		jle @f
-
 
2894
			mov eax,dword[ebx+sb_offs_cur_area] ;¯®«ãç ¥¬ ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­®
-
 
2895
		@@:
-
 
2896
		sub dword[ebx+sb_offs_position],eax ;®â­¨¬ ¥¬ ®â ¯®«§ã­ª  ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­® (­® ­¥ ¡®«ìè¥ â¥å, çâ® ¥áâì ¢ ¤®ªã¬¥­â¥)
-
 
2897
		dec eax
-
 
2898
		mov ted_cur_y,eax ;áâ ¢¨¬ ªãàá®à ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
-
 
2899
	pop ebx eax
-
 
2900
	call ted_cur_move_x_last_char
-
 
2901
	stdcall ted_draw,edi
-
 
2902
	cmp ted_fun_draw_panel_buttons,0
-
 
2903
	je @f
-
 
2904
		call ted_fun_draw_panel_buttons
-
 
2905
	@@:
-
 
2906
	ret
-
 
2907
 
-
 
2908
;input:
-
 
2909
; edi = pointer to tedit struct
2853
align 4
2910
align 4
2854
proc ted_sel_key_up
2911
proc ted_sel_key_up
2855
  cmp ted_drag_k,1
2912
  cmp ted_drag_k,1
2856
  je @f
2913
  je @f
2857
    call ted_sel_start
2914
    call ted_sel_start
Line 3179... Line 3236...
3179
		mov si,1
3236
		mov si,1
3180
		ror ebx,16
3237
		ror ebx,16
3181
		jmp @b
3238
		jmp @b
3182
	.no_draw_text:
3239
	.no_draw_text:
Line -... Line 3240...
-
 
3240
 
3183
 
3241
	inc dword[line_num]
3184
	stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
3242
	stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
3185
	call ted_draw_line_numbers
3243
	call ted_draw_line_numbers
Line 3186... Line 3244...
3186
	call ted_draw_main_cursor
3244
	call ted_draw_main_cursor
Line 3674... Line 3732...
3674
 
3732
 
3675
	sub ebx,0x10001 ;®â­¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3733
	sub ebx,0x10001 ;®â­¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3676
	cmp dword[clear_o],0
3734
	cmp dword[clear_o],0
3677
	jne @f
3735
	jne @f
3678
		add ebx,ted_rec_h
-
 
3679
		inc esi
3736
		add ebx,ted_rec_h
3680
		ror ebx,16
3737
		ror ebx,16
3681
		xor bx,bx
3738
		xor bx,bx
3682
		add ebx,ted_wnd_l
3739
		add ebx,ted_wnd_l
3683
		add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l
3740
		add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l
Line 3704... Line 3761...
3704
	je .pusto
3761
	je .pusto
3705
	cmp ax,cx
3762
	cmp ax,cx
3706
	jge @f
3763
	jge @f
3707
	.pusto:
3764
	.pusto:
3708
		mov cx,ax
3765
		mov cx,ax
-
 
3766
		jmp .no_select ;¥á«¨ ®ç¨á⪠ ®ª­  ¤® ­¨§ã, â® ¢á¥£¤  ä®­®¢ë¬ 梥⮬
3709
	@@:
3767
	@@:
Line 3710... Line 3768...
3710
 
3768
 
3711
	call ted_is_select
3769
	call ted_is_select
3712
	cmp al,0
3770
	cmp al,0
3713
	je @f
3771
	je .no_select
3714
	cmp ted_seln_y0,esi
3772
	cmp ted_seln_y0,esi
3715
	jg @f
3773
	jg .no_select
3716
	cmp ted_seln_y1,esi
3774
	cmp ted_seln_y1,esi
3717
	jl @f
3775
	jl .no_select
3718
		mov edx,ted_color_select ;draw selected line
3776
		mov edx,ted_color_select ;draw selected line
Line 3719... Line 3777...
3719
	@@:
3777
	.no_select:
3720
 
-
 
-
 
3778
 
Line 3721... Line 3779...
3721
	mov eax,13 ;rect
3779
	mov eax,13 ;rect
3722
	int 0x40
3780
	int 0x40 ;§ ªà áª  ¯®«­®© áâப¨ 梥⮬ ä®­  ¨«¨ 梥⮬ ¢ë¤¥«¥­¨ï
3723
 
3781
 
Line 3746... Line 3804...
3746
		int 0x40
3804
		int 0x40
3747
		pop esi bx
3805
		pop esi bx
3748
	@@:
3806
	@@:
3749
	cmp ted_seln_y1,esi
3807
	cmp ted_seln_y1,esi
3750
	jne @f
3808
	jne @f
3751
		push esi
3809
		;push esi
-
 
3810
		;¥á«¨ ¢ë¤¥«¥­ ¢¥áì ä ©« âãâ ¬®¦­® ᤥ« âì ¢ë室, ­® ⮣¤  ­ã¦­® ¢ëè¥ ã¡à âì jmp .no_select
3752
		mov edx,ted_seln_x1 ; ­¨¦­ïï ¯®«®á  (§ â¨à ¥â á¯à ¢ )
3811
		mov edx,ted_seln_x1 ; ­¨¦­ïï ¯®«®á  (§ â¨à ¥â á¯à ¢ )
3753
		mov esi,ted_scr_h
3812
		mov esi,ted_scr_h
3754
		cmp edx,dword[esi+sb_offs_position]
3813
		cmp edx,dword[esi+sb_offs_position]
3755
		jle .in_wnd2
3814
		jle .in_wnd2
3756
			sub edx,dword[esi+sb_offs_position]
3815
			sub edx,dword[esi+sb_offs_position]
3757
			imul edx,ted_rec_w
3816
			imul edx,ted_rec_w
3758
			sub bx,dx
3817
			sub bx,dx
3759
			shl edx,16
3818
			shl edx,16
3760
			add ebx,edx
3819
			add ebx,edx
3761
		.in_wnd2:
3820
		.in_wnd2:
3762
 
-
 
3763
		mov edx,ted_color_wnd_work
3821
		mov edx,ted_color_wnd_work
3764
		int 0x40
3822
		int 0x40
3765
		pop esi
3823
		;pop esi
3766
	@@:
3824
	@@:
Line 3767... Line 3825...
3767
 
3825
 
3768
	.no_clear:
3826
	.no_clear:
3769
	popad
3827
	popad