Subversion Repositories Kolibri OS

Rev

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

Rev 7421 Rev 7613
1
use32
1
use32
2
    org     0x0
2
    org     0x0
3
;-------------------------------------------------------------------------------
3
;-------------------------------------------------------------------------------
4
    db	    "MENUET01"
4
    db	    "MENUET01"
5
    dd	    1, main, __dataend, __memend, __stackend, 0, sys_path
5
    dd	    1, main, __dataend, __memend, __stackend, 0, sys_path
6
;-------------------------------------------------------------------------------
6
;-------------------------------------------------------------------------------
7
    include "../../../macros.inc"
7
    include "../../../macros.inc"
8
    include "../../../proc32.inc"
8
    include "../../../proc32.inc"
9
    include "../../../dll.inc"
9
    include "../../../dll.inc"
10
    include "../../../develop/libraries/box_lib/load_lib.mac"
10
    include "../../../develop/libraries/box_lib/load_lib.mac"
11
    ;include "../../../debug.inc"
11
    ;include "../../../debug.inc"
12
 
12
 
13
    include "DATA.INC"
13
    include "DATA.INC"
14
    include "NAME.INC"
14
    include "NAME.INC"
15
 
15
 
16
    @use_library_mem	 \
16
    @use_library_mem	 \
17
	    mem.Alloc,	 \
17
	    mem.Alloc,	 \
18
	    mem.Free,	 \
18
	    mem.Free,	 \
19
	    mem.ReAlloc, \
19
	    mem.ReAlloc, \
20
	    dll.Load
20
	    dll.Load
21
;================================================================================
21
;================================================================================
22
main:
22
main:
23
; ==== Init ====
23
; ==== Init ====
24
    mcall   18, 7
24
    mcall   18, 7
25
    mov     [win.psid], eax
25
    mov     [win.psid], eax
26
 
26
 
27
    mcall   40, 100101b
27
    mcall   40, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change
28
 
28
 
29
; ==== Load libs ====
29
; ==== Load libs ====
30
    load_libraries load_lib_start, load_lib_end
30
    load_libraries load_lib_start, load_lib_end
31
 
31
 
32
; ==== Config LibINI ====
32
; ==== Config LibINI ====
33
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 1
33
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 1
34
    mov     [dock_items.location], eax
34
    mov     [dock_items.location], eax
35
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.fsize_name, 0
35
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.fsize_name, 0
36
    mov     [dock_items.fsize], eax
36
    mov     [dock_items.fsize], eax
37
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.ashow_name, 0
37
    invoke  ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.ashow_name, 0
38
    mov     [dock_items.ashow], eax
38
    mov     [dock_items.ashow], eax
39
 
39
 
40
    invoke  ini.sections, ini_data.file_name, sections_callback
40
    invoke  ini.sections, ini_data.file_name, sections_callback
41
 
41
 
42
; ==== Load colors ====
42
; ==== Load colors ====
43
    mcall   48, 3, color
43
    mcall   48, 3, color
44
    or	    dword[color.bg],	0x10000000
44
    or	    dword[color.bg],	0x10000000
45
    or	    dword[color.frame], 0x10000000
45
    or	    dword[color.frame], 0x10000000
46
    or	    dword[color.text],	0x80000000
46
    or	    dword[color.text],	0x80000000
47
 
47
 
48
; ==== Config LibIMG ====
48
; ==== Config LibIMG ====
49
    mov     dword[fi.p00], 5
49
    mov     dword[fi.p00], 5
50
    mov     dword[fi.p16], buf_128
50
    mov     dword[fi.p16], buf_128
51
    mov     dword[fi.p21], img_data.file_name
51
    mov     dword[fi.p21], img_data.file_name
52
 
52
 
53
    mcall   70, fi
53
    mcall   70, fi
54
 
54
 
55
    mov     edx, [buf_128 + 32]
55
    mov     edx, [buf_128 + 32]
56
    imul    edx, 10
56
    imul    edx, 10
57
 
57
 
58
    stdcall mem.Alloc, edx
58
    stdcall mem.Alloc, edx
59
    mov     [img_data.rgb_object], eax
59
    mov     [img_data.rgb_object], eax
60
 
60
 
61
    mov     dword[fi.p00], 0
61
    mov     dword[fi.p00], 0
62
    mov     dword[fi.p12], edx
62
    mov     dword[fi.p12], edx
63
    m2m     dword[fi.p16], dword[img_data.rgb_object]
63
    m2m     dword[fi.p16], dword[img_data.rgb_object]
64
    mov     dword[fi.p21], img_data.file_name
64
    mov     dword[fi.p21], img_data.file_name
65
 
65
 
66
    mcall   70, fi
66
    mcall   70, fi
67
 
67
 
68
    cmp     ebx, 0xFFFFFFFF
68
    cmp     ebx, 0xFFFFFFFF
69
    je	    @f
69
    je	    @f
70
 
70
 
71
    stdcall dword[img.decode], dword[img_data.rgb_object], ebx, 0
71
    stdcall dword[img.decode], dword[img_data.rgb_object], ebx, 0
72
    mov     dword[img_data.object], eax
72
    mov     dword[img_data.object], eax
73
 
73
 
74
  ; === ALPHA ===
74
  ; === ALPHA ===
75
    mov     edi, eax
75
    mov     edi, eax
76
    add     edi, 8
76
    add     edi, 8
77
    mov     edi, [edi]
77
    mov     edi, [edi]
78
    imul    edi, 128
78
    imul    edi, 128
79
    sub     edi, 4
79
    sub     edi, 4
80
 
80
 
81
    add     eax, 24
81
    add     eax, 24
82
    mov     eax, [eax]
82
    mov     eax, [eax]
83
 .setalpha:
83
 .setalpha:
84
    mov     ebx, [eax + edi]
84
    mov     ebx, [eax + edi]
85
    shr     ebx, 24
