Subversion Repositories Kolibri OS

Rev

Rev 9876 | 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
;-------------------------------------------------------------------------------
9876 Doczom 250
error_exit:
251
    push    .notify
252
    dec     esp
253
    push    0
254
    push    0
255
    push    .error_message
256
    push    0
257
    push    SSF_START_APP
258
 
259
    mcall   SF_FILE, esp
260
    add     esp, 6*4 + 1
261
    mcall   SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid]
262
    mcall   SF_TERMINATE_PROCESS
263
.error_message:
264
    db  '"@DOCKY\nError load @RESHARE" -tdE',0
265
.notify:
266
    db  '/sys/@notify',0
267
;-------------------------------------------------------------------------------
8568 IgorA 268
align 4
4195 eAndrew 269
main_loop:
8568 IgorA 270
    mcall   SF_WAIT_EVENT
4120 eAndrew 271
 
272
    cmp     eax, EV_REDRAW
9530 leency 273
    je      event_redraw
4120 eAndrew 274
 
275
    cmp     eax, EV_BUTTON
9530 leency 276
    je      event_button
4120 eAndrew 277
 
278
    cmp     eax, EV_MOUSE
9530 leency 279
    je      event_mouse
4120 eAndrew 280
 
281
    jmp     main_loop
282
;-------------------------------------------------------------------------------
4140 eAndrew 283
event_redraw:
4198 eAndrew 284
    call    DRAW_WINDOW
285
    jmp     main_loop
286
;-------------------------------------------------------------------------------
287
DRAW_WINDOW:
8568 IgorA 288
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
9530 leency 289
 
290
    push    dword [sc.work]
291
    mcall   SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
292
    pop     eax
293
    cmp     dword [sc.work], eax
294
    je      @f
295
    call    LOAD_ICONS
296
  @@:
297
    mov     esi, [sc.work]
298
    or        esi, 0x01000000
299
    mcall   SF_CREATE_WINDOW, <[win.x], [win.w]>, <[win.y], [win.h]>, [sc.work], , [sc.work_dark]
4120 eAndrew 300
 
8568 IgorA 301
    xor     edi, edi
4120 eAndrew 302
  @@:
303
    cmp     edi, [dock_items.count]
9530 leency 304
    je        @f
4120 eAndrew 305
 
306
    push    edi
8568 IgorA 307
    mov     eax, SF_DEFINE_BUTTON
4124 eAndrew 308
    mov     edx, 0x60000002
9530 leency 309
    mov     esi, [sc.work]
4140 eAndrew 310
    imul    edi, BUTTON_SIZE
311
    add     edi, 12
4124 eAndrew 312
    shl     edi, 16
4140 eAndrew 313
    add     edi, BUTTON_SIZE
4120 eAndrew 314
    cmp     byte[win.isvert], 1
9530 leency 315
    je        .vert_btn
4140 eAndrew 316
    mcall   , edi, <0, BUTTON_SIZE>
4120 eAndrew 317
    jmp     .endbtn
318
 .vert_btn:
4157 eAndrew 319
    sub     edi, 12 shl 16
4140 eAndrew 320
    mcall   , <0, BUTTON_SIZE>, edi
4120 eAndrew 321
 .endbtn:
322
    pop     edi
323
 
324
    cmp     byte[dock_items.separator + edi], 1
4134 eAndrew 325
    jne     .end_separator
4120 eAndrew 326
 
327
 .draw_separator:
328
    push    ebx
329
    push    ecx
4140 eAndrew 330
 
8568 IgorA 331
    mov     eax, SF_DRAW_RECT
4120 eAndrew 332
    mov     ebx, edi
4140 eAndrew 333
    imul    ebx, BUTTON_SIZE
334
    add     ebx, BUTTON_SIZE
8568 IgorA 335
    add     ebx, 12-1
4120 eAndrew 336
    shl     ebx, 16
4198 eAndrew 337
    add     ebx, 2
4140 eAndrew 338
 
4120 eAndrew 339
    cmp     byte[win.isvert], 1
9530 leency 340
    je      .vert_draw_sep
341
    mcall   , , <4,  36>, [sc.work_dark]
4120 eAndrew 342
    jmp     .end_inner_sep
343
 .vert_draw_sep:
4157 eAndrew 344
    sub     ebx, 12 shl 16
4120 eAndrew 345
    mov     ecx, ebx
9530 leency 346
    mcall   , <4, 36>, , [sc.work_dark]
4120 eAndrew 347
 .end_inner_sep:
348
    pop     ecx
349
    pop     ebx
350
 .end_separator:
351
 
352
    cmp     byte[win.isvert], 1
9530 leency 353
    je        .vert_dig
4120 eAndrew 354
    mov     edx, ebx
355
    and     edx, 0xFFFF0000
4140 eAndrew 356
    add     edx, 0x00060006
4120 eAndrew 357
    jmp     .digend
358
 .vert_dig:
359
    mov     edx, ecx
360
    and     edx, 0xFFFF0000
361
    shr     edx, 16
4140 eAndrew 362
    add     edx, 0x00060006
4120 eAndrew 363
 .digend:
364
 
365
    imul    ebx, edi, 4
366
    add     ebx, dock_items.icon
367
    mov     ebx, [ebx]
368
 
9530 leency 369
    push    edi
370
    imul    ebx, 32*32*4
371
    add     ebx, [icons_inactive]
372
    mcall   SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
373
    pop     edi
4120 eAndrew 374
 
375
    inc     edi
376
    jmp     @b
377
  @@:
378
 
8568 IgorA 379
    mcall   SF_REDRAW, SSF_END_DRAW
4120 eAndrew 380
 
4198 eAndrew 381
    ret
4120 eAndrew 382
;-------------------------------------------------------------------------------
4140 eAndrew 383
event_button:
8568 IgorA 384
    mcall   SF_GET_BUTTON
4120 eAndrew 385
 
9530 leency 386
    ;; it must not be possible to close dock
7421 leency 387
    ;cmp     ah, 1
9530 leency 388
    ;je        .button_close
4120 eAndrew 389
 
390
    cmp     ah, 2
9530 leency 391
    je      .button_dock
4120 eAndrew 392
 
393
    jmp     @f
394
 
7421 leency 395
 ;.button_close:
396
 ;   jmp     exit
4120 eAndrew 397
 
398
 .button_dock:
9530 leency 399
    mov     edi, [win.btn_index]
4120 eAndrew 400
    imul    edi, 256
401
 
8568 IgorA 402
    mov     dword[fi.p00], SSF_START_APP
4140 eAndrew 403
 
4120 eAndrew 404
    mov     esi, edi
405
    add     esi, dock_items.path
4140 eAndrew 406
    mov     dword[fi.p21], esi
4120 eAndrew 407
 
408
    mov     esi, edi
409
    add     esi, dock_items.param
4140 eAndrew 410
    mov     dword[fi.p08], esi
4120 eAndrew 411
 
8568 IgorA 412
    mcall   SF_FILE, fi
4120 eAndrew 413
 
4134 eAndrew 414
    mov     ecx, eax
8568 IgorA 415
    mcall   SF_SYSTEM, SSF_GET_THREAD_SLOT
4134 eAndrew 416
    and     eax, 0xFFFF
417
    mov     [win.psid], eax
418
 
4140 eAndrew 419
    jmp     wnd_hide
420
 
4120 eAndrew 421
  @@:
422
    jmp     main_loop
423
;-------------------------------------------------------------------------------
4140 eAndrew 424
event_mouse:
4198 eAndrew 425
  ; ==== IS MOUSE INNER ====
8568 IgorA 426
    mcall   SF_MOUSE_GET, SSF_WINDOW_POSITION
4120 eAndrew 427
    mov     edi, eax
428
    mov     esi, eax
429
    shr     edi, 16
430
    and     esi, 0xFFFF
431
 
432
    cmp     edi, 0
