Subversion Repositories Kolibri OS

Rev

Rev 7613 | Rev 9444 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7613 Rev 8568
Line 5... Line 5...
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 "../../../KOSfuncs.inc"
10
    include "../../../develop/libraries/box_lib/load_lib.mac"
11
    include "../../../load_lib.mac"
11
    ;include "../../../debug.inc"
12
    ;include "../../../debug.inc"
Line 12... Line 13...
12
 
13
 
13
    include "DATA.INC"
14
    include "DATA.INC"
Line 14... Line 15...
14
    include "NAME.INC"
15
    include "NAME.INC"
15
 
16
 
16
    @use_library_mem	 \
17
    @use_library	 \
17
	    mem.Alloc,	 \
18
	    mem.Alloc,	 \
18
	    mem.Free,	 \
19
	    mem.Free,	 \
19
	    mem.ReAlloc, \
20
	    mem.ReAlloc, \
20
	    dll.Load
21
	    dll.Load
21
;================================================================================
22
;================================================================================
22
main:
23
main:
23
; ==== Init ====
24
; ==== Init ====
Line 24... Line 25...
24
    mcall   18, 7
25
    mcall   SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
Line 25... Line 26...
25
    mov     [win.psid], eax
26
    mov     [win.psid], eax
26
 
27
 
Line 27... Line 28...
27
    mcall   40, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change
28
    mcall   SF_SET_EVENTS_MASK, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change
Line 38... Line 39...
38
    mov     [dock_items.ashow], eax
39
    mov     [dock_items.ashow], eax
Line 39... Line 40...
39
 
40
 
Line 40... Line 41...
40
    invoke  ini.sections, ini_data.file_name, sections_callback
41
    invoke  ini.sections, ini_data.file_name, sections_callback
41
 
42
 
42
; ==== Load colors ====
43
; ==== Load colors ====
43
    mcall   48, 3, color
44
    mcall   SF_STYLE_SETTINGS, SSF_GET_COLORS, color
44
    or	    dword[color.bg],	0x10000000
45
    or	    dword[color.bg],	0x10000000
Line 45... Line 46...
45
    or	    dword[color.frame], 0x10000000
46
    or	    dword[color.frame], 0x10000000
46
    or	    dword[color.text],	0x80000000
47
    or	    dword[color.text],	0x80000000
47
 
48
 
48
; ==== Config LibIMG ====
49
; ==== Config LibIMG ====
Line 49... Line 50...
49
    mov     dword[fi.p00], 5
50
    mov     dword[fi.p00], SSF_GET_INFO
Line 50... Line 51...
50
    mov     dword[fi.p16], buf_128
51
    mov     dword[fi.p16], buf_128
51
    mov     dword[fi.p21], img_data.file_name
52
    mov     dword[fi.p21], img_data.file_name
Line 52... Line 53...
52
 
53
 
53
    mcall   70, fi
54
    mcall   SF_FILE, fi
Line 54... Line 55...
54
 
55
 
55
    mov     edx, [buf_128 + 32]
56
    mov     edx, [buf_128 + 32]
56
    imul    edx, 10
57
    imul    edx, 10
57
 
58
 
Line 58... Line 59...
58
    stdcall mem.Alloc, edx
59
    stdcall mem.Alloc, edx
Line 59... Line 60...
59
    mov     [img_data.rgb_object], eax
60
    mov     [img_data.rgb_object], eax
60
 
61
 
Line 61... Line 62...
61
    mov     dword[fi.p00], 0
62
    mov     dword[fi.p00], SSF_READ_FILE
Line 151... Line 152...
151
    imul    eax, ebx
152
    imul    eax, ebx
152
    add     eax, 24
153
    add     eax, 24
153
    dec     eax
154
    dec     eax
154
    jmp     .set_hw
155
    jmp     .set_hw
155
  @@:
156
  @@:
156
    mcall   14
157
    mcall   SF_GET_SCREEN_SIZE
157
    shr     eax, 16
158
    shr     eax, 16
158
 .set_hw:
159
 .set_hw:
159
    mov     [win.width_opn], eax
160
    mov     [win.width_opn], eax
160
    mov     [win.width_hdn], eax
161
    mov     [win.width_hdn], eax
Line 161... Line 162...
161
 
162
 
Line 162... Line 163...
162
    ret
163
    ret
163
 
164
 
164
;-------------------------------------------------------------------------------
165
;-------------------------------------------------------------------------------
165
 .HORZ_X:
166
 .HORZ_X:
166
    mcall   14
167
    mcall   SF_GET_SCREEN_SIZE
167
    shr     eax, 17
168
    shr     eax, 17
168
    mov     ecx, [win.width_opn]
169
    mov     ecx, [win.width_opn]
169
    shr     ecx, 1
170
    shr     ecx, 1
Line 180... Line 181...
180
 
181
 
Line 181... Line 182...
181
    ret
182
    ret
182
 
183
 
183
;-------------------------------------------------------------------------------
184
;-------------------------------------------------------------------------------
184
 .HORZ_Y_BOTTOM:
185
 .HORZ_Y_BOTTOM:
185
    mcall   14
186
    mcall   SF_GET_SCREEN_SIZE
186
    and     eax, 0xFFFF
187
    and     eax, 0xFFFF
187
    dec     eax
188
    dec     eax
188
    mov     [win.y_hdn], eax
189
    mov     [win.y_hdn], eax
Line 210... Line 211...
210
    mov     dword[win.x_hdn], 0
211
    mov     dword[win.x_hdn], 0
Line 211... Line 212...
211
 
212
 
Line 212... Line 213...
212
    ret
213
    ret
213
 
214
 
214
 .VERT_X_RIGHT:
215
 .VERT_X_RIGHT:
215
    mcall   14
216
    mcall   SF_GET_SCREEN_SIZE
216
    and     eax, 0xFFFF0000
217
    and     eax, 0xFFFF0000
217
    shr     eax, 16
218
    shr     eax, 16
218
    mov     [win.x_hdn], eax
219
    mov     [win.x_hdn], eax
Line 229... Line 230...
229
    mov     ebx, [dock_items.count]
230
    mov     ebx, [dock_items.count]
230
    imul    eax, ebx
231
    imul    eax, ebx
231
    dec     eax
232
    dec     eax
232
    jmp     .set_vh
233
    jmp     .set_vh
233
  @@:
234
  @@:
234
    mcall   14
235
    mcall   SF_GET_SCREEN_SIZE
235
    and     eax, 0xFFFF
236
    and     eax, 0xFFFF
236
 .set_vh:
237
 .set_vh:
237
    mov     [win.height_opn], eax
238
    mov     [win.height_opn], eax
238
    mov     [win.height_hdn], eax
239
    mov     [win.height_hdn], eax
Line 239... Line 240...
239
 
240
 
Line 240... Line 241...
240
    ret
241
    ret
241
 
242
 
242
;-------------------------------------------------------------------------------
243
;-------------------------------------------------------------------------------
243
 .VERT_Y:
244
 .VERT_Y:
244
    mcall   14
245
    mcall   SF_GET_SCREEN_SIZE
Line 245... Line 246...
245
    and     eax, 0xFFFF
246
    and     eax, 0xFFFF
246
    shr     eax, 1
247
    shr     eax, 1
Line 286... Line 287...
286
 .not_ashow:
287
 .not_ashow:
Line 287... Line 288...
287
 
288
 
288
 
289
 
289
;-------------------------------------------------------------------------------
290
;-------------------------------------------------------------------------------
290
; ==== START ====
291
; ==== START ====
291
    mcall   9, win.procinfo, -1
292
    mcall   SF_THREAD_INFO, win.procinfo, -1
292
    mov     ecx, [win.procinfo + 30]
293
    mov     ecx, [win.procinfo + 30]
293
    mcall   18, 21
294
    mcall   SF_SYSTEM, SSF_GET_THREAD_SLOT
Line 294... Line 295...
294
    and     eax, 0xFFFF
295
    and     eax, 0xFFFF
295
    mov     [win.sid], eax
296
    mov     [win.sid], eax
296
 
297
 
297
    call    main_loop
298
    call    main_loop
298
;-------------------------------------------------------------------------------
299
;-------------------------------------------------------------------------------
299
exit:
300
exit:
300
    stdcall mem.Free, [img_data.rgb_object]
301
    stdcall mem.Free, [img_data.rgb_object]
-
 
302
    mcall   SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid]
301
    mcall   18, 2, [nwin.sid]
303
    mcall   SF_TERMINATE_PROCESS
302
    mcall   -1
304
;-------------------------------------------------------------------------------
Line 303... Line 305...
303
;-------------------------------------------------------------------------------
305
align 4
304
main_loop:
306
main_loop:
Line 305... Line 307...
305
    mcall   10
307
    mcall   SF_WAIT_EVENT
Line 318... Line 320...
318
event_redraw:
320
event_redraw:
319
    call    DRAW_WINDOW
321
    call    DRAW_WINDOW
320
    jmp     main_loop
322
    jmp     main_loop
321
;-------------------------------------------------------------------------------
323
;-------------------------------------------------------------------------------
322
DRAW_WINDOW:
324
DRAW_WINDOW:
323
    mcall   12, 1
325
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
Line 324... Line 326...
324
 
326
 
325
    mov     esi, [color.bg]
327
    mov     esi, [color.bg]
326
    or	    esi, 0x01000000
328
    or	    esi, 0x01000000
Line 327... Line 329...
327
    mcall   0, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame]
329
    mcall   SF_CREATE_WINDOW, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame]
328
 
330
 
329
    mov     edi, 0
331
    xor     edi, edi
330
  @@:
332
  @@:
Line 331... Line 333...
331
    cmp     edi, [dock_items.count]
333
    cmp     edi, [dock_items.count]
332
    je	    @f
334
    je	    @f
333
 
335
 
334
    push    edi
336
    push    edi
335
    mov     eax, 8
337
    mov     eax, SF_DEFINE_BUTTON
336
    mov     edx, 0x60000002
338
    mov     edx, 0x60000002
337
    mov     esi, [color.bg]
339
    mov     esi, [color.bg]
Line 354... Line 356...
354
 
356
 
355
 .draw_separator:
357
 .draw_separator:
356
    push    ebx
358
    push    ebx
Line 357... Line 359...
357
    push    ecx
359
    push    ecx
358
 
360
 
359
    mov     eax, 13
361
    mov     eax, SF_DRAW_RECT
360
    mov     ebx, edi
362
    mov     ebx, edi
361
    imul    ebx, BUTTON_SIZE
363
    imul    ebx, BUTTON_SIZE
362
    add     ebx, BUTTON_SIZE
-
 
363
    add     ebx, 12
364
    add     ebx, BUTTON_SIZE
364
    dec     ebx
365
    add     ebx, 12-1
Line 365... Line 366...
365
    shl     ebx, 16
366
    shl     ebx, 16
366
    add     ebx, 2
367
    add     ebx, 2
Line 395... Line 396...
395
    add     ebx, dock_items.icon
396
    add     ebx, dock_items.icon
396
    mov     ebx, [ebx]
397
    mov     ebx, [ebx]
397
    imul    ebx, ICON_SIZE_BGR
398
    imul    ebx, ICON_SIZE_BGR
398
    add     ebx, [img_data.rgb_object]
399
    add     ebx, [img_data.rgb_object]
Line 399... Line 400...
399
 
400
 
Line 400... Line 401...
400
    mcall   7, , <32, 32>
401
    mcall   SF_PUT_IMAGE, , <32, 32>
401
 
402
 
402
    inc     edi
403
    inc     edi
Line 403... Line 404...
403
    jmp     @b
404
    jmp     @b
Line 404... Line 405...
404
  @@:
405
  @@:
405
 
406
 
406
    mcall   12, 2
407
    mcall   SF_REDRAW, SSF_END_DRAW
407
 
408
 
Line 408... Line 409...
408
    ret
409
    ret
409
;-------------------------------------------------------------------------------
410
;-------------------------------------------------------------------------------
410
event_button:
411
event_button:
Line 424... Line 425...
424
 
425
 
425
 .button_dock:
426
 .button_dock:
426
    mov     edi, [win.button_index]
427
    mov     edi, [win.button_index]
Line 427... Line 428...
427
    imul    edi, 256
428
    imul    edi, 256
Line 428... Line 429...
428
 
429
 
429
    mov     dword[fi.p00], 7
430
    mov     dword[fi.p00], SSF_START_APP
430
 
431
 
Line 431... Line 432...
431
    mov     esi, edi
432
    mov     esi, edi
432
    add     esi, dock_items.path
433
    add     esi, dock_items.path
433
    mov     dword[fi.p21], esi
434
    mov     dword[fi.p21], esi
Line 434... Line 435...
434
 
435
 
Line 435... Line 436...
435
    mov     esi, edi
436
    mov     esi, edi
436
    add     esi, dock_items.param
437
    add     esi, dock_items.param
437
    mov     dword[fi.p08], esi
438
    mov     dword[fi.p08], esi
438
 
439
 
Line 439... Line 440...
439
    mcall   70, fi
440
    mcall   SF_FILE, fi
Line 440... Line 441...
440
 
441
 
441
    mov     ecx, eax
442
    mov     ecx, eax
442
    mcall   18, 21
443
    mcall   SF_SYSTEM, SSF_GET_THREAD_SLOT
443
    and     eax, 0xFFFF
444
    and     eax, 0xFFFF
444
    mov     [win.psid], eax
445
    mov     [win.psid], eax
445
 
446
 
446
    jmp     wnd_hide
447
    jmp     wnd_hide
447
 
448
 
448
  @@:
449
  @@:
449
    jmp     main_loop
450
    jmp     main_loop
Line 511... Line 512...
511
    cmp     byte[win.isvert], 1
512
    cmp     byte[win.isvert], 1
512
    je	    .vert_name
513
    je	    .vert_name
513
    add     eax, [win.x]
514
    add     eax, [win.x]
514
    mov     [nwin.x], eax
515
    mov     [nwin.x], eax
515
    mov     byte[nwin.change_shape], 1
516
    mov     byte[nwin.change_shape], 1
516
    mcall   13, <0, [win.width]>, <[win.height], 1>, [color.frame]
517
    mcall   SF_DRAW_RECT, <0, [win.width]>, <[win.height], 1>, [color.frame]
517
    jmp     .vert_end
518
    jmp     .vert_end
518
 .vert_name:
519
 .vert_name:
519
    add     eax, [win.y]
520
    add     eax, [win.y]
520
    add     eax, 14
521
    add     eax, 14
521
    mov     [nwin.y], eax
522
    mov     [nwin.y], eax
522
    mov     byte[nwin.change_shape], 1
523
    mov     byte[nwin.change_shape], 1
523
    mcall   13, <[win.width], 1>, <0, [win.height]>, [color.frame]
524
    mcall   SF_DRAW_RECT, <[win.width], 1>, <0, [win.height]>, [color.frame]
524
 .vert_end:
525
 .vert_end:
Line 525... Line 526...
525
 
526
 
526
 ; ==== OPEN/CLOSE WINDOW ====
527
 ; ==== OPEN/CLOSE WINDOW ====
527
    cmp     byte[win.state], 1
528
    cmp     byte[win.state], 1
Line 528... Line 529...
528
    je	    main_loop
529
    je	    main_loop
529
 
530
 
530
    mov     edx, esp
531
    mov     edx, esp
531
    add     edx, 512
-
 
532
    mcall   51, 1, n_main
-
 
Line 533... Line 532...
533
 
532
    add     edx, 512
534
    mov     eax, 18
533
    mcall   SF_CREATE_THREAD, 1, n_main
Line 535... Line 534...
535
 
534
 
Line 536... Line 535...
536
    mcall   , 7
535
    mcall   SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
Line 537... Line 536...
537
    mov     [win.psid], eax
536
    mov     [win.psid], eax
538
 
537
 
Line 553... Line 552...
553
    mov     [win.y], eax
552
    mov     [win.y], eax
Line 554... Line 553...
554
 
553
 
555
 
554
 
556
    cmp     byte[dock_items.ashow],1
555
    cmp     byte[dock_items.ashow],1
Line 557... Line 556...
557
    je	   .change_nothing
556
    je	   .change_nothing
558
    mcall   67, [win.x], [win.y], [win.width], [win.height]
557
    mcall   SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height]
559
 
558
 
560
  .change_nothing:
559
  .change_nothing:
Line 567... Line 566...
567
    cmp     byte[win.state], 0
566
    cmp     byte[win.state], 0
568
    je	    main_loop
567
    je	    main_loop
Line 569... Line 568...
569
 
568
 
Line 570... Line 569...
570
    mov     byte[nwin.close], 1
569
    mov     byte[nwin.close], 1
Line 571... Line 570...
571
 
570
 
572
    mcall   18, 3, [win.psid]
571
    mcall   SF_SYSTEM, SSF_FOCUS_WINDOW, [win.psid]
Line 573... Line 572...
573
 
572
 
Line 587... Line 586...
587
    mov     [win.height], eax
586
    mov     [win.height], eax
Line 588... Line 587...
588
 
587
 
589
    mov     eax, [win.y_hdn]
588
    mov     eax, [win.y_hdn]
Line 590... Line 589...
590
    mov     [win.y], eax
589
    mov     [win.y], eax
Line 591... Line 590...
591
 
590
 
592
    mcall   67, [win.x], [win.y], [win.width], [win.height]
591
    mcall   SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height]
593
 
592
 
594
  .do_no_hide:
593
  .do_no_hide:
Line 607... Line 606...
607
    jne     @f
606
    jne     @f
608
    xchg    ebx, ecx
607
    xchg    ebx, ecx
609
    sub     ecx, 0x000C0000
608
    sub     ecx, 0x000C0000
610
  @@:
609
  @@:
Line 611... Line 610...
611
 
610
 
Line 612... Line 611...
612
    mcall   13, , , [color.bg]
611
    mcall   SF_DRAW_RECT, , , [color.bg]
613
 
612
 
614
    mov     edx, ebx
613
    mov     edx, ebx
615
    shr     ecx, 16
614
    shr     ecx, 16
Line 621... Line 620...
621
    add     ebx, dock_items.icon
620
    add     ebx, dock_items.icon
622
    mov     ebx, [ebx]
621
    mov     ebx, [ebx]
623
    imul    ebx, ICON_SIZE_BGR
622
    imul    ebx, ICON_SIZE_BGR
624
    add     ebx, [img_data.rgb_object]
623
    add     ebx, [img_data.rgb_object]
Line 625... Line 624...
625
 
624
 
Line 626... Line 625...
626
    mcall   7, , <32, 32>
625
    mcall   SF_PUT_IMAGE, , <32, 32>
627
 
626
 
628
    mov     ebx, [win.button_index]
627
    mov     ebx, [win.button_index]
629
    imul    ebx, BUTTON_SIZE
628
    imul    ebx, BUTTON_SIZE
Line 636... Line 635...
636
    jne     @f
635
    jne     @f
637
    xchg    ebx, ecx
636
    xchg    ebx, ecx
638
    sub     ecx, 0x000C0000
637
    sub     ecx, 0x000C0000
639
  @@:
638
  @@:
Line 640... Line 639...
640
 
639
 
Line 641... Line 640...
641
    mcall   13, , , [color.bt]
640
    mcall   SF_DRAW_RECT, , , [color.bt]
642
 
641
 
643
    mov     edx, ebx
642
    mov     edx, ebx
644
    shr     ecx, 16
643
    shr     ecx, 16
Line 680... Line 679...
680
    add     edi, 3
679
    add     edi, 3
Line 681... Line 680...
681
 
680
 
682
    cmp     edi, 1024 * 3
681
    cmp     edi, 1024 * 3
Line 683... Line 682...
683
    jne     @b
682
    jne     @b
Line 684... Line 683...
684
 
683
 
685
    mcall   7, sel_img, <32, 32>
684
    mcall   SF_PUT_IMAGE, sel_img, <32, 32>
686
 
685
 
687
    ret
686
    ret