85
    shr     ebx, 24
86
    cmp     ebx, 0
86
    cmp     ebx, 0
87
    jne     .nonalpha
87
    jne     .nonalpha
88
 
88
 
89
    mov     ecx, [color.bg]
89
    mov     ecx, [color.bg]
90
    mov     [eax + edi], ecx
90
    mov     [eax + edi], ecx
91
 .nonalpha:
91
 .nonalpha:
92
    sub     edi, 4
92
    sub     edi, 4
93
    cmp     edi, 0
93
    cmp     edi, 0
94
    jne     .setalpha
94
    jne     .setalpha
95
 
95
 
96
  ; === CONVERTING TO BGR
96
  ; === CONVERTING TO BGR
97
    stdcall dword[img.toRGB], dword[img_data.object], dword[img_data.rgb_object]
97
    stdcall dword[img.toRGB], dword[img_data.object], dword[img_data.rgb_object]
98
    stdcall dword[img.destroy], dword[img_data.object]
98
    stdcall dword[img.destroy], dword[img_data.object]
99
 
99
 
100
; ==== Config window ====
100
; ==== Config window ====
101
    mov     eax, dword[dock_items.location]
101
    mov     eax, dword[dock_items.location]
102
    and     eax, 1b
102
    and     eax, 1b
103
    cmp     eax, 0
103
    cmp     eax, 0
104
    je	    .vert
104
    je	    .vert
105
    jmp     .setshape
105
    jmp     .setshape
106
 
106
 
107
 .vert:
107
 .vert:
108
    mov     byte[win.isvert], 1
108
    mov     byte[win.isvert], 1
109
 
109
 
110
 .setshape:
110
 .setshape:
111
    cmp     byte[win.isvert], 1
111
    cmp     byte[win.isvert], 1
112
    je	    .vert_sp
112
    je	    .vert_sp
113
 
113
 
114
 .horz_sp:
114
 .horz_sp:
115
    call    .HORZ_WIDTH
115
    call    .HORZ_WIDTH
116
    call    .HORZ_X
116
    call    .HORZ_X
117
    call    .HORZ_HEIGHT
117
    call    .HORZ_HEIGHT
118
    cmp     dword[dock_items.location], 1
118
    cmp     dword[dock_items.location], 1
119
    je	    .settop
119
    je	    .settop
120
 
120
 
121
 .setbottom:
121
 .setbottom:
122
    call    .HORZ_Y_BOTTOM
122
    call    .HORZ_Y_BOTTOM
123
    jmp     .SETDEF
123
    jmp     .SETDEF
124
 
124
 
125
 .settop:
125
 .settop:
126
    call    .HORZ_Y_TOP
126
    call    .HORZ_Y_TOP
127
    jmp     .SETDEF
127
    jmp     .SETDEF
128
 
128
 
129
 
129
 
130
 .vert_sp:
130
 .vert_sp:
131
    call    .VERT_WIDTH
131
    call    .VERT_WIDTH
132
    call    .VERT_HEIGHT
132
    call    .VERT_HEIGHT
133
    call    .VERT_Y
133
    call    .VERT_Y
134
    cmp     dword[dock_items.location], 2
134
    cmp     dword[dock_items.location], 2
135
    je	    .setleft
135
    je	    .setleft
136
 
136
 
137
 .setright:
137
 .setright:
138
    call    .VERT_X_RIGHT
138
    call    .VERT_X_RIGHT
139
    jmp     .SETDEF
139
    jmp     .SETDEF
140
 
140
 
141
 .setleft:
141
 .setleft:
142
    call    .VERT_X_LEFT
142
    call    .VERT_X_LEFT
143
    jmp     .SETDEF
143
    jmp     .SETDEF
144
 
144
 
145
;-------------------------------------------------------------------------------
145
;-------------------------------------------------------------------------------
146
 .HORZ_WIDTH:
146
 .HORZ_WIDTH:
147
    cmp     [dock_items.fsize], byte 1
147
    cmp     [dock_items.fsize], byte 1
148
    je	    @f
148
    je	    @f
149
    mov     eax, BUTTON_SIZE
149
    mov     eax, BUTTON_SIZE
150
    mov     ebx, [dock_items.count]
150
    mov     ebx, [dock_items.count]
151
    imul    eax, ebx
151
    imul    eax, ebx
152
    add     eax, 24
152
    add     eax, 24
153
    dec     eax
153
    dec     eax
154
    jmp     .set_hw
154
    jmp     .set_hw
155
  @@:
155
  @@:
156
    mcall   14
156
    mcall   14
157
    shr     eax, 16
157
    shr     eax, 16
158
 .set_hw:
158
 .set_hw:
159
    mov     [win.width_opn], eax
159
    mov     [win.width_opn], eax
160
    mov     [win.width_hdn], eax
160
    mov     [win.width_hdn], eax
161
 
161
 
162
    ret
162
    ret
163
 
163
 
164
;-------------------------------------------------------------------------------
164
;-------------------------------------------------------------------------------
165
 .HORZ_X:
165
 .HORZ_X:
166
    mcall   14
166
    mcall   14
167
    shr     eax, 17
167
    shr     eax, 17
168
    mov     ecx, [win.width_opn]
168
    mov     ecx, [win.width_opn]
169
    shr     ecx, 1
169
    shr     ecx, 1
170
    sub     eax, ecx
170
    sub     eax, ecx
171
    mov     [win.x_opn], eax
171
    mov     [win.x_opn], eax
172
    mov     [win.x_hdn], eax
172
    mov     [win.x_hdn], eax
173
 
173
 
174
    ret
174
    ret
175
 
175
 
176
;-------------------------------------------------------------------------------
176
;-------------------------------------------------------------------------------
177
 .HORZ_HEIGHT:
177
 .HORZ_HEIGHT:
178
    mov     dword[win.height_hdn], 3
178
    mov     dword[win.height_hdn], 3
179
    mov     dword[win.height_opn], BUTTON_SIZE
179
    mov     dword[win.height_opn], BUTTON_SIZE
180
 
180
 
181
    ret
181
    ret
182
 
182
 
183
;-------------------------------------------------------------------------------
183
;-------------------------------------------------------------------------------
184
 .HORZ_Y_BOTTOM:
184
 .HORZ_Y_BOTTOM:
185
    mcall   14
185
    mcall   14
186
    and     eax, 0xFFFF
186
    and     eax, 0xFFFF
187
    dec     eax
187
    dec     eax
188
    mov     [win.y_hdn], eax
188
    mov     [win.y_hdn], eax
189
    sub     eax, 43
189
    sub     eax, 43
190
    mov     [win.y_opn], eax
190
    mov     [win.y_opn], eax
191
 
191
 
192
    ret
192
    ret
193
 
193
 
194
 .HORZ_Y_TOP:
194
 .HORZ_Y_TOP:
195
    mov     dword[win.y_opn], 0
195
    mov     dword[win.y_opn], 0
196
    mov     dword[win.y_hdn], 0
196
    mov     dword[win.y_hdn], 0
197
 
197
 
198
    ret
198
    ret
199
 
199
 
200
;-------------------------------------------------------------------------------
200
;-------------------------------------------------------------------------------
201
 .VERT_WIDTH:
201
 .VERT_WIDTH:
202
    mov     dword[win.width_opn], BUTTON_SIZE
202
    mov     dword[win.width_opn], BUTTON_SIZE
203
    mov     dword[win.width_hdn], 3
203
    mov     dword[win.width_hdn], 3
204
 
204
 
205
    ret
205
    ret
206
 
206
 
207
;-------------------------------------------------------------------------------
207
;-------------------------------------------------------------------------------
208
 .VERT_X_LEFT:
208
 .VERT_X_LEFT:
209
    mov     dword[win.x_opn], 0
209
    mov     dword[win.x_opn], 0
210
    mov     dword[win.x_hdn], 0
210
    mov     dword[win.x_hdn], 0
211
 
211
 
212
    ret
212
    ret
213
 
213
 
214
 .VERT_X_RIGHT:
214
 .VERT_X_RIGHT:
215
    mcall   14
215
    mcall   14
216
    and     eax, 0xFFFF0000
216
    and     eax, 0xFFFF0000
217
    shr     eax, 16
217
    shr     eax, 16
218
    mov     [win.x_hdn], eax
218
    mov     [win.x_hdn], eax
219
    sub     eax, BUTTON_SIZE
219
    sub     eax, BUTTON_SIZE
220
    mov     [win.x_opn], eax
220
    mov     [win.x_opn], eax
221
 
221
 
222
    ret
222
    ret
223
 
223
 
224
;-------------------------------------------------------------------------------
224
;-------------------------------------------------------------------------------
225
 .VERT_HEIGHT:
225
 .VERT_HEIGHT:
226
    cmp     [dock_items.fsize], byte 1
226
    cmp     [dock_items.fsize], byte 1
227
    je	    @f
227
    je	    @f
228
    mov     eax, BUTTON_SIZE
228
    mov     eax, BUTTON_SIZE
229
    mov     ebx, [dock_items.count]
229
    mov     ebx, [dock_items.count]
230
    imul    eax, ebx
230
    imul    eax, ebx
231
    dec     eax
231
    dec     eax
232
    jmp     .set_vh
232
    jmp     .set_vh
233
  @@:
233
  @@:
234
    mcall   14
234
    mcall   14
235
    and     eax, 0xFFFF
235
    and     eax, 0xFFFF
236
 .set_vh:
236
 .set_vh:
237
    mov     [win.height_opn], eax
237
    mov     [win.height_opn], eax
238
    mov     [win.height_hdn], eax
238
    mov     [win.height_hdn], eax
239
 
239
 
240
    ret
240
    ret
241
 
241
 
242
;-------------------------------------------------------------------------------
242
;-------------------------------------------------------------------------------
243
 .VERT_Y:
243
 .VERT_Y:
244
    mcall   14
244
    mcall   14
245
    and     eax, 0xFFFF
245
    and     eax, 0xFFFF
246
    shr     eax, 1
246
    shr     eax, 1
247
 
247
 
248
    mov     esi, [win.height_opn]
248
    mov     esi, [win.height_opn]
249
    shr     esi, 1
249
    shr     esi, 1
250
    sub     eax, esi
250
    sub     eax, esi
251
 
251
 
252
    mov     [win.y_hdn], eax
252
    mov     [win.y_hdn], eax
253
    mov     [win.y_opn], eax
253
    mov     [win.y_opn], eax
254
 
254
 
255
    ret
255
    ret
256
 
256
 
257
;-------------------------------------------------------------------------------
257
;-------------------------------------------------------------------------------
258
 .SETDEF:
258
 .SETDEF:
259
    mov     eax, [win.width_hdn]
259
    mov     eax, [win.width_hdn]
260
    mov     [win.width], eax
260
    mov     [win.width], eax
261
 
261
 
262
    mov     eax, [win.x_hdn]
262
    mov     eax, [win.x_hdn]
263
    mov     [win.x], eax
263
    mov     [win.x], eax
264
 
264
 
265
    mov     eax, [win.height_hdn]
265
    mov     eax, [win.height_hdn]
266
    mov     [win.height], eax
266
    mov     [win.height], eax
267
 
267
 
268
    mov     eax, [win.y_hdn]
268
    mov     eax, [win.y_hdn]
269
    mov     [win.y], eax
269
    mov     [win.y], eax
270
	
270
	
271
    cmp     byte[dock_items.ashow],1
271
    cmp     byte[dock_items.ashow],1
272
    jne     .not_ashow
272
    jne     .not_ashow
273
 
273
 
