⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 raresed.asm

📁 汇编资源编辑器
💻 ASM
📖 第 1 页 / 共 2 页
字号:
.386
.model flat,stdcall
option casemap:none

include Data.inc
include RAGrid.inc
includelib ..\Lib\RAGrid.lib
include ..\RAResEd.inc
include Style.inc
include Misc.asm
include DlgEdit.asm
include MenuEdit.asm
include VersionEdit.asm
include IncludeEdit.asm
include ResourceEdit.asm
include StringEdit.asm
include AccelEdit.asm
include NameEdit.asm
include ToolBox.asm
include Property.asm
include ParseRC.asm
include Project.asm

.data

bmiMakeBitmap		BITMAPINFO <<SIZEOF BITMAPINFOHEADER,,,1,32,BI_RGB>,>

.code

CreateGridBrush proc uses ebx esi edi
	LOCAL	hDC:HDC
	LOCAL	hBit:DWORD
	LOCAL	pBits:DWORD
	LOCAL	clr:DWORD
	LOCAL	bline:DWORD

	mov		eax,Gridc
	shr		eax,24
	mov		bline,eax
	mov		eax,Gridc
	xchg	al,ah	;ABDC
	ror		eax,16	;DCAB
	xchg	al,ah	;DCBA
	ror		eax,8	;ADCB
	and		eax,0FFFFFFh
	mov		clr,eax
	mov		eax,hGridBr
	.if eax
		invoke DeleteObject,eax
	.endif
	invoke CreateCompatibleDC,NULL
	mov		hDC,eax
	mov		eax,Gridcx
	mov		ecx,eax
	.while ecx<8
		add		ecx,eax
	.endw
	mov		eax,Gridcy
	mov		edx,eax
	.while edx<8
		add		edx,eax
	.endw
	mov		bmiMakeBitmap.bmiHeader.biWidth,ecx
	mov		bmiMakeBitmap.bmiHeader.biHeight,edx
	invoke CreateDIBSection,hDC,addr bmiMakeBitmap,DIB_RGB_COLORS,addr pBits,0,0
	mov		hBit,eax
	invoke GdiFlush
	invoke GetSysColor,COLOR_BTNFACE
	xchg	al,ah	;ABDC
	ror		eax,16	;DCAB
	xchg	al,ah	;DCBA
	ror		eax,8	;ADCB
	mov		edx,bmiMakeBitmap.bmiHeader.biWidth
	mov		ecx,bmiMakeBitmap.bmiHeader.biHeight
	imul	ecx,edx						; total pixel count
	mov		edi,pBits
	shl		edx,2						; bytes per line
	rep stosd							; fill bitmap with COLOR_BTNFACE
	mov		ecx,Gridcy
	sub		edi,edx						; start on last line
	imul	ecx,edx
	shr		edx,2						; pixels per line
	mov		ebx,clr
	.if bline
		push	edi
		.while edi>pBits
			mov		eax,edx
		@@:	dec		eax							; next horizontal dot in grid
			mov		dword ptr [edi+eax*4],ebx	; pixel for grid dot
			jne		@b
			sub		edi,ecx
		.endw
		pop		edi
		lea		ecx,[edx*4]
		.while edi>pBits
			sub		edi,ecx
			mov		eax,edx
		@@:	mov		dword ptr [edi+eax*4],ebx	; pixel for grid dot
			sub		eax,Gridcx					; next horizontal dot in grid
			jns		@b
		.endw
	.else
		.while edi>pBits
			mov		eax,edx
		@@:	sub		eax,Gridcx					; next horizontal dot in grid
			mov		dword ptr [edi+eax*4],ebx	; pixel for grid dot
			jg		@b
			sub		edi,ecx
		.endw
	.endif
	invoke DeleteDC,hDC
	mov		edi,hBit
	invoke CreatePatternBrush,edi
	mov		hGridBr,eax
	invoke DeleteObject,edi
	ret

CreateGridBrush endp

ToolTipProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	ps:PAINTSTRUCT
	LOCAL	buffer[32]:BYTE

	mov		eax,uMsg
	.if eax==WM_PAINT
		invoke BeginPaint,hWin,addr ps
		invoke FillRect,ps.hdc,addr ps.rcPaint,hBrTlt
		invoke SendMessage,hWin,WM_GETFONT,0,0
		invoke SelectObject,ps.hdc,eax
		push	eax
		invoke SetBkMode,ps.hdc,TRANSPARENT
		invoke SendMessage,hWin,WM_GETTEXT,sizeof buffer,addr buffer
		invoke TextOut,ps.hdc,0,0,addr buffer,eax
		pop		eax
		invoke SelectObject,ps.hdc,eax
		invoke EndPaint,hWin,addr ps
		xor		eax,eax
		ret
	.endif
	invoke CallWindowProc,OldToolTipProc,hWin,uMsg,wParam,lParam
	ret

ToolTipProc endp

ResEdInstall proc hInst:DWORD
	LOCAL	wc:WNDCLASSEX

    push    hInst
    pop     hInstance
	mov		wc.cbSize,sizeof WNDCLASSEX
IFDEF DLL
	mov		wc.style,CS_GLOBALCLASS or CS_HREDRAW or CS_VREDRAW
ELSE
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
ENDIF
	mov		wc.lpfnWndProc,offset DlgEditProc
	mov		wc.cbClsExtra,0
	;0=hDialog, 4=hMem, 8=ReadOnly
	;12=ScrollX, 16=ScrollY, 20=lpProjectItem
	mov		wc.cbWndExtra,24
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,COLOR_WINDOW+1
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset szDlgEditClass
	mov		wc.hIcon,NULL
	mov		wc.hIconSm,NULL
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr wc

	mov		wc.cbSize,sizeof WNDCLASSEX
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
	mov		wc.lpfnWndProc,offset EditDlgProc
	mov		wc.cbClsExtra,0
	mov		wc.cbWndExtra,0
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,NULL
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset szDlgChildClass
	mov		wc.hIcon,NULL
	mov		wc.hIconSm,NULL
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr wc

	mov		wc.cbSize,sizeof WNDCLASSEX
IFDEF DLL
	mov		wc.style,CS_GLOBALCLASS or CS_HREDRAW or CS_VREDRAW
ELSE
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
ENDIF
	mov		wc.lpfnWndProc,offset ToolBoxProc
	mov		wc.cbClsExtra,0
	mov		wc.cbWndExtra,0
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,COLOR_BTNFACE+1
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset	szToolBoxClass
	mov		wc.hIcon,0
	mov		wc.hIconSm,0
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr	wc

	mov		wc.cbSize,sizeof WNDCLASSEX
IFDEF DLL
	mov		wc.style,CS_GLOBALCLASS or CS_HREDRAW or CS_VREDRAW
ELSE
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
ENDIF
	mov		wc.lpfnWndProc,offset PropertyProc
	mov		wc.cbClsExtra,0
	mov		wc.cbWndExtra,4
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,COLOR_BTNFACE+1
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset	szPropertyClass
	mov		wc.hIcon,0
	mov		wc.hIconSm,0
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr	wc

	mov		wc.cbSize,sizeof WNDCLASSEX
IFDEF DLL
	mov		wc.style,CS_GLOBALCLASS or CS_HREDRAW or CS_VREDRAW
