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 ret
@@: @@:
xor ebx,ebx mov ebx,ecx
mov ebx,[NumIconI] dec ebx
.TestIcon: .TestIcon:
cmp dword[NumIconI],-1 cmp dword[NumIconI],-1
je @f je @f
cmp ebx,[NumIconI] cmp ebx,[NumIconI]
jne @f jne @f
inc ebx dec ebx
dec ecx dec ecx
test ecx,ecx test ecx,ecx
jz .NoIcon jz .NoIcon
@ -903,12 +903,12 @@ local posX:WORD,\
jmp .OkIcon jmp .OkIcon
@@: @@:
inc ebx dec ebx
pop ecx pop ecx
;loop .TestIcon loop .TestIcon
dec ecx ;dec ecx
jnz .TestIcon ;jnz .TestIcon
jmp .NoIcon jmp .NoIcon
.OkIcon: .OkIcon:
mov eax,ebx mov eax,ebx
@ -1220,10 +1220,12 @@ secRButt db 'rbmenu',0
PredItem dd -1 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
RMenuOffMoving db '‡ ªà¥¯¨âì ¨ª®­ª¨',0
RMenuOnMoving db 'Žâªà¥¯¨âì ¨ª®­ª¨',0
RMenuAdd db '„®¡ ¢¨âì',0 RMenuAdd db '„®¡ ¢¨âì',0
RMenuDel db '“¤ «¨âì',0 RMenuDel db '“¤ «¨âì',0
RMenuProp db '‘¢®©á⢠',0 RMenuProp db '‘¢®©á⢠',0
@ -1391,8 +1393,6 @@ slotDlgAdd rd 1
DlgBufImg rb IMG_SIZE*IMG_SIZE*3 DlgBufImg rb IMG_SIZE*IMG_SIZE*3
bufStdIco rb 40 bufStdIco rb 40
IconsOffs rd 100 IconsOffs rd 100
PIcoDB rd 1 PIcoDB rd 1
@ -1406,9 +1406,11 @@ strip_file_size rd 1
cur_band_compensation rd 1 cur_band_compensation rd 1
;---- RButton ----------------------------------------------------------------------- ;---- RButton -----------------------------------------------------------------------
MinRMenuW rd 1
bufIni rb 40 bufIni rb 40
NumUserButt rd 1 NumMenuButt rd 1
RBUser rd 16*2+1 RBMenuCP rd MAX_USER_BUTTONS*2 ;㪠§ â¥«¨ ­  ¯®¤¯¨áì ¨ ¯ãâì á ¯à®£®© (Caption(dd), Path(dd)) ¨ § ¯ á­®© (dd) ¤«ï § ¢¥àè î饣® ­ã«ï
RMenuW rw 1 RMenuW rw 1
RMenuH 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 ;idbRRedrawFon equ 100
idbRAlign equ 101 ;idbRAlign equ 101
idbRFixIcons equ 102 ;idbRFixIcons equ 102
idbRAdd equ 103 ;idbRAdd equ 103
idbRDel equ 104 ;idbRDel equ 104
idbRProp equ 105 ;idbRProp equ 105
DELTA_COLOR equ 70 DELTA_COLOR equ 70
COLOR_SEL_BUT equ 00F7092Dh
MAX_USER_BUTTONS equ 30
;---- thread for rbutton ----------------------------------------------------------------------- ;---- thread for rbutton -----------------------------------------------------------------------
RButtonWin: RButtonWin:
if lang eq ru
mov [MinRMenuW],18*6+10
else
mov [MinRMenuW],15*6+10
end if
mcall 40,100101b ;SetMaskMessage 100101b mcall 40,100101b ;SetMaskMessage 100101b
mcall 48,3,sc,40 mcall 48,3,sc,40
@ -57,32 +62,90 @@ RButtonWin:
stdcall GetNumIcon,[MouseX],[MouseY],-1 stdcall GetNumIcon,[MouseX],[MouseY],-1
mov [SelIcon],eax mov [SelIcon],eax
mov [NumUserButt],0 ;¢ëáâ ¢«ï¥¬ ¯¥à¢®­ ç «ì­ë¥ §­ ç¥­¨ï
mov [RMenuW],0 m2m [RMenuW],[MinRMenuW]
cmp [SelIcon],-1
jne .RBW1
;----------- ¥á«¨ ª«¨ª ­¥ ¯® ¨ª®­ª¥ ------------------------------------------------
mov [NumMenuButt],0
mcall 70,fiIni mcall 70,fiIni
mcall 68,12,dword[bufIni+32] mcall 68,12,dword[bufIni+32] ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¯®¤¯¨á¥© ¨ ¯ã⥩ § ¯ã᪠
mov [RBUser],eax mov [RBMenuCP],eax ;GetUserBut ¡¥àñâ ®âá ¯¥à¢®­ ç «ì­ë© 㪠§ â¥«ì ­  ¯ ¬ïâì
stdcall [ini_enum_keys],IconIni,secRButt,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 cmp [SelIcon],-1
jne @f jne @f
mov [RMenuH],16*4 mov eax,[NumMenuButt]
mov eax,[NumUserButt]
shl eax,4 shl eax,4
add [RMenuH],ax mov [RMenuH],ax
jmp .rbw1 jmp .rbw1
@@: @@:
mov [RMenuH],16*5 mov [RMenuH],16*5
.rbw1: .rbw1:
add [RMenuW],3 ;­  à ¬ªã
add [RMenuH],3 ;­  à ¬ªã
RBWRedraw: RBWRedraw:
mcall 12,1 ;RedrawWinBeg mcall 12,1 ;RedrawWinBeg
mov ebx,[MouseX] mov ebx,[MouseX]
shl ebx,16 shl ebx,16
mov bx,[RMenuW] mov bx,[RMenuW]
mov ecx,[MouseY] mov ecx,[MouseY]
shl ecx,16 shl ecx,16
mov cx,[RMenuH] mov cx,[RMenuH]
mov edx,01000000h mov edx,01000000h
mov esi,01000000h mov esi,01000000h
xor eax,eax xor eax,eax
@ -94,16 +157,14 @@ RBWRedraw:
inc cx inc cx
mcall 13,,,[sc.work] mcall 13,,,[sc.work]
cmp [SelIcon],-1 ;¥á«¨ ª«¨ª ¯® ¨ª®­ª¥, â® ¯ã­ªâë ¯®«ì§®¢ â¥«ï ­¥ ­ã¦­ë ;----------- ®¯à¥¤¥«ï¥¬ ¨ à¨á㥬 ª­®¯ª¨
jne .NoDrawUserBut mov ecx,[NumMenuButt]
;-----------
mov ecx,[NumUserButt]
.DrawUB: .DrawUB:
push ecx push ecx
mov eax,[NumUserButt] mov eax,[NumMenuButt]
sub eax,ecx sub eax,ecx
mov edx,eax ;button ID mov edx,eax ;button ID = ®â 0 ¤® NumMenuButt
or edx,60000000h or edx,60000000h
shl eax,4+16 ;*16*10000h shl eax,4+16 ;*16*10000h
mov ecx,eax mov ecx,eax
@ -114,97 +175,65 @@ RBWRedraw:
mov esi,[sc.work] mov esi,[sc.work]
mcall 8 ;®¯à¥¤¥«¨«¨ mcall 8 ;®¯à¥¤¥«¨«¨
mov ebx,50000h mov ebx,70000h
shr ecx,16 shr ecx,16
mov bx,cx mov bx,cx
add bx,5 add bx,7
mov ecx,80000000h mov ecx,80000000h
mov eax,[NumUserButt] mov eax,[NumMenuButt]
sub eax,[esp] sub eax,[esp]
mov edx,[RBUser+eax*8] mov edx,[RBMenuCP+eax*8]
mcall 4 ;¯®¤¯¨á «¨ mcall 4 ;¯®¤¯¨á «¨
pop ecx pop ecx
loop .DrawUB 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 xor ebx,ebx
mov bx,[RMenuW] mov bx,[RMenuW]
add ebx,1*10000h-1
mov ecx,00010001h
mcall ,,,[sc.workH]
xor eax,eax mov ebx,00010001h
cmp [SelIcon],-1 xor ecx,ecx
jne @f mov cx,[RMenuH]
mov eax,[NumUserButt] add ecx,1*10000h-1
@@:
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:
mcall 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 12,2 ;RedrawWinEnd
;-------------------------------------------------------------------
mcall 9,RBProcInfo,-1 ;GetThreadInfo RBProcInfo,-1 mcall 9,RBProcInfo,-1 ;GetThreadInfo RBProcInfo,-1
mcall 18,21,dword[RBProcInfo+30] mcall 18,21,dword[RBProcInfo+30]
@ -223,67 +252,86 @@ RBWMessages:
RBWButton: RBWButton:
mcall 17 ;GetButtonPressed mcall 17 ;GetButtonPressed
shr eax,8 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 jz RBRedrawFon
cmp eax,idbRAlign cmp eax,RMenuAlign
jz RBAlign jz RBAlign
cmp eax,idbRFixIcons cmp eax,RMenuOffMoving
jz RBFixIcons jz RBFixIcons
cmp eax,idbRAdd cmp eax,RMenuOnMoving
jz RBFixIcons
cmp eax,RMenuAdd
jz RBAdd jz RBAdd
cmp eax,idbRDel cmp eax,RMenuDel
jz RBDelete jz RBDelete
cmp eax,idbRProp cmp eax,RMenuProp
jz RBPropeties jz RBPropeties
cmp eax,[NumUserButt] jmp RBWExit
ja @f .RBWB:
mov eax,[RBUser+eax*8+4]
mov dword[fiRunProg+8],0 mov dword[fiRunProg+8],0
mov dword[fiRunProg+21],eax mov dword[fiRunProg+21],eax
mcall 70,fiRunProg mcall 70,fiRunProg
@@:
jmp RBWExit jmp RBWExit
RBWMouse: 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 je @f
mov eax,[PredItem]
xor ebx,ebx stdcall DrawRBLine,[PredItem],0
mov bx,[RMenuW]
mov cx,ax
shl ecx,16
mov cx,ax
mcall 38,,,[sc.work]
add ecx,00100010h
mcall ,,,[sc.work]
@@: @@:
call ClickInWin
call MouseInWin
jnc @f jnc @f
mcall 37,1 ;¯®«®¦¥­¨¥ ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­  mcall 37,1 ;¯®«®¦¥­¨¥ ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
and eax,0FFF0h and eax,0FFF0h ;­ã¦¥­ ⮫쪮 Y, ¯à¨çñ¬ ®ªà㣫ñ­­ë© ¤® ¢¥àå­¥© â®çª¨ ªà â­®© 16(¢ëá®â  ª­®¯ª¨)
mov [PredItem],eax mov [PredItem],eax
xor ebx,ebx stdcall DrawRBLine,eax,1
mov bx,[RMenuW]
mov cx,ax
shl ecx,16
mov cx,ax
mcall 38,,,[sc.workL]
add ecx,00100010h
mcall ,,,[sc.workH]
@@: @@:
jmp .RBWMendLightBut
.RBWMnoInWin:
cmp [PredItem],-1 ;¢®ááâ ­®¢«¥­¨¥ ¯à¥¤ë¤ã饩 ª­®¯ª¨
je .RBWMendLightBut
stdcall DrawRBLine,[PredItem],0
mov [PredItem],-1
.RBWMendLightBut:
mcall 37,2 ;GetMouseKey mcall 37,2 ;GetMouseKey
test eax,111b test eax,111b
jz RBWMessages jz RBWMessages
call ClickInWin call MouseInWin
jc RBWMessages jc RBWMessages
RBWExit: RBWExit:
mcall 68,13,[RBUser] cmp [SelIcon],-1
jne @f
mcall 68,13,[RBMenuCP] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì á ¯®¤¯¨áﬨ ¨ ¯ãâﬨ ª ¯à®£ ¬
@@:
mov [RButtonActiv],0 mov [RButtonActiv],0
mcall -1 ;ExitProcess mcall -1 ;ExitProcess
@ -328,15 +376,11 @@ RBAdd:
jmp RBWExit jmp RBWExit
RBDelete: RBDelete:
mov eax,[SelIcon] mov eax,[SelIcon]
mov eax,[IconsOffs+eax*4] mov eax,[IconsOffs+eax*4]
stdcall [ini_del_section],IconIni,eax stdcall [ini_del_section],IconIni,eax
stdcall DelIcon,[SelIcon] stdcall DelIcon,[SelIcon]
; mov dword[fiStdIco],2
; m2m dword[fInfo+12],dword[SizeData]
; mcall 70,fInfo
mov dword[fiRunProg+8],WarningSave mov dword[fiRunProg+8],WarningSave
mov dword[fiRunProg+21],pthNotify mov dword[fiRunProg+21],pthNotify
@ -357,7 +401,120 @@ RBWSetActivWin:
mcall 18,3,[slotDlgAdd] mcall 18,3,[slotDlgAdd]
jmp RBWExit 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 mcall 37,0 ;GetMousePos
xor ebx,ebx xor ebx,ebx
mov bx,ax ;y mov bx,ax ;y
@ -519,7 +676,7 @@ endp
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
proc GetUserBut stdcall,f_name,sec_name,key_name,key_value proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
cmp [NumUserButt],16 cmp [NumMenuButt],MAX_USER_BUTTONS
jne @f jne @f
ret ret
@@: @@:
@ -538,33 +695,27 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
jbe @f jbe @f
mov [RMenuW],ax mov [RMenuW],ax
@@: @@:
cmp [RMenuW],MinRMenuW
jae @f
mov [RMenuW],MinRMenuW
@@:
mov ebx,[NumUserButt] mov ebx,[NumMenuButt]
mov esi,[key_name] mov esi,[key_name]
mov edi,[RBUser+ebx*8] mov edi,[RBMenuCP+ebx*8]
@@: lodsb @@: lodsb
stosb stosb
test al,al test al,al
jnz @b jnz @b
;debug_newline
mov [RBMenuCP+ebx*8+4],edi
mov [RBUser+ebx*8+4],edi
mov esi,[key_value] mov esi,[key_value]
@@: lodsb @@: lodsb
stosb stosb
test al,al test al,al
jnz @b jnz @b
mov [RBUser+ebx*8+8],edi mov [RBMenuCP+ebx*8+8],edi
inc [NumUserButt] inc [NumMenuButt]
pop edi esi ebx pop edi esi ebx
mov eax,1 mov eax,1