mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-22 14:29:00 +00:00
Make same-volume drags moves, not copies (by default). Fixes #8
This commit is contained in:
parent
b2a35e9a56
commit
9a3463f37e
@ -13,6 +13,7 @@ https://github.com/inexorabletash/a2d/issues
|
|||||||
* Up to 13 volumes are shown on the desktop (was 10). (#20)
|
* Up to 13 volumes are shown on the desktop (was 10). (#20)
|
||||||
* Up to 12 Desk Accessories are shown in the menu (was 8). (#90)
|
* Up to 12 Desk Accessories are shown in the menu (was 8). (#90)
|
||||||
* Drag "unlimited" number of icons (was 20). (#18)
|
* Drag "unlimited" number of icons (was 20). (#18)
|
||||||
|
* Dragging files to same volume moves; use Open-Apple to force copy. (#8)
|
||||||
* Menus allow click-to-drop, click-to-select interaction. (#104)
|
* Menus allow click-to-drop, click-to-select interaction. (#104)
|
||||||
* Add Special > Check Drive command to refresh a single drive. (#97)
|
* Add Special > Check Drive command to refresh a single drive. (#97)
|
||||||
* Show Text File DA: Keyboard support. Escape quits, arrows scroll. (#4)
|
* Show Text File DA: Keyboard support. Escape quits, arrows scroll. (#4)
|
||||||
|
@ -3219,10 +3219,10 @@ textbg_white: .byte $7F
|
|||||||
|
|
||||||
press_ok_to_rect: DEFINE_RECT 39,25,360,80
|
press_ok_to_rect: DEFINE_RECT 39,25,360,80
|
||||||
prompt_rect: DEFINE_RECT 40,60,360,80
|
prompt_rect: DEFINE_RECT 40,60,360,80
|
||||||
current_target_file_pos: DEFINE_POINT 65,43
|
current_target_file_pos: DEFINE_POINT 75,43
|
||||||
current_dest_file_pos: DEFINE_POINT 65,51
|
current_dest_file_pos: DEFINE_POINT 75,51
|
||||||
current_target_file_rect: DEFINE_RECT 65,35,394,42
|
current_target_file_rect: DEFINE_RECT 75,35,394,42
|
||||||
current_dest_file_rect: DEFINE_RECT 65,43,394,50
|
current_dest_file_rect: DEFINE_RECT 75,43,394,50
|
||||||
|
|
||||||
str_cancel_label:
|
str_cancel_label:
|
||||||
PASCAL_STRING "Cancel Esc"
|
PASCAL_STRING "Cancel Esc"
|
||||||
@ -3262,6 +3262,14 @@ str_copy_to:
|
|||||||
str_copy_remaining:
|
str_copy_remaining:
|
||||||
PASCAL_STRING "Files remaining to copy: "
|
PASCAL_STRING "Files remaining to copy: "
|
||||||
|
|
||||||
|
;; "Move File" dialog strings
|
||||||
|
str_move_title:
|
||||||
|
PASCAL_STRING "Move ..."
|
||||||
|
str_move_moving:
|
||||||
|
PASCAL_STRING "Now Moving "
|
||||||
|
str_move_remaining:
|
||||||
|
PASCAL_STRING "Files remaining to move: "
|
||||||
|
|
||||||
str_exists_prompt:
|
str_exists_prompt:
|
||||||
PASCAL_STRING "That file already exists. Do you want to write over it ?"
|
PASCAL_STRING "That file already exists. Do you want to write over it ?"
|
||||||
str_large_prompt:
|
str_large_prompt:
|
||||||
@ -3405,8 +3413,6 @@ str_save_selector_list:
|
|||||||
str_on_system_disk:
|
str_on_system_disk:
|
||||||
PASCAL_STRING "on the system disk ?"
|
PASCAL_STRING "on the system disk ?"
|
||||||
|
|
||||||
PAD_TO $B600
|
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
show_alert_indirection:
|
show_alert_indirection:
|
||||||
|
@ -3860,15 +3860,19 @@ start_icon_drag:
|
|||||||
jsr swap_in_desktop_icon_table
|
jsr swap_in_desktop_icon_table
|
||||||
jmp redraw_windows_and_desktop
|
jmp redraw_windows_and_desktop
|
||||||
|
|
||||||
|
;; Was a move?
|
||||||
|
: bit move_flag
|
||||||
|
bpl :+
|
||||||
|
;; Update source vol's contents
|
||||||
|
jsr update_active_window
|
||||||
|
;; fall through
|
||||||
|
|
||||||
;; Dropped on trash?
|
;; Dropped on trash?
|
||||||
: lda drag_drop_param
|
: lda drag_drop_param
|
||||||
cmp trash_icon_num
|
cmp trash_icon_num
|
||||||
bne :+
|
bne :+
|
||||||
;; Update used/free for same-vol windows
|
;; Update used/free for same-vol windows
|
||||||
lda active_window_id
|
jsr update_active_window
|
||||||
jsr update_used_free_for_vol_windows
|
|
||||||
lda active_window_id
|
|
||||||
jsr select_and_refresh_window
|
|
||||||
jmp redraw_windows_and_desktop
|
jmp redraw_windows_and_desktop
|
||||||
|
|
||||||
;; Dropped on icon?
|
;; Dropped on icon?
|
||||||
@ -3990,6 +3994,13 @@ L5E57: lda ($06),y
|
|||||||
lda L5E77
|
lda L5E77
|
||||||
L5E74: jmp launch_file ; when double-clicked
|
L5E74: jmp launch_file ; when double-clicked
|
||||||
|
|
||||||
|
.proc update_active_window
|
||||||
|
lda active_window_id
|
||||||
|
jsr update_used_free_for_vol_windows
|
||||||
|
lda active_window_id
|
||||||
|
jmp select_and_refresh_window
|
||||||
|
.endproc
|
||||||
|
|
||||||
L5E77: .byte 0
|
L5E77: .byte 0
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
@ -9520,8 +9531,6 @@ done: rts
|
|||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
jt_drop: jmp do_drop
|
jt_drop: jmp do_drop
|
||||||
jmp do_nothing ; rts
|
|
||||||
jmp do_nothing ; rts
|
|
||||||
jt_get_info: jmp do_get_info ; cmd_get_info
|
jt_get_info: jmp do_get_info ; cmd_get_info
|
||||||
jt_lock: jmp do_lock ; cmd_lock
|
jt_lock: jmp do_lock ; cmd_lock
|
||||||
jt_unlock: jmp do_unlock ; cmd_unlock
|
jt_unlock: jmp do_unlock ; cmd_unlock
|
||||||
@ -9529,8 +9538,6 @@ jt_rename_icon: jmp do_rename_icon ; cmd_rename_icon
|
|||||||
jt_eject: jmp do_eject ; cmd_eject ???
|
jt_eject: jmp do_eject ; cmd_eject ???
|
||||||
jt_copy_file: jmp do_copy_file ; cmd_copy_file
|
jt_copy_file: jmp do_copy_file ; cmd_copy_file
|
||||||
jt_delete_file: jmp do_delete_file ; cmd_delete_file
|
jt_delete_file: jmp do_delete_file ; cmd_delete_file
|
||||||
jmp do_nothing ; rts
|
|
||||||
jmp do_nothing ; rts
|
|
||||||
jt_run: jmp do_run ; cmd_selector_action / Run
|
jt_run: jmp do_run ; cmd_selector_action / Run
|
||||||
jt_get_size: jmp do_get_size ; cmd_get_size
|
jt_get_size: jmp do_get_size ; cmd_get_size
|
||||||
|
|
||||||
@ -9752,6 +9759,10 @@ L9076: ldy #$FF
|
|||||||
bit delete_flag
|
bit delete_flag
|
||||||
bmi @trash
|
bmi @trash
|
||||||
|
|
||||||
|
;; Copy or Move - compare src/dst paths (etc)
|
||||||
|
jsr get_window_path_ptr
|
||||||
|
jsr check_move_or_copy
|
||||||
|
sta move_flag
|
||||||
jsr do_copy_dialog_phase
|
jsr do_copy_dialog_phase
|
||||||
jmp iterate_selection
|
jmp iterate_selection
|
||||||
|
|
||||||
@ -9785,7 +9796,6 @@ L90BA: bit operation_flags
|
|||||||
jmp iterate_selection
|
jmp iterate_selection
|
||||||
|
|
||||||
iterate_selection:
|
iterate_selection:
|
||||||
jsr get_window_path_ptr
|
|
||||||
lda selected_icon_count
|
lda selected_icon_count
|
||||||
bne :+
|
bne :+
|
||||||
jmp finish
|
jmp finish
|
||||||
@ -9800,22 +9810,18 @@ loop: jsr get_window_path_ptr
|
|||||||
beq next_icon
|
beq next_icon
|
||||||
jsr icon_entry_name_lookup
|
jsr icon_entry_name_lookup
|
||||||
jsr join_paths
|
jsr join_paths
|
||||||
copy16 #path_buf3, $06
|
|
||||||
|
|
||||||
;; Shrink name to remove trailing ' '
|
;; Shrink name to remove trailing ' '
|
||||||
ldy #0
|
lda path_buf3
|
||||||
lda ($06),y
|
beq :+
|
||||||
beq L9114
|
dec path_buf3
|
||||||
sec
|
:
|
||||||
sbc #$01
|
lda L97E4
|
||||||
sta ($06),y
|
|
||||||
|
|
||||||
L9114: lda L97E4
|
|
||||||
beq L913D
|
beq L913D
|
||||||
bit operation_flags
|
bit operation_flags
|
||||||
bmi @lock_or_size
|
bmi @lock_or_size
|
||||||
bit delete_flag
|
bit delete_flag
|
||||||
bmi :+
|
bmi :+
|
||||||
|
|
||||||
jsr copy_process_selected_file
|
jsr copy_process_selected_file
|
||||||
jmp next_icon
|
jmp next_icon
|
||||||
|
|
||||||
@ -9854,15 +9860,6 @@ not_trash:
|
|||||||
jmp L90BA
|
jmp L90BA
|
||||||
|
|
||||||
finish: jsr done_dialog_phase1
|
finish: jsr done_dialog_phase1
|
||||||
|
|
||||||
;; Restore space to start of icon name
|
|
||||||
;; BUG: For drop on window, updates arbitrary icon. Also unnecessary???
|
|
||||||
lda drag_drop_param
|
|
||||||
jsr icon_entry_name_lookup
|
|
||||||
ldy #1
|
|
||||||
lda #' '
|
|
||||||
sta ($06),y
|
|
||||||
|
|
||||||
return #0
|
return #0
|
||||||
|
|
||||||
icon_count:
|
icon_count:
|
||||||
@ -9911,6 +9908,10 @@ operation_flags:
|
|||||||
delete_flag:
|
delete_flag:
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
|
;; high bit set = move, clear = copy
|
||||||
|
move_flag:
|
||||||
|
.byte 0
|
||||||
|
|
||||||
;; high bit set = unlock, clear = lock
|
;; high bit set = unlock, clear = lock
|
||||||
unlock_flag:
|
unlock_flag:
|
||||||
.byte 0
|
.byte 0
|
||||||
@ -10867,7 +10868,7 @@ op_jt2: jmp (op_jt_addr2)
|
|||||||
op_jt3: jmp (op_jt_addr3)
|
op_jt3: jmp (op_jt_addr3)
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;; "Copy" (including Drag/Drop) files state and logic
|
;;; "Copy" (including Drag/Drop/Move) files state and logic
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
;;; copy_process_selected_file
|
;;; copy_process_selected_file
|
||||||
@ -10876,12 +10877,14 @@ op_jt3: jmp (op_jt_addr3)
|
|||||||
;;; - c/o process_dir for each file in dir; skips if dir, copies otherwise
|
;;; - c/o process_dir for each file in dir; skips if dir, copies otherwise
|
||||||
;;; copy_pop_directory
|
;;; copy_pop_directory
|
||||||
;;; - c/o process_dir when exiting dir; pops path segment
|
;;; - c/o process_dir when exiting dir; pops path segment
|
||||||
|
;;; maybe_finish_file_move
|
||||||
|
;;; - c/o process_dir after exiting; deletes dir if moving
|
||||||
|
|
||||||
;;; Overlays for copy operation (op_jt_addrs)
|
;;; Overlays for copy operation (op_jt_addrs)
|
||||||
callbacks_for_copy:
|
callbacks_for_copy:
|
||||||
.addr copy_process_directory_entry
|
.addr copy_process_directory_entry
|
||||||
.addr copy_pop_directory
|
.addr copy_pop_directory
|
||||||
.addr do_nothing
|
.addr maybe_finish_file_move
|
||||||
|
|
||||||
.enum CopyDialogLifecycle
|
.enum CopyDialogLifecycle
|
||||||
open = 0
|
open = 0
|
||||||
@ -11116,12 +11119,14 @@ create_ok:
|
|||||||
lda is_dir_flag
|
lda is_dir_flag
|
||||||
beq copy_file
|
beq copy_file
|
||||||
copy_dir: ; also used when dragging a volume icon
|
copy_dir: ; also used when dragging a volume icon
|
||||||
jmp process_dir
|
jsr process_dir
|
||||||
|
jmp maybe_finish_file_move
|
||||||
|
|
||||||
done: rts
|
done: rts
|
||||||
|
|
||||||
copy_file:
|
copy_file:
|
||||||
jmp do_file_copy
|
jsr do_file_copy
|
||||||
|
jmp maybe_finish_file_move
|
||||||
|
|
||||||
is_dir_flag:
|
is_dir_flag:
|
||||||
.byte 0
|
.byte 0
|
||||||
@ -11141,6 +11146,25 @@ src_path_slash_index:
|
|||||||
copy_pop_directory:
|
copy_pop_directory:
|
||||||
jmp remove_dst_path_segment
|
jmp remove_dst_path_segment
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
|
;;; If moving, delete src file/directory.
|
||||||
|
|
||||||
|
.proc maybe_finish_file_move
|
||||||
|
;; Copy or move?
|
||||||
|
bit move_flag
|
||||||
|
bpl done
|
||||||
|
|
||||||
|
;; Was a move - delete file
|
||||||
|
@retry: MLI_RELAY_CALL DESTROY, destroy_params
|
||||||
|
beq done
|
||||||
|
cmp #ERR_ACCESS_ERROR
|
||||||
|
;; TODO: if ERR_ACCESS_ERROR, unlock (or prompt)
|
||||||
|
beq done
|
||||||
|
jsr show_error_alert
|
||||||
|
jmp @retry
|
||||||
|
done: rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;; Called by |process_dir| to process a single file
|
;;; Called by |process_dir| to process a single file
|
||||||
|
|
||||||
@ -11198,6 +11222,7 @@ regular_file:
|
|||||||
bcs :+
|
bcs :+
|
||||||
jsr append_to_src_path
|
jsr append_to_src_path
|
||||||
jsr do_file_copy
|
jsr do_file_copy
|
||||||
|
jsr maybe_finish_file_move
|
||||||
jsr remove_src_path_segment
|
jsr remove_src_path_segment
|
||||||
: jsr remove_dst_path_segment
|
: jsr remove_dst_path_segment
|
||||||
done: rts
|
done: rts
|
||||||
@ -12243,6 +12268,63 @@ loop: iny
|
|||||||
return #$FF
|
return #$FF
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
|
;;; Move or Copy? Compare src/dst paths, same vol = move.
|
||||||
|
;;; Output: A=high bit set if move, clear if copy
|
||||||
|
|
||||||
|
.proc check_move_or_copy
|
||||||
|
src_ptr := $08
|
||||||
|
dst_buf := path_buf4
|
||||||
|
|
||||||
|
bit BUTN0 ; Open-Apple overrides, forces copy
|
||||||
|
bmi no_match
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda (src_ptr),y
|
||||||
|
sta src_len
|
||||||
|
iny ; skip leading '/'
|
||||||
|
bne check ; always
|
||||||
|
|
||||||
|
;; Chars the same?
|
||||||
|
loop: lda (src_ptr),y
|
||||||
|
cmp dst_buf,y
|
||||||
|
bne no_match
|
||||||
|
|
||||||
|
;; Same and a slash?
|
||||||
|
cmp #'/'
|
||||||
|
beq match
|
||||||
|
|
||||||
|
;; End of src?
|
||||||
|
check: cpy src_len
|
||||||
|
bcc :+
|
||||||
|
cpy dst_buf ; dst also done?
|
||||||
|
bcs match
|
||||||
|
lda path_buf4+1,y ; is next char in dst a slash?
|
||||||
|
bne check_slash ; always
|
||||||
|
|
||||||
|
: cpy dst_buf ; src is not done, is dst?
|
||||||
|
bcc :+
|
||||||
|
iny
|
||||||
|
lda (src_ptr),y ; is next char in src a slash?
|
||||||
|
bne check_slash ; always
|
||||||
|
|
||||||
|
: iny ; next char
|
||||||
|
bne loop ; always
|
||||||
|
|
||||||
|
check_slash:
|
||||||
|
cmp #'/'
|
||||||
|
beq match ; if so, same vol
|
||||||
|
;; fall through
|
||||||
|
|
||||||
|
no_match:
|
||||||
|
return #0
|
||||||
|
|
||||||
|
match: return #$80
|
||||||
|
|
||||||
|
src_len:
|
||||||
|
.byte 0
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
.proc check_escape_key_down
|
.proc check_escape_key_down
|
||||||
@ -12404,12 +12486,6 @@ driver: jmp (RAMSLOT)
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
str_preview_fot:
|
|
||||||
PASCAL_STRING "Preview/show.image.file"
|
|
||||||
|
|
||||||
str_preview_txt:
|
|
||||||
PASCAL_STRING "Preview/show.text.file"
|
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
PAD_TO $A500
|
PAD_TO $A500
|
||||||
@ -12896,12 +12972,20 @@ close: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_about_dialog
|
|||||||
;; CopyDialogLifecycle::open
|
;; CopyDialogLifecycle::open
|
||||||
: copy #0, has_input_field_flag
|
: copy #0, has_input_field_flag
|
||||||
jsr open_dialog_window
|
jsr open_dialog_window
|
||||||
addr_call draw_dialog_title, desktop_aux::str_copy_title
|
|
||||||
axy_call draw_dialog_label, 1, desktop_aux::str_copy_copying
|
;; TODO: Looks ugly due to overwrite of ascenders; adjust spacing
|
||||||
axy_call draw_dialog_label, 2, desktop_aux::str_copy_from
|
axy_call draw_dialog_label, 2, desktop_aux::str_copy_from
|
||||||
axy_call draw_dialog_label, 3, desktop_aux::str_copy_to
|
axy_call draw_dialog_label, 3, desktop_aux::str_copy_to
|
||||||
|
bit move_flag
|
||||||
|
bmi :+
|
||||||
|
addr_call draw_dialog_title, desktop_aux::str_copy_title
|
||||||
|
axy_call draw_dialog_label, 1, desktop_aux::str_copy_copying
|
||||||
axy_call draw_dialog_label, 4, desktop_aux::str_copy_remaining
|
axy_call draw_dialog_label, 4, desktop_aux::str_copy_remaining
|
||||||
rts
|
rts
|
||||||
|
: addr_call draw_dialog_title, desktop_aux::str_move_title
|
||||||
|
axy_call draw_dialog_label, 1, desktop_aux::str_move_moving
|
||||||
|
axy_call draw_dialog_label, 4, desktop_aux::str_move_remaining
|
||||||
|
rts
|
||||||
|
|
||||||
;; CopyDialogLifecycle::populate
|
;; CopyDialogLifecycle::populate
|
||||||
do1: ldy #1
|
do1: ldy #1
|
||||||
@ -15053,6 +15137,14 @@ reset_grafport3a:
|
|||||||
MGTK_RELAY_CALL MGTK::SetPort, grafport3
|
MGTK_RELAY_CALL MGTK::SetPort, grafport3
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
|
|
||||||
|
str_preview_fot:
|
||||||
|
PASCAL_STRING "Preview/show.image.file"
|
||||||
|
|
||||||
|
str_preview_txt:
|
||||||
|
PASCAL_STRING "Preview/show.text.file"
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
PAD_TO $BF00
|
PAD_TO $BF00
|
||||||
|
Loading…
x
Reference in New Issue
Block a user