; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
        SUBT    MessageTrans_MakeMenus macro definitions => &.Hdr.MsgMenus

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************

; Date       Name  Description
; ----       ----  -----------
;  3-Nov-89  NDR   File created.
;  7-Nov-89  JSR   Change Item to take its flag parameters as a string of letters.
;                    This requires the GET of Hdr.Macros before this file.
; 10-Feb-93  BC    Restored OPT correctly
; 12-Jul-93  SMC   Added menu item flag "S" for shaded items.
;


menuiconflags * (0:SHL:ifb_bcol):OR:(7:SHL:ifb_fcol):OR:if_filled:OR:if_text


        GBLS    menusym                 ; start of current menu
        GBLA    itemno
        GBLA    itemtot
        GBLL    menutempflag

        MACRO
$lab    Menu    $token
        DCB     "$token", 0
        DCB     7, 2, 7, 0              ; title fg, bg, work fg, bg
        DCB     44, 0                   ; item height, gap
menusym SETS    "$lab"
itemno  SETA    0
itemtot SETA    ((?$menusym)-m_headersize)/mi_size
        MEND

; $flags is a string of letters which have these meanings:
; -     item is dotted (has a dotted line after it)
; W     item is writeable
; >     item is traversable (can traverse to next menu down even if greyed)
; N     item gives a message_menuwarning
; D     item is direct (not indirect)
; S     item is shaded

        MACRO
$lab    Item    $token, $submenu, $flags
$lab    *       itemno
itemno  SETA    itemno+1
        DCB     "$token", 0
        ALIGN
        LCLA    menuitemflags
menuitemflags SETA 0
menutempflag    StringContains  "$flags","-"
 [ menutempflag
menuitemflags SETA menuitemflags + mi_it_dotted
 ]
menutempflag    StringContains  "$flags","W"
 [ menutempflag
menuitemflags SETA menuitemflags + mi_it_writeable
 ]
menutempflag    StringContains  "$flags",">"
 [ menutempflag
menuitemflags SETA menuitemflags + mi_it_traverse
 ]
menutempflag    StringContains  "$flags","N"
 [ menutempflag
menuitemflags SETA menuitemflags + mi_it_warning
 ]
        ASSERT itemno <= itemtot
 [ itemno >= itemtot
menuitemflags SETA menuitemflags + mi_it_lastitem
 ]
        DCD     menuitemflags
 [ "$submenu"<>""
        DCD     $submenu-$menusym
 |
        DCD     0
 ]
        LCLA    menuiconflgs
menuiconflgs    SETA    menuiconflags
menutempflag    StringContains  "$flags","D"
 [ :LNOT: menutempflag
menuiconflgs    SETA    menuiconflags :OR: if_indirected
 ]
menutempflag    StringContains  "$flags","S"
 [ menutempflag
menuiconflgs    SETA    menuiconflgs :OR: is_shaded
 ]
        DCD     menuiconflgs
        MEND

        OPT     OldOpt

        END

