Subversion Repositories Kolibri OS

Rev

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

Rev 5892 Rev 5900
Line 106... Line 106...
106
    add     dword [text.offset], MARGIN + 24
106
    add     dword [text.offset], MARGIN + 24
107
  @@:
107
  @@:
Line 108... Line 108...
108
 
108
 
109
;; CALC WIDTH
109
;; CALC WIDTH
110
    mov     eax, [text.max_len]
-
 
111
    dec     eax
110
    mov     eax, [text.max_len]
112
    imul    eax, 6
111
    imul    eax, 6
113
    add     eax, MARGIN
112
    add     eax, MARGIN
114
    add     eax, [text.offset]
113
    add     eax, [text.offset]
Line 122... Line 121...
122
    mov     [scr.width], eax
121
    mov     [scr.width], eax
123
    sub     eax, [window.width]
122
    sub     eax, [window.width]
124
    sub     eax, LINEH
123
    sub     eax, LINEH
125
    mov     [window.x], eax
124
    mov     [window.x], eax
Line -... Line 125...
-
 
125
 
-
 
126
;; CALC PBAR
-
 
127
    mov     eax, [window.width]
-
 
128
    sub     eax, [text.offset]
-
 
129
    sub     eax, MARGIN
-
 
130
    mov     [pbar.width], eax
126
 
131
 
127
;; CALC Y
132
;; CALC Y
128
    mcall   68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
133
    mcall   68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
129
    add     eax, 512
134
    add     eax, 512
Line 230... Line 235...
230
    mov     [ctrl.addr], eax
235
    mov     [ctrl.addr], eax
Line 231... Line 236...
231
 
236
 
232
;; COPY TEXT TO CTRL
237
;; COPY TEXT TO CTRL
233
    add     eax, NTCTRL_TEXT
238
    add     eax, NTCTRL_TEXT
-
 
239
    mov     ebx, text.buffer
234
    mov     ebx, text.buffer
240
 
-
 
241
    mov     ecx, [text.lines]
-
 
242
    cmpne   byte [params.pbar], 1, @f
-
 
243
    dec     ecx
-
 
244
  @@:
235
    mov     ecx, [text.lines]
245
 
236
 .copy_start:
246
 .copy_start:
237
    cmpe     ecx, 0, .copy_end
247
    cmpe     ecx, 0, .copy_end
238
    mov      dl, [ebx]
248
    mov      dl, [ebx]
239
    cmpne    dl, 0, @f
249
    cmpne    dl, 0, @f
240
    mov      dl, "|"
250
    mov      dl, 10
241
    dec      ecx
251
    dec      ecx
242
  @@:
252
  @@:
243
    mov      [eax], dl
253
    mov      [eax], dl
244
    inc      eax
254
    inc      eax
Line 269... Line 279...
269
;; TEST TEXT
279
;; TEST TEXT
270
    mov     eax, [ctrl.addr]
280
    mov     eax, [ctrl.addr]
271
    add     eax, NTCTRL_APPLY_TEXT
281
    add     eax, NTCTRL_APPLY_TEXT
272
    cmpne   byte [eax], 1, @f
282
    cmpne   byte [eax], 1, @f
273
    mov     byte [eax], 0
283
    mov     byte [eax], 0
-
 
284
 
274
    mov     eax, [ctrl.addr]
285
    mov     eax, [ctrl.addr]
275
    add     eax, NTCTRL_TEXT
286
    add     eax, NTCTRL_TEXT
276
    mov     esi, 1
287
    mov     esi, 1
277
    call    parse_text
288
    call    parse_text
-
 
289
 
278
    mov     edi, redraw
290
    mov     edi, redraw
279
  @@:
291
  @@:
Line 280... Line 292...
280
 
292
 
281
;; TEST ICON
293
;; TEST ICON
282
    mov     eax, [ctrl.addr]
294
    mov     eax, [ctrl.addr]
283
    add     eax, NTCTRL_APPLY_ICON
295
    add     eax, NTCTRL_APPLY_ICON
-
 
296
    cmpne   byte [eax], 1, @f
-
 
297
    mov     byte [eax], 0
284
    cmpne   byte [eax], 1, @f
298
 
285
    mov     eax, [ctrl.addr]
299
    mov     eax, [ctrl.addr]
286
    add     eax, NTCTRL_ICON
300
    add     eax, NTCTRL_ICON
287
    mov     dl, [eax]
301
    mov     dl, [eax]
-
 
302
    mov     [params.icon], dl
-
 
303
 
288
    mov     [params.icon], dl
304
    mov     edi, redraw
Line 289... Line 305...
289
  @@:
305
  @@:
290
 
306
 
291
;; TEST TITLE
307
;; TEST TITLE
292
    mov     eax, [ctrl.addr]
308
    mov     eax, [ctrl.addr]
-
 
309
    add     eax, NTCTRL_APPLY_TITLE
-
 
310
    cmpne   byte [eax], 1, @f
293
    add     eax, NTCTRL_APPLY_TITLE
311
    mov     byte [eax], 0
294
    cmpne   byte [eax], 1, @f
312
 
295
    mov     eax, [ctrl.addr]
313
    mov     eax, [ctrl.addr]
296
    add     eax, NTCTRL_TITLE
314
    add     eax, NTCTRL_TITLE
-
 
315
    mov     dl, [eax]
-
 
316
    mov     [params.title], dl
-
 
317
 
-
 
318
    mov     edi, redraw
-
 
319
  @@:
-
 
320
 
-
 
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
297
    mov     dl, [eax]
338
 
Line 298... Line 339...
298
    mov     [params.title], dl
339
    mov     edi, redraw
299
  @@:
340
  @@:
300
 
341
 
Line 335... Line 376...
335
 ;----------------------------
376
 ;----------------------------
Line 336... Line 377...
336
 
377
 
337
 redraw:
378
 redraw:
338
    call    draw_window
379
    call    draw_window
-
 
380
    call    draw_text
Line 339... Line 381...
339
    call    draw_text
381
    call    draw_pbar
Line 340... Line 382...
340
 
382
 
Line 472... Line 514...
472
 ;----------------------------
514
 ;----------------------------
Line 473... Line 515...
473
 
515
 
474
 draw_text:
516
 draw_text:
Line -... Line 517...
-
 
517
    mov     esi, [text.lines]
-
 
518
 
-
 
519
    cmpne   byte [params.pbar], 1, @f
-
 
520
    dec     esi
475
    mov     esi, [text.lines]
521
  @@:
476
 
522
 
477
    mov     eax, 4
523
    mov     eax, 4
478
    mov     ebx, [text.offset]
524
    mov     ebx, [text.offset]
479
    shl     ebx, 16
525
    shl     ebx, 16
Line 526... Line 572...
526
 
572
 
Line 527... Line 573...
527
    ret
573
    ret
Line -... Line 574...
-
 
574
 
-
 
575
 ;----------------------------
-
 
576
 
-
 
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
528
 
599
 
529
 ;----------------------------
600
 ;----------------------------
530
 
601
 
531
 init_window:
602
 init_window:
532
    dec     dword [window.width]
603
    dec     dword [window.width]
Line 538... Line 609...
538
    ret
609
    ret
Line 539... Line 610...
539
 
610
 
Line 540... Line 611...
540
 ;----------------------------
611
 ;----------------------------
541
 
-
 
542
 parse_text:
612
 
-
 
613
 parse_text:
-
 
614
    mov     dword [text.lines], 1
-
 
615
    cmpne   byte [params.pbar], 1, @f
-
 
616
    inc     dword [text.lines]
-
 
617
  @@:
543
    mov     dword [text.max_len], 0
618
 
544
    mov     dword [text.lines], 1
619
    mov     dword [text.max_len], 0
545
    mov     ebx, text.buffer
620
    mov     ebx, text.buffer
546
    mov     ecx, 0
621
    mov     ecx, 0
Line 623... Line 698...
623
 
698
 
624
    cmpe    dl, 0, .exit
699
    cmpe    dl, 0, .exit
625
    cmpe    dl, "d", .set_atcl
700
    cmpe    dl, "d", .set_atcl
626
    cmpe    dl, "c", .set_clcl
701
    cmpe    dl, "c", .set_clcl
-
 
702
    cmpe    dl, "t", .set_title
Line 627... Line 703...
627
    cmpe    dl, "t", .set_title
703
    cmpe    dl, "p", .set_pbar
628
 
704
 
629
    mov     bl, 1
705
    mov     bl, 1
630
    mov     ecx, sz_icons
706
    mov     ecx, sz_icons
Line 645... Line 721...
645
 
721
 
646
 .set_title:
722
 .set_title:
647
    mov     byte [params.title], 1
723
    mov     byte [params.title], 1
Line -... Line 724...
-
 
724
    jmp     .next_char
-
 
725
 
-
 
726
 .set_pbar:
-
 
727
    mov     byte [params.pbar], 1
-
 
728
    inc     dword [text.lines]
648
    jmp     .next_char
729
    jmp     .next_char
649
 
730
 
Line 650... Line 731...
650
 .set_icon:
731
 .set_icon:
651
    mov     [params.icon], bl
732
    mov     [params.icon], bl
Line 657... Line 738...
657
 .exit:
738
 .exit:
658
    ret
739
    ret
Line 659... Line 740...
659
 
740
 
Line -... Line 741...
-
 
741
 ;----------------------------
-
 
742
 
-
 
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
 
660
 ;----------------------------
761
 ;----------------------------
661
 
762
 
662
 @imports:
763
 @imports:
663
    library img, "libimg.obj"
764
    library img, "libimg.obj"
664
    import  img, img.to_rgb,  "img_to_rgb2", \
765
    import  img, img.to_rgb,  "img_to_rgb2", \
Line 671... Line 772...
671
 sz_ifile   db "/sys/notify3.png", 0
772
 sz_ifile   db "/sys/notify3.png", 0
672
 sz_shname  db "notify-mem-v01", 0
773
 sz_shname  db "notify-mem-v01", 0
673
 sz_std     db "'NOTIFY 3\n",                 \
774
 sz_std     db "'NOTIFY 3\n",                 \
674
	       "d - disable auto-closing\n",  \
775
	       "d - disable auto-closing\n",  \
675
	       "c - disable click-closing\n", \
776
	       "c - disable click-closing\n", \
-
 
777
	       "p - use progressbar\n",       \
676
	       "t - title\n",		      \
778
	       "t - title\n",		      \
677
	       " \n",			      \
779
	       " \n",			      \
678
	       "ICONS:\n",		      \
780
	       "ICONS:\n",		      \
679
	       "A - application\n",	      \
781
	       "A - application\n",	      \
680
	       "E - error\n",		      \
782
	       "E - error\n",		      \
Line 721... Line 823...
721
 params:
823
 params:
722
 .source   rd 1
824
 .source   rd 1
723
 .atcl	   rb 1
825
 .atcl	   rb 1
724
 .clcl	   rb 1
826
 .clcl	   rb 1
725
 .title    rb 1
827
 .title    rb 1
-
 
828
 .pbar	   rb 1
726
 .icon	   rb 1
829
 .icon	   rb 1
727
 .ctrl	   rb 1
830
 .ctrl	   rb 1
Line 728... Line 831...
728
 
831
 
729
 img_data:
832
 img_data:
Line 740... Line 843...
740
 
843
 
741
 ctrl:
844
 ctrl:
742
 .name	   rb 31
845
 .name	   rb 31
Line -... Line 846...
-
 
846
 .addr	   rd 1
-
 
847
 
-
 
848
 pbar:
-
 
849
 .width    rd 1
-
 
850
 .cur_val  rd 1
-
 
851
 .max_val  rd 1
743
 .addr	   rd 1
852
 .f_width  rd 1
744
 
853
 
745
 buffer     rb 1024
854
 buffer     rb 1024
Line 746... Line 855...
746
 first_draw rb 1
855
 first_draw rb 1