Subversion Repositories Kolibri OS

Rev

Rev 205 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 205 Rev 1098
1
;--------------------------------------------------------------------
1
;--------------------------------------------------------------------
2
;--- à¨á®¢ ­¨¥ ª­®¯ª¨ á ⥪á⮬ ¢ á¥à¥¤¨­¥ --------------------------
2
;--- à¨á®¢ ­¨¥ ª­®¯ª¨ á ⥪á⮬ ¢ á¥à¥¤¨­¥ --------------------------
3
;--------------------------------------------------------------------
3
;--------------------------------------------------------------------
4
macro use_txt_button
4
macro use_txt_button
5
{
5
{
6
txt_button:
6
txt_button:
7
.draw:
7
.draw:
8
pusha
8
pusha
9
;--- ¯à®à¨á®¢ª  á ¬®© ª­®¯ª¨ ---
9
;--- ¯à®à¨á®¢ª  á ¬®© ª­®¯ª¨ ---
10
	mov	eax,8
10
        mov     eax,8
11
	mov	ebx,[edi] ; [but.width]
11
        mov     ebx,[edi] ; [but.width]
12
	mov	ecx,[edi+4] ;[but.height]
12
        mov     ecx,[edi+4] ;[but.height]
13
	mov	edx,[edi+8];[but.id]
13
        mov     edx,[edi+8];[but.id]
14
	mov	esi,[edi+12];[but.color]
14
        mov     esi,[edi+12];[but.color]
15
	int	0x40
15
        mcall
16
;--- ⥪áâ ­  ­¥© ---
16
;--- ⥪áâ ­  ­¥© ---
17
	; áç¨â ¥¬ ª®«¨ç¥á⢮ ᨬ¢®«®¢
17
        ; áç¨â ¥¬ ª®«¨ç¥á⢮ ᨬ¢®«®¢
18
	mov	edx,[edi+20]
18
        mov     edx,[edi+20]
19
	xor	esi,esi
19
        xor     esi,esi
20
.check_next_symbol:
20
.check_next_symbol:
21
	cmp	[edx+esi],byte 0
21
        cmp     [edx+esi],byte 0
22
	je	.str_end
22
        je      .str_end
23
	inc	esi	 ; ¢ esi ¤«¨­  áâப¨ ¢ ᨬ¢®« å
23
        inc     esi      ; ¢ esi ¤«¨­  áâப¨ ¢ ᨬ¢®« å
24
	jmp	.check_next_symbol
24
        jmp     .check_next_symbol
25
.str_end:
25
.str_end:
26
 
26
 
27
	; ¢ëç¨á«ï¥¬ ª®®à¤¨­ âë
27
        ; ¢ëç¨á«ï¥¬ ª®®à¤¨­ âë
28
	lea	ebx,[esi*2+esi]
28
        lea     ebx,[esi*2+esi]
29
	lea	ebx,[ebx*2] ; ¢ ebx ¤«¨­  áâப¨ ¢ ¯¨ªá¥«ïå
29
        lea     ebx,[ebx*2] ; ¢ ebx ¤«¨­  áâப¨ ¢ ¯¨ªá¥«ïå
30
 
30
 
31
	;not     ebx
31
        ;not     ebx
32
	neg	ebx
32
        neg     ebx
33
	add	bx,[edi] ; [but.width]
33
        add     bx,[edi] ; [but.width]
34
	sar	bx,1
34
        sar     bx,1
35
	inc	bx
35
        inc     bx
36
	add	bx,[edi+2];[but.left]  ; ¢ bx ¯®§¨æ¨ï á«¥¢ 
36
        add     bx,[edi+2];[but.left]  ; ¢ bx ¯®§¨æ¨ï á«¥¢ 
37
	shl	ebx,16
37
        shl     ebx,16
38
 
38
 
39
 
39
 
40
	mov	bx,[edi+4];[but.height]
40
        mov     bx,[edi+4];[but.height]
41
	sub	bx,8
41
        sub     bx,8
42
	sar	bx,1
42
        sar     bx,1
43
	add	bx,[edi+6];[but.top]   ; ¢ bx ¯®§¨æ¨ï ᢥàåã
43
        add     bx,[edi+6];[but.top]   ; ¢ bx ¯®§¨æ¨ï ᢥàåã
44
 
44
 
45
	; à¨á㥬 áâபã ⥪áâ 
45
        ; à¨á㥬 áâபã ⥪áâ 
46
	mov	ecx,[edi+16] ;[but.text_color]
46
        mov     ecx,[edi+16] ;[but.text_color]
47
	shr	eax,1
47
        shr     eax,1
48
	int	0x40
48
        mcall
49
popa
49
popa
50
ret
50
ret
51
}
51
}
52
 
52
 
53
struc txt_button width,left,height,top,id,color,text_color,text_ptr,\
53
struc txt_button width,left,height,top,id,color,text_color,text_ptr,\
54
proc_addres
54
proc_addres
55
{
55
{
56
.width dw width ;+0
56
.width dw width ;+0
57
.left dw left	;+2
57
.left dw left   ;+2
58
.height dw height ;+4
58
.height dw height ;+4
59
.top dw top	  ;+6
59
.top dw top       ;+6
60
.id dd id	  ;+8
60
.id dd id         ;+8
61
.color dd color   ;+12
61
.color dd color   ;+12
62
.text_color dd text_color  ;+16
62
.text_color dd text_color  ;+16
63
.text_ptr dd text_ptr	   ;+20
63
.text_ptr dd text_ptr      ;+20
64
.proc_addres dd proc_addres+0 ;+24
64
.proc_addres dd proc_addres+0 ;+24
65
}
65
}
66
but_struc_size=24+4
66
but_struc_size=24+4
67
macro draw_txt_buttons start,end
67
macro draw_txt_buttons start,end
68
{
68
{
69
	mov	edi,start
69
        mov     edi,start
70
	mov	ecx,((end-start)/but_struc_size)
70
        mov     ecx,((end-start)/but_struc_size)
71
@@:
71
@@:
72
	call	txt_button.draw
72
        call    txt_button.draw
73
	add	edi,but_struc_size
73
        add     edi,but_struc_size
74
	loop	@b
74
        loop    @b
75
}
75
}
76
 
76
 
77
macro txt_but_set_sys_color start,end,color_table
77
macro txt_but_set_sys_color start,end,color_table
78
{
78
{
79
	mov	edi,start
79
        mov     edi,start
80
	mov	esi,color_table
80
        mov     esi,color_table
81
	mov	ecx,((end-start)/but_struc_size)
81
        mov     ecx,((end-start)/but_struc_size)
82
@@:
82
@@:
83
	push	dword [esi+24]
83
        push    dword [esi+24]
84
	pop	dword [edi+12]
84
        pop     dword [edi+12]
85
	push	dword [esi+28]
85
        push    dword [esi+28]
86
	pop	dword [edi+16]
86
        pop     dword [edi+16]
87
	add	edi,but_struc_size
87
        add     edi,but_struc_size
88
	loop	@b
88
        loop    @b
89
}
89
}
90
 
90
 
91
macro txt_but_ev start,end
91
macro txt_but_ev start,end
92
{
92
{
93
	mov	edi,start
93
        mov     edi,start
94
	mov	ecx,((end-start)/but_struc_size)
94
        mov     ecx,((end-start)/but_struc_size)
95
.txt_but_next:
95
.txt_but_next:
96
	cmp	ah,[edi+8]
96
        cmp     ah,[edi+8]
97
	jne	@f
97
        jne     @f
98
	cmp	dword [edi+24],0
98
        cmp     dword [edi+24],0
99
	je	@f
99
        je      @f
100
	pusha
100
        pusha
101
	call	dword [edi+24]
101
        call    dword [edi+24]
102
	popa
102
        popa
103
@@:
103
@@:
104
	add	edi,but_struc_size
104
        add     edi,but_struc_size
105
	loop	.txt_but_next
105
        loop    .txt_but_next
106
}
106
}