Subversion Repositories Kolibri OS

Rev

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