From: adam Date: Sun, 4 Apr 2004 05:31:11 +0000 (+0000) Subject: improvements to Doc.java, corresponding fixes to the reference X-Git-Tag: RC4~52 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=ff2b086d176f8b2323bfd73fb4830cd237b7fa6c improvements to Doc.java, corresponding fixes to the reference darcs-hash:20040404053111-5007d-2c384ee3c6c64eabaa85d785c5048474c5890aa5.gz --- diff --git a/Makefile b/Makefile index 136f4ef..3369b98 100644 --- a/Makefile +++ b/Makefile @@ -380,7 +380,7 @@ commit: propose-patch darcs push --and-apply xwt@xwt.org:/var/www/org/ibex/core/ doc/%.pdf: build/class/org/ibex/util/XML.class build/class/org/ibex/util/Doc.class doc/%.xml - cd $(@D); java -cp ../../build/class org.ibex.util.Doc slides < `basename $*`.xml > `basename $*`.tex + cd $(@D); java -cp ../../build/class org.ibex.util.Doc < `basename $*`.xml > `basename $*`.tex cd $(@D); pdflatex `basename $*`.tex open doc/$*.pdf diff --git a/doc/reference/reference.xml b/doc/reference/reference.xml index 4c830b6..844bad6 100644 --- a/doc/reference/reference.xml +++ b/doc/reference/reference.xml @@ -1,18 +1,18 @@ - +
- + ** If you are reading the html version of this document and are thinking of printing it out, you might be interested in the nicely typeset produced with LaTeX. - + ** - This document is a reference. It is not a - specification or a - tutorial. + This document is a __reference__. It is not a + __specification__ or a + __tutorial__. This document does not guide the user gently through examples (as a tutorial would), and it doesn't provide enough detail and formality @@ -33,12 +33,12 @@ Ibex itself; the native code (or Java bytecode) that runs on - the client. This term does not include the Wildebeest - or the UI + the client. This term does not include the **Wildebeest** + or the **UI** A set of files (mostly XML, JavaScript, and PNG images) - bundled up in a zip archive, ending with the ".ibex" + bundled up in a zip archive, ending with the "[[.ibex]]" extension. Together, these files specify the appearance and behavior of the application's user interface. @@ -59,16 +59,16 @@ In ECMAscript, when you change the value of a property on an - object, you are putting to that property, or - writing to it. For example, the ECMAscript expression - "foo.bar = 5" puts the value 5 to the bar + object, you are **putting** to that property, or + **writing** to it. For example, the ECMAscript expression + "[[foo.bar = 5]]" **puts** the value 5 to the bar property on object foo. In ECMAscript, when you access the value of a property on an - object, you are getting that property, or - reading from it. For example, the ECMAscript - expression "return (3 + foo.bar)" gets the + object, you are **getting** that property, or + **reading** from it. For example, the ECMAscript + expression "[[return (3 + foo.bar)]]" **gets** the value of bar property on object foo and then adds 3 to it before returning the result. @@ -94,8 +94,8 @@ The Wildebeest downloads the appropriate core for the user's machine and verifies its digital signature. It then launches the - core, which downloads the UI (an .ibex archive), loads it, - applies the main.t template (found in the archive), and + core, which downloads the UI (an [[.ibex]] archive), loads it, + applies the [[main.t]] template (found in the archive), and renders it onto the screen, running any associated JavaScript code. @@ -117,9 +117,9 @@ Each top-level window in an Ibex UI is called a - surface. There are two kinds of surfaces: frames, + **surface**. There are two kinds of surfaces: **frames**, which usually have a platform-specific titlebar and border, and - windows, which never have any additional platform-specific + **windows**, which never have any additional platform-specific decorations. Whenever we refer to the size or position @@ -132,25 +132,25 @@ Surfaces are not actual JavaScript objects; you cannot obtain a reference to a surface. However, each surface is uniquely identified - by its root box, described in the next section. + by its **root box**, described in the next section.
- A box is the fundamental unit from which all Ibex user + A **box** is the fundamental unit from which all Ibex user interfaces are built. Boxes can contain other boxes (referred to as - its children). Each surface has a single box associated with - it called the root box; the root box and its children (and - its children's children, and so on) form the surface's box - tree. + its **children**). Each surface has a single box associated with + it called the **root box**; the root box and its children (and + its children's children, and so on) form the surface's **box + tree**. There are three ways to think of a box: - As a rendered visualization on the screen (the "Visual Representation") + As a rendered visualization on the screen (the "**Visual Representation**") - As a JavaScript object (the "Object Representation") + As a JavaScript object (the "**Object Representation**") As as an XML tag (the "XML Template Representation"). @@ -170,13 +170,13 @@ A template (discussed in the next section) is an XML file which acts as a blueprint for constructing a tree of boxes. We call this - construction process applying, since unlike - instantiation in object-oriented programming systems, you + construction process **applying**, since unlike + **instantiation** in object-oriented programming systems, you always apply a template to a pre-existing box, and you can apply multiple templates to the same box. Each XML tag corresponds to a single box, or to another template - which will be applied to that box. For example, a scrollbar + which will be applied to that box. For example, a [[scrollbar]] template, when applied, will construct a tree of boxes which has the visual appearance and behavior of a scrollbar. @@ -188,11 +188,11 @@ applying a template is complete, Ibex completely forgets the fact that it has applied a particular template to a particular box. One consequence of this approach is that if you think of templates as - classes, then Ibex has no equivalent for Java's instanceof + classes, then Ibex has no equivalent for Java's [[instanceof]] operator. Each template is an XML document whose root element is - <ibex>. Here is a sample template file: + [[<ibex>]]. Here is a sample template file:
   
@@ -219,19 +219,19 @@
   
The following two namespaces are predefined and need not be declared - using xmlns: + using [[xmlns]]: - http://xmlns.ibex.org/meta + [[http://xmlns.ibex.org/meta]] - This will be referred to as the "meta namespace" in the + This will be referred to as the "[[meta]] namespace" in the remainder of this document. - http://xmlns.ibex.org/ui + [[http://xmlns.ibex.org/ui]] - This will be referred to as the "ui namespace" in the + This will be referred to as the "[[ui]] namespace" in the remainder of this document. @@ -240,20 +240,33 @@
- -
+ If the root [[<ibex>]] element contains any non-whitespace + text content, this text is interpreted as JavaScript code and is + executed the first time the template is referenced. This code is + executed in a fresh scope containing two predefined properties: + + + The Ibex Object (described in ) + + + + A reference to this template's **static object**, which is + initially [[null]]. The static object can be accessed (read + and written) from both static scripts as well as instance + scripts in a particular template. FIXME +
Any immediate children of the root element which are in the - meta namespace are treated as metadata and are exempted from + [[meta]] namespace are treated as metadata and are exempted from the rest of the template application process. Currently only one type of metadata element is defined: - <meta:doc>: structured documentation for the + [[<meta:doc>]]: structured documentation for the template. @@ -262,7 +275,7 @@
All remaining children of the root element are treated as elements - to be applied to the box, in the order in which they appear + to be **applied** to the box, in the order in which they appear in the file using the following procedure. - To apply an XML tag x to a box b, perform the following + To apply an XML tag [[__x__]] to a box [[__b__]], perform the following operations, in this order: - Allocate a fresh scope s whose parent scope is - b. + Allocate a fresh scope [[__s__]] whose parent scope is + [[__b__]]. - Process each child element or text segment of x + Process each child element or text segment of [[__x__]] in the order they appear in the document: - Treat each text segment t as JavaScript code - and execute it with s as the root scope. + Treat each text segment [[__t__]] as JavaScript code + and execute it with [[__s__]] as the root scope. - For each child element x' of x: + For each child element [[__x'__]] of [[__x__]]: - Create a new box b'. + Create a new box [[__b'__]]. - If the name of tag x' is not - "box" in the ui namespace, prepend the + If the name of tag [[__x'__]] is not + "[[box]]" in the [[ui]] namespace, prepend the tag's namespace identifier uri (if any) to the name of the tag, and use the result as a key to retrieve a property from the root stream (defined later). Interpret the resulting stream as a template and apply - that template to b'. + that template to [[__b'__]]. - (recursively) apply x' to b'. + (recursively) apply [[__x'__]] to [[__b'__]]. - If x' has an id attribute, declare a variable - in s whose name is the value of the id - attribute, prefixed with the $ character, and whose - value is b' + If [[__x'__]] has an [[id]] attribute, declare a variable + in [[__s__]] whose name is the value of the [[id]] + attribute, prefixed with the [[$]] character, and whose + value is [[__b'__]] - Copy any $-variables created during the application - of x' into scope s. + Copy any [[$]]-variables created during the application + of [[__x'__]] into scope [[__s__]]. - Append b' as the last child of b. + Append [[__b'__]] as the last child of [[__b__]]. - Apply any attributes on x to b, except for - id. Since XML specifies that the order of attributes + Apply any attributes on [[__x__]] to [[__b__]], except for + [[id]]. Since XML specifies that the order of attributes cannot be significant, Ibex processes attributes in alphabetical order by attribute name. For example, if - x has the attribute foo="bar", then the - equivalent of the statement B.foo="bar"; will be + [[__x__]] has the attribute [[foo="bar"]], then the + equivalent of the statement [[B.foo="bar";]] will be performed, with the following exceptions: If the value portion of the attribute is the string - "true", put the boolean true. If the - value is "false", put the boolean false. + "[[true]]", put the boolean [[true]]. If the + value is "[[false]]", put the boolean [[false]]. If the value is a valid ECMAscript number, put it as a number (instead of a string). - If the value begins with a dollar sign ($), + If the value begins with a dollar sign ([[$]]), retrieve the value of the corresponding variable in - s and use that value instead. + [[__s__]] and use that value instead. - If the value begins with a dot (.), prepend the + If the value begins with a dot ([[.]]), prepend the attributes' namespace identifier uri (if any) and interpret the remainder as a property to be retrieved from the root stream (defined later). @@ -366,7 +379,7 @@ - The last two steps are referred to as the initialization of the + The last two steps are referred to as the **initialization** of the node. There are two important aspects of this ordering to be aware of: @@ -376,8 +389,8 @@ certain that they will never wind up accessing a box when it is in a partially-initialized state. - Attributes are applied after scripts are run so that - the attributes will trigger any traps (defined later) + Attributes are applied **after** scripts are run so that + the attributes will trigger any **traps** (defined later) placed by the script. @@ -393,7 +406,7 @@ Each box occupies a rectangular region on the surface. The visual appearance of a surface is created by rendering each box in its tree. - Unless the clip attribute is false, each box will + Unless the [[clip]] attribute is [[false]], each box will clip its childrens' visual representations to its own, so that the children appear "confined to" the parent. Children are rendered after their parents so they appear "on top of" their parents. @@ -404,42 +417,42 @@ - A box's path consists of zero or more lines and curves. + A box's [[path]] consists of zero or more lines and curves. The path may be filled with a color, gradient, or texture, and may be stroked with a line of a given thickness and color. If the path is not specified, it defaults to the perimiter of the - box. [Note: Vector Graphics support (including the ability - to set the path property to anything other than the - default) is currently not implemented]. + box. [**Note: Vector Graphics support (including the ability + to set the [[path]] property to anything other than the + default) is currently not implemented**]. A path also has: - an associated strokecolor, which is a color + an associated [[strokecolor]], which is a color - an associated strokewidth, which is a number - specifying the width of the stroke. [Note: Vector - Graphics support (including the strokewidth - property) is currently not implemented] + an associated [[strokewidth]], which is a number + specifying the width of the stroke. [**Note: Vector + Graphics support (including the [[strokewidth]] + property) is currently not implemented**] - a fill, which is either a color, gradient, or + a [[fill]], which is either a color, gradient, or texture - Each box also has a single line of text, whose + Each box also has a single line of [[text]], whose appearance is determined by its: - associated font, which can be any font supported by + associated [[font]], which can be any font supported by the library. - an associated fontsize in pixels + an associated [[fontsize]] in **pixels** - an associated textcolor + an associated [[textcolor]] @@ -453,8 +466,8 @@ The size and position of every box is determined by its properties, its childrens' sizes, and its parent's size and position. Box layout and rendering happens in four phases: - packing, constraining, placing, and - rendering. The Core is careful to only perform a phase on + **packing**, **constraining**, **placing**, and + **rendering**. The Core is careful to only perform a phase on a box if the box has changed in a way that invalidates the work done the last time that phase was performed. The packing and constraining phases are performed in a single traversal of the @@ -464,72 +477,64 @@ For brevity, the rest of this chapter deals only with width and columns. Height and rows is treated identically and independently. - Also, it is important to note that the term minimum width is - not the same thing as the property minwidth, although they + Also, it is important to note that the term **minimum width** is + not the same thing as the property [[minwidth]], although they are closely related. When the user resizes a window, Ibex changes the root box's - maxwidth and maxheight to match the size chosen by + [[maxwidth]] and [[maxheight]] to match the size chosen by the user and then determines the root box's size using the same sizing rules it uses for other boxes. Ibex will always attempt to prevent the user from making the surface smaller than the root box's - minwidth and minheight. If the hshrink or - vshrink flag is set, Ibex will try to prevent the user from + [[minwidth]] and [[minheight]]. If the [[hshrink]] or + [[vshrink]] flag is set, Ibex will try to prevent the user from resizing the surface at all. However, not all platforms give Ibex enough control to do this. + When talking about positioning, we will often refer to the - alignment point. + **alignment point**. - If the align property is "center", then the + If the [[align]] property is "[[center]]", then the alignment point is the center of the box. - If the align property is "topleft", - "bottomleft", "topright", or - "bottomright", then the alignment point is + If the [[align]] property is "[[topleft]]", + "[[bottomleft]]", "[[topright]]", or + "[[bottomright]]", then the alignment point is corresponding corner of the box. - If the align property is "top", - "bottom", "right", or "left", then + If the [[align]] property is "[[top]]", + "[[bottom]]", "[[right]]", or "[[left]]", then the alignment point is middle of the corresponding edge of the box. - When positioning a child box, the alignment point is determined by - the parent's align property. When rendering a - visual element (a texture, path, or text string) within a box, the - alignment point is determined by the box's own align - property. - - A simple way to think about this is that whenever there are two boxes - involved in the decision, you should use the parent's alignment point. -
- A grid of cells is created within the parent. If the - parent's cols property is set to 0, the cell grid has an - infinite number of columns. Either cols or rows + A grid of **cells** is created within the parent. If the + parent's [[cols]] property is set to 0, the cell grid has an + infinite number of columns. Either [[cols]] or [[rows]] must be zero, but not both. - If a child's visible property is false, it does + If a child's [[visible]] property is [[false]], it does not occupy any cells (and is not rendered). Otherwise, each child - occupies a rectangular set of cells child.colspan cells - wide and child.rowspan cells high. + occupies a rectangular set of cells [[child.colspan]] cells + wide and [[child.rowspan]] cells high. The Core iterates over the cells in the grid in the following - order: if rows is 0, the Core iterates across each column + order: if [[rows]] is 0, the Core iterates across each column before proceeding to the next row; otherwise rows come before - columns. At each cell, the Core attempts to place the first - remaining unplaced child's top-left corner in that cell + columns. At each cell, the Core attempts to place the **first + remaining unplaced child's** top-left corner in that cell (with the child occupying some set of cells extending down and to the right of that cell). If the parent has a fixed number of - columns and the child's colspan exceeds that limit, the + columns and the child's [[colspan]] exceeds that limit, the child is placed in column zero regardless, but only occupies the available set of cells (it does not "hang off the end" of the box). @@ -551,82 +556,74 @@
- Each box's minimum width is computed recursively as the - maximum of: + Each box's minimum width is computed recursively as the + maximum of: - - Its minwidth + + Its [[minwidth]] - The width of the box's text (after applying the - box's transform) [Note: Vector Graphics support - (including the transform property) is currently not - implemented]. + The width of the box's [[text]] (after applying the + box's [[transform]]) [**Note: Vector Graphics support + (including the [[transform]] property) is currently not + implemented**]. - The width of the box's path (after applying the box's - transform) if the box is packed. + The width of the box's path (after applying the box's + [[transform]]) **if the box is [[packed]]**. - The width of the bounding box enclosing the box's cells. - - - The minimum width of each cell is computed as the minimum - width of the box occupying it divided by the box's - colspan. - - If a box's hshrink property is set to - true, the box's maximum width is the same as its - minimum width; otherwise it is the box's - maxwidth. + The minimum width of the children in each row. + - The maximum width of each cell is the maxwidth of - the box occupying it divided by the box's - colspan. + If a box's [[hshrink]] property is set to + [[true]], the box's maximum width is the same as its + minimum width; otherwise it is the box's + [[maxwidth]]. +
- Each column's actual width is set to the maximum - minimum width of all the cells in that column. - NOTE: although a column or row can be sized smaller - than its "minimum width" or larger than its "maximum width", a - box will never be smaller than its minwidth or - larger than its maxwidth. - - Each column's maximum width is the largest maximum width of - the cells in that column, but no smaller than the column's - minimum width. - - A value k is chosen such that when each column's width - is set to min(maximum width, max(minimum width, k)), - the sum of all the column widths equals the parent's width. - If no such value exists, positive or negative infinity is used - (whichever is appropriate). Each column is then set to the - width dictated by k. - - Next, the rows and columns are positioned within the parent - box. The rows and columns are transformed according to the - parent's transform property [Note: Vector Graphics - support (including the transform property) is currently - not implemented]., and the bounding box of the resulting - cells are placed such that the cells' alignment point - coincides with the parent's alignment point (both alignment - points are determined by the parent's align property). - - +
+ + Ibex formulates a set of constraints for placing a box's + **packed** children as follows: + + + - A box's width can be no greater than the sum of the + columns it occupies + - The sum of a set of colums cannot be smaller than the + minimum width of a box that spans them. + - The sum of the widths of the parents' columns will be at + least as large as the parent's width is (but possibly + larger). + - Packed boxes: Each packed box's actual position - and size is then set to the aggregation of the actual sizes of - the cells it spans. If this size exceeds the box's maximum - width, the box is sized to its maximum width and centered - horizontally within the space occupied by its cells. - - Non-packed boxes: each non-packed box is transformed - according to the parent's transform property and then - positioned so that its alignment point is (child.x, - child.y) pixels from the parent's alignment point (both - alignment points are determined by the parent's align - property). - + Subject to these two unbreakable constraints, Ibex searches for + a solution which will optimize the following three goals, + prioritized from most important to least important: + + + - (__Most Important__) The sum of all columns will be a close + to the parent's with as possible (ie as small as possible) + - Ibex will attempt to make a set of columns no wider than + the [[maxwidth]] of a box spanning them. + - (__Least Important__) Ibex will attempt to make all + columns the same width. + + + Each packed box is then placed within the set of cells that it + spans. Usually the box will exactly fill this rectangle; if it + does not (due to [[maxwidth]] or minimum width constraints), the + box's will be placed so that its alignment point coincides with + the alignment point of that rectangle of cells.
+ +
+ Each non-packed box is transformed according to the parent's + [[transform]] property and then positioned so that its alignment + point is [[(child.x, child.y)]] pixels from the corresponding + edge/corner/center of its parent. +
+
@@ -636,29 +633,29 @@ - If the box's transform property is non-null, the + If the box's [[transform]] property is non-null, the coordinate space is transformed accordingly for the rest of - this phase and for the rendering of all children. [Note: - Vector Graphics support (including the transform - property) is currently not implemented]. + this phase and for the rendering of all children. [**Note: + Vector Graphics support (including the [[transform]] + property) is currently not implemented**]. - If the box is packed and has a non-null path, the + If the box is packed and has a non-[[null]] path, the path is translated such that the alignment point of the path's bounding box coincides with the box's alignment point (both - alignment points are determined by the box's align + alignment points are determined by the box's [[align]] property). If a box has a path, that path is filled with the color, - gradient, or image specified by the fill property and + gradient, or image specified by the [[fill]] property and stroked with the color and width specified by the - strokecolor and strokewidth properties. + [[strokecolor]] and [[strokewidth]] properties. - If the box has a non-null text attribute, - the text is rendered in font with size - fontsize and color textcolor. The text is + If the box has a non-null [[text]] attribute, + the text is rendered in [[font]] with size + [[fontsize]] and color [[textcolor]]. The text is then translated such that the alignment point of the text's bounding box coincides with the box's alignment point (both - alignment points are determined by the box's align + alignment points are determined by the box's [[align]] property). The box's children are rendered (pre-order traversal). @@ -669,13 +666,13 @@
- +
Each box is a full-fledged ECMAscript object, and can store key-value pairs as properties. Some of these keys have special meaning, which will be explained later. Each box's numeric - properties hold its child boxes. + properties hold its **child boxes**.
@@ -686,9 +683,9 @@ - If the value is a 5-character hex string (#RGB), - 7-character hex string (#RRGGBB), 9-character hex - string (#AARRGGBB), the box's stroke color will be set + If the value is a 5-character hex string ([[#RGB]]), + 7-character hex string ([[#RRGGBB]]), 9-character hex + string ([[#AARRGGBB]]), the box's stroke color will be set to that color. If the value is one of the colors (the same set of color names supported by SVG), the stroke color be set to that color. - If the value is null, the stroke color will be set - to clear (#00000000). + If the value is [[null]], the stroke color will be set + to clear ([[#00000000]]). @@ -706,11 +703,11 @@ This property can be set to any of the values specified for - strokecolor. + [[strokecolor]]. Alternatively, if the value written is an object, its stream will be read and interpreted as a PNG, GIF, or JPEG image, which will become the texture for this box, and the box's - minwidth and minheight properties will be + [[minwidth]] and [[minheight]] properties will be automatically set to the dimensions of the image. @@ -722,19 +719,19 @@ - The box's text; writing null to this property sets it - to "". + The box's text; writing [[null]] to this property sets it + to [[""]]. - The color in which to render the font; accepts the same values as strokecolor. + The color in which to render the font; accepts the same values as [[strokecolor]]. When an object is written to this property, its stream is read using the , and the resulting font is used to render the - box's text. + box's [[text]]. @@ -746,7 +743,7 @@
- If set to true, this box will shrink + If set to [[true]], this box will shrink (horizontally/vertically/both) to the smallest size allowed by its children and the bounding box of its path. @@ -754,7 +751,8 @@ If the box is a root box, this is the (x/y)-coordinate of the surface; otherwise it is the distance between the parent's - alignment point and this box's alignment point. + alignment point and the corresponding corner/edge/center of + its parent. @@ -768,17 +766,17 @@ When read, this is the current (width/height) of this box. Writing to this property is equivalent to writing to - both the minimum and maximum (width/height). + **both** the minimum and maximum (width/height). The number of (columns/rows) in which to lay out the children of this box. If set to zero, the number of (columns/rows) is unconstrained. - Either rows or cols must be zero. If - 0 is written to cols when rows is - 0, the write is ignored. If a nonzero value is - written to cols when rows is nonzero, - rows is set to 0, and vice versa. + Either [[rows]] or [[cols]] must be zero. If + [[0]] is written to [[cols]] when [[rows]] is + [[0]], the write is ignored. If a nonzero value is + written to [[cols]] when [[rows]] is nonzero, + [[rows]] is set to [[0]], and vice versa. @@ -791,18 +789,18 @@ - If set to false, this box will be rendered as if its + If set to [[false]], this box will be rendered as if its width and height were zero. If this is a root box, the associated surface will be hidden. - When reading from this property, the value false will - be returned if this box or any of its ancestors is not - visible. Thus it is possible to write true to a box's - visible property and then read back false. + When reading from this property, the value [[false]] will + be returned if this box **or any of its ancestors** is not + visible. Thus it is possible to write [[true]] to a box's + [[visible]] property and then read back [[false]]. - The layout strategy for this box. If set to true, the + The layout strategy for this box. If set to [[true]], the box occupies no cells and is laid out independently of its siblings. @@ -814,14 +812,14 @@ Writing to this property sets the box's redirect target. This property cannot be read from, and can only be written to if - the value being written is a descendant of the current + the value being written is a **descendant** of the current value. If a box has a non-null redirect target, reads and writes to any of the other properties in this section will be forwarded to the redirect target. - The redirect attribute is very useful for hiding the + The [[redirect]] attribute is very useful for hiding the internal structure of a widget, and for allowing widgets to act as "smart" containers for other widgets. For example, a menu widget might have an invisible child as its redirect target; this way, when boxes @@ -830,24 +828,24 @@ - The nth child of box b can be accessed by reading from - b[n]. The nth child can be removed by writing - null to b[n] (the child will become parentless). A - new child can be inserted before the nth child by - writing it to b[n]; if the value written is already a child of - b, it will be removed from b first. It is important + The **n**th child of box [[b]] can be accessed by reading from + [[b[n]]]. The **n**th child can be removed by writing + [[null]] to [[b[n]]] (the child will become parentless). A + new child can be inserted **before** the **n**th child by + writing it to [[b[n]]]; if the value written is already a child of + [[b]], it will be removed from [[b]] first. It is important to note that this behavior is different from ECMAscript arrays -- - writing a non-null value to b[n] does not eliminate - the nth child; it merely shifts it over one position. - Note: Unlike most JavaScript objects, enumerating a Box's - properties with the JavaScript for..in construct will - enumerate only the box's children and not any other properties. + writing a non-[[null]] value to [[b[n]]] does not eliminate + the **n**th child; it merely shifts it over one position. + __Note:__ Unlike most JavaScript objects, enumerating a Box's + properties with the JavaScript [[for..in]] construct will + enumerate **only** the box's children and not any other properties. - If true, the visual representation of this box's + If [[true]], the visual representation of this box's children will be clipped to the boundaries of this box. - Note: setting this property to false imposes a + __Note:__ setting this property to [[false]] imposes a substantial performance penalty. @@ -859,7 +857,7 @@ FIXME If this box has a parent, this property returns - parent.surface; otherwise it returns null. + [[**parent**.surface]]; otherwise it returns null. This property is a simple building block that the widget library uses to implement more complex functionality such as focus control and popups. @@ -871,29 +869,29 @@ The shape that the cursor should take when inside this - box. Valid values are: "default" , "wait", - "crosshair", "text", "hand", and - "move", as well as resizing cursors"east", - "west", "north", "south", - "northwest", "northeast", - "southwest", and "southeast". Note that on + box. Valid values are: "[[default]]" , "[[wait]]", + "[[crosshair]]", "[[text]]", "[[hand]]", and + "[[move]]", as well as resizing cursors"[[east]]", + "[[west]]", "[[north]]", "[[south]]", + "[[northwest]]", "[[northeast]]", + "[[southwest]]", and "[[southeast]]". Note that on some platforms, resize cursors for opposite directions (such - as northwest and southeast are the + as [[northwest]] and [[southeast]] are the same). - If a box's cursor is null, its parent's cursor will + If a box's cursor is [[null]], its parent's cursor will be used. If the root box's cursor is null, the - "default" cursor will be used. + "[[default]]" cursor will be used. Reading from this property will return the parent scope used - to execute the block of the template + to execute the [[]] block of the template in which the currently-executing code resides. Returns a reference to the box itself. - If null is written to this property, and this box is + If [[null]] is written to this property, and this box is the root box of a surface, the box will be detached and the surface destroyed. If this box has a parent, it will be detached from its parent. @@ -901,19 +899,19 @@ This property is actually a function; invoking - parent.indexof(child) will return the numerical index - of child in parent if child is a - child of parent (or parent's redirect - target), and -1 otherwise. Writing to this property + [[parent.indexof(child)]] will return the numerical index + of [[child]] in [[parent]] if [[child]] is a + child of [[parent]] (or [[parent]]'s redirect + target), and [[-1]] otherwise. Writing to this property has no effect. This property is actually a function; invoking - box.distanceto(otherbox) will return an object with two - properties, x and y, containing the horizontal + [[box.distanceto(otherbox)]] will return an object with two + properties, [[x]] and [[y]], containing the horizontal and vertical distance between the two boxes (negative if - otherbox is to the left of / above box). This + [[otherbox]] is to the left of / above [[box]]). This can be used to determine the relative placement of two boxes on different branches of the box tree. @@ -926,42 +924,42 @@ of a surface. - The value true is put to this property on the root box - when the surface gains the input focus, and false when + The value [[true]] is put to this property on the root box + when the surface gains the input focus, and [[false]] when the surface loses the input focus. Reading from this value will - return true if the surface is focused and false - if it is not. Putting true to this property will - not cause the surface to "steal" the input focus from other + return [[true]] if the surface is focused and [[false]] + if it is not. Putting [[true]] to this property will + **not** cause the surface to "steal" the input focus from other windows. - The value true is put to this property on the root box - when the surface is maximized, and false when the surface - is un-maximized. Reading from this value will return true - if the surface is maximized and false if it is - not. Putting true to this property will maximize the - window, and putting false to this property will + The value [[true]] is put to this property on the root box + when the surface is maximized, and [[false]] when the surface + is un-maximized. Reading from this value will return [[true]] + if the surface is maximized and [[false]] if it is + not. Putting [[true]] to this property will maximize the + window, and putting [[false]] to this property will unmaximize the window. Note that not all platforms support maximization. - The value true is put to this property on the root box - when the surface is minimized, and false when the surface - is unminimized. Reading from this value will return true - if the surface is minimized and false if it is - not. Putting true to this property will minimize the - window, and putting false will unminimize it. + The value [[true]] is put to this property on the root box + when the surface is minimized, and [[false]] when the surface + is unminimized. Reading from this value will return [[true]] + if the surface is minimized and [[false]] if it is + not. Putting [[true]] to this property will minimize the + window, and putting [[false]] will unminimize it. When the user attempts to close a surface, the value - true will be put to this property. Scripts may trap + [[true]] will be put to this property. Scripts may trap this property to prevent the window from closing. Putting the value - true to this property on a root box has the same - effect as putting null to the thisbox + [[true]] to this property on a root box has the same + effect as putting [[null]] to the [[thisbox]] property. @@ -980,16 +978,16 @@
- +
- Every object has a stream associated with it. A stream is a + Every object has a **stream** associated with it. A stream is a sequence of bytes that can be read or written to. By default an object has an empty stream (zero bytes). However, some objects - (returned from special methods on the ibex object) have + (returned from special methods on the [[ibex]] object) have streams yielding data read from an url, file, or a component of a zip archive. In a future release, the stream associated with a box will be an .ibex template which, when applied, will fully reconstitute the @@ -1025,8 +1023,8 @@
Most stream objects let you access - substreams using the usual JavaScript operators [] and - ., as well as the for..in syntax. + substreams using the usual JavaScript operators [[[]]] and + [[.]], as well as the [[for..in]] syntax.
     // r1 and r2 are equivalent but not equal (!=)
@@ -1038,9 +1036,9 @@
 
   
- The empty-string property on the ibex object is called the - root stream. You can access this object as ibex.. or - ibex[""]. Additionally, any expression which starts with a + The empty-string property on the [[ibex]] object is called the + **root stream**. You can access this object as [[ibex..]] or + [[ibex[""]]]. Additionally, any expression which starts with a dot is treated as property to be retrieved from the root stream. The following three expressions are equivalent: @@ -1057,7 +1055,7 @@ FIXME You can access variables within the static block of a template by - appending a double period (..) and the variable name to the + appending a double period ([[..]]) and the variable name to the stream used to load that template:
@@ -1074,11 +1072,11 @@
 
     If you attempt to send a stream as part of an XML-RPC call, the
     stream will be read in its entirity, Base64-encoded, and transmitted
-    as a  element.
+    as a [[]] element.
     
-    Ibex supports two special URL protocols.  The first is data:,
+    Ibex supports two special URL protocols.  The first is [[data:]],
     which inteprets the rest of the URL as a Base64 encoded sequence of
-    bytes to use as a source.  The other is utf8: which
+    bytes to use as a source.  The other is [[utf8:]] which
     interpretets the rest of the string as a Unicode character sequence to
     be UTF-8 encoded as a string of bytes to use as a source.
     
@@ -1108,10 +1106,10 @@
 
   
- +
- The ibex object is present in the top-level scope of every + The [[ibex]] object is present in the top-level scope of every script. It has the following properties: @@ -1135,7 +1133,7 @@ this object contains the ECMA math functions - return a regexp object corresponding to string s + return a regexp object corresponding to string **s** this object contains the ECMA string manipulation functions @@ -1144,26 +1142,26 @@ - log the debug messages m1 through mn. - o + log the debug messages **m1** through **mn**. + **o** - log the info messages m1 through mn. + log the info messages **m1** through **mn**. - log the warning messages m1 through mn. + log the warning messages **m1** through **mn**. - log the error messages m1 through mn. + log the error messages **m1** through **mn**. - opens a new browser window with URL u + opens a new browser window with URL **u** @@ -1230,12 +1228,12 @@ - return an XML-RPC call object with endpoint URL u + return an XML-RPC call object with endpoint URL **u** - return a SOAP call object with endpoint URL u, - SoapAction a, and XML Namespace n + return a SOAP call object with endpoint URL **u**, + SoapAction **a**, and XML Namespace **n** @@ -1250,77 +1248,77 @@ - sleep for n milliseconds + sleep for **n** milliseconds - returns a new object whose stream is drawn from URL u + returns a new object whose stream is drawn from URL **u** - unpacks a zip archive from s's stream + unpacks a zip archive from **s**'s stream - unpacks a cab archive from s's stream + unpacks a cab archive from **s**'s stream - valign=top>wraps a disk-backed read cache keyed on k - around s's stream + valign=top>wraps a disk-backed read cache keyed on **k** + around **s**'s stream - returns an object whose stream is drawn from s's - stream, but invokes f(n,d) as it is read from. + returns an object whose stream is drawn from **s**'s + stream, but invokes **f(n,d)** as it is read from. - Use SAX to parse the XML document on stream s with - handler h + Use SAX to parse the XML document on stream **s** with + handler **h** - Same as parse.xml(), but tries to fix broken HTML. + Same as [[parse.xml()]], but tries to fix broken HTML. - treat s's stream as a string encoded as a UTF-8 byte stream and return the string + treat **s**'s stream as a string encoded as a UTF-8 byte stream and return the string - ibex.stream.tempdir + [[ibex.stream.tempdir]] - not implemented yet: return a - stream which rsa-decrypts stream s with key k + **not implemented yet:** return a + stream which rsa-decrypts stream **s** with key **k** - not implemented yet: return a - stream which rc4-decrypts stream s with key k + **not implemented yet:** return a + stream which rc4-decrypts stream **s** with key **k** - not implemented yet: immediately - MD5-hash stream s + **not implemented yet:** immediately + MD5-hash stream **s** - not implemented yet: immediately - SHA1-hash stream s + **not implemented yet:** immediately + SHA1-hash stream **s**
- +
- You can add a trap to a property by applying the ++= operator + You can add a trap to a property by applying the [[++=]] operator to a function with one argument. The trap will be invoked whenever that property is written to. @@ -1332,15 +1330,15 @@
- If another script were to set the property "foo" - on the box above to the value 5, the function above would be - invoked with the argument 5. The function would then log - the string "foo is 5". + If another script were to set the property "[[foo]]" + on the box above to the value [[5]], the function above would be + invoked with the argument [[5]]. The function would then log + the string "[[foo is 5]]". - Within a trap, the expression trapee can be used to + Within a trap, the expression [[trapee]] can be used to get a reference to the box on which the trap was placed. - The expression trapname returns the name of the + The expression [[trapname]] returns the name of the trap executing the current function. This is useful when a function is applied to multiple traps. For example: @@ -1356,7 +1354,7 @@
- You can remove a trap by using the --= operator with the same + You can remove a trap by using the [[--=]] operator with the same function you added as a trap:
@@ -1374,21 +1372,21 @@
 
   
 
-    When the trapped property is written to, each of the trap
+    When the trapped property is **written** to, each of the trap
     functions placed on it will be invoked in the opposite order that
     they were placed on the box -- the most recently placed trap will
     execute first. This last-to-first execution of traps is called
-    cascading. After the last trap is invoked, the value is
+    **cascading**. After the last trap is invoked, the value is
     stored on the box (remember, boxes are objects, so they can hold
     properties just like all other ECMAscript objects).
     
   
There are two additional tricks you can use when placing traps. The - first is a manual cascade. If you want to cascade to lower + first is a **manual cascade**. If you want to cascade to lower traps in the middle of a function, or you want to cascade with a different value than the value passed to you (in effect "lying" to - lower traps), you can use cascade. For example: + lower traps), you can use [[cascade]]. For example:
     
@@ -1402,7 +1400,7 @@
     This effectively creates a box whose color cannot be changed, and
     which complains loudly if you try to do so.
     
-    Do not try to do something like this:
+    Do **not** try to do something like this:
     
     
     
@@ -1411,7 +1409,7 @@
         }
     
     
- To prevent automatic cascading, return true from your function: + To prevent automatic cascading, return [[true]] from your function:
     
@@ -1425,27 +1423,27 @@
 
   
- The other trick is a read-trap. Read traps are just like normal + The other trick is a **read-trap**. Read traps are just like normal traps, except that you use a function that takes zero arguments instead of one. Read traps also do not automatically cascade.
     
-        doublewidth ++= function() { return 2 * width; }
+        doublewidth [[++=]] function() { return 2 * width; }
     
     
- If another script attempts to read from the doublewidth + If another script attempts to read from the [[doublewidth]] property on this box, the value it gets will be twice the actual width of the box. Note that - the actual doublewidth property on the box never gets written + the actual [[doublewidth]] property on the box never gets written to, since the trap does not cascade. You can manually cascade on read traps as well:
     
-        text ++= function() { return "my text is " + cascade; }
+        text [[++=]] function() { return "my text is " + cascade; }
     
     
@@ -1460,15 +1458,15 @@ place traps on any of the properties described in the sections , , or except for childadded, - childremoved and surface. FIXME: remove? + Properties"/> except for [[childadded]], + [[childremoved]] and [[surface]]. FIXME: remove? If an uncaught exception is thrown from a trap, Ibex will log the - exception, but will not propagate it to the code which + exception, but will **not** propagate it to the code which triggered the trap. If the trap was a read trap, the value - null will be returned. + [[null]] will be returned. FIXME: is this right? @@ -1480,10 +1478,10 @@
- Cloning is a companion technique for traps; together they can + **Cloning** is a companion technique for traps; together they can be used to simulate any sort of environment you might need. When you - call ibex.clone(o), Ibex returns a new object (called the - clone) which compares with equality (==) to the + call [[ibex.clone(o)]], Ibex returns a new object (called the + **clone**) which compares with equality ([[==]]) to the original object. Furthermore, both objects are "equal" as keys in hashtables, so: @@ -1498,28 +1496,28 @@ properties on the original object, and reads from properties on the clone will read properties on the original object. In fact, the only thing that can be used to distinguish the original from the clone is - traps -- a trap placed on the clone is not placed on the + traps -- a trap placed on the clone is **not** placed on the original object as well.
- +
From the perspective of an application writer, Ibex is strictly single-threaded. Ibex is always in exactly one of the following three - contexts: + **contexts**: - Rendering Context -- (redrawing the screen) + __Rendering Context__ -- (redrawing the screen) - Event Context (executing javascript traps triggered by an event) + __Event Context__ (executing javascript traps triggered by an event) - Thread Context (executing a background thread spawned with ibex.thread) + __Thread Context__ (executing a background thread spawned with [[ibex.thread]]) @@ -1527,10 +1525,10 @@ - The box.mouse property and its subproperties - (x, y, and inside) can only be read + The [[box.mouse]] property and its subproperties + ([[x]], [[y]], and [[inside]]) can only be read from within the Event Context, or in a thread context - after a the box.mouse property on this box or + **after** a the [[box.mouse]] property on this box or an ancestor box has been written to. Blocking operations (anything that accesses the network or @@ -1543,7 +1541,7 @@
Ibex offers easy access to threads. Spawning a background thread is as - simple as writing a function to the ibex.thread property: + simple as writing a function to the [[ibex.thread]] property:
     ibex.thread = function() {
@@ -1555,13 +1553,13 @@
     reserved for use in future versions of Ibex. Scripts should not
     depend on the number or content of these arguments.
     
-    Ibex is cooperatively multitasked, so threads must not process
+    Ibex is **cooperatively multitasked**, so threads must not process
     for too long.  This was a deliberate choice; cooperatively
     multitasked environments do not require complex locking primitives
     like mutexes and semaphores which are difficult for novices to
     understand.  The disadvantage of cooperative multitasking is that one
     thread can hog the CPU.  This is unlikely to happen in Ibex for two reasons:
-    first, all blocking I/O operations automatically yield the CPU,
+    first, all blocking I/O operations **automatically** yield the CPU,
     so the overall user interface never becomes unresponsive because it is
     waiting for a disk or network transfer.  Second, since Ibex is strictly
     a user interface platform, Ibex scripts are unlikely to perform highly
@@ -1575,9 +1573,9 @@
 
     Every execution of the Event Context begins with an event, which
     consists of a key/value pair, and a mouse position, which consists of
-    an x and y coordinate.  The possible keys are _Press[1-3],
-    _Release[1-3], _Click[1-3], _DoubleClick[1-3],
-    _Move, _KeyPressed, and _KeyReleased.
+    an x and y coordinate.  The possible keys are [[_Press[1-3]]],
+    [[_Release[1-3]]], [[_Click[1-3]]], [[_DoubleClick[1-3]]],
+    [[_Move]], [[_KeyPressed]], and [[_KeyReleased]].
     
     Here are two example events:
     
@@ -1588,7 +1586,7 @@
     and writes the key and value to that box.  If none of the box's
     children contain the mouse position, Ibex removes the leading
     underscore from the key name and writes the value to
-    that property.  Once all the traps on that property have
+    **that** property.  Once all the traps on that property have
     executed, the value is written to the box's parent.
     
     Intuitively, Ibex delivers the underscored event to every box from the
@@ -1608,7 +1606,7 @@
     
     
- In general, you should use the non-underscore names to respond + In general, you should use the **non-underscore** names to respond to user input and use the underscored names when you want to override child boxes' behavior or route events to particular boxes (for example, when implementing a focus protocol). This is why the @@ -1623,7 +1621,7 @@ At any point in this sequence, a trap handler can choose not to - cascade (by returning true from the trap handler function). + cascade (by returning [[true]] from the trap handler function). This will immediately cease the propagation of the event. This is how you would indicate that an event has been "handled". @@ -1634,28 +1632,28 @@ either up or down the tree. - The value true is written to this property when the mouse (enters/leaves) the box. + The value [[true]] is written to this property when the mouse (enters/leaves) the box. - The value true is put to this property after the size + The value [[true]] is put to this property after the size of this box changes. When a child is added or removed, that child is written to - this property. The write is always performed after the + this property. The write is always performed **after** the addition or removal, so these two cases can be distinguished - by checking indexof(child). + by checking [[indexof(child)]]. Note that if the parent's redirect target is set to another box, this trap will only be invoked when children are manipulated by reading and writing to the parent. Reads and - writes directly to the redirect target will not trigger + writes directly to the redirect target will **not** trigger this trap. Note also that this traps is still triggered if a box's - redirect target is null. This is useful for + [[redirect]] target is **null**. This is useful for boxes that need to accept children and then relocate them elsewhere. @@ -1664,7 +1662,7 @@ Indicates that the use has pressed a mouse button. On - platforms with three mouse buttons, the middle button + platforms with three mouse buttons, the **middle** button is button 3 -- this ensures that applications written to only use two buttons (1 and 2) will work intuitively on three button platforms. @@ -1687,7 +1685,7 @@ Indicates that the mouse has moved while within this box, or that - the mouse while outside this box if a button was pressed while within this box and has not yet been released + the mouse while outside this box **if a button was pressed while within this box and has not yet been released** @@ -1705,16 +1703,16 @@ If the shift key was depressed immediately before the event took place, then the string will be capitalized. Special keynames are also capitalized; shift+home is reported as - "HOME". Symbols are capitalized as they appear on the + "[[HOME]]". Symbols are capitalized as they appear on the keyboard; for example, on an American QWERTY keyboard, shift+2 - is reported as "@". + is reported as "[[@]]". If the alt, meta, or command key was depressed immediately before this key was pressed, then the string will be prefixed - with the string "A-". If the control key was depressed + with the string "[[A-]]". If the control key was depressed while this key was pressed, then the string will be prefixed - with the string "C-". If both alt and control are - depressed, the string is prefixed with "C-A-". + with the string "[[C-]]". If both alt and control are + depressed, the string is prefixed with "[[C-A-]]". Ibex does not distinguish between a key press resulting from the user physically pushing down a key, and a 'key press' @@ -1729,13 +1727,13 @@
- +
- XML-RPC objects can be created by calling ibex.net.rpc.xml(XML-RPC - URL), and then invoking methods on that object. For example, + XML-RPC objects can be created by calling [[ibex.net.rpc.xml(**XML-RPC + URL**)]], and then invoking methods on that object. For example,
     Press1 += function(v) {
@@ -1747,23 +1745,23 @@
     
When the user clicks the first mouse button on this box, it will - contact the server xmlrpc.ibex.org, route to the - /RPC2/ handler and invoke the getTodaysColor() - method on the color object with a single string argument - "Friday". The return value will be used to change the color + contact the server [[xmlrpc.ibex.org]], route to the + [[/RPC2/]] handler and invoke the [[getTodaysColor()]] + method on the [[color]] object with a single string argument + "[[Friday]]". The return value will be used to change the color of the box the user clicked on. Note that in this example we spawned a background thread to handle the - request -- the Press1 event is delivered in the foreground + request -- the [[Press1]] event is delivered in the foreground thread, and XML-RPC methods may only be invoked in background threads. This is to prevent the UI from "locking up" if the server takes a long time to reply. If the XML-RPC method faults, an object will be thrown with two - properties: faultCode and faultString, as defined in + properties: [[faultCode]] and [[faultString]], as defined in the . If Ibex encounters a network, transport, or session-layer error, it will - throw a String object describing the error in a + throw a [[String]] object describing the error in a human-readable format. Scripts should not rely on the contents of this string having any special structure or significance. @@ -1772,7 +1770,7 @@ element. If a element is found in the XML-RPC reply, it will be returned as an object with a stream drawn from that byte sequence. - Each object returned by ibex.net.rpc.xml() represents a + Each object returned by [[ibex.net.rpc.xml()]] represents a single HTTP connection. The connection will be held open until the object is garbage collected or the server closes the connection. If a second call is issued on the object before the @@ -1782,7 +1780,7 @@ text="pipelined"/>. This can dramatically improve performance. Ibex supports HTTP Basic and Digest authentication. To use - authentication, pass ibex.net.rpc.xml() a URL in the form + authentication, pass [[ibex.net.rpc.xml()]] a URL in the form
        http[s]://user:password@hostname/
@@ -1802,8 +1800,8 @@
     
     
 
-        ibex.net.rpc.soap() is used instead of
-        ibex.net.rpc.xml()
+        [[ibex.net.rpc.soap()]] is used instead of
+        [[ibex.net.rpc.xml()]]
         
         Instead of specifying just the URL of the service itself, you
         must specify the URL, the SOAPAction argument, and the
@@ -1816,7 +1814,7 @@
     
     
     SOAP faults are handled the same way as XML-RPC faults except that the
-    capitalization of the faultstring and faultcode
+    capitalization of the [[faultstring]] and [[faultcode]]
     members is all lower-case, to match the SOAP spec. Here is a
     SOAP example:
     
@@ -1839,7 +1837,7 @@
     applications.
     
     The current Ibex SOAP stack does not support 'document style' or
-    multi-ref (href) data structures.
+    multi-ref ([[href]]) data structures.
     
     
@@ -1853,7 +1851,7 @@
- +
If the Ibex Core encounters an error while servicing a function call @@ -1915,11 +1913,11 @@ Thrown when an HTTP error code is returned during an - operation. The three characters xyz will be + operation. The three characters [[**xyz**]] will be the three-digit HTTP status code. - The caller attempted to transmit the null value via XML-RPC. + The caller attempted to transmit the [[null]] value via XML-RPC. The caller attempted to transmit a circular data structure via XML-RPC. @@ -1929,13 +1927,13 @@ XML-RPC (for example, a Box or the Ibex object). - A JavaScript attempted to put to a property on the null value + A JavaScript attempted to put to a property on the [[null]] value - A JavaScript attempted to get from a property on the null value + A JavaScript attempted to get from a property on the [[null]] value - A JavaScript attempted to call the null value + A JavaScript attempted to call the [[null]] value If an exception is thrown inside a trap, the exception will propagate @@ -1944,19 +1942,19 @@ If an uncaught exception is thrown while applying a template, or the requested template could not be found, an error will be logged and the box to which the template was being applied will be made invisible - (visible = false). This ensures that half-applied widgets are + ([[visible = false]]). This ensures that half-applied widgets are never shown to the user.
- +
- At any point in the Event Context, you can write to the mouse + At any point in the Event Context, you can write to the [[mouse]] property on any box. The value written should be an object with two - properties, x and y. For example: + properties, [[x]] and [[y]]. For example:
     _Press1 ++= function(p) {
@@ -1964,13 +1962,13 @@
     }
     
- The coordinates specified are relative to the box whose mouse + The coordinates specified are relative to the box whose [[mouse]] property is being written to. There is no need to supply the - inside property; it is computed automatically. Writing to - the mouse property causes Ibex to recompute the eventual - target box, and also alter the values returned by mouse.x, - mouse.y, and mouse.inside for any descendants - of the current box. Writing to the mouse property also + [[inside]] property; it is computed automatically. Writing to + the [[mouse]] property causes Ibex to recompute the eventual + target box, and also alter the values returned by [[mouse.x]], + [[mouse.y]], and [[mouse.inside]] for any **descendants** + of the current box. Writing to the [[mouse]] property also automatically prevents the event from returning to the box's parents -- it is equivalent to not cascading on the non-underscored event. This ensures that child boxes cannot trick their parent boxes into @@ -2011,7 +2009,7 @@
- You can create "fake events" by simply writing to the mouse + You can create "fake events" by simply writing to the [[mouse]] property and then writing a value to one of the underscored properties on a box. This will have exactly the same effect as if the use had actually pressed a key, clicked a button, or moved the mouse -- they @@ -2021,12 +2019,12 @@
- When the core first starts up, it clones the ibex object, + When the core first starts up, it clones the [[ibex]] object, creates a stream for the initial .ibex, and then places a trap on the - cloned ibex object so that its empty-string property returns + cloned [[ibex]] object so that its empty-string property returns the .ibex stream. The cloned Ibex object is then passed as the third - (optional) argument to ibex.apply(), making it the default - ibex object for the scripts that are executed as part of the + (optional) argument to [[ibex.apply()]], making it the default + [[ibex]] object for the scripts that are executed as part of the template instantiation.
@@ -2036,12 +2034,12 @@
     ibex.apply(ibex.box, new_ibex..main, new_ibex);
     
- Note that we called ibex.bless() on the stream before tacking + Note that we called [[ibex.bless()]] on the stream before tacking it on to the new Ibex object. The bless function returns a clone of the object passed to it, with a few traps which are explained below. Additionally, any sub-streams retrieved by accessing properties of the blessed stream will also automatically be blessed (blessed streams are - monadic). + **monadic**). Blessing a stream serves three purposes: @@ -2058,23 +2056,23 @@ If the stream is a template to be applied, the string - ".ibex" is appended. + "[[.ibex]]" is appended. - If the stream is an image, the string ".png" is - appended. If no stream is found, ".jpeg" and - ".gif" are tried, in that order. + If the stream is an image, the string "[[.png]]" is + appended. If no stream is found, "[[.jpeg]]" and + "[[.gif]]" are tried, in that order. - If the stream is an font, the string ".ttf" is + If the stream is an font, the string "[[.ttf]]" is appended. - Every call to ibex.bless() returns a different object + Every call to [[ibex.bless()]] returns a different object (which happens to be a clone of the object passed to it) with a completely separate set of static blocks. - Ibex can self-emulate by using ibex.clone() on the Ibex object; + Ibex can self-emulate by using [[ibex.clone()]] on the Ibex object; this technique is very similar to the use of ClassLoaders in Java. This is useful for a number of applications, including debuggers, IDEs, sandboxing untrusted code, remote-control, and @@ -2089,7 +2087,7 @@
- + Due to the expense and hassle imposed by the commercial PKI code @@ -2154,12 +2152,12 @@ such machines public IP addresses is a poor network security policy, and doing so squanders scarce public IPv4 addresses. As such, the onus is on the administrators of such machines to explicitly block access - to clients reporting a User-Agent: header beginning with the - four characters "IBEX". + to clients reporting a [[User-Agent:]] header beginning with the + four characters "[[IBEX]]". - All top-level windows created by Ibex are scarred -- a stripe + All top-level windows created by Ibex are **scarred** -- a stripe and a lock is drawn across the corner of the window. There is no way for a user interface to remove this scar. Ibex user interfaces may not create windows smaller than the size of the scar. @@ -2185,7 +2183,7 @@ - + Ibex's scripts are written in a modified subset of ECMA-262, revision 3 @@ -2198,25 +2196,25 @@ - The undefined value, ===, and !== + The [[undefined]] value, [[===]], and [[!==]] - The new keyword (and ECMAScript object inheritance) - eval + The [[new]] keyword (and ECMAScript object inheritance) + [[eval]] - getter and setter + [[getter]] and [[setter]] - The ECMA this keyword. + The ECMA [[this]] keyword. - The String, Number, and Boolean - classes. Note that string, number, and - boolean values are supported, however. + The [[String]], [[Number]], and [[Boolean]] + classes. Note that [[string]], [[number]], and + [[boolean]] values are supported, however. - You may not throw the null value. + You may not [[throw]] the [[null]] value. Additionally, you must declare all root-scope variables (with - var) before using them; failure to do so will result in an + [[var]]) before using them; failure to do so will result in an exception. Box properties are pre-defined in the scope that scripts are executed in. @@ -2226,13 +2224,13 @@ - The token .. is equivalent to [""]. + The token [[..]] is equivalent to [[[""]]]. Trapping Cloning - Extended catch syntax. The following code: + Extended [[catch]] syntax. The following code:
         } catch(e propname "foo.bar.baz") {
            // ...
@@ -2252,18 +2250,18 @@
         if it does appear, it must be the last one.
     
         Since Ibex ECMAscripts are wrapped in XML, the lexical token
-        "lt" is be interpreted as <, the lexical
-        token "gt" is be interpreted as >, and the
-        token "and" is interpreted as &&.
+        "[[lt]]" is be interpreted as [[<]], the lexical
+        token "[[gt]]" is be interpreted as [[>]], and the
+        token "[[and]]" is interpreted as [[&&]].
         Thus these tokens cannot be used as variable names.
     
-        The identifier static is a reserved word in
+        The identifier [[static]] is a reserved word in
         ECMAScript, but not in Ibex.
     
-        Ibex defines an additional reserved word, "assert",
+        Ibex defines an additional reserved word, "[[assert]]",
         which will evaluate the expression which follows it, throwing
-        a ibex.assertion.failed exception if the expression
-        evaluates to false.
+        a [[ibex.assertion.failed]] exception if the expression
+        evaluates to [[false]].
     
         To ensure that Ibex files appear the same in all text editors, tab
         characters are not allowed in Ibex files.
@@ -2297,7 +2295,7 @@
     
- +
@@ -2308,7 +2306,7 @@
         -l host:port    emit log to TCP socket
         -l [file]       write log to a file on disk
         -a              check assertions
-        -w   reserved for libibex
+        -w [window-id]  reserved for libibex
         -p              dump profiling information [not yet supported]
     
@@ -2325,28 +2323,28 @@ invoked. To inhibit this console window, provide a logging destination (file, port, etc). - The source-location parameter can be either the path - to an .ibex archive, the http url of an .ibex + The [[**source-location**]] parameter can be either the path + to an [[.ibex]] archive, the http url of an [[.ibex]] archive, or the path to a directory comprising an unpacked - .ibex archive. + [[.ibex]] archive. - The initial-template parameter is the stream name of + The [[**initial-template**]] parameter is the stream name of a template to be used as the initial template. If ommitted, it - defaults to main. + defaults to [[main]]. - The -v option causes Ibex to enable verbose logging; this will - cause it to log lots of information to the log file. This + The [[-v]] option causes Ibex to enable verbose logging; this will + cause it to log **lots** of information to the log file. This option will also substantially decrease Ibex's performance.
- + - +** Copyright (C) 2004 Adam Megacz, verbatim redistribution permitted. Ibex is a trademark of Adam Megacz - +** - + \ No newline at end of file diff --git a/src/org/ibex/util/Doc.java b/src/org/ibex/util/Doc.java index 70ef527..9770a99 100644 --- a/src/org/ibex/util/Doc.java +++ b/src/org/ibex/util/Doc.java @@ -2,6 +2,7 @@ // FEATURE: -- syntax highlighting // FEATURE: -- LaTeX moreverb package can help // FIXME: nest TextNodes within each other for bold+italic +// FEATURE: property tree package org.ibex.util; import java.util.*; @@ -9,7 +10,8 @@ import java.io.*; import org.ibex.util.*; public class Doc extends XML { - + + public static boolean slides = false; Root root = null; int skip = 0; Vec nodeStack = new Vec(); @@ -20,6 +22,7 @@ public class Doc extends XML { public Doc() { } public static void main(String[] s) throws Exception { + if (s.length > 0 && "slides".equals(s[0])) slides = true; Doc d = new Doc(); Reader r = new InputStreamReader(System.in); int len = 0; @@ -41,6 +44,14 @@ public class Doc extends XML { public void startElement(Element e) throws Exn { if (preStart != -1) return; + + Node target = (Node)nodeStack.lastElement(); + if (target == null) target = (Node)victim; + if (target != null) { + if (pending.length() > 0) target.addText(pending); + pending = ""; + } + String name = e.getLocalName(); Node newGuy = null; if (name.equals("ibex-doc")) { newGuy = new Root(e); @@ -52,11 +63,9 @@ public class Doc extends XML { } else if (name.equals("pre")) { preStart = getGlobalOffset(); } else if (name.equals("definition")) { newGuy = new Definition(e); + } else if (name.equals("math")) { newGuy = new Math(e); } else if (name.equals("property")) { newGuy = new Property(e); - } else if (name.equals("b")) { newGuy = new B(); - } else if (name.equals("i")) { newGuy = new I(); - } else if (name.equals("t")) { newGuy = new T(); } else if (name.equals("link")) { newGuy = new Link(e); } else if (name.equals("image")) { newGuy = new Image(e); @@ -71,22 +80,33 @@ public class Doc extends XML { } } + static Object victim = null; + public void whitespace(char[] ch, int start, int length) throws Exn, IOException { characters(ch, start, length); } public void endElement(Element e) throws Exn, IOException { + + Node target = (Node)nodeStack.lastElement(); + if (target == null) target = (Node)victim; if (preStart != -1) { if (!e.getLocalName().equals("pre")) return; - ((Node)nodeStack.lastElement()).addChild(new PRE(preStart, getGlobalOffset())); + target.addChild(new PRE(preStart, getGlobalOffset())); preStart = -1; } else if (skip > 0) { skip--; return; } else { + if (target != null) { + if (pending.length() > 0) target.addText(pending); + pending = ""; + } + if (nodeStack.lastElement() instanceof Section) victim = nodeStack.lastElement(); nodeStack.setSize(nodeStack.size() - 1); } } + public void characters(char[] ch, int start, int length) throws Exn, IOException { if (preStart != -1) return; - ((Node)nodeStack.lastElement()).addText(new String(ch, start, length)); + pending += new String(ch, start, length); } abstract class Node { @@ -96,20 +116,22 @@ public class Doc extends XML { public abstract void dumpLatex(StringBuffer sb); final String fixLatex(String s) { if (s == null) return ""; - s = s.replaceAll("\\$", "\\\\\\$ "); - s = s.replaceAll("\\\\([^\\$])", "\\$\\\\backslash\\$\\1"); + s = s.replaceAll("\\\\", "\\$\\\\backslash\\$"); + s = s.replaceAll("\\$", "\\\\\\$"); + s = s.replaceAll("\\\\\\$\\\\backslash\\\\\\$", "\\$\\\\backslash\\$"); + s = s.replaceAll("\\{", "\\\\{"); + s = s.replaceAll("\\}", "\\\\}"); + s = s.replaceAll("\\*\\*([^\n]+?)\\*\\*", "{\\\\it{$1}}"); + s = s.replaceAll("__([^\n]+?)__", "{\\\\textbf{$1}}"); + s = s.replaceAll("\\[\\[([^\n]+?)\\]\\]", "{\\\\texttt{$1}}"); s = s.replaceAll("LaTeX", "\\\\LaTeX"); s = s.replaceAll("\\%", "\\\\% "); s = s.replaceAll("#", "\\\\#"); - s = s.replaceAll("\\{", "\\\\{"); - s = s.replaceAll("\\}", "\\\\}"); s = s.replaceAll("\\&", "\\\\&"); s = s.replaceAll("\\~", "\\\\~"); s = s.replaceAll("_", "\\\\_"); - if (!(this instanceof T)) { - s = s.replaceAll(" \"", " ``"); - s = s.replaceAll("\"", "''"); - } + s = s.replaceAll(" \"", " ``"); + s = s.replaceAll("\"", "''"); return s; } } @@ -126,8 +148,38 @@ public class Doc extends XML { class Image extends EmptyNode { public String url; - public Image(XML.Element e) { url = e.getAttrVal("url"); } - public void dumpLatex(StringBuffer sb) { sb.append("\\hyperimage{" + url + "}"); } + public String caption; + public String width; + public String align; + public Image(XML.Element e) { + url = e.getAttrVal("url"); caption = e.getAttrVal("caption"); width = e.getAttrVal("width"); + align = e.getAttrVal("align"); + } + public void dumpLatex(StringBuffer sb) { + if (url.endsWith(".pdf")) { + if (width == null) { + sb.append("\\begin{figure}[H]\n"); + sb.append("\\begin{center}\n"); + sb.append("\\epsfig{file="+url.substring(0, url.length() - 4)+",width=\\textwidth}\n"); + if (caption != null) + sb.append("\\caption{"+fixLatex(caption)+"}\n"); + sb.append("\\end{center}\n"); + sb.append("\\end{figure}\n"); + } else { + if ("left".equals(align)) { + sb.append("\\begin{wrapfigure}{l}{"+width+"}\n"); + } else { + sb.append("\\begin{wrapfigure}{r}{"+width+"}\n"); + } + sb.append("\\epsfig{file="+url.substring(0, url.length() - 4)+",width="+width+"}%\n"); + if (caption != null) + sb.append("\\caption{"+fixLatex(caption)+"}\n"); + sb.append("\\end{wrapfigure}\n"); + } + } else { + sb.append("\\hyperimage{" + url + "}"); + } + } } class Heading extends EmptyNode { @@ -154,7 +206,7 @@ public class Doc extends XML { /** Nodes which contain only text; they split themselves if anything else is added */ class TextNode extends Node implements Cloneable { - protected String mytext = ""; + public String mytext = ""; private boolean canAcceptMoreText = true; public void dumpLatex(StringBuffer sb) { sb.append(fixLatex(mytext)); } public void addChild(Node o) { canAcceptMoreText = false; parent.addChild(o); } @@ -167,53 +219,47 @@ public class Doc extends XML { mytext = split[0]; parent.addChild(new ParagraphBreak()); o = ""; - for(int i=1; i 13) { + if (name.trim().length() > 13 && name.trim().indexOf(' ') == -1) { sb.append("\n\n{\\color{CodeBorder}\\hspace{-2cm}\\dotfill\\\\\\color{black}}"); sb.append("\\marginpar{\\raggedleft{\\texttt{\\textbf{\\footnotesize{"+fname+"}}}}\\\\"+type+" }"); sb.append("\\\\"); @@ -282,7 +339,10 @@ public class Doc extends XML { sb.append(s.substring(s.indexOf(' '))); } if (default_ != null) { - sb.append("\\\\{\\it default: }{\\texttt{" + fixLatex(default_) + "}}\n\n"); + String fd = fixLatex(default_); + fd = fd.replaceAll(" ``", " \""); + fd = fd.replaceAll("''", "\""); + sb.append("\\\\{\\it default: }{\\texttt{" + fd + "}}\n\n"); } else { sb.append("\n\n"); } @@ -303,21 +363,52 @@ public class Doc extends XML { } } + class Math extends ParagraphNode { + String tex = ""; + public Math(XML.Element e) { tex = e.getAttrVal("tex"); if (tex == null) tex = ""; } + public void addText(String s) { tex += s; } + public void dumpLatex(StringBuffer sb) { sb.append("\n\n$$\n" + tex.replaceAll("\n", " ") + "\n$$\n\n"); } + } + class Section extends ParagraphNode { String name; - public Section(XML.Element e) { name = e.getAttrVal("title"); } + public Section(XML.Element e) { + name = e.getAttrVal("title"); + if (slides) super.addChild(new List()); + } + public void addText(String s) { + if (slides) ((List)children.elementAt(0)).addText(s); + else super.addText(s); + } + public void addChild(Node n) { + /* if (slides) ((List)children.elementAt(0)).addChild(n); + else*/ super.addChild(n); + } public void dumpLatex(StringBuffer sb) { String secs = ""; String base = "section"; + int count = 0; + String pile = ""; for(Node n = parent; n != null; n = n.parent) if (n instanceof Section || n instanceof Appendix) { base = "section"; secs += "sub"; + for (int i=0; i indentation) { + if (spawn == null) spawn = new List(); + spawn.addText(txt); + spawn.addChild(new ParagraphBreak()); + continue; + } + if (spawn != null) { + spawn.dumpLatex(sb); + unusedItem = false; + spawn = null; } + if (!unusedItem) { unusedItem = true; sb.append("\n\n\\item\n"); } + sb.append(fixLatex(txt)); + } + if (spawn != null) { + spawn.dumpLatex(sb); + spawn = null; + } + if (sb.toString().replaceAll("\\[.+\\]", "").trim().length() > 0) { + sb0.append("\n\\begin{itemize}\n"); + sb0.append(sb.toString()); + sb0.append("\n\\end{itemize}\n"); } - sb.append("\n\\end{itemize}%\n"); } } @@ -373,63 +507,190 @@ public class Doc extends XML { email = e.getAttrVal("email"); subtitle = e.getAttrVal("subtitle"); } + public void addText(String s) { + if (victim != null) ((Node)victim).addText(s); + } + public void addChild(Node n) { + if (!(n instanceof Section)) + ((Section)victim).addChild(n); + else + super.addChild(n); + } public void dumpLatex(StringBuffer sb) { - sb.append("\\documentclass{article}\n"); - sb.append("\\def\\ninept{\\def\\baselinestretch{.95}\\let\\normalsize\\small\\normalsize}\n"); - sb.append("\\ninept\n"); - sb.append("\\usepackage{color}\n"); - sb.append("\\definecolor{CodeBorder}{rgb}{0.6,0.6,0.6}\n"); - sb.append("\\definecolor{CodeBackground}{rgb}{0.93,0.93,0.93}\n"); - sb.append("\\usepackage{graphicx}\n"); - sb.append("\\usepackage{courier}\n"); - sb.append("\\usepackage{fancyvrb}\n"); - sb.append("\\usepackage{fvrb-ex}\n"); - sb.append("\\usepackage{bold-extra}\n"); - sb.append("\\usepackage{ulem}\n"); - sb.append("\\usepackage{appendix}\n"); - sb.append("\\usepackage{amssymb,amsmath,epsfig,alltt}\n"); - sb.append("\\sloppy\n"); - sb.append("\\usepackage{palatino}\n"); - sb.append("\\usepackage{sectsty}\n"); - sb.append("\\allsectionsfont{\\sffamily}\n"); - sb.append("\\sectionfont{\\color{black}\\leftskip=-2cm\\hrulefill\\\\\\sffamily\\bfseries\\raggedleft\\vspace{1cm}}\n"); - sb.append("\\subsectionfont{\\color{black}\\dotfill\\\\\\sffamily\\raggedright\\hspace{-4cm}}\n"); - sb.append("\\newdimen\\sectskip\n"); - sb.append("\\newdimen\\subsectskip\n"); - sb.append("\\newdimen\\saveskip\n"); - sb.append("\\saveskip=\\leftskip\n"); - sb.append("\\sectskip=-2cm\n"); - sb.append("\\subsectskip=0cm\n"); - sb.append("\\let\\oldsection\\section\n"); - sb.append("\\let\\oldsubsection\\subsection\n"); - sb.append("\\def\\subsection#1{\\leftskip=\\sectskip\\oldsubsection{#1}\\leftskip=0cm}\n"); - sb.append("\\usepackage{parskip}\n"); - sb.append("\\usepackage{tabularx}\n"); - sb.append("\\usepackage{alltt}\n"); - sb.append("\\usepackage[pdftex,colorlinks=true,urlcolor=blue,linkcolor=blue,bookmarks=true]{hyperref}\n"); - // FIXME: pdfauthor, pdftitle, pdfsubject, pdfkeywords? - sb.append("\n"); - sb.append("\\begin{document}\n"); - sb.append("\\reversemarginpar\n"); - sb.append("\n"); - sb.append("\\title{\\textbf{\\textsf{\n"); - sb.append(title); - if (subtitle != null) sb.append("\\\\{\\large " + subtitle + "}\n"); - sb.append("}}}\n"); - if (author != null) { - sb.append("\\author{\n"); - sb.append(author); - if (email != null) sb.append("\\\\{\\tt " + email + "}\n"); - sb.append("}\n"); + if (slides) { + sb.append("\\documentclass[letter]{seminar}\n"); + sb.append("\\usepackage{calc} % Simple computations with LaTeX variables\n"); + sb.append("\\usepackage[hang]{caption2} % Improved captions\n"); + sb.append("\\usepackage{fancybox} % To have several backgrounds\n"); + sb.append(" % (must be loaded before `fancyvrb')\n"); + sb.append("\\usepackage{fancyhdr} % Headers and footers definitions\n"); + sb.append("\\usepackage{fancyvrb} % Fancy verbatim environments\n"); + sb.append("\\usepackage{wrapfig}\n"); + sb.append("\\usepackage{float}\n"); + sb.append("\\usepackage{amsmath}\n"); + sb.append("\\usepackage{amssymb}\n"); + sb.append("\\usepackage{pdftricks}\n"); + sb.append("\\begin{psinputs}\n"); + sb.append(" \\usepackage{pstcol} % PSTricks with the standard color package\n"); + sb.append(" % (before `graphicx' for the \\scalebox macro)\n"); + sb.append(" \\usepackage{graphicx} % Standard graphics package\n"); + sb.append(" \\usepackage{multido} % General loop macro\n"); + sb.append(" \\usepackage{pifont} % Ding symbols (mainly for lists)\n"); + sb.append(" \\usepackage{pst-fr3d} % PSTricks 3D framed boxes\n"); + sb.append(" \\usepackage{pst-grad} % PSTricks gradient mode\n"); + sb.append(" \\usepackage{pst-node} % PSTricks nodes\n"); + sb.append(" \\usepackage{pst-slpe} % Improved PSTricks gradients\n"); + sb.append("\\end{psinputs}\n"); + sb.append("\\usepackage{color}\n"); + sb.append("\\definecolor{CodeBorder}{rgb}{0.6,0.6,0.6}\n"); + sb.append("\\definecolor{CodeBackground}{rgb}{0.93,0.93,0.93}\n"); + sb.append("\\usepackage{graphicx}\n"); + sb.append("\\usepackage{courier}\n"); + sb.append("\\usepackage{fancyvrb}\n"); + sb.append("\\usepackage{float}\n"); + sb.append("\\usepackage{fvrb-ex}\n"); + sb.append("\\usepackage{bold-extra}\n"); + sb.append("\\usepackage{ulem}\n"); + sb.append("\\usepackage{amssymb,amsmath,epsfig,alltt}\n"); + sb.append("\\usepackage{semcolor} % Seminar colored slides\n"); + sb.append("\\usepackage{semhelv} % Seminar helvetica fonts\n"); + sb.append("\\usepackage{semlayer} % Seminar overlays\n"); + sb.append("\\usepackage{slidesec} % Seminar sections and list of slides\n"); + sb.append("\\usepackage{url} % Convenient URL typesetting\n"); + sb.append("\\usepackage[pdftex,letterpaper,pdffitwindow=true,colorlinks=true,pdfpagemode=UseNone,\n"); + sb.append(" bookmarks=true]{hyperref} % Hyperlinks for PDF versions\n"); + sb.append("\\usepackage{hcolor}\n"); + sb.append("\\slidepagestyle{fancy}\n"); + sb.append("\n"); + sb.append("\\slidesmag{4} % Set magnification of slide\n"); + sb.append("\\def\\SeminarPaperWidth{\\paperwidth / 2}\n"); + sb.append("\\def\\SeminarPaperHeight{\\paperheight / 2}\n"); + sb.append("\\slideframe{none} % No default frame\n"); + sb.append("\n"); + sb.append(" \n"); + sb.append("\n"); + sb.append(" % General size parameters\n"); + sb.append("\\renewcommand{\\slideparindent}{5mm}\n"); + sb.append("\\raggedslides[0mm]\n"); + sb.append("% \\renewcommand{\\slidetopmargin}{15.5mm}\n"); + sb.append("% \\renewcommand{\\slidebottommargin}{13mm}\n"); + sb.append("% \\renewcommand{\\slideleftmargin}{4mm}\n"); + sb.append("% \\renewcommand{\\sliderightmargin}{4mm}\n"); + sb.append(" % To adjust the frame length to the header and footer ones\n"); + sb.append("% \\autoslidemarginstrue\n"); + sb.append(" % We suppress the header and footer `fancyhdr' rules\n"); + sb.append("\\fancyhf{} % Clear all fields\n"); + sb.append("\\renewcommand{\\headrule}{}\n"); + sb.append("\\renewcommand{\\footrule}{}\n"); + sb.append("\n"); + sb.append("% \\usepackage{nohyperref} % To deactivate the `hyperref' features\n"); + sb.append("% \\overlaysfalse % To suppress overlays\n"); + sb.append("% \\def\\special@paper{}% Needed to avoid `hyperref' to collapse with ``dvips''\n"); + sb.append("\\newslideframe{IMAGE}{%\n"); + sb.append(" \\boxput{\\rput(0,0){%\n"); + sb.append(" \\includegraphics[width=\\SeminarPaperHeight,height=\\SeminarPaperWidth]{background.pdf}}}{#1}}\n"); + sb.append("\\slideframe*{IMAGE}\n"); + sb.append("%\\renewcommand{\\slideleftmargin}{3cm}\n"); + sb.append("%\\addtolength{\\slidewidth}{-\\slideleftmargin}\n"); + sb.append("\\RequirePackage[T1]{fontenc}\n"); + sb.append("\\RequirePackage{textcomp}\n"); + sb.append("\\renewcommand{\\rmdefault}{trebuchet}\n"); + sb.append("\\renewcommand{\\slidefonts}{%\n"); + sb.append(" \\renewcommand{\\rmdefault}{trebuchet}%\n"); + sb.append(" \\renewcommand{\\ttdefault}{courier}}%\n"); + sb.append(" \\newcommand{\\ParagraphTitle}[2][black]{%\n"); + sb.append(" \\noindent\\psshadowbox[fillstyle=solid,fillcolor=#1]{\\large{#2}}}\n"); + sb.append(" \\newcommand{\\CenteredParagraphTitle}[2][black]{%\n"); + sb.append(" \\centerline{\\psshadowbox[fillstyle=solid,fillcolor=#1]{\\large{#2}}}}\n"); + sb.append(" \\renewcommand{\\makeslideheading}[1]{%\n"); + sb.append(" \\CenteredParagraphTitle[black]{%\n"); + sb.append(" \\textcolor{black}{\\huge\\textbf{#1}}}}\n"); + sb.append(" \\renewcommand{\\makeslidesubheading}[1]{%\n"); + sb.append(" \\CenteredParagraphTitle{\\Large\\theslidesubsection{} -- #1}}\n"); + sb.append(" \\renewenvironment{dinglist}[2][black]\n"); + sb.append(" {\\begin{list}{\\ding{#2}}{}}{\\end{list}}\n"); + sb.append(" \\newcommand{\\DingListSymbolA}{43}\n"); + sb.append(" \\newcommand{\\DingListSymbolB}{243}\n"); + sb.append(" \\newcommand{\\DingListSymbolC}{224}\n"); + sb.append(" \\newcommand{\\DingListSymbolD}{219}\n"); + sb.append(" \\newcommand{\\eqbox}[2][0.6]{%\n"); + sb.append(" \\centerline{\\psshadowbox[fillstyle=solid,fillcolor=gray]{%\n"); + sb.append(" \\parbox{#1\\hsize}{%\n"); + sb.append(" \\[\n"); + sb.append(" \\textcolor{black} {#2}\n"); + sb.append(" \\]}}}}\n"); + sb.append("\\begin{document}\n"); + sb.append("\\begin{slide}\n"); + sb.append("\\begin{center}\n"); + sb.append("\\ParagraphTitle{\\bf \\Large "+title+"}\n"); + sb.append("\\vspace{5mm} \\\n"); + sb.append("\\textit{\\large "+subtitle+"} \\\\\n"); + sb.append("\\vspace{5mm} \\\n"); + sb.append("\\textit{"+author+"} \\\n"); + sb.append("\\end{center}\n"); + sb.append("\\end{slide}\n\n"); + super.dumpLatex(sb); + sb.append("\\end{document}"); + } else { + sb.append("\\documentclass{article}\n"); + sb.append("\\def\\ninept{\\def\\baselinestretch{.95}\\let\\normalsize\\small\\normalsize}\n"); + sb.append("\\ninept\n"); + sb.append("\\usepackage{color}\n"); + sb.append("\\definecolor{CodeBorder}{rgb}{0.6,0.6,0.6}\n"); + sb.append("\\definecolor{CodeBackground}{rgb}{0.93,0.93,0.93}\n"); + sb.append("\\usepackage{graphicx}\n"); + sb.append("\\usepackage{courier}\n"); + sb.append("\\usepackage{fancyvrb}\n"); + sb.append("\\usepackage{float}\n"); + sb.append("\\usepackage{wrapfig}\n"); + sb.append("\\usepackage{fvrb-ex}\n"); + sb.append("\\usepackage{bold-extra}\n"); + sb.append("\\usepackage{ulem}\n"); + sb.append("\\usepackage{amssymb,amsmath,epsfig,alltt}\n"); + sb.append("\\sloppy\n"); + sb.append("\\usepackage{palatino}\n"); + sb.append("\\usepackage{sectsty}\n"); + sb.append("\\allsectionsfont{\\sffamily}\n"); + sb.append("\\sectionfont{\\color{black}\\leftskip=-2cm"); + sb.append("\\hrulefill\\\\\\sffamily\\bfseries\\raggedleft\\vspace{1cm}}\n"); + sb.append("\\subsectionfont{\\color{black}\\dotfill\\\\\\sffamily\\raggedright\\hspace{-4cm}}\n"); + sb.append("\\newdimen\\sectskip\n"); + sb.append("\\newdimen\\subsectskip\n"); + sb.append("\\newdimen\\saveskip\n"); + sb.append("\\saveskip=\\leftskip\n"); + sb.append("\\sectskip=-2cm\n"); + sb.append("\\subsectskip=0cm\n"); + sb.append("\\let\\oldsection\\section\n"); + sb.append("\\let\\oldsubsection\\subsection\n"); + sb.append("\\def\\subsection#1{\\leftskip=\\sectskip\\oldsubsection{#1}\\leftskip=0cm}\n"); + sb.append("\\usepackage{parskip}\n"); + sb.append("\\usepackage{tabularx}\n"); + sb.append("\\usepackage{alltt}\n"); + sb.append("\\usepackage[pdftex,colorlinks=true,urlcolor=blue,linkcolor=blue,bookmarks=true]{hyperref}\n"); + // FIXME: pdfauthor, pdftitle, pdfsubject, pdfkeywords? + sb.append("\n"); + sb.append("\\begin{document}\n"); + sb.append("\\reversemarginpar\n"); + sb.append("\n"); + sb.append("\\title{\\textbf{\\textsf{\n"); + sb.append(title); + if (subtitle != null) sb.append("\\\\{\\large " + subtitle + "}\n"); + sb.append("}}}\n"); + if (author != null) { + sb.append("\\author{\n"); + sb.append(author); + if (email != null) sb.append("\\\\{\\tt " + email + "}\n"); + sb.append("}\n"); + } + sb.append("\n"); + sb.append("\\maketitle\n"); + sb.append("\\clearpage\n"); + sb.append("\\tableofcontents\n"); + sb.append("\\clearpage\n"); + sb.append("\\onecolumn\n"); + super.dumpLatex(sb); + sb.append("\\end{document}"); } - sb.append("\n"); - sb.append("\\maketitle\n"); - sb.append("\\clearpage\n"); - sb.append("\\tableofcontents\n"); - sb.append("\\clearpage\n"); - sb.append("\\onecolumn\n"); - super.dumpLatex(sb); - sb.append("\\end{document}"); } } }