Subversion Repositories Kolibri OS

Rev

Rev 33 | Rev 49 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33 Rev 35
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                          ;;
2
;;                                          ;;
3
;;   WINDOW SKIN for MenuetOS               ;;
3
;;   WINDOW SKIN for MenuetOS               ;;
4
;;                                          ;;
4
;;                                          ;;
5
;;   entryway@bkg.lt                        ;;
5
;;   entryway@bkg.lt                        ;;
6
;;                                          ;;
6
;;                                          ;;
7
;;   Bugfixes & upgrades by                 ;;
7
;;   Bugfixes & upgrades by                 ;;
8
;;             Samuel Rodriguez Perez       ;;
8
;;             Samuel Rodriguez Perez       ;;
9
;;             Xeoda@ciberirmandade.org     ;;
9
;;             Xeoda@ciberirmandade.org     ;;
10
;;                                          ;;
10
;;                                          ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
 
12
 
13
 
13
 
14
 
14
 
15
include "skindata.inc"
15
include "skindata.inc"
16
 
16
 
17
virtual at 0
17
virtual at 0
18
  bmp_header:
18
  bmp_header:
19
    .type       rw  1  ; "BM" signature
19
    .type       rw  1  ; "BM" signature
20
    .filesize   rd  1  ; size of the file
20
    .filesize   rd  1  ; size of the file
21
    .reserved   rd  1  ; zero
21
    .reserved   rd  1  ; zero
22
    .offbits    rd  1  ; pointer to image data
22
    .offbits    rd  1  ; pointer to image data
23
    ;----------------
23
    ;----------------
24
    .headsize   rd  1  ; usually 40 bytes for image header
24
    .headsize   rd  1  ; usually 40 bytes for image header
25
    .width      rd  1
25
    .width      rd  1
26
    .height     rd  1
26
    .height     rd  1
27
    .planes     rw  1  ; usually 1
27
    .planes     rw  1  ; usually 1
28
    .bitcount   rw  1  ; currently 24 bits/pixel (0x18)
28
    .bitcount   rw  1  ; currently 24 bits/pixel (0x18)
29
    .compress   rd  1  ; zero
29
    .compress   rd  1  ; zero
30
    .sizeimage  rd  1  ; x*y*(bitcount/8)
30
    .sizeimage  rd  1  ; x*y*(bitcount/8)
31
    .unused     rd  4  ; these bits aren't used by MeOS
31
    .unused     rd  4  ; these bits aren't used by MeOS
32
  bmp_data:
32
  bmp_data:
33
end virtual
33
end virtual
34
 
34
 
35
virtual at 0x778000
35
virtual at 0x778000
36
  _bmp_bpl dd ?        ; bytes per line
36
  _bmp_bpl dd ?        ; bytes per line
37
  _bmp_dpl dd ?        ; dwords per line
37
  _bmp_dpl dd ?        ; dwords per line
38
  _bmp_zb  dd ?        ; bytes filled by zeroes at the end of a scanline
38
  _bmp_zb  dd ?        ; bytes filled by zeroes at the end of a scanline
39
 align 32
39
 align 32
40
  raw_data:
40
  raw_data:
41
end virtual
41
end virtual
42
 
42
 
43
bmp2raw:
43
bmp2raw:
44
; esi = to bmp data (source)
44
; esi = to bmp data (source)
45
; edi = to raw data (destination)
45
; edi = to raw data (destination)
46
    cmp   [esi+bmp_header.type],'BM'     ; check if bmp file is really loaded
46
    cmp   [esi+bmp_header.type],'BM'     ; check if bmp file is really loaded
47
    jne   .finish
47
    jne   .finish
48
    mov   edx,esi
48
    mov   edx,esi
49
 
49
 
50
    mov   eax,[edx+bmp_header.width]
50
    mov   eax,[edx+bmp_header.width]
51
    imul  eax,3
51
    imul  eax,3
52
    push  eax
52
    push  eax
53
    test  eax,11b
53
    test  eax,11b
54
    jz    @f
54
    jz    @f
55
    add   eax,4
55
    add   eax,4
56
  @@:
56
  @@:
57
    shr   eax,2
57
    shr   eax,2
58
    mov   [_bmp_dpl],eax
58
    mov   [_bmp_dpl],eax
59
    shl   eax,2
59
    shl   eax,2
60
    mov   [_bmp_bpl],eax
60
    mov   [_bmp_bpl],eax
