📄 filesel.asm
字号:
;
@@ds_8: test _FS_drawstate,8 ;mask list need updateing?
jz @@ds_16
mov ecx,dFILE_TYPES ;use type button details.
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;clear type box ready for printing.
;
call DialogGetButtonW ;need width for current selection
mov edi,eax
sub edi,4
call DialogGetButtonX ;need x co-ord so we know where
add eax,2 ;to start printing.
push eax
call DialogGetButtonY ;need y co-ord so we know where
add eax,2 ;to start printing.
mov ebx,eax
pop ecx
;
xor edx,edx
mov esi,maskptr ;point to list of masks.
@@ds_8_0: cmp edx,_FS_FirstMask ;found first mask yet?
jz @@ds_8_2
@@ds_8_1: lodsb
or al,al ;end of a masl yet?
jnz @@ds_8_1
inc edx ;update mask number.
jmp @@ds_8_0
;
@@ds_8_2: xor edx,edx
@@ds_8_3: cmp edx,10 ;done max print's?
jz @@ds_8_5
mov eax,edx
add eax,_FS_FirstMask ;check if we reached the end of
cmp eax,_FS_TotalMasks ;the mask list.
jge @@ds_8_5
push esi
push edi
mov edi,offset _FS_filemask ;our storage for one mask.
add esi,2 ;skip the *.
cmp b[esi],"*" ;check for *
jnz @@ds_8_4
mov esi,offset _FS_ALL ;replace list mask with "ALL"
@@ds_8_4: movsb
cmp b[esi-1],0
jnz @@ds_8_4
pop edi
;
mov eax,edx
add eax,_FS_FirstMask ;check if we're about to print
cmp eax,_FS_CurrentMask ;the currently selected mask.
jnz @@ds_8_6
;
push FontDepth ;clear area behind this mask
push edi ;so we know its selected.
push ebx
push ecx
mov al,251 ;convert "system" pen number into
call VideoSys2Hard ;real hardware value.
push eax
push 0
push _FS_window
call WinFillRectangle
add esp,4*7
;
@@ds_8_6: push ebx
push ecx ;print current mask.
push offset _FS_filemask
push SystemFont
mov al,253 ;convert "system" pen number into
call VideoSys2Hard ;real hardware value.
push eax
push 2+16 ;OR it on and use fixed spaceing.
push _FS_window
call WinPrintWindow
add esp,4*7
;
add ebx,FontDepth ;fixed spaceing for mask list.
inc edx
pop esi
@@ds_8_7: lodsb ;find the end of the mask we just
or al,al ;printed.
jnz @@ds_8_7
jmp @@ds_8_3
;
@@ds_8_5: and _FS_drawstate,not 8
;
;Display the drive list.
;
@@ds_16: test _FS_drawstate,16 ;need to update the drive list
jz @@ds_32 ;display?
mov ecx,dFILE_DRIVES
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;clear drive list box ready for
; ;printing.
call DialogGetButtonW ;need width for current selection
mov edi,eax ;highlighting.
sub edi,4
call DialogGetButtonX ;need x co-ord so we know where
add eax,2 ;to start printing.
push eax
call DialogGetButtonY ;need y co-ord so we know where
add eax,2 ;to start printing.
mov ebx,eax
pop ecx
;
mov esi,_FS_FirstDrive ;get list start position.
shl esi,1 ;2 bytes per entry.
add esi,offset _FS_drivelist ;offset into the drive list.
xor edx,edx
@@ds_16_0: cmp edx,10 ;done maximum number yet?
jz @@ds_16_5
mov eax,edx
add eax,_FS_FirstDrive ;check if we've reached the end
cmp eax,_FS_TotalDrives ;of the drive list.
jg @@ds_16_5
cmp eax,_FS_CurrentDrive ;this the currently selected drive?
jnz @@ds_16_1
;
push FontDepth
push edi ;clear area behind current drive
push ebx ;so we know it's selected.
push ecx
mov al,251 ;convert "system" pen number into
call VideoSys2Hard ;real hardware value.
push eax
push 0
push _FS_window
call WinFillRectangle
add esp,4*7
;
@@ds_16_1: push ebx
push ecx
push esi ;print current drive.
push SystemFont
mov al,253 ;convert "system" pen number into
call VideoSys2Hard ;real hardware value.
push eax
push 2+16 ;OR it on and use fixed spaceing.
push _FS_window
call WinPrintWindow
add esp,4*7
;
add esi,2
add ebx,FontDepth ;fixed spaceing for drive list.
inc edx
jmp @@ds_16_0
;
@@ds_16_5: and _FS_drawstate,not 16
;
;Display the file list UP button.
;
@@ds_32: test _FS_drawstate,32 ;need to update file list up
jz @@ds_64 ;button?
mov ecx,dFILE_FILEUP
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 32
;
;Display the file list DOWN button.
;
@@ds_64: test _FS_drawstate,64 ;need to update file list down
jz @@ds_128 ;button?
mov ecx,dFILE_FILEDOWN
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 64
;
;Display the type list UP button.
;
@@ds_128: test _FS_drawstate,128 ;need to update the type list up
jz @@ds_256 ;button?
mov ecx,dFILE_TYPEUP
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 128
;
;Display the type list down button.
;
@@ds_256: test _FS_drawstate,256 ;need to update the type list down
jz @@ds_512 ;button?
mov ecx,dFILE_TYPEDOWN
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 256
;
;Display the drive list up button.
;
@@ds_512: test _FS_drawstate,512 ;need to update the drive list up
jz @@ds_1024 ;button?
mov ecx,dFILE_DRIVEUP
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 512
;
;Display the drive list down button.
;
@@ds_1024: test _FS_drawstate,1024 ;need to update the drive list down
jz @@ds_2048 ;button?
mov ecx,dFILE_DRIVEDOWN
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 1024
;
;Display the OK button.
;
@@ds_2048: test _FS_drawstate,2048 ;need to update the OK button?
jz @@ds_4096
mov ecx,dFILE_OK
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 2048
;
;Display the cancel button.
;
@@ds_4096: test _FS_drawstate,4096 ;need to update the cancel button?
jz @@ds_8192
mov ecx,dFILE_CANCEL
mov esi,offset dFileSelector
mov edi,_FS_window
call DrawDialog ;re-draw it then.
and _FS_drawstate,not 4096
;
;Display current typed name entry.
;
@@ds_8192: test _FS_drawstate,8192 ;need to update the typed name
jz @@ds_16384 ;button?
mov ecx,dFILE_TYPED
mov esi,offset dFileSelector
mov edi,_FS_window ;clear typed name button ready
call DrawDialog ;for printing.
call DialogGetButtonX ;need the x co-ord so we know
add eax,2 ;where to start printing.
push eax
call DialogGetButtonY ;need the y co-ord so we know
add eax,2 ;where to start printing.
mov ebx,eax
pop ecx
;
cmp _FS_TypedFocus,-1 ;is typed name current focus?
jnz @@ds_8192_0
;
push FontDepth ;need to put a cursor of sorts
mov eax,FontWidth ;by the current position in the
shr eax,3 ;typed name.
push eax
push ebx
mov eax,_FS_FirstTyped ;current cursor position.
mul FontWidth ;fixed spaceing for typed name.
add eax,ecx
dec eax
push eax
mov al,1 ;convert "system" pen number into
call VideoSys2Hard ;real hardware value.
push eax
push 0
push _FS_window
call WinFillRectangle ;do a fill so we know where we are.
add esp,4*7
;
@@ds_8192_0: push ebx
push ecx
push offset _FS_typedname ;text to print.
push SystemFont
mov al,253 ;convert "system" pen number into
call VideoSys2Hard ;real hardware pen number.
push eax
push 2+16 ;OR it on and use fixed spaceing.
push _FS_window
call WinPrintWindow ;print the text.
add esp,4*7
and _FS_drawstate,not 8192
;
@@ds_16384: jmp waitloop2
;
;This is the start of the wait code. First we check if any of the buttons
;should be reset though.
;
waitloop: mov esi,offset dFileSelector ;get state of the file list up
mov ecx,dFILE_FILEUP ;button.
call DialogGetState
or eax,eax ;in or out?
jz @@wl0
xor eax,eax ;make sure file list up button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,32
jmp drawloop
;
@@wl0: mov ecx,dFILE_FILEDOWN ;get state of the file list down
call DialogGetState ;button.
or eax,eax ;in or out?
jz @@wl1
xor eax,eax ;make sure file list down button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,64
jmp drawloop
;
@@wl1: mov ecx,dFILE_TYPEUP ;get state of the type list up
call DialogGetState ;button.
or eax,eax ;in or out?
jz @@wl2
xor eax,eax ;make sure type list up button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,128
jmp drawloop
;
@@wl2: mov ecx,dFILE_TYPEDOWN ;get state of type list down
call DialogGetState ;button.
or eax,eax ;in or out?
jz @@wl3
xor eax,eax ;make sure type list down button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,256
jmp drawloop
;
@@wl3: mov ecx,dFILE_DRIVEUP ;get state of drive list up
call DialogGetState ;button.
or eax,eax ;in or out?
jz @@wl4
xor eax,eax ;make sure drive list up button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,512
jmp drawloop
;
@@wl4: mov ecx,dFILE_DRIVEDOWN ;get state of drive list down
call DialogGetState ;button.
or eax,eax ;in or out?
jz @@wl5
xor eax,eax ;make sure drive list down button
call DialogSetState ;gets reset to out position.
or _FS_drawstate,1024
jmp drawloop
@@wl5:
;
;Wait for some user action here.
;
waitloop2: call _FS_Readinput ;read keyboard and mouse states.
cmp _FS_KeyCode,0 ;anything at the keyboard?
jz @@wl2_0
cmp _FS_KeyCode,1 ;check for escape.
jz cancelexit ;pretend they pressed CANCEL.
cmp _FS_KeyASCII,13 ;check for ENTER.
jz okexit ;pretend they pressed OK.
cmp _FS_KeyCode,71 ;check for HOME
jz HomeKeyed
cmp _FS_KeyCode,79 ;check for END
jz EndKeyed
cmp _FS_KeyCode,73 ;check for PgUp
jz PgUpKeyed
cmp _FS_KeyCode,81 ;check for PgDn
jz PgDnKeyed
cmp _FS_TypedFocus,0 ;should we be passing this to
jnz typedinput ;the typed name handler?
;
@@wl2_0: cmp _FS_mouseb,0 ;anything interesting happening
jz waitloop ;with the mouse?
;
;Make sure pointer is in the right windows.
;
mov eax,_FS_window ;must make sure the mouse pointer
cmp eax,_FS_mousewin ;is inside our window before we
jnz @@wl2_1 ;try doing anything with the values.
mov esi,offset dFileSelector
mov ecx,_FS_mousewinx ;Mouse is in our window so now
mov edx,_FS_mousewiny ;we need to know which, if any,
call DialogWhich ;dialog button is selected.
cmp eax,-1
jz @@wl2_1 ;nothing useful selected.
;
;Check for cancel button.
;
cmp eax,dFILE_CANCEL
jz cancelexit
;
;Check for OK button.
;
cmp eax,dFILE_OK
jz okexit
;
;Check for PATH selection.
;
cmp eax,dFILE_PATH
jz pathchange
;
;Check for file or directory selection.
;
cmp eax,dFILE_FILES
jz fileordir
;
;Check for type selection.
;
cmp eax,dFILE_TYPES
jz typechange
;
;Check for drive selection.
;
cmp eax,dFILE_DRIVES
jz drivechange
;
;Check for typed name becomeing the focus.
;
cmp eax,dFILE_TYPED
jz changetyped
;
;Check for file list UP button.
;
cmp eax,dFILE_FILEUP
jz fileup
;
;Check for file list DOWN button.
;
cmp eax,dFILE_FILEDOWN
jz filedown
;
;Check for type list UP button.
;
cmp eax,dFILE_TYPEUP
jz typeup
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -