refine menu item macros

This commit is contained in:
Joshua Bell 2018-01-29 23:34:12 -08:00
parent 6315aab0f7
commit 57c5c09e26
2 changed files with 80 additions and 55 deletions

View File

@ -54,18 +54,6 @@ INVOKER_FILENAME := $280 ; File to invoke (PREFIX must be set)
jmp target jmp target
.endmacro .endmacro
.macro DEFINE_RECT left, top, right, bottom
.word left
.word top
.word right
.word bottom
.endmacro
.macro DEFINE_POINT left, top
.word left
.word top
.endmacro
.macro MGTK_RELAY_CALL call, addr .macro MGTK_RELAY_CALL call, addr
.if .paramcount > 1 .if .paramcount > 1
yax_call MGTK_RELAY, (call), (addr) yax_call MGTK_RELAY, (call), (addr)
@ -3437,47 +3425,15 @@ label_get_size:
label_rename_icon: label_rename_icon:
PASCAL_STRING "Rename an Icon ..." PASCAL_STRING "Rename an Icon ..."
;;; Top-level menus
.macro DEFINE_TL_MENU count
.word count
.endmacro
.macro DEFINE_TL_MENU_ITEM id, label, menu
.word id
.addr label
.addr menu
.word 0, 0, 0
.endmacro
;;; Drop-down menus
.macro DEFINE_MENU count
.word count, 0, 0
.endmacro
.macro DEFINE_MENU_ITEM saddr, shortcut1, shortcut2
.if .paramcount > 1
.word 1
.byte shortcut1
.byte shortcut2
.else
.word 0
.byte 0
.byte 0
.endif
.addr saddr
.endmacro
.macro DEFINE_MENU_SEPARATOR
.word 64, 19, 0
.endmacro
desktop_menu: desktop_menu:
DEFINE_TL_MENU 6 DEFINE_MENU_BAR 6
DEFINE_TL_MENU_ITEM 1, label_apple, apple_menu DEFINE_MENU_BAR_ITEM 1, label_apple, apple_menu
DEFINE_TL_MENU_ITEM 2, label_file, file_menu DEFINE_MENU_BAR_ITEM 2, label_file, file_menu
DEFINE_TL_MENU_ITEM 4, label_view, view_menu DEFINE_MENU_BAR_ITEM 4, label_view, view_menu
DEFINE_TL_MENU_ITEM 5, label_special, special_menu DEFINE_MENU_BAR_ITEM 5, label_special, special_menu
DEFINE_TL_MENU_ITEM 8, label_startup, startup_menu DEFINE_MENU_BAR_ITEM 8, label_startup, startup_menu
DEFINE_TL_MENU_ITEM 3, label_selector, selector_menu DEFINE_MENU_BAR_ITEM 3, label_selector, selector_menu
file_menu: file_menu:
DEFINE_MENU 12 DEFINE_MENU 12
@ -5586,12 +5542,12 @@ label_about:
buf: .res $80, 0 buf: .res $80, 0
splash_menu: splash_menu:
DEFINE_TL_MENU 1 DEFINE_MENU_BAR 1
DEFINE_TL_MENU_ITEM 1, splash_menu_label, dummy_dd_menu DEFINE_MENU_BAR_ITEM 1, splash_menu_label, dummy_dd_menu
blank_menu: blank_menu:
DEFINE_TL_MENU 1 DEFINE_MENU_BAR 1
DEFINE_TL_MENU_ITEM 1, blank_dd_label, dummy_dd_menu DEFINE_MENU_BAR_ITEM 1, blank_dd_label, dummy_dd_menu
dummy_dd_menu: dummy_dd_menu:
DEFINE_MENU 1 DEFINE_MENU 1

View File

@ -566,6 +566,14 @@ scroll_option_thumb := 1 << 6
scroll_option_active := 1 << 0 scroll_option_active := 1 << 0
scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_option_active scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_option_active
;;; Used in menu structs
menuopt_mod_open_apple := 1 << 0
menuopt_mod_solid_apple := 1 << 1
menuopt_has_mark := 1 << 2
menuopt_is_checked := 1 << 5
menuopt_is_filler := 1 << 6
menuopt_disabled_flag := 1 << 7
.endscope ; MGTK .endscope ; MGTK
;;; ================================================== ;;; ==================================================
@ -593,6 +601,18 @@ scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_
;;; ------------------------------------ ;;; ------------------------------------
.macro DEFINE_RECT left, top, right, bottom
.word left
.word top
.word right
.word bottom
.endmacro
.macro DEFINE_POINT left, top
.word left
.word top
.endmacro
.macro DEFINE_STRING str, label ; String definition, for use with TextWidth/DrawText .macro DEFINE_STRING str, label ; String definition, for use with TextWidth/DrawText
.local data ; Call as DEFINE_STRING "abc" .local data ; Call as DEFINE_STRING "abc"
.local end ; Can include control chars by using: .local end ; Can include control chars by using:
@ -606,6 +626,55 @@ data: .byte str
end: end:
.endmacro .endmacro
;;; Menus (common cases; other options are possible)
.macro DEFINE_MENU_BAR count
.byte count ; num menus
.byte 0 ; reserved
.endmacro
.macro DEFINE_MENU_BAR_ITEM id, label, menu
.byte id ; menu id
.byte 0 ; disable flag
.addr label ; title pointer
.addr menu ; pointer to menu
.res 6, 0 ; 6 reserved bytes
.endmacro
.macro DEFINE_MENU count
.byte count ; num items
.res 5, 0 ; 5 reserved bytes
.endmacro
.macro DEFINE_MENU_ITEM saddr, shortcut1, shortcut2
.if .paramcount > 1
.byte MGTK::menuopt_mod_open_apple ; option byte
.byte 0 ; mark character
.byte shortcut1 ; char 1
.byte shortcut2 ; char 2
.addr saddr ; name pointer
.else
.byte 0 ; option byte
.byte 0 ; mark character
.byte 0 ; char 1
.byte 0 ; char 2
.addr saddr ; name pointer
.endif
.endmacro
.macro DEFINE_MENU_SEPARATOR
.byte MGTK::menuopt_is_filler ; option byte
.byte 0 ; mark character
.byte 19 ; char 1 - Ctrl+S for separator ???
.byte 0 ; char 2
.addr 0 ; name pointer
.endmacro
;;; ------------------------------------
;;; Define pattern for PaintBits - low 7 bits are reversed ;;; Define pattern for PaintBits - low 7 bits are reversed
;;; e.g. .byte px(%1000000) ;;; e.g. .byte px(%1000000)