1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <?xml-stylesheet type=
"text/xsl" href=
"formats/html.xsl"?>
4 <!-- This file is part of Shapes. -->
6 <!-- Shapes is free software: you can redistribute it and/or modify -->
7 <!-- it under the terms of the GNU General Public License as published by -->
8 <!-- the Free Software Foundation, either version 3 of the License, or -->
9 <!-- any later version. -->
11 <!-- Shapes is distributed in the hope that it will be useful, -->
12 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
13 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
14 <!-- GNU General Public License for more details. -->
16 <!-- You should have received a copy of the GNU General Public License -->
17 <!-- along with Shapes. If not, see <http://www.gnu.org/licenses/>. -->
19 <!-- Copyright 2008, 2014 Henrik Tidefelt -->
23 <title>shiftoff
</title>
25 <p>Very basic layout tools that mimic
<str-MetaPost /> suffix placement syntax.
</p>
27 <meta-selflink><self-href /></meta-selflink>
28 <base href=
<!--#expand-next-string-->"$(BASE)" />
29 <examples-home href=
<!--#expand-next-string-->"$(EXAMPLES)" />
30 <shapes-version number=
<!--#expand-next-string-->"$(SHAPES_VERSION)" />
31 <up-link><parent-namespace /></up-link>
33 <a extension=
"basic-layout" />
35 <public-namespace>Shapes..Layout
</public-namespace>
37 <!--#include virtual="^/toc.xml" -->
41 <p>The name of this extension includes the mysterious
<em>wfo
</em>. It stands for
<em>waiting for objects
</em>, and refers to the wish to deal with elements of block diagrams using objects of user-defined types rather than just relying on
<named-type name=
"Drawable" />. However, by relying on
<named-type name=
"Drawable" /> as the representation, this extension is much more generally useful than it would otherwise be.
</p>
44 <section id=
"extensions/shiftoff/constants">
45 <title>Constants
</title>
47 <p>The constants defined here give numeric values to directions. This is preferred over using symbols, since a miss-spelled symbol won't be detected by static analysis of the program. Note, though, that the numeric values should never be used as such; they could equally well have been defined as unique symbols.
</p>
49 <system-binding identifier=
"to_lft">
51 <type><named-type name=
"Float" /></type>
53 <p>Constant for the direction
<em>left
</em>.
</p>
57 <system-binding identifier=
"to_llft">
59 <type><named-type name=
"Float" /></type>
61 <p>Constant for the direction
<em>down and left
</em> (“lower left”).
</p>
65 <system-binding identifier=
"to_bot">
67 <type><named-type name=
"Float" /></type>
69 <p>Constant for the direction
<em>down
</em> (“bottom”).
</p>
73 <system-binding identifier=
"to_lrt">
75 <type><named-type name=
"Float" /></type>
77 <p>Constant for the direction
<em>down and right
</em> (“lower right”).
</p>
81 <system-binding identifier=
"to_rt">
83 <type><named-type name=
"Float" /></type>
85 <p>Constant for the direction
<em>right
</em>.
</p>
89 <system-binding identifier=
"to_urt">
91 <type><named-type name=
"Float" /></type>
93 <p>Constant for the direction
<em>up and right
</em> (“upper right“).
</p>
97 <system-binding identifier=
"to_top">
99 <type><named-type name=
"Float" /></type>
101 <p>Constant for the direction
<em>up
</em> (“top”).
</p>
105 <system-binding identifier=
"to_ulft">
107 <type><named-type name=
"Float" /></type>
109 <p>Constant for the direction
<em>up ad left
</em> (“upper left”).
</p>
113 <system-binding identifier=
"to_center">
115 <type><named-type name=
"Float" /></type>
117 <p>Constant for centered placement.
</p>
124 <section id=
"extensions/shiftoff/functions">
125 <title>Functions
</title>
127 <p>Functions for working with directions in terms of the constants defined by this extension.
</p>
129 <system-binding identifier=
"dirtopoint">
134 <type><named-type name=
"Float" /></type>
138 <type><named-type name=
"FloatPair" /></type>
140 <dynamic-references></dynamic-references>
142 <p>Converts a direction constant (which must have one of the values held by the constants defined by this extension) to a relative point to center at. The returned value can be used with
<binding extension=
"basic-layout" name=
"center" />.
</p>
145 <see-also><binding extension=
"shiftoff" name=
"to_dir" /></see-also>
149 <system-binding identifier=
"to_dir">
154 <type><named-type name=
"FloatPair" /></type>
158 <type><named-type name=
"Float" /></type>
160 <dynamic-references></dynamic-references>
162 <p>This generalizes the inverse of
<binding extension=
"shiftoff" name=
"dirtopoint" />. It converts any relative point (see
<binding extension=
"basic-layout" name=
"center" />) to the closest direction constant defined by this extension. It always returns a directional value, never
<binding extension=
"shiftoff" name=
"to_center" />.
</p>
168 <system-binding identifier=
"dir_to">
173 <type><named-type name=
"Float" /></type>
177 <type><named-type name=
"FloatPair" /></type>
179 <dynamic-references></dynamic-references>
181 <p><b>This function might be removed in the future!
</b></p>
182 <p>This generalizes
<binding extension=
"shiftoff" name=
"dirtopoint" /> by being applicable to any float value. This makes ugly use of the numerical values held by the constants defined by this extension.
</p>
188 <system-binding identifier=
"shiftoff">
192 <arg identifier=
"obj">
193 <type><named-type name=
"Drawable2D" /></type>
196 <type><named-type name=
"Float" /></type>
200 <type><named-type name=
"Drawable2D" /></type>
202 <dynamic-references></dynamic-references>
204 <p>Provides
<str-MetaPost />-like layout.
</p>
205 <p>For instance, to place a label below a point, say
<inline>lblPoint
</inline>, one may write:
207 •page
<< [shift lblPoint] [] [shiftoff (TeX `$x_{
1}$´) to_bot]
211 <see-also><binding extension=
"shiftoff" name=
"shiftoffwlm" /></see-also>
215 <system-binding identifier=
"shiftoffwlm">
219 <arg identifier=
"obj">
220 <type><named-type name=
"Drawable2D" /></type>
223 <type><named-type name=
"Float" /></type>
227 <type><named-type name=
"Drawable2D" /></type>
229 <dynamic-references><dynvar extension=
"basic-layout" name=
"labelmargin" /></dynamic-references>
231 <p>Provides
<str-MetaPost />-like layout.
</p>
232 <p>This function is like
<binding extension=
"shiftoff" name=
"shiftoff" />, but treats the obeject as if it was slightly bigger than it really is. The implementation uses
<binding extension=
"basic-layout" name=
"centerat_wlm" /> instead of
<binding extension=
"basic-layout" name=
"center" />.
</p>