mirror of
https://github.com/mi57730/a2d.git
synced 2024-09-27 18:54:49 +00:00
DeskTop: Fix highlighting when dragging over icons. Fixes #163
The DeskTop library routines for handling icons switched GrafPorts in a fragile way, which previous changes had broken. Updates to the volume icon clipping code left the GrafPort used for icon drawing clipped, and it was not restored correctly before subsequent file icons were drawn. Ensure the correct grafports are used everywhere, and reset them when necessary. Further simplification is possible.
This commit is contained in:
parent
e8a9add613
commit
6e96eae7ed
@ -672,7 +672,6 @@ found: asl a
|
|||||||
|
|
||||||
;; Unhighlight
|
;; Unhighlight
|
||||||
: jsr calc_icon_poly
|
: jsr calc_icon_poly
|
||||||
MGTK_CALL MGTK::SetPenMode, pencopy
|
|
||||||
jsr draw_icon
|
jsr draw_icon
|
||||||
|
|
||||||
;; Move it to the end of the icon list
|
;; Move it to the end of the icon list
|
||||||
@ -1115,7 +1114,8 @@ is_drag:
|
|||||||
and #icon_entry_winid_mask
|
and #icon_entry_winid_mask
|
||||||
sta L9832
|
sta L9832
|
||||||
|
|
||||||
;; Prepare grafport
|
;; Prepare grafports
|
||||||
|
MGTK_CALL MGTK::InitPort, icon_grafport
|
||||||
MGTK_CALL MGTK::InitPort, drag_outline_grafport
|
MGTK_CALL MGTK::InitPort, drag_outline_grafport
|
||||||
MGTK_CALL MGTK::SetPort, drag_outline_grafport
|
MGTK_CALL MGTK::SetPort, drag_outline_grafport
|
||||||
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
|
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
|
||||||
@ -1279,6 +1279,7 @@ L9A31: COPY_BYTES 4, findwindow_params2, L9C92
|
|||||||
cmp highlight_icon_id
|
cmp highlight_icon_id
|
||||||
beq L9A84
|
beq L9A84
|
||||||
jsr xdraw_outline
|
jsr xdraw_outline
|
||||||
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
|
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
|
||||||
jsr xdraw_outline
|
jsr xdraw_outline
|
||||||
lda #0
|
lda #0
|
||||||
@ -1359,11 +1360,12 @@ L9B9C: jsr xdraw_outline
|
|||||||
|
|
||||||
L9BA5: jsr xdraw_outline
|
L9BA5: jsr xdraw_outline
|
||||||
lda highlight_icon_id
|
lda highlight_icon_id
|
||||||
beq L9BB9
|
beq :+
|
||||||
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
|
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
|
||||||
jmp L9C63
|
jmp L9C63
|
||||||
|
|
||||||
L9BB9: MGTK_CALL MGTK::FindWindow, findwindow_params2
|
: MGTK_CALL MGTK::FindWindow, findwindow_params2
|
||||||
lda findwindow_params2::window_id
|
lda findwindow_params2::window_id
|
||||||
cmp L9832
|
cmp L9832
|
||||||
beq L9BE1
|
beq L9BE1
|
||||||
@ -1380,8 +1382,6 @@ L9BD4: ora #$80
|
|||||||
L9BDC: lda L9832
|
L9BDC: lda L9832
|
||||||
beq L9BD1
|
beq L9BD1
|
||||||
L9BE1: jsr push_pointers
|
L9BE1: jsr push_pointers
|
||||||
MGTK_CALL MGTK::InitPort, grafport
|
|
||||||
MGTK_CALL MGTK::SetPort, grafport
|
|
||||||
ldx highlight_count
|
ldx highlight_count
|
||||||
L9BF3: dex
|
L9BF3: dex
|
||||||
bmi L9C18
|
bmi L9C18
|
||||||
@ -1392,7 +1392,6 @@ L9BF3: dex
|
|||||||
tax
|
tax
|
||||||
copy16 icon_ptrs,x, $06
|
copy16 icon_ptrs,x, $06
|
||||||
jsr calc_icon_poly
|
jsr calc_icon_poly
|
||||||
MGTK_CALL MGTK::SetPenMode, pencopy
|
|
||||||
jsr draw_icon
|
jsr draw_icon
|
||||||
pla
|
pla
|
||||||
tax
|
tax
|
||||||
@ -1561,7 +1560,7 @@ L9E1A: jsr push_pointers
|
|||||||
bne L9E2B
|
bne L9E2B
|
||||||
sta findwindow_params2::window_id
|
sta findwindow_params2::window_id
|
||||||
L9E2B: DESKTOP_DIRECT_CALL DT_FIND_ICON, findwindow_params2
|
L9E2B: DESKTOP_DIRECT_CALL DT_FIND_ICON, findwindow_params2
|
||||||
lda findwindow_params2::which_area
|
lda findwindow_params2::which_area ; Icon ID
|
||||||
bne L9E39
|
bne L9E39
|
||||||
jmp L9E97
|
jmp L9E97
|
||||||
|
|
||||||
@ -1572,8 +1571,8 @@ L9E3D: cmp highlight_list,x
|
|||||||
dex
|
dex
|
||||||
bpl L9E3D
|
bpl L9E3D
|
||||||
sta L9EB3
|
sta L9EB3
|
||||||
cmp #1
|
cmp #1 ; Trash?
|
||||||
beq L9E6A
|
beq :+
|
||||||
asl a
|
asl a
|
||||||
tax
|
tax
|
||||||
copy16 icon_ptrs,x, $06
|
copy16 icon_ptrs,x, $06
|
||||||
@ -1585,8 +1584,9 @@ L9E3D: cmp highlight_list,x
|
|||||||
and #icon_entry_type_mask
|
and #icon_entry_type_mask
|
||||||
bne L9E97
|
bne L9E97
|
||||||
lda L9EB3
|
lda L9EB3
|
||||||
L9E6A: sta highlight_icon_id
|
: sta highlight_icon_id
|
||||||
jsr xdraw_outline
|
jsr xdraw_outline
|
||||||
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, highlight_icon_id
|
DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, highlight_icon_id
|
||||||
jsr xdraw_outline
|
jsr xdraw_outline
|
||||||
L9E97: jsr pop_pointers
|
L9E97: jsr pop_pointers
|
||||||
@ -1603,7 +1603,6 @@ L9EB4: asl a
|
|||||||
.proc xdraw_outline
|
.proc xdraw_outline
|
||||||
MGTK_CALL MGTK::SetPort, drag_outline_grafport
|
MGTK_CALL MGTK::SetPort, drag_outline_grafport
|
||||||
MGTK_CALL MGTK::FramePoly, drag_outline_buffer
|
MGTK_CALL MGTK::FramePoly, drag_outline_buffer
|
||||||
MGTK_CALL MGTK::SetPort, grafport
|
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@ -1808,20 +1807,20 @@ highlighted: copy #$80, icon_flags ; is highlighted
|
|||||||
COPY_STRUCT MGTK::Point, moveto_params2, L9F94
|
COPY_STRUCT MGTK::Point, moveto_params2, L9F94
|
||||||
|
|
||||||
bit icon_flags ; volume icon (on desktop) ?
|
bit icon_flags ; volume icon (on desktop) ?
|
||||||
bvc paint_icon ; nope
|
bvc do_paint ; nope
|
||||||
|
|
||||||
;; Redraw desktop background
|
;; Redraw desktop background
|
||||||
MGTK_CALL MGTK::InitPort, grafport
|
MGTK_CALL MGTK::InitPort, grafport
|
||||||
jsr set_port_for_vol_icon
|
jsr set_port_for_vol_icon
|
||||||
: jsr calc_window_intersections
|
: jsr calc_window_intersections
|
||||||
jsr paint_icon
|
jsr do_paint
|
||||||
lda more_drawing_needed_flag
|
lda more_drawing_needed_flag
|
||||||
bne :-
|
bne :-
|
||||||
MGTK_CALL MGTK::SetPortBits, grafport
|
MGTK_CALL MGTK::SetPortBits, grafport ; default maprect
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc paint_icon
|
.proc do_paint
|
||||||
MGTK_CALL MGTK::HideCursor
|
MGTK_CALL MGTK::HideCursor
|
||||||
|
|
||||||
;; --------------------------------------------------
|
;; --------------------------------------------------
|
||||||
@ -2224,8 +2223,8 @@ stash: .word 0
|
|||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
draw_icon:
|
draw_icon:
|
||||||
MGTK_CALL MGTK::InitPort, grafport
|
MGTK_CALL MGTK::InitPort, icon_grafport
|
||||||
MGTK_CALL MGTK::SetPort, grafport
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
jmp LA3B9
|
jmp LA3B9
|
||||||
|
|
||||||
LA3AC: .byte 0
|
LA3AC: .byte 0
|
||||||
@ -2277,7 +2276,7 @@ volume:
|
|||||||
jsr erase_desktop_icon
|
jsr erase_desktop_icon
|
||||||
lda more_drawing_needed_flag
|
lda more_drawing_needed_flag
|
||||||
bne :-
|
bne :-
|
||||||
MGTK_CALL MGTK::SetPortBits, grafport
|
MGTK_CALL MGTK::SetPortBits, grafport ; default maprect
|
||||||
jmp LA446
|
jmp LA446
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@ -2313,7 +2312,7 @@ LA446: jsr push_pointers
|
|||||||
bne LA466
|
bne LA466
|
||||||
bit LA3B7 ; no, almost done
|
bit LA3B7 ; no, almost done
|
||||||
bpl :+
|
bpl :+
|
||||||
MGTK_CALL MGTK::InitPort, grafport
|
MGTK_CALL MGTK::InitPort, icon_grafport
|
||||||
MGTK_CALL MGTK::SetPort, icon_grafport
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
: jsr pop_pointers
|
: jsr pop_pointers
|
||||||
rts
|
rts
|
||||||
@ -2896,8 +2895,11 @@ vert: cmp16 win_t, cr_t
|
|||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
.proc shift_port_down
|
.proc shift_port_down
|
||||||
add16 icon_grafport::viewloc::ycoord, #15, icon_grafport::viewloc::ycoord
|
;; For window's used/free space bar
|
||||||
add16 icon_grafport::cliprect::y1, #15, icon_grafport::cliprect::y1
|
offset = 15
|
||||||
|
|
||||||
|
add16 icon_grafport::viewloc::ycoord, #offset, icon_grafport::viewloc::ycoord
|
||||||
|
add16 icon_grafport::cliprect::y1, #offset, icon_grafport::cliprect::y1
|
||||||
MGTK_CALL MGTK::SetPort, icon_grafport
|
MGTK_CALL MGTK::SetPort, icon_grafport
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
Loading…
Reference in New Issue
Block a user