ELSE
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
ENDIF
	mov		wc.lpfnWndProc,offset ProjectProc
	mov		wc.cbClsExtra,0
	;0=hMem
	mov		wc.cbWndExtra,4
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,COLOR_BTNFACE+1
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset	szProjectClass
	mov		wc.hIcon,0
	mov		wc.hIconSm,0
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr	wc

	mov		wc.cbSize,sizeof WNDCLASSEX
	mov		wc.style,CS_HREDRAW or CS_VREDRAW
	mov		wc.lpfnWndProc,offset DesignDummyProc
	mov		wc.cbClsExtra,0
	mov		wc.cbWndExtra,0
	push	hInstance
	pop		wc.hInstance
	mov		wc.hbrBackground,NULL
	mov		wc.lpszMenuName,NULL
	mov		wc.lpszClassName,offset	szDlgEditDummyClass
	mov		wc.hIcon,0
	mov		wc.hIconSm,0
	invoke LoadCursor,NULL,IDC_ARROW
	mov		wc.hCursor,eax
	invoke RegisterClassEx,addr	wc

	invoke CreateSolidBrush,0E0FFFFh
	mov		hBrTlt,eax
	invoke CreateGridBrush
	invoke ResEdDo_ImageList,hInstance,IDB_MNUARROW,16,4,0,0C0C0C0h,0
	mov		hMnuIml,eax
	invoke ResEdDo_ImageList,hInstance,IDB_PROTRV,16,7,0,0FFFFFFh,0
	mov		hPrjIml,eax
	ret

ResEdInstall endp

ResEdUninstall proc

;	invoke DestroyWindow,hTlt
	invoke DestroyWindow,hToolTip
	invoke DeleteObject,hBrTlt
	invoke DeleteObject,hGridBr
	invoke ImageList_Destroy,hMnuIml
	invoke ImageList_Destroy,hPrjIml
	ret

ResEdUninstall endp

ToolBoxProc	proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	pt:POINT
	LOCAL	rect:RECT

	mov		eax,uMsg
	.if eax==WM_CREATE
		push	hWin
		pop		hTlb
		invoke Do_ToolBox,hWin
	.elseif eax==WM_MOUSEMOVE
		.if hStatus
			invoke SendMessage,hStatus,SB_SETTEXT,nStatus,offset szNULL
		.endif
	.elseif	eax==WM_SIZE
		mov		eax,lParam
		movzx	edx,ax
		shr		eax,16
		mov		pt.x,edx
		mov		pt.y,eax
		invoke ToolBoxSize,pt.x
	.elseif eax==WM_USER+9999
		invoke GetClientRect,hWin,addr rect
		mov		eax,rect.right
		mov		edx,rect.bottom
		shl		edx,16
		movzx	eax,ax
		or		eax,edx
		invoke SendMessage,hWin,WM_SIZE,SIZE_RESTORED,eax
		xor		eax,eax
		jmp		Ex
	.endif
	invoke DefWindowProc,hWin,uMsg,wParam,lParam
  Ex:
	ret

ToolBoxProc	endp

ProjectProc	proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	pt:POINT
	LOCAL	rect:RECT

	mov		eax,uMsg
	.if eax==WM_CREATE
		push	hWin
		pop		hPrj
		invoke Do_Project,hWin
	.elseif eax==WM_DESTROY
		invoke SendMessage,hWin,PRO_CLOSE,0,0
	.elseif eax==WM_MOUSEMOVE
		.if hStatus
			invoke SendMessage,hStatus,SB_SETTEXT,nStatus,offset szNULL
		.endif
	.elseif	eax==WM_SIZE
		mov		eax,lParam
		movzx	edx,ax
		shr		eax,16
		mov		pt.x,edx
		mov		pt.y,eax
		invoke ProjectSize,pt.x,pt.y
	.elseif eax==PRO_OPEN
		invoke SendMessage,hWin,PRO_CLOSE,0,0
		invoke OpenProject,wParam,lParam
		invoke SetWindowLong,hWin,0,eax
		jmp		Ex
	.elseif eax==PRO_CLOSE
		invoke GetWindowLong,hWin,0
		.if eax
			invoke CloseProject,eax
		.endif
		invoke SetWindowLong,hWin,0,0
		jmp		Ex
	.elseif eax==PRO_EXPORT
		invoke GetWindowLong,hWin,0
		.if eax
			invoke ExportProject,lParam,eax
		.endif
		jmp		Ex
	.elseif eax==PRO_GETMODIFY
		invoke GetWindowLong,hWin,0
		.if eax
			invoke GetProjectModify,eax
		.endif
		jmp		Ex
	.elseif eax==PRO_SETMODIFY
		invoke GetWindowLong,hWin,0
		.if eax
			invoke SetProjectModify,eax,wParam
		.endif
		jmp		Ex
	.elseif eax==PRO_GETSELECTED
		invoke GetProjectSelected
		jmp		Ex
	.elseif eax==PRO_ADDITEM
		invoke GetWindowLong,hWin,0
		.if eax
			invoke AddProjectItem,eax,wParam,lParam
		.endif
		jmp		Ex
	.elseif eax==PRO_DELITEM
		invoke RemoveProjectSelected
		jmp		Ex
	.elseif eax==PRO_CANUNDO
		invoke ProjectCanUndo
		jmp		Ex
	.elseif eax==PRO_UNDODELETED
		invoke ProjectUndoDeleted
		jmp		Ex
	.elseif eax==PRO_SETNAME
		invoke SetProjectItemName,NULL,wParam
		.if lParam
			invoke lstrcpy,offset szProjectPath,lParam
			invoke SetCurrentDirectory,offset szProjectPath
		.endif
		jmp		Ex
	.elseif eax==PRO_SHOWNAMES
		invoke GetWindowLong,hWin,0
		.if eax
			mov		eax,lParam
			mov		hExportOut,eax
			invoke DialogBoxParam,hInstance,IDD_DLGNAMES,hPrj,offset NameEditProc,NULL
		.endif
		jmp		Ex
	.elseif eax==PRO_SETEXPORT
		mov		eax,wParam
		mov		nExportType,eax
		.if lParam
			invoke lstrcpy,offset szExportFileName,lParam
		.endif
		xor		eax,eax
		jmp		Ex
	.elseif eax==WM_USER+9999
		invoke GetClientRect,hWin,addr rect
		mov		eax,rect.right
		mov		edx,rect.bottom
		shl		edx,16
		movzx	eax,ax
		or		eax,edx
		invoke SendMessage,hWin,WM_SIZE,SIZE_RESTORED,eax
		xor		eax,eax
		jmp		Ex
	.endif
	invoke DefWindowProc,hWin,uMsg,wParam,lParam
  Ex:
	ret

ProjectProc	endp

DlgEditProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	pt:POINT
	LOCAL	sinf:SCROLLINFO
	LOCAL	rect:RECT
	LOCAL	ps:PAINTSTRUCT

	mov		eax,uMsg
	.if eax==WM_CREATE
		push	hWin
		pop		hDEd
		invoke GetWindowLong,hWin,GWL_STYLE
		mov		edx,eax
		and		eax,1
		mov		fGrid,eax
		shr		edx,1
		mov		eax,edx
		and		eax,1
		mov		fSnapToGrid,eax
		shr		edx,1
		mov		eax,edx
		and		eax,1
		mov		fShowSizePos,eax
		;Fake tooltip
		invoke CreateWindowEx,0,addr szStaticClass,0,WS_POPUP or WS_BORDER or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or SS_OWNERDRAW,0,0,0,0,hWin,0,hInstance,0
		mov		hTlt,eax
		invoke SetWindowLong,hTlt,GWL_WNDPROC,addr ToolTipProc
		mov		OldToolTipProc,eax
	.elseif eax==WM_SIZE
		mov		eax,lParam
		movzx	edx,ax
		shr		eax,16
		mov		pt.x,edx
		mov		pt.y,eax
	.elseif eax==WM_MOUSEMOVE
		.if hStatus
			invoke SendMessage,hStatus,SB_SETTEXT,nStatus,offset szNULL
		.endif
	.elseif eax==WM_PAINT
		invoke BeginPaint,hWin,addr ps
		invoke GetWindowLong,hWin,DEWM_MEMORY
		.if eax
			invoke SetChanged,2,hWin
		.endif
		invoke EndPaint,hWin,addr ps
		xor		eax,eax
		ret
	.elseif eax==DEM_OPEN
		invoke SendMessage,hWin,WM_VSCROLL,SB_THUMBTRACK,0
		invoke SendMessage,hWin,WM_HSCROLL,SB_THUMBTRACK,0
		invoke GetWindowLong,hWin,DEWM_PROJECT
		invoke CreateDlg,hWin,lParam
		push	eax
		invoke NotifyParent
		pop		eax
		jmp		Ex
	.elseif eax==DEM_DELETECONTROLS
		invoke DeleteCtl
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_CANUNDO
		invoke GetWindowLong,hWin,DEWM_MEMORY
		.if eax
			mov		eax,[eax].DLGHEAD.undo
			.if eax
				mov		eax,TRUE
			.endif
		.endif
		jmp		Ex
	.elseif eax==DEM_UNDO
		invoke UndoCtl
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_CUT
		invoke CopyCtl
		invoke DeleteCtl
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_COPY
		invoke CopyCtl
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_CANPASTE
		invoke GetWindowLong,hWin,DEWM_MEMORY
		.if eax
			mov		eax,offset dlgpaste
			mov		eax,[eax].DIALOG.hwnd
			.if eax
				mov		eax,TRUE
			.endif
		.endif
		jmp		Ex
	.elseif eax==DEM_PASTE
		invoke PasteCtl
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_ISLOCKED
		invoke GetWindowLong,hWin,DEWM_MEMORY
		.if eax
			mov		eax,[eax].DLGHEAD.locked
			.if eax
				mov		eax,TRUE
			.endif
		.endif
		jmp		Ex
	.elseif eax==DEM_LOCKCONTROLS
		invoke GetWindowLong,hWin,DEWM_MEMORY
		.if eax
			push	eax
			invoke SetFocus,hWin
			pop		eax
			mov		edx,lParam
			.if edx
				mov		edx,TRUE
			.endif
			mov		[eax].DLGHEAD.locked,edx
			.if hReSize
				invoke SizeingRect,hReSize,FALSE
			.endif
			invoke SetChanged,TRUE,hWin
		.endif
		jmp		Ex
	.elseif eax==DEM_ISBACK
		invoke GetWindowLong,hWin,DEWM_DIALOG
		invoke GetWindowLong,eax,GWL_USERDATA
		push	eax
		.if hReSize
			invoke GetWindowLong,hReSize,GWL_USERDATA
		.endif
		pop		edx
		.if eax==edx
			mov		eax,TRUE
		.else
			add		edx,sizeof DIALOG
			.if eax==edx
				mov		eax,TRUE
			.else
				mov		eax,FALSE
			.endif
		.endif
		jmp		Ex
	.elseif eax==DEM_SENDTOBACK
		mov		eax,hReSize
		.if eax
			invoke GetWindowLong,eax,GWL_USERDATA
			.if eax
				.if [eax].DIALOG.ntype
					invoke SendToBack,[eax].DIALOG.hwnd
				.endif
			.endif
		.endif
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_ISFRONT
		invoke GetWindowLong,hWin,DEWM_DIALOG
		invoke GetWindowLong,eax,GWL_USERDATA
		push	eax
		.if hReSize
			invoke GetWindowLong,hReSize,GWL_USERDATA
		.endif
		pop		edx
		.if eax==edx
			mov		eax,TRUE
		.else
			add		eax,sizeof DIALOG
			mov		eax,(DIALOG ptr [eax]).hwnd
			.if eax
				mov		eax,FALSE
			.else
				mov		eax,TRUE
			.endif
		.endif
		jmp		Ex
	.elseif eax==DEM_BRINGTOFRONT
		mov		eax,hReSize
		.if eax
			invoke GetWindowLong,eax,GWL_USERDATA
			.if eax
				.if [eax].DIALOG.ntype
					invoke BringToFront,[eax].DIALOG.hwnd
				.endif
			.endif
		.endif
		invoke NotifyParent
		jmp		Ex
	.elseif eax==DEM_ISSELECTION
		xor		eax,eax
		.if hReSize
			invoke GetWindowLong,hReSize,GWL_USERDATA

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -