Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
4812 eAndrew 1
use32
2
    org     0
3
    db	    'MENUET01'
5892 eAndrew 4
    dd	    1, @ENTRY, @end, @memory, @stack, @params, 0
4812 eAndrew 5
 
6
    include "../../macros.inc"
7
    include "../../proc32.inc"
8
    include "../../dll.inc"
5889 eAndrew 9
;    include "../../debug.inc"
5892 eAndrew 10
    include "../../notify.inc"
11
    include "../../string.inc"
4812 eAndrew 12
 
13
 LINEH	    equ 12
5892 eAndrew 14
 MARGIN     equ 12
4814 eAndrew 15
 ICONS	    equ 11
4812 eAndrew 16
 
5892 eAndrew 17
;-------------------------------------------------------------------------------
4812 eAndrew 18
 
5892 eAndrew 19
 @ENTRY:
20
;; INIT HEAP
21
    mcall   68, 11
4812 eAndrew 22
 
5892 eAndrew 23
;; SAVE FOCUSED WINDOW
5868 eAndrew 24
    mcall   18, 7
25
    mov     ecx, eax
26
    mcall   9, buffer
5892 eAndrew 27
    m2m     dword [prev_pid], dword [buffer + 30]
5868 eAndrew 28
 
5892 eAndrew 29
;; MAKE IT ALWAYS ON TOP
5868 eAndrew 30
    mcall   18, 25, 2, -1, 1
31
 
5892 eAndrew 32
;; SET STD PARAMS, IF IT NEEDS
4812 eAndrew 33
    mov     eax, @params
5892 eAndrew 34
    cmpne   byte [@params], 0, @f
5889 eAndrew 35
    mov     eax, sz_std
4812 eAndrew 36
  @@:
5892 eAndrew 37
    mov     [params.source], eax
4812 eAndrew 38
 
5892 eAndrew 39
;; PARSE ARGUMENTS
40
    mov     esi, 0
5889 eAndrew 41
    call    parse_text
5892 eAndrew 42
    call    parse_flags
43
    movzx   ebx, [params.icon]
4812 eAndrew 44
 
5892 eAndrew 45
;; GET PID
46
    mcall   9, buffer, -1
47
    mov     eax, dword [buffer + 30]
4812 eAndrew 48
 
5892 eAndrew 49
;; CONVERT PID TO STR
50
    mov     ebx, 10
51
    mov     ecx, 0
52
  @@:
53
    mov     edx, 0
54
    div     ebx
55
    push    edx
56
    inc     ecx
57
    cmpne   eax, 0, @b
5868 eAndrew 58
 
5892 eAndrew 59
    mov     ebx, ctrl.name
5868 eAndrew 60
  @@:
5892 eAndrew 61
    pop     eax
62
    add     al, "0"
63
    mov     [ebx], al
4812 eAndrew 64
    inc     ebx
5892 eAndrew 65
    loop    @b
4812 eAndrew 66
 
5892 eAndrew 67
    mov     dword [ebx + 0], "-NOT"
68
    mov     dword [ebx + 4], "IFY"
4812 eAndrew 69
 
5892 eAndrew 70
;; LOAD LIBRARIES
4812 eAndrew 71
    stdcall dll.Load, @imports
72
 
5892 eAndrew 73
;; GET SIZE OF ICONS
4812 eAndrew 74
    mcall   70, fi
75
    mov     edx, dword [buffer + 32]
76
    shl     edx, 2
5892 eAndrew 77
 
78
;; ALLOCATE MEMORY FOR THIS
4812 eAndrew 79
    stdcall mem.Alloc, edx
80
    mov     [img_data.rgb_obj], eax
81
 
5892 eAndrew 82
;; READ ICONS
4812 eAndrew 83
    mov     dword [fi + 00], 0
84
    mov     dword [fi + 12], edx
5892 eAndrew 85
    mov     dword [fi + 16], eax
4812 eAndrew 86
    mcall   70, fi
87
 
5892 eAndrew 88
;; DECODE ICONS
4812 eAndrew 89
    stdcall dword [img.decode], dword [img_data.rgb_obj], ebx, 0
90
    mov     dword [img_data.obj], eax
91
    stdcall dword [img.to_rgb], dword [img_data.obj], dword [img_data.rgb_obj]
92
    stdcall dword [img.destroy], dword [img_data.obj]
93
 
94
 
95
 
5892 eAndrew 96
;; CALC HEIGHT
4812 eAndrew 97
    mov     eax, [text.lines]
98
    add     eax, 2
99
    imul    eax, LINEH
100
    mov     [window.height], eax
101
 
5892 eAndrew 102
;; CALC OFFSET OF TEXT
103
    mov     dword [text.offset], MARGIN
104
    cmpe    byte [params.icon], 0, @f
105
    add     dword [text.offset], MARGIN + 24
106
  @@:
107
 
108
;; CALC WIDTH
4812 eAndrew 109
    mov     eax, [text.max_len]
110
    imul    eax, 6
5892 eAndrew 111
    add     eax, MARGIN
112
    add     eax, [text.offset]
4812 eAndrew 113
    mov     [window.width], eax
114
 
115
    mcall   14
116
    mov     ebx, eax
5892 eAndrew 117
    movzx   ebx, bx
4812 eAndrew 118
    mov     [scr.height], ebx
119
    shr     eax, 16
120
    mov     [scr.width], eax
121
    sub     eax, [window.width]
122
    sub     eax, LINEH
123
    mov     [window.x], eax
124
 
5900 eAndrew 125
;; CALC PBAR
126
    mov     eax, [window.width]
127
    sub     eax, [text.offset]
128
    sub     eax, MARGIN
129
    mov     [pbar.width], eax
130
 
5892 eAndrew 131
;; CALC Y
132
    mcall   68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
4812 eAndrew 133
    add     eax, 512
134
    mov     [shm], eax
135
 
136
 s_search:
137
    mov     eax, [shm]
138
 
139
    mov     ebx, 0
140
    mov     ecx, [text.lines]
141
    add     ecx, 3
142
 
143
    push    eax ebx
144
 
145
    mov     eax, [scr.height]
146
    mov     edx, 0
147
    mov     ebx, LINEH
148
    div     ebx
149
    mov     edx, eax
150
    add     edx, [shm]
151
    sub     edx, ecx
152
    inc     edx
153
 
154
    pop     ebx eax
155
 
156
 s_area:
157
    cmpe    [eax], byte 1, .is_1
158
 
5892 eAndrew 159
 .is_0:
4812 eAndrew 160
    inc     ebx
161
    cmpe    ebx, ecx, s_ok
162
    jmp     .next
163
 
5892 eAndrew 164
 .is_1:
4812 eAndrew 165
    mov     ebx, 0
166
 
5892 eAndrew 167
 .next:
4812 eAndrew 168
    inc     eax
169
    cmple   eax, edx, s_area
170
 
171
    mcall   5, 10
172
    jmp     s_search
173
 
174
 s_ok:
175
    sub     eax, ecx
176
    inc     eax
177
    mov     [shm.our], eax
178
 
179
    mov     edx, eax
180
    sub     edx, [shm]
181
    inc     edx
182
    imul    edx, LINEH
183
    mov     [window.y], edx
184
 
4877 eAndrew 185
    push    eax ebx
186
    mcall   48, 5
187
    shr     ebx, 16
188
    add     [window.y], ebx
189
    pop     ebx eax
190
 
4812 eAndrew 191
  @@:
192
    mov     [eax], byte 1
193
    inc     eax
194
    loop    @b
195
 
196
 ;----------------------------
197
 
5892 eAndrew 198
;; SET EVENT MASK
199
    mcall   40, 101b
200
 
201
;; INIT TIMER
4812 eAndrew 202
    mov     eax, 60
203
    imul    eax, [text.lines]
204
    mov     [timer], eax
5892 eAndrew 205
    mov     dword [timer.step], 1
206
    cmpne   byte [params.atcl], 1, @f
207
    mov     dword [timer.step], 0
4812 eAndrew 208
  @@:
209
 
5892 eAndrew 210
;; INIT WINDOW
5868 eAndrew 211
    call    init_window
212
 
5892 eAndrew 213
;; RESTORE FOCUS
5868 eAndrew 214
    mcall   18, 21, [prev_pid]
215
    mov     ecx, eax
216
    mcall   18, 3
217
 
218
    jmp     redraw
219
 
220
 ;----------------------------
221
 
4812 eAndrew 222
 update:
223
    mcall   23, 10
224
    cmpe    al, EV_REDRAW, redraw
