summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/prop-ini.mkiv
blob: 3cb5d2a6f5adb5fd2c3f080bf3acabdc9bd655dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
%D \module
%D   [       file=prop-ini,
%D        version=2003.04.20,
%D          title=\CONTEXT\ Property Macros,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Property Macros / Initialization}

%D This module is replaced by dedicated mechanisms. Originally properties were
%D a sort of attributes in \MKII, but now we do things different anyway. We keep
%D a surrogate mechanism around for compatibility reasons but even this will
%D become obsolete some day.

\unprotect

\def\propertyobsoletemessage
  {\writestatus\m!system{properties are obsolete, use dedicated commands}%
   \glet\propertyobsoletemessage\donothing}

\setvalue{\??py:d:\v!layer   }[#1][#2][#3]{\defineviewerlayer[#1][#3]}
\setvalue{\??py:d:\s!effect  }[#1][#2][#3]{\defineeffect     [#1][#3]}
\setvalue{\??py:d:\v!negative}[#1][#2][#3]{}

\unexpanded\def\defineproperty
  {\dotripleempty\dodefineproperty}

\def\dodefineproperty[#1][#2][#3]%
  {\propertyobsoletemessage
   \setevalue{\??py#1\c!type}{#2}%
   \getvalue{\??py:d:#2}[#1][#2][#3]}

\setvalue{\??py:s:\v!layer   }#1{\let\dostopproperty\stopviewerlayer\startviewerlayer[#1]}
\setvalue{\??py:s:\s!effect  }#1{\let\dostopproperty\stopeffect     \starteffect     [#1]}
\setvalue{\??py:s:\v!negative}#1{\let\dostopproperty\stopnegative   \startnegative       }

\unexpanded\def\property[#1]%
  {\groupedcommand{\dostartproperty{#1}}\dostopproperty}

\unexpanded\def\startproperty[#1]%
  {\dostartproperty{#1}}

\unexpanded\def\stopproperty
  {\dostopproperty}

\unexpanded\def\dostartproperty#1%
  {\pushmacro\dostopproperty
   \getvalue{\??py:s:\getvalue{\??py#1\c!type}}{#1}}

\unexpanded\def\dostopproperty
  {\dostopproperty
   \popmacro\dostopproperty}

\protect \endinput