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

View File

@ -11,23 +11,52 @@ idbRAdd equ 103
idbRDel equ 104
idbRProp equ 105
DELTA_COLOR equ 70
;---- thread for rbutton -----------------------------------------------------------------------
RButtonWin:
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
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 [RMenuW],0
mcall 70,fiIni
@ -35,6 +64,16 @@ RButtonWin:
mov [RBUser],eax
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:
mcall 12,1 ;RedrawWinBeg
@ -44,11 +83,19 @@ RBWRedraw:
mov ecx,[MouseY]
shl ecx,16
mov cx,[RMenuH]
mov edx,0177CCFFh
mov edx,01000000h
mov esi,01000000h
xor eax,eax
int 40h
and ebx,0FFFFh ;ä®­®¢ë© ¯àאַ㣮«ì­¨ª
inc bx
and ecx,0FFFFh
inc cx
mcall 13,,,[sc.work]
cmp [SelIcon],-1 ;¥á«¨ ª«¨ª ¯® ¨ª®­ª¥, â® ¯ã­ªâë ¯®«ì§®¢ â¥«ï ­¥ ­ã¦­ë
jne .NoDrawUserBut
;-----------
mov ecx,[NumUserButt]
.DrawUB:
@ -57,14 +104,15 @@ RBWRedraw:
mov eax,[NumUserButt]
sub eax,ecx
mov edx,eax ;button ID
or edx,60000000h
shl eax,4+16 ;*16*10000h
mov ecx,eax
mov cx,16
xor ebx,ebx
mov bx,[RMenuW]
mov esi,[sc.work] ;[RBMenuColor];0888888h
mcall 8
mov esi,[sc.work]
mcall 8 ;®¯à¥¤¥«¨«¨
mov ebx,50000h
shr ecx,16
@ -76,44 +124,58 @@ RBWRedraw:
mov eax,[NumUserButt]
sub eax,[esp]
mov edx,[RBUser+eax*8]
mcall 4
mcall 4 ;¯®¤¯¨á «¨
pop ecx
loop .DrawUB
;-----------
.NoDrawUserBut:
;®¯à¥¤¥«¥­¨¥ ª­®¯®ª ¤«ï ¨ª®­®ª
xor ebx,ebx
mov bx,[RMenuW]
mov cx,[RMenuH]
sub cx,[RMenuHsb]
push ecx
mov dx,cx
shl ecx,16
mov cx,dx
;¯¥à¢ ï à §¤¥«¨â¥«ì­ ï «¨­¨ï
; mcall 38,,,[RBMenuColor];0888888h
mcall 38,,,[sc.work]
add ecx,00010001h
mcall ,,,
;------------
mov ecx,[esp]
add ecx,2
xor eax,eax
cmp [SelIcon],-1
jne @f
mov eax,[NumUserButt]
@@:
shl eax,4
mov cx,ax
shl ecx,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 bx,word[esp]
add bx,2+5
mov bx,ax
add bx,5
mcall 4,,80000000h,RMenuRedrawFon
add ebx,16
mcall ,,,RMenuAlign
@ -127,52 +189,19 @@ RBWRedraw:
mov edx,RMenuOnMoving
.RBWR1:
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
je @f
; mcall 8,,,idbRDel,[RBMenuColor];0888888h
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
mcall ,,,RMenuDel
add bx,16
mcall ,, ,RMenuProp
jmp .endRM
mcall ,,,RMenuProp
jmp .endRM2
@@:
; mcall 8,,,idbRAdd,[RBMenuColor];0888888h
mcall 8,,,idbRAdd,[sc.work]
mov ebx,50000h
mov bx,word[esp]
add bx,16*3+4+5
mcall 4,,80000000h,RMenuAdd
.endRM:
mcall ,,,RMenuAdd
.endRM2:
pop ecx
mcall 12,2 ;RedrawWinEnd
@ -218,21 +247,40 @@ RBWButton:
jmp RBWExit
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
test eax,111b
jz RBWMessages
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]
je RBWMessages
call ClickInWin
jc RBWMessages
RBWExit:
mcall 68,13,[RBUser]
@ -309,6 +357,26 @@ RBWSetActivWin:
mcall 18,3,[slotDlgAdd]
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
local posX:WORD,\
@ -458,19 +526,6 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
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] ;®¯à¥¤¥«ï¥¬ è¨à¨­ã ¬¥­î
xor eax,eax
or ecx,-1
@ -510,7 +565,6 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
mov [RBUser+ebx*8+8],edi
inc [NumUserButt]
add [RMenuH],16
pop edi esi ebx
mov eax,1