kolibrios/programs/develop/kol_f_edit/ced_wnd_m.inc
IgorA b0017d06ea fix element 'checkbox2' in 'box_lib.obj'
git-svn-id: svn://kolibrios.org@1715 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-12-09 22:35:04 +00:00

477 lines
9.0 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;¯®¤­¨¬ ¥¬ ®¡ê¥ªâ ¢¢¥àå ¯® ᯨáªã
align 4
but_obj_move_up:
stdcall [tl_node_move_up], tree2
ret
;®¯ã᪠¥¬ ®¡ê¥ªâ ¢­¨§ ¯® ᯨáªã
align 4
but_obj_move_down:
stdcall [tl_node_move_down], tree2
ret
;ª®¯¨à㥬 ®¡ê¥ªâ
align 4
but_obj_copy:
push ecx esi edi
stdcall [tl_node_get_data], tree2
pop esi
mov edi,[tree2.data_info] ;¤ ­­ë¥ 0-£® 㧫 , ¨á¯®«ì§ã¥¬ ¤«ï ª®¯¨à®¢ ­¨ï
xor ecx,ecx
mov cx,word[tree2.info_size]
cld
rep movsb
pop edi esi ecx
ret
;¢áâ ¢«ï¥¬ ®¡ê¥ªâ
align 4
but_obj_paste:
push eax ebx ecx edi
mov eax,[tree2.data_info] ;¤ ­­ë¥ 0-£® 㧫 , ¨á¯®«ì§ã¥¬ ¤«ï ª®¯¨à®¢ ­¨ï
mov bl,byte[eax]
call find_obj_in_opt
xor ecx,ecx
mov cx,word[edi+obj_opt.img-obj_opt] ;cx - ¨­¤¥ªá £« ¢­®© ¨ª®­ª¨ ¤®¡ ¢«ï¥¬®£® ®¡ê¥ªâ 
shl ecx,16
stdcall [tl_node_add], eax, ecx, tree2 ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
stdcall [tl_draw], tree2
pop edi ecx ebx eax
ret
;®¡­®¢«¥­¨¥ ®¡ê¥ªâ®¢ ¢ tree2, ¯® §­ ç¥­¨ï¬ ⥪á⮢ëå ¯®«¥©
;äã­ªæ¨ï ®¡à â­ ï ª ¤ ­­®© on_file_object_select
align 4
but_element_change:
;foc_obj - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© ¢ë¡à ­­ë© 㧥« ¢ tree2
cmp dword[foc_obj],0
je .err_obj
pushad
;ãáâ ­®¢ª  ⥪á⮢ëå ᢮©áâ¢
xor ebx,ebx
mov edi,edit2
@@:
call get_obj_win_param
inc ebx
add edi,ed_struc_size
cmp edi,prop_wnd_edits_end
jl @b
;ãáâ ­®¢ª  áá뫪¨ ­  ®¡ê¥ªâ ⨯ 
mov edx,dword[foc_obj]
mov dword[edx+u_object.typid-u_object],0 ;­  á«ãç © ¥á«¨ ­¨ç¥£® ­¥ ¢ë¡à ­®
stdcall [tl_node_get_data],tree3
pop eax
cmp eax,0
je @f
mov eax,dword[eax] ;¡¥à¥¬ ¯®à浪®¢ë© ­®¬¥à (¢ ¯ ¬ïâ¨) ¢ë¡à ­­®£® ®¡ê¥ªâ 
mov dword[edx+u_object.typid-u_object],eax
@@:
;ãáâ ­®¢ª  «®£¨ç¥áª¨å ᢮©áâ¢
mov edi,ch1.flags
mov eax,1
xor ebx,ebx
@@:
bt dword[edi],1
jnc .opt_no_sel
or ebx,eax ;­ ª®¯«¥­¨¥ ®â¬¥ç¥­­ëå ®¯æ¨©
.opt_no_sel:
shl eax,1
add edi,ch_struc_size
cmp edi,check_boxes_end
jl @b
mov dword[edx+u_object.modif-u_object],ebx
popad
.err_obj:
call draw_constructor ;®¡­®¢«ï¥¬ ®ª­® ª®­áâàãªâ®à 
;call draw_window
ret
;input:
; ebx - property column
; edi - pointer to property editbox
align 4
get_obj_win_param:
pushad
mov esi,ed_text
stdcall get_obj_text_col, [foc_obj], ebx ;edx - ᬥ饭¨¥ ¤«ï ⥪áâ 
stdcall get_obj_text_len_col, [foc_obj], ebx ;eax - ¤«¨­­  ¯®«ï
cld
mov edi,edx
mov ecx,eax
rep movsb
popad
ret
;input:
; obj - pointer to object
; ind - column index
;output:
; edx + offset
; edx = 0 if not text
align 4
proc get_obj_text_col, obj:dword, ind:dword
mov edx,dword[obj]
inc edx ;goto text
push ebx
mov ebx,dword[ind]
cmp bx,0
je .end_fun
shl ebx,8 ;¢ bh ¯®¯ ¤ ¥â ­®¬¥à ¨áª®¬®© ª®«®­ª¨
mov bl,byte[edx-1] ;¢ bl ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
push ecx edi
call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
add edi,obj_opt.Col-obj_opt
dec bh
and ebx,0xff00
shr ebx,7 ;ᤢ¨£ ¥¬ ­  7, â.ª. ­ã¦­® §­ ç¥­¨¥ bh 㬭®¦¥­­®¥ ­  2
add edi,ebx ;+ ¡ë¢è¥¥ bh*2
xor ecx,ecx
mov cx,word[edi] ;ecx - ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï
add edx,ecx
cmp cx,0
jg @f
mov edx,0 ;not text
@@:
cmp cx,MAX_LEN_OBJ_TXT
jl @f
mov edx,0 ;not text
@@:
pop edi ecx
.end_fun:
pop ebx
ret
endp
;input:
; obj - 㪠§ â¥«ì ­  ®¡ê¥ªâ
; ind - ­®¬¥à ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
;output:
; eax - ¤«¨­­  ⥪á⮢®£® ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
align 4
proc get_obj_text_len_col, obj:dword, ind:dword
xor eax,eax
push ebx
mov ebx,dword[ind]
shl ebx,8 ;¢ bh ¯®¯ ¤ ¥â ­®¬¥à ¨áª®¬®© ª®«®­ª¨
mov eax,dword[obj]
mov bl,byte[eax] ;¢ bl ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
xor eax,eax
push edi
call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
add edi,obj_opt.Col-obj_opt
and ebx,0xff00
shr ebx,7 ;ᤢ¨£ ¥¬ ­  7, â.ª. ­ã¦­® §­ ç¥­¨¥ bh 㬭®¦¥­­®¥ ­  2
add edi,ebx ;+ ¡ë¢è¥¥ bh*2
mov ax,word[edi] ;eax - ᤨ£ ¤«ï á«¥¤ã饣® ¯®«ï
cmp ax,0
jg @f
mov eax,MAX_LEN_OBJ_TXT ;¯®á«¥¤­¨¥ ¯®«ï ¤«ï 㤮¡á⢠ ª®¤¨àãîâáï 0,   ­¥ MAX_LEN_OBJ_TXT, ¨á¯à ¢«ï¥¬ á¨âã æ¨î
@@:
cmp dword[ind],0
je .end_fun ;¤«ï ¯¥à¢®£® ¯®«ï ᤨ£ = 0, ¯®â®¬ã ¢ áâàãªâãॠ®­ ­¥ åà ­¨âáï, â.ª. ¨§¢¥á⥭ § à ­¥¥
sub ax,word[edi-2] ;®â­¨¬ ¥¬ ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï, ¯®«ãç ¥¬ ¤«¨­­ã ¯®«ï
cmp word[edi-2],0
jg @f
mov eax,0 ;¯®«¥ ¯ãá⮥, ­¥ ¨á¯®«ì§ã¥âáï
@@:
cmp ax,MAX_LEN_OBJ_TXT
jl @f
mov eax,0 ;not text
@@:
pop edi
.end_fun:
pop ebx
ret
endp
align 4
proc draw_obj_icon, o_type:dword,n_col:dword, coord_y:dword
pushad
xor ebx,ebx
mov bl,byte[o_type]
call find_obj_in_opt
add edi,obj_opt.img-obj_opt ;get index (+0)
mov ebx,[n_col]
shl ebx,1
add edi,ebx ;move index (+bh)
xor ecx,ecx
mov cx,[edi]
cmp cx,0
jge @f
jmp .end_fun ;error icon index
@@:
mov ebx,bmp_icon
imul ecx,0x300
add ebx,ecx
mov eax,7
mov ecx,0x100010 ;ecx - size:16*16
mov edx,3 ;®âáâ㯠®â «¥¢®£® ªà ï à ¬ª¨ ¤® ¨ª®­ª¨
shl edx,16
add edx,[coord_y]
int 0x40
.end_fun:
popad
ret
endp
;¢ë¢®¤ ⥪áâ  á ¯®¤¯¨áìî
align 4
proc draw_obj_caption, o_type:dword,n_col:dword, coord_y:dword
pushad
stdcall get_obj_text_len_col, [foc_obj], [n_col] ;eax - ¤«¨­­  ¯®«ï
cmp eax,1
jl .no_draw
xor ebx,ebx
mov bl,byte[o_type]
call find_obj_in_opt
mov edx,edi
add edx,obj_opt.caption-obj_opt
mov eax,[n_col]
mov ebx,150
shl ebx,16
add ebx,dword[coord_y]
add ebx,3
mov ecx,0 ;text color
mov esi,edx
.beg_found:
cmp byte[esi],0
je .end_found
cmp byte[esi],'*'
je @f
inc esi
jmp .beg_found
@@:
cmp eax,0
je .end_found
dec eax
inc esi
mov edx,esi ;¯¥à¥ª«îç ¥¬ ­ ç «® áâப¨ ­  á«¥¤. ¯®¤¯¨áì
jmp .beg_found
.end_found:
cmp esi,edx
jle .no_draw
sub esi,edx ;esi = text len
mov eax,4
int 0x40
.no_draw:
popad
ret
endp
align 4
proc draw_icon, ind:dword,coord_x:dword,coord_y:dword
pushad
mov ecx,[ind]
cmp ecx,0
jl .end_fun
mov ebx,bmp_icon
imul ecx,0x300
add ebx,ecx
mov eax,7
mov ecx,0x100010 ;ecx - size:16*16
mov edx,[coord_x]
shl edx,16
add edx,[coord_y]
int 0x40
.end_fun:
popad
ret
endp
;input
; bl = cod object
;output:
; edi = pointer to option struct
align 4
find_obj_in_opt:
push ecx
xor ecx,ecx ;find 'bl' in options
mov edi,obj_opt
@@:
cmp bl,[edi] ;find
je @f
inc ecx
cmp ecx,MAX_OBJ_TYPES
je @f ;not find
add edi,sizeof.ObjOpt
jmp @b
@@:
pop ecx
ret
obj_find_last dd 0 ;㪠§ â¥«ì ­  ¯®á«¥¤­¨© 㤠筮 ­ ©¤¥­­ë© ®¡ê¥ªâ,
;­ã¦¥­ ¤«ï ã᪮७¨ï ¯®á«¥¤ã饣® ¯®¨áª 
;¢ë室:
;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
align 4
proc find_obj_in_file, o_type:dword
push ebx esi
mov ebx,[o_type]
stdcall dword[tl_node_poi_get_info], 0,tree2
pop esi
@@:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
cmp eax,0
je .find_no
cmp byte[eax],bl ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
je .find_yes
stdcall dword[tl_node_poi_get_next_info], esi,tree2
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
.find_yes:
mov dword[obj_find_last],esi
jmp @f
.find_no:
mov dword[obj_find_last],0
xor eax,eax
@@:
pop esi ebx
ret
endp
;¢ë室:
;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
align 4
proc find_obj_in_file_next, o_type:dword
push ebx esi
cmp dword[obj_find_last],0
je .find_no
mov ebx,[o_type]
stdcall dword[tl_node_poi_get_next_info], dword[obj_find_last],tree2
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
@@:
cmp esi,0
je .find_no
stdcall dword[tl_node_poi_get_data], esi,tree2
pop eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
cmp eax,0
je .find_no
cmp byte[eax],bl ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
je .find_yes
stdcall dword[tl_node_poi_get_next_info], esi, tree2
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
.find_yes:
mov dword[obj_find_last],esi
jmp @f
.find_no:
mov dword[obj_find_last],0
xor eax,eax
@@:
pop esi ebx
ret
endp
align 4
but_show_constructor:
mov byte[show_mode],0
stdcall [buf2d_draw], buf_fon
ret
align 4
but_show_code:
mov byte[show_mode],1
stdcall [ted_draw], tedit0
ret
;input:
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
;output:
; eax - ç¨á«®
align 4
proc conv_str_to_int, buf:dword
xor eax,eax
push ebx esi
xor ebx,ebx
mov esi,[buf]
cmp word[esi],'0x'
je .load_digit_16
.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'9'
jg @f
sub bl,'0'
imul eax,10
add eax,ebx
inc esi
jmp .load_digit_10
jmp @f
.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
add esi,2
.cycle_16:
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'f'
jg @f
cmp bl,'9'
jle .us1
cmp bl,'A'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
cmp bl,'F'
jle .us2
cmp bl,'a'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
sub bl,'0'
cmp bl,9
jle .cor1
sub bl,7 ;convert 'A' to '10'
.cor1:
shl eax,4
add eax,ebx
inc esi
jmp .cycle_16
@@:
pop esi ebx
ret
endp