61
    pop   ebx
61
    pop   ebx
62
    sub   eax,ebx
62
    sub   eax,ebx
63
    mov   [_bmp_zb],eax
63
    mov   [_bmp_zb],eax
64
 
64
 
65
    add   esi,bmp_data
65
    add   esi,bmp_data
66
    mov   eax,[_bmp_bpl]
66
    mov   eax,[_bmp_bpl]
67
    imul  eax,[edx+bmp_header.height]
67
    imul  eax,[edx+bmp_header.height]
68
    add   esi,eax
68
    add   esi,eax
69
    mov   ebx,[edx+bmp_header.height]    ; ebx = y
69
    mov   ebx,[edx+bmp_header.height]    ; ebx = y
70
    cld
70
    cld
71
    .y_begin:
71
    .y_begin:
72
       sub   esi,[_bmp_bpl]
72
       sub   esi,[_bmp_bpl]
73
       push  esi
73
       push  esi
74
       mov   ecx,[_bmp_dpl]
74
       mov   ecx,[_bmp_dpl]
75
       rep   movsd
75
       rep   movsd
76
       pop   esi
76
       pop   esi
77
       sub   edi,[_bmp_zb]
77
       sub   edi,[_bmp_zb]
78
    dec   ebx
78
    dec   ebx
79
    jne   .y_begin
79
    jne   .y_begin
80
 
80
 
81
.finish:
81
.finish:
82
    ret
82
    ret
83
 
83
 
84
 
84
 
85
; BMP support by Ivan Poddubny
85
; BMP support by Ivan Poddubny
86
; 1) load LEFT.BMP
86
; 1) load LEFT.BMP
87
;   a) _skinleftw = bmp_width
87
;   a) _skinleftw = bmp_width
88
;   b) _skinleft = 0
88
;   b) _skinleft = 0
89
;   c) _refleft = 0x778000
89
;   c) _refleft = 0x778000
90
;   d) convert
90
;   d) convert
91
; 2) load BASE.BMP
91
; 2) load BASE.BMP
92
;   a) _skinbasew = bmp_width
92
;   a) _skinbasew = bmp_width
93
;   b) _skinbase = _skinleftw
93
;   b) _skinbase = _skinleftw
94
;   c) _refbase = _refleft+sizeof(left_raw_converted)
94
;   c) _refbase = _refleft+sizeof(left_raw_converted)
95
;   d) convert
95
;   d) convert
96
; 3) load OPER.BMP
96
; 3) load OPER.BMP
97
;   a) _skinoper = minus width from bmp file
97
;   a) _skinoper = minus width from bmp file
98
;   b) _skinoperw = width from bmp file
98
;   b) _skinoperw = width from bmp file
99
;   c) _refoper = _refbase+sizeof(oper_raw_converted)
99
;   c) _refoper = _refbase+sizeof(oper_raw_converted)
100
;   d) convert
100
;   d) convert
101
; 4) set height
101
; 4) set height
102
 
102
 
103
load_bmp_file:
103
load_bmp_file:
104
; eax = pointer to filename
104
; eax = pointer to filename
105
    mov   ebx, 1
105
    mov   ebx, 1
106
    or    ecx, -1
106
    or    ecx, -1
107
    mov   edx, 0x90000
107
    mov   edx, 0x90000
108
    mov   esi, 12
108
    mov   esi, 12
109
    call  fileread
109
    call  fileread
110
    ret
110
    ret
111
 
111
 
112
 
112
 
113
load_default_skin:
113
load_default_skin:
114
    pushad
114
    pushad
115
    mov   eax, _fileleft
115
    mov   eax, _fileleft
116
    call  load_bmp_file
116
    call  load_bmp_file
117
    mov   eax, [0x90000+bmp_header.width]
117
    mov   eax, [0x90000+bmp_header.width]
118
    mov   [_skinleftw], eax
118
    mov   [_skinleftw], eax
119
    mov   [_skinleft], 0
119
    mov   [_skinleft], 0
120
    mov   edi, raw_data
120
    mov   edi, raw_data
121
    mov   [_refleft], edi
121
    mov   [_refleft], edi
122
    mov   esi, 0x90000
122
    mov   esi, 0x90000
123
    call  bmp2raw
123
    call  bmp2raw
124
    mov   eax, [_bmp_bpl]
124
    mov   eax, [_bmp_bpl]
125
    imul  eax, [0x90000+bmp_header.height]
125
    imul  eax, [0x90000+bmp_header.height]
126
    push  eax
126
    push  eax
127
 
127
 
128
    mov   eax, _filebase
128
    mov   eax, _filebase
129
    call  load_bmp_file
129
    call  load_bmp_file
130
    mov   eax, [0x90000+bmp_header.width]
130
    mov   eax, [0x90000+bmp_header.width]
131
    mov   [_skinbasew], eax
131
    mov   [_skinbasew], eax
132
    mov   eax, [_skinleftw]
132
    mov   eax, [_skinleftw]
133
    mov   [_skinbase], eax
133
    mov   [_skinbase], eax
134
    pop   eax
134
    pop   eax
135
    add   eax, [_refleft]
135
    add   eax, [_refleft]
136
    ; align to 32-byte boundary
136
    ; align to 32-byte boundary
137
    test  eax, 11111b
137
    test  eax, 11111b
138
    jz    @f
138
    jz    @f
139
    shr   eax, 5
139
    shr   eax, 5
140
    inc   eax
140
    inc   eax
141
    shl   eax, 5
141
    shl   eax, 5
142
  @@:
142
  @@:
143
    ; save base address
143
    ; save base address
144
    mov   [_refbase], eax
144
    mov   [_refbase], eax
145
    ; convert
145
    ; convert
146
    mov   edi, eax
146
    mov   edi, eax
147
    mov   esi, 0x90000
147
    mov   esi, 0x90000
148
    call  bmp2raw
148
    call  bmp2raw
149
    mov   eax, [_bmp_bpl]
149
    mov   eax, [_bmp_bpl]
150
    imul  eax, [0x90000+bmp_header.height]
150
    imul  eax, [0x90000+bmp_header.height]
151
    push  eax
151
    push  eax
152
 
152
 
153
    mov   eax, _fileoper
153
    mov   eax, _fileoper
154
    call  load_bmp_file
154
    call  load_bmp_file
155
    mov   eax, [0x90000+bmp_header.width]
155
    mov   eax, [0x90000+bmp_header.width]
156
    mov   [_skinoperw], eax
156
    mov   [_skinoperw], eax
157
    neg   eax
157
    neg   eax
158
    mov   [_skinoper], eax
158
    mov   [_skinoper], eax
159
    pop   eax
159
    pop   eax
160
    add   eax, [_refbase]
160
    add   eax, [_refbase]
161
    ; align to 32-byte boundary
161
    ; align to 32-byte boundary
162
    test  eax, 11111b
162
    test  eax, 11111b
163
    jz    @f
163
    jz    @f
164
    shr   eax, 5
164
    shr   eax, 5
165
    inc   eax
165
    inc   eax
166
    shl   eax, 5
166
    shl   eax, 5
167
  @@:
167
  @@:
168
    mov   [_refoper], eax
168
    mov   [_refoper], eax
169
    mov   edi, eax
169
    mov   edi, eax
170
    mov   esi, 0x90000
170
    mov   esi, 0x90000
171
    call  bmp2raw
171
    call  bmp2raw
172
    mov   eax, [0x90000+bmp_header.height]
172
    mov   eax, [0x90000+bmp_header.height]
173
    mov   [_skinh], eax
173
    mov   [_skinh], eax
174
    popad
174
    popad
175
 
175
 
176
    ret
176
    ret
177
 
177
 
178
load_default_skin_1:          
178
load_default_skin_1:          
179
    pushad
179
    pushad
180
    mov   eax, _fileleft_1
180
    mov   eax, _fileleft_1
181
    call  load_bmp_file
181
    call  load_bmp_file
182
    mov   eax, [0x90000+bmp_header.width]
182
    mov   eax, [0x90000+bmp_header.width]
183
    mov   [_skinleftw], eax
183
    mov   [_skinleftw], eax
184
    mov   [_skinleft_1], 0
184
    mov   [_skinleft_1], 0
185
    mov   edi, raw_data+1000h
185
    mov   edi, raw_data+1000h
186
    mov   [_refleft_1], edi
186
    mov   [_refleft_1], edi
187
    mov   esi, 0x90000
187
    mov   esi, 0x90000
188
    call  bmp2raw
188
    call  bmp2raw
189
    mov   eax, [_bmp_bpl]
189
    mov   eax, [_bmp_bpl]
190
    imul  eax, [0x90000+bmp_header.height]
190
    imul  eax, [0x90000+bmp_header.height]
191
    push  eax
191
    push  eax
192
 
192
 
193
    mov   eax, _filebase_1
193
    mov   eax, _filebase_1
194
    call  load_bmp_file
194
    call  load_bmp_file
195
    mov   eax, [0x90000+bmp_header.width]
195
    mov   eax, [0x90000+bmp_header.width]
196
    mov   [_skinbasew], eax
196
    mov   [_skinbasew], eax
197
    mov   eax, [_skinleftw]
197
    mov   eax, [_skinleftw]
198
    mov   [_skinbase], eax
198
    mov   [_skinbase], eax
199
    pop   eax
199
    pop   eax
200
    add   eax, [_refleft_1]
200
    add   eax, [_refleft_1]
201
    ; align to 32-byte boundary
201
    ; align to 32-byte boundary
202
    test  eax, 11111b
202
    test  eax, 11111b
203
    jz    @f
203
    jz    @f
204
    shr   eax, 5
204
    shr   eax, 5
205
    inc   eax
205
    inc   eax
206
    shl   eax, 5
206
    shl   eax, 5
207
  @@:
207
  @@:
208
    ; save base address
208
    ; save base address
209
    mov   [_refbase_1], eax
209
    mov   [_refbase_1], eax
210
    ; convert
210
    ; convert
211
    mov   edi, eax
211
    mov   edi, eax
212
    mov   esi, 0x90000
212
    mov   esi, 0x90000
213
    call  bmp2raw
213
    call  bmp2raw
214
    mov   eax, [_bmp_bpl]
214
    mov   eax, [_bmp_bpl]
215
    imul  eax, [0x90000+bmp_header.height]
215
    imul  eax, [0x90000+bmp_header.height]
216
    push  eax
216
    push  eax
217
 
217
 
218
    mov   eax, _fileoper_1
218
    mov   eax, _fileoper_1
219
    call  load_bmp_file
219
    call  load_bmp_file
220
    mov   eax, [0x90000+bmp_header.width]
220
    mov   eax, [0x90000+bmp_header.width]
221
    mov   [_skinoperw], eax
221
    mov   [_skinoperw], eax
222
    neg   eax
222
    neg   eax
223
    mov   [_skinoper], eax
223
    mov   [_skinoper], eax
224
    pop   eax
224
    pop   eax
225
    add   eax, [_refbase_1]
225
    add   eax, [_refbase_1]
226
    ; align to 32-byte boundary
226
    ; align to 32-byte boundary
227
    test  eax, 11111b
227
    test  eax, 11111b
228
    jz    @f
228
    jz    @f
229
    shr   eax, 5
229
    shr   eax, 5
230
    inc   eax
230
    inc   eax
231
    shl   eax, 5
231
    shl   eax, 5
232
  @@:
232
  @@:
233
    mov   [_refoper_1], eax
233
    mov   [_refoper_1], eax
234
    mov   edi, eax
234
    mov   edi, eax
235
    mov   esi, 0x90000
235
    mov   esi, 0x90000
236
    call  bmp2raw
236
    call  bmp2raw
237
    mov   eax, [0x90000+bmp_header.height]
237
    mov   eax, [0x90000+bmp_header.height]
238
    mov   [_skinh], eax
238
    mov   [_skinh], eax
239
    popad
239
    popad
240
    ret
240
    ret
241
 
241
 
242
drawwindow_IV:
242
drawwindow_IV:
243
 
243
;param1 - aw_yes
-
 
244
 
244
        pusha
245
        pusha
245
 
246
 
246
        push  edx
247
        push  edx
247
 
248
 
248
        mov   edi,[esp]                              ; RECTANGLE
249
        mov   edi,[esp]                              ; RECTANGLE
249
 
250
 
250
        mov   eax,[edi+0]
251
        mov   eax,[edi+0]
251
        shl   eax,16
252
        shl   eax,16
252
        mov   ax,[edi+0]
253
        mov   ax,[edi+0]
253
        add   ax,[edi+8]
254
        add   ax,[edi+8]
254
        mov   ebx,[edi+4]
255
        mov   ebx,[edi+4]
255
        shl   ebx,16
256
        shl   ebx,16
256
        mov   bx,[edi+4]
257
        mov   bx,[edi+4]
257
        add   bx,[edi+12]
258
        add   bx,[edi+12]
258
;        mov   esi,[edi+24]
259
;        mov   esi,[edi+24]
259
;        shr   esi,1
260
;        shr   esi,1
260
;        and   esi,0x007f7f7f
261
;        and   esi,0x007f7f7f
261
        mov   esi,[_coloroutborder]
262
        mov   esi,[_coloroutborder]
262
        call  draw_rectangle
263
        call  draw_rectangle
263
        mov   ecx,3
264
        mov   ecx,3
264
      _dw3l:
265
      _dw3l:
265
        add   eax,1*65536-1
266
        add   eax,1*65536-1
266
        add   ebx,1*65536-1
267
        add   ebx,1*65536-1
267
        test  ax,ax
268
        test  ax,ax
268
        js    no_skin_add_button
269
        js    no_skin_add_button
269
        test  bx,bx
270
        test  bx,bx
270
        js    no_skin_add_button
271
        js    no_skin_add_button
271
        mov   esi,[_colorframe] ;[edi+24]
272
        mov   esi,[_colorframe] ;[edi+24]
272
        call  draw_rectangle
273
        call  draw_rectangle
273
        dec   ecx
274
        dec   ecx
274
        jnz   _dw3l
275
        jnz   _dw3l
275
        mov   esi,[_colorborder]
276
        mov   esi,[_colorborder]
276
        add   eax,1*65536-1
277
        add   eax,1*65536-1
277
        add   ebx,1*65536-1
278
        add   ebx,1*65536-1
278
        test  ax,ax
279
        test  ax,ax
279
        js    no_skin_add_button
280
        js    no_skin_add_button
280
        test  bx,bx
281
        test  bx,bx
281
        js    no_skin_add_button
282
        js    no_skin_add_button
282
        call  draw_rectangle
283
        call  draw_rectangle
283
 
284
 
284
        mov   esi,[esp]
285
        mov   esi,[esp]
285
        mov   eax,[esi+8]    ; window width
286
        mov   eax,[esi+8]    ; window width
286
        mov   edx,[_skinleft]
287
        mov   edx,[_skinleft]
287
        shl   edx,16
288
        shl   edx,16
288
        mov   ecx,[_skinleftw]
289
        mov   ecx,[_skinleftw]
289
        shl   ecx,16
290
        shl   ecx,16
290
        add   ecx,[_skinh]
291
        add   ecx,[_skinh]
291
 
292
 
292
        cmp   [aw_yes],1
293
        cmp   byte [esp+32+4+4],1
293
;        cmp   [esp+32+4+2], word 1
294
        mov   ebx, [_refleft_1]
294
        jne   @f
295
        jne   @f
295
        mov   ebx,[_refleft]
296
        mov   ebx,[_refleft]
296
        jmp   no_aw_3
-
 
297
     @@:
297
     @@:
298
        mov   ebx,[_refleft_1]
-
 
299
      no_aw_3:
-
 
300
        call  sys_putimage
298
        call  sys_putimage
301
 
299
 
302
        mov   esi,[esp]
300
        mov   esi,[esp]
303
        mov   eax,[esi+8]
301
        mov   eax,[esi+8]
304
        sub   eax,[_skinleftw]
302
        sub   eax,[_skinleftw]
305
        sub   eax,[_skinoperw]
303
        sub   eax,[_skinoperw]
306
        cmp   eax,[_skinbase]
304
        cmp   eax,[_skinbase]
307
        jng   non_base
305
        jng   non_base
308
        xor   edx,edx
306
        xor   edx,edx
309
        mov   ebx,[_skinbasew]
307
        mov   ebx,[_skinbasew]
310
        div   ebx
308
        div   ebx
311
 
309
 
312
        inc   eax
310
        inc   eax
313
 
311
 
314
        cmp   [aw_yes],1
312
        cmp   byte [esp+32+4+4], 1
315
;        cmp   [esp+32+4+2], word 1
313
        mov   ebx,[_refbase_1]
316
        jne   @f
314
        jne   @f
317
        mov   ebx,[_refbase]
315
        mov   ebx,[_refbase]
318
        jmp   no_aw_2
-
 
319
     @@:
316
     @@:
320
        mov   ebx,[_refbase_1]
-
 
321
      no_aw_2:
317
 
322
        mov   ecx,[_skinbasew]
318
        mov   ecx,[_skinbasew]
323
        shl   ecx,16
319
        shl   ecx,16
324
        add   ecx,[_skinh]
320
        add   ecx,[_skinh]
325
        mov   edx,[_skinbase]
321
        mov   edx,[_skinbase]
326
        sub   edx,[_skinbasew]
322
        sub   edx,[_skinbasew]
327
        shl   edx,16
323
        shl   edx,16
328
      baseskinloop:
324
      baseskinloop:
329
        shr   edx,16
325
        shr   edx,16
330
        add   edx,[_skinbasew]
326
        add   edx,[_skinbasew]
331
        shl   edx,16
327
        shl   edx,16
332
 
328
 
333
        push  eax ebx ecx edx
329
        push  eax ebx ecx edx
334
        call  sys_putimage
330
        call  sys_putimage
335
        pop   edx ecx ebx eax
331
        pop   edx ecx ebx eax
336
 
332
 
337
        dec   eax
333
        dec   eax
338
        jnz   baseskinloop
334
        jnz   baseskinloop
339
      non_base:
335
      non_base:
340
 
336
 
341
        mov   esi,[esp]
337
        mov   esi,[esp]
342
        mov   edx,[esi+8]
338
        mov   edx,[esi+8]
343
        sub   edx,[_skinoperw]
339
        sub   edx,[_skinoperw]
344
        inc   edx
340
        inc   edx
345
        shl   edx,16
341
        shl   edx,16
346
        cmp   [aw_yes],1
342
        cmp   byte [esp+32+4+4], 1
347
;        cmp   [esp+32+4+2], word 1
343
        mov   ebx,[_refoper_1]
348
        jne   @f
344
        jne   @f
349
        mov   ebx,[_refoper]
345
        mov   ebx,[_refoper]
350
        jmp   no_aw_1
346
     @@:
351
     @@:
-
 
352
        mov   ebx,[_refoper_1]
347
 
353
      no_aw_1:
-
 
354
        mov   ecx,[_skinoperw]
348
        mov   ecx,[_skinoperw]
355
        shl   ecx,16
349
        shl   ecx,16
356
        add   ecx,[_skinh]
350
        add   ecx,[_skinh]
357
        call  sys_putimage
351
        call  sys_putimage
358
 
352
 
359
        mov   esi,[esp]
353
        mov   esi,[esp]
360
 
354
 
361
        mov   edx,[esi+04]                       ; WORK AREA
355
        mov   edx,[esi+04]                       ; WORK AREA
362
        add   edx,21+5
356
        add   edx,21+5
363
        mov   ebx,[esi+04]
357
        mov   ebx,[esi+04]
364
        add   ebx,[esi+12]
358
        add   ebx,[esi+12]
365
        cmp   edx,ebx
359
        cmp   edx,ebx
366
        jg    _noinside2
360
        jg    _noinside2
367
        mov   eax,5
361
        mov   eax,5
368
        mov   ebx,[_skinh]
362
        mov   ebx,[_skinh]
369
        mov   ecx,[esi+8]
363
        mov   ecx,[esi+8]
370
        mov   edx,[esi+12]
364
        mov   edx,[esi+12]
371
        sub   ecx,4
365
        sub   ecx,4
372
        sub   edx,4
366
        sub   edx,4
373
        mov   edi,[esi+16]
367
        mov   edi,[esi+16]
374
        call  [drawbar]
368
        call  [drawbar]
375
      _noinside2:
369
      _noinside2:
376
 
370
 
377
        mov   edi,[0xfe88]
371
        mov   edi,[0xfe88]
378
        movzx eax,word [edi]
372
        movzx eax,word [edi]
379
        cmp   eax,1000
373
        cmp   eax,1000
380
        jge   no_skin_add_button
374
        jge   no_skin_add_button
381
        inc   eax
375
        inc   eax
382
        mov   [edi],ax
376
        mov   [edi],ax
383
 
377
 
384
        shl   eax,4
378
        shl   eax,4
385
        add   eax,edi
379
        add   eax,edi
386
 
380
 
387
        mov   bx,[0x3000]
381
        mov   bx,[0x3000]
388
        mov   [eax],bx
382
        mov   [eax],bx
389
 
383
 
390
        add   eax,2         ; save button id number
384
        add   eax,2         ; save button id number
391
        mov   bx,1
385
        mov   bx,1
392
        mov   [eax],bx
386
        mov   [eax],bx
393
        add   eax,2         ; x start
387
        add   eax,2         ; x start
394
        mov   ebx,[esp]
388
        mov   ebx,[esp]
395
        mov   ebx,[ebx+8]
389
        mov   ebx,[ebx+8]
396
        cmp   [_buttonCx],0
390
        cmp   [_buttonCx],0
397
        jg    _bCx_at_right
391
        jg    _bCx_at_right
398
        mov   ebx,[_buttonCw]    ; ebx will be 0 in next instruction
392
        mov   ebx,[_buttonCw]    ; ebx will be 0 in next instruction
399
      _bCx_at_right:
393
      _bCx_at_right:
400
        sub   ebx,[_buttonCw]
394
        sub   ebx,[_buttonCw]
401
        sub   ebx,[_buttonCx]
395
        sub   ebx,[_buttonCx]
402
        mov   [eax],bx
396
        mov   [eax],bx
403
        add   eax,2         ; x size
397
        add   eax,2         ; x size
404
        mov   ebx,[_buttonCw]
398
        mov   ebx,[_buttonCw]
405
        mov   [eax],bx
399
        mov   [eax],bx
406
        add   eax,2         ; y start
400
        add   eax,2         ; y start
407
        mov   ebx,[_buttonCy]
401
        mov   ebx,[_buttonCy]
408
        mov   [eax],bx
402
        mov   [eax],bx
409
        add   eax,2         ; y size
403
        add   eax,2         ; y size
410
        mov   ebx,[_buttonCh]
404
        mov   ebx,[_buttonCh]
411
        mov   [eax],bx
405
        mov   [eax],bx
412
 
406
 
413
;* minimize button
407
;* minimize button
414
        mov   edi,[0xfe88]
408
        mov   edi,[0xfe88]
415
        movzx eax,word [edi]
409
        movzx eax,word [edi]
416
        cmp   eax,1000
410
        cmp   eax,1000
417
        jge   no_skin_add_button
411
        jge   no_skin_add_button
418
        inc   eax
412
        inc   eax
419
        mov   [edi],ax
413
        mov   [edi],ax
420
 
414
 
421
        shl   eax,4
415
        shl   eax,4
422
        add   eax,edi
416
        add   eax,edi
423
 
417
 
424
        mov   bx,[0x3000]
418
        mov   bx,[0x3000]
425
        mov   [eax],bx
419
        mov   [eax],bx
426
 
420
 
427
        add   eax,2         ; save button id number
421
        add   eax,2         ; save button id number
428
        mov   bx,65535 ;999
422
        mov   bx,65535 ;999
429
        mov   [eax],bx
423
        mov   [eax],bx
430
        add   eax,2         ; x start
424
        add   eax,2         ; x start
431
        mov   ebx,[esp]
425
        mov   ebx,[esp]
432
        mov   ebx,[ebx+8]
426
        mov   ebx,[ebx+8]
433
        cmp   [_buttonMx],0
427
        cmp   [_buttonMx],0
434
        jg    _bMx_at_right
428
        jg    _bMx_at_right
435
        mov   ebx,[_buttonMw]    ; ebx will be 0 in next instruction
429
        mov   ebx,[_buttonMw]    ; ebx will be 0 in next instruction
436
      _bMx_at_right:
430
      _bMx_at_right:
437
        sub   ebx,[_buttonMw]
431
        sub   ebx,[_buttonMw]
438
        sub   ebx,[_buttonMx]
432
        sub   ebx,[_buttonMx]
439
        mov   [eax],bx
433
        mov   [eax],bx
440
        add   eax,2         ; x size
434
        add   eax,2         ; x size
441
        mov   ebx,[_buttonMw]
435
        mov   ebx,[_buttonMw]
442
        mov   [eax],bx
436
        mov   [eax],bx
443
        add   eax,2         ; y start
437
        add   eax,2         ; y start
444
        mov   ebx,[_buttonMy]
438
        mov   ebx,[_buttonMy]
445
        mov   [eax],bx
439
        mov   [eax],bx
446
        add   eax,2         ; y size
440
        add   eax,2         ; y size
447
        mov   ebx,[_buttonMh]
441
        mov   ebx,[_buttonMh]
448
        mov   [eax],bx
442
        mov   [eax],bx
449
;* minimize button
443
;* minimize button
450
 
444
 
451
      no_skin_add_button:
445
      no_skin_add_button:
452
 
446
 
453
        add   esp,4
447
        add   esp,4
454
        popa
448
        popa
455
 
449
 
456
        ret
450
        ret  4