Fixed a problem with the stack. Improved the right mouse button menu.

git-svn-id: svn://kolibrios.org@4036 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2013-10-15 19:20:30 +00:00
parent f39767f1f2
commit 224e4023ab
2 changed files with 177 additions and 117 deletions

View File

@ -1,3 +1,5 @@
;¨­®£¤  ­¥¢¥à­® ®¯à¥¤¥«ï¥âáï è¨à¨­  ¬¥­î誨
ICONS_DAT equ '/rd/1/icons.dat' ICONS_DAT equ '/rd/1/icons.dat'
ICON_STRIP equ '/rd/1/iconstrp.png' ICON_STRIP equ '/rd/1/iconstrp.png'
ICON_SIZE equ 68 ICON_SIZE equ 68
@ -29,7 +31,7 @@ BegData equ fiStdIco.point
dd START ; start of code dd START ; start of code
dd I_END ; size of image dd I_END ; size of image
dd ENDMEM ; memory for app dd ENDMEM ; memory for app
dd stack_area ; esp dd stack_main ; esp
dd 0 ; boot parameters dd 0 ; boot parameters
dd 0 ; path dd 0 ; path
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -428,7 +430,7 @@ RButtonPress:
jmp @b jmp @b
@@: @@:
mcall 51,1,RButtonWin,stack_dlg ;CreateThread RButtonWin,stack_dlg mcall 51,1,RButtonWin,stack_rmenu ;CreateThread RButtonWin,stack_rmenu
jmp messages jmp messages
@ -846,6 +848,7 @@ local posX:WORD,\
@@: @@:
xor ebx,ebx xor ebx,ebx
mov ebx,[NumIconI]
.TestIcon: .TestIcon:
cmp dword[NumIconI],-1 cmp dword[NumIconI],-1
je @f je @f
@ -1165,7 +1168,6 @@ keyParams db 'param',0
keyIco db 'ico',0 keyIco db 'ico',0
keyX db 'x',0 keyX db 'x',0
keyY db 'y',0 keyY db 'y',0
keyMenuColor db 'menucolor',0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
IMPORTS: IMPORTS:
@ -1215,24 +1217,27 @@ import libini,\
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
secRButt db 'rbmenu',0 secRButt db 'rbmenu',0
PredItem dd -1
if lang eq ru if lang eq ru
RMenuOffMoving db '‡ ªà¥¯¨âì ¨ª®­ª¨',0
RMenuOnMoving db 'Žâªà¥¯¨âì ¨ª®­ª¨',0
RMenuRedrawFon db '<27>¥à¥à¨á®¢ âì',0 RMenuRedrawFon db '<27>¥à¥à¨á®¢ âì',0
RMenuAlign db '‚ë஢­ïâì ¯® á¥âª¥',0 RMenuAlign db '‚ë஢­ïâì ¯® á¥âª¥',0
RMenuAdd db '„®¡ ¢¨âì',0 RMenuAdd db '„®¡ ¢¨âì',0
RMenuDel db '“¤ «¨âì',0 RMenuDel db '“¤ «¨âì',0
RMenuProp db '‘¢®©á⢠',0 RMenuProp db '‘¢®©á⢠',0
RMenuOffMoving db '‡ ªà¥¯¨âì ¨ª®­ª¨',0
RMenuOnMoving db 'Žâªà¥¯¨âì ¨ª®­ª¨',0
else else
RMenuOffMoving db 'Fix the icons',0
RMenuOnMoving db 'Unfix the icons',0
RMenuRedrawFon db 'Redraw',0 RMenuRedrawFon db 'Redraw',0
RMenuAlign db 'Snap to Grid',0 RMenuAlign db 'Snap to Grid',0
RMenuAdd db 'Add',0 RMenuAdd db 'Add',0
RMenuDel db 'Delete',0 RMenuDel db 'Delete',0
RMenuProp db 'Properties',0 RMenuProp db 'Properties',0
RMenuOffMoving db 'Fix the icons',0
RMenuOnMoving db 'Unfix the icons',0
end if end if
@ -1250,7 +1255,6 @@ else
ErrName db 'The name "rbmenu" reserved',0 ErrName db 'The name "rbmenu" reserved',0
end if end if
pthNotify db '/rd/1/@notify',0 pthNotify db '/rd/1/@notify',0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -1277,7 +1281,6 @@ DCaptName db 'Name',0
DCaptPath db 'Path',0 DCaptPath db 'Path',0
DCaptParams db 'Parameters',0 DCaptParams db 'Parameters',0
DCaptIcon db 'Icon',0 DCaptIcon db 'Icon',0
;DCaptChange db '.',0
DCaptCreate db 'Create',0 DCaptCreate db 'Create',0
DCaptProperties db 'Change',0 DCaptProperties db 'Change',0
DCaptCancel db 'Cancel',0 DCaptCancel db 'Cancel',0
@ -1367,6 +1370,8 @@ IconArea rb 4*ICON_SIZE*ICON_SIZE
;\ ;\
sc system_colors sc system_colors
sc.workL rd 1
sc.workH rd 1
align 4 align 4
ScreenX rw 1 ScreenX rw 1
@ -1406,10 +1411,8 @@ NumUserButt rd 1
RBUser rd 16*2+1 RBUser rd 16*2+1
RMenuW rw 1 RMenuW rw 1
RMenuH rw 1 RMenuH rw 1
RMenuHsb rw 1
MaxPage rd 1 MaxPage rd 1
RBMenuColor rd 1
mouse_dd rd 1 mouse_dd rd 1
DAreaName rb NAME_LENGTH+1 DAreaName rb NAME_LENGTH+1
@ -1421,17 +1424,20 @@ align 4
RBProcInfo rb 1024 RBProcInfo rb 1024
align 4 align 4
; OpenDialog
;------ OpenDialog -------------------------------
temp_dir_pach rb 1024 temp_dir_pach rb 1024
fname_Info rb 1024 fname_Info rb 1024
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
rb 512 rb 512
stack_mov: stack_mov: ;®¤­®¢à¥¬¥­­® â áª âì ¨ ¤¥à¦ âì ®âªàëâë¬ ¬¥­îèªã ­¥¢®§¬®¦­®
stack_rmenu:
rb 512 rb 512
stack_dlg: stack_dlg:
rb 512 rb 512
stack_bredraw: stack_bredraw:
rb 512 rb 512
stack_area: stack_main:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
ENDMEM: ENDMEM:

View File

@ -11,23 +11,52 @@ idbRAdd equ 103
idbRDel equ 104 idbRDel equ 104
idbRProp equ 105 idbRProp equ 105
DELTA_COLOR equ 70
;---- thread for rbutton ----------------------------------------------------------------------- ;---- thread for rbutton -----------------------------------------------------------------------
RButtonWin: RButtonWin:
mcall 40,100101b ;SetMaskMessage 100101b mcall 40,100101b ;SetMaskMessage 100101b
mcall 48,3,sc,40 mcall 48,3,sc,40
mov eax,[sc.work] ;¢ëç¨á«ï¥¬ 梥â ᢥ⫥¥ ä®­®¢®£®
rol eax,16
add al,DELTA_COLOR
jnc @f
mov al,0FFh
@@:
rol eax,16
add al,DELTA_COLOR
jnc @f
mov al,0FFh
@@:
add ah,DELTA_COLOR
jnc @f
mov ah,0FFh
@@:
mov [sc.workH],eax
mov eax,[sc.work] ;¢ëç¨á«ï¥¬ 梥â ⥬­¥¥ ä®­®¢®£®
rol eax,16
sub al,DELTA_COLOR
jnc @f
mov al,0FFh
@@:
rol eax,16
sub al,DELTA_COLOR
jnc @f
mov al,0FFh
@@:
sub ah,DELTA_COLOR
jnc @f
mov ah,0FFh
@@:
mov [sc.workL],eax
stdcall GetNumIcon,[MouseX],[MouseY],-1 stdcall GetNumIcon,[MouseX],[MouseY],-1
mov [SelIcon],eax mov [SelIcon],eax
cmp eax,-1
jne @f
mov [RMenuH],16*4+3+3
mov [RMenuHsb],16*4+3+3
jmp .rbw1
@@:
mov [RMenuH],16*5+3+3
mov [RMenuHsb],16*5+3+3
.rbw1:
mov [NumUserButt],0 mov [NumUserButt],0
mov [RMenuW],0 mov [RMenuW],0
mcall 70,fiIni mcall 70,fiIni
@ -35,6 +64,16 @@ RButtonWin:
mov [RBUser],eax mov [RBUser],eax
stdcall [ini_enum_keys],IconIni,secRButt,GetUserBut stdcall [ini_enum_keys],IconIni,secRButt,GetUserBut
cmp [SelIcon],-1
jne @f
mov [RMenuH],16*4
mov eax,[NumUserButt]
shl eax,4
add [RMenuH],ax
jmp .rbw1
@@:
mov [RMenuH],16*5
.rbw1:
RBWRedraw: RBWRedraw:
mcall 12,1 ;RedrawWinBeg mcall 12,1 ;RedrawWinBeg
@ -44,11 +83,19 @@ RBWRedraw:
mov ecx,[MouseY] mov ecx,[MouseY]
shl ecx,16 shl ecx,16
mov cx,[RMenuH] mov cx,[RMenuH]
mov edx,0177CCFFh mov edx,01000000h
mov esi,01000000h mov esi,01000000h
xor eax,eax xor eax,eax
int 40h int 40h
and ebx,0FFFFh ;ä®­®¢ë© ¯àאַ㣮«ì­¨ª
inc bx
and ecx,0FFFFh
inc cx
mcall 13,,,[sc.work]
cmp [SelIcon],-1 ;¥á«¨ ª«¨ª ¯® ¨ª®­ª¥, â® ¯ã­ªâë ¯®«ì§®¢ â¥«ï ­¥ ­ã¦­ë
jne .NoDrawUserBut
;----------- ;-----------
mov ecx,[NumUserButt] mov ecx,[NumUserButt]
.DrawUB: .DrawUB:
@ -57,14 +104,15 @@ RBWRedraw:
mov eax,[NumUserButt] mov eax,[NumUserButt]
sub eax,ecx sub eax,ecx
mov edx,eax ;button ID mov edx,eax ;button ID
or edx,60000000h
shl eax,4+16 ;*16*10000h shl eax,4+16 ;*16*10000h
mov ecx,eax mov ecx,eax
mov cx,16 mov cx,16
xor ebx,ebx xor ebx,ebx
mov bx,[RMenuW] mov bx,[RMenuW]
mov esi,[sc.work] ;[RBMenuColor];0888888h mov esi,[sc.work]
mcall 8 mcall 8 ;®¯à¥¤¥«¨«¨
mov ebx,50000h mov ebx,50000h
shr ecx,16 shr ecx,16
@ -76,44 +124,58 @@ RBWRedraw:
mov eax,[NumUserButt] mov eax,[NumUserButt]
sub eax,[esp] sub eax,[esp]
mov edx,[RBUser+eax*8] mov edx,[RBUser+eax*8]
mcall 4 ;¯®¤¯¨á «¨
mcall 4
pop ecx pop ecx
loop .DrawUB loop .DrawUB
;----------- ;-----------
.NoDrawUserBut:
;®¯à¥¤¥«¥­¨¥ ª­®¯®ª ¤«ï ¨ª®­®ª
xor ebx,ebx xor ebx,ebx
mov bx,[RMenuW] mov bx,[RMenuW]
mov cx,[RMenuH]
sub cx,[RMenuHsb]
push ecx
mov dx,cx
shl ecx,16
mov cx,dx
;¯¥à¢ ï à §¤¥«¨â¥«ì­ ï «¨­¨ï xor eax,eax
; mcall 38,,,[RBMenuColor];0888888h cmp [SelIcon],-1
mcall 38,,,[sc.work] jne @f
add ecx,00010001h mov eax,[NumUserButt]
mcall ,,, @@:
shl eax,4
;------------ mov cx,ax
mov ecx,[esp]
add ecx,2
shl ecx,16 shl ecx,16
mov cx,16 mov cx,16
push ecx ;®âá à¨á®¢ âì ª­®¯ª¨ (¯® ¢ëá®â¥)
; mcall 8,,,idbRRedrawFon,[RBMenuColor];0888888h ;3 ª­®¯ª¨ ¢â®à®£® ¡«®ª 
mcall 8,,,idbRRedrawFon,[sc.work]
add ecx,00100000h
mcall ,,,idbRAlign
add ecx,00100000h
mcall ,,,idbRFixIcons
mcall 8,,,60000000h or idbRRedrawFon,[sc.work]
add ecx,16*10000h
mcall ,,,60000000h or idbRAlign
add ecx,16*10000h
mcall ,,,60000000h or idbRFixIcons
add ecx,16*10000h
cmp dword[SelIcon],-1
je @f
mcall ,,,60000000h or idbRDel,
add ecx,16*10000h
mcall ,,,60000000h or idbRProp,
jmp .endRM1
@@:
mcall ,,,60000000h or idbRAdd,
.endRM1:
;¯®¤¯¨á¨ ª ª­®¯ª ¬
xor eax,eax
cmp [SelIcon],-1
jne @f
mov eax,[NumUserButt]
@@:
shl eax,4
mov ebx,50000h mov ebx,50000h
mov bx,word[esp] mov bx,ax
add bx,2+5
add bx,5
mcall 4,,80000000h,RMenuRedrawFon mcall 4,,80000000h,RMenuRedrawFon
add ebx,16 add ebx,16
mcall ,,,RMenuAlign mcall ,,,RMenuAlign
@ -127,52 +189,19 @@ RBWRedraw:
mov edx,RMenuOnMoving mov edx,RMenuOnMoving
.RBWR1: .RBWR1:
mcall mcall
add ebx,16
;------------
xor ebx,ebx ;¢â®à ï à §¤¥«¨â¥«ì­ ï «¨­¨ï
mov bx,[RMenuW]
mov ecx,[esp]
add ecx,16*3+2
mov dx,cx
shl ecx,16
mov cx,dx
; mcall 38,,,[RBMenuColor];0888888h
mcall 38,,,[sc.work]
add ecx,00010001h
mcall ,,,
;------------
;1 ¨«¨ 2 ª­®¯ª¨ âà¥â쥣® ¡«®ª 
mov ecx,[esp]
add ecx,16*3+4
shl ecx,16
mov cx,16
cmp dword[SelIcon],-1 cmp dword[SelIcon],-1
je @f je @f
; mcall 8,,,idbRDel,[RBMenuColor];0888888h mcall ,,,RMenuDel
mcall 8,,,idbRDel,[sc.work]
add ecx,00100000h
; mcall ,,,idbRProp,[RBMenuColor];0888888h
mcall ,,,idbRProp,[sc.work]
mov ebx,50000h
mov bx,word[esp]
add bx,16*3+4+5
mcall 4,,80000000h,RMenuDel
add bx,16 add bx,16
mcall ,, ,RMenuProp mcall ,,,RMenuProp
jmp .endRM2
jmp .endRM
@@: @@:
; mcall 8,,,idbRAdd,[RBMenuColor];0888888h mcall ,,,RMenuAdd
mcall 8,,,idbRAdd,[sc.work] .endRM2:
mov ebx,50000h
mov bx,word[esp]
add bx,16*3+4+5
mcall 4,,80000000h,RMenuAdd
.endRM:
pop ecx pop ecx
mcall 12,2 ;RedrawWinEnd mcall 12,2 ;RedrawWinEnd
@ -218,21 +247,40 @@ RBWButton:
jmp RBWExit jmp RBWExit
RBWMouse: RBWMouse:
cmp [PredItem],-1
je @f
mov eax,[PredItem]
xor ebx,ebx
mov bx,[RMenuW]
mov cx,ax
shl ecx,16
mov cx,ax
mcall 38,,,[sc.work]
add ecx,00100010h
mcall ,,,[sc.work]
@@:
call ClickInWin
jnc @f
mcall 37,1 ;¯®«®¦¥­¨¥ ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
and eax,0FFF0h
mov [PredItem],eax
xor ebx,ebx
mov bx,[RMenuW]
mov cx,ax
shl ecx,16
mov cx,ax
mcall 38,,,[sc.workL]
add ecx,00100010h
mcall ,,,[sc.workH]
@@:
mcall 37,2 ;GetMouseKey mcall 37,2 ;GetMouseKey
test eax,111b test eax,111b
jz RBWMessages jz RBWMessages
mcall 37,0 ;GetMousePos
xor ebx,ebx
mov bx,ax ;y
shr eax,16 ;x
xor ecx,ecx call ClickInWin
mov cx,bx jc RBWMessages
mov bx,ax
mcall 34
cmp eax,[RBSlot]
je RBWMessages
RBWExit: RBWExit:
mcall 68,13,[RBUser] mcall 68,13,[RBUser]
@ -309,6 +357,26 @@ RBWSetActivWin:
mcall 18,3,[slotDlgAdd] mcall 18,3,[slotDlgAdd]
jmp RBWExit jmp RBWExit
proc ClickInWin ;Carry flag = 1, ¥á«¨ ª«¨ª ¢ ®ª­¥
mcall 37,0 ;GetMousePos
xor ebx,ebx
mov bx,ax ;y
shr eax,16 ;x
xor ecx,ecx
mov cx,bx
mov bx,ax
mcall 34
cmp eax,[RBSlot]
jne @f
stc
ret
@@:
clc
ret
endp
proc AlignIcons proc AlignIcons
local posX:WORD,\ local posX:WORD,\
@ -458,19 +526,6 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
push ebx esi edi push ebx esi edi
mov edi,[key_name]
mov esi,keyMenuColor
@@: lodsb
scasb
jne @f
test al,al
jnz @b
stdcall [ini_get_color],[f_name],[sec_name],[key_name],0888888h
mov [RBMenuColor],eax
ret
@@:
mov edi,[key_name] ;®¯à¥¤¥«ï¥¬ è¨à¨­ã ¬¥­î mov edi,[key_name] ;®¯à¥¤¥«ï¥¬ è¨à¨­ã ¬¥­î
xor eax,eax xor eax,eax
or ecx,-1 or ecx,-1
@ -510,7 +565,6 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
mov [RBUser+ebx*8+8],edi mov [RBUser+ebx*8+8],edi
inc [NumUserButt] inc [NumUserButt]
add [RMenuH],16
pop edi esi ebx pop edi esi ebx
mov eax,1 mov eax,1