DeskTop: Streamline File menu; repurpose Apple-W shortcut. Fixes #154

This commit is contained in:
Joshua Bell 2019-05-09 21:43:51 -07:00
parent 5efade0c6e
commit 39260141e8
3 changed files with 23 additions and 107 deletions

View File

@ -3095,7 +3095,7 @@ label_new_folder:
label_open:
PASCAL_STRING "Open"
label_close:
PASCAL_STRING "Close"
PASCAL_STRING "Close Window"
label_close_all:
PASCAL_STRING "Close All"
label_select_all:
@ -3151,36 +3151,34 @@ desktop_menu:
DEFINE_MENU_BAR_ITEM menu_id_selector, label_selector, selector_menu
file_menu:
DEFINE_MENU 14
DEFINE_MENU 13
DEFINE_MENU_ITEM label_new_folder, 'F', 'f'
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM label_open, 'O', 'o'
DEFINE_MENU_ITEM label_close, 'C', 'c'
DEFINE_MENU_ITEM label_close_all, 'B', 'b'
DEFINE_MENU_ITEM label_close, 'W', 'w'
DEFINE_MENU_ITEM label_close_all
DEFINE_MENU_ITEM label_select_all, 'A', 'a'
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM label_copy_file, 'Y', 'y'
DEFINE_MENU_ITEM label_delete_file, 'D', 'd'
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM label_get_info, 'I', 'i'
DEFINE_MENU_ITEM label_rename_icon
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM label_copy_file, 'Y', 'y'
DEFINE_MENU_ITEM label_delete_file, 'D', 'd'
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM label_quit, 'Q', 'q'
menu_item_id_new_folder = 1
menu_item_id_open = 2
menu_item_id_close = 3
menu_item_id_close_all = 4
menu_item_id_select_all = 5
;; --------------------
menu_item_id_open = 3
menu_item_id_close = 4
menu_item_id_close_all = 5
menu_item_id_select_all = 6
menu_item_id_get_info = 7
menu_item_id_rename_icon = 8
;; --------------------
menu_item_id_copy_file = 8
menu_item_id_delete_file = 9
menu_item_id_copy_file = 10
menu_item_id_delete_file = 11
;; --------------------
menu_item_id_get_info = 11
menu_item_id_rename_icon = 12
;; --------------------
menu_item_id_quit = 14
menu_item_id_quit = 13
view_menu:
DEFINE_MENU 5

View File

@ -354,18 +354,17 @@ dispatch_table:
;; File menu (2)
menu2_start := *
.addr cmd_new_folder
.addr cmd_noop ; --------
.addr cmd_open
.addr cmd_close
.addr cmd_close_all
.addr cmd_select_all
.addr cmd_noop ; --------
.addr cmd_copy_file
.addr cmd_delete_file
.addr cmd_noop ; --------
.addr cmd_get_info
.addr cmd_rename_icon
.addr cmd_noop ; --------
.addr cmd_copy_file
.addr cmd_delete_file
.addr cmd_noop ; --------
.addr cmd_quit
;; Selector menu (3)
@ -454,10 +453,7 @@ handle_keydown:
jmp cmd_higlight
: bit flag
bpl menu_accelerators
cmp #'W' ; OA-W (Activate Window)
bne :+
jmp cmd_activate
: cmp #'G' ; OA-G (Resize)
cmp #'G' ; OA-G (Resize)
bne :+
jmp cmd_resize
: cmp #'M' ; OA-M (Move)
@ -2919,82 +2915,6 @@ L56F8: .byte 0
jmp offset_grafport2_and_set
.endproc
;;; ============================================================
;;; Handle keyboard-based window activation
.proc cmd_activate
lda active_window_id
bne L5708
rts
L5708: sta $800
ldy #$01
ldx #0
L570F: lda window_to_dir_icon_table,x
beq L5720 ; 0 = window free
inx
cpx active_window_id
beq L5721
txa
dex
sta $800,y
iny
L5720: inx
L5721: cpx #$08
bne L570F
sty L578D
cpy #$01
bne L572D
rts
L572D: copy #0, L578C
L5732: jsr get_event
lda event_kind
cmp #MGTK::EventKind::key_down
beq L5743
cmp #MGTK::EventKind::button_down
bne L5732
jmp L578B
L5743: lda event_key
and #CHAR_MASK
cmp #CHAR_RETURN
beq L578B
cmp #CHAR_ESCAPE
beq L578B
cmp #CHAR_LEFT
beq L5772
cmp #CHAR_RIGHT
bne L5732
ldx L578C
inx
cpx L578D
bne L5763
ldx #$00
L5763: stx L578C
lda $800,x
sta findwindow_window_id
jsr handle_inactive_window_click
jmp L5732
L5772: ldx L578C
dex
bpl L577C
ldx L578D
dex
L577C: stx L578C
lda $800,x
sta findwindow_window_id
jsr handle_inactive_window_click
jmp L5732
L578B: rts
L578C: .byte 0
L578D: .byte 0
.endproc
;;; ============================================================
;;; Initiate keyboard-based resizing

View File

@ -9,7 +9,6 @@ with the keyboard.
## Windows
* △-W - Activate window; Left/Right Arrows to navigate
* △-G - Resize window; Arrows to resize, Return to finish
* △-M - Move window; Arrows to move, Return to finish
* △-X - Scroll contents; Arrows to scroll, Esc or Return when done
@ -30,16 +29,15 @@ with the keyboard.
__File Menu__
* △-F - New Folder
* △-O - Open
* △-C - Close
* △-B - Close All
* △-W - Close
* △-A - Select All
* △-I - Get Info
* △-Y - Copy a File
* △-D - Delete a File
* △-I - Get Info
* △-Q - Quit
__View Menu__
* △-J - View By Icon
* △-J - View As Icons
* △-N - View By Name
* △-T - View By Date
* △-K - View By Size