Subversion Repositories Kolibri OS

Rev

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