Subversion Repositories Kolibri OS

Rev

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

Rev 3471 Rev 6586
Line 1... Line 1...
1
;**************************************************************
1
;**************************************************************
-
 
2
; 2016, 0CodErr
-
 
3
;       Added border styles(raised, sunken, etched, ridged).
-
 
4
;       Added possibility to fill frame background.
-
 
5
;**************************************************************
2
; Frame Macro for Kolibri OS
6
; Frame Macro for Kolibri OS
3
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
7
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
4
; All rights reserved.
8
; All rights reserved.
5
;
9
;
6
; Redistribution and use in source and binary forms, with or without
10
; Redistribution and use in source and binary forms, with or without
Line 26... Line 30...
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;*****************************************************************************
31
;*****************************************************************************
28
macro frame_start
32
macro frame_start
29
{
33
{
30
	pusha
34
	pusha
31
	mov	edi,dword [esp+36]
-
 
32
}
35
}
33
;*****************************************************************************
36
;*****************************************************************************
34
macro frame_exit
37
macro frame_exit
35
{
38
{
36
popa         
39
popa         
37
ret 4
40
ret 4
38
}
41
}
39
;*****************************************************************************
42
;*****************************************************************************
40
macro use_frame
43
macro use_frame
41
{
44
{
-
 
45
fr equ [esp + 36]
42
frame: 
46
frame: 
43
fr_type			equ [edi]	;dword
47
fr_type              equ [eax + FR_STYLE]         ; dword 
44
fr_size_x		equ [edi+4]	;word
48
fr_size_x            equ [eax + FR_WIDTH]         ;  word 
45
fr_start_x		equ [edi+6]	;word
49
fr_start_x           equ [eax + FR_LEFT]          ;  word 
46
fr_size_y		equ [edi+8]	;word
50
fr_size_y            equ [eax + FR_HEIGHT]        ;  word 
47
fr_start_y		equ [edi+10]	;word
51
fr_start_y           equ [eax + FR_TOP]           ;  word 
48
fr_ext_fr_col		equ [edi+12]	;dword
52
fr_ext_fr_col        equ [eax + FR_OUTER_COLOR]   ; dword 
49
fr_int_fr_col		equ [edi+16]	;dword
53
fr_int_fr_col        equ [eax + FR_INNER_COLOR]   ; dword 
50
fr_draw_text_flag	equ [edi+20]	;dword 0-not,1-yes
54
fr_flags             equ [eax + FR_FLAGS]         ; dword 
51
fr_text_pointer		equ [edi+24]	;dword
55
fr_text_pointer      equ [eax + FR_TEXT]          ; dword 
52
fr_text_position	equ [edi+28]	;dword 0-up,1-bottom
56
fr_text_position     equ [eax + FR_TEXT_POSITION] ; dword 
53
fr_font_number		equ [edi+32]	;dword 0-monospace,1-variable
57
fr_font_number       equ [eax + FR_FONT]          ; dword
54
fr_font_size_y		equ [edi+36]	;dword
58
fr_font_size_y       equ [eax + FR_FONT_HEIGHT]   ; dword
55
fr_font_color		equ [edi+40]	;dword
59
fr_font_color        equ [eax + FR_FORE_COLOR]    ; dword
56
fr_font_backgr_color	equ [edi+44]	;dword
60
fr_font_backgr_color equ [eax + FR_BACK_COLOR]    ; dword
57
;*****************************************************************************
61
;*****************************************************************************
58
;*****************************************************************************
62
;*****************************************************************************
59
; draw event
63
; draw event
60
;*****************************************************************************
64
;*****************************************************************************
61
;*****************************************************************************
65
;*****************************************************************************
62
align 4
66
align 4
63
.draw:
67
.draw:
64
frame_start
68
frame_start
-
 
69
        mov    eax, fr
-
 
70
        mov    edx, fr_ext_fr_col
65
;-------------------------------------
71
        mov    edi, fr_int_fr_col
-
 
72
        mov    esi, edx
-
 
73
        mov    ebp, edi
-
 
74
        mov    eax, fr_flags
-
 
75
        and    eax, 1110b
66
; in
76
.raised:        
-
 
77
        cmp    eax, FR_RAISED     
67
; ebx = [coordinate on axis x]*65536 + [size on axis x]
78
        je     .border_style_selected
-
 
79
.sunken:        
68
; ecx = [coordinate on axis y]*65536 + [size on axis y]
80
        cmp    eax, FR_SUNKEN
-
 
81
        jne    .etched
-
 
82
        xchg   edx, edi
-
 
83
        xchg   esi, ebp
69
;--------------------------------------
84
        jmp    .border_style_selected
70
; top
85
.etched:        
-
 
86
        cmp    eax, FR_ETCHED
-
 
87
        jne    .ridged
-
 
88
        xchg   edx, edi
-
 
89
        jmp    .border_style_selected
-
 
90
.ridged:        
-
 
91
        cmp    eax, FR_RIDGED
-
 
92
        jne    .double
71
	mov	bx,fr_start_x
93
        xchg   esi, ebp
-
 
94
        jmp    .border_style_selected
72
	shl	ebx,16
95
.double:    
-
 
96
        cmp    eax, FR_DOUBLE
-
 
97
        jne    .border_style_selected
-
 
98
        mov    edi, edx
-
 
99
        mov    esi, ebp
-
 
100
.border_style_selected:                
-
 
101
; Outer Top Line
-
 
102
        mov    eax, fr
73
	mov	bx,fr_start_x
103
        mov    bx, fr_start_x
74
	add	bx,fr_size_x
-
 
75
	dec	bx
-
 
76
	
-
 
77
	mov	cx,fr_start_y
104
        mov    cx, fr_start_y
-
 
105
        shl    ebx, 16
78
	shl	ecx,16
106
        shl    ecx, 16
-
 
107
        mov    bx, fr_size_x
-
 
108
        add    bx, fr_start_x
-
 
109
        sub    ebx, 1
79
	mov	cx,fr_start_y
110
        mov    cx, fr_start_y
80
 
-
 
81
	mcall	38,,,fr_ext_fr_col
111
        mov    eax, 38
82
	
-
 
83
	add	ecx,1 shl 16 +1
112
        int    64
84
	add	ebx,1 shl 16
113
; Outer Left Line
85
	dec	ebx
-
 
86
 
-
 
87
	mcall	,,,fr_int_fr_col
114
        mov    eax, fr
88
;--------------------------------------
-
 
89
; bottom
-
 
90
	mov	bx,fr_start_x
115
        mov    bx, fr_start_x
-
 
116
        add    cx, fr_size_y        
91
	shl	ebx,16
117
        sub    ecx, 1
-
 
118
        mov    eax, 38
-
 
119
        int    64                
-
 
120
; Inner Top Line
-
 
121
        mov    eax, fr
92
	mov	bx,fr_start_x
122
        mov    bx, fr_start_x
93
	add	bx,fr_size_x
-
 
94
	dec	bx
-
 
95
	
-
 
96
	mov	cx,fr_start_y
123
        mov    cx, fr_start_y
97
	add	cx,fr_size_y
124
        add    ebx, 1
98
	dec	cx
125
        add    ecx, 1
-
 
126
        shl    ebx, 16
99
	shl	ecx,16
127
        shl    ecx, 16
-
 
128
        mov    bx, fr_size_x
100
	mov	cx,fr_start_y
129
        mov    cx, fr_start_y
101
	add	cx,fr_size_y
130
        add    bx, fr_start_x        
102
	dec	cx
-
 
103
 
-
 
104
	mcall	,,,fr_ext_fr_col
131
        sub    ebx, 2
105
	
-
 
106
	sub	ecx,1 shl 16 +1
132
        add    ecx, 1
107
	add	ebx,1 shl 16
133
        mov    edx, esi
108
	dec	ebx
134
        mov    eax, 38
109
 
-
 
110
	mcall	,,,fr_int_fr_col
135
        int    64
111
;--------------------------------------
136
; Inner Left Line
112
; left
137
        mov    eax, fr
113
	mov	bx,fr_start_x
138
        mov    bx, fr_start_x
-
 
139
        add    cx, fr_size_y        
-
 
140
        add    ebx, 1
-
 
141
        sub    ecx, 3
-
 
142
        mov    edx, esi
-
 
143
        mov    eax, 38
-
 
144
        int    64    
-
 
145
; Outer Bottom Line    
-
 
146
        mov    eax, fr    
-
 
147
        mov    bx, fr_size_x
-
 
148
        mov    cx, fr_size_y        
-
 
149
        add    bx, fr_start_x
-
 
150
        add    cx, fr_start_y   
-
 
151
        sub    ebx, 1 
-
 
152
        sub    ecx, 1
114
	shl	ebx,16
153
        shl    ebx, 16
115
	mov	bx,fr_start_x
-
 
116
	
-
 
117
	mov	cx,fr_start_y
-
 
118
	shl	ecx,16
154
        shl    ecx, 16
119
	mov	cx,fr_start_y
-
 
120
	add	cx,fr_size_y
-
 
121
	dec	cx
-
 
122
 
-
 
123
	mcall	,,,fr_ext_fr_col
-
 
124
	
-
 
125
	add	ebx,1 shl 16 +1
-
 
126
	add	ecx,1 shl 16
-
 
127
	dec	ecx
-
 
128
 
-
 
129
	mcall	,,,fr_int_fr_col
-
 
130
 
-
 
131
;--------------------------------------
-
 
132
; right
-
 
133
	mov	bx,fr_start_x
155
        mov    bx, fr_start_x
-
 
156
        mov    cx, fr_size_y
-
 
157
        add    cx, fr_start_y
-
 
158
        sub    ecx, 1
-
 
159
        mov    edx, edi
-
 
160
        mov    eax, 38
-
 
161
        int    64
-
 
162
; Outer Right Line
-
 
163
        mov    eax, fr
134
	add	bx,fr_size_x
164
        add    bx, fr_size_x        
135
	dec	bx
165
        sub    ebx, 1
-
 
166
        mov    cx, fr_start_y
-
 
167
        mov    edx, edi
-
 
168
        mov    eax, 38
-
 
169
        int    64           
-
 
170
; Inner Bottom Line
-
 
171
        mov    eax, fr
-
 
172
        mov    bx, fr_size_x
-
 
173
        mov    cx, fr_size_y        
-
 
174
        add    bx, fr_start_x
-
 
175
        add    cx, fr_start_y   
-
 
176
        sub    ebx, 2
-
 
177
        sub    ecx, 2
136
	shl	ebx,16
178
        shl    ebx, 16
-
 
179
        shl    ecx, 16
137
	mov	bx,fr_start_x
180
        mov    bx, fr_start_x
-
 
181
        mov    cx, fr_size_y
-
 
182
        add    cx, fr_start_y
-
 
183
        add    ebx, 1
-
 
184
        sub    ecx, 2
-
 
185
        mov    edx, ebp
-
 
186
        mov    eax, 38
-
 
187
        int    64
-
 
188
; Inner Right Line
-
 
189
        mov    eax, fr
-
 
190
        mov    cx, fr_start_y        
138
	add	bx,fr_size_x
191
        add    bx, fr_size_x
-
 
192
        sub    ebx, 3
139
	dec	bx
193
        add    ecx, 1
-
 
194
        mov    edx, ebp
-
 
195
        mov    eax, 38
-
 
196
        int    64        
-
 
197
;----------------------------------------------------------------------
-
 
198
        mov    eax, fr        
-
 
199
        test   dword fr_flags, FR_FILLED
-
 
200
        je     .fill_exit
Line -... Line 201...
-
 
201
        
140
 
202
        mov    bx, fr_start_x 
-
 
203
        mov    cx, fr_start_y
-
 
204
        add    ebx, 2
-
 
205
        add    ecx, 2
141
	mov	cx,fr_start_y
206
        shl    ebx, 16
142
	shl	ecx,16
207
        shl    ecx, 16
143
	mov	cx,fr_start_y
208
        mov    bx, fr_size_x
-
 
209
        mov    cx, fr_size_y
144
	add	cx,fr_size_y
210
        sub    ebx, 4
145
	dec	cx
-
 
146
 
211
        sub    ecx, 4
147
	mcall	,,,fr_ext_fr_col
-
 
148
	
212
        mov    edx, fr_font_backgr_color
149
	sub	ebx,1 shl 16 +1
213
        mov    eax, 13
150
	add	ecx,1 shl 16
214
        int    64               
151
	dec	ecx
-
 
152
 
-
 
153
	mcall	,,,fr_int_fr_col
215
.fill_exit:  
-
 
216
;----------------------------------------------------------------------
154
;----------------------------------------------------------------------
217
        mov    eax, fr
155
	cmp	fr_draw_text_flag,dword 0
218
        test    dword fr_flags, FR_CAPTION
Line 156... Line 219...
156
	je	.exit
219
	je	.exit
157
 
220
 
158
	mov	ecx,0xC0000000
221
	mov	ecx,0xC0000000
159
	mov	eax,fr_font_number
222
	mov	eax,fr_font_number
160
	and	eax,11b
223
	and	eax,11b
-
 
224
	shl	eax,28
161
	shl	eax,28
225
	add	ecx,eax
162
	add	ecx,eax
226
        mov    eax, fr
163
	mov	eax,fr_font_color
227
	mov	eax,fr_font_color
Line 164... Line 228...
164
	and	eax,0xffffff
228
	and	eax,0xffffff
Line 169... Line 233...
169
	mov	eax,fr_font_backgr_color
233
	mov	eax,fr_font_backgr_color
170
	and	eax,0xffffff
234
	and	eax,0xffffff
Line 171... Line 235...
171
 
235
 
Line -... Line 236...
-
 
236
	xor	esi,esi
172
	xor	esi,esi
237
 
173
 
238
        mov    eax, fr
174
	mov	bx,fr_start_x
239
	mov	bx,fr_start_x
175
	add	bx,10
240
	add	bx,10
176
	shl	ebx,16
241
	shl	ebx,16
Line 192... Line 257...
192
	
257
	
193
	add	bx,fr_size_y
258
	add	bx,fr_size_y
194
;--------------------------------------
259
;--------------------------------------
195
align 4
260
align 4
196
.draw_1:
261
.draw_1:
197
	push	edi
262
        mov     edx,fr_text_pointer
198
	mov	edi,eax
263
        mov     edi,fr_font_backgr_color
199
	mcall	4
-
 
200
	pop	edi
264
	mcall	4
201
;----------------------------------------------------------------------
265
;----------------------------------------------------------------------
202
align 4
266
align 4
203
.exit:
267
.exit:
204
frame_exit
268
frame_exit