forked from KolibriOS/kolibrios
add processbar; fix redraws and a lot of other bugs
git-svn-id: svn://kolibrios.org@5900 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
162ef550a0
commit
fb3a8b054d
@ -1,11 +1,14 @@
|
|||||||
NTCTRL_READY = 0
|
NTCTRL_READY = 0 ; BYTE
|
||||||
NTCTRL_APPLY_TEXT = 1
|
NTCTRL_APPLY_TEXT = 1 ; BYTE
|
||||||
NTCTRL_APPLY_ICON = 2
|
NTCTRL_APPLY_ICON = 2 ; BYTE
|
||||||
NTCTRL_APPLY_TITLE = 3
|
NTCTRL_APPLY_TITLE = 3 ; BYTE
|
||||||
|
NTCTRL_APPLY_PBAR = 4 ; BYTE
|
||||||
|
|
||||||
NTCTRL_CLOSE = 32
|
NTCTRL_CLOSE = 32 ; BYTE
|
||||||
|
|
||||||
NTCTRL_ICON = 64
|
NTCTRL_ICON = 64 ; BYTE
|
||||||
NTCTRL_TITLE = 65
|
NTCTRL_TITLE = 65 ; BYTE
|
||||||
|
NTCTRL_PBAR_CUR = 66 ; DWORD
|
||||||
|
NTCTRL_PBAR_MAX = 70 ; DWORD
|
||||||
|
|
||||||
NTCTRL_TEXT = 128
|
NTCTRL_TEXT = 128 ; BUFFER
|
@ -108,7 +108,6 @@
|
|||||||
|
|
||||||
;; CALC WIDTH
|
;; CALC WIDTH
|
||||||
mov eax, [text.max_len]
|
mov eax, [text.max_len]
|
||||||
dec eax
|
|
||||||
imul eax, 6
|
imul eax, 6
|
||||||
add eax, MARGIN
|
add eax, MARGIN
|
||||||
add eax, [text.offset]
|
add eax, [text.offset]
|
||||||
@ -124,6 +123,12 @@
|
|||||||
sub eax, LINEH
|
sub eax, LINEH
|
||||||
mov [window.x], eax
|
mov [window.x], eax
|
||||||
|
|
||||||
|
;; CALC PBAR
|
||||||
|
mov eax, [window.width]
|
||||||
|
sub eax, [text.offset]
|
||||||
|
sub eax, MARGIN
|
||||||
|
mov [pbar.width], eax
|
||||||
|
|
||||||
;; CALC Y
|
;; CALC Y
|
||||||
mcall 68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
|
mcall 68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
|
||||||
add eax, 512
|
add eax, 512
|
||||||
@ -232,12 +237,17 @@
|
|||||||
;; COPY TEXT TO CTRL
|
;; COPY TEXT TO CTRL
|
||||||
add eax, NTCTRL_TEXT
|
add eax, NTCTRL_TEXT
|
||||||
mov ebx, text.buffer
|
mov ebx, text.buffer
|
||||||
|
|
||||||
mov ecx, [text.lines]
|
mov ecx, [text.lines]
|
||||||
|
cmpne byte [params.pbar], 1, @f
|
||||||
|
dec ecx
|
||||||
|
@@:
|
||||||
|
|
||||||
.copy_start:
|
.copy_start:
|
||||||
cmpe ecx, 0, .copy_end
|
cmpe ecx, 0, .copy_end
|
||||||
mov dl, [ebx]
|
mov dl, [ebx]
|
||||||
cmpne dl, 0, @f
|
cmpne dl, 0, @f
|
||||||
mov dl, "|"
|
mov dl, 10
|
||||||
dec ecx
|
dec ecx
|
||||||
@@:
|
@@:
|
||||||
mov [eax], dl
|
mov [eax], dl
|
||||||
@ -271,10 +281,12 @@
|
|||||||
add eax, NTCTRL_APPLY_TEXT
|
add eax, NTCTRL_APPLY_TEXT
|
||||||
cmpne byte [eax], 1, @f
|
cmpne byte [eax], 1, @f
|
||||||
mov byte [eax], 0
|
mov byte [eax], 0
|
||||||
|
|
||||||
mov eax, [ctrl.addr]
|
mov eax, [ctrl.addr]
|
||||||
add eax, NTCTRL_TEXT
|
add eax, NTCTRL_TEXT
|
||||||
mov esi, 1
|
mov esi, 1
|
||||||
call parse_text
|
call parse_text
|
||||||
|
|
||||||
mov edi, redraw
|
mov edi, redraw
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
@ -282,20 +294,49 @@
|
|||||||
mov eax, [ctrl.addr]
|
mov eax, [ctrl.addr]
|
||||||
add eax, NTCTRL_APPLY_ICON
|
add eax, NTCTRL_APPLY_ICON
|
||||||
cmpne byte [eax], 1, @f
|
cmpne byte [eax], 1, @f
|
||||||
|
mov byte [eax], 0
|
||||||
|
|
||||||
mov eax, [ctrl.addr]
|
mov eax, [ctrl.addr]
|
||||||
add eax, NTCTRL_ICON
|
add eax, NTCTRL_ICON
|
||||||
mov dl, [eax]
|
mov dl, [eax]
|
||||||
mov [params.icon], dl
|
mov [params.icon], dl
|
||||||
|
|
||||||
|
mov edi, redraw
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
;; TEST TITLE
|
;; TEST TITLE
|
||||||
mov eax, [ctrl.addr]
|
mov eax, [ctrl.addr]
|
||||||
add eax, NTCTRL_APPLY_TITLE
|
add eax, NTCTRL_APPLY_TITLE
|
||||||
cmpne byte [eax], 1, @f
|
cmpne byte [eax], 1, @f
|
||||||
|
mov byte [eax], 0
|
||||||
|
|
||||||
mov eax, [ctrl.addr]
|
mov eax, [ctrl.addr]
|
||||||
add eax, NTCTRL_TITLE
|
add eax, NTCTRL_TITLE
|
||||||
mov dl, [eax]
|
mov dl, [eax]
|
||||||
mov [params.title], dl
|
mov [params.title], dl
|
||||||
|
|
||||||
|
mov edi, redraw
|
||||||
|
@@:
|
||||||
|
|
||||||
|
;; TEST PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_PBAR
|
||||||
|
cmpne byte [eax], 1, @f
|
||||||
|
mov byte [eax], 0
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_CUR
|
||||||
|
mov edx, [eax]
|
||||||
|
mov [pbar.cur_val], edx
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_MAX
|
||||||
|
mov edx, [eax]
|
||||||
|
mov [pbar.max_val], edx
|
||||||
|
|
||||||
|
call calc_fill_width
|
||||||
|
|
||||||
|
mov edi, redraw
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
;; TEST CLOSE
|
;; TEST CLOSE
|
||||||
@ -337,6 +378,7 @@
|
|||||||
redraw:
|
redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
call draw_text
|
call draw_text
|
||||||
|
call draw_pbar
|
||||||
|
|
||||||
jmp update
|
jmp update
|
||||||
|
|
||||||
@ -474,6 +516,10 @@
|
|||||||
draw_text:
|
draw_text:
|
||||||
mov esi, [text.lines]
|
mov esi, [text.lines]
|
||||||
|
|
||||||
|
cmpne byte [params.pbar], 1, @f
|
||||||
|
dec esi
|
||||||
|
@@:
|
||||||
|
|
||||||
mov eax, 4
|
mov eax, 4
|
||||||
mov ebx, [text.offset]
|
mov ebx, [text.offset]
|
||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
@ -528,6 +574,31 @@
|
|||||||
|
|
||||||
;----------------------------
|
;----------------------------
|
||||||
|
|
||||||
|
draw_pbar:
|
||||||
|
cmpne byte [params.pbar], 1, .exit
|
||||||
|
mov esi, 0xFF0000
|
||||||
|
mov ecx, LINEH
|
||||||
|
imul ecx, [text.lines]
|
||||||
|
shl ecx, 16
|
||||||
|
add ecx, (LINEH / 2) shl 16 + 8
|
||||||
|
mcall 13, <[text.offset], [pbar.width]>, , 0x555555
|
||||||
|
|
||||||
|
sub ecx, -(1 shl 16) + 2
|
||||||
|
|
||||||
|
mov bx, word [pbar.f_width]
|
||||||
|
add ebx, 1 shl 16
|
||||||
|
|
||||||
|
mcall , , , 0x999999
|
||||||
|
mov cx, 1
|
||||||
|
mcall , , , 0xAAAAAA
|
||||||
|
mov cx, 6
|
||||||
|
mov bx, 1
|
||||||
|
mcall
|
||||||
|
.exit:
|
||||||
|
ret
|
||||||
|
|
||||||
|
;----------------------------
|
||||||
|
|
||||||
init_window:
|
init_window:
|
||||||
dec dword [window.width]
|
dec dword [window.width]
|
||||||
dec dword [window.height]
|
dec dword [window.height]
|
||||||
@ -540,8 +611,12 @@
|
|||||||
;----------------------------
|
;----------------------------
|
||||||
|
|
||||||
parse_text:
|
parse_text:
|
||||||
mov dword [text.max_len], 0
|
|
||||||
mov dword [text.lines], 1
|
mov dword [text.lines], 1
|
||||||
|
cmpne byte [params.pbar], 1, @f
|
||||||
|
inc dword [text.lines]
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mov dword [text.max_len], 0
|
||||||
mov ebx, text.buffer
|
mov ebx, text.buffer
|
||||||
mov ecx, 0
|
mov ecx, 0
|
||||||
mov dl, 0
|
mov dl, 0
|
||||||
@ -625,6 +700,7 @@
|
|||||||
cmpe dl, "d", .set_atcl
|
cmpe dl, "d", .set_atcl
|
||||||
cmpe dl, "c", .set_clcl
|
cmpe dl, "c", .set_clcl
|
||||||
cmpe dl, "t", .set_title
|
cmpe dl, "t", .set_title
|
||||||
|
cmpe dl, "p", .set_pbar
|
||||||
|
|
||||||
mov bl, 1
|
mov bl, 1
|
||||||
mov ecx, sz_icons
|
mov ecx, sz_icons
|
||||||
@ -647,6 +723,11 @@
|
|||||||
mov byte [params.title], 1
|
mov byte [params.title], 1
|
||||||
jmp .next_char
|
jmp .next_char
|
||||||
|
|
||||||
|
.set_pbar:
|
||||||
|
mov byte [params.pbar], 1
|
||||||
|
inc dword [text.lines]
|
||||||
|
jmp .next_char
|
||||||
|
|
||||||
.set_icon:
|
.set_icon:
|
||||||
mov [params.icon], bl
|
mov [params.icon], bl
|
||||||
|
|
||||||
@ -659,6 +740,26 @@
|
|||||||
|
|
||||||
;----------------------------
|
;----------------------------
|
||||||
|
|
||||||
|
calc_fill_width:
|
||||||
|
mov eax, [pbar.cur_val]
|
||||||
|
cmpng eax, [pbar.max_val], @f
|
||||||
|
mov eax, [pbar.max_val]
|
||||||
|
@@:
|
||||||
|
cmpnl eax, 0, @f
|
||||||
|
mov eax, 0
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mov ebx, [pbar.width]
|
||||||
|
sub ebx, 2
|
||||||
|
imul eax, ebx
|
||||||
|
mov edx, 0
|
||||||
|
mov ebx, [pbar.max_val]
|
||||||
|
div ebx
|
||||||
|
mov [pbar.f_width], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
;----------------------------
|
||||||
|
|
||||||
@imports:
|
@imports:
|
||||||
library img, "libimg.obj"
|
library img, "libimg.obj"
|
||||||
import img, img.to_rgb, "img_to_rgb2", \
|
import img, img.to_rgb, "img_to_rgb2", \
|
||||||
@ -673,6 +774,7 @@
|
|||||||
sz_std db "'NOTIFY 3\n", \
|
sz_std db "'NOTIFY 3\n", \
|
||||||
"d - disable auto-closing\n", \
|
"d - disable auto-closing\n", \
|
||||||
"c - disable click-closing\n", \
|
"c - disable click-closing\n", \
|
||||||
|
"p - use progressbar\n", \
|
||||||
"t - title\n", \
|
"t - title\n", \
|
||||||
" \n", \
|
" \n", \
|
||||||
"ICONS:\n", \
|
"ICONS:\n", \
|
||||||
@ -723,6 +825,7 @@
|
|||||||
.atcl rb 1
|
.atcl rb 1
|
||||||
.clcl rb 1
|
.clcl rb 1
|
||||||
.title rb 1
|
.title rb 1
|
||||||
|
.pbar rb 1
|
||||||
.icon rb 1
|
.icon rb 1
|
||||||
.ctrl rb 1
|
.ctrl rb 1
|
||||||
|
|
||||||
@ -742,6 +845,12 @@
|
|||||||
.name rb 31
|
.name rb 31
|
||||||
.addr rd 1
|
.addr rd 1
|
||||||
|
|
||||||
|
pbar:
|
||||||
|
.width rd 1
|
||||||
|
.cur_val rd 1
|
||||||
|
.max_val rd 1
|
||||||
|
.f_width rd 1
|
||||||
|
|
||||||
buffer rb 1024
|
buffer rb 1024
|
||||||
first_draw rb 1
|
first_draw rb 1
|
||||||
prev_pid rd 1
|
prev_pid rd 1
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
d - disable auto-closing
|
d - disable auto-closing
|
||||||
c - disable closing by click
|
c - disable closing by click
|
||||||
t - title
|
t - title
|
||||||
|
p - progressbar
|
||||||
|
|
||||||
2.3.1 ICONS:
|
2.3.1 ICONS:
|
||||||
A - application
|
A - application
|
||||||
|
@ -49,6 +49,19 @@
|
|||||||
mcall 5, 1
|
mcall 5, 1
|
||||||
cmpe byte [eax], 0, @b
|
cmpe byte [eax], 0, @b
|
||||||
|
|
||||||
|
;; CONFIG PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_MAX
|
||||||
|
mov dword [eax], 9
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_CUR
|
||||||
|
mov dword [eax], 9
|
||||||
|
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_PBAR
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
;; LOOP OF NOTIFIES CHANGES
|
;; LOOP OF NOTIFIES CHANGES
|
||||||
@@:
|
@@:
|
||||||
;; SHIFT TEXT
|
;; SHIFT TEXT
|
||||||
@ -68,10 +81,10 @@
|
|||||||
mov byte [eax], 1
|
mov byte [eax], 1
|
||||||
|
|
||||||
;; CLOSE NOTIFY IF TIME IS END
|
;; CLOSE NOTIFY IF TIME IS END
|
||||||
cmpe byte [sz_time], "0" - 1, .exit
|
cmpe byte [sz_time], "0", .exit
|
||||||
|
|
||||||
;; WAIT AND DO NEXT ITERATION
|
;; WAIT AND DO NEXT ITERATION
|
||||||
mcall 5, 10
|
mcall 5, 20
|
||||||
jmp @b
|
jmp @b
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
@ -95,8 +108,8 @@
|
|||||||
mov [eax], dh
|
mov [eax], dh
|
||||||
|
|
||||||
inc byte [timer]
|
inc byte [timer]
|
||||||
cmpne byte [timer], 10, .skip_changes
|
cmpne byte [timer], 5, .skip_changes
|
||||||
sub byte [timer], 10
|
sub byte [timer], 5
|
||||||
|
|
||||||
;; CHANGE TIMER TEXT
|
;; CHANGE TIMER TEXT
|
||||||
dec byte [sz_time]
|
dec byte [sz_time]
|
||||||
@ -126,6 +139,16 @@
|
|||||||
add eax, NTCTRL_APPLY_TITLE
|
add eax, NTCTRL_APPLY_TITLE
|
||||||
mov byte [eax], 1
|
mov byte [eax], 1
|
||||||
|
|
||||||
|
;; CHANGE PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_PBAR_CUR
|
||||||
|
dec dword [eax]
|
||||||
|
|
||||||
|
;; APPLY PBAR
|
||||||
|
mov eax, [ctrl.addr]
|
||||||
|
add eax, NTCTRL_APPLY_PBAR
|
||||||
|
mov byte [eax], 1
|
||||||
|
|
||||||
.skip_changes:
|
.skip_changes:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -148,7 +171,7 @@
|
|||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
|
||||||
sz_time:
|
sz_time:
|
||||||
db "5", 0
|
db "9", 0
|
||||||
sz_text:
|
sz_text:
|
||||||
db "Hello, World!!! It is a marquee! ", 0
|
db "Hello, World!!! It is a marquee! ", 0
|
||||||
sz_quote:
|
sz_quote:
|
||||||
@ -158,10 +181,11 @@
|
|||||||
sz_sec_line_end:
|
sz_sec_line_end:
|
||||||
db " seconds", 0
|
db " seconds", 0
|
||||||
sz_flags:
|
sz_flags:
|
||||||
db "Idc", 0
|
db "Idcp", 0
|
||||||
|
|
||||||
fi_launch:
|
fi_launch:
|
||||||
dd 7, 0, params, 0, 0
|
dd 7, 0, params, 0, 0
|
||||||
|
;db "/usbhd0/2/svn/programs/system/notify3/notify", 0
|
||||||
db "@notify", 0
|
db "@notify", 0
|
||||||
|
|
||||||
@end:
|
@end:
|
||||||
|
Loading…
Reference in New Issue
Block a user