Subversion Repositories Kolibri OS

Rev

Rev 2455 | Rev 3588 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2455 mario79 3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 2463 $
9
 
10
 
11
include "skindata.inc"
12
 
13
;skin_data = 0x00778000
2436 mario79 14
;------------------------------------------------------------------------------
15
align 4
2288 clevermous 16
read_skin_file:
17
        stdcall load_file, ebx
18
        test    eax, eax
19
        jz      .notfound
20
        cmp     dword [eax], 'SKIN'
21
        jnz     .noskin
22
        cmp     ebx, 32*1024
23
        jb      @f
24
        mov     ebx, 32*1024
2436 mario79 25
;--------------------------------------
26
align 4
2288 clevermous 27
@@:
28
        lea     ecx, [ebx+3]
29
        shr     ecx, 2
30
        mov     esi, eax
31
        mov     edi, skin_data
32
        rep movsd
33
        stdcall kernel_free, eax
34
 
35
        call    parse_skin_data
36
        xor     eax, eax
37
        ret
2436 mario79 38
;--------------------------------------
39
align 4
2288 clevermous 40
.notfound:
41
        xor     eax, eax
42
        inc     eax
43
        ret
2436 mario79 44
;--------------------------------------
45
align 4
2288 clevermous 46
.noskin:
47
        stdcall kernel_free, eax
48
        push    2
49
        pop     eax
50
        ret
2436 mario79 51
;------------------------------------------------------------------------------
2381 hidnplayr 52
struct  SKIN_HEADER
53
        ident           dd ?
54
        version         dd ?
55
        params          dd ?
56
        buttons         dd ?
57
        bitmaps         dd ?
2288 clevermous 58
ends
59
 
2381 hidnplayr 60
struct  SKIN_PARAMS
61
        skin_height     dd ?
62
        margin.right    dw ?
63
        margin.left     dw ?
64
        margin.bottom   dw ?
65
        margin.top      dw ?
66
        colors.inner    dd ?
67
        colors.outer    dd ?
68
        colors.frame    dd ?
69
        colors_1.inner  dd ?
70
        colors_1.outer  dd ?
71
        colors_1.frame  dd ?
72
        dtp.size        dd ?
73
        dtp.data        rb 40
2288 clevermous 74
ends
75
 
2381 hidnplayr 76
struct  SKIN_BUTTONS
77
        type    dd ?
78
; position
79
        left    dw ?
80
        top     dw ?
81
; size
82
        width   dw ?
83
        height  dw ?
2288 clevermous 84
ends
85
 
2381 hidnplayr 86
struct  SKIN_BITMAPS
87
        kind    dw ?
88
        type    dw ?
89
        data    dd ?
2288 clevermous 90
ends
2436 mario79 91
;------------------------------------------------------------------------------
92
align 4
2288 clevermous 93
load_default_skin:
94
        mov     [_skinh], 22
95
        mov     ebx, _skin_file_default
96
        call    read_skin_file
97
        ret
2436 mario79 98
;------------------------------------------------------------------------------
99
align 4
2288 clevermous 100
parse_skin_data:
101
        mov     ebp, skin_data
102
        cmp     [ebp+SKIN_HEADER.ident], 'SKIN'
103
        jne     .exit
104
 
105
        mov     edi, skin_udata
106
        mov     ecx, (skin_udata.end-skin_udata)/4
107
        xor     eax, eax
108
        cld
109
        rep stosd
110
 
111
        mov     ebx, [ebp+SKIN_HEADER.params]
112
        add     ebx, skin_data
113
        mov     eax, [ebx+SKIN_PARAMS.skin_height]
114
        mov     [_skinh], eax
115
        mov     eax, [ebx+SKIN_PARAMS.colors.inner]
116
        mov     [skin_active.colors.inner], eax
117
        mov     eax, [ebx+SKIN_PARAMS.colors.outer]
118
        mov     [skin_active.colors.outer], eax
119
        mov     eax, [ebx+SKIN_PARAMS.colors.frame]
120
        mov     [skin_active.colors.frame], eax
121
        mov     eax, [ebx+SKIN_PARAMS.colors_1.inner]
122
        mov     [skin_inactive.colors.inner], eax
123
        mov     eax, [ebx+SKIN_PARAMS.colors_1.outer]