274
    mov     eax, [win.width_opn]
274
    mov     eax, [win.width_opn]
275
    mov     [win.width], eax
275
    mov     [win.width], eax
276
 
276
 
277
    mov     eax, [win.x_opn]
277
    mov     eax, [win.x_opn]
278
    mov     [win.x], eax
278
    mov     [win.x], eax
279
 
279
 
280
    mov     eax, [win.height_opn]
280
    mov     eax, [win.height_opn]
281
    mov     [win.height], eax
281
    mov     [win.height], eax
282
 
282
 
283
    mov     eax, [win.y_opn]
283
    mov     eax, [win.y_opn]
284
    mov     [win.y], eax
284
    mov     [win.y], eax
285
 
285
 
286
 .not_ashow:
286
 .not_ashow:
287
 
287
 
288
 
288
 
289
;-------------------------------------------------------------------------------
289
;-------------------------------------------------------------------------------
290
; ==== START ====
290
; ==== START ====
291
    mcall   9, win.procinfo, -1
291
    mcall   9, win.procinfo, -1
292
    mov     ecx, [win.procinfo + 30]
292
    mov     ecx, [win.procinfo + 30]
293
    mcall   18, 21
293
    mcall   18, 21
294
    and     eax, 0xFFFF
294
    and     eax, 0xFFFF
295
    mov     [win.sid], eax
295
    mov     [win.sid], eax
296
 
296
 
297
    call    main_loop
297
    call    main_loop
298
;-------------------------------------------------------------------------------
298
;-------------------------------------------------------------------------------
299
exit:
299
exit:
300
    stdcall mem.Free, [img_data.rgb_object]
300
    stdcall mem.Free, [img_data.rgb_object]
301
    mcall   18, 2, [nwin.sid]
301
    mcall   18, 2, [nwin.sid]
302
    mcall   -1
302
    mcall   -1
303
;-------------------------------------------------------------------------------
303
;-------------------------------------------------------------------------------
304
main_loop:
304
main_loop:
305
    mcall   10
305
    mcall   10
306
 
306
 
307
    cmp     eax, EV_REDRAW
307
    cmp     eax, EV_REDRAW
308
    je	    event_redraw
308
    je	    event_redraw
309
 
309
 
310
    cmp     eax, EV_BUTTON
310
    cmp     eax, EV_BUTTON
311
    je	    event_button
311
    je	    event_button
312
 
312
 
313
    cmp     eax, EV_MOUSE
313
    cmp     eax, EV_MOUSE
314
    je	    event_mouse
314
    je	    event_mouse
315
 
315
 
316
    jmp     main_loop
316
    jmp     main_loop
317
;-------------------------------------------------------------------------------
317
;-------------------------------------------------------------------------------
318
event_redraw:
318
event_redraw:
319
    call    DRAW_WINDOW
319
    call    DRAW_WINDOW
320
    jmp     main_loop
320
    jmp     main_loop
321
;-------------------------------------------------------------------------------
321
;-------------------------------------------------------------------------------
322
DRAW_WINDOW:
322
DRAW_WINDOW:
323
    mcall   12, 1
323
    mcall   12, 1
324
 
324
 
325
    mov     esi, [color.bg]
325
    mov     esi, [color.bg]
326
    or	    esi, 0x01000000
326
    or	    esi, 0x01000000
327
    mcall   0, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame]
327
    mcall   0, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame]
328
 
328
 
329
    mov     edi, 0
329
    mov     edi, 0
330
  @@:
330
  @@:
331
    cmp     edi, [dock_items.count]
331
    cmp     edi, [dock_items.count]
332
    je	    @f
332
    je	    @f
333
 
333
 
334
    push    edi
334
    push    edi
335
    mov     eax, 8
335
    mov     eax, 8
336
    mov     edx, 0x60000002
336
    mov     edx, 0x60000002
337
    mov     esi, [color.bg]
337
    mov     esi, [color.bg]
338
    imul    edi, BUTTON_SIZE
338
    imul    edi, BUTTON_SIZE
339
    add     edi, 12
339
    add     edi, 12
340
    shl     edi, 16
340
    shl     edi, 16
341
    add     edi, BUTTON_SIZE
341
    add     edi, BUTTON_SIZE
342
    cmp     byte[win.isvert], 1
342
    cmp     byte[win.isvert], 1
343
    je	    .vert_btn
343
    je	    .vert_btn
344
    mcall   , edi, <0, BUTTON_SIZE>
344
    mcall   , edi, <0, BUTTON_SIZE>
345
    jmp     .endbtn
345
    jmp     .endbtn
346
 .vert_btn:
346
 .vert_btn:
347
    sub     edi, 12 shl 16
347
    sub     edi, 12 shl 16
348
    mcall   , <0, BUTTON_SIZE>, edi
348
    mcall   , <0, BUTTON_SIZE>, edi
349
 .endbtn:
349
 .endbtn:
350
    pop     edi
350
    pop     edi
351
 
351
 
352
    cmp     byte[dock_items.separator + edi], 1
352
    cmp     byte[dock_items.separator + edi], 1
353
    jne     .end_separator
353
    jne     .end_separator
354
 
354
 
355
 .draw_separator:
355
 .draw_separator:
356
    push    ebx
356
    push    ebx
357
    push    ecx
357
    push    ecx
358
 
358
 
359
    mov     eax, 13
359
    mov     eax, 13
360
    mov     ebx, edi
360
    mov     ebx, edi
361
    imul    ebx, BUTTON_SIZE
361
    imul    ebx, BUTTON_SIZE
362
    add     ebx, BUTTON_SIZE
362
    add     ebx, BUTTON_SIZE
363
    add     ebx, 12
363
    add     ebx, 12
364
    dec     ebx
364
    dec     ebx
365
    shl     ebx, 16
365
    shl     ebx, 16
366
    add     ebx, 2
366
    add     ebx, 2
367
 
367
 
368
    cmp     byte[win.isvert], 1
368
    cmp     byte[win.isvert], 1
369
    je	    .vert_draw_sep
369
    je	    .vert_draw_sep
370
    mcall   , , <4,  36>, [color.frame]
370
    mcall   , , <4,  36>, [color.frame]
371
    jmp     .end_inner_sep
371
    jmp     .end_inner_sep
372
 .vert_draw_sep:
372
 .vert_draw_sep:
373
    sub     ebx, 12 shl 16
373
    sub     ebx, 12 shl 16
374
    mov     ecx, ebx
374
    mov     ecx, ebx
375
    mcall   , <4, 36>, , [color.frame]
375
    mcall   , <4, 36>, , [color.frame]
376
 .end_inner_sep:
376
 .end_inner_sep:
377
    pop     ecx
377
    pop     ecx
378
    pop     ebx
378
    pop     ebx
379
 .end_separator:
379
 .end_separator:
380
 
380
 
381
    cmp     byte[win.isvert], 1
381
    cmp     byte[win.isvert], 1
382
    je	    .vert_dig
382
    je	    .vert_dig
383
    mov     edx, ebx
383
    mov     edx, ebx
384
    and     edx, 0xFFFF0000
384
    and     edx, 0xFFFF0000
385
    add     edx, 0x00060006
385
    add     edx, 0x00060006
386
    jmp     .digend
386
    jmp     .digend
387
 .vert_dig:
387
 .vert_dig:
388
    mov     edx, ecx
388
    mov     edx, ecx
389
    and     edx, 0xFFFF0000
389
    and     edx, 0xFFFF0000
390
    shr     edx, 16
390
    shr     edx, 16
391
    add     edx, 0x00060006
391
    add     edx, 0x00060006
392
 .digend:
392
 .digend:
393
 
393
 
394
    imul    ebx, edi, 4
394
    imul    ebx, edi, 4
395
    add     ebx, dock_items.icon
395
    add     ebx, dock_items.icon
396
    mov     ebx, [ebx]
396
    mov     ebx, [ebx]
397
    imul    ebx, ICON_SIZE_BGR
397
    imul    ebx, ICON_SIZE_BGR
398
    add     ebx, [img_data.rgb_object]
398
    add     ebx, [img_data.rgb_object]
399
 
399
 
400
    mcall   7, , <32, 32>
400
    mcall   7, , <32, 32>
401
 
401
 
402
    inc     edi
402
    inc     edi
403
    jmp     @b
403
    jmp     @b
404
  @@:
404
  @@:
405
 
405
 
406
    mcall   12, 2
406
    mcall   12, 2
407
 
407
 
408
    ret
408
    ret
409
;-------------------------------------------------------------------------------
409
;-------------------------------------------------------------------------------
410
event_button:
410
event_button:
411
    mcall   17
411
    mcall   17
412
 
412
 
413
	;; it must not be possible to close dock
413
	;; it must not be possible to close dock
414
    ;cmp     ah, 1
414
    ;cmp     ah, 1
415
    ;je	    .button_close
415
    ;je	    .button_close
416
 
416
 
417
    cmp     ah, 2
417
    cmp     ah, 2
418
    je	    .button_dock
418
    je	    .button_dock
419
 
419
 
420
    jmp     @f
420
    jmp     @f
421
 
421
 
422
 ;.button_close:
422
 ;.button_close:
423
 ;   jmp     exit
423
 ;   jmp     exit
424
 
424
 
425
 .button_dock:
425
 .button_dock:
426
    mov     edi, [win.button_index]
426
    mov     edi, [win.button_index]
427
    imul    edi, 256
427
    imul    edi, 256
428
 
428
 
429
    mov     dword[fi.p00], 7
429
    mov     dword[fi.p00], 7
430
 
430
 
431
    mov     esi, edi
431
    mov     esi, edi
432
    add     esi, dock_items.path
432
    add     esi, dock_items.path
433
    mov     dword[fi.p21], esi
433
    mov     dword[fi.p21], esi
434
 
434
 
435
    mov     esi, edi
435
    mov     esi, edi
436
    add     esi, dock_items.param
436
    add     esi, dock_items.param
437
    mov     dword[fi.p08], esi
437
    mov     dword[fi.p08], esi
438
 
438
 
439
    mcall   70, fi
439
    mcall   70, fi
440
 
440
 
441
    mov     ecx, eax
441
    mov     ecx, eax
442
    mcall   18, 21
442
    mcall   18, 21
443
    and     eax, 0xFFFF
443
    and     eax, 0xFFFF
444
    mov     [win.psid], eax
444
    mov     [win.psid], eax
445
 
445
 
446
    jmp     wnd_hide
446
    jmp     wnd_hide
447
 
447
 
448
  @@:
448
  @@:
449
    jmp     main_loop
449
    jmp     main_loop
450
;-------------------------------------------------------------------------------
450
;-------------------------------------------------------------------------------
451
event_mouse:
451
event_mouse:
452
  ; ==== IS MOUSE INNER ====
452
  ; ==== IS MOUSE INNER ====
453
    mcall   37, 1
453
    mcall   37, 1
454
    mov     edi, eax
454
    mov     edi, eax
455
    mov     esi, eax
455
    mov     esi, eax
456
    shr     edi, 16
456
    shr     edi, 16
457
    and     esi, 0xFFFF
457
    and     esi, 0xFFFF
458
 
458
 
459
    cmp     edi, 0
459
    cmp     edi, 0
460
    jl	    wnd_hide
460
    jl	    wnd_hide
461
    dec     edi
461
    dec     edi
462
    cmp     edi, [win.width]
462
    cmp     edi, [win.width]
463
    jg	    wnd_hide
463
    jg	    wnd_hide
464
    cmp     esi, 0
464
    cmp     esi, 0
465
    jl	    wnd_hide
465
    jl	    wnd_hide
466
    dec     esi
466
    dec     esi
467
    cmp     esi, [win.height]
467
    cmp     esi, [win.height]
468
    jg	    wnd_hide
468
    jg	    wnd_hide
469
 
469
 
470
  ; ==== COUNT INDEX ====
470
  ; ==== COUNT INDEX ====
471
 
471
 
472
    mov     eax, [dock_items.location]
472
    mov     eax, [dock_items.location]
473
    and     eax, 1b
473
    and     eax, 1b
474
    cmp     eax, 1
474
    cmp     eax, 1
475
    jne     .vert
475
    jne     .vert
476
    mov     eax, edi
476
    mov     eax, edi
477
    jmp     .nxt
477
    jmp     .nxt
478
 
478
 
479
 .vert:
479
 .vert:
480
    mov     eax, esi
480
    mov     eax, esi
481
    add     eax, 12
481
    add     eax, 12
482
 
482
 
483
 .nxt:
483
 .nxt:
484
    sub     eax, 12
484
    sub     eax, 12
485
    mov     edx, 0
485
    mov     edx, 0
486
    mov     ebx, BUTTON_SIZE
486
    mov     ebx, BUTTON_SIZE
487
    div     ebx
487
    div     ebx
488
 
488
 
489
    cmp     eax, [dock_items.count]
489
    cmp     eax, [dock_items.count]
490
    jge     .set0
490
    jge     .set0
491
    jmp     .nxtcmp
491
    jmp     .nxtcmp
492
 
492
 
493
 .set0:
493
 .set0:
494
    mov     eax, 100
494
    mov     eax, 100
495
 
495
 
496
 .nxtcmp:
496
 .nxtcmp:
497
    cmp     [win.button_index], eax
497
    cmp     [win.button_index], eax
498
    je	    .nxt2
498
    je	    .nxt2
499
 
499
 
500
    push    dword[win.button_index]
500
    push    dword[win.button_index]
501
    pop     dword[win.prev_index]
501
    pop     dword[win.prev_index]
502
 
502
 
503
    mov     [win.button_index], eax
503
    mov     [win.button_index], eax
504
 
504
 
505
 ; ==== DRAW SELECTION ====
505
 ; ==== DRAW SELECTION ====
506
    call    DRAW_SELECTION
506
    call    DRAW_SELECTION
507
 
507
 
508
 .nxt2:
508
 .nxt2:
509
    mov     eax, [win.button_index]
509
    mov     eax, [win.button_index]
510
    imul    eax, BUTTON_SIZE
510
    imul    eax, BUTTON_SIZE
511
    cmp     byte[win.isvert], 1
511
    cmp     byte[win.isvert], 1
512
    je	    .vert_name
512
    je	    .vert_name
513
    add     eax, [win.x]
513
    add     eax, [win.x]
514
    mov     [nwin.x], eax
514
    mov     [nwin.x], eax
515
    mov     byte[nwin.change_shape], 1
515
    mov     byte[nwin.change_shape], 1
516
    mcall   13, <0, [win.width]>, <[win.height], 1>, [color.frame]
516
    mcall   13, <0, [win.width]>, <[win.height], 1>, [color.frame]
517
    jmp     .vert_end
517
    jmp     .vert_end
518
 .vert_name:
518
 .vert_name:
519
    add     eax, [win.y]
519
    add     eax, [win.y]
520
    add     eax, 14
520
    add     eax, 14
521
    mov     [nwin.y], eax
521
    mov     [nwin.y], eax
522
    mov     byte[nwin.change_shape], 1
522
    mov     byte[nwin.change_shape], 1
523
    mcall   13, <[win.width], 1>, <0, [win.height]>, [color.frame]
523
    mcall   13, <[win.width], 1>, <0, [win.height]>, [color.frame]
524
 .vert_end:
524
 .vert_end:
525
 
525
 
526
 ; ==== OPEN/CLOSE WINDOW ====
526
 ; ==== OPEN/CLOSE WINDOW ====
527
    cmp     byte[win.state], 1
527
    cmp     byte[win.state], 1
528
    je	    main_loop
528
    je	    main_loop
529
 
529
 
530
    mov     edx, esp
530
    mov     edx, esp
531
    add     edx, 512
531
    add     edx, 512
532
    mcall   51, 1, n_main
532
    mcall   51, 1, n_main
533
 
533
 
534
    mov     eax, 18
534
    mov     eax, 18
535
 
535
 
536
    mcall   , 7
536
    mcall   , 7
537
    mov     [win.psid], eax
537
    mov     [win.psid], eax
538
 
538
 
539
    mcall   18, 3, [win.sid]
539
    mcall   18, 3, [win.sid]
540
 
540
 
541
    mov     byte[win.state], 1
541
    mov     byte[win.state], 1
542
 
542
 
543
    mov     eax, [win.width_opn]
543
    mov     eax, [win.width_opn]
544
    mov     [win.width], eax
544
    mov     [win.width], eax
545
 
545
 
546
    mov     eax, [win.x_opn]
546
    mov     eax, [win.x_opn]
547
    mov     [win.x], eax
547
    mov     [win.x], eax
548
 
548
 
549
    mov     eax, [win.height_opn]
549
    mov     eax, [win.height_opn]
550
    mov     [win.height], eax
550
    mov     [win.height], eax
551
 
551
 
552
    mov     eax, [win.y_opn]
552
    mov     eax, [win.y_opn]
553
    mov     [win.y], eax
553
    mov     [win.y], eax
554
 
554
 
555
 
555
 
556
    cmp     byte[dock_items.ashow],1
556
    cmp     byte[dock_items.ashow],1
557
    je	   .change_nothing
557
    je	   .change_nothing
558
    mcall   67, [win.x], [win.y], [win.width], [win.height]
558
    mcall   67, [win.x], [win.y], [win.width], [win.height]
559
 
