From 466f301832d57ec6aad50fd1cb2e54388b375368 Mon Sep 17 00:00:00 2001 From: eAndrew Date: Sun, 6 Apr 2014 19:31:46 +0000 Subject: [PATCH] Notify 3 to svn git-svn-id: svn://kolibrios.org@4784 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/common/NOTIFY3.png | Bin 0 -> 6240 bytes programs/system/notify3/NOTIFY.ASM | 598 +++++++++++++++++++++++++++++ programs/system/notify3/README.TXT | 24 ++ programs/system/notify3/TEST.SH | 3 + 4 files changed, 625 insertions(+) create mode 100644 data/common/NOTIFY3.png create mode 100644 programs/system/notify3/NOTIFY.ASM create mode 100644 programs/system/notify3/README.TXT create mode 100644 programs/system/notify3/TEST.SH diff --git a/data/common/NOTIFY3.png b/data/common/NOTIFY3.png new file mode 100644 index 0000000000000000000000000000000000000000..72b9d87f8320ff9b7f402bc049454f80cb137c27 GIT binary patch literal 6240 zcmV-m7@y~fP)`E`lHg;pBtVK3A0{PAq9iJoC|IQCY^LTlXN_ubkZi7DsIwoA4;6WspF??IgX{uwk(R2NQxAnAV`7_fFMCU z7W=sO+;e{YQGbKp4?V<=9Xm)Q5_q0RB9WNYeLo%^ zMG?lBS>0NTF@`tZcw;sP>2#VXimH@VD6dcrV66qfIfpTZD2i(K#>U3k02OvC-8qMI z4r^@{&AhB0h*ecs=Ap8 zG|LaBQcwZ9a^(tzLV@n??r9SNba!`CEEX9V8JWdFO%Y9{UPKrlALq)ID=4K{wQ3bT zJv|&fdK7@3o*u@=#^~?w$2rH6B}+)B)73ey3y{m@7#bR?4mxw@44s{wtXsDZpgMWQ ztOo`LXm4+)p`l?GfSw5uh9Lt31JmRhh9Uj^{S=EuN~IEK&YU3#g6i)TJyo2oCcsqr zE?>TU8UR2hlOdnaGchs2nl)>x1XX%RN5`yrrU8gZbqNp=R<2xG^@D6SOD>nAudk23 zzCLof9BbFEtxnk4*@;q$Fbs*JsJ5e3kSorjl%lhV;I zFvd)if8|=)&9v54nNQu-rcOQ+K$mS?3WdU)dZ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=ZJDXi2=@!V3sv9~tyD5MVePXrT`$!9m z7cOIP_#EH=%N#%W#+jP}nKL1^ZRcuvyWti{&`-)lgr+GP;FIO0+s8z2NzL{vU95r=aYClS^~Sm%hG z!@Xtn zJIJomEAJjp0kO`37@}(gZoUW{={?F@2aaKkrfqSWhab2dFENI5rhK|I31Vjei9|$^ zrFD74uE#qhnHDbhdmR2zl9R_zE59(N+51w0S6}Q`0GoHL7HePUv4^)4M1{#$w5M<} z4L}=`bw0ZvPqJjt)px+Ba3kX3>n5zT z6oO$)6yobNM-JwA@ykK&#ZGyGbrGR8B=OXpYRC+%jz}lWHQaB~hLNEZ=am%i9Jr`%-M&(;UOmgb4=%x2 zgL8s&poxgW$%y3Csp;!c3}7OHD2kJNfKnb8`$su@D9Jkq&MJVn_w}omjt&{zRHUiJ zl>r3AV6NwAL0}02%VaH=Wg=%Vfts}mh0000< KMNUMnLSTa0I5)ch literal 0 HcmV?d00001 diff --git a/programs/system/notify3/NOTIFY.ASM b/programs/system/notify3/NOTIFY.ASM new file mode 100644 index 0000000000..7c5036c9b3 --- /dev/null +++ b/programs/system/notify3/NOTIFY.ASM @@ -0,0 +1,598 @@ + use32 + org 0 + db 'MENUET01' + dd 1, @entry, @end, @memory, @stack, @params, 0 + + include "../../macros.inc" + include "../../proc32.inc" + include "../../dll.inc" + + macro cmpe a, b, c { + cmp a, b + je c } + + macro cmpl a, b, c { + cmp a, b + jl c } + + macro cmpne a, b, c { + cmp a, b + jne c } + + macro cmple a, b, c { + cmp a, b + jle c } + + macro cmpge a, b, c { + cmp a, b + jge c } + + LINEH equ 12 + +;===================================================================== + + @entry: + + mcall 40, 101b + + ;---------------------------- + + ;; CHECK FOR PARAMS + cmpne [@params], byte 0, parse + mov eax, @params + mov ebx, sz_std + @@: + mov cl, [ebx] + mov [eax], cl + inc eax + inc ebx + cmpne [ebx - 1], byte 0, @b + + ;; TEXT + + parse: + mov [text.lines], dword 1 + mov [text.max_len], dword 1 + + mov eax, @params + mov ebx, text.buffer + mov edx, 0 + mov esi, 0 + + cmpne [eax], byte "'", @f + mov dl, "'" + mov eax, @params + 1 + jmp .text + + @@: + cmpne [eax], byte '"', .text + mov dl, '"' + mov eax, @params + 1 + + .text: + cmpe [eax], dl, .text.end + cmpe [eax], byte 0, .text.end + mov cl, [eax] + + cmpe cl, "\", .char + jmp .copy + + .char: + cmpe [eax + 1], byte "n", .newline + cmpe [eax + 1], dl, .quote + jmp .copy + + .newline: + cmple esi, dword [text.max_len], @f + mov [text.max_len], esi + @@: + mov esi, 0 + mov cl, 0 + inc dword [text.lines] + inc eax + jmp .copy + + .quote: + mov cl, dl + inc eax + + .copy: + mov [ebx], cl + inc eax + inc ebx + inc esi + jmp .text + .text.end: + + cmple esi, dword [text.max_len], @f + mov [text.max_len], esi + @@: + + mov [ebx], byte 0 + + cmpge [text.max_len], dword 25, @f + mov [text.max_len], dword 25 + @@: + + ;; PARAMS + + .params: + cmpe [eax], byte 0, .params.end + cmpe [eax], byte "d", .set_atcl + cmpe [eax], byte "t", .set_title + mov ebx, 1 + cmpe [eax], byte "A", .set_icon + mov ebx, 2 + cmpe [eax], byte "E", .set_icon + mov ebx, 3 + cmpe [eax], byte "W", .set_icon + mov ebx, 4 + cmpe [eax], byte "O", .set_icon + mov ebx, 5 + cmpe [eax], byte "N", .set_icon + mov ebx, 6 + cmpe [eax], byte "I", .set_icon + mov ebx, 7 + cmpe [eax], byte "F", .set_icon + mov ebx, 8 + cmpe [eax], byte "C", .set_icon + + jmp .next_char + + .set_atcl: + mov [params.atcl], byte 1 + jmp .next_char + + .set_title: + mov [params.title], byte 1 + jmp .next_char + + .set_icon: + mov [params.icon], ebx + + .next_char: + inc eax + jmp .params + + .params.end: + + ;---------------------------- + + mcall 68, 11 + stdcall dll.Load, @imports + + mov dword [fi + 00], 5 + mov dword [fi + 16], buffer + mov dword [fi + 21], sz_ifile + mcall 70, fi + + mov edx, dword [buffer + 32] + shl edx, 1 + stdcall mem.Alloc, edx + mov [img_data.rgb_obj], eax + + mov dword [fi + 00], 0 + mov dword [fi + 12], edx + m2m dword [fi + 16], [img_data.rgb_obj] + mov dword [fi + 21], sz_ifile + mcall 70, fi + + stdcall dword [img.decode], dword [img_data.rgb_obj], ebx, 0 + mov dword [img_data.obj], eax + + ;; alpha + add eax, 24 + mov eax, [eax] ;; eax - data [argb] + + mov ecx, 24 * 24 * 8 + alpha: + mov ebx, [eax] + shr ebx, 24 + cmpne bl, 0x00, @f + mov [eax], dword 0x222222 + + @@: + add eax, 4 + loop alpha + + ;; end alpha + + stdcall dword [img.to_rgb], dword [img_data.obj], dword [img_data.rgb_obj] + stdcall dword [img.destroy], dword [img_data.obj] + + ;---------------------------- + + mov [text.offset], LINEH + + mov eax, [text.lines] + add eax, 2 + imul eax, LINEH + mov [window.height], eax + + mov eax, [text.max_len] + imul eax, 6 + add eax, LINEH * 2 + cmpe [params.icon], dword 0, @f + add eax, 24 + LINEH + add [text.offset], 24 + LINEH + @@: + mov [window.width], eax + + mcall 14 + mov ebx, eax + and ebx, 0xFFFF + mov [scr.height], ebx + shr eax, 16 + mov [scr.width], eax + sub eax, [window.width] + sub eax, LINEH + mov [window.x], eax + + ;; CALC WINDOW.Y + + mcall 68, 22, sz_shname, 256, 4 + 1 ;OPEN_ALWAYS and WRITE + mov [shm], eax + + s_search: + mov eax, [shm] + + mov ebx, 0 + mov ecx, [text.lines] + add ecx, 3 + + push eax ebx + + mov eax, [scr.height] + mov edx, 0 + mov ebx, LINEH + div ebx + mov edx, eax + add edx, [shm] + sub edx, ecx + inc edx + + pop ebx eax + + s_area: + cmpe [eax], byte 1, .is_1 + + .is_0: + inc ebx + cmpe ebx, ecx, s_ok + jmp .next + + .is_1: + mov ebx, 0 + + .next: + inc eax + cmple eax, edx, s_area + + mcall 5, 10 + jmp s_search + + s_ok: + sub eax, ecx + inc eax + mov [shm.our], eax + + mov edx, eax + sub edx, [shm] + inc edx + imul edx, LINEH + mov [window.y], edx + + @@: + mov [eax], byte 1 + inc eax + loop @b + + ;---------------------------- + + mov eax, 60 + imul eax, [text.lines] + mov [timer], eax + + mov [timer.step], dword 1 + cmpne [params.atcl], byte 1, @f + mov [timer.step], dword 0 + @@: + + ;---------------------------- + + update: + mcall 23, 10 + cmpe al, EV_REDRAW, redraw + cmpe al, EV_BUTTON, exit + + mov eax, [timer.step] + sub [timer], eax + cmpne [timer], dword 0, update + + ;---------------------------- + + exit: + mov eax, [shm.our] + mov ecx, [text.lines] + add ecx, 3 + @@: + mov [eax], byte 0 + inc eax + loop @b + + mcall 68, 23, sz_shname + + mcall -1 + + ;---------------------------- + + redraw: + call draw_window + call draw_text + + jmp update + + ;---------------------------- + + draw_window: + dec dword [window.width] + dec dword [window.height] + mcall 0, <[window.x], [window.width]>, <[window.y], [window.height]>, 0x61000000 + inc dword [window.width] + inc dword [window.height] + + and ebx, 0xFFFF + and ecx, 0xFFFF + inc ebx + inc ecx + mcall 8, , , 0x61000001 + + mov eax, 13 + mov ebx, [window.width] + mov edx, 0x222222 + cmpe [first_draw], byte 1, .draw_full + mov [first_draw], byte 1 + mov esi, [window.height] + mov ecx, LINEH / 2 + @@: + mcall + add ecx, (LINEH / 2) shl 16 + sub esi, LINEH / 2 + push eax ebx + mcall 5, 1 + pop ebx eax + cmpne esi, 0, @b + .draw_full: + mcall + + mcall , , 1, 0x121212 + + mov ecx, [window.height] + dec ecx + shl ecx, 16 + inc ecx + mcall + + mcall , 1, [window.width] + + mov ebx, [window.width] + dec ebx + shl ebx, 16 + inc ebx + mcall + + mcall 1, 1, 1 + mov ebx, [window.width] + sub ebx, 2 + mcall + mov ecx, [window.height] + sub ecx, 2 + mcall + mov ebx, 1 + mcall + + ;----- + + mov ecx, [scr.width] + inc ecx + + mov eax, 35 + mov ebx, ecx + imul ebx, [window.y] + add ebx, [window.x] + dec ebx + mcall + push eax + + mov eax, 35 + add ebx, [window.width] + add ebx, 2 + mcall + push eax + + mov eax, 35 + mov edx, ecx + mov esi, [window.height] + dec esi + imul edx, esi + add ebx, edx + mcall + push eax + + mov eax, 35 + sub ebx, [window.width] + sub ebx, 2 + mcall + push eax + + ;----- + + mov eax, 1 + + pop edx + mov ecx, [window.height] + dec ecx + mcall , 0 + + pop edx + mov ebx, [window.width] + dec ebx + mcall + + pop edx + mcall , , 0 + + pop edx + mcall , 0 + + ;----- + + cmpe [params.icon], dword 0, @f + + mov ebx, [params.icon] + dec ebx + imul ebx, 24 * 24 * 3 + add ebx, [img_data.rgb_obj] + + mov edx, [window.height] + shr edx, 1 + sub edx, 12 + add edx, LINEH shl 16 + + mcall 7, , <24, 24> + + @@: + + ret + + ;---------------------------- + + draw_text: + mov esi, [text.lines] + + mov eax, 4 + mov ebx, [text.offset] + shl ebx, 16 + add ebx, LINEH + (LINEH - 6) / 2 + mov edx, text.buffer + + .draw_lines: + mov ecx, 0x80111111 + + add ebx, 0x00010000 + dec ebx + mcall + add ebx, 2 + mcall + sub ebx, 0x00020000 + mcall + sub ebx, 2 + mcall + + add ebx, 0x00010001 + mov ecx, 0x80D0D0D0 + mcall + + add ebx, LINEH + dec esi + cmpe esi, 0, .draw_lines.end + + inc edx + @@: + cmpe [edx], byte 0, @f + inc edx + jmp @b + @@: + inc edx + jmp .draw_lines + + .draw_lines.end: + + cmpne [params.title], byte 1, @f + mov edx, text.buffer + mov ecx, 0x80111111 + and ebx, 0xFFFF0000 + add ebx, 1 shl 16 + LINEH + (LINEH - 6) / 2 + mcall + + mov ecx, 0x80FFFFFF + sub ebx, 0x00010000 + mcall + @@: + + ret + ;---------------------------- + + @imports: + library img, "libimg.obj" + import img, img.init, "lib_init", \ + img.to_rgb, "img_to_rgb2", \ + img.decode, "img_decode", \ + img.destroy, "img_destroy" + + ;---------------------------- + + sz_ifile db "notify3.png", 0 + sz_shname db "notify-mem-v01", 0 + sz_std db "'Notify 3. Keys list\n \n", \ + "d - disable auto-closing\n", \ + "t - first line is title\n", \ + "A - application icon\n", \ + "E - error icon\n", \ + "W - warning icon\n", \ + "O - ok icon\n", \ + "N - network icon\n", \ + "I - info icon\n", \ + "F - folder icon\n", \ + "C - component icon", \ + "' -td", 0 + + ;---------------------------- + + @end: + +;===================================================================== + + window: + .x rd 1 + .y rd 1 + .width rd 1 + .height rd 1 + + scr: + .width rd 1 + .height rd 1 + + text: + .buffer rb 256 + .lines rd 1 + .max_len rd 1 + .offset rd 1 + + params: + .atcl rb 1 + .title rb 1 + .icon rd 1 + + img_data: + .rgb_obj rd 1 + .obj rd 1 + + timer: + .value rd 1 + .step rd 1 + + shm: + .addr rd 1 + .our rd 1 + + fi rb 26 + buffer rb 1024 + first_draw rb 1 + +;===================================================================== + rb 2048 + @stack: + @params rb 256 + + @memory: diff --git a/programs/system/notify3/README.TXT b/programs/system/notify3/README.TXT new file mode 100644 index 0000000000..d2527b7bdc --- /dev/null +++ b/programs/system/notify3/README.TXT @@ -0,0 +1,24 @@ +1. INSTALL + Copy "@notify" and "notify3.png" to "/sys/". Launch "test.sh" for testing. + +2. FORMAT + 2.1 RUN + a) @notify + b) @notify "" [-] + c) @notify '' [-] + + 2.2 + All charactes. If you won`t to write character of quote (" or '), you must + enter \ before it (\" or \'). New-line character is "\n". + + 2.3 + d - disable auto-closing + t - first line is title + A - application icon + E - error icon + W - warning icon + O - ok icon + N - network icon + I - info icon + F - folder icon + C - component icon diff --git a/programs/system/notify3/TEST.SH b/programs/system/notify3/TEST.SH new file mode 100644 index 0000000000..f795b1edec --- /dev/null +++ b/programs/system/notify3/TEST.SH @@ -0,0 +1,3 @@ +#SHS +@notify "HTTP Downloader\nhttp://builds.kolibrios.org/rus/latest-img.7z\nhas been successfully downloaded" -tdN +@notify "RDSave\nRAM-диск сохранён успешно в /hd0/2/boot/kolibri.img" -tdF \ No newline at end of file