Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2486 → Rev 2487

/programs/media/log_el/trunk/log_el.asm
29,9 → 29,10
el_offs_box_x equ 20 ;è¨à¨­  ª®à®¡ª¨ í«¥¬¥­â 
el_offs_box_y equ 21 ;¢ëá®â  ª®à®¡ª¨ í«¥¬¥­â 
el_offs_table equ 22 ;㪠§ â¥«ì ­  â ¡«¨æã à ¡®âë í«¥¬¥­â 
el_offs_legs_inp equ 26 ;ᬥ饭¨¥ ­  ®¯¨á ­¨¥ ¢å®¤­ëå ­®£
el_offs_legs_inp equ 26 ;㪠§ â¥«ì ­  â ¡«¨æã ®¯¨á ­¨ï ¢å®¤­ëå ­®£
el_offs_legs_out equ 30 ;ᬥ饭¨¥ ­  ®¯¨á ­¨¥ ¢ë室­ëå ­®£
 
sp_offs_el_angle equ 8 ;ᬥ饭¨¥ ¤«ï 㣫  ¯®¢®à®â  í«¥¬¥­â  ¢ ᯨ᪥
sp_offs_el_type equ 9 ;ᬥ饭¨¥ ¤«ï ⨯  í«¥¬¥­â  ¢ ᯨ᪥
 
points_max equ 1000
47,7 → 48,7
include 'le_signal.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 20.03.12',0 ;¯®¤¯¨áì ®ª­ 
caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 21.03.12',0 ;¯®¤¯¨áì ®ª­ 
 
panel_0_coord_top equ 5 ;¢¥àå­ïï ª®®à¤¨­ â  0-£® à鸞 ¯ ­¥«¨ ¨­áâà㬥­â®¢
panel_1_coord_top equ 35
82,7 → 83,7
FileName dd ?
ends
 
macro elOpt nam,col,box_x,box_y,table, il0, il1, il2, ol0, ol1, ol2
macro elOpt nam,col,box_x,box_y,table, tbl_i_legs, ol0, ol1, ol2
{
@@: db nam
rb @b+16-$
90,40 → 91,46
db box_x
db box_y
dd table+0 ;+el_offs_table
;+26
db il0+0 ;0-ï ¢å®¤­ ï ­®£ 
db il1+0 ;1-ï ¢å®¤­ ï ­®£ 
db il2+0
db 0
;+30
db ol0+0
db ol1+0
db ol2+0
db 0
dd tbl_i_legs+0 ;+26 ¢å®¤­ë¥ ­®£¨
;+30 ¢ë室­ë¥ ­®£¨
db ol0+0, ol1+0, ol2+0, 0
}
 
align 4
el_opt_beg:
elOpt 'or[2]', 0xff00ff,5,5,tbl_or, 1,2,, 2
elOpt 'or[3]', 0xff00ff,5,7,tbl_or, 1,2,2, 3
elOpt 'and[2]',0xffff00,5,5,tbl_and.2, 1,2,, 2
elOpt 'and[3]',0xffff00,5,7,tbl_and.3, 1,2,2, 3
elOpt 'not', 0xffff,3,3,tbl_not, 1,,, 1
elOpt 'xor', 0x8000ff,5,5,tbl_xor, 1,2,, 2
elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm, 1,2,2, 1,4
elOpt 'or[2]', 0xff00ff,5,5,tbl_or, tbl_il_2, 2
elOpt 'or[3]', 0xff00ff,5,7,tbl_or, tbl_il_3, 3
elOpt 'or[4]', 0xff00ff,5,9,tbl_or, tbl_il_4, 4
elOpt 'and[2]',0xffff00,5,5,tbl_and.2, tbl_il_2, 2
elOpt 'and[3]',0xffff00,5,7,tbl_and.3, tbl_il_3, 3
elOpt 'and[4]',0xffff00,5,9,tbl_and.4, tbl_il_4, 4
elOpt 'not', 0xffff, 3,3,tbl_not, tbl_il_1, 1
elOpt 'xor', 0x8000ff,5,5,tbl_xor, tbl_il_2, 2
elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm, tbl_il_3, 1,4
;elOpt 'cd[8]', 0x8000, 7,17,tbl_cd_8,tbl_il_8, 6,2,2 ;è¨äà â®à ­  8 ¢å®¤®¢
.end:
elOpt '???', 0x808080,3,3,tbl_and.3, 1,,, 1 ;­¥ ®¯®§­ ­­ë© í«¥¬¥­â
elOpt '???', 0x808080,3,3,tbl_and.3, tbl_il_1, 1 ;­¥ ®¯®§­ ­­ë© í«¥¬¥­â
 
;â ¡«¨æë ¯® ª®â®àë¬ § ¤ îâáï ¯à ¢¨«  à ¡®âë í«¥¬¥­â®¢
align 4
tbl_or db 0,1,1,1, 1,1,1,1 ;or2, or3
db 1,1,1,1,1,1,1,1 ;or4
tbl_and:
.3: db 0,0,0,0
.4: dq 0
.3: dd 0
.2: db 0,0,0,1
tbl_xor db 0,1,1,0
tbl_sm db 0,2,2,1, 2,1,1,3
tbl_not db 1,0 ;not
;tbl_cd_8 db ;256=2^8
 
;â ¡«¨æë ¤«ï ¢å®¤­ëå ­®£
tbl_il_1 db 1,0 ;ª®à¯ãá ­  1 ­®£ã
tbl_il_2 db 1,2,0 ;ª®à¯ãá ­  2 ­®£¨
tbl_il_3 db 1,2,2,0
tbl_il_4 db 1,2,2,2,0
;tbl_il_8 db 1,2,2,2,2,2,2,2,0
 
time dd 0
tim_ch db 0
pen_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
224,6 → 231,7
 
stdcall pole_init, pole
stdcall dword[tl_data_init], tree1
stdcall dword[tl_data_init], tree2
 
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
231,10 → 239,12
;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
mov dword[tree2.data_img_sys],eax
 
load_image_file 'objects.png', icon_toolbar,TOOLBAR_ICON_BMP_SIZE
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
mov dword[tree2.data_img],eax
 
;*** § £à㧪  èà¨äâ 
load_image_file 'font6x9.bmp', image_data_gray,IMAGE_FONT_SIZE
257,6 → 267,15
stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
 
stdcall sign_init, 3000
mov eax,el_opt_beg+el_offs_nam
mov ecx,(el_opt_beg.end-el_opt_beg)/size_el_opt ;ª®««¨ç¥á⢮ ⨯®¢ í«¥¬¥­â®¢
cld
@@:
stdcall [tl_node_add], eax, el_icon_elems shl 16, tree2
stdcall [tl_cur_next], tree2
add eax,size_el_opt
loop @b
stdcall [tl_cur_beg], tree2
 
mcall 26,9
mov [last_time],eax
318,6 → 337,7
align 4
mouse:
stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2
 
push eax ebx ecx edx
mcall 37,2 ;­ ¦ âë¥ ª­®¯ª¨ ¬ëè¨
362,6 → 382,31
cmp ebx,[shem_h]
jge .end_buf_wnd
 
cmp byte[pen_mode],0
jne .end_mode_0
;०¨¬ ªãàá®à  (¢ë¡®à í«¥¬¥­â  ¯à¨ ­ ¦ â¨¨)
stdcall element_is_click,eax,ebx
test eax,eax
jz .end_buf_wnd ;¯à¨ ­ ¦ â¨¨ ­¥ ¯®¯ «¨ ­¨ ­  ®¤¨­ ¨§ í«¥¬¥­â®¢
stdcall [tl_node_get_data], tree1
pop ebx
cmp eax,ebx
je .end_buf_wnd ;¥á«¨ 㦥 ªãàá®à á⮨â â ¬ £¤¥ ­ã¦­®
stdcall [tl_cur_beg], tree1
.cycle0:
stdcall [tl_node_get_data], tree1
pop ebx
test ebx,ebx
jz .end_buf_wnd
cmp eax,ebx
je @f
stdcall [tl_cur_next], tree1
jmp .cycle0
@@:
stdcall [tl_draw], tree1
jmp .end_buf_wnd
.end_mode_0:
cmp byte[pen_mode],1
jne .end_mode_1
;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
437,7 → 482,92
pop edx ecx ebx eax
ret
 
;output:
; eax - pointer to element data
align 4
proc element_is_click uses ebx ecx edx esi edi, coord_x:dword, coord_y:dword
stdcall dword[tl_node_poi_get_info],0,tree1
pop esi
@@:
cmp esi,0
je @f
cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
jne .end_add_p1
stdcall [tl_node_poi_get_data], esi, tree1
pop ecx
 
movzx edx,byte[ecx+sp_offs_el_type]
imul edx,size_el_opt
add edx,el_opt_beg ;­ å®¤¨¬ ®¯æ¨î ᮠ᢮©á⢠¬¨ ¤ ­­®£® í«¥¬¥­â 
 
mov eax,[ecx] ;element coord x
mov ebx,[ecx+4] ;element coord y
movzx edi,byte[ecx+sp_offs_el_angle]
push edi
movzx edi,byte[edx+el_offs_box_y]
dec edi
push edi
movzx edi,byte[edx+el_offs_box_x]
dec edi
push edi
stdcall move_rotate_n90 ;,[edx+el_offs_box_x],[edx+el_offs_box_y],[ecx+sp_offs_el_angle]
;Rect(eax,ebx,[ecx],[ecx+4])
stdcall point_in_rect, [coord_x],[coord_y], eax,ebx,[ecx],[ecx+4]
test eax,eax
jz .end_add_p1
mov eax,ecx
jmp .end_f
.end_add_p1:
stdcall dword[tl_node_poi_get_next_info],esi,tree1
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
@@:
xor eax,eax ;¥á«¨ ­¥ ­ è«¨
.end_f:
ret
endp
 
;¯à®¢¥àª  ¯®¯ ¤¥­¨ï â®çª¨ ¢ ¯àאַ㣮«ì­¨ª
;१ã«ìâ â:
; ¥á«¨ ­¥ ¯®¯ ¤ ¥â â® eax=0
; ¥á«¨ ¯®¯ ¤ ¥â â® eax=1
align 4
proc point_in_rect uses ebx ecx, px:dword, py:dword, rx0:dword, ry0:dword, rx1:dword, ry1:dword
xor eax,eax
 
;¯à®¢¥àª  ¯® ®á¨ x
mov ebx,[rx0]
mov ecx,[rx1]
cmp ebx,ecx
jle @f
xchg ebx,ecx
@@:
cmp ebx,[px]
jg .no_contains
cmp ecx,[px]
jl .no_contains
 
;¯à®¢¥àª  ¯® ®á¨ y
mov ebx,[ry0]
mov ecx,[ry1]
cmp ebx,ecx
jle @f
xchg ebx,ecx
@@:
cmp ebx,[py]
jg .no_contains
cmp ecx,[py]
jl .no_contains
 
;¥á«¨ ¯®¯ «¨ â® eax=1
inc eax
;stdcall draw_scaled_rect, [rx0],[ry0],[rx1],[ry1], 0xffffff
;stdcall [buf2d_draw], buf_0
.no_contains:
ret
endp
 
align 4
draw_window:
pushad
mcall 12,1
541,8 → 671,10
 
; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
stdcall [buf2d_draw], buf_0
mov dword[wScrObj.all_redraw],1
mov dword[wScr1.all_redraw],1
stdcall [tl_draw], tree1
mov dword[wScr2.all_redraw],1
stdcall [tl_draw], tree2
stdcall pole_draw_pok, pole
 
; *** ᮧ¤ ­¨¥ ª­®¯®ª ãáâ ­®¢ª¨ ᨣ­ «®¢ set_0 ¨ set_1 ***
663,6 → 795,7
key:
mcall 2
stdcall [tl_key], dword tree1
stdcall [tl_key], dword tree2
jmp still
 
 
743,19 → 876,19
@@:
cmp ah,31
jne @f
stdcall set_pen_mode,1,0 ;ãáâ ­®¢ª  ०¨¬  à¨á®¢ ­¨ï ¯à®¢®¤ 
stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  à¨á®¢ ­¨ï ¯à®¢®¤ 
@@:
cmp ah,32
jne @f
stdcall set_pen_mode,2,1
stdcall set_pen_mode,2,1,((9 shl 8)+9) shl 16
@@:
cmp ah,33
jne @f
stdcall set_pen_mode,3,2 ;ãáâ ­®¢ª  ०¨¬  áâ¨à ­¨ï ¯à®¢®¤ 
stdcall set_pen_mode,3,2,((15 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  áâ¨à ­¨ï ¯à®¢®¤ 
@@:
cmp ah,34
jne @f
stdcall set_pen_mode,4,3 ;ãáâ ­®¢ª  ०¨¬  ᮧ¤ ­¨ï í«¥¬¥­â®¢
stdcall set_pen_mode,4,3,((9 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  ᮧ¤ ­¨ï í«¥¬¥­â®¢
@@:
cmp ah,1
jne still
767,6 → 900,10
stdcall pole_delete, pole
call sign_delete
stdcall [tl_data_clear], tree1
;ç¨á⨬ 㪠§ â¥«¨ ­  ¨§®¡à ¦¥­¨ï, ª®â®àë¥ ¡ë«¨ ®¡é¨¬¨ ¤«ï «¨á⮢ ¨ 㤠«¥­ë «¨á⮬ tree1
mov dword[tree2.data_img_sys],0
mov dword[tree2.data_img],0
stdcall [tl_data_clear], tree2
cmp [cursor_pointer],0
je @f
mcall 37,6,[cursor_pointer]
880,7 → 1017,7
mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
call str_next_val
stdcall conv_str_to_int,edi
mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨¥
mov byte[txt_buf+sp_offs_el_angle],al ;­ ¯à ¢«¥­¨¥
call str_next_val
;¯®  ¤à¥áã edi ­ §¢ ­¨¥ í«¥¬¥­â 
stdcall el_get_name, edi
1318,7 → 1455,7
 
stdcall str_len,edi
add edi,eax
movzx eax,byte[ecx+8] ;angle
movzx eax,byte[ecx+sp_offs_el_angle] ;angle
stdcall convert_int_to_str
stdcall str_cat,edi,txt_space
 
1570,22 → 1707,30
proc shem_element_creat uses eax ebx, coord_x:dword, coord_y:dword
mov eax,dword[coord_x]
mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
mov eax,dword[coord_y]
mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
mov ebx,dword[coord_y]
 
xor eax,eax
mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨¥
;¯®  ¤à¥áã edi ­ §¢ ­¨¥ í«¥¬¥­â 
;stdcall el_get_name, edi
stdcall element_is_click,eax,ebx ;¯à®¢¥à塞 ¥áâì «¨ ¢ ¤ ­­®© â®çª¥ ¤à㣮© í«¥¬¥­â ᮧ¤ ­­ë© à ­ìè¥
test eax,eax
jnz .end_f ;¯à¨ ­ ¦ â¨¨ ¯®¯ «¨ ­  ®¤¨­ ¨§ í«¥¬¥­â®¢
mov dword[txt_buf+4],ebx ;ª®®à¤¨­ â  y
 
;xor eax,eax
mov byte[txt_buf+sp_offs_el_angle],al ;­ ¯à ¢«¥­¨¥
 
stdcall [tl_node_get_data], tree2
pop ebx
test ebx,ebx
jnz @f
mov ebx,el_opt_beg+el_offs_nam ;¥á«¨ ­¥ ¢§ï«®áì ¨¬ï í«¥¬¥­â , â® ¯® 㬮«ç ­¨î ¡¥à¥¬ 1-© ¨§ ᯨ᪠
@@:
stdcall el_get_name, ebx
mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥­â 
 
movzx ebx,al
imul ebx,size_el_opt
add ebx,el_opt_beg+el_offs_nam
stdcall make_list_capts,txt_buf,ebx
stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
stdcall [tl_cur_next], tree1
stdcall [tl_draw], tree1
.end_f:
ret
endp
 
1622,12 → 1767,12
movzx esi,byte[edi+sp_offs_el_type] ;⨯ í«¥¬¥­â 
imul esi,size_el_opt
add esi,el_opt_beg
;esi+el_offs_legs_inp - 㪠§ â¥«ì ­  ¯ à ¬¥âàë 0-© ¢å®¤­®© ­®£¨
;esi+el_offs_legs_inp - 㪠§ â¥«ì ­  â ¡«¨æã á ¯ à ¬¥âà ¬¨ ¢å®¤­ëå ­®£
 
mov eax,[edi+0]
mov ebx,[edi+4]
mov edx,[l_opt]
movzx edi,byte[edi+8] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
movzx edi,byte[edi+sp_offs_el_angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
 
btr edx,16 ;¢å®¤­ ï/¢ë室­ ï ­®£ 
jc .output_leg
1635,7 → 1780,7
;¥á«¨ ­®£  ¢å®¤­ ï
inc edx ;­®¬¥à æ¨ï ­®£ ­ ç¨­ ¥âáï á ­ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
stdcall move_rotate_x_n90, -2,edi
add esi,el_offs_legs_inp
mov esi,[esi+el_offs_legs_inp]
@@:
movzx ecx,byte[esi]
cmp ecx,0
1980,14 → 2125,15
ret
endp
 
;hot_p - ª®®à¤¨­ âë £®àï祩 â®çª¨ ªãàá®à , ᬥ饭­ë¥ ­  ¡¨â 16 ((cx shl 8) + cy) shl 16
align 4
proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword
proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword
mov eax,[mode]
cmp byte[pen_mode],al
je @f
mov byte[pen_mode],al
;mov edx,((cx shl 8) + cy) shl 16
mov edx,2 ;LOAD_INDIRECT
mov edx,[hot_p]
mov dx,2 ;LOAD_INDIRECT
mov ecx,[icon]
shl ecx,12 ;㬭®¦ ¥¬ ­  4 ª¡
add ecx,[buf_curs.data]
2094,10 → 2240,14
 
el_focus dd 0
tree1 tree_list 32,points_max+2, tl_key_no_edit, 16,16,\
0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top,145,250, 0,capt_offs,0,\
el_focus, wScrObj,0
0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top+85,145,170, 0,capt_offs,0,\
el_focus, wScr1,0
tree2 tree_list el_offs_col-el_offs_nam,100+2, tl_key_no_edit+tl_list_box_mode, 16,16,\
0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top,145,80, 0,0,0,\
el_focus, wScr2,0
 
align 4
wScrObj:
wScr1:
.x:
.size_x dw 16 ;+0
.start_x dw 0 ;+2
2131,6 → 2281,40
.ar_offset dd 1 ;+84
 
align 4
wScr2:
.x:
.size_x dw 16 ;+0
.start_x dw 0 ;+2
.y:
.size_y dw 150 ;+4
.start_y dw 0 ;+6
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
.cur_area dd 30 ;+20
.position dd 0 ;+24
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
 
align 4
proc str_n_cat uses eax ecx edi esi, str1:dword, str2:dword, n:dword
mov esi,dword[str2]
mov ecx,dword[n]