Subversion Repositories Kolibri OS

Rev

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

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