📄 dlgedit.asm
字号:
mov SizeRect.right,eax
mov eax,pt.y
add SizeRect.bottom,eax
mov eax,SizeRect.bottom
sub eax,SizeRect.top
invoke SizeY,1
add eax,SizeRect.top
mov SizeRect.bottom,eax
.endif
invoke DlgDrawRect,hReSize,addr SizeRect,1,0
mov eax,SizeRect.right
sub eax,SizeRect.left
mov pt.x,eax
mov eax,SizeRect.bottom
sub eax,SizeRect.top
mov pt.y,eax
invoke DialogTltSize,pt.x,pt.y
.endif
.endif
xor eax,eax
ret
.endif
.endif
invoke CallWindowProc,OldSizeingProc,hWin,uMsg,wParam,lParam
ret
SizeingProc endp
DrawSizeingItem proc uses edi,xP:DWORD,yP:DWORD,nInx:DWORD,hCur:DWORD,hPar:DWORD,fLocked:DWORD
LOCAL hWin:HWND
mov eax,nInx
shl eax,2
mov edi,offset hSizeing
add edi,eax
mov eax,[edi]
.if eax
invoke DestroyWindow,eax
.endif
invoke GetWindowLong,hDEd,DEWM_MEMORY
.if eax!=0 && fLocked==FALSE
push (DLGHEAD ptr [eax]).locked
pop fLocked
.endif
invoke GetWindowLong,hDEd,DEWM_READONLY
.if eax
mov fLocked,TRUE
.endif
.if fLocked
mov hCur,NULL
.endif
.if hCur
invoke CreateWindowEx,0,
addr szStaticClass,0,
WS_CHILD or WS_VISIBLE or SS_WHITERECT or WS_BORDER or SS_NOTIFY,
xP,yP,6,6,
hPar,0,hInstance,0
.else
invoke CreateWindowEx,0,
addr szStaticClass,0,
WS_CHILD or WS_VISIBLE or SS_GRAYRECT or WS_BORDER or SS_NOTIFY or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,
xP,yP,6,6,
hPar,0,hInstance,0
.endif
mov hWin,eax
mov [edi],eax
mov eax,nInx
shl eax,16
or eax,hCur
invoke SetWindowLong,hWin,GWL_USERDATA,eax
invoke SetWindowLong,hWin,GWL_WNDPROC,offset SizeingProc
mov OldSizeingProc,eax
invoke SetWindowPos,hWin,HWND_TOP,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
ret
DrawSizeingItem endp
DrawMultiSelItem proc xP:DWORD,yP:DWORD,hPar:HWND,fLocked:DWORD,hPrv:HWND
LOCAL hWin:HWND
.if !fLocked
mov edx,WS_CHILD or WS_CLIPSIBLINGS or WS_VISIBLE or SS_WHITERECT or WS_BORDER
.else
mov edx,WS_CHILD or WS_CLIPSIBLINGS or WS_VISIBLE or SS_GRAYRECT or WS_BORDER
.endif
invoke CreateWindowEx,0,addr szStaticClass,0,edx,xP,yP,6,6,hPar,0,hInstance,0
mov hWin,eax
invoke SetWindowLong,hWin,GWL_USERDATA,hPrv
invoke SetWindowPos,hWin,HWND_TOP,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
mov eax,hWin
ret
DrawMultiSelItem endp
DestroyMultiSel proc hSel:HWND
.if hSel
invoke GetParent,hSel
push eax
mov eax,8
.while eax
push eax
invoke GetWindowLong,hSel,GWL_USERDATA
push eax
invoke DestroyWindow,hSel
pop hSel
pop eax
dec eax
.endw
pop eax
.endif
mov eax,hSel
ret
DestroyMultiSel endp
MultiSelRect proc uses ebx,hWin:HWND,fLocked:DWORD
LOCAL rect:RECT
LOCAL ctlrect:RECT
LOCAL pt:POINT
LOCAL hSel:HWND
mov hSel,0
mov ebx,hMultiSel
.while ebx
invoke GetParent,ebx
.if eax==hWin
invoke DestroyMultiSel,ebx
mov ebx,eax
.if hSel
invoke SetWindowLong,hSel,GWL_USERDATA,ebx
.else
mov hMultiSel,ebx
.endif
xor ebx,ebx
.else
mov ecx,8
.while ecx
push ecx
mov hSel,ebx
invoke GetWindowLong,ebx,GWL_USERDATA
mov ebx,eax
pop ecx
dec ecx
.endw
.endif
.endw
mov ParPt.x,0
mov ParPt.y,0
invoke ClientToScreen,hWin,addr ParPt
invoke GetWindowRect,hWin,addr rect
invoke CopyRect,addr CtlRect,addr rect
mov eax,ParPt.x
sub rect.left,eax
sub rect.right,eax
mov eax,ParPt.y
sub rect.top,eax
sub rect.bottom,eax
invoke CopyRect,addr ctlrect,addr rect
sub rect.right,6
sub rect.bottom,6
mov eax,rect.right
sub eax,rect.left
shr eax,1
add eax,rect.left
mov pt.x,eax
mov eax,rect.bottom
sub eax,rect.top
shr eax,1
add eax,rect.top
mov pt.y,eax
invoke DrawMultiSelItem,rect.left,rect.top,hWin,fLocked,hMultiSel
invoke DrawMultiSelItem,pt.x,rect.top,hWin,fLocked,eax
invoke DrawMultiSelItem,rect.right,rect.top,hWin,fLocked,eax
invoke DrawMultiSelItem,rect.left,pt.y,hWin,fLocked,eax
invoke DrawMultiSelItem,rect.right,pt.y,hWin,fLocked,eax
invoke DrawMultiSelItem,rect.left,rect.bottom,hWin,fLocked,eax
invoke DrawMultiSelItem,pt.x,rect.bottom,hWin,fLocked,eax
invoke DrawMultiSelItem,rect.right,rect.bottom,hWin,fLocked,eax
mov hMultiSel,eax
invoke SendMessage,hDEd,WM_LBUTTONDOWN,0,0
ret
MultiSelRect endp
SizeingRect proc uses esi,hWin:HWND,fLocked:DWORD
LOCAL fDlg:DWORD
LOCAL rect:RECT
LOCAL ctlrect:RECT
LOCAL pt:POINT
LOCAL hPar:HWND
invoke GetWindowLong,hWin,GWL_USERDATA
mov esi,eax
.if fLocked!=99
.while hMultiSel
invoke DestroyMultiSel,hMultiSel
mov hMultiSel,eax
.endw
mov eax,hWin
mov hReSize,eax
.endif
mov fDlg,FALSE
mov eax,(DIALOG ptr [esi]).ntype
.if !eax
mov fDlg,TRUE
.elseif eax==18 || eax==19
test [esi].DIALOG.style,CCS_NORESIZE
.if ZERO?
mov fLocked,TRUE
.endif
.endif
invoke FetchParent,hWin
mov hPar,eax
mov ParPt.x,0
mov ParPt.y,0
invoke ClientToScreen,hPar,addr ParPt
invoke GetWindowRect,hWin,addr rect
mov eax,(DIALOG ptr [esi]).ntype
.if eax==7 || eax==8 || eax==24
mov eax,(DIALOG ptr [esi]).ccy
add eax,rect.top
mov rect.bottom,eax
.endif
invoke CopyRect,addr CtlRect,addr rect
mov eax,ParPt.x
sub rect.left,eax
sub rect.right,eax
mov eax,ParPt.y
sub rect.top,eax
sub rect.bottom,eax
invoke CopyRect,addr ctlrect,addr rect
sub rect.left,6
sub rect.top,6
mov eax,rect.right
sub eax,rect.left
shr eax,1
add eax,rect.left
mov pt.x,eax
mov eax,rect.bottom
sub eax,rect.top
shr eax,1
add eax,rect.top
mov pt.y,eax
.if fLocked!=99
.if fDlg
invoke DrawSizeingItem,rect.left,rect.top,0,0,hPar,fLocked
invoke DrawSizeingItem,pt.x,rect.top,1,0,hPar,fLocked
invoke DrawSizeingItem,rect.right,rect.top,2,0,hPar,fLocked
invoke DrawSizeingItem,rect.left,pt.y,3,0,hPar,fLocked
invoke DrawSizeingItem,rect.left,rect.bottom,5,0,hPar,fLocked
.else
invoke DrawSizeingItem,rect.left,rect.top,0,IDC_SIZENWSE,hPar,fLocked
invoke DrawSizeingItem,pt.x,rect.top,1,IDC_SIZENS,hPar,fLocked
invoke DrawSizeingItem,rect.right,rect.top,2,IDC_SIZENESW,hPar,fLocked
invoke DrawSizeingItem,rect.left,pt.y,3,IDC_SIZEWE,hPar,fLocked
invoke DrawSizeingItem,rect.left,rect.bottom,5,IDC_SIZENESW,hPar,fLocked
.endif
invoke DrawSizeingItem,rect.right,pt.y,4,IDC_SIZEWE,hPar,fLocked
invoke DrawSizeingItem,pt.x,rect.bottom,6,IDC_SIZENS,hPar,fLocked
invoke DrawSizeingItem,rect.right,rect.bottom,7,IDC_SIZENWSE,hPar,fLocked
.endif
mov eax,ctlrect.left
sub ctlrect.right,eax
mov eax,ctlrect.top
sub ctlrect.bottom,eax
.if !fDlg
invoke UpdateSize,hWin,ctlrect.left,ctlrect.top,ctlrect.right,ctlrect.bottom
.endif
.if fLocked!=99
invoke PropertyList,hWin
invoke SendMessage,hDEd,WM_LBUTTONDOWN,0,0
.endif
ret
SizeingRect endp
SnapToGrid proc uses edi,hWin:HWND,lpRect:DWORD
LOCAL hPar:HWND
.if fSnapToGrid
mov edi,lpRect
invoke FetchParent,hWin
mov hPar,eax
mov ParPt.x,0
mov ParPt.y,0
invoke ClientToScreen,hPar,addr ParPt
mov eax,(RECT ptr [edi]).left
sub eax,ParPt.x
cdq
idiv Gridcx
imul Gridcx
add eax,ParPt.x
sub eax,(RECT ptr [edi]).left
add (RECT ptr [edi]).left,eax
add (RECT ptr [edi]).right,eax
mov eax,(RECT ptr [edi]).right
sub eax,(RECT ptr [edi]).left
cdq
idiv Gridcx
imul Gridcx
add eax,(RECT ptr [edi]).left
inc eax
mov (RECT ptr [edi]).right,eax
mov eax,(RECT ptr [edi]).top
sub eax,ParPt.y
cdq
idiv Gridcy
imul Gridcy
add eax,ParPt.y
sub eax,(RECT ptr [edi]).top
add (RECT ptr [edi]).top,eax
add (RECT ptr [edi]).bottom,eax
mov eax,(RECT ptr [edi]).bottom
sub eax,(RECT ptr [edi]).top
cdq
idiv Gridcy
imul Gridcy
add eax,(RECT ptr [edi]).top
inc eax
mov (RECT ptr [edi]).bottom,eax
.endif
ret
SnapToGrid endp
MoveingRect proc uses esi edi,hWin:HWND,lParam:LPARAM,nFun:DWORD,nInx:DWORD
LOCAL pt:POINT
LOCAL ptold:POINT
LOCAL hPar:HWND
invoke GetWindowRect,hWin,addr CtlRect
invoke GetWindowLong,hWin,GWL_USERDATA
.if eax
mov esi,eax
mov eax,(DIALOG ptr [esi]).ntype
.if eax==7 || eax==24
mov eax,(DIALOG ptr [esi]).ccy
add eax,CtlRect.top
mov CtlRect.bottom,eax
.endif
mov eax,lParam
and eax,0FFFFh
cwde
mov pt.x,eax
mov eax,lParam
shr eax,16
cwde
mov pt.y,eax
mov edi,nInx
shl edi,4
add edi,offset SizeRect
.if nFun==0
mov eax,(DIALOG ptr [esi]).ntype
.if eax
mov fMoveing,TRUE
mov eax,pt.x
mov MousePtDown.x,eax
mov eax,pt.y
mov MousePtDown.y,eax
invoke DlgDrawRect,hWin,addr CtlRect,0,nInx
invoke CopyRect,edi,addr CtlRect
.endif
.elseif nFun==1
mov eax,pt.x
sub eax,MousePtDown.x
mov pt.x,eax
mov eax,pt.y
sub eax,MousePtDown.y
mov pt.y,eax
push (RECT ptr [edi]).left
pop ptold.x
push (RECT ptr [edi]).top
pop ptold.y
invoke CopyRect,edi,addr CtlRect
mov eax,pt.x
add (RECT ptr [edi]).left,eax
add (RECT ptr [edi]).right,eax
mov eax,pt.y
add (RECT ptr [edi]).top,eax
add (RECT ptr [edi]).bottom,eax
invoke SnapToGrid,hWin,edi
mov eax,(RECT ptr [edi]).left
mov edx,(RECT ptr [edi]).top
.if eax!=ptold.x || edx!=ptold.y
invoke DlgDrawRect,hWin,edi,1,nInx
.endif
invoke FetchParent,hWin
mov hPar,eax
mov ParPt.x,0
mov ParPt.y,0
invoke ClientToScreen,hPar,addr ParPt
mov eax,(RECT ptr [edi]).left
sub eax,ParPt.x
mov ParPt.x,eax
mov eax,(RECT ptr [edi]).top
sub eax,ParPt.y
mov ParPt.y,eax
.elseif nFun==2
invoke DlgDrawRect,hWin,edi,2,nInx
invoke ShowWindow,hTlt,SW_HIDE
invoke FetchParent,hWin
mov hPar,eax
mov ParPt.x,0
mov ParPt.y,0
invoke ClientToScreen,hPar,addr ParPt
mov eax,(RECT ptr [edi]).left
sub eax,ParPt.x
mov pt.x,eax
mov eax,(RECT ptr [edi]).top
sub eax,ParPt.y
mov pt.y,eax
mov fMoveing,FALSE
invoke ReleaseCapture
invoke SetWindowPos,hWin,0,pt.x,pt.y,0,0,SWP_NOZORDER or SWP_NOSIZE
.endif
.endif
ret
MoveingRect endp
CtlMultiSelect proc hWin:HWND,lParam:LPARAM
.if hReSize
invoke GetWindowLong,hReSize,GWL_USERDATA
mov eax,(DIALOG ptr [eax]).ntype
.if eax && eax!=18 && eax!=19
mov eax,hReSize
.if eax!=hWin
push eax
invoke DestroySizeingRect
pop eax
invoke MultiSelRect,eax,TRUE
invoke MultiSelRect,hWin,FALSE
.endif
.endif
xor eax,eax
ret
.endif
.if hMultiSel
invoke GetParent,hMultiSel
.if eax==hWin
invoke DestroyMultiSel,hMultiSel
mov hMultiSel,eax
invoke GetParent,eax
push eax
invoke DestroyMultiSel,hMultiSel
mov hMultiSel,eax
pop eax
.if hMultiSel
invoke MultiSelRect,eax,FALSE
.else
mov fNoMouseUp,TRUE
invoke SizeingRect,eax,FALSE
.endif
xor eax,eax
ret
.else
push eax
invoke DestroyMultiSel,hMultiSel
mov hMultiSel,eax
pop eax
invoke MultiSelRect,eax,TRUE
.endif
.endif
invoke MultiSelRect,hWin,FALSE
ret
CtlMultiSelect endp
GetMnuPopup proc uses ebx esi,lpDlgMem:DWORD
LOCAL hMnu[8]:DWORD
LOCAL buffer[256]:BYTE
LOCAL buffer1[32]:BYTE
mov hMnu,0
mov esi,lpDlgMem
mov eax,[esi].DLGHEAD.lpmnu
.if eax
mov esi,eax
add esi,sizeof MNUHEAD
mov edx,MnuInx
inc edx
@@:
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax!=-1
mov eax,(MNUITEM ptr [esi]).level
.if !eax
dec edx
.if !edx
Nx:
add esi,sizeof MNUITEM
mov eax,(MNUITEM ptr [esi]).level
.if eax
dec eax
lea ebx,[hMnu+eax*4]
mov eax,[ebx]
.if !eax
invoke CreatePopupMenu
mov [ebx],eax
.endif
mov al,(MNUITEM ptr [esi]).itemcaption
.if al=='-'
invoke AppendMenu,[ebx],MF_SEPARATOR,0,0
.else
mov buffer1,VK_TAB
invoke MnuSaveAccel,[esi].MNUITEM.shortcut,addr buffer1[1]
invoke lstrcpy,addr buffer,addr (MNUITEM ptr [esi]).itemcaption
.if buffer1[1]
invoke lstrcat,addr buffer,addr buffer1
.endif
push esi
call GetNextLevel
pop esi
mov edx,(MNUITEM ptr [esi]).level
mov ecx,(MNUITEM ptr [esi]).nstate
or ecx,MF_STRING
.if eax>edx
push ecx
invoke CreatePopupMenu
mov [ebx+4],eax
pop ecx
or ecx,MF_POPUP
invoke AppendMenu,[ebx],ecx,[ebx+4],addr buffer
.elseif eax==edx
invoke AppendMenu,[ebx],ecx,(MNUITEM ptr [esi]).itemid,addr buffer
.elseif eax
invoke AppendMenu,[ebx],ecx,(MNUITEM ptr [esi]).itemid,addr buffer
mov dword ptr [ebx],0
.else
invoke AppendMenu,[ebx],ecx,(MNUITEM ptr [esi]).itemid,addr buffer
.endif
.endif
jmp Nx
.endif
.endif
.endif
.endif
add esi,sizeof MNUITEM
jmp @b
.endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -