meta-imp-nav.mkiv / last modification: 2020-01-30 14:16
%D \module
%D   [       file=meta-nav,
%D        version=2003.03.28,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Navigational Graphics,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startuniqueMPgraphic{navplus}{size,color,type,mode}
  color c ; numeric s, t ; path p ;
  t := \MPvar{type} ; c := \MPvar{color} ; s := \MPvar{size} ;
  if \MPvar{mode} = 1 : c := .5[c,white] fi ;
  if    t = 1 :
    p := ((0,0)--(1/2,0)--(1,1/3)--(1,1)--(0,1)--(0,0)--cycle)
      xyscaled (3,4) ;
  elseif t = 2 :
    p := ((0,0)--(1,0)--(1,1)--(0,1)--(1/2,2/5)--(1,1)--(0,1)--cycle)
      xyscaled (4,3) ;
  else :
    p := fullsquare xyscaled (3,3) ;
  fi ;
  draw p withpen pencircle scaled (1/2) withcolor .75white ;
  fill p withcolor c ;
  draw p withpen pencircle scaled (1/3) withcolor .5c ;
  currentpicture := currentpicture scaled s ;
  currentpicture := currentpicture shifted -center currentpicture ;
\stopuniqueMPgraphic

\setupMPvariables
  [navplus]
  [size=1ex,
   color=black,
   type=1,
   mode=0]

\definepalet
  [navplus]
  [attach=darkred,
   comment=darkblue]

\definesymbol
  [comment-normal]
  [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment}]
\definesymbol
  [comment-down]
  [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment,mode=1}]

\definesymbol
  [attach-normal]
  [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach}]
\definesymbol
  [attach-down]
  [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach,mode=1}]

\unprotect

\setupcomment    [\c!symbol={comment-normal,comment-down}]
\setupattachments[\c!symbol={attach-normal,attach-down}]

\protect \endinput