@PANEL - taskbar. Some optimisations and code refactoring. Intermediate stage.

git-svn-id: svn://kolibrios.org@2532 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-31 16:34:52 +00:00
parent 34c41e7258
commit f4bf2eedaa
6 changed files with 2187 additions and 2431 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,76 +1,107 @@
;------------------------------------------------------------------------------
align 4
load_ini:
mov [point2],16h
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [firini],al
mov [point2],32h
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [lngcrc1],al
mov [point2],42h
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [lngcrc2],al
mov [point2],52h
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [lngcrc3],al
mov [point2],06eh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng1],al
mov [point2],07eh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng2],al
mov [point2],08eh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng3],al
mov [point2],09eh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng4],al
mov [point2],0aeh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng5],al
mov [point2],0beh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng6],al
mov [point2],0ceh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng7],al
mov [point2],0deh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng8],al
mov [point2],0eeh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng9],al
mov [point2],0feh
mcall 70,get_ini
mov al,[inicont]
sub al,30h
mov [altlng0],al
ret
;------------------------------------------------------------------------------
align 4
fir_lng:
mov al,[firini]
sub al,1
@ -78,265 +109,289 @@ fir_lng:
mul dx
mov [point],eax
mcall 70,get_key
mov eax,21
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mcall 21,,,current_keymap_shift
inc ecx
mov edx,current_keymap_alt
mcall
mov eax,21
mov ecx,9
mcall 21,,,current_keymap_alt
movzx edx,[firini]
mcall
mcall 21,,9
ret
;------------------------------------------------------------------------------
align 4
karu:
add [key_r2],1
cmp [key_r2],3
jb .altes
mov [key_r2],0
;--------------------------------------
align 4
.altes:
cmp [key_r2],0
je .klt_1
cmp [key_r2],1
je .klt_2
cmp [key_r2],2
je .klt_3
jmp still
;--------------------------------------
align 4
.klt_1:
mov al,[lngcrc1]
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.klt_2:
mov al,[lngcrc2]
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.klt_3:
mov al,[lngcrc3]
sub al,1
mov [key_r],al
jmp alted
ret
;------------------------------------------------------------------------------
align 4
alter:
cmp [key_r],0
je .alt_1
cmp [key_r],1
je .alt_2
cmp [key_r],2
je .alt_3
cmp [key_r],3
je .alt_4
cmp [key_r],4
je .alt_5
cmp [key_r],5
je .alt_6
cmp [key_r],6
je .alt_7
;--------------------------------------
align 4
.alt_1:
mov al,[altlng1]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_2:
mov al,[altlng2]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_3:
mov al,[altlng3]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_4:
mov al,[altlng4]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_5:
mov al,[altlng5]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_6:
mov al,[altlng6]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.alt_7:
mov al,[altlng7]
cmp al,0
je .exit
sub al,1
mov [key_r],al
jmp alted
;--------------------------------------
align 4
.exit:
ret
;------------------------------------------------------------------------------
align 4
alted:
cmp [key_r],0
je alt_1
cmp [key_r],1
je alt_2
cmp [key_r],2
je alt_3
cmp [key_r],3
je alt_4
cmp [key_r],4
je alt_5
cmp [key_r],5
je alt_6
cmp [key_r],6
je alt_7
ret
;------------------------------------------------------------------------------
align 4
alt_1:
mov [point],0
mov [point],0 ; english
mcall 70,get_key
mov eax,21 ; english 0
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,1 ; 1 - english
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,1 ; 1 - english
ret
;------------------------------------------------------------------------------
align 4
alt_2:
mov [point],1536
mov [point],384 ;1536 ; finnish
mcall 70,get_key
mov eax,21 ; finnish
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,2 ; 2 - finnish
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,2 ; 2 - finnish
ret
;------------------------------------------------------------------------------
align 4
alt_3:
mov [point],768
mov [point],768 ; german
mcall 70,get_key
mov eax,21 ; german
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,3 ; 3 - german
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,3 ; 3 - german
ret
;------------------------------------------------------------------------------
align 4
alt_4:
mov [point],384
mov [point],1152 ;384 ; russian
mcall 70,get_key
mov eax,21 ; russian
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,4 ; 4 - russian
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,4 ; 4 - russian
ret
;------------------------------------------------------------------------------
align 4
alt_5:
mov [point],1152
mov [point],1536 ;1152 ;french
mcall 70,get_key
mov eax,21 ;french
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mcall 21,,,current_keymap_shift
inc ecx
mov edx,current_keymap_alt
mcall
mov eax,21
mov ecx,9
mov edx,5 ; 5 - french
mcall
mcall 21,,,current_keymap_alt
mcall 21,,9,5 ; 5 - french
ret
;------------------------------------------------------------------------------
align 4
alt_6:
mov [point],1920
mov [point],1920 ; estonian
mcall 70,get_key
mov eax,21 ; estonian
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,6 ; 6 - estonian
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,6 ; 6 - estonian
ret
;------------------------------------------------------------------------------
align 4
alt_7:
mov [point],2304
mov [point],2304 ; ukrainian
mcall 70,get_key
mov eax,21 ; ukrainian
mov ebx,2
mov ecx,1
mov edx,current_keymap
mcall
mov eax,21
mcall 21,2,1,current_keymap
inc ecx
mov edx,current_keymap_shift
mcall
mov eax,21
mov ecx,9
mov edx,7 ; 7 - ukrainian
mcall
mcall 21,,,current_keymap_shift
mcall 21,,9,7 ; 7 - ukrainian
ret
;------------------------------------------------------------------------------
align 4
current_keymap:
rb 128
;------------------------------------------------------------------------------
align 4
current_keymap_shift:
rb 128
;------------------------------------------------------------------------------
align 4
current_keymap_alt:
rb 128
;------------------------------------------------------------------------------
key_r db 0
key_r2 db 0
key_r3 db 0
@ -355,22 +410,24 @@ altlng7 db 0
altlng8 db 0
altlng9 db 0
altlng0 db 0
get_key:
dd 0
;------------------------------------------------------------------------------
align 4
get_key: dd 0
point dd 0
dd 0
dd 384
dd current_keymap
db 0
dd key_file
get_ini:
dd 0
;------------------------------------------------------------------------------
align 4
get_ini: dd 0
point2 dd 0
dd 0
dd 1
dd inicont
db 0
dd ini_file
;------------------------------------------------------------------------------
key_file: db '/rd/1/keymap.key',0
ini_file: db '/rd/1/lang.ini',0

View File

@ -1,5 +1,6 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @panel.asm @panel
@fasm -m 16384 @panel.asm @panel
@erase lang.inc
@kpack @panel
@pause

View File

@ -1,5 +1,6 @@
@erase lang.inc
@echo lang fix et >lang.inc
@fasm @panel.asm @panel
@fasm -m 16384 @panel.asm @panel
@erase lang.inc
@kpack @panel
@pause

View File

@ -1,6 +1,6 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @panel.asm @panel
@fasm -m 16384 @panel.asm @panel
@erase lang.inc
@kpack @panel
@pause

View File

@ -1,66 +1,44 @@
;------------------------------------------------------------------------------
align 4
context_menu_start:
mov eax, 40
mov ebx, 00100111b
int 0x40
;call draw_ctx_menu
mov ebp, 2 ; 2 ç áâ® ¨á¯®«ì§ã¥âáï.
; // Alver 26.08.2007 // {
; xor ecx, ecx
; mov edx, [ctx_menu_PID]
; find_slot:
; inc ecx
; mov eax, 9
; mov ebx, process_info_buffer
; int 0x40
; cmp dword [process_info_buffer + 30], edx
; jne find_slot
mcall 40,00100111b
mov ecx, [ctx_menu_PID]
mcall 18,21
mov ecx, eax
; } \\ Alver \\
mov eax, 18
mov ebx, 3
;mov ecx, ecx ; :)
int 0x40
mcall 18,3
call draw_ctx_menu
;------------------------------------------------------------------------------
align 4
ctx_menu_still:
mov eax, 10
int 0x40
cmp eax, ebp ; cmp eax, 2
mcall 10
cmp eax, 2
jz ctx_menu_key
cmp eax, 3
jz ctx_menu_button
cmp eax, 6
jz ctx_menu_mouse
call draw_ctx_menu
jmp ctx_menu_still
;------------------------------------------------------------------------------
align 4
ctx_menu_key:
mov eax, ebp ; mov eax, 2
int 0x40
mcall 2
;--------------------------------------
align 4
ctx_menu_button:
mov eax, 17
int 0x40
mcall 17
cmp ah, 1
; // Alver 26.08.2007 // {
; jne ctx_menu_still
jne @f
; } \\ Alver \\
mov eax, 18
mov ebx, ebp ; mov eax, 2
mov ebx, 2
mov ecx, [n_slot]
; // Alver 26.08.2007 // {
jmp .lllxxx
;--------------------------------------
align 4
@@:
cmp ah, 2
jne ctx_menu_still
@ -68,53 +46,51 @@ context_menu_start:
mov ebx, 22
mov edx, [n_slot]
xor ecx, ecx
; \begin{diamond}[20.09.2007]
test byte [procinfo_for_detect+70], 2
test [procinfo_for_detect+70],byte 2
setnz cl
add cl, cl
; \end{diamond}[20.09.2007]
;--------------------------------------
align 4
.lllxxx:
; } \\ Alver \\
int 0x40
mcall
jmp ctx_menu_exit
;--------------------------------------
align 4
ctx_menu_mouse:
mov eax, 37
mov ebx, ebp ; mov ebx, 2
int 0x40
xchg eax, ecx ; cmp eax, 0 …᫨ ­¥ ®¤­  ¨§ ª­®¯®ª ­¥ ­ ¦ â  ¢®§¢à é ¥¬áï
mcall 37,2
xchg eax,ecx ; …᫨ ­¥ ®¤­  ¨§ ª­®¯®ª ­¥ ­ ¦ â  ¢®§¢à é ¥¬áï
; ¢ £« ¢­ë© 横« ¯®â®ª 
jecxz ctx_menu_still
mov eax, 37
xor ebx, ebx ; mov ebx, 1
inc ebx
int 0x40
mcall 37,1
cmp ax, 0 ; ’ã⠯஢¥à塞 ¯à®¨§®èñ«-«¨ ª«¨ª §  ¯à¥¤¥« ¬¨ ®ª­  ª®­â¥ªáâ­®£®
jb ctx_menu_exit ; ¬¥­î, ¥á«¨ §  ¯à¥¤¥« ¬¨ â® § ªà뢠¥¬ ª®­â¥ªáâ­®¥ ¬¥­î
cmp ax, 60 ; 41
ja ctx_menu_exit
shr eax, 16
cmp ax, 0
jb ctx_menu_exit
cmp ax, 133
ja ctx_menu_exit
jmp ctx_menu_still
;--------------------------------------
align 4
ctx_menu_exit:
xor eax, eax
dec eax ; mov eax, -1
int 0x40
func draw_ctx_menu
or eax,-1
mcall
;------------------------------------------------------------------------------
align 4
;func draw_ctx_menu
draw_ctx_menu:
mcall 12, 1
xor eax, eax ; mov eax, 0
xor eax, eax
movzx ebx, [x_coord]
shl ebx, 16
add ebx, 133
@ -122,78 +98,58 @@ func draw_ctx_menu
sub ecx, 60 ; 41
shl ecx, 16
add ecx, 60 ; 41
mov edx, [system_colours + 20] ; sc.work
mov esi, [system_colours + 4] ; sc.grab
or esi, 0x81000000
mov edi, [system_colours] ; sc.frame
int 0x40
mcall ,,,[system_colours + 20],[system_colours]
mov eax, 8
mov ebx, 0 * 65536 + 133
mov ecx, 22 * 65536 + 17
mov edx, 0x40000001
int 0x40
mcall 8,<0,133>,<22,17>,0x40000001
;mov eax, 8
;mov ebx, 0 * 65536 + 133
;mov ecx, 40 * 65536 + 17
;mov edx, 0x40000002
;int 0x40
mov ecx, 40 * 65536 + 17
inc edx
int 0x40
mcall ,,<40,17>
shr eax, 1 ; mov eax, 4
mov ebx, 36 * 65536 + 7
mov ecx, [system_colours + 16] ; sc.grab_text
or ecx, 0x10000000
mov edx, ctx_menu_title
mov esi, ctx_menu_title_end - ctx_menu_title
int 0x40
mcall 4,<36,7>,,ctx_menu_title,ctx_menu_title_end - ctx_menu_title
add ebx, 1 * 65536
int 0x40
mcall
mov ebx, 4 * 65536 + 28
mov ecx, 0x80000000
mov edx, ctx_menu_text
mcall ,<4,28>,0x80000000,ctx_menu_text
int 0x40
add bx, 18
mov edx, ctx_menu_text2
test byte [procinfo_for_detect+70], 2
jz @f
mov edx, ctx_menu_text3
;--------------------------------------
align 4
@@:
int 0x40
add bx, 18
mcall
mcall 12,2
ret
endf
;endf
;------------------------------------------------------------------------------
align 4
x_coord rw 1
y_coord rw 1
n_slot rd 1
ctx_menu_PID rd 1
;------------------------------------------------------------------------------
lsz ctx_menu_text,\
ru, <"X ‡ ªàëâì Alt + F4",0>,\
en, <"X Close Alt + F4",0>,\
;------------------------------------------------------------------------------
lsz ctx_menu_text2,\
ru, <25," ‘¢¥à­ãâì ",0>,\
en, <25," Minimize ",0>,\
;------------------------------------------------------------------------------
lsz ctx_menu_text3,\
ru, <24," ‚®ááâ ­®¢¨âì ",0>,\
en, <24," Restore ",0>
ctx_menu_PID rd 1
;------------------------------------------------------------------------------
ctx_menu_title:
db 'KolibriOS'
ctx_menu_title_end:
;------------------------------------------------------------------------------