124
        mov     [skin_inactive.colors.outer], eax
125
        mov     eax, [ebx+SKIN_PARAMS.colors_1.frame]
126
        mov     [skin_inactive.colors.frame], eax
127
        lea     esi, [ebx+SKIN_PARAMS.dtp.data]
128
        mov     edi, common_colours
129
        mov     ecx, [ebx+SKIN_PARAMS.dtp.size]
130
        and     ecx, 127
131
        rep movsb
132
        mov     eax, dword[ebx+SKIN_PARAMS.margin.right]
133
        mov     dword[_skinmargins+0], eax
134
        mov     eax, dword[ebx+SKIN_PARAMS.margin.bottom]
135
        mov     dword[_skinmargins+4], eax
136
 
137
        mov     ebx, [ebp+SKIN_HEADER.bitmaps]
138
        add     ebx, skin_data
2436 mario79 139
;--------------------------------------
140
align 4
141
.lp1:
2288 clevermous 142
        cmp     dword[ebx], 0
143
        je      .end_bitmaps
144
        movzx   eax, [ebx+SKIN_BITMAPS.kind]
145
        movzx   ecx, [ebx+SKIN_BITMAPS.type]
146
        dec     eax
147
        jnz     .not_left
148
        xor     eax, eax
149
        mov     edx, skin_active.left.data
150
        or      ecx, ecx
151
        jnz     @f
152
        mov     edx, skin_inactive.left.data
2436 mario79 153
;--------------------------------------
154
align 4
155
@@:
2288 clevermous 156
        jmp     .next_bitmap
2436 mario79 157
;--------------------------------------
158
align 4
159
.not_left:
2288 clevermous 160
        dec     eax
161
        jnz     .not_oper
162
        mov     esi, [ebx+SKIN_BITMAPS.data]
163
        add     esi, skin_data
164
        mov     eax, [esi+0]
165
        neg     eax
166
        mov     edx, skin_active.oper.data
167
        or      ecx, ecx
168
        jnz     @f
169
        mov     edx, skin_inactive.oper.data
2436 mario79 170
;--------------------------------------
171
align 4
172
@@:
2288 clevermous 173
        jmp     .next_bitmap
2436 mario79 174
;--------------------------------------
175
align 4
176
.not_oper:
2288 clevermous 177
        dec     eax
178
        jnz     .not_base
179
        mov     eax, [skin_active.left.width]
180
        mov     edx, skin_active.base.data
181
        or      ecx, ecx
182
        jnz     @f
183
        mov     eax, [skin_inactive.left.width]
184
        mov     edx, skin_inactive.base.data
2436 mario79 185
;--------------------------------------
186
align 4
187
@@:
2288 clevermous 188
        jmp     .next_bitmap
2436 mario79 189
;--------------------------------------
190
align 4
191
.not_base:
2288 clevermous 192
        add     ebx, 8
193
        jmp     .lp1
2436 mario79 194
;--------------------------------------
195
align 4
196
.next_bitmap:
2288 clevermous 197
        mov     ecx, [ebx+SKIN_BITMAPS.data]
198
        add     ecx, skin_data
199
        mov     [edx+4], eax
200
        mov     eax, [ecx+0]
201
        mov     [edx+8], eax
202
        add     ecx, 8
203
        mov     [edx+0], ecx
204
        add     ebx, 8
205
        jmp     .lp1
2436 mario79 206
;--------------------------------------
207
align 4
208
.end_bitmaps:
2288 clevermous 209
        mov     ebx, [ebp+SKIN_HEADER.buttons]
210
        add     ebx, skin_data
2436 mario79 211
;--------------------------------------
212
align 4
213
.lp2:
2288 clevermous 214
        cmp     dword[ebx], 0
215
        je      .end_buttons
216
        mov     eax, [ebx+SKIN_BUTTONS.type]
217
        dec     eax
218
        jnz     .not_close
219
        mov     edx, skin_btn_close
220
        jmp     .next_button
2436 mario79 221
;--------------------------------------
222
align 4
223
.not_close:
2288 clevermous 224
        dec     eax
225
        jnz     .not_minimize
226
        mov     edx, skin_btn_minimize
227
        jmp     .next_button
2436 mario79 228
;--------------------------------------
229
align 4
230
.not_minimize:
2288 clevermous 231
        add     ebx, 12
232</