Permalink
Browse files

some more snippets. added elapsed_time, pause, resume, link & added t…

…hem to grammar
  • Loading branch information...
1 parent fd7a1e3 commit 3795bad51cb94a0187380e50de797eb5adaa2510 @lastobelus committed Jun 1, 2009
View
16 README
@@ -14,7 +14,21 @@ Contains the sequence diagram macros from http://www.umlgraph.org/ in a template
* added begin_group...end_group to draw a group box around objects
* added message_self to draw common way of showing messages to self in one call
* added title, which just prints text & does a step.**
-
+ * added elapsed_time, a dotted divider line with an elapsed time squiggle
+ * added link, a document-wide box indicating a link to a sequence in another document
+ * added pause & resume, which draws a slanted dotted line across a swimlane to make conditional
+ sections easier to read, using something like:
+ message_self(OBJ, "has_catz?")
+ pause(OBJ);
+ divider_line();
+ lconstraint(OBJ, "YES");
+ resume(OBJ);
+ inactive(OBJ);active(OBJ);
+ divider_line();
+ lconstraint(OBJ, "NO");
+ resume(OBJ);
+
+
The bundle has a command for previewing the sequence diagram in Preview, and for saving it to pdf (requires pic2plot and epstopdf).
pic2plot is contained in the umlgraph package at http://www.umlgraph.org/
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>async();$0</string>
+ <key>name</key>
+ <string>async (async)</string>
+ <key>tabTrigger</key>
+ <string>async</string>
+ <key>uuid</key>
+ <string>C48844D5-3E5F-4289-BB39-200DD0D7B6B4</string>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>"\fB${1:text}\fP"</string>
+ <key>name</key>
+ <string>bold (b)</string>
+ <key>tabTrigger</key>
+ <string>b</string>
+ <key>uuid</key>
+ <string>29FE4C8D-61CF-460D-8D49-845BA84B478C</string>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>elapsed_time();$0</string>
+ <key>name</key>
+ <string>elapsed_time (elt)</string>
+ <key>tabTrigger</key>
+ <string>elt</string>
+ <key>uuid</key>
+ <string>A70FCC5A-0774-4DF9-81A9-CFDDCCCF21FC</string>
+</dict>
+</plist>
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
- <string>active(${1:id});$0</string>
+ <string>inactive(${1:id});$0</string>
<key>name</key>
<string>inactive (inac)</string>
<key>scope</key>
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>section_line();$0</string>
+ <key>name</key>
+ <string>section_line (sec)</string>
+ <key>tabTrigger</key>
+ <string>sec</string>
+ <key>uuid</key>
+ <string>B2F573C0-EE7E-48DD-8F39-0A3937F6D396</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>step();$0</string>
+ <key>name</key>
+ <string>step (st)</string>
+ <key>scope</key>
+ <string>source.pic</string>
+ <key>tabTrigger</key>
+ <string>step</string>
+ <key>uuid</key>
+ <string>30637E46-B140-42AD-A211-561FBCD43792</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>step2();$0</string>
+ <key>name</key>
+ <string>step2 (st2)</string>
+ <key>scope</key>
+ <string>source.pic</string>
+ <key>tabTrigger</key>
+ <string>step</string>
+ <key>uuid</key>
+ <string>905ACEB1-7A86-460E-B9A8-9DC8450FDBD7</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>step3();$0</string>
+ <key>name</key>
+ <string>step3 (st3)</string>
+ <key>scope</key>
+ <string>source.pic</string>
+ <key>tabTrigger</key>
+ <string>step</string>
+ <key>uuid</key>
+ <string>208EA48F-EFE9-4118-AFEC-67EA0EF38781</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>step4();$0</string>
+ <key>name</key>
+ <string>step4 (st4)</string>
+ <key>scope</key>
+ <string>source.pic</string>
+ <key>tabTrigger</key>
+ <string>step</string>
+ <key>uuid</key>
+ <string>60D4F610-A85D-485D-9AF3-638BD640B940</string>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>sync();$0</string>
+ <key>name</key>
+ <string>sync (sync)</string>
+ <key>tabTrigger</key>
+ <string>sync</string>
+ <key>uuid</key>
+ <string>69D647ED-3660-46D0-93F9-5AB14BDA872D</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>title("\fB${1:text}\fP");$0</string>
+ <key>name</key>
+ <string>title (tit)</string>
+ <key>scope</key>
+ <string>source.pic</string>
+ <key>tabTrigger</key>
+ <string>tit</string>
+ <key>uuid</key>
+ <string>00201F00-5509-4DD8-9F10-E05248F5C6A3</string>
+</dict>
+</plist>
@@ -106,7 +106,7 @@
<key>1</key>
<dict>
<key>name</key>
- <string>storage.activation.sequence.pic</string>
+ <string>support.function.activation.sequence.pic</string>
</dict>
<key>2</key>
<dict>
@@ -125,7 +125,7 @@
</dict>
</dict>
<key>match</key>
- <string>\b(active|inactive|complete|delete)(\()(\w+)(\));</string>
+ <string>\b(active|inactive|complete|delete|pause|resume)(\()(\w+)(\));</string>
<key>name</key>
<string>meta.object.activation.sequence.pic</string>
</dict>
@@ -320,12 +320,52 @@
</dict>
</dict>
<key>match</key>
- <string>^\s*(step|async|sync|divider_line|section_line)(\(\));</string>
+ <string>^\s*(step|async|sync|divider_line|section_line|elapsed_time)(\(\));</string>
<key>name</key>
<string>meta.control.sequence.pic</string>
</dict>
<dict>
<key>begin</key>
+ <string>\b(link)(\()</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.object.definition.sequence.pic</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.parameters.sequence.pic</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>(\));</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.parameters.sequence.pic</string>
+ </dict>
+ </dict>
+ <key>name</key>
+ <string>meta.control.labeled.sequence.pic</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#strings</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#arguments</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>begin</key>
<string>\b(begin_frame|end_frame)(\()(\w+),(\w+),?</string>
<key>beginCaptures</key>
<dict>
@@ -110,6 +110,7 @@ define extend_lifeline {
lifestart_$1 = Here.y;
}
+
# complete(name)
# Complete the lifeline of the object with the given name
define complete {
@@ -304,6 +305,21 @@ define step {
move spacing;
}
+define step2 {
+ down;
+ move spacing*2;
+}
+
+define step3 {
+ down;
+ move spacing*3;
+}
+
+define step4 {
+ down;
+ move spacing*4;
+}
+
# Switch to asynchronous messages
define async {
if(arrowhead != 0) then {
@@ -494,3 +510,55 @@ define message_self {
# leave room for group
step();
+
+define elapsed_time {
+ move down spacing*1.5;
+ jag = 2*spacing/3
+ line from (left_side, Here.y) right movewid then right jag down jag then right jag*2 up jag*2 then down jag right jag then to (right_side, Here.y) dotted
+ move down spacing*1.5;
+}
+
+
+define pause {
+ step();
+ start_y = Here.y
+ if (active_$1 > 0) then {
+ # # draw the left edges of the boxes
+ move to ($1.x - awid/2, Here.y);
+ for level = 1 to active_$1 do {
+ line from (Here.x, lifestart_$1) to Here;
+ move right awid/2 up awid/8
+ }
+ #
+ # # draw the right edge of the innermost box
+ move right awid/2 up awid/8
+ line from (Here.x, lifestart_$1) to Here;
+ lifestart_$1 = start_y - awid/8;
+ line from ($1.x - awid*1.5, start_y - awid/4) to (Here.x + awid, Here.y + awid/4) dotted
+ }
+}
+
+define resume {
+ if (active_$1 > 0) then {
+ # # draw the left edges of the boxes
+ line from ($1.x, lifestart_$1) to ($1.x, Here.y+dashwid) dashed;
+ start_y = Here.y
+ lifestart_$1 = start_y
+ move to ($1.x - awid/2, Here.y);
+ for level = 1 to active_$1 do {
+ line from (Here.x, lifestart_$1) to (Here.x, Here.y+0.01);
+ move right awid/2 up awid/8
+ }
+ #
+ # # draw the right edge of the innermost box
+ move right awid/2 up awid/8
+ line from (Here.x, lifestart_$1) to Here;
+ line from ($1.x - awid*1.5, start_y - awid/4) to (Here.x + awid, Here.y + awid/4) dotted
+ }
+}
+
+define link {
+ step();
+ box with .nw at (left_side+movewid/8, Here.y) wid right_side - left_side - 3*movewid/8 fill 0.1 $1
+ line from last box.nw to (last box.nw.x + boxht/2, last box.nw.y - boxht/2) then to last box.sw
+}
Oops, something went wrong.

0 comments on commit 3795bad

Please sign in to comment.