9530 leency 433
    jl        wnd_hide
4120 eAndrew 434
    dec     edi
9530 leency 435
    cmp     edi, [win.w]
436
    jg        wnd_hide
4120 eAndrew 437
    cmp     esi, 0
9530 leency 438
    jl        wnd_hide
4120 eAndrew 439
    dec     esi
9530 leency 440
    cmp     esi, [win.h]
441
    jg        wnd_hide
4120 eAndrew 442
 
4198 eAndrew 443
  ; ==== COUNT INDEX ====
444
 
4120 eAndrew 445
    mov     eax, [dock_items.location]
446
    and     eax, 1b
447
    cmp     eax, 1
448
    jne     .vert
449
    mov     eax, edi
450
    jmp     .nxt
451
 
452
 .vert:
453
    mov     eax, esi
4157 eAndrew 454
    add     eax, 12
4120 eAndrew 455
 
456
 .nxt:
4140 eAndrew 457
    sub     eax, 12
4120 eAndrew 458
    mov     edx, 0
4140 eAndrew 459
    mov     ebx, BUTTON_SIZE
4120 eAndrew 460
    div     ebx
461
 
462
    cmp     eax, [dock_items.count]
463
    jge     .set0
464
    jmp     .nxtcmp
465
 
466
 .set0:
467
    mov     eax, 100
468
 
469
 .nxtcmp:
9530 leency 470
    cmp     [win.btn_index], eax
471
    je        .nxt2
4120 eAndrew 472
 
9530 leency 473
    push    dword[win.btn_index]
4198 eAndrew 474
    pop     dword[win.prev_index]
475
 
9530 leency 476
    mov     [win.btn_index], eax
4120 eAndrew 477
 
4198 eAndrew 478
 ; ==== DRAW SELECTION ====
479
    call    DRAW_SELECTION
480
 
4120 eAndrew 481
 .nxt2:
9530 leency 482
    mov     eax, [win.btn_index]
4140 eAndrew 483
    imul    eax, BUTTON_SIZE
4120 eAndrew 484
    cmp     byte[win.isvert], 1
9530 leency 485
    je        .vert_name
4120 eAndrew 486
    add     eax, [win.x]
487
    mov     [nwin.x], eax
9530 leency 488
    mov     byte[nwin.swap_shape], 1
489
    mcall   SF_DRAW_RECT, <0, [win.w]>, <[win.h], 1>, [sc.work_dark]
4120 eAndrew 490
    jmp     .vert_end
491
 .vert_name:
492
    add     eax, [win.y]
4157 eAndrew 493
    add     eax, 14
4120 eAndrew 494
    mov     [nwin.y], eax
9530 leency 495
    mov     byte[nwin.swap_shape], 1
496
    mcall   SF_DRAW_RECT, <[win.w], 1>, <0, [win.h]>, [sc.work_dark]
4120 eAndrew 497
 .vert_end:
498
 
4198 eAndrew 499
 ; ==== OPEN/CLOSE WINDOW ====
4120 eAndrew 500
    cmp     byte[win.state], 1
9530 leency 501
    je        main_loop
4120 eAndrew 502
 
503
    mov     edx, esp
504
    add     edx, 512
8568 IgorA 505
    mcall   SF_CREATE_THREAD, 1, n_main
4120 eAndrew 506
 
8568 IgorA 507
    mcall   SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
4120 eAndrew 508
    mov     [win.psid], eax
509
 
8568 IgorA 510
    mcall   SF_SYSTEM, SSF_FOCUS_WINDOW, [win.sid]
4120 eAndrew 511
 
512
    mov     byte[win.state], 1
513
 
9530 leency 514
    m2m     dword [win.x], dword [win.x_opn]
515
    m2m     dword [win.y], dword [win.y_opn]
516
    m2m     dword [win.w], dword [win.w_opn]
517
    m2m     dword [win.h], dword [win.h_opn]
4120 eAndrew 518
 
5475 leency 519
    cmp     byte[dock_items.ashow],1
9530 leency 520
    je       .change_nothing
521
    mcall   SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
4120 eAndrew 522
 
5475 leency 523
  .change_nothing:
4198 eAndrew 524
    call    DRAW_WINDOW
525
    call    DRAW_SELECTION
526
    jmp     main_loop
4120 eAndrew 527
 
4140 eAndrew 528
;-------------------------------------------------------------------------------
529
wnd_hide:
4120 eAndrew 530
    cmp     byte[win.state], 0
9530 leency 531
    je        main_loop
4120 eAndrew 532
 
533
    mov     byte[nwin.close], 1
534
 
8568 IgorA 535
    mcall   SF_SYSTEM, SSF_FOCUS_WINDOW, [win.psid]
4120 eAndrew 536
 
537
    mov     byte[win.state], 0
9530 leency 538
    mov     byte[win.btn_index], -1
4120 eAndrew 539
 
5475 leency 540
    cmp     byte[dock_items.ashow],1
9530 leency 541
    je       .do_no_hide
5475 leency 542
 
9530 leency 543
    m2m     dword [win.x], dword [win.x_hdn]
544
    m2m     dword [win.y], dword [win.y_hdn]
545
    m2m     dword [win.w], dword [win.w_hdn]
546
    m2m     dword [win.h], dword [win.h_hdn]
4120 eAndrew 547
 
9530 leency 548
    mcall   SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
4120 eAndrew 549
 
5475 leency 550
  .do_no_hide:
4198 eAndrew 551
    call    DRAW_WINDOW
552
    jmp     main_loop
4120 eAndrew 553
;-------------------------------------------------------------------------------
4198 eAndrew 554
DRAW_SELECTION:
555
    mov     ebx, [win.prev_index]
556
    imul    ebx, BUTTON_SIZE
557
    add     ebx, 14
558
    shl     ebx, 16
559
    add     ebx, 40
560
    mov     ecx, 0x00020028
561
 
562
    cmp     byte[win.isvert], 1
563
    jne     @f
564
    xchg    ebx, ecx
565
    sub     ecx, 0x000C0000
566
  @@:
567
 
9530 leency 568
    mcall   SF_DRAW_RECT, , , [sc.work]
4198 eAndrew 569
 
570
    mov     edx, ebx
571
    shr     ecx, 16
9530 leency 572
    mov     dx,  cx
4198 eAndrew 573
    add     edx, 0x00040004
574
 
575
    mov     ebx, [win.prev_index]
576
    imul    ebx, 4
577
    add     ebx, dock_items.icon
578
    mov     ebx, [ebx]
9530 leency 579
    imul    ebx, 32*32*4
580
    add     ebx, [icons_inactive]
581
    mcall   SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
4198 eAndrew 582
 
9530 leency 583
    mov     ebx, [win.btn_index]
4198 eAndrew 584
    imul    ebx, BUTTON_SIZE
585
    add     ebx, 14
586
    shl     ebx, 16
587
    add     ebx, 40
588
    mov     ecx, 0x00020028
589
 
590
    cmp     byte[win.isvert], 1
591
    jne     @f
592
    xchg    ebx, ecx
593
    sub     ecx, 0x000C0000
594
  @@:
595
 
9530 leency 596
    mcall   SF_DRAW_RECT, , , [sc.work_button]
4198 eAndrew 597
 
598
    mov     edx, ebx
599
    shr     ecx, 16
600
    mov     dx, cx
601
    add     edx, 0x00040004
602
 
9530 leency 603
    mov     ebx, [win.btn_index]
604
    imul    ebx, 4
605
    add     ebx, dock_items.icon
606
    mov     ebx, [ebx]
607
    imul    ebx, 32*32*4
608
    add     ebx, [icons_active]
609
    mcall   SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
610
 
611
    ret
612
;-------------------------------------------------------------------------------
613
proc icon32cpy uses ecx edx edi esi, dest:dword, src:dword, len:dword, bgcol:dword
614
    mov     edi, [dest]
615
    mov     esi, [src]
616
    mov     ecx, [len]
617
    mov     edx, [bgcol]
618
.loop:
619
    m2m     dword [edi], dword [esi]
620
    cmp     dword [edi], 0
621
    jne     @f
622
    mov     dword [edi], edx
623
   @@:
624
    add     edi, 4
625
    add     esi, 4
626
    sub     ecx, 4
627
    cmp     ecx, 4
628
    jg      .loop
4198 eAndrew 629
 
9530 leency 630
    ret
631
endp
632
;-------------------------------------------------------------------------------
633
LOAD_ICONS:
634
    mov     esi, 0 ; esi is a counter of mem_open attempts
9877 Doczom 635
    mov     edi, esi
4198 eAndrew 636
  @@:
9530 leency 637
    ; try to open shr memory, if failed then make 5 attempts more
638
    mcall   SF_SYS_MISC, SSF_MEM_OPEN,icons_resname ; 0 = SHM_READ
9876 Doczom 639
 
9530 leency 640
    cmp     eax,0
641
    jne     @f
9877 Doczom 642
    inc     edi
643
    cmp     edi,10
644
    je      error_exit
9530 leency 645
    mcall   SF_SLEEP, 70
646
    jmp     @b
647
  @@:
648
    mov     [shr_icons_ptr], eax
649
    mov     [shr_icons_len], edx
650
 
651
    mcall   SF_SYS_MISC, SSF_MEM_FREE,  [icons_active]
652
    mcall   SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
653
    mov     [icons_active], eax
654
 
655
    mcall   SF_SYS_MISC, SSF_MEM_FREE,  [icons_inactive]
656
    mcall   SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
657
    mov     [icons_inactive], eax
658
 
659
    stdcall icon32cpy, [icons_inactive], [shr_icons_ptr], [shr_icons_len], [sc.work]
660
    stdcall icon32cpy, [icons_active],   [shr_icons_ptr], [shr_icons_len], [sc.work_button]
661
 
662
    mcall   SF_SYS_MISC, SSF_MEM_CLOSE,icons_resname
663
 
4198 eAndrew 664
    ret
665
;-------------------------------------------------------------------------------
4120 eAndrew 666
proc sections_callback, _file_name, _section_name
667
    mov     eax, [_section_name]
668
    cmp     byte[eax], '@'
669
    jne     @f
670
 
671
    dec     dword[dock_items.count]
672
    jmp     .endproc
673
 
674
  @@:
675
    ; ==== GET NAME ====
676
    mov     ebx, [dock_items.count]
677
    imul    ebx, 16
678
    add     ebx, dock_items.name
679
 
680
    mov     eax, [_section_name]
681
 
682
    mov     edi, 0
683
  @@:
684
    mov     cl, byte[eax]
685
    mov     byte[ebx + edi], cl
686
 
687
    inc     eax
688
    inc     edi
689
    cmp     edi, 10
690
    jne     @b
691
 
692
  ; ==== GET PATH ====
693
    mov     ebx, [dock_items.count]
694
    imul    ebx, 256
695
    add     ebx, dock_items.path
696
 
697
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0
698
 
699
  ; === GET  PARAM ===
700
    mov     ebx, [dock_items.count]
701
    imul    ebx, 256
702
    add     ebx, dock_items.param
703
 
704
    invoke  ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0
705
 
706
  ; ==== GET ICON ====
707
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0
708
 
709
    mov     ebx, [dock_items.count]
710
    imul    ebx, 4
711
    mov     [dock_items.icon + ebx], eax
712
 
713
  ; ==== GET SEPARATOR ====
714
    invoke  ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0
715
 
716
    mov     ebx, [dock_items.count]
717
    mov     byte[dock_items.separator + ebx], al
718
 
719
  ; ====== END =======
720
 .endproc:
721
    mov     eax, 1
722
    inc     dword[dock_items.count]
723
    ret
724
endp
725
;-------------------------------------------------------------------------------
4140 eAndrew 726
    include "MEMORY.INC"