Skip to content

Commit

Permalink
File Dialogs: Obey "show invisible files" option
Browse files Browse the repository at this point in the history
Hiding the files in file dialog was missed when the change was made in
1.3 - oops!

Obey the setting, and hide or show the files as appropriate.
  • Loading branch information
inexorabletash committed Jan 15, 2025
1 parent a22e128 commit 71d3e7f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 36 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Project Page: https://github.com/a2stuff/a2d
* Correctly exit 80-column firmware when exiting.
* Option "Copy to RAMCard" now defaults to off.
* Option "Preserve uppercase and lowercase in names" no defaults to on.
* Hide "invisible" files in file dialogs by default.

### Launcher

Expand Down
82 changes: 46 additions & 36 deletions lib/file_dialog.s
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ file_names := $1800
only_show_dirs_flag: ; set when selecting copy destination
.byte 0

dir_count:
.byte 0

;;; ============================================================

.proc Init
Expand Down Expand Up @@ -1035,12 +1032,11 @@ err: copy #1, path_buf
jmp _ReadDrives
:
lda #0
sta d1
sta d2
sta dir_count
sta entry_index
lda #1
sta d3
copy16 dir_read_buf+SubdirectoryHeader::entry_length, entry_length
sta entry_in_block
copy dir_read_buf+SubdirectoryHeader::entry_length, entry_length
copy dir_read_buf+SubdirectoryHeader::entries_per_block, entries_per_block
lda dir_read_buf+SubdirectoryHeader::file_count
and #$7F
sta num_file_names
Expand All @@ -1052,71 +1048,85 @@ err: copy #1, path_buf

l1: param_call_indirect AdjustFileEntryCase, ptr

ldy #0
ldy #FileEntry::storage_type_name_length
lda (ptr),y
and #NAME_LENGTH_MASK
bne l2
jmp l6
beq l6 ; deleted entry

l2: ldx d1
ldx entry_index
txa
sta file_list_index,x
ldy #0

;; Invisible?
ldx #DeskTopSettings::options
jsr ReadSetting
and #DeskTopSettings::kOptionsShowInvisible
IF_ZERO
ldy #FileEntry::access
lda (ptr),y
and #ACCESS_I
IF_NE
dec num_file_names ; skip
jmp l6
END_IF
END_IF

;; Directory?
ldy #FileEntry::storage_type_name_length
lda (ptr),y
and #STORAGE_TYPE_MASK
cmp #ST_LINKED_DIRECTORY << 4
beq l3
beq l3 ; is dir
bit only_show_dirs_flag
bpl l4
inc d2
bpl l4 ; not dir, but show
dec num_file_names ; skip
jmp l6

l3: lda file_list_index,x
;; Flag as "is dir"
l3: ldx entry_index
lda file_list_index,x
ora #$80
sta file_list_index,x
inc dir_count
l4: ldy #$00

l4: ldy #FileEntry::storage_type_name_length
lda (ptr),y
and #NAME_LENGTH_MASK
sta (ptr),y

lda d1
lda entry_index
jsr _CopyIntoNthFilename

inc d1
inc d2
l6: inc d3
lda d2
inc entry_index
l6: inc entry_in_block
lda entry_index
cmp num_file_names
bne next

close: MLI_CALL CLOSE, close_params
bit only_show_dirs_flag
bpl :+
lda dir_count
sta num_file_names
: jsr _SortFileNames
jsr _SortFileNames
clc
rts

next: lda d3
cmp d4
next: lda entry_in_block
cmp entries_per_block
beq :+
add16_8 ptr, entry_length
jmp l1

: MLI_CALL READ, read_params
copy16 #dir_read_buf+$04, ptr
lda #$00
sta d3
sta entry_in_block
jmp l1

d1: .byte 0
d2: .byte 0
d3: .byte 0
entry_index:
.byte 0
entry_in_block:
.byte 0
entry_length:
.byte 0
d4: .byte 0
entries_per_block:
.byte 0
.endproc ; _ReadDir

;;; ============================================================
Expand Down
2 changes: 2 additions & 0 deletions res/notes/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,8 @@ Test the following in all of the above, except where called out specifically:

* Create a directory, and in the directory create a file named "A.B" then a file named "A". Browse to the directory. Verify "A" sorts before "A.B".

* Create or locate an "invisible" file (e.g. the GS/OS FINDER.DATA file). Use DeskTop's Options Control Panel and enable "Show invisible files". Use the file picker to browse to the folder containing the file. Verify that it appears in the list. Disable the option. Use the file picker again, and verify that the file does not appear in the list.

* In Shortcuts > Add/Edit a Shortcut... name field:
* Type a non-path, non-control character. Verify that it is accepted.
* Type a control character that is not an alias for an Arrow key (so not Control+H, J, K, or U), editing key (so not Control+F, Control+X), Return (Control+M), Escape (Control+[), or a button shortcut (so not Control+D, O, or C) e.g. Control+Q. Verify that it is ignored.
Expand Down
1 change: 1 addition & 0 deletions selector/ovl_file_dialog.s
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ SystemTask := app::SystemTask
DetectDoubleClick := app::DetectDoubleClick
AdjustOnLineEntryCase := app::AdjustOnLineEntryCase
AdjustFileEntryCase := app::AdjustFileEntryCase
ReadSetting := app::ReadSetting

.include "../lib/file_dialog.s"
.include "../lib/get_next_event.s"
Expand Down

0 comments on commit 71d3e7f

Please sign in to comment.