559
 
560
  .change_nothing:
560
  .change_nothing:
561
    call    DRAW_WINDOW
561
    call    DRAW_WINDOW
562
    call    DRAW_SELECTION
562
    call    DRAW_SELECTION
563
    jmp     main_loop
563
    jmp     main_loop
564
 
564
 
565
;-------------------------------------------------------------------------------
565
;-------------------------------------------------------------------------------
566
wnd_hide:
566
wnd_hide:
567
    cmp     byte[win.state], 0
567
    cmp     byte[win.state], 0
568
    je	    main_loop
568
    je	    main_loop
569
 
569
 
570
    mov     byte[nwin.close], 1
570
    mov     byte[nwin.close], 1
571
 
571
 
572
    mcall   18, 3, [win.psid]
572
    mcall   18, 3, [win.psid]
573
 
573
 
574
    mov     byte[win.state], 0
574
    mov     byte[win.state], 0
575
    mov     byte[win.button_index], -1
575
    mov     byte[win.button_index], -1
576
 
576
 
577
    cmp     byte[dock_items.ashow],1
577
    cmp     byte[dock_items.ashow],1
578
    je	   .do_no_hide
578
    je	   .do_no_hide
579
 
579
 
580
    mov     eax, [win.width_hdn]
580
    mov     eax, [win.width_hdn]
581
    mov     [win.width], eax
581
    mov     [win.width], eax
582
 
582
 
583
    mov     eax, [win.x_hdn]
583
    mov     eax, [win.x_hdn]
584
    mov     [win.x], eax
584
    mov     [win.x], eax
585
 
585
 
586
    mov     eax, [win.height_hdn]
586
    mov     eax, [win.height_hdn]
587
    mov     [win.height], eax
587
    mov     [win.height], eax
588
 
588
 
589
    mov     eax, [win.y_hdn]
589
    mov     eax, [win.y_hdn]
590
    mov     [win.y], eax
590
    mov     [win.y], eax
591
 
591
 
592
    mcall   67, [win.x], [win.y], [win.width], [win.height]
592
    mcall   67, [win.x], [win.y], [win.width], [win.height]
593
 
593
 
594
  .do_no_hide:
594
  .do_no_hide:
595
    call    DRAW_WINDOW
595
    call    DRAW_WINDOW
596
    jmp     main_loop
596
    jmp     main_loop
597
;-------------------------------------------------------------------------------
597
;-------------------------------------------------------------------------------
598
DRAW_SELECTION:
598
DRAW_SELECTION:
599
    mov     ebx, [win.prev_index]
599
    mov     ebx, [win.prev_index]
600
    imul    ebx, BUTTON_SIZE
600
    imul    ebx, BUTTON_SIZE
601
    add     ebx, 14
601
    add     ebx, 14
602
    shl     ebx, 16
602
    shl     ebx, 16
603
    add     ebx, 40
603
    add     ebx, 40
604
    mov     ecx, 0x00020028
604
    mov     ecx, 0x00020028
605
 
605
 
606
    cmp     byte[win.isvert], 1
606
    cmp     byte[win.isvert], 1
607
    jne     @f
607
    jne     @f
608
    xchg    ebx, ecx
608
    xchg    ebx, ecx
609
    sub     ecx, 0x000C0000
609
    sub     ecx, 0x000C0000
610
  @@:
610
  @@:
611
 
611
 
612
    mcall   13, , , [color.bg]
612
    mcall   13, , , [color.bg]
613
 
613
 
614
    mov     edx, ebx
614
    mov     edx, ebx
615
    shr     ecx, 16
615
    shr     ecx, 16
616
    mov     dx, cx
616
    mov     dx, cx
617
    add     edx, 0x00040004
617
    add     edx, 0x00040004
618
 
618
 
619
    mov     ebx, [win.prev_index]
619
    mov     ebx, [win.prev_index]
620
    imul    ebx, 4
620
    imul    ebx, 4
621
    add     ebx, dock_items.icon
621
    add     ebx, dock_items.icon
622
    mov     ebx, [ebx]
622
    mov     ebx, [ebx]
623
    imul    ebx, ICON_SIZE_BGR
623
    imul    ebx, ICON_SIZE_BGR
624
    add     ebx, [img_data.rgb_object]
624
    add     ebx, [img_data.rgb_object]
625
 
625
 
626
    mcall   7, , <32, 32>
626
    mcall   7, , <32, 32>
627
 
627
 
628
    mov     ebx, [win.button_index]
628
    mov     ebx, [win.button_index]
629
    imul    ebx, BUTTON_SIZE
629
    imul    ebx, BUTTON_SIZE
630
    add     ebx, 14
630
    add     ebx, 14
631
    shl     ebx, 16
631
    shl     ebx, 16
632
    add     ebx, 40
632
    add     ebx, 40
633
    mov     ecx, 0x00020028
633
    mov     ecx, 0x00020028
634
 
634
 
635
    cmp     byte[win.isvert], 1
635
    cmp     byte[win.isvert], 1
636
    jne     @f
636
    jne     @f
637
    xchg    ebx, ecx
637
    xchg    ebx, ecx
638
    sub     ecx, 0x000C0000
638
    sub     ecx, 0x000C0000
639
  @@:
639
  @@:
640
 
640
 
641
    mcall   13, , , [color.bt]
641
    mcall   13, , , [color.bt]
642
 
642
 
643
    mov     edx, ebx
643
    mov     edx, ebx
644
    shr     ecx, 16
644
    shr     ecx, 16
645
    mov     dx, cx
645
    mov     dx, cx
646
    add     edx, 0x00040004
646
    add     edx, 0x00040004
647
 
647
 
648
    mov     ecx, [win.button_index]
648
    mov     ecx, [win.button_index]
649
    imul    ecx, 4
649
    imul    ecx, 4
650
    add     ecx, dock_items.icon
650
    add     ecx, dock_items.icon
651
    mov     ecx, [ecx]
651
    mov     ecx, [ecx]
652
    imul    ecx, ICON_SIZE_BGR
652
    imul    ecx, ICON_SIZE_BGR
653
    add     ecx, [img_data.rgb_object]
653
    add     ecx, [img_data.rgb_object]
654
 
654
 
655
    mov     ebx, sel_img
655
    mov     ebx, sel_img
656
 
656
 
657
    mov     edi, 0
657
    mov     edi, 0
658
  @@:
658
  @@:
659
    mov     al, byte[ecx + 2]
659
    mov     al, byte[ecx + 2]
660
    shl     eax, 8
660
    shl     eax, 8
661
    mov     al, byte[ecx + 1]
661
    mov     al, byte[ecx + 1]
662
    shl     eax, 8
662
    shl     eax, 8
663
    mov     al, byte[ecx + 0]
663
    mov     al, byte[ecx + 0]
664
 
664
 
665
    or	    eax, 0x10000000
665
    or	    eax, 0x10000000
666
    cmp     eax, [color.bg]
666
    cmp     eax, [color.bg]
667
    jne     .notbg
667
    jne     .notbg
668
    mov     eax, [color.bt]
668
    mov     eax, [color.bt]
669
 .notbg:
669
 .notbg:
670
 
670
 
671
    mov     byte[ebx + 0], al
671
    mov     byte[ebx + 0], al
672
    shr     eax, 8
672
    shr     eax, 8
673
    mov     byte[ebx + 1], al
673
    mov     byte[ebx + 1], al
674
    shr     eax, 8
674
    shr     eax, 8
675
    mov     byte[ebx + 2], al
675
    mov     byte[ebx + 2], al
676
 
676
 
677
    add     ebx, 3
677
    add     ebx, 3
678
    add     ecx, 3
678
    add     ecx, 3
679
 
679
 
680
    add     edi, 3
680
    add     edi, 3
681
 
681
 
682
    cmp     edi, 1024 * 3
682
    cmp     edi, 1024 * 3
683
    jne     @b
683
    jne     @b
684
 
684
 
685
    mcall   7, sel_img, <32, 32>
685
    mcall   7, sel_img, <32, 32>
686
 
686
 
687
    ret
687
    ret
688
;-------------------------------------------------------------------------------
688
;-------------------------------------------------------------------------------
689
proc sections_callback, _file_name, _section_name
689
proc sections_callback, _file_name, _section_name
690
    mov     eax, [_section_name]
690
    mov     eax, [_section_name]
691
    cmp     byte[eax], '@'
691
    cmp     byte[eax], '@'
692
    jne     @f
692
    jne     @f
693
 
693
 
694
    dec     dword[dock_items.count]
694
    dec     dword[dock_items.count]
695
    jmp     .endproc
695
    jmp     .endproc
696
 
696
 
697
  @@:
697
  @@:
698
    ; ==== GET NAME ====
698
    ; ==== GET NAME ====
699
    mov     ebx, [dock_items.count]
699
    mov     ebx, [dock_items.count]
700
    imul    ebx, 16
700
    imul    ebx, 16
701
    add     ebx, dock_items.name
701
    add     ebx, dock_items.name
702
 
702
 
703
    mov     eax, [_section_name]
703
    mov     eax, [_section_name]
704
 
704
 
705
    mov     edi, 0
705
    mov     edi, 0
706
  @@:
706
  @@:
707
    mov     cl, byte[eax]
707
    mov     cl, byte[eax]
708
    mov     byte[ebx + edi], cl
708
    mov     byte[ebx + edi], cl
709
 
709
 
710
    inc     eax
710
    inc     eax
711
    inc     edi
711
    inc     edi
712
    cmp     edi, 10
712
    cmp     edi, 10
713
    jne     @b
713
    jne     @b
714
 
714
 
715
  ; ==== GET PATH ====
715
  ; ==== GET PATH ====
716
    mov     ebx, [dock_items.count]
716
    mov     ebx, [dock_items.count]
717
    imul    ebx, 256
717
    imul    ebx, 256
718
    add     ebx, dock_items.path
718
    add     ebx, dock_items.path
719
 
719
 
720
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0
720
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0
721
 
721
 
722
  ; === GET  PARAM ===
722
  ; === GET  PARAM ===
723
    mov     ebx, [dock_items.count]
723
    mov     ebx, [dock_items.count]
724
    imul    ebx, 256
724
    imul    ebx, 256
725
    add     ebx, dock_items.param
725
    add     ebx, dock_items.param
726
 
726
 
727
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0
727
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0
728
 
728
 
729
  ; ==== GET ICON ====
729
  ; ==== GET ICON ====
730
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0
730
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0
731
 
731
 
732
    mov     ebx, [dock_items.count]
732
    mov     ebx, [dock_items.count]
733
    imul    ebx, 4
733
    imul    ebx, 4
734
    mov     [dock_items.icon + ebx], eax
734
    mov     [dock_items.icon + ebx], eax
735
 
735
 
736
  ; ==== GET SEPARATOR ====
736
  ; ==== GET SEPARATOR ====
737
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0
737
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0
738
 
738
 
739
    mov     ebx, [dock_items.count]
739
    mov     ebx, [dock_items.count]
740
    mov     byte[dock_items.separator + ebx], al
740
    mov     byte[dock_items.separator + ebx], al
741
 
741
 
742
  ; ====== END =======
742
  ; ====== END =======
743
 .endproc:
743
 .endproc:
744
    mov     eax, 1
744
    mov     eax, 1
745
    inc     dword[dock_items.count]
745
    inc     dword[dock_items.count]
746
    ret
746
    ret
747
endp
747
endp
748
;-------------------------------------------------------------------------------
748
;-------------------------------------------------------------------------------
749
    include "MEMORY.INC"
749
    include "MEMORY.INC"