?? fasmw.asm
字號:
or eax,MF_BYCOMMAND
invoke CheckMenuItem,[wparam],IDM_REVIVEDEADKEYS,eax
cmp [help_path],0
sete bl
neg bl
and ebx,MF_GRAYED
or ebx,MF_BYCOMMAND
invoke EnableMenuItem,[wparam],IDM_CONTENTS,ebx
invoke EnableMenuItem,[wparam],IDM_KEYWORD,ebx
jmp finish
wmcommand:
mov eax,[wparam]
mov ebx,[lparam]
or ebx,ebx
jz menu_command
cmp ebx,[hwnd_asmedit]
jne finish
shr eax,16
cmp eax,AEN_SETFOCUS
je update_status_bar
cmp eax,AEN_TEXTCHANGE
je update_status_bar
cmp eax,AEN_POSCHANGE
je update_status_bar
cmp eax,AEN_OUTOFMEMORY
je not_enough_mem
jmp finish
update_status_bar:
invoke SendMessage,[hwnd_asmedit],AEM_GETPOS,aepos,0
cinvoke wsprintf,string_buffer,_row_column,[aepos.caretLine],[aepos.caretPosition]
invoke SendMessage,[hwnd_status],SB_SETTEXT,0,string_buffer
mov esi,_null
invoke SendMessage,[hwnd_asmedit],EM_CANUNDO,0,0
or eax,eax
jz modified_status_ok
mov esi,_modified_status
modified_status_ok:
invoke SendMessage,[hwnd_status],SB_SETTEXT,1,esi
jmp finish
not_enough_mem:
invoke SendMessage,[hwnd_asmedit],AEM_FINDFIRST,0,0
invoke MessageBox,[hwnd],_memory_error,_caption,MB_ICONERROR+MB_OK
jmp finish
menu_command:
and eax,0FFFFh
mov ebx,[hwnd_asmedit]
cmp eax,IDM_NEW
je new_file
cmp eax,IDM_OPEN
je open_file
cmp eax,IDM_SAVE
je save_file
cmp eax,IDM_SAVEAS
je save_file_as
cmp eax,IDM_NEXT
je next_file
cmp eax,IDM_PREVIOUS
je previous_file
cmp eax,IDM_OPENFOLDER
je open_folder
cmp eax,IDM_CLOSE
je close_file
cmp eax,IDM_DISCARD
je discard_file
cmp eax,IDM_EXIT
je exit
cmp eax,IDM_UNDO
je undo
cmp eax,IDM_CUT
je cut
cmp eax,IDM_COPY
je copy
cmp eax,IDM_PASTE
je paste
cmp eax,IDM_DELETE
je delete
cmp eax,IDM_SELECTALL
je select_all
cmp eax,IDM_VERTICAL
je vertical
cmp eax,IDM_POSITION
je position
cmp eax,IDM_FIND
je find
cmp eax,IDM_FINDNEXT
je findnext
cmp eax,IDM_REPLACE
je replace
cmp eax,IDM_RUN
je run
cmp eax,IDM_COMPILE
je compile
cmp eax,IDM_ASSIGN
je assign
cmp eax,IDM_APPEARANCE
je appearance
cmp eax,IDM_COMPILERSETUP
je compiler_setup
cmp eax,IDM_SECURESEL
je option_securesel
cmp eax,IDM_AUTOBRACKETS
je option_autobrackets
cmp eax,IDM_AUTOINDENT
je option_autoindent
cmp eax,IDM_SMARTTABS
je option_smarttabs
cmp eax,IDM_OPTIMALFILL
je option_optimalfill
cmp eax,IDM_REVIVEDEADKEYS
je option_revivedeadkeys
cmp eax,IDM_CONTENTS
je contents
cmp eax,IDM_KEYWORD
je keyword
cmp eax,IDM_PICKHELP
je pick_help
cmp eax,IDM_ABOUT
je about
jmp finish
new_file:
invoke SendMessage,[hwnd],FM_NEW,_untitled,0
jmp finish
open_file:
mov [ofn.lpstrFile],path_buffer
mov [path_buffer],0
mov [ofn.lpstrFilter],asm_filter
mov [ofn.Flags],OFN_EXPLORER+OFN_ALLOWMULTISELECT+OFN_FILEMUSTEXIST+OFN_HIDEREADONLY
mov [ofn.lpstrFileTitle],name_buffer
mov [ofn.lpstrTitle],NULL
invoke GetOpenFileName,ofn
or eax,eax
jz finish
test [ofn.Flags],OFN_ALLOWMULTISELECT
jz open_single_file
mov esi,path_buffer
movzx eax,[ofn.nFileOffset]
add esi,eax
mov byte [esi-1],'\'
mov edi,esi
open_chosen_files:
cmp byte [esi],0
je finish
push edi
move_file_name:
lodsb
stosb
or al,al
jnz move_file_name
pop edi
invoke GetFileTitle,path_buffer,name_buffer,100h
invoke SendMessage,[hwnd],FM_OPEN,name_buffer,path_buffer
cmp eax,-1
jne open_chosen_files
invoke wvsprintf,string_buffer,_loading_error,ofn.lpstrFile
invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK
jmp open_chosen_files
open_single_file:
invoke SendMessage,[hwnd],FM_OPEN,name_buffer,path_buffer
cmp eax,-1
jne finish
invoke wvsprintf,string_buffer,_loading_error,ofn.lpstrFile
invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK
jmp finish
save_file:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
invoke SendMessage,[hwnd],FM_SAVE,eax,0
or eax,eax
jnz save_file_as
jmp finish
save_file_as:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
mov ebx,eax
mov [ei.header.mask],TCIF_PARAM
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei
mov eax,[ei.pszpath]
or eax,eax
jnz alloc_ok
invoke VirtualAlloc,0,1000h,MEM_COMMIT,PAGE_READWRITE
mov [ei.pszpath],eax
alloc_ok:
mov [lparam],eax
mov [ofn.lpstrFile],eax
mov [ofn.lpstrFilter],asm_filter
mov [ofn.Flags],OFN_EXPLORER+OFN_HIDEREADONLY+OFN_OVERWRITEPROMPT
invoke GetSaveFileName,ofn
or eax,eax
jz save_cancelled
mov [ei.header.pszText],name_buffer
mov [ei.header.mask],TCIF_TEXT+TCIF_PARAM
invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,ebx,ei
invoke SendMessage,[hwnd],FM_SAVE,ebx,0
xor esi,esi
check_if_overwritten:
cmp esi,ebx
je not_overwritten
mov [ei.header.mask],TCIF_PARAM
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,esi,ei
or eax,eax
jz save_ok
invoke lstrcmpi,[ei.pszpath],[lparam]
or eax,eax
jz remove_overwritten
not_overwritten:
inc esi
jmp check_if_overwritten
remove_overwritten:
invoke VirtualFree,[ei.pszpath],0,MEM_RELEASE
invoke SendMessage,[hwnd_tabctrl],TCM_DELETEITEM,esi,0
cmp [assigned_file],-1
je save_ok
cmp esi,[assigned_file]
ja save_ok
je assigned_overwritten
dec [assigned_file]
jmp save_ok
assigned_overwritten:
mov [assigned_file],-1
save_ok:
xor eax,eax
jmp finish
save_cancelled:
mov eax,[lparam]
xchg eax,[ei.pszpath]
cmp eax,[ei.pszpath]
je finish
invoke VirtualFree,eax,0,MEM_RELEASE
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,eax,ei
jmp finish
next_file:
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0
mov ebx,eax
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
inc eax
cmp eax,ebx
jb select_file
xor eax,eax
select_file:
push eax
invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,eax,0
pop eax
invoke SendMessage,[hwnd],FM_SELECT,eax,0
jmp finish
previous_file:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
sub eax,1
jnc select_file
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0
dec eax
call select_file
jmp select_file
open_folder:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,eax,ei
or eax,eax
jz finish
mov eax,[ei.pszpath]
or eax,eax
jz finish
invoke GetFullPathName,eax,1000h,path_buffer,param_buffer
mov edi,[param_buffer]
xor al,al
stosb
invoke ShellExecute,HWND_DESKTOP,NULL,path_buffer,NULL,NULL,SW_SHOWNORMAL
jmp finish
close_file:
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0
cmp eax,1
jbe close_window
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
mov ebx,eax
mov [ei.header.mask],TCIF_PARAM+TCIF_TEXT
mov [ei.header.pszText],name_buffer
mov [ei.header.cchTextMax],100h
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei
mov eax,[ei.hwnd]
mov [wparam],eax
invoke SendMessage,eax,EM_CANUNDO,0,0
or eax,eax
jnz close_modified
cmp [ei.pszpath],0
jne do_close
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0
cmp eax,1
jne do_close
jmp failed
close_modified:
mov eax,MB_ICONQUESTION+MB_YESNOCANCEL
or eax,[lparam]
invoke MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax
cmp eax,IDCANCEL
je failed
cmp eax,IDNO
je do_close
invoke SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0
or eax,eax
jnz failed
do_close:
cmp [ei.pszpath],0
je delete_tab
invoke VirtualFree,[ei.pszpath],0,MEM_RELEASE
delete_tab:
invoke SendMessage,[hwnd_tabctrl],TCM_DELETEITEM,ebx,0
cmp ebx,[assigned_file]
jg tab_deleted
je assigned_deleted
dec [assigned_file]
jmp tab_deleted
assigned_deleted:
mov [assigned_file],-1
tab_deleted:
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0
dec eax
cmp eax,ebx
jge select_next
sub ebx,1
jnc select_next
invoke SendMessage,[hwnd],FM_NEW,_untitled,0
jmp destroy_asmedit
select_next:
invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0
invoke SendMessage,[hwnd],FM_SELECT,ebx,0
destroy_asmedit:
invoke DestroyWindow,[wparam]
xor eax,eax
jmp finish
discard_file:
mov [lparam],MB_DEFBUTTON2
jmp close_file
exit:
mov [lparam],0
jmp close_window
undo:
invoke SendMessage,ebx,WM_UNDO,0,0
jmp finish
cut:
invoke SendMessage,ebx,WM_CUT,0,0
jmp finish
copy:
invoke SendMessage,ebx,WM_COPY,0,0
jmp finish
paste:
invoke SendMessage,ebx,WM_PASTE,0,0
jmp finish
delete:
invoke SendMessage,ebx,WM_CLEAR,0,0
jmp finish
select_all:
mov [aepos.selectionLine],1
mov [aepos.selectionPosition],1
mov [aepos.caretLine],-1
mov [aepos.caretPosition],1
invoke SendMessage,ebx,AEM_SETPOS,aepos,0
invoke SendMessage,ebx,AEM_GETPOS,aepos,0
invoke SendMessage,ebx,AEM_GETLINELENGTH,[aepos.caretLine],0
inc eax
mov [aepos.caretPosition],eax
invoke SendMessage,ebx,AEM_SETPOS,aepos,0
jmp finish
vertical:
invoke SendMessage,ebx,AEM_GETMODE,0,0
xor eax,AEMODE_VERTICALSEL
invoke SendMessage,ebx,AEM_SETMODE,eax,0
jmp finish
position:
invoke DialogBoxParam,[hinstance],IDD_POSITION,[hwnd],PositionDialog,0
jmp finish
find:
invoke DialogBoxParam,[hinstance],IDD_FIND,[hwnd],FindDialog,0
or eax,eax
jz finish
invoke SendMessage,ebx,AEM_FINDFIRST,[search_settings],search_string
or eax,eax
jnz finish
not_found:
invoke MessageBox,[hwnd],_not_found,_caption,MB_ICONINFORMATION+MB_OK
jmp finish
findnext:
invoke SendMessage,ebx,AEM_FINDNEXT,0,0
or eax,eax
jz not_found
jmp finish
replace:
invoke DialogBoxParam,[hinstance],IDD_REPLACE,[hwnd],ReplaceDialog,0
or eax,eax
jz finish
invoke SendMessage,ebx,AEM_FINDFIRST,[search_settings],search_string
or eax,eax
jz not_found
invoke SendMessage,ebx,AEM_GETMODE,0,0
push eax
and eax,not (AEMODE_VERTICALSEL + AEMODE_OVERWRITE)
invoke SendMessage,ebx,AEM_SETMODE,eax,0
.confirm_replace:
test [command_flags],CF_REPLACEPROMPT
jz .replace
invoke UpdateWindow,edi
invoke MessageBox,[hwnd],_replace_prompt,_caption,MB_ICONQUESTION+MB_YESNOCANCEL
cmp eax,IDCANCEL
je .replace_finish
cmp eax,IDNO
je .replace_next
.replace:
push ebx edi
invoke SendMessage,ebx,EM_REPLACESEL,FALSE,replace_string
pop edi ebx
.replace_next:
invoke SendMessage,ebx,AEM_FINDNEXT,0,0
or eax,eax
jnz .confirm_replace
.replace_finish:
pop eax
invoke SendMessage,ebx,AEM_SETMODE,eax,0
jmp finish
run:
invoke SendMessage,[hwnd],FM_COMPILE,0,FALSE
or eax,eax
jnz finish
mov [sinfo.cb],sizeof.STARTUPINFO
mov [sinfo.dwFlags],0
cmp [output_format],3
ja run_object
invoke CreateProcess,path_buffer,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,sinfo,pinfo
invoke CloseHandle,[pinfo.hThread]
invoke CloseHandle,[pinfo.hProcess]
jmp finish
run_object:
invoke MessageBox,[hwnd],_run_object_error,_caption,MB_ICONERROR+MB_OK
jmp finish
compile:
invoke SendMessage,[hwnd],FM_COMPILE,0,TRUE
jmp finish
assign:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
cmp eax,[assigned_file]
jne do_assign
or eax,-1
do_assign:
invoke SendMessage,[hwnd],FM_ASSIGN,eax,0
jmp finish
appearance:
invoke DialogBoxParam,[hinstance],IDD_APPEARANCE,[hwnd],AppearanceSetup,0
or eax,eax
jnz update
jmp finish
compiler_setup:
invoke DialogBoxParam,[hinstance],IDD_COMPILERSETUP,[hwnd],CompilerSetup,0
jmp finish
option_securesel:
xor [asmedit_style],AES_SECURESEL
jmp update
option_autobrackets:
xor [asmedit_style],AES_AUTOBRACKETS
jmp update
option_autoindent:
xor [asmedit_style],AES_AUTOINDENT
jmp update
option_smarttabs:
xor [asmedit_style],AES_SMARTTABS
jmp update
option_optimalfill:
xor [asmedit_style],AES_OPTIMALFILL
jmp update
option_revivedeadkeys:
xor [asmedit_style],AES_REVIVEDEADKEYS
jmp update
contents:
call get_help_file_extension
cmp eax,'.hlp'
je winhelp_contents
call check_htmlhelp
jc winhelp_contents
invoke HtmlHelp,[hwnd],help_path,HH_DISPLAY_TOPIC,0
jmp finish
winhelp_contents:
invoke WinHelp,[hwnd],help_path,HELP_FINDER,0
jmp finish
get_help_file_extension:
mov esi,help_path
skip_help_path:
lodsb
or al,al
jnz skip_help_path
mov ebx,characters
dec esi
mov ecx,4
convert_extension:
dec esi
shl eax,8
mov al,[esi]
xlatb
loop convert_extension
retn
check_htmlhelp:
cmp [HtmlHelp],0
jne htmlhelp_ok
invoke LoadLibrary,_htmlhelp_library
or eax,eax
jz htmlhelp_unavailable
invoke GetProcAddress,eax,_htmlhelp_api
or eax,eax
jz htmlhelp_unavailable
mov [HtmlHelp],eax
htmlhelp_ok:
clc
retn
htmlhelp_unavailable:
stc
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -