Subversion Repositories Kolibri OS

Rev

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

Rev 1457 Rev 1458
Line 1... Line 1...
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 29.04.2010 IgorA
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 03.05.2010 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 52... Line 52...
52
  tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
52
  tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
53
  td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
53
  td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
54
ends
54
ends
55
;------------------------------------------------------------------------------
55
;------------------------------------------------------------------------------
Line -... Line 56...
-
 
56
 
-
 
57
ted_symbol_tab db 26
56
 
58
 
Line 57... Line 59...
57
if lang eq ru
59
if lang eq ru
58
 
60
 
59
txtFindCapt db '®¨áª',0
61
txtFindCapt db '®¨áª',0
Line 78... Line 80...
78
 
80
 
Line 79... Line 81...
79
end if
81
end if
80
 
82
 
81
;------
83
;------
82
align 4
84
align 4
83
EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
85
EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0
84
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
86
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
85
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
87
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
86
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
88
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Line 166... Line 168...
166
  call mem_Alloc
168
	call mem_Alloc
167
  mov ted_arr_key_pos,eax
169
	mov ted_arr_key_pos,eax
168
  add eax,1024
170
	add eax,1024
169
  mov ted_syntax_file,eax
171
	mov ted_syntax_file,eax
Line -... Line 172...
-
 
172
 
170
 
173
	stdcall ted_init_scroll_bars,edi,3
171
  pop edi ecx eax
174
	pop edi ecx eax
172
  ret
175
	ret
Line -... Line 176...
-
 
176
endp
-
 
177
 
-
 
178
MIN_W_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨­£ 
-
 
179
MIN_H_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨­£ 
-
 
180
;input:
-
 
181
; opt = 1 - ¬¥­ïâì 梥â áªà®««¨­£®¢, 2 - ¬¥­ïâì ¢­¥è­¨¥ à §¬¥àë
-
 
182
align 4
-
 
183
proc ted_init_scroll_bars, edit:dword, opt:dword
-
 
184
	pushad
-
 
185
	mov esi,ted_scr_w
-
 
186
	mov ebx,ted_scr_h
-
 
187
	bt dword[opt],0
-
 
188
	jae @f
-
 
189
		mov ecx,ted_color_wnd_work
-
 
190
		mov dword[esi+sb_offs_bckg_col],ecx
-
 
191
		mov dword[ebx+sb_offs_bckg_col],ecx
-
 
192
		mov ecx,ted_color_wnd_capt
-
 
193
		mov dword[esi+sb_offs_frnt_col],ecx
-
 
194
		mov dword[ebx+sb_offs_frnt_col],ecx
-
 
195
		mov ecx,ted_color_wnd_bord
-
 
196
		mov dword[esi+sb_offs_line_col],ecx
-
 
197
		mov dword[ebx+sb_offs_line_col],ecx
-
 
198
	@@:
-
 
199
	bt dword[opt],1
-
 
200
	jae .no_size
-
 
201
			mov edx,ted_wnd_l
-
 
202
			add edx,ted_rec_l
-
 
203
			mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨­£ 
-
 
204
		mov eax,ted_wnd_h ;calculate lines in page
-
 
205
			mov edx,ted_wnd_t
-
 
206
			add edx,eax
-
 
207
			mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠£®à¨§. áªà®««¨­£ 
-
 
208
		sub eax,ted_rec_t
-
 
209
		xor edx,edx
-
 
210
		mov ecx,ted_rec_h
-
 
211
		div ecx
-
 
212
		cmp eax,MIN_W_SCRL_ARE
-
 
213
		jg @f
-
 
214
			mov eax,MIN_W_SCRL_ARE
-
 
215
		@@:
-
 
216
		mov dword[esi+sb_offs_cur_area],eax
-
 
217
 
-
 
218
		mov eax,ted_wnd_w ;calculate cols in page
-
 
219
			mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª­ 
-
 
220
			add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨­ã ®ª­ 
-
 
221
			mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
-
 
222
			mov edx,ted_wnd_t
-
 
223
			mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
-
 
224
			mov edx,ted_wnd_h
-
 
225
			mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨­£ 
-
 
226
		sub eax,ted_rec_l
-
 
227
			mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨­ã £®à¨§. áªà®««¨­£ 
-
 
228
		xor edx,edx
-
 
229
		mov ecx,ted_rec_w
-
 
230
		div ecx
-
 
231
		cmp eax,MIN_H_SCRL_ARE
-
 
232
		jg @f
-
 
233
			mov eax,MIN_H_SCRL_ARE
-
 
234
		@@:
-
 
235
		dec eax
-
 
236
		mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ­ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ­ ¤«ï £®à¨§. áªà®««¨­£ 
-
 
237
	.no_size:
-
 
238
	popad
-
 
239
	ret
173
endp
240
endp
174
 
241
 
175
align 4
242
align 4
176
proc ted_delete, edit:dword
243
proc ted_delete, edit:dword
Line 191... Line 258...
191
; eax = key kodes
258
; eax = key kodes
192
align 4
259
align 4
193
proc ted_key, edit:dword, table:dword, control:dword
260
proc ted_key, edit:dword, table:dword, control:dword
194
	pushad
261
	pushad
195
	mov edi,dword[edit]
262
	mov edi,dword[edit]
-
 
263
	mov esi,ted_el_focus
-
 
264
	cmp dword[esi],edi
-
 
265
	jne .end_key_fun ;í«¥¬¥­â ­¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ ä㭪樨
196
	mov esi,dword[control]
266
	mov esi,dword[control]
Line 197... Line 267...
197
 
267
 
198
	cmp ah,KEY_F1 ;[F1]
268
	cmp ah,KEY_F1 ;[F1]
199
	jne @f
269
	jne @f
Line 212... Line 282...
212
		jne @f
282
		jne @f
213
			cmp ted_fun_on_key_ctrl_o,0
283
			cmp ted_fun_on_key_ctrl_o,0
214
			je @f
284
			je @f
215
				call ted_fun_on_key_ctrl_o
285
				call ted_fun_on_key_ctrl_o
216
		@@:
286
		@@:
-
 
287
		cmp ah,31 ;Ctrl+S
-
 
288
		jne @f
-
 
289
			cmp ted_fun_on_key_ctrl_s,0
-
 
290
			je @f
-
 
291
				call ted_fun_on_key_ctrl_s
-
 
292
		@@:
217
		cmp ah,33 ;Ctrl+F
293
		cmp ah,33 ;Ctrl+F
218
		jne @f
294
		jne @f
219
		cmp ted_panel_id,TED_PANEL_FIND
295
		cmp ted_panel_id,TED_PANEL_FIND
220
		je @f
296
		je @f
221
			cmp ted_fun_on_key_ctrl_f,0
297
			cmp ted_fun_on_key_ctrl_f,0
Line 605... Line 681...
605
  mov ted_tim_undo,0
681
  mov ted_tim_undo,0
606
  mov ted_help_id,-1
682
  mov ted_help_id,-1
Line 607... Line 683...
607
 
683
 
608
  mov ecx,ted_scr_w
684
  mov ecx,ted_scr_w
609
  mov dword[ecx+sb_offs_position],0
685
  mov dword[ecx+sb_offs_position],0
610
  mov dword[ecx+sb_offs_max_area],100
686
  mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
611
  mov dword[ecx+sb_offs_redraw],1
687
  mov dword[ecx+sb_offs_redraw],1
612
  mov ecx,ted_scr_h
688
  mov ecx,ted_scr_h
613
  mov dword[ecx+sb_offs_position],0
689
  mov dword[ecx+sb_offs_position],0
Line 614... Line 690...
614
  mov dword[ecx+sb_offs_max_area],100
690
  mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
615
 
691
 
616
  mov ted_sel_x0,0
692
  mov ted_sel_x0,0
617
  mov ted_sel_y0,0
693
  mov ted_sel_y0,0
Line 722... Line 798...
722
	mov ecx,ted_key_words_count
798
	mov ecx,ted_key_words_count
723
	imul ecx,sizeof.TexColViv
799
	imul ecx,sizeof.TexColViv
724
	add ecx,ted_key_words_data
800
	add ecx,ted_key_words_data
725
	mov ted_help_text_f1,ecx
801
	mov ted_help_text_f1,ecx
Line -... Line 802...
-
 
802
 
726
 
803
	stdcall ted_init_scroll_bars,edi,1 ;¬¥­ï¥¬ æ¢¥â  áªà®««¨­£®¢
727
	.no_colors:
804
	.no_colors:
728
	popad
805
	popad
729
	ret
806
	ret
Line 2804... Line 2881...
2804
;description:
2881
;description:
2805
; ”ã­ªæ¨ï ¯à¥®¡à §ã¥â ­¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ ­  íªà ­¥
2882
; ”ã­ªæ¨ï ¯à¥®¡à §ã¥â ­¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ ­  íªà ­¥
2806
align 4
2883
align 4
2807
ted_convert_invis_symb:
2884
ted_convert_invis_symb:
2808
  cmp ted_mode_invis,1
2885
	cmp ted_mode_invis,1
-
 
2886
	jne .end_f
-
 
2887
		cmp byte[edx],9
2809
  jne @f
2888
		jne @f
-
 
2889
			lea edx,[ted_symbol_tab]
-
 
2890
		@@:
2810
  cmp byte[edx],13
2891
		cmp byte[edx],13
2811
  jne @f
2892
		jne @f
2812
    mov edx,edi
2893
			mov edx,edi
2813
	add edx,ted_offs_symbol_new_line
2894
			add edx,ted_offs_symbol_new_line
2814
  @@:
2895
		@@:
-
 
2896
	.end_f:
2815
  ret
2897
	ret
Line 2816... Line 2898...
2816
 
2898
 
2817
;input:
2899
;input:
2818
; edi = pointer to tedit struct
2900
; edi = pointer to tedit struct
Line 3084... Line 3166...
3084
 
3166
 
3085
  cmp ted_tim_undo,0
3167
  cmp ted_tim_undo,0
3086
  je @f
3168
  je @f
3087
    mov ecx,ted_tim_undo
3169
    mov ecx,ted_tim_undo
-
 
3170
    add edx,0x500000
3088
    add edx,0x500000
3171
	mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ­® ¢ ª®­æ¥ ä㭪樨 í⮠㦥 ­¥ ¢ ¦­®
3089
    int 0x40
3172
    int 0x40 ;¢ë¢®¤ ç¨á«  ®â¬¥­¥­­ëå ¤¥©á⢨©
Line 3090... Line 3173...
3090
  @@:
3173
  @@:
3091
 
3174
 
3092
  popad
3175
  popad
Line 3099... Line 3182...
3099
	pushad
3182
	pushad
Line 3100... Line 3183...
3100
 
3183
 
3101
	mov eax,ted_buffer
3184
	mov eax,ted_buffer
3102
	cmp byte[eax],0 ;ᬮâਬ 1-© ᨬ¢®« ¨§ ¡ãä¥à 
3185
	cmp byte[eax],0 ;ᬮâਬ 1-© ᨬ¢®« ¨§ ¡ãä¥à 
3103
	je @f
-
 
3104
		mov ebx,ted_wnd_l
3186
	je @f
3105
		add ebx,ted_rec_l
3187
		mov ebx,ted_rec_l
-
 
3188
		add bx,300
-
 
3189
		cmp ebx,ted_wnd_w ;áà ¢­¨¢ ¥¬ ª®®à¤¨­ âã ¤«ï ¢ë¢®¤ ⥪áâ 
-
 
3190
		jge @f ;¯®¤¯¨áì ­¥ ¢« §¨â ¢ ®ª­®
-
 
3191
 
3106
		add bx,300
3192
		add ebx,ted_wnd_l
3107
		shl ebx,16
3193
		shl ebx,16
3108
		add ebx,ted_wnd_t
3194
		add ebx,ted_wnd_t
3109
		add ebx,3
3195
		add ebx,3
3110
		mov ecx,ted_color_wnd_bord
3196
		mov ecx,ted_color_wnd_bord
Line 3140... Line 3226...
3140
;input:
3226
;input:
3141
; edi = pointer to tedit struct
3227
; edi = pointer to tedit struct
3142
align 4
3228
align 4
3143
proc ted_draw_help_f1
3229
proc ted_draw_help_f1
3144
  pushad
3230
	pushad
-
 
3231
	cmp ted_rec_t,13 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ¤«ï à¨á®¢ ­¨ï á¯à ¢ª¨
3145
 
3232
	jle @f
3146
  mov eax,13 ;clear place before draw help
3233
		mov eax,13 ;clear place before draw help
3147
  mov ebx,ted_wnd_l
3234
		mov ebx,ted_wnd_l
3148
  add ebx,ted_rec_l
3235
		add ebx,ted_rec_l
3149
  shl ebx,16
3236
		shl ebx,16
3150
  add ebx,ted_wnd_w
3237
		add ebx,ted_wnd_w
Line 3696... Line 3783...
3696
 
3783
 
3697
		call ted_draw_cursor_sumb
3784
		call ted_draw_cursor_sumb
3698
		call ted_wnd_main_click
3785
		call ted_wnd_main_click
3699
		jmp .no_in_wnd
3786
		jmp .no_in_wnd
3700
	@@:
3787
	@@:
-
 
3788
	mov edx,ted_el_focus
-
 
3789
	cmp dword[edx],edi
-
 
3790
	jne @f
-
 
3791
		call ted_wnd_main_mouse_scroll ;ᬮâਬ ­  ¯à®ªàãâªã ª®«¥á  ¬ëè¨
3701
	call ted_wnd_main_mouse_scroll
3792
	@@:
3702
	cmp ted_drag_m,0
3793
	cmp ted_drag_m,0
3703
	je .no_in_wnd
3794
	je .no_in_wnd
3704
		mov ted_drag_m,0
3795
		mov ted_drag_m,0
3705
		stdcall ted_draw,edi
3796
		stdcall ted_draw,edi
Line 3717... Line 3808...
3717
;description:
3808
;description:
3718
; äã­ªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ­ ¦ â¨¨ ª­®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥­¨¨ ªãàá®à®¬ ¢ ®ª­® । ªâ®à 
3809
; äã­ªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ­ ¦ â¨¨ ª­®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥­¨¨ ªãàá®à®¬ ¢ ®ª­® । ªâ®à 
3719
align 4
3810
align 4
3720
ted_wnd_main_click:
3811
ted_wnd_main_click:
3721
  push ebx ecx edx
3812
	push ebx ecx edx
-
 
3813
	mov ebx,ted_el_focus
-
 
3814
	mov dword[ebx],edi ;áâ ¢¨¬ 䮪ãá
Line 3722... Line 3815...
3722
 
3815
 
3723
  push eax
3816
  push eax
3724
    shr eax,16
3817
    shr eax,16
3725
    and eax,0xffff
3818
    and eax,0xffff
Line 3771... Line 3864...
3771
;input:
3864
;input:
3772
; edi = pointer to tedit struct
3865
; edi = pointer to tedit struct
3773
align 4
3866
align 4
3774
ted_wnd_main_mouse_scroll:
3867
ted_wnd_main_mouse_scroll:
3775
	push eax ebx ecx
3868
	push eax ebx ecx
3776
	mcall 37,7
3869
	mcall 37,7 ;¯à®ªàã⪠ ª®«¥á  ¬ëè¨
3777
	cmp ax,0
3870
	cmp ax,0
3778
	je .no_scroll
3871
	je .no_scroll
3779
		mov ecx,ted_scr_w
3872
		mov ecx,ted_scr_w
3780
		mov ebx,dword[ecx+sb_offs_position] ;copy old scroll position
3873
		mov ebx,dword[ecx+sb_offs_position] ;copy old scroll position
3781
		and eax,0xffff
3874
		and eax,0xffff