Fixed bugs. Upgraded the menu.

git-svn-id: svn://kolibrios.org@4082 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2013-10-24 19:29:45 +00:00
parent 6ba7bf3033
commit 91a8bed3bd
2 changed files with 313 additions and 160 deletions

View File

@ -847,15 +847,15 @@ local posX:WORD,\
ret
@@:
xor ebx,ebx
mov ebx,[NumIconI]
mov ebx,ecx
dec ebx
.TestIcon:
cmp dword[NumIconI],-1
je @f
cmp ebx,[NumIconI]
jne @f
inc ebx
dec ebx
dec ecx
test ecx,ecx
jz .NoIcon
@ -903,12 +903,12 @@ local posX:WORD,\
jmp .OkIcon
@@:
inc ebx
dec ebx
pop ecx
;loop .TestIcon
dec ecx
jnz .TestIcon
loop .TestIcon
;dec ecx
;jnz .TestIcon
jmp .NoIcon
.OkIcon:
mov eax,ebx
@ -1220,10 +1220,12 @@ secRButt db 'rbmenu',0
PredItem dd -1
if lang eq ru
RMenuOffMoving db '‡ ªà¥¯¨âì ¨ª®­ª¨',0
RMenuOnMoving db 'Žâªà¥¯¨âì ¨ª®­ª¨',0
RMenuRedrawFon db '<27>¥à¥à¨á®¢ âì',0
RMenuAlign db '‚ë஢­ïâì ¯® á¥âª¥',0
RMenuOffMoving db '‡ ªà¥¯¨âì ¨ª®­ª¨',0
RMenuOnMoving db 'Žâªà¥¯¨âì ¨ª®­ª¨',0
RMenuAdd db '„®¡ ¢¨âì',0
RMenuDel db '“¤ «¨âì',0
RMenuProp db '‘¢®©á⢠',0
@ -1391,8 +1393,6 @@ slotDlgAdd rd 1
DlgBufImg rb IMG_SIZE*IMG_SIZE*3
bufStdIco rb 40
IconsOffs rd 100
PIcoDB rd 1
@ -1406,9 +1406,11 @@ strip_file_size rd 1
cur_band_compensation rd 1
;---- RButton -----------------------------------------------------------------------
MinRMenuW rd 1
bufIni rb 40
NumUserButt rd 1
RBUser rd 16*2+1
NumMenuButt rd 1
RBMenuCP rd MAX_USER_BUTTONS*2 ;㪠§ â¥«¨ ­  ¯®¤¯¨áì ¨ ¯ãâì á ¯à®£®© (Caption(dd), Path(dd)) ¨ § ¯ á­®© (dd) ¤«ï § ¢¥àè î饣® ­ã«ï
RMenuW rw 1
RMenuH rw 1

View File

