Center volume icons using icon defs

This commit is contained in:
Joshua Bell 2019-01-11 18:32:40 -08:00
parent e403bef725
commit 1a0fe7ec55
3 changed files with 62 additions and 61 deletions

View File

@ -2704,13 +2704,6 @@ LA923: lda setportbits_params2::cliprect::x2
;;; ============================================================
;; 5.25" Floppy Disk
floppy140_icon:
.addr floppy140_pixels; mapbits
.byte 4 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 26, 14 ; maprect
floppy140_pixels:
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1100000),px(%0000011),px(%1000000),px(%0000110)
@ -2728,13 +2721,6 @@ floppy140_pixels:
.byte px(%1100000),px(%0000000),px(%0000000),px(%0000110)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
;; RAM Disk
ramdisk_icon:
.addr ramdisk_pixels ; mapbits
.byte 6 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 39, 11 ; maprect
ramdisk_pixels:
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111101)
.byte px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0001110)
@ -2749,13 +2735,6 @@ ramdisk_pixels:
.byte px(%1010101),px(%0101010),px(%1010101),px(%0110011),px(%0011001),px(%1001101)
.byte px(%0101010),px(%1010101),px(%0101010),px(%1111111),px(%1111111),px(%1111110)
;; 3.5" Floppy Disk
floppy800_icon:
.addr floppy800_pixels; mapbits
.byte 3 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 20, 11 ; maprect
floppy800_pixels:
.byte px(%1111111),px(%1111111),px(%1111110)
.byte px(%1100011),px(%0000000),px(%1100111)
@ -2770,13 +2749,6 @@ floppy800_pixels:
.byte px(%1100110),px(%0000000),px(%0110011)
.byte px(%1111111),px(%1111111),px(%1111111)
;; Hard Disk
profile_icon:
.addr profile_pixels ; mapbits
.byte 8 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 52, 9 ; maprect
profile_pixels:
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1110101)
.byte px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0011010)
@ -2789,13 +2761,6 @@ profile_pixels:
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1110101)
.byte px(%1010111),px(%0101010),px(%1010101),px(%0101010),px(%1010101),px(%0101010),px(%1010111),px(%0101010)
;; Trash Can
trash_icon:
.addr trash_pixels ; mapbits
.byte 3 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 20, 17 ; maprect
trash_pixels:
.byte px(%1010101),px(%1111111),px(%1010101)
.byte px(%0101011),px(%1000001),px(%1101010)
@ -3183,7 +3148,6 @@ str_on_system_disk:
show_alert_indirection:
jmp show_alert_dialog
;;; TODO: Dedupe with alert_bitmap2 in desktop_res
alert_bitmap:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0111111),px(%1111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)

View File

@ -8575,11 +8575,11 @@ pos_win: .word 0, 0
;;; 4 = unknown / RAM-based driver
device_type_to_icon_address_table:
.addr desktop_aux::floppy140_icon
.addr desktop_aux::ramdisk_icon
.addr desktop_aux::profile_icon
.addr desktop_aux::floppy800_icon
.addr desktop_aux::profile_icon ; unknown
.addr floppy140_icon
.addr ramdisk_icon
.addr profile_icon
.addr floppy800_icon
.addr profile_icon ; unknown
.proc get_device_type
slot_addr := $0A
@ -8685,6 +8685,8 @@ buffer: .res 16, 0 ; length overwritten with '/'
DEFINE_ON_LINE_PARAMS on_line_params,, cvi_data_buffer
max_icon_width = 53
.proc create_volume_icon
sta unit_number
dex ; icon numbers are 1-based, and Trash is #1,
@ -8714,6 +8716,7 @@ success:
create_icon:
icon_ptr := $6
icon_defn_ptr := $8
jsr push_pointers
jsr DESKTOP_ALLOC_ICON
@ -8754,16 +8757,14 @@ create_icon:
lda unit_number
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
tax
ldy #IconEntry::iconbits
lda device_type_to_icon_address_table,x
sta icon_defn_ptr
sta (icon_ptr),y
txa
iny
lda device_type_to_icon_address_table+1,x
sta icon_defn_ptr+1
sta (icon_ptr),y
;; ----------------------------------------
@ -8788,8 +8789,11 @@ assign: ldy #IconEntry::iconbits
bne :-
;; Center it horizontally
ldy #IconDefinition::maprect + MGTK::Rect::x2
sub16in #max_icon_width, (icon_defn_ptr),y, offset
lsr16 offset ; offset = (max_width - icon_width) / 2
ldy #IconEntry::iconx
add16in (icon_ptr),y, offset_x, (icon_ptr),y
add16in (icon_ptr),y, offset, (icon_ptr),y
;; Assign icon number
ldx cached_window_icon_count
@ -8803,16 +8807,7 @@ assign: ldy #IconEntry::iconbits
unit_number: .byte 0
devlst_index: .byte 0
icon_index: .byte 0
offset_x: .word 0
;;; 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 ; floppy140
.word (53 - 38) / 2 ; ramdisk
.word (53 - 53) / 2 ; profile
.word (53 - 21) / 2 ; floppy800
.word (53 - 53) / 2 ; profile
offset: .word 0
;;; Icons are placed places in order as specified by caller
@ -15101,7 +15096,7 @@ trash_name: PASCAL_STRING " Trash "
ldy #IconEntry::win_type
copy #icon_entry_type_trash, (ptr),y
ldy #IconEntry::iconbits
copy16in #desktop_aux::trash_icon, (ptr),y
copy16in #trash_icon, (ptr),y
iny
ldx #0
: lda trash_name,x

View File

@ -832,6 +832,8 @@ delete_a_file_label:
file_to_delete_label:
PASCAL_STRING "File to delete:"
;;; ============================================================
pos_clock:
DEFINE_POINT 500, 10
@ -841,6 +843,46 @@ str_clock:
is_iic_plus_flag:
.byte 0
;;; ============================================================
;;; 5.25" Floppy Disk
floppy140_icon:
.addr desktop_aux::floppy140_pixels; mapbits
.byte 4 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 26, 14 ; maprect
;;; RAM Disk
ramdisk_icon:
.addr desktop_aux::ramdisk_pixels ; mapbits
.byte 6 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 39, 11 ; maprect
;;; 3.5" Floppy Disk
floppy800_icon:
.addr desktop_aux::floppy800_pixels; mapbits
.byte 3 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 20, 11 ; maprect
;;; Hard Disk
profile_icon:
.addr desktop_aux::profile_pixels ; mapbits
.byte 8 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 52, 9 ; maprect
;;; Trash Can
trash_icon:
.addr desktop_aux::trash_pixels ; mapbits
.byte 3 ; mapwidth
.byte 0 ; reserved
DEFINE_RECT 0, 0, 20, 17 ; maprect
;;; ============================================================
PAD_TO $DB00
;;; ============================================================