📄 keywords.asm
字号:
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKBOLD
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
push eax
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETITEMDATA,eax,0
pop edx
xor eax,01000000h
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_SETITEMDATA,edx,eax
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKITALIC
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
push eax
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETITEMDATA,eax,0
pop edx
xor eax,02000000h
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_SETITEMDATA,edx,eax
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKRCFILE
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
push eax
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETITEMDATA,eax,0
pop edx
xor eax,10000000h
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_SETITEMDATA,edx,eax
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKEXPAND
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKAUTOINDENT
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKHILITELINE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_CHKHILITECMNT
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.elseif eax==IDC_BTNCODEFONT
mov edx,hCFnt
.if !edx
mov edx,hFont
.endif
invoke GetObject,edx,sizeof lf,addr lf
invoke RtlZeroMemory,addr cf,sizeof cf
mov cf.lStructSize,sizeof cf
mov eax,hWin
mov cf.hwndOwner,eax
lea eax,lf
mov cf.lpLogFont,eax
mov cf.Flags,CF_SCREENFONTS or CF_INITTOLOGFONTSTRUCT
invoke ChooseFont,addr cf
.if eax
invoke CreateFontIndirect,addr lf
mov hCFnt,eax
invoke SendDlgItemMessage,hWin,IDC_STCCODEFONT,WM_SETFONT,hCFnt,TRUE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.endif
.elseif eax==IDC_BTNLNRFONT
mov edx,hLFnt
.if !edx
mov edx,hLnrFont
.endif
invoke GetObject,edx,sizeof lf,addr lf
invoke RtlZeroMemory,addr cf,sizeof cf
mov cf.lStructSize,sizeof cf
mov eax,hWin
mov cf.hwndOwner,eax
lea eax,lf
mov cf.lpLogFont,eax
mov cf.Flags,CF_SCREENFONTS or CF_INITTOLOGFONTSTRUCT
invoke ChooseFont,addr cf
.if eax
invoke CreateFontIndirect,addr lf
mov hLFnt,eax
invoke SendDlgItemMessage,hWin,IDC_STCLNRFONT,WM_SETFONT,hLFnt,TRUE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.endif
.endif
.elseif edx==EN_CHANGE
.if eax==IDC_EDTKW
invoke SendDlgItemMessage,hWin,IDC_EDTKW,WM_GETTEXTLENGTH,0,0
.if eax
mov eax,TRUE
.endif
mov edx,eax
mov eax,IDC_BTNADD
call EnButton
.elseif eax==IDC_EDTTABSIZE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.endif
.elseif edx==LBN_SELCHANGE
.if eax==IDC_LSTKWCOLORS
invoke SaveKeyWordList,hWin,IDC_LSTKWACTIVE,nKWInx
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
invoke SetKeyWordList,hWin,IDC_LSTKWACTIVE,eax
invoke GetDlgItem,hWin,IDC_BTNHOLD
invoke EnableWindow,eax,FALSE
invoke GetDlgItem,hWin,IDC_BTNDEL
invoke EnableWindow,eax,FALSE
.elseif eax==IDC_LSTKWACTIVE
invoke SendDlgItemMessage,hWin,IDC_LSTKWACTIVE,LB_GETSELCOUNT,0,0
.if eax
mov eax,TRUE
.endif
push eax
mov edx,eax
mov eax,IDC_BTNHOLD
call EnButton
pop edx
mov eax,IDC_BTNDEL
call EnButton
.elseif eax==IDC_LSTKWHOLD
invoke SendDlgItemMessage,hWin,IDC_LSTKWHOLD,LB_GETSELCOUNT,0,0
.if eax
mov eax,TRUE
.endif
mov edx,eax
mov eax,IDC_BTNACTIVE
call EnButton
.endif
.elseif edx==LBN_DBLCLK
.if eax==IDC_LSTKWCOLORS
mov cc.lStructSize,sizeof CHOOSECOLOR
mov eax,hWin
mov cc.hwndOwner,eax
mov eax,hInstance
mov cc.hInstance,eax
mov cc.lpCustColors,offset CustColors
mov cc.Flags,CC_FULLOPEN or CC_RGBINIT
mov cc.lCustData,0
mov cc.lpfnHook,0
mov cc.lpTemplateName,0
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETITEMDATA,eax,0
push eax
;Mask off group/font
and eax,0FFFFFFh
mov cc.rgbResult,eax
invoke ChooseColor,addr cc
pop ecx
.if eax
push ecx
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_GETCURSEL,0,0
pop ecx
mov edx,cc.rgbResult
;Group/Font
and ecx,0FF000000h
or edx,ecx
invoke SendDlgItemMessage,hWin,IDC_LSTKWCOLORS,LB_SETITEMDATA,eax,edx
invoke GetDlgItem,hWin,IDC_LSTKWCOLORS
invoke InvalidateRect,eax,NULL,FALSE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.endif
.elseif eax==IDC_LSTKWACTIVE
invoke SendDlgItemMessage,hWin,IDC_LSTKWACTIVE,LB_GETCURSEL,0,0
.if eax!=LB_ERR
mov edx,eax
invoke SendDlgItemMessage,hWin,IDC_LSTKWACTIVE,LB_GETTEXT,edx,addr buffer
invoke SetDlgItemText,hWin,IDC_EDTKW,addr buffer
.endif
.elseif eax==IDC_LSTKWHOLD
invoke SendDlgItemMessage,hWin,IDC_LSTKWHOLD,LB_GETCURSEL,0,0
.if eax!=LB_ERR
mov edx,eax
invoke SendDlgItemMessage,hWin,IDC_LSTKWHOLD,LB_GETTEXT,edx,addr buffer
invoke SetDlgItemText,hWin,IDC_EDTKW,addr buffer
.endif
.elseif eax==IDC_LSTCOLORS
mov cc.lStructSize,sizeof CHOOSECOLOR
mov eax,hWin
mov cc.hwndOwner,eax
mov eax,hInstance
mov cc.hInstance,eax
mov cc.lpCustColors,offset CustColors
mov cc.Flags,CC_FULLOPEN or CC_RGBINIT
mov cc.lCustData,0
mov cc.lpfnHook,0
mov cc.lpTemplateName,0
invoke SendDlgItemMessage,hWin,IDC_LSTCOLORS,LB_GETCURSEL,0,0
invoke SendDlgItemMessage,hWin,IDC_LSTCOLORS,LB_GETITEMDATA,eax,0
push eax
;Mask off font
and eax,0FFFFFFh
mov cc.rgbResult,eax
invoke ChooseColor,addr cc
pop ecx
.if eax
push ecx
invoke SendDlgItemMessage,hWin,IDC_LSTCOLORS,LB_GETCURSEL,0,0
pop ecx
mov edx,cc.rgbResult
;Font
and ecx,0FF000000h
or edx,ecx
invoke SendDlgItemMessage,hWin,IDC_LSTCOLORS,LB_SETITEMDATA,eax,edx
invoke GetDlgItem,hWin,IDC_LSTCOLORS
invoke InvalidateRect,eax,NULL,FALSE
mov eax,IDC_BTNKWAPPLY
mov edx,TRUE
call EnButton
.endif
.endif
.endif
.elseif eax==WM_DRAWITEM
push esi
mov esi,lParam
assume esi:ptr DRAWITEMSTRUCT
test [esi].itemState,ODS_SELECTED
.if ZERO?
push COLOR_WINDOW
mov eax,COLOR_WINDOWTEXT
.else
push COLOR_HIGHLIGHT
mov eax,COLOR_HIGHLIGHTTEXT
.endif
invoke GetSysColor,eax
invoke SetTextColor,[esi].hdc,eax
pop eax
invoke GetSysColor,eax
invoke SetBkColor,[esi].hdc,eax
invoke ExtTextOut,[esi].hdc,0,0,ETO_OPAQUE,addr [esi].rcItem,NULL,0,NULL
mov eax,[esi].rcItem.left
inc eax
mov rect.left,eax
add eax,25
mov rect.right,eax
mov eax,[esi].rcItem.top
inc eax
mov rect.top,eax
mov eax,[esi].rcItem.bottom
dec eax
mov rect.bottom,eax
mov eax,[esi].itemData
and eax,0FFFFFFh
invoke CreateSolidBrush,eax
mov hBr,eax
invoke FillRect,[esi].hdc,addr rect,hBr
invoke DeleteObject,hBr
invoke GetStockObject,BLACK_BRUSH
invoke FrameRect,[esi].hdc,addr rect,eax
invoke SendMessage,[esi].hwndItem,LB_GETTEXT,[esi].itemID,addr buffer
invoke lstrlen,addr buffer
mov edx,[esi].rcItem.left
add edx,30
invoke TextOut,[esi].hdc,edx,[esi].rcItem.top,addr buffer,eax
assume esi:nothing
pop esi
.elseif eax==WM_CLOSE
mov hCFnt,0
mov hLFnt,0
invoke EndDialog,hWin,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
EnButton:
push edx
invoke GetDlgItem,hWin,eax
pop edx
invoke EnableWindow,eax,edx
retn
Update:
invoke GetDlgItem,hWin,IDC_BTNKWAPPLY
invoke IsWindowEnabled,eax
.if eax
mov eax,IDC_BTNKWAPPLY
xor edx,edx
call EnButton
invoke SaveKeyWordList,hWin,IDC_LSTKWACTIVE,nKWInx
invoke SaveKeyWordList,hWin,IDC_LSTKWHOLD,16
invoke UpdateKeyWords,hWin
invoke GetDlgItemInt,hWin,IDC_EDTTABSIZE,NULL,FALSE
mov edopt.tabsize,eax
invoke IsDlgButtonChecked,hWin,IDC_CHKEXPAND
mov edopt.exptabs,eax
invoke IsDlgButtonChecked,hWin,IDC_CHKAUTOINDENT
mov edopt.indent,eax
invoke IsDlgButtonChecked,hWin,IDC_CHKHILITELINE
mov edopt.hiliteline,eax
invoke IsDlgButtonChecked,hWin,IDC_CHKHILITECMNT
mov edopt.hilitecmnt,eax
push edi
mov edi,offset col
xor eax,eax
@@:
push eax
invoke SendDlgItemMessage,hWin,IDC_LSTCOLORS,LB_GETITEMDATA,eax,0
mov [edi],eax
pop eax
inc eax
add edi,4
cmp edi,offset col+sizeof col
jc @b
pop edi
.if hCFnt
invoke DeleteObject,hFont
invoke DeleteObject,hIFont
invoke GetObject,hCFnt,sizeof lfnt,offset lfnt
mov eax,hCFnt
mov hFont,eax
mov lfnt.lfItalic,TRUE
invoke CreateFontIndirect,offset lfnt
mov hIFont,eax
mov lfnt.lfItalic,FALSE
; invoke UpdateAll,WM_SETFONT
invoke RegSetValueEx,hReg,addr szCodeFont,0,REG_BINARY,addr lfnt,sizeof lfnt
mov hCFnt,0
.endif
.if hLFnt
invoke DeleteObject,hLnrFont
invoke GetObject,hLFnt,sizeof lfntlnr,offset lfntlnr
mov eax,hLFnt
mov hLnrFont,eax
; invoke UpdateAll,WM_SETFONT
invoke RegSetValueEx,hReg,addr szLnrFont,0,REG_BINARY,addr lfntlnr,sizeof lfntlnr
mov hLFnt,0
.endif
invoke UpdateAll,WM_SETFONT
invoke UpdateToolColors
invoke RegSetValueEx,hReg,addr szEditOpt,0,REG_BINARY,addr edopt,sizeof edopt
invoke RegSetValueEx,hReg,addr szColor,0,REG_BINARY,addr col,sizeof col
invoke RegSetValueEx,hReg,addr szCustColors,0,REG_BINARY,addr CustColors,sizeof CustColors
.endif
retn
KeyWordsProc endp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -