diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrn-wid.mkvi')
-rw-r--r-- | Master/texmf-dist/tex/context/base/scrn-wid.mkvi | 169 |
1 files changed, 89 insertions, 80 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrn-wid.mkvi b/Master/texmf-dist/tex/context/base/scrn-wid.mkvi index 72f5255bbce..2b75f83cd75 100644 --- a/Master/texmf-dist/tex/context/base/scrn-wid.mkvi +++ b/Master/texmf-dist/tex/context/base/scrn-wid.mkvi @@ -5,7 +5,7 @@ %D subtitle=Widgets, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%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 @@ -60,11 +60,14 @@ % startattachment -> temp file -\newbox\scrn_attachment_box_collect -\newbox\scrn_attachment_box_link -\newbox\scrn_attachment_box_symbol +\newbox\b_scrn_attachment_collect +\newbox\b_scrn_attachment_link +\newbox\b_scrn_attachment_symbol -\installcommandhandler\??at{attachment}\??at +\installcorenamespace{attachment} +\installcorenamespace{attachmentlocation} + +\installcommandhandler \??attachment {attachment} \??attachment \let\setupattachments\setupattachment % convenience and compatibility @@ -94,17 +97,20 @@ {\ifsecondargument \begingroup \def\currentattachment{_}% - \setupattachment[_][#settings,\s!parent=\??at]% + \setupcurrentattachment[#settings,\s!parent=\??attachment]% \ctxcommand{registerattachment{ - tag = "#tag", - title = "\attachmentparameter\c!title", - subtitle = "\attachmentparameter\c!subtitle", - author = "\attachmentparameter\c!author", - file = "\attachmentparameter\c!file", - name = "\attachmentparameter\c!name", - buffer = "\attachmentparameter\c!buffer", + tag = "#tag", + registered = "#tag", + title = "\attachmentparameter\c!title", + subtitle = "\attachmentparameter\c!subtitle", + author = "\attachmentparameter\c!author", + file = "\attachmentparameter\c!file", + name = "\attachmentparameter\c!name", + buffer = "\attachmentparameter\c!buffer", }}% \endgroup + \else + % todo \fi} \appendtoks @@ -157,7 +163,7 @@ {\doifassignmentelse{#registered} {\def\scrn_attachment_stop{\scrn_attachment_inject[\v!auto][\c!buffer=\v!attachment,#registered]\egroup}}% {\def\scrn_attachment_stop{\scrn_attachment_inject[#registered][\c!buffer=\v!attachment,#settings]\egroup}}}% - \dostartbuffer[\v!attachment][\e!start\currentattachment][\e!stop\currentattachment]} + \grabbufferdatadirect\v!attachment{\e!start\currentattachment}{\e!stop\currentattachment}} \def\scrn_attachment_start_ignore {\expandafter\gobbleuntil\csname\e!stop\currentattachment\endcsname} @@ -179,10 +185,10 @@ \else \ctxcommand{presetsymbollist("\attachmentparameter\c!symbol")}% % we cannot yet ask for the wd/ht/dp of an xform else we could use those - \setbox\scrn_attachment_box_symbol\hbox{\symbol[\lastpredefinedsymbol]}% - \ifx\currentattachmentwidth \v!fit\edef\currentattachmentwidth {\wd\scrn_attachment_box_symbol}\fi - \ifx\currentattachmentheight\v!fit\edef\currentattachmentheight{\ht\scrn_attachment_box_symbol}\fi - \ifx\currentattachmentdepth \v!fit\edef\currentattachmentdepth {\dp\scrn_attachment_box_symbol}\fi + \setbox\b_scrn_attachment_symbol\hbox{\symbol[\lastpredefinedsymbol]}% + \ifx\currentattachmentwidth \v!fit\edef\currentattachmentwidth {\wd\b_scrn_attachment_symbol}\fi + \ifx\currentattachmentheight\v!fit\edef\currentattachmentheight{\ht\b_scrn_attachment_symbol}\fi + \ifx\currentattachmentdepth \v!fit\edef\currentattachmentdepth {\dp\b_scrn_attachment_symbol}\fi \fi \ctxcommand{insertattachment{ tag = "\currentattachment", @@ -191,7 +197,7 @@ height = \number\dimexpr\currentattachmentheight\relax, depth = \number\dimexpr\currentattachmentdepth \relax, color = "\attachmentparameter\c!color", - colormodel = \number\currentcolormodel, + colormodel = \number\attribute\colormodelattribute, colorvalue = \thecolorattribute{\attachmentparameter\c!color}, transparencyvalue = \thetransparencyattribute{\attachmentparameter\c!color}, symbol = "\currentattachmentsymbol", @@ -204,11 +210,11 @@ name = "\attachmentparameter\c!name", buffer = "\attachmentparameter\c!buffer", }}% - \setbox\scrn_attachment_box_link\hbox{\scrn_attachment_place}% - \wd\scrn_attachment_box_link\currentattachmentwidth - \ht\scrn_attachment_box_link\currentattachmentheight - \dp\scrn_attachment_box_link\currentattachmentdepth - \box\scrn_attachment_box_link} + \setbox\b_scrn_attachment_link\hbox{\scrn_attachment_place}% + \wd\b_scrn_attachment_link\currentattachmentwidth + \ht\b_scrn_attachment_link\currentattachmentheight + \dp\b_scrn_attachment_link\currentattachmentdepth + \box\b_scrn_attachment_link} \setvalue{scrn_attachment_method_\v!hidden}% {\ctxcommand{insertattachment{ @@ -219,29 +225,29 @@ \def\scrn_attachment_place {\executeifdefined - {\??at:\c!location:\attachmentparameter\c!location}\hbox - {\box\scrn_attachment_box_link}} + {\??attachmentlocation\attachmentparameter\c!location}\hbox + {\box\b_scrn_attachment_link}} -\setvalue{\??at:\c!location:\v!inmargin }{\inmargin } -\setvalue{\??at:\c!location:\v!leftedge }{\inleftedge } -\setvalue{\??at:\c!location:\v!rightedge }{\inrightedge } -\setvalue{\??at:\c!location:\v!leftmargin }{\inleftmargin } -\setvalue{\??at:\c!location:\v!rightmargin}{\inrightmargin} -\setvalue{\??at:\c!location:\v!high }{\high} -\setvalue{\??at:\c!location:\v!none }{\scrn_attachment_collect} +\setvalue{\??attachmentlocation\v!inmargin }{\inmargin } +\setvalue{\??attachmentlocation\v!leftedge }{\inleftedge } +\setvalue{\??attachmentlocation\v!rightedge }{\inrightedge } +\setvalue{\??attachmentlocation\v!leftmargin }{\inleftmargin } +\setvalue{\??attachmentlocation\v!rightmargin}{\inrightmargin} +\setvalue{\??attachmentlocation\v!high }{\high} +\setvalue{\??attachmentlocation\v!none }{\scrn_attachment_collect} \def\scrn_attachment_collect#content% - {\global\setbox\scrn_attachment_box_collect\hbox\bgroup - \ifvoid\scrn_attachment_box_collect\else - \box\scrn_attachment_box_collect + {\global\setbox\b_scrn_attachment_collect\hbox\bgroup + \ifvoid\b_scrn_attachment_collect\else + \box\b_scrn_attachment_collect \hskip\attachmentparameter\c!distance \fi #content% \egroup} \unexpanded\def\placeattachments - {\ifvoid\scrn_attachment_box_collect\else - \box\scrn_attachment_box_collect + {\ifvoid\b_scrn_attachment_collect\else + \box\b_scrn_attachment_collect \fi} \defineattachment[attachment] @@ -345,12 +351,15 @@ % % test -\installcommandhandler\??cc{comment}\??cc +\installcorenamespace{comment} +\installcorenamespace{commentlocation} + +\installcommandhandler \??comment {comment} \??comment -\newbox\scrn_comment_box_collect -\newbox\scrn_comment_box_rendering -\newbox\scrn_comment_box_link -\newbox\scrn_comment_box_symbol +\newbox\b_scrn_comment_collect +\newbox\b_scrn_comment_rendering +\newbox\b_scrn_comment_link +\newbox\b_scrn_comment_symbol \setupcomment [\c!state=\v!start, @@ -368,8 +377,6 @@ \c!ny=10, \c!location=\v!high] -\presetlocalframed[\??cc] - \appendtoks \setuevalue \currentcomment {\scrn_comment_argument{\currentcomment}}% \setuevalue{\e!start\currentcomment}{\scrn_comment_start {\currentcomment}}% @@ -389,8 +396,8 @@ \def\scrn_comment_argument_indeed[#title][#settings]#text% {\doifassignmentelse{#title} - {\setupcomment[\currentcomment][#title]} - {\setupcomment[\currentcomment][\c!title=#title,#settings]}% + {\setupcurrentcomment[#title]} + {\setupcurrentcomment[\c!title=#title,#settings]}% \ctxlua{buffers.assign("\v!comment",\!!bs#text\!!es)}% todo: expansion control, but expanded by default (xml) \scrn_comment_inject \ignorespaces} @@ -401,10 +408,10 @@ \unexpanded\def\scrn_comment_start#category% {\def\currentcomment{#category}% \doifelselocation - {\dodoubleempty\scrn_comment_start_indeed} + {\dodoubleempty\scrn_comment_start_status} {\dodoubleempty\scrn_comment_start_ignore}} -\def\scrn_comment_start_indeed +\def\scrn_comment_start_status {\doifelse{\commentparameter\c!state}\v!start {\scrn_comment_start_indeed} {\scrn_comment_start_ignore}} @@ -412,10 +419,10 @@ \def\scrn_comment_start_indeed[#title][#settings]% {\bgroup \doifassignmentelse{#title} - {\setupcomment[\currentcomment][#title]} - {\setupcomment[\currentcomment][\c!title=#title,#settings]}% + {\setupcurrentcomment[#title]} + {\setupcurrentcomment[\c!title=#title,#settings]}% \def\scrn_comment_stop{\scrn_comment_inject\egroup}% - \dostartbuffer[\v!comment][\e!start\currentcomment][\e!stop\currentcomment]} + \grabbufferdatadirect\v!comment{\e!start\currentcomment}{\e!stop\currentcomment}} \def\scrn_comment_start_ignore {\expandafter\gobbleuntil\csname\e!stop\currentcomment\endcsname} @@ -423,13 +430,15 @@ \unexpanded\def\scrn_comment_stop {} +\installcorenamespace{commentmethods} + \def\scrn_comment_inject - {\expandcheckedcsname{scrn_comment_method_}{\commentparameter\c!method}\v!normal} + {\expandcheckedcsname\??commentmethods{\commentparameter\c!method}\v!normal} %D Beware: comments symbols don't scale in acrobat (cf. spec but somewhat %D weird, esp because for instance attachment symbols do scale). -\setvalue{scrn_comment_method_\v!normal}% +\setvalue{\??commentmethods\v!normal}% {\edef\currentcommentsymbol{\commentparameter\c!symbol}% \edef\currentcommentwidth {\commentparameter\c!width }% \edef\currentcommentheight{\commentparameter\c!height}% @@ -441,10 +450,10 @@ \else \ctxcommand{presetsymbollist("\commentparameter\c!symbol")}% % we cannot yet ask for the wd/ht/dp of an xform else we could use those - \setbox\scrn_comment_box_symbol\hbox{\symbol[\lastpredefinedsymbol]}% - \ifx\currentcommentwidth \v!fit\edef\currentcommentwidth {\wd\scrn_comment_box_symbol}\fi - \ifx\currentcommentheight\v!fit\edef\currentcommentheight{\ht\scrn_comment_box_symbol}\fi - \ifx\currentcommentdepth \v!fit\edef\currentcommentdepth {\dp\scrn_comment_box_symbol}\fi + \setbox\b_scrn_comment_symbol\hbox{\symbol[\lastpredefinedsymbol]}% + \ifx\currentcommentwidth \v!fit\edef\currentcommentwidth {\wd\b_scrn_comment_symbol}\fi + \ifx\currentcommentheight\v!fit\edef\currentcommentheight{\ht\b_scrn_comment_symbol}\fi + \ifx\currentcommentdepth \v!fit\edef\currentcommentdepth {\dp\b_scrn_comment_symbol}\fi \fi \ctxcommand{insertcomment{ tag = "\currentcomment", @@ -456,7 +465,7 @@ depth = \number\dimexpr\currentcommentdepth, nx = \commentparameter\c!nx, ny = \commentparameter\c!ny, - colormodel = \number\currentcolormodel, + colormodel = \number\attribute\colormodelattribute, colorvalue = \thecolorattribute{\commentparameter\c!color}, transparencyvalue = \thetransparencyattribute{\commentparameter\c!color}, option = "\commentparameter\c!option", % todo @@ -464,41 +473,41 @@ buffer = "\v!comment", layer = "\commentparameter\c!textlayer" }}% - \wd\scrn_comment_box_link\currentcommentwidth - \ht\scrn_comment_box_link\currentcommentheight - \dp\scrn_comment_box_link\currentcommentdepth + \wd\b_scrn_comment_link\currentcommentwidth + \ht\b_scrn_comment_link\currentcommentheight + \dp\b_scrn_comment_link\currentcommentdepth \scrn_comment_place} -\setvalue{scrn_comment_method_\v!hidden}% +\setvalue{\??commentmethods\v!hidden}% {} % todo: dedicated margin classes \def\scrn_comment_place {\executeifdefined - {\??cc:\c!location:\commentparameter\c!location}\hbox - {\hbox{\box\scrn_comment_box_link}}} + {\??commentlocation\commentparameter\c!location}\hbox + {\hbox{\box\b_scrn_comment_link}}} -\setvalue{\??cc:\c!location:\v!inmargin }{\inmargin } -\setvalue{\??cc:\c!location:\v!leftedge }{\inleftedge } -\setvalue{\??cc:\c!location:\v!rightedge }{\inrightedge } -\setvalue{\??cc:\c!location:\v!leftmargin }{\inleftmargin } -\setvalue{\??cc:\c!location:\v!rightmargin}{\inrightmargin} -\setvalue{\??cc:\c!location:\v!high }{\high} -\setvalue{\??cc:\c!location:\v!none }{\scrn_comment_collect} +\setvalue{\??commentlocation\v!inmargin }{\inmargin } +\setvalue{\??commentlocation\v!leftedge }{\inleftedge } +\setvalue{\??commentlocation\v!rightedge }{\inrightedge } +\setvalue{\??commentlocation\v!leftmargin }{\inleftmargin } +\setvalue{\??commentlocation\v!rightmargin}{\inrightmargin} +\setvalue{\??commentlocation\v!high }{\high} +\setvalue{\??commentlocation\v!none }{\scrn_comment_collect} \def\scrn_comment_collect#content% - {\global\setbox\scrn_comment_box_collect\hbox\bgroup - \ifvoid\scrn_comment_box_collect\else - \box\scrn_comment_box_collect + {\global\setbox\b_scrn_comment_collect\hbox\bgroup + \ifvoid\b_scrn_comment_collect\else + \box\b_scrn_comment_collect \hskip\commentparameter\c!distance \fi #content% \egroup} \unexpanded\def\placecomments - {\ifvoid\scrn_comment_box_collect\else - \box\scrn_comment_box_collect + {\ifvoid\b_scrn_comment_collect\else + \box\b_scrn_comment_collect \fi} \definecomment[comment] @@ -585,8 +594,8 @@ \def\renderingtype #tag{\ctxlua{interactions.renderings.var("#tag","type")}} \def\renderingoption#tag{\ctxlua{interactions.renderings.var("#tag","option")}} -\def\renderingwidth {8cm} % will become private -\def\renderingheight {6cm} % will become private +\def\renderingwidth {8cm} % will become private +\def\renderingheight{6cm} % will become private \unexpanded\def\definerenderingwindow {\dodoubleempty\scrn_rendering_define_window} @@ -624,7 +633,7 @@ \def\currentrenderingwindow{#window}% \else \let\currentrenderingwindow\s!default - \scrn_rendering_define_window[\currentrenderingwindow]% + \definerenderingwindow[\currentrenderingwindow]% \fi % todo % \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!openpageaction }}\dosetuprenderingopenpageaction |