Skip to content

Commit

Permalink
DeskTop: Constrain type-down and tab selection to active window
Browse files Browse the repository at this point in the history
Revisiting be3740e - while allowing arrow keys to iterate through all
icons feels good, type-down and tab suddenly activating a background
window feels very strange. So constrain these to the active window
only, or desktop if none. This is more constrained than in v1.4 but
feels more correct. More feedback welcome.

Also, unrelated updates to release notes and README.
  • Loading branch information
inexorabletash committed Sep 26, 2024
1 parent 5442aeb commit ea36d00
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 37 deletions.
7 changes: 6 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project Page: https://github.com/a2stuff/a2d
### General

* 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.

### Launcher

Expand All @@ -23,14 +25,17 @@ Project Page: https://github.com/a2stuff/a2d
* Hold either Apple key when selecting File > Close to Close All.
* Fix Apple+O to not "Open and Close" when menu already showing. ([#796](https://github.com/a2stuff/a2d/issues/796))
* Allow keyboard selection of icons in all windows.
* Show tip about copying PRODOS during Format/Erase process.

### Selector

### Disk Copy

### Desk Accessories

* About This Apple II: Detect Microdigital TK-3000 //e
* About This Apple II
* Detect Microdigital TK-3000 //e
* Detect Pravetz 8A/C

## 1.4

Expand Down
44 changes: 27 additions & 17 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,16 @@ dispatch_click:

;;; ============================================================
;;; Activate the window, draw contents, and update menu items
;;; No-op if the window is already active.
;;; No-op if the window is already active, or if 0 passed.
;;; Inputs: A = window id to activate

.proc ActivateWindow
cmp active_window_id
RTS_IF_EQ

cmp #0
RTS_IF_EQ

;; Make the window active.
sta active_window_id
MGTK_CALL MGTK::SelectWindow, active_window_id
Expand Down Expand Up @@ -3277,9 +3280,7 @@ ret: rts

;; If selection in non-active window, activate it
lda selected_window_id
IF_NE
jsr ActivateWindow ; no-op if already active
END_IF
jsr ActivateWindow ; no-op if already active, or 0

;; If selection is in a window with View > by Name, refresh
lda selected_window_id
Expand Down Expand Up @@ -3386,7 +3387,7 @@ a_next: lda #$00
alpha: jsr ShiftDown

store: sta flag
jsr GetSelectableIconsSorted
jsr GetNameSelectableIconsSorted
jmp common

;; Arrows - next/prev in icon order
Expand Down Expand Up @@ -3455,9 +3456,7 @@ HighlightIcon:
lda buffer+1,x
pha
jsr GetIconWindow
IF_NE
jsr ActivateWindow ; no-op if already active
END_IF
jsr ActivateWindow ; no-op if already active, or 0
pla
jmp SelectIcon
.endproc ; CmdHighlightImpl
Expand Down Expand Up @@ -3506,7 +3505,7 @@ file_char:
sta typedown_buf,x

;; Collect and sort the potential type-down matches
jsr GetSelectableIconsSorted
jsr GetNameSelectableIconsSorted

;; Find a match. There will always be one, since
;; desktop icons (including Trash) are considered.
Expand All @@ -3527,7 +3526,7 @@ file_char:
icon := *+1
lda #SELF_MODIFIED_BYTE
jsr GetIconWindow
jsr ActivateWindow ; no-op if already active
jsr ActivateWindow ; no-op if already active, or 0
lda icon
jsr SelectIcon

Expand Down Expand Up @@ -3609,22 +3608,33 @@ typedown_buf:
ret: rts
.endproc ; GetSelectableIcons

;;; Gather the selectable icons into buffer at $1800, as above, but
;;; also sort them by name.
;;; Gather the name-selectable icons - those in the active window or
;;; desktop - into buffer at $1800, and sort them by name.
;;; Output: Buffer at $1800 (length prefixed)

.proc GetSelectableIconsSorted
.proc GetNameSelectableIconsSorted
buffer := $1800
ptr1 := $06
ptr2 := $08

;; Init table with unsorted list of icons (never empty)
jsr GetSelectableIcons
jsr LoadActiveWindowEntryTable
ldx #0
:
cpx cached_window_entry_count
beq :+
lda cached_window_entry_list,x
sta buffer+1,x
inx
bne :-
:
stx buffer

cpx #2
RTS_IF_CC

;; Selection sort. In each outer iteration, the highest
;; remaining element is moved to the end of the unsorted
;; region, and the region is reduced by one. O(n^2)
ldx buffer ; count
dex
stx outer

Expand Down Expand Up @@ -3666,7 +3676,7 @@ next: inc inner
bne oloop

rts
.endproc ; GetSelectableIconsSorted
.endproc ; GetNameSelectableIconsSorted

;;; Assuming selectable icon buffer at $1800 is populated by the
;;; above functions, return ptr to nth icon's name in A,X
Expand Down
15 changes: 6 additions & 9 deletions res/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ slightly different file format which other tools/emulators/solid state
drives prefer, and is a 32 MB image so you have plenty of space to
copy other things onto the disk.

A2DeskTop...140k_disk1.po, ...disk2.po and ...disk3.po are 140k images
containing different parts of the application, and can be transferred
to 5.25" floppies using ADTPro.
A2DeskTop...140k_disk1.po, ...disk2.po, etc are 140k images containing
different parts of the application, and can be transferred to 5.25"
floppies using ADTPro.


Documentation
Expand All @@ -34,12 +34,9 @@ storage device:
* `A2.DESKTOP/` - any name is allowed, can be in any subdirectory
* `DESKTOP.SYSTEM` - run this to launch DeskTop
* `MODULES/` - contains parts of the application
* `DESKTOP` - application file
* `DISK.COPY` - application file
* `SELECTOR` - application file
* ... and the `THIS.APPLE` DA plus Preview Accessories
* `APPLE.MENU/` - contains Desk Accessories (DAs)
* `CONTROL.PANELS/` - DAs for modifying DeskTop settings
* `SCREEN.SAVERS/` - DAs that provide full-screen entertainment
* `EXTRAS/` - contains additional utilities
* `LOCAL/` - contains files created at runtime (settings, etc)

If you are installing from floppy disks onto a hard disk, follow the
above structure as you copy files from each floppy.
20 changes: 10 additions & 10 deletions res/notes/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@

* Close all windows. Start typing a volume name. Verify that a prefix-matching volume, or the subsequent volume (in lexicographic order) is selected, or the last volume (in lexicographic order).
* Close all windows. Start typing a volume name. Move the mouse. Start typing another filename. Verify that the matching is reset.
* Open a window containing multiple files. Start typing a filename. Verify that a prefix-matching file or volume, or the subsequent file or volume (in lexicographic order), or the last file or volume (in lexicographic order) is selected. For example, if the files "Alfa" and "Whiskey" and the volume "November" are present, typing "A" selects "Alfa", typing "AB" selects "Alfa", typing "AL" selects "Alfa", typing "ALFAA" selects "November", typing "B" selects "November", typing "Z" selects "Whiskey". Repeat including file and volume names with numbers and periods.
* Open a window containing multiple files. Start typing a filename. Verify that a prefix-matching file in the window, or the subsequent file (in lexicographic order), or the last file (in lexicographic order) is selected. For example, if the files "Alfa" and "Whiskey" and the volume "November" are present, typing "A" selects "Alfa", typing "AB" selects "Alfa", typing "AL" selects "Alfa", typing "ALFAA" selects "Whiskey", typing "B" selects "Whiskey", typing "Z" selects "Whiskey". Repeat including file names with numbers and periods.
* Open a window containing multiple files. Start typing a filename. Move the mouse. Start typing another filename. Verify that the matching is reset.
* Open a window containing no files. Start typing a filename. Verify that matching is done against the volume icons.
* Open a window containing no files. Start typing a filename. Verify that nothing is selected.
* Open a window containing one or more files starting with lowercase letters (AppleWorks or GS/OS). Verify the files appear with correct names. Press a letter. Verify that the first file starting with that letter is selected.
* Disable any acceleration. Close all windows. Restart DeskTop. Type the first letter of a volume name to select it. Quickly press Open-Apple+O. Verify the volume opens.
* Disable any acceleration. Close all windows. Restart DeskTop. Type the first letter of a volume name to select it. Quickly click on the File menu. Verify that Open is enabled.
Expand All @@ -238,15 +238,15 @@
* Open a window containing no file icons.
* Open a window containing file icons.
* Run these steps:
* Clear selection. Press Tab repeatedly. Verify that icons are selected in lexicographic order.
* Select an icon. Press Tab. Verify that the next icon in lexicographic order is selected.
* Clear selection. Press \` repeatedly. Verify that icons are selected in lexicographic order.
* Select an icon. Press \`. Verify that the next icon in lexicographic order is selected.
* Clear selection. Press Shift+\` repeatedly. Verify that icons are selected in reverse lexicographic order.
* Select an icon. Press Shift+\`. Verify that the previous icon in lexicographic order is selected.
* Clear selection. Press Tab repeatedly. Verify that icons in the active window (or desktop if no window is open) are selected in lexicographic order.
* Select an icon. Press Tab. Verify that the next icon in the active window (or desktop if no window is open) in lexicographic order is selected.
* Clear selection. Press \` repeatedly. Verify that icons in the active window (or desktop if no window is open) are selected in lexicographic order.
* Select an icon. Press \`. Verify that the next icon in the active window (or desktop if no window is open) in lexicographic order is selected.
* Clear selection. Press Shift+\` repeatedly. Verify that icons in the active window (or desktop if no window is open) are selected in reverse lexicographic order.
* Select an icon. Press Shift+\`. Verify that the previous icon in the active window (or desktop if no window is open) in lexicographic order is selected.
* On a IIgs and a Platinum IIe:
* Clear selection. Press Shift+Tab repeatedly. Verify that icons are selected in reverse lexicographic order.
* Select an icon. Press Shift+Tab. Verify that the previous icon in lexicographic order is selected.
* Clear selection. Press Shift+Tab repeatedly. Verify that icons in the active window (or desktop if no window is open) are selected in reverse lexicographic order.
* Select an icon. Press Shift+Tab. Verify that the previous icon in the active window (or desktop if no window is open) in lexicographic order is selected.


* Launch DeskTop. Open a volume containing no files. Verify that the default minimum window size is used - about 170px by 50px not counting title/scrollbars.
Expand Down

0 comments on commit ea36d00

Please sign in to comment.