@ -1,20 +1,25 @@
if lang eq ru
MinRMenuW equ 18*6+10
else
MinRMenuW equ 15*6+10
end if
idbRRedrawFon equ 100
idbRAlign equ 101
idbRFixIcons equ 102
idbRAdd equ 103
idbRDel equ 104
idbRProp equ 105
;idbRRedrawFon equ 100
;idbRAlign equ 101
;idbRFixIcons equ 102
;idbRAdd equ 103
;idbRDel equ 104
;idbRProp equ 105
DELTA_COLOR equ 70
COLOR_SEL_BUT equ 00F7092Dh
MAX_USER_BUTTONS equ 30
;---- thread for rbutton -----------------------------------------------------------------------
RButtonWin:
if lang eq ru
mov [MinRMenuW],18*6+10
else
mov [MinRMenuW],15*6+10
end if
mcall 40,100101b ;SetMaskMessage 100101b
mcall 48,3,sc,40
@ -57,32 +62,90 @@ RButtonWin:
stdcall GetNumIcon,[MouseX],[MouseY],-1
mov [SelIcon],eax
mov [NumUserButt],0
mov [RMenuW],0
;¢ëáâ ¢«ï¥¬ ¯¥à¢®­ ç «ì­ë¥ §­ ç¥­¨ï
m2m [RMenuW],[MinRMenuW]
cmp [SelIcon],-1
jne .RBW1
;----------- ¥á«¨ ª«¨ª ­¥ ¯® ¨ª®­ª¥ ------------------------------------------------
mov [NumMenuButt],0
mcall 70,fiIni
mcall 68,12,dword[bufIni+32]
mov [RBUser],eax
mcall 68,12,dword[bufIni+32] ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¯®¤¯¨á¥© ¨ ¯ã⥩ § ¯ã᪠
mov [RBMenuCP],eax ;GetUserBut ¡¥àñâ ®âá ¯¥à¢®­ ç «ì­ë© 㪠§ â¥«ì ­  ¯ ¬ïâì
stdcall [ini_enum_keys],IconIni,secRButt,GetUserBut
mov ebx,[NumMenuButt]
add [NumMenuButt],4
mov [RBMenuCP+ebx*8],RMenuRedrawFon
mov [RBMenuCP+ebx*8+8],RMenuAlign
cmp [bFixIcons],1
je @f
mov [RBMenuCP+ebx*8+16],RMenuOffMoving
jmp .RBW11
@@:
mov [RBMenuCP+ebx*8+16],RMenuOnMoving
.RBW11:
mov [RBMenuCP+ebx*8+24],RMenuAdd
mov [RBMenuCP+ebx*8+4],0
mov [RBMenuCP+ebx*8+8+4],0
mov [RBMenuCP+ebx*8+16+4],0
mov [RBMenuCP+ebx*8+24+4],0
jmp .RBW2
;----------- ¥á«¨ ª«¨ª ¯® ¨ª®­ª¥ ------------------------------------------------
.RBW1:
xor ebx,ebx
mov [NumMenuButt],5
mov [RBMenuCP+ebx*8],RMenuRedrawFon
mov [RBMenuCP+ebx*8+8],RMenuAlign
cmp [bFixIcons],1
je @f
mov [RBMenuCP+ebx*8+16],RMenuOffMoving
jmp .RBW21
@@:
mov [RBMenuCP+ebx*8+16],RMenuOnMoving
.RBW21:
mov [RBMenuCP+ebx*8+24],RMenuDel
mov [RBMenuCP+ebx*8+32],RMenuProp
mov [RBMenuCP+ebx*8+4],0
mov [RBMenuCP+ebx*8+8+4],0
mov [RBMenuCP+ebx*8+16+4],0
mov [RBMenuCP+ebx*8+24+4],0
mov [RBMenuCP+ebx*8+32+4],0
;-------------------------------------------------------------------------------
.RBW2:
cmp [SelIcon],-1
jne @f
mov [RMenuH],16*4
mov eax,[NumUserButt]
mov eax,[NumMenuButt]
shl eax,4
add [RMenuH],ax
mov [RMenuH],ax
jmp .rbw1
@@:
mov [RMenuH],16*5
.rbw1:
add [RMenuW],3 ;­  à ¬ªã
add [RMenuH],3 ;­  à ¬ªã
RBWRedraw:
mcall 12,1 ;RedrawWinBeg
mov ebx,[MouseX]
shl ebx,16
mov bx,[RMenuW]
mov ecx,[MouseY]
shl ecx,16
mov cx,[RMenuH]
mov edx,01000000h
mov esi,01000000h
xor eax,eax
@ -94,16 +157,14 @@ RBWRedraw:
inc cx
mcall 13,,,[sc.work]
cmp [SelIcon],-1 ;¥á«¨ ª«¨ª ¯® ¨ª®­ª¥, â® ¯ã­ªâë ¯®«ì§®¢ â¥«ï ­¥ ­ã¦­ë
jne .NoDrawUserBut
;-----------
mov ecx,[NumUserButt]
;----------- ®¯à¥¤¥«ï¥¬ ¨ à¨á㥬 ª­®¯ª¨
mov ecx,[NumMenuButt]
.DrawUB:
push ecx
mov eax,[NumUserButt]
mov eax,[NumMenuButt]
sub eax,ecx
mov edx,eax ;button ID
mov edx,eax ;button ID = ®â 0 ¤® NumMenuButt
or edx,60000000h
shl eax,4+16 ;*16*10000h
mov ecx,eax
@ -114,97 +175,65 @@ RBWRedraw:
mov esi,[sc.work]
mcall 8 ;®¯à¥¤¥«¨«¨
mov ebx,50000h
mov ebx,70000h
shr ecx,16
mov bx,cx
add bx,5
add bx,7
mov ecx,80000000h
mov eax,[NumUserButt]
mov eax,[NumMenuButt]
sub eax,[esp]
mov edx,[RBUser+eax*8]
mov edx,[RBMenuCP+eax*8]
mcall 4 ;¯®¤¯¨á «¨
pop ecx
loop .DrawUB
;---------------
;-----------
.NoDrawUserBut:
;®¯à¥¤¥«¥­¨¥ ª­®¯®ª ¤«ï ¨ª®­®ª
; ®¡à ¬«ïî騩 ¯àאַ㣮«ì­¨ª
xor ebx,ebx ;¢¥àå
mov bx,[RMenuW]
xor ecx,ecx
mcall 38,,,[sc.workL]
mov bx,[RMenuW] ;¯à ¢®
shl ebx,16
mov bx,[RMenuW]
xor ecx,ecx
mov cx,[RMenuH]
mcall
xor ebx,ebx ;­¨§
mov bx,[RMenuW]
mov cx,[RMenuH]
shl ecx,16
mov cx,[RMenuH]
mcall
xor ebx,ebx ;«¥¢®
xor ecx,ecx
mov cx,[RMenuH]
mcall
; ᢥâ«ë© «¥¢ë© ¢¥àå­¨© 㣮«
xor ebx,ebx
mov bx,[RMenuW]
add ebx,1*10000h-1
mov ecx,00010001h
mcall ,,,[sc.workH]
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,,,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,ax
add bx,5
mcall 4,,80000000h,RMenuRedrawFon
add ebx,16
mcall ,,,RMenuAlign
add ebx,16
cmp [bFixIcons],0
jne @f
mov edx,RMenuOffMoving
jmp .RBWR1
@@:
mov edx,RMenuOnMoving
.RBWR1:
mov ebx,00010001h
xor ecx,ecx
mov cx,[RMenuH]
add ecx,1*10000h-1
mcall
add ebx,16
cmp dword[SelIcon],-1
je @f
mcall ,,,RMenuDel
add bx,16
mcall ,,,RMenuProp
jmp .endRM2
@@:
mcall ,,,RMenuAdd
.endRM2:
pop ecx
;ª®­¥æ à¨á®¢ ­¨ï
mcall 12,2 ;RedrawWinEnd
;-------------------------------------------------------------------
mcall 9,RBProcInfo,-1 ;GetThreadInfo RBProcInfo,-1
mcall 18,21,dword[RBProcInfo+30]
@ -223,67 +252,86 @@ RBWMessages:
RBWButton:
mcall 17 ;GetButtonPressed
shr eax,8
cmp eax,idbRRedrawFon
mov ebx,eax
mov eax,[RBMenuCP+ebx*8+4] ;¥á«¨ ᤥáì 0, â® ª«¨ª ¯® áâ ­¤ àâ­®© ª­®¯ª¥(ª®â®à ï ­¥ ¢ ini)
test eax,eax
jnz .RBWB
mov eax,[RBMenuCP+ebx*8] ;ᬮâਬ, 㪠§ â¥«ì ­  ª ªãî ­ ¤¯¨áì ¢ ¯®¤¯¨á¨
cmp eax,RMenuRedrawFon ; ¨ ¯® ­¥© ¢ë¡¨à ¥¬ ¤¥©á⢨¥
jz RBRedrawFon
cmp eax,idbRAlign
cmp eax,RMenuAlign
jz RBAlign
cmp eax,idbRFixIcons
cmp eax,RMenuOffMoving
jz RBFixIcons
cmp eax,idbRAdd
cmp eax,RMenuOnMoving
jz RBFixIcons
cmp eax,RMenuAdd
jz RBAdd
cmp eax,idbRDel
cmp eax,RMenuDel
jz RBDelete
cmp eax,idbRProp
cmp eax,RMenuProp
jz RBPropeties
cmp eax,[NumUserButt]
ja @f
mov eax,[RBUser+eax*8+4]
jmp RBWExit
.RBWB:
mov dword[fiRunProg+8],0
mov dword[fiRunProg+21],eax
mcall 70,fiRunProg
@@:
jmp RBWExit
RBWMouse:
cmp [PredItem],-1
call MouseInWin
jnc .RBWMnoInWin ;¥á«¨ ¢­¥ ®ª­ , â® ¯à®áâ® ¢®ááâ ­ ¢«¨¢ ¥¬ ¯à¥¤ë¤ãéãî ª­®¯ªã
mcall 37,1 ;¯®«®¦¥­¨¥ ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
and eax,0FFF0h ;­ã¦¥­ ⮫쪮 Y, ¯à¨çñ¬ ®ªà㣫ñ­­ë© ¤® ¢¥àå­¥© â®çª¨ ªà â­®© 16(¢ëá®â  ª­®¯ª¨)
cmp [PredItem],eax
je .RBWMendLightBut
shr eax,4 ;¥á«¨ ¬ëèì ­  ­¨¦­¥© à ¬ª¥, â® â ª¦¥ ⮫쪮 ¢®ááâ ­®¢¨âì ¯à¥¤ë¤ãéãî ª­®¯ªã
cmp eax,[NumMenuButt]
jae .RBWMnoInWin
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]
stdcall DrawRBLine,[PredItem],0
@@:
call ClickInWin
call MouseInWin
jnc @f
mcall 37,1 ;¯®«®¦¥­¨¥ ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
and eax,0FFF0h
and eax,0FFF0h ;­ã¦¥­ ⮫쪮 Y, ¯à¨çñ¬ ®ªà㣫ñ­­ë© ¤® ¢¥àå­¥© â®çª¨ ªà â­®© 16(¢ëá®â  ª­®¯ª¨)
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]
stdcall DrawRBLine,eax,1
@@:
jmp .RBWMendLightBut
.RBWMnoInWin:
cmp [PredItem],-1 ;¢®ááâ ­®¢«¥­¨¥ ¯à¥¤ë¤ã饩 ª­®¯ª¨
je .RBWMendLightBut
stdcall DrawRBLine,[PredItem],0
mov [PredItem],-1
.RBWMendLightBut:
mcall 37,2 ;GetMouseKey
test eax,111b
jz RBWMessages
call ClickInWin
call MouseInWin
jc RBWMessages
RBWExit:
mcall 68,13,[RBUser]
cmp [SelIcon],-1
jne @f
mcall 68,13,[RBMenuCP] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì á ¯®¤¯¨áﬨ ¨ ¯ãâﬨ ª ¯à®£ ¬
@@:
mov [RButtonActiv],0
mcall -1 ;ExitProcess
@ -328,15 +376,11 @@ RBAdd:
jmp RBWExit
RBDelete:
mov eax,[SelIcon]
mov eax,[IconsOffs+eax*4]
stdcall [ini_del_section],IconIni,eax
stdcall DelIcon,[SelIcon]
; mov dword[fiStdIco],2
; m2m dword[fInfo+12],dword[SizeData]
; mcall 70,fInfo
mov dword[fiRunProg+8],WarningSave
mov dword[fiRunProg+21],pthNotify
@ -357,7 +401,120 @@ RBWSetActivWin:
mcall 18,3,[slotDlgAdd]
jmp RBWExit
proc ClickInWin ;Carry flag = 1, ¥á«¨ ª«¨ª ¢ ®ª­¥
proc DrawRBLine y,active
xor ebx,ebx
mov bx,[RMenuW]
add ebx,2*10000h-3
mov ecx,[y]
add ecx,2
shl ecx,16
mov cx,16;-1-2
cmp [active],1
jne @f
mov edx,[sc.work_button]
jmp .L1
@@:
mov edx,[sc.work]
.L1:
mcall 13
;----------------------------------------------
xor ebx,ebx ;¢¥àå
mov bx,[RMenuW]
add ebx,2*10000h-3
mov cx,word[y]
shl ecx,16
mov cx,word[y]
add ecx,00020002h
cmp [active],1
jne @f
mov edx,[sc.workL]
jmp .L3
@@:
mov edx,[sc.work]
.L3:
mcall 38
mov ebx,00020002h ;«¥¢®
mov cx,word[y]
shl ecx,16
mov cx,word[y]
add ecx,00020002h+16
cmp [active],1
jne @f
mov edx,[sc.workL]
@@:
mcall
xor ebx,ebx ;­¨§
mov bx,[RMenuW]
add ebx,2*10000h-3
mov cx,word[y]
shl ecx,16
mov cx,word[y]
add ecx,16*10000h+16+00020002h
cmp [active],1
jne @f
mov edx,[sc.workH]
@@:
mcall
mov bx,[RMenuW] ;¯à ¢®
shl ebx,16
mov bx,[RMenuW]
add ebx,-2*10000h-2
mov cx,word[y]
shl ecx,16
mov cx,word[y]
add ecx,00020002h+16
cmp [active],1
jne @f
mov edx,[sc.workH]
@@:
mcall
mov eax,[y]
shr eax,4
mov edx,[RBMenuCP+eax*8]
xor ebx,ebx
mov ebx,[y]
add ebx,7*10000h+7
cmp [active],1
jne @f
mov ecx,[sc.work_button_text]
jmp .L2
@@:
mov ecx,[sc.work_text]
.L2:
or ecx,80000000h
mcall 4
ret
endp
proc MouseInWin ;Carry flag = 1, ¥á«¨ ª«¨ª ¢ ®ª­¥
mcall 37,0 ;GetMousePos
xor ebx,ebx
mov bx,ax ;y
@ -519,7 +676,7 @@ endp
;-------------------------------------------------------------------------------
proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
cmp [NumUserButt],16
cmp [NumMenuButt],MAX_USER_BUTTONS
jne @f
ret
@@:
@ -538,33 +695,27 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
jbe @f
mov [RMenuW],ax
@@:
cmp [RMenuW],MinRMenuW
jae @f
mov [RMenuW],MinRMenuW
@@:
mov ebx,[NumUserButt]
mov ebx,[NumMenuButt]
mov esi,[key_name]
mov edi,[RBUser+ebx*8]
mov edi,[RBMenuCP+ebx*8]
@@: lodsb
stosb
test al,al
jnz @b
;debug_newline
mov [RBUser+ebx*8+4],edi
mov [RBMenuCP+ebx*8+4],edi
mov esi,[key_value]
@@: lodsb
stosb
test al,al
jnz @b
mov [RBUser+ebx*8+8],edi
mov [RBMenuCP+ebx*8+8],edi
inc [NumUserButt]
inc [NumMenuButt]
pop edi esi ebx
mov eax,1