5892 eAndrew 225
    cmpe    al, EV_BUTTON, button
4812 eAndrew 226
 
5892 eAndrew 227
    mov     edi, update
228
 
229
;; TRY OPEN CONTROLLER
230
    cmpe    byte [params.ctrl], 1, .fail_controller_open
231
    mcall   68, 22, ctrl.name, , 0x01
232
    cmpe    eax, 0, .fail_controller_open
233
    mov     byte [params.ctrl], 1
234
    mov     [ctrl.addr], eax
235
 
236
;; COPY TEXT TO CTRL
237
    add     eax, NTCTRL_TEXT
238
    mov     ebx, text.buffer
5900 eAndrew 239
 
5892 eAndrew 240
    mov     ecx, [text.lines]
5900 eAndrew 241
    cmpne   byte [params.pbar], 1, @f
242
    dec     ecx
243
  @@:
244
 
5892 eAndrew 245
 .copy_start:
246
    cmpe     ecx, 0, .copy_end
247
    mov      dl, [ebx]
248
    cmpne    dl, 0, @f
5900 eAndrew 249
    mov      dl, 10
5892 eAndrew 250
    dec      ecx
251
  @@:
252
    mov      [eax], dl
253
    inc      eax
254
    inc      ebx
255
    jmp      .copy_start
256
 .copy_end:
257
    mov      byte [eax - 1], 0
258
 
259
;; COPY FLAGS TO CTRL
260
    mov      eax, [ctrl.addr]
261
    add      eax, NTCTRL_ICON
262
    mov      dl, [params.icon]
263
    mov      [eax], dl
264
 
265
    mov      eax, [ctrl.addr]
266
    add      eax, NTCTRL_TITLE
267
    mov      dl,  [params.title]
268
    mov      [eax], dl
269
 
270
;; SET CONTROLLER READY
271
    mov     eax, [ctrl.addr]
272
    add     eax, NTCTRL_READY
273
    mov     byte [eax], 1
274
 .fail_controller_open:
275
 
276
 
277
    cmpe    [params.ctrl], 0, .no_ctrl
278
;; TEST TEXT
279
    mov     eax, [ctrl.addr]
280
    add     eax, NTCTRL_APPLY_TEXT
281
    cmpne   byte [eax], 1, @f
282
    mov     byte [eax], 0
5900 eAndrew 283
 
5892 eAndrew 284
    mov     eax, [ctrl.addr]
285
    add     eax, NTCTRL_TEXT
286
    mov     esi, 1
287
    call    parse_text
5900 eAndrew 288
 
5892 eAndrew 289
    mov     edi, redraw
290
  @@:
291
 
292
;; TEST ICON
293
    mov     eax, [ctrl.addr]
294
    add     eax, NTCTRL_APPLY_ICON
295
    cmpne   byte [eax], 1, @f
5900 eAndrew 296
    mov     byte [eax], 0
297
 
5892 eAndrew 298
    mov     eax, [ctrl.addr]
299
    add     eax, NTCTRL_ICON
300
    mov     dl, [eax]
301
    mov     [params.icon], dl
5900 eAndrew 302
 
303
    mov     edi, redraw
5892 eAndrew 304
  @@:
305
 
306
;; TEST TITLE
307
    mov     eax, [ctrl.addr]
308
    add     eax, NTCTRL_APPLY_TITLE
309
    cmpne   byte [eax], 1, @f
5900 eAndrew 310
    mov     byte [eax], 0
311
 
5892 eAndrew 312
    mov     eax, [ctrl.addr]
313
    add     eax, NTCTRL_TITLE
314
    mov     dl, [eax]
315
    mov     [params.title], dl
5900 eAndrew 316
 
317
    mov     edi, redraw
5892 eAndrew 318
  @@:
319
 
5900 eAndrew 320
;; TEST PBAR
321
    mov     eax, [ctrl.addr]
322
    add     eax, NTCTRL_APPLY_PBAR
323
    cmpne   byte [eax], 1, @f
324
    mov     byte [eax], 0
325
 
326
    mov     eax, [ctrl.addr]
327
    add     eax, NTCTRL_PBAR_CUR
328
    mov     edx, [eax]
329
    mov     [pbar.cur_val], edx
330
 
331
    mov     eax, [ctrl.addr]
332
    add     eax, NTCTRL_PBAR_MAX
333
    mov     edx, [eax]
334
    mov     [pbar.max_val], edx
335
 
336
    call    calc_fill_width
337
 
338
    mov     edi, redraw
339
  @@:
340
 
5892 eAndrew 341
;; TEST CLOSE
342
    mov     eax, [ctrl.addr]
343
    add     eax, NTCTRL_CLOSE
344
    cmpe    byte [eax], 1, exit
345
 
346
 .no_ctrl:
347
 
4812 eAndrew 348
    mov     eax, [timer.step]
349
    sub     [timer], eax
5892 eAndrew 350
    cmpe    [timer], dword 0, exit
351
    jmp     edi
4812 eAndrew 352
 
353
 ;----------------------------
354
 
355
 exit:
356
    mov     eax, [shm.our]
357
    mov     ecx, [text.lines]
358
    add     ecx, 3
359
  @@:
360
    mov     [eax], byte 0
361
    inc     eax
362
    loop    @b
363
 
364
    mcall   68, 23, sz_shname
365
 
366
    mcall   -1
367
 
368
 ;----------------------------
369
 
5892 eAndrew 370
 button:
371
    mcall   17
372
    cmpe    byte [params.clcl], 0, exit
373
    jmp     update
5476 eAndrew 374
 
375
 ;----------------------------
376
 
4812 eAndrew 377
 redraw:
378
    call    draw_window
379
    call    draw_text
5900 eAndrew 380
    call    draw_pbar
4812 eAndrew 381
 
382
    jmp     update
383
 
384
 ;----------------------------
385
 
386
 draw_window:
5868 eAndrew 387
    call    init_window
4812 eAndrew 388
 
5892 eAndrew 389
    movzx   ebx, bx
390
    movzx   ecx, cx
4812 eAndrew 391
    inc     ebx
392
    inc     ecx
393
    mcall   8, , , 0x61000001
394
 
395
    mov     eax, 13
396
    mov     ebx, [window.width]
397
    mov     edx, 0x222222
5868 eAndrew 398
 
4812 eAndrew 399
    cmpe    [first_draw], byte 1, .draw_full
400
    mov     [first_draw], byte 1
401
    mov     esi, [window.height]
402
    mov     ecx, LINEH
403
  @@:
404
    mcall
405
    add     ecx, LINEH shl 16
406
    sub     esi, LINEH
407
    push    eax ebx
408
    mcall   5, 1
409
    pop     ebx eax
410
    cmpne   esi, 0, @b
5868 eAndrew 411
 
5892 eAndrew 412
 .draw_full:
4812 eAndrew 413
    mcall
414
 
415
    mcall   , , 1, 0x121212
416
 
417
    mov     ecx, [window.height]
418
    dec     ecx
419
    shl     ecx, 16
420
    inc     ecx
421
    mcall
422
 
423
    mcall   , 1, [window.width]
424
 
425
    mov     ebx, [window.width]
426
    dec     ebx
427
    shl     ebx, 16
428
    inc     ebx
429
    mcall
430
 
431
    mcall   1, 1, 1
432
    mov     ebx, [window.width]
433
    sub     ebx, 2
434
    mcall
435
    mov     ecx, [window.height]
436
    sub     ecx, 2
437
    mcall
438
    mov     ebx, 1
439
    mcall
440
 
441
 ;-----
442
 
443
    mov     ecx, [scr.width]
444
    inc     ecx
445
 
446
    mov     eax, 35
447
    mov     ebx, ecx
448
    imul    ebx, [window.y]
449
    add     ebx, [window.x]
450
    dec     ebx
451
    mcall
452
    push    eax
453
 
454
    mov     eax, 35
455
    add     ebx, [window.width]
456
    add     ebx, 2
457
    mcall
458
    push    eax
459
 
460
    mov     eax, 35
461
    mov     edx, ecx
462
    mov     esi, [window.height]
463
    dec     esi
464
    imul    edx, esi
465
    add     ebx, edx
466
    mcall
467
    push    eax
468
 
469
    mov     eax, 35
470
    sub     ebx, [window.width]
471
    sub     ebx, 2
472
    mcall
473
    push    eax
474
 
475
 ;-----
476
 
477
    mov     eax, 1
478
 
479
    pop     edx
480
    mov     ecx, [window.height]
481
    dec     ecx
482
    mcall   , 0
483
 
484
    pop     edx
485
    mov     ebx, [window.width]
486
    dec     ebx
487
    mcall
488
 
489
    pop     edx
490
    mcall   , , 0
491
 
492
    pop     edx
493
    mcall   , 0
494
 
495
 ;-----
496
 
5892 eAndrew 497
    cmpe    byte [params.icon], 0, @f
498
    movzx   ebx, byte [params.icon]
4812 eAndrew 499
    dec     ebx
500
    imul    ebx, 24 * 24 * 3
501
    add     ebx, [img_data.rgb_obj]
502
 
503
    mov     edx, [window.height]
504
    shr     edx, 1
505
    sub     edx, 12
506
    add     edx, LINEH shl 16
507
 
508
    mcall   7, , <24, 24>
509
  @@:
510
 
511
    ret
512
 
513
 ;----------------------------
514
 
515
 draw_text:
516
    mov     esi, [text.lines]
517
 
5900 eAndrew 518
    cmpne   byte [params.pbar], 1, @f
519
    dec     esi
520
  @@:
521
 
4812 eAndrew 522
    mov     eax, 4
523
    mov     ebx, [text.offset]
524
    shl     ebx, 16
525
    add     ebx, LINEH + (LINEH - 6) / 2
526
    mov     edx, text.buffer
527
 
5892 eAndrew 528
 .draw_lines:
4812 eAndrew 529
    mov     ecx, 0x80111111
530
 
531
    add     ebx, 0x00010000
532
    dec     ebx
533
    mcall
534
    add     ebx, 2
535
    mcall
536
    sub     ebx, 0x00020000
537
    mcall
538
    sub     ebx, 2
539
    mcall
540
 
541
    add     ebx, 0x00010001
542
    mov     ecx, 0x80D0D0D0
543
    mcall
544
 
545
    add     ebx, LINEH
546
    dec     esi
547
    cmpe    esi, 0, .draw_lines.end
548
 
549
    inc     edx
550
  @@:
551
    cmpe    [edx], byte 0, @f
552
    inc     edx
553
    jmp     @b
554
  @@:
555
    inc     edx
556
    jmp     .draw_lines
557
 
5892 eAndrew 558
 .draw_lines.end:
4812 eAndrew 559
 
5892 eAndrew 560
    cmpne   byte [params.title], 1, @f
4812 eAndrew 561
    mov     edx, text.buffer
562
    mov     ecx, 0x80111111
563
    and     ebx, 0xFFFF0000
564
    add     ebx, 1 shl 16 + LINEH + (LINEH - 6) / 2
565
    mcall
566
 
567
    mov     ecx, 0x80FFFFFF
568
    sub     ebx, 0x00010000
569
    mcall
570
  @@:
571
 
572
    ret
5868 eAndrew 573
 
4812 eAndrew 574
 ;----------------------------
575
 
5900 eAndrew 576
 draw_pbar:
577
    cmpne   byte [params.pbar], 1, .exit
578
    mov     esi, 0xFF0000
579
    mov     ecx, LINEH
580
    imul    ecx, [text.lines]
581
    shl     ecx, 16
582
    add     ecx, (LINEH / 2) shl 16 + 8
583
    mcall   13, <[text.offset], [pbar.width]>, , 0x555555
584
 
585
    sub     ecx, -(1 shl 16) + 2
586
 
587
    mov     bx, word [pbar.f_width]
588
    add     ebx, 1 shl 16
589
 
590
    mcall     , , , 0x999999
591
    mov     cx, 1
592
    mcall     , , , 0xAAAAAA
593
    mov     cx, 6
594
    mov     bx, 1
595
    mcall
596
 .exit:
597
    ret
598
 
599
 ;----------------------------
600
 
5868 eAndrew 601
 init_window:
602
    dec     dword [window.width]
603
    dec     dword [window.height]
604
    mcall   0, <[window.x], [window.width]>, <[window.y], [window.height]>, 0x61000000
605
    inc     dword [window.width]
606
    inc     dword [window.height]
607
 
608
    ret
609
 
610
 ;----------------------------
611
 
5889 eAndrew 612
 parse_text:
5900 eAndrew 613
    mov     dword [text.lines], 1
614
    cmpne   byte [params.pbar], 1, @f
615
    inc     dword [text.lines]
616
  @@:
617
 
5889 eAndrew 618
    mov     dword [text.max_len], 0
619
    mov     ebx, text.buffer
620
    mov     ecx, 0
621
    mov     dl, 0
622
    mov     dh, 0
623
 
5892 eAndrew 624
    cmpe    esi, 1, .parse_loop
5889 eAndrew 625
    cmpne   byte [eax], "'", @f
626
    mov     dl, "'"
627
    mov     dh, 1
628
  @@:
629
    cmpne   byte [eax], '"', @f
630
    mov     dl, '"'
631
    mov     dh, 1
632
  @@:
633
    cmpne   dh, 1, @f
634
    inc     eax
635
  @@:
636
 
5892 eAndrew 637
 .parse_loop:
5889 eAndrew 638
    cmpe    byte [eax],  0, .parse_loop.end
639
    cmpe    byte [eax], dl, .parse_loop.end
640
 
641
    cmpe    byte [eax], 10, .newline
5892 eAndrew 642
    cmpe    esi, 1, .next_set_char
643
    cmpne   byte [eax], "\", @f
644
    cmpe    byte [eax + 1], dl, .quote
645
    cmpe    byte [eax + 1], "n", .newline_esc
646
    jmp     @f
5889 eAndrew 647
 
5892 eAndrew 648
 .quote:
5889 eAndrew 649
    inc     eax
5892 eAndrew 650
    jmp     .next_set_char
5889 eAndrew 651
 
5892 eAndrew 652
 .newline_esc:
653
    inc     eax
654
 
655
 .newline:
5889 eAndrew 656
    mov     byte [ebx], 0
657
    cmple   ecx, dword [text.max_len], .skip_max_len
658
    mov     dword [text.max_len], ecx
5892 eAndrew 659
 .skip_max_len:
5889 eAndrew 660
    mov     ecx, 0
661
    inc     dword [text.lines]
662
    jmp     .next
663
  @@:
664
 
5892 eAndrew 665
 .next_set_char:
666
    mov     dh, [eax]
5889 eAndrew 667
    mov     [ebx], dh
668
 
5892 eAndrew 669
 .next:
5889 eAndrew 670
    inc     eax
671
    inc     ebx
672
    inc     ecx
673
    jmp     .parse_loop
5892 eAndrew 674
 .parse_loop.end:
5889 eAndrew 675
 
676
    cmple   ecx, dword [text.max_len], @f
677
    mov     dword [text.max_len], ecx
678
  @@:
679
 
680
    cmpge   [text.max_len], dword 25, @f
681
    mov     [text.max_len], dword 25
682
  @@:
683
 
684
    mov     [ebx], byte 0
685
 
686
    ret
687
 
688
 ;----------------------------
689
 
5892 eAndrew 690
 parse_flags:
691
    mov     byte [params.atcl], 0
692
    mov     byte [params.title], 0
693
    mov     byte [params.icon], 0
694
 
695
 .loop:
696
    mov     dl, [eax]
697
 
698
    cmpe    dl, 0, .exit
699
    cmpe    dl, "d", .set_atcl
700
    cmpe    dl, "c", .set_clcl
701
    cmpe    dl, "t", .set_title
5900 eAndrew 702
    cmpe    dl, "p", .set_pbar
5892 eAndrew 703
 
704
    mov     bl, 1
705
    mov     ecx, sz_icons
706
  @@:
707
    cmpe    dl, [ecx], .set_icon
708
    inc     bl
709
    inc     ecx
710
    cmpne   [ecx], byte 0, @b
711
    jmp     .next_char
712
 
713
 .set_atcl:
714
    mov     byte [params.atcl], 1
715
    jmp     .next_char
716
 
717
 .set_clcl:
718
    mov     byte [params.clcl], 1
719
    jmp     .next_char
720
 
721
 .set_title:
722
    mov     byte [params.title], 1
723
    jmp     .next_char
724
 
5900 eAndrew 725
 .set_pbar:
726
    mov     byte [params.pbar], 1
727
    inc     dword [text.lines]
728
    jmp     .next_char
729
 
5892 eAndrew 730
 .set_icon:
731
    mov     [params.icon], bl
732
 
733
 .next_char:
734
    inc     eax
735
    jmp     .loop
736
 
737
 .exit:
738
    ret
739
 
740
 ;----------------------------
741
 
5900 eAndrew 742
 calc_fill_width:
743
    mov     eax, [pbar.cur_val]
744
    cmpng   eax, [pbar.max_val], @f
745
    mov     eax, [pbar.max_val]
746
  @@:
747
    cmpnl   eax, 0, @f
748
    mov     eax, 0
749
  @@:
750
 
751
    mov     ebx, [pbar.width]
752
    sub     ebx, 2
753
    imul    eax, ebx
754
    mov     edx, 0
755
    mov     ebx, [pbar.max_val]
756
    div     ebx
757
    mov     [pbar.f_width], eax
758
    ret
759
 
760
 ;----------------------------
761
 
4812 eAndrew 762
 @imports:
763
    library img, "libimg.obj"
5892 eAndrew 764
    import  img, img.to_rgb,  "img_to_rgb2", \
765
		 img.decode,  "img_decode",  \
4812 eAndrew 766
		 img.destroy, "img_destroy"
767
 
768
 ;----------------------------
769
 
5868 eAndrew 770
 sz_icons   db "AEWONIFCMDS", 0
4812 eAndrew 771
 sz_ifile   db "/sys/notify3.png", 0
772
 sz_shname  db "notify-mem-v01", 0
5892 eAndrew 773
 sz_std     db "'NOTIFY 3\n",                 \
774
	       "d - disable auto-closing\n",  \
775
	       "c - disable click-closing\n", \
5900 eAndrew 776
	       "p - use progressbar\n",       \
5892 eAndrew 777
	       "t - title\n",		      \
778
	       " \n",			      \
779
	       "ICONS:\n",		      \
780
	       "A - application\n",	      \
781
	       "E - error\n",		      \
782
	       "W - warning\n", 	      \
783
	       "O - ok\n",		      \
784
	       "N - network\n", 	      \
785
	       "I - info\n",		      \
786
	       "F - folder\n",		      \
787
	       "C - component\n",	      \
788
	       "M - mail\n",		      \
789
	       "D - download\n",	      \
790
	       "S - audio player",	      \
5889 eAndrew 791
	       "' -td", 0
4812 eAndrew 792
 
5892 eAndrew 793
 fi:
794
	    dd 5
795
	    dd 0, 0, 0
796
	    dd buffer
797
	    db 0
798
	    dd sz_ifile
799
 
4812 eAndrew 800
 ;----------------------------
801
 
802
 @end:
803
 
804
;=====================================================================
805
 
806
 window:
5892 eAndrew 807
 .x	   rd 1
808
 .y	   rd 1
809
 .width    rd 1
810
 .height   rd 1
4812 eAndrew 811
 
812
 scr:
5892 eAndrew 813
 .width    rd 1
814
 .height   rd 1
4812 eAndrew 815
 
816
 text:
5892 eAndrew 817
 .buffer   rb 2048
818
 .lines    rd 1
819
 .max_len  rd 1
820
 .offset   rd 1
4812 eAndrew 821
 
822
 params:
5892 eAndrew 823
 .source   rd 1
824
 .atcl	   rb 1
825
 .clcl	   rb 1
826
 .title    rb 1
5900 eAndrew 827
 .pbar	   rb 1
5892 eAndrew 828
 .icon	   rb 1
829
 .ctrl	   rb 1
4812 eAndrew 830
 
831
 img_data:
5892 eAndrew 832
 .rgb_obj  rd 1
833
 .obj	   rd 1
4812 eAndrew 834
 
835
 timer:
5892 eAndrew 836
 .value    rd 1
837
 .step	   rd 1
4812 eAndrew 838
 
839
 shm:
5892 eAndrew 840
 .addr	   rd 1
841
 .our	   rd 1
4812 eAndrew 842
 
5892 eAndrew 843
 ctrl:
844
 .name	   rb 31
845
 .addr	   rd 1
846
 
5900 eAndrew 847
 pbar:
848
 .width    rd 1
849
 .cur_val  rd 1
850
 .max_val  rd 1
851
 .f_width  rd 1
852
 
4812 eAndrew 853
 buffer     rb 1024
854
 first_draw rb 1
5868 eAndrew 855
 prev_pid   rd 1
4812 eAndrew 856
 
857
;=====================================================================
858
	    rb 2048
859
 @stack:
5891 eAndrew 860
 @params    rb 2048
4812 eAndrew 861
 
862
 @memory: