Center desktop icons in columns

This commit is contained in:
Joshua Bell 2018-12-29 10:55:26 -08:00
parent 3a128da01d
commit 287da7395c
2 changed files with 16 additions and 4 deletions

View File

@ -2593,6 +2593,7 @@ ramdisk_icon:
.byte 6 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 1, 0, 38, 11 ; maprect
;; TODO: increase border size
ramdisk_pixels:
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111101)

View File

@ -8693,10 +8693,10 @@ create_icon:
jsr get_device_type
asl ; * 2
tay
copy16 device_type_to_icon_offset_table,y, offset_x
lda device_type_to_icon_address_table,y
ldx device_type_to_icon_address_table+1,y
;; Assign icon bitmap
assign: ldy #IconEntry::iconbits
sta (icon_ptr),y
@ -8712,9 +8712,6 @@ assign: ldy #IconEntry::iconbits
sta (icon_ptr),y
inc device_num
;; TODO: Center icon horizontally
;; (Currently, left edges are aligned)
;; Assign icon coordinates
;; (Original logic was to assign in order based on
;; DEVLST order. This assigns based on Slot/Drive.)
@ -8734,6 +8731,10 @@ assign: ldy #IconEntry::iconbits
cpy #IconEntry::iconbits
bne :-
;; Center it horizontally
ldy #IconEntry::iconx
add16in (icon_ptr),y, offset_x, (icon_ptr),y
;; Assign icon number
ldx cached_window_icon_count
dex
@ -8745,8 +8746,18 @@ assign: ldy #IconEntry::iconbits
unit_number: .byte 0
device_num: .byte 0
offset_x: .word 0
.endproc
;;; Table of icon widths (/2) for centering icons
;;; TODO: Keep this up to date with icon bitmaps in desktop_aux
device_type_to_icon_offset_table:
.word (53 - 27) / 2
.word (53 - 38) / 2
.word (53 - 53) / 2
.word (53 - 21) / 2
.word (53 - 53) / 2
;;; ============================================================
;;; +-------------------------------------------------+