tkar 0.63 → 0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING +22 -0
- data/README.md +142 -0
- data/Rakefile +64 -0
- data/{FAQ.rdoc → doc/faq.md} +9 -9
- data/{History.txt → doc/old-history.txt} +4 -0
- data/{protocol.rdoc → doc/protocol.md} +213 -210
- data/lib/tkar/version.rb +1 -2
- metadata +44 -78
- data/.gitignore +0 -5
- data/README.rdoc +0 -153
- data/TODO +0 -67
- data/bin/tkar +0 -104
- data/examples/s +0 -3
- data/install.rb +0 -1015
- data/rakefile +0 -56
- data/tasks/ann.rake +0 -80
- data/tasks/bones.rake +0 -20
- data/tasks/gem.rake +0 -201
- data/tasks/git.rake +0 -40
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -34
- data/tasks/rdoc.rake +0 -51
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -292
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- data/tasks/zentest.rake +0 -36
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4196633cb35d88e09177f98152a39c7e270e430c
|
4
|
+
data.tar.gz: d49c7da5c07643a4eb64a122dfcaf719739570a2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c3331fa2839d571f00e824df61e30e8c22e3a85d1043d8af16d403bac82b0c29725a9ffdbb02f19d7556144717b62b4a645d8a46bcbaecb51afd6290f34494d
|
7
|
+
data.tar.gz: 41d04aded1f21bc6bda145d67f288d512fab7a64bf456825683b80c32cfdc5ad9d88b39748e835cd1947bda13f21fd8690ce0ba2b7355952b7b312771a1fa1de
|
data/COPYING
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2006-2014, Joel VanderWerf, vjoel@users.sourceforge.net
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
17
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
22
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
# Tkar -- Tk-based animation process and protocol
|
2
|
+
|
3
|
+
The Tkar animator aims to do one thing well: listen to an incoming stream of data and animate it in a 2D canvas. User interaction is streamed back out.
|
4
|
+
|
5
|
+
Additional documentation:
|
6
|
+
|
7
|
+
* [protocol](doc/protocol.md)
|
8
|
+
* [FAQ](doc/faq.md)
|
9
|
+
|
10
|
+
## Overview
|
11
|
+
|
12
|
+
Tkar is a Tk/ruby-based animation program using TkCanvas. It accepts command input from stdin or a socket. Commands may define parametrized shapes, place them on the canvas, move and rotate them, change parameters, etc. User interaction events (click, drag, etc) are sent back on the socket or stdout. The canvas can be resized, scrolled, zoomed, and tracked to an object.
|
13
|
+
|
14
|
+
### Graphical constructs
|
15
|
+
|
16
|
+
* Shapes include: arc, oval, polygon, line, curve, text, bitmap.
|
17
|
+
|
18
|
+
* Parameters include color/pattern of border/area, arrowheads, splines, line dot/dash/width, text font, etc.
|
19
|
+
|
20
|
+
* Can group, layer, rotate, move, and scale objects
|
21
|
+
|
22
|
+
### Tkar command summary
|
23
|
+
|
24
|
+
command| effect
|
25
|
+
------| ------
|
26
|
+
_shape_| define shape in terms of primitives (Tk Canvas objects). Shape may expose any Tk parameters (e.g, colors, lengths of poly sides)
|
27
|
+
_add_| add object to canvas with specified shape, layer, position, rotation, params
|
28
|
+
_move_, _rotate_, _scale_, _delete_| operate on existing object
|
29
|
+
_param_| change param value of an object (e.g. change color or geometry over time; change arrow shape because endpoint moves)
|
30
|
+
_wait_| playback with specified frame rate
|
31
|
+
_update_| finish time step
|
32
|
+
_params_| set window params (color, size, zoom)
|
33
|
+
_follow_| follow a specified object
|
34
|
+
_load_| load file (like #include)
|
35
|
+
|
36
|
+
### User interaction
|
37
|
+
|
38
|
+
* Use keys and mouse to zoom, pan/scroll, select, double-click, drag, drop, etc.
|
39
|
+
|
40
|
+
* User commands are sent back over stream to controlling process, e.g. "drag 2 140.0 259.0" and "drop 2 7" ("2" and "7" are object ids)
|
41
|
+
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
### Prerequisites
|
46
|
+
|
47
|
+
#### Tcl/Tk
|
48
|
+
|
49
|
+
For windows: http://www.activestate.com/Products/ActiveTcl/
|
50
|
+
|
51
|
+
For linux, just use your distribution's package tool to install tcl. However, you may need to make sure that ruby and linux both use (or do not use) the pthread library.
|
52
|
+
|
53
|
+
#### Ruby
|
54
|
+
|
55
|
+
For windows: http://rubyforge.org/projects/rubyinstaller/
|
56
|
+
|
57
|
+
For other platforms: http://www.ruby-lang.org
|
58
|
+
|
59
|
+
### Gem installation
|
60
|
+
|
61
|
+
gem install tkar
|
62
|
+
|
63
|
+
Alternately, you can download the source code (tar ball or git repo) and run it in place using the <tt>--local-lib</tt> command line option
|
64
|
+
|
65
|
+
bin/tkar --local-lib
|
66
|
+
|
67
|
+
|
68
|
+
## Usage
|
69
|
+
|
70
|
+
### Command line
|
71
|
+
|
72
|
+
See the -h command line option for details on running tkar.
|
73
|
+
|
74
|
+
Examples are available with the source code--read the comments to see how to run.
|
75
|
+
|
76
|
+
### Tkar window
|
77
|
+
|
78
|
+
Press the "h" key for on-line help using the tkar window.
|
79
|
+
|
80
|
+
### Protocol
|
81
|
+
|
82
|
+
See [protocol](doc/protocol.md) for details on the protocol and writing shape files.
|
83
|
+
|
84
|
+
### Integrating tkar with other applications
|
85
|
+
|
86
|
+
There are three transport options:
|
87
|
+
|
88
|
+
1. Over pipe
|
89
|
+
|
90
|
+
Invoke as
|
91
|
+
|
92
|
+
cat data | tkar
|
93
|
+
|
94
|
+
or
|
95
|
+
|
96
|
+
program | tkar
|
97
|
+
|
98
|
+
- unidirectional (no mouseclick feedback to program)
|
99
|
+
|
100
|
+
- output messages simply go to stdout
|
101
|
+
|
102
|
+
- easy to write filters this way
|
103
|
+
|
104
|
+
2. Over TCP socket
|
105
|
+
|
106
|
+
Invoke as
|
107
|
+
|
108
|
+
tkar [<ipaddr>] <port>
|
109
|
+
|
110
|
+
- bidirectional; client can block waiting for update to finish
|
111
|
+
|
112
|
+
- remote host possible, using ipaddr=="localhost"
|
113
|
+
|
114
|
+
- if port is 0, lets OS choose port and prints it to stderr
|
115
|
+
|
116
|
+
- can still write filters by using netcat
|
117
|
+
|
118
|
+
3. Over unix domain socket
|
119
|
+
|
120
|
+
Invoke as
|
121
|
+
|
122
|
+
tkar /path/to/socket
|
123
|
+
|
124
|
+
- bidirectional; client can block waiting for update to finish
|
125
|
+
|
126
|
+
- faster than TCP (but unix/linux only)
|
127
|
+
|
128
|
+
Note that tkar has a -c option which tells it to be the socket client rather than the server. This is useful when your main program needs to choose the port, for example.
|
129
|
+
|
130
|
+
## Tkar and Simulink
|
131
|
+
|
132
|
+
Tkar can be interfaced with Simulink. Tkar appears in a simulink model as a block to which can be wired to any number of data sources that drive objects in the animation. You can have several tkar blocks. Think of tkar as the animation version of the built-in plotting block. (Simulink's built-in animation capabilities are bad.)
|
133
|
+
|
134
|
+
An additional set of C files need to be compiled as a Simulink extension. Contact author for details.
|
135
|
+
|
136
|
+
## Author
|
137
|
+
|
138
|
+
Copyright 2006-2014, Joel VanderWerf, mailto:vjoel@users.sourceforge.org
|
139
|
+
|
140
|
+
## License
|
141
|
+
|
142
|
+
License is BSD. See [COPYING](COPYING).
|
data/Rakefile
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
PRJ = "tkar"
|
5
|
+
|
6
|
+
def version
|
7
|
+
@version ||= begin
|
8
|
+
require 'tkar/version'
|
9
|
+
warn "Tkar::VERSION not a string" unless Tkar::VERSION.kind_of? String
|
10
|
+
Tkar::VERSION
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def tag
|
15
|
+
@tag ||= "#{PRJ}-#{version}"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run tests"
|
19
|
+
Rake::TestTask.new :test do |t|
|
20
|
+
t.libs << "lib"
|
21
|
+
t.libs << "ext"
|
22
|
+
t.test_files = FileList["test/**/*.rb"]
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Commit, tag, and push repo; build and push gem"
|
26
|
+
task :release => "release:is_new_version" do
|
27
|
+
require 'tempfile'
|
28
|
+
|
29
|
+
sh "gem build #{PRJ}.gemspec"
|
30
|
+
|
31
|
+
file = Tempfile.new "template"
|
32
|
+
begin
|
33
|
+
file.puts "release #{version}"
|
34
|
+
file.close
|
35
|
+
sh "git commit --allow-empty -a -v -t #{file.path}"
|
36
|
+
ensure
|
37
|
+
file.close unless file.closed?
|
38
|
+
file.unlink
|
39
|
+
end
|
40
|
+
|
41
|
+
sh "git tag #{tag}"
|
42
|
+
sh "git push"
|
43
|
+
sh "git push --tags"
|
44
|
+
|
45
|
+
sh "gem push #{tag}.gem"
|
46
|
+
end
|
47
|
+
|
48
|
+
namespace :release do
|
49
|
+
desc "Diff to latest release"
|
50
|
+
task :diff do
|
51
|
+
latest = `git describe --abbrev=0 --tags --match '#{PRJ}-*'`.chomp
|
52
|
+
sh "git diff #{latest}"
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Log to latest release"
|
56
|
+
task :log do
|
57
|
+
latest = `git describe --abbrev=0 --tags --match '#{PRJ}-*'`.chomp
|
58
|
+
sh "git log #{latest}.."
|
59
|
+
end
|
60
|
+
|
61
|
+
task :is_new_version do
|
62
|
+
abort "#{tag} exists; update version!" unless `git tag -l #{tag}`.empty?
|
63
|
+
end
|
64
|
+
end
|
data/{FAQ.rdoc → doc/faq.md}
RENAMED
@@ -1,18 +1,18 @@
|
|
1
|
-
|
1
|
+
# Design Decisions
|
2
2
|
|
3
|
-
|
3
|
+
## what is tkar trying to be?
|
4
4
|
|
5
5
|
The gnuplot of animation -- a quick and dirty way to get data (stream or file) into a window to see what is happening.
|
6
6
|
|
7
|
-
|
7
|
+
## why Tk?
|
8
8
|
|
9
9
|
Tcl/Tk is widely available, and the Ruby/Tk interface is a standard part of ruby.
|
10
10
|
|
11
|
-
|
11
|
+
## why TkCanvas?
|
12
12
|
|
13
13
|
TkCanvas has easy access to relatively high-level 2D vector graphics constructs, such as groups, layers, splines, fonts, icons, zoom, and scroll. Plus, it supports mouse/keyboard operations, dialogs, and so on.
|
14
14
|
|
15
|
-
|
15
|
+
## why not just write code in Ruby/Tk instead of stream to tkar?
|
16
16
|
|
17
17
|
1. Because you may not want to write your code in the Tk framework. Maybe you're using a different gui, or not a gui at all.
|
18
18
|
|
@@ -22,18 +22,18 @@ TkCanvas has easy access to relatively high-level 2D vector graphics constructs,
|
|
22
22
|
|
23
23
|
4. You can distribute processing: take advantage of 2 cpus, or even 2 hosts across a network.
|
24
24
|
|
25
|
-
|
25
|
+
## why not HTML 5 canvas, other gui canvas, or Processing?
|
26
26
|
|
27
27
|
Those are heavyweight and add more dependencies (browser, java), and in some cases still lack some of the features of TkCanvas. Tkar is light enough that you can run several instances at once even on resource limited machines.
|
28
28
|
|
29
|
-
|
29
|
+
## why not opengl?
|
30
30
|
|
31
31
|
It would be more work to get the diagram and user interaction stuff. Anyway, it's overkill.
|
32
32
|
|
33
|
-
|
33
|
+
## why a special protocol, rather than ruby/tk method calls serialized as text?
|
34
34
|
|
35
35
|
The protocol is not a programming language: there are no variables, functions, loops, etc. There are only macros. It is very simple, which makes it much easier to emit from other languages than ruby, and less prone to programming errors.
|
36
36
|
|
37
|
-
|
37
|
+
## why is the protocol so ugly?
|
38
38
|
|
39
39
|
It's not meant to be written by hand. You wouldn't write http headers by hand, would you?
|
@@ -1,206 +1,205 @@
|
|
1
|
-
|
1
|
+
# Tkar protocol
|
2
2
|
|
3
3
|
This document describes the syntax and semantics of the text commands sent over the two-way communication stream (pipe, tcp socket, unix socket) to the tkar process. (The binary protocol is not documented here.)
|
4
4
|
|
5
5
|
See also the command-line options for tkar by running it with the -h option:
|
6
6
|
|
7
|
-
|
7
|
+
tkar -h
|
8
8
|
|
9
|
-
|
9
|
+
## Syntax
|
10
10
|
|
11
11
|
Commands are case sensitive and separated by newlines, and arguments are separated (from commands and from each other) by spaces:
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
command1 arg0 arg1 arg2
|
14
|
+
command2 arg0 arg1 arg2
|
15
15
|
|
16
16
|
Use a backslash ("\") character at the end of a line to continue to the next line:
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
command1 arg0 \
|
19
|
+
arg1 arg2
|
20
20
|
|
21
21
|
Blank lines are ignored. Spaces before text on a line are ignored. Extra spaces between arguments is not significant.
|
22
22
|
|
23
23
|
Lines which are blank up to a # character are ignored (the text after the # is a comment):
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
command1 arg0 arg1 arg2
|
26
|
+
#command2 arg0 arg1 arg2 this line is not executed
|
27
27
|
|
28
28
|
However, # characters are significant after non-whitespace characters:
|
29
29
|
|
30
|
-
|
30
|
+
command1 arg0 arg1 #F0A020
|
31
31
|
|
32
32
|
The last argument is a typical color parameter.
|
33
33
|
|
34
|
-
|
34
|
+
## Process control
|
35
35
|
|
36
|
-
|
36
|
+
*`wait t`*
|
37
37
|
|
38
38
|
Tells tkar to sleep for up to t seconds before processessing the next command. The value may be floating point.
|
39
39
|
|
40
40
|
Wait is a way to keep the frame rate constant. A single timer with memory is used for all waits, so that if wait is called repeatedly, sleep time is reduced by the amount of time used for processing since the last wait. If processing time is less than wait time, the next processing cycle will begin exactly t seconds after the previous one (subject to OS process scheduling limitations).
|
41
41
|
|
42
|
-
|
42
|
+
*`done`*
|
43
43
|
|
44
44
|
Tells tkar to stop processing inputs, closing the input stream.
|
45
45
|
|
46
|
-
This is useful in exactly one case: only on MS Windows _and_ when input comes from a pipe (not a socket). Send a
|
46
|
+
This is useful in exactly one case: only on MS Windows _and_ when input comes from a pipe (not a socket). Send a `done` message when you are finished sending animation data to tkar. Otherwise, waiting for input that never arrives causes the UI thread to freeze, due to a bug in the VC6 MSVCRT.DLL.
|
47
47
|
|
48
|
-
|
48
|
+
*`exit`*
|
49
49
|
|
50
50
|
Exit the tkar process.
|
51
51
|
|
52
|
-
|
52
|
+
*`load FILE`*
|
53
53
|
|
54
|
-
Load the specified command file before proceeding with the next command. Any commands take the same effect as if they occurred in the current command sequence. Any number of files may be nested. The file is searched for first assuming that
|
54
|
+
Load the specified command file before proceeding with the next command. Any commands take the same effect as if they occurred in the current command sequence. Any number of files may be nested. The file is searched for first assuming that `FILE` is an absolute path and then, if the load command is nested in another file, relative to the dir of that file. The file name may contain spaces; no quotation is needed.
|
55
55
|
|
56
|
-
|
56
|
+
*`echo arg arg ...`*
|
57
57
|
|
58
58
|
Echo the arguments back on the output stream from tkar (the same output stream that contains user command messages as described later in this document).
|
59
59
|
|
60
60
|
|
61
|
-
|
61
|
+
## Window control
|
62
62
|
|
63
|
-
|
63
|
+
*`title TITLE`*
|
64
64
|
|
65
|
-
Sets the title of the window to
|
65
|
+
Sets the title of the window to `TITLE`.
|
66
66
|
|
67
|
-
|
67
|
+
*`background COLOR`*
|
68
68
|
|
69
69
|
Sets the window background color to <TT>COLOR</tt>. See the section on colors for an explanation of the argument.
|
70
70
|
|
71
|
-
|
71
|
+
*`width X`*
|
72
72
|
|
73
73
|
Sets the width (in pixels) of the animation window. (The window can be resized using the mouse.)
|
74
74
|
|
75
|
-
|
75
|
+
*`height Y`*
|
76
76
|
|
77
77
|
Sets the height (in pixels) of the animation window. (The window can be resized using the mouse.)
|
78
78
|
|
79
|
-
|
79
|
+
*`window_xy X Y`*
|
80
80
|
|
81
81
|
Sets the position of the window on the screen. Positive coordinates denote offset of window from left or top edge of screen. Negative coordinates denote offset from right or bottom edge.
|
82
82
|
|
83
|
-
|
83
|
+
*`zoom_to Z`*
|
84
84
|
|
85
85
|
Sets the zoom level of the animation window. A value of 1 means no zoom. A larger value makes objects look bigger. A smaller (positive) value makes objects look smaller. (The zoom can be changed using the mouse or the keyboard--see the help text for the window.)
|
86
86
|
|
87
|
-
|
87
|
+
*`view_at X Y`*
|
88
88
|
|
89
89
|
Scroll the canvas so that the point X Y (in canvas coordinates) is at the center of the window.
|
90
90
|
|
91
|
-
|
91
|
+
*`view_id ID`*
|
92
92
|
|
93
93
|
Scroll the canvas so that the object with specified id is at the center of the window.
|
94
94
|
|
95
|
-
|
95
|
+
*`follow ID`*
|
96
96
|
|
97
97
|
As the animation updates, scroll the window so that the object with specified id is at the center of the window.
|
98
98
|
|
99
|
-
|
99
|
+
*`bounds X_MIN Y_MIN X_MAX Y_MAX`*
|
100
100
|
|
101
101
|
Sets the dimensions of the canvas (of which only a portion is visible at a time in the window). The default values are <tt>-3000 -3000 3000 3000</tt>.
|
102
102
|
|
103
|
-
|
103
|
+
*`update`*
|
104
104
|
|
105
105
|
Draws all changed objects to the canvas.
|
106
106
|
|
107
|
-
|
107
|
+
*Should be called after each time-step (and after all the `move`, `rot`, etc. commands pertaining to the timestep have been sent) to update the display*.
|
108
108
|
|
109
109
|
|
110
|
-
|
110
|
+
## Shape definition
|
111
111
|
|
112
112
|
A shape definition is used to define how an object is drawn. Each object on the canvas has a shape. A shape is built out of one or more drawing primitives. A shape can reference another shape as a macro and can be parametrized, so that two objects with the same shape may look quite different. A parametrized shape can also be used for an object which changes its geometry or color dynamically.
|
113
113
|
|
114
114
|
The basic syntax of a shape definition is:
|
115
115
|
|
116
|
-
|
116
|
+
*`shape SHAPE_NAME PART0 PART1 PART2...`*
|
117
117
|
|
118
|
-
This defines a new shape with specified SHAPE_NAME
|
119
|
-
the parts of the shape.
|
118
|
+
This defines a new shape with specified `SHAPE_NAME`, which may be any string without whitespace. The `PART` strings are one or more space-free strings defining the parts of the shape.
|
120
119
|
|
121
|
-
The order of the
|
120
|
+
The order of the `PART`s is significant: later parts are drawn after, and therefore appear to be above the earlier parts.
|
122
121
|
|
123
122
|
The parts can be primitives (discussed below) or other shapes that have already been defined.
|
124
123
|
|
125
|
-
|
124
|
+
### Part Syntax
|
126
125
|
|
127
|
-
Each PART is of the form:
|
126
|
+
Each `PART` is of the form:
|
128
127
|
|
129
|
-
|
128
|
+
partnameARG,ARG,ARG,....
|
130
129
|
|
131
|
-
There are no spaces (or line continuations) within the entire PART
|
130
|
+
There are no spaces (or line continuations) within the entire `PART`.
|
132
131
|
|
133
132
|
The following rules apply:
|
134
133
|
|
135
|
-
-
|
136
|
-
|
137
|
-
|
138
|
-
|
134
|
+
- `partname` can be the name of a primitive or of another shape. In the latter case, the other shape acts as a _macro_, expanding its own primitives within the shape being defined. For example:
|
135
|
+
|
136
|
+
shape foo line0,0,10,10
|
137
|
+
shape bar foo
|
139
138
|
|
140
139
|
is equivalent to
|
141
140
|
|
142
|
-
|
143
|
-
|
141
|
+
shape foo line0,0,10,10
|
142
|
+
shape bar line0,0,10,10
|
144
143
|
|
145
144
|
Any (finite!) number of macros can be nested. Macros may take arguments; see the section on parametrized shapes.
|
146
145
|
|
147
146
|
- Arguments are separated from each other by a comma, but no spaces.
|
148
147
|
|
149
|
-
- The _positional_ arguments (i.e., the arguments whose meaning derives from their index in the list of arguments) of a primitive are appended to the name of the primitive
|
150
|
-
|
151
|
-
|
148
|
+
- The _positional_ arguments (i.e., the arguments whose meaning derives from their index in the list of arguments) of a primitive are appended to the name of the primitive *without any separating spaces or other characters*. For example:
|
149
|
+
|
150
|
+
shape label text0,50
|
152
151
|
|
153
152
|
Positional arguments are almost always coordinates, distances, or angles.
|
154
153
|
|
155
154
|
- The _key_-_value_ arguments (i.e., the arguments whose meaning derives from the key string paired with the value), if any, are appended after the positional arguments. They may occur in any order. The key and value are separated by a colon. For example:
|
156
|
-
|
157
|
-
|
155
|
+
|
156
|
+
shape label text0,50,anchor:c,justify:center,width:40,text:Untitled,fc:0
|
158
157
|
|
159
158
|
- In some cases, a single argument must be used to designate a list. In those cases, the "+" character is used to separate the values. For example, as an argument to a line primitive, the following denotes a list of three numbers, 10, 8, and 6, as the value for the arrowshape option:
|
160
|
-
|
161
|
-
|
159
|
+
|
160
|
+
shape arrow line0,0,*0,0,arrow:last,arrowshape:10+8+6
|
162
161
|
|
163
162
|
- If only key-value arguments are present, use a comma to separate the first argument from the name of the shape:
|
163
|
+
|
164
|
+
shape car carbox,fc:red
|
164
165
|
|
165
|
-
|
166
|
-
|
167
|
-
- In some cases, a value might need to include spaces (text, for example). In that case, use a parameter for that value and use the +param+ command to set the actual value. See the +text+ command entry.
|
166
|
+
- In some cases, a value might need to include spaces (text, for example). In that case, use a parameter for that value and use the `param` command to set the actual value. See the `text` command entry.
|
168
167
|
|
169
|
-
|
168
|
+
### Parametrized shapes
|
170
169
|
|
171
|
-
If a string of the form
|
170
|
+
If a string of the form `*N`, where `N` is a sequence of digits, occurs in a shape definition, then the shape is parametric. Parameters are not named and can only be referred to by the number `N`.
|
172
171
|
|
173
|
-
In an
|
172
|
+
In an `add` command, the `N`-th parameter supplied with the command is substituted into all places where `*N` appears in the shape definition. For example, the commands:
|
174
173
|
|
175
|
-
|
176
|
-
|
174
|
+
shape box rect*0,*0,*1,*1
|
175
|
+
add box 3 - 100 30 50 0 5 10
|
177
176
|
|
178
177
|
add a box defined by the points 5 5 and 10 10 at position 30 50. (Note that the coordinates 5 5 and 10 10 are in the shape's local coordinate system, whereas the coordinates 30 50 are in the canvas's global coordinates.)
|
179
178
|
|
180
|
-
|
179
|
+
*Note: all of these examples can be entered as standard input to tkar. Just make sure to type* `update` *when you want to see the effect.*
|
181
180
|
|
182
181
|
Parametrized shapes can be used as macros inside of shape definitions, in which case their parameters are substituted when the macro is expanded. For example:
|
183
182
|
|
184
|
-
|
185
|
-
|
186
|
-
|
183
|
+
shape box rect*0,*0,*1,*1
|
184
|
+
shape two_boxes box-20,-10 box10,20
|
185
|
+
add two_boxes 3 - 100 30 50 0
|
187
186
|
|
188
|
-
|
187
|
+
Parameters can be passed to a macro as well as to a primitive:
|
189
188
|
|
190
|
-
|
191
|
-
|
192
|
-
|
189
|
+
shape box rect*0,*0,*1,*1
|
190
|
+
shape two_boxes box-20,*0 box*0,20
|
191
|
+
add two_boxes 3 - 100 30 50 0 10
|
193
192
|
|
194
|
-
Note that the last line above ends with a single parameter value, 10, which is passed to the *0 parameter in
|
193
|
+
Note that the last line above ends with a single parameter value, 10, which is passed to the *0 parameter in `two_boxes`.
|
195
194
|
|
196
195
|
Note that not only positional arguments but also key-value arguments can be parametrized:
|
197
196
|
|
198
|
-
|
199
|
-
|
197
|
+
shape box rect*0,*0,*1,*1,fc:*2
|
198
|
+
add box 3 - 100 30 50 0 5 10 red
|
200
199
|
|
201
|
-
|
200
|
+
## Drawing primitives
|
202
201
|
|
203
|
-
Drawing primitives are used only within shape definitions. Primitives cannot be
|
202
|
+
Drawing primitives are used only within shape definitions. Primitives cannot be `add`-ed directily to the canvas. (This is because all primitives require some coordinates to outline the shape, but the `add` command only supplies coordinates of the _center_ [or origin] of the shape.)
|
204
203
|
|
205
204
|
Since these primitives are implemented directly in terms of TkCanvas primitives, the Tk manual is a helpful reference: http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm. Individual sections are linked to from the sections below.
|
206
205
|
|
@@ -218,186 +217,189 @@ Points to bear in mind when reading the Tk documentation:
|
|
218
217
|
|
219
218
|
- The object ID is handled by Tk as a _tag_.
|
220
219
|
|
221
|
-
|
220
|
+
### Coordinates
|
222
221
|
|
223
|
-
The coordinate system while defining shapes always has the following characteristics, regardless of the
|
222
|
+
The coordinate system while defining shapes always has the following characteristics, regardless of the `--flip` and `--radians` command-line arguments:
|
224
223
|
|
225
224
|
- The coordinate system is left-handed: positive x is to the right, positive y is down.
|
226
225
|
|
227
|
-
- The origin is the center of the shape (about which the shape will be rotated by the
|
226
|
+
- The origin is the center of the shape (about which the shape will be rotated by the `rot` command).
|
228
227
|
|
229
228
|
- Angles are measured in degrees clockwise from the positive x axis.
|
230
229
|
|
231
230
|
All primitives in the shape definition use this same coordinate system.
|
232
231
|
|
233
|
-
The coordinate system used when _adding_ objects to the canvas or moving them is different, and the orientation and units depend on the
|
232
|
+
The coordinate system used when _adding_ objects to the canvas or moving them is different, and the orientation and units depend on the `--flip` and `--radians` options.
|
234
233
|
|
235
|
-
|
234
|
+
### Colors
|
236
235
|
|
237
236
|
Color can be specified by name or by numeric value, using one of the notations
|
238
237
|
|
239
|
-
|
240
|
-
|
241
|
-
|
238
|
+
#RGB
|
239
|
+
#RRGGBB
|
240
|
+
#RRRGGGBBB
|
242
241
|
|
243
242
|
where each R or G or B is replaced by a hexidecimal digit. Alternately, a decimal integer can be used.
|
244
243
|
|
245
244
|
A list of color names is at http://www.tcl.tk/man/tcl8.4/TkCmd/colors.htm. Examples:
|
246
245
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
246
|
+
green
|
247
|
+
DarkOrchid2
|
248
|
+
#EECC66
|
249
|
+
#F0F
|
251
250
|
|
252
|
-
|
251
|
+
### Generic options
|
253
252
|
|
254
253
|
The following options apply to most primitives (each option has a shortcut, which is listed second).
|
255
254
|
|
256
|
-
|
255
|
+
#### *`fill:COLOR`*
|
257
256
|
|
258
|
-
|
257
|
+
#### *`fc:COLOR`*
|
259
258
|
|
260
259
|
Set the fill color of the primitive.
|
261
260
|
|
262
|
-
|
261
|
+
#### *`outline:COLOR`*
|
263
262
|
|
264
|
-
|
263
|
+
#### *`oc:COLOR`*
|
265
264
|
|
266
265
|
Set the outline color of the primitive.
|
267
266
|
|
268
|
-
|
267
|
+
#### *`width:WIDTH`*
|
269
268
|
|
270
|
-
|
269
|
+
#### *`wi:WIDTH`*
|
271
270
|
|
272
271
|
Set the line (or outline) width.
|
273
272
|
|
274
|
-
|
273
|
+
#### *`dash:DASH_TYPE`*
|
275
274
|
|
276
|
-
|
275
|
+
#### *`da:DASH_TYPE`*
|
277
276
|
|
278
277
|
Set the dash type for the line (or outline). The value can be an integer or a string. See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M27. For example,
|
279
278
|
|
280
|
-
|
279
|
+
da:48
|
281
280
|
|
282
281
|
produces a nice dashed line to represent the lines between lanes in a roadway. The 4 means 4 pixels without color; the 8 means 8 pixels with the specified outline color. Tk accepts any sequence of digits, but not all platforms support all sequences.
|
283
282
|
|
284
|
-
|
283
|
+
#### *`stipple:STIPPLE_TYPE`*
|
285
284
|
|
286
|
-
|
285
|
+
#### *`st:STIPPLE_TYPE`*
|
287
286
|
|
288
287
|
Set the stipple type for the region. See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M111. (This is not very useful.)
|
289
288
|
|
290
|
-
|
289
|
+
### Primitives
|
291
290
|
|
292
291
|
The primitives are the basic shapes from which user-defined shapes are built.
|
293
292
|
|
294
|
-
|
293
|
+
#### arc
|
295
294
|
|
296
|
-
|
295
|
+
*`arcX,Y,W,H,key:val...`*
|
297
296
|
|
298
297
|
Draw an arc-based shape, which may be a pieslice, a chord region (between a chord and the arc), or a true arc (segment of a circle or oval).
|
299
298
|
|
300
|
-
The point X Y is the center, W is width, H is height.
|
299
|
+
The point `X Y` is the center, `W` is width, `H` is height.
|
301
300
|
|
302
|
-
|
301
|
+
*Note that this differs from Tk's arc command,* whose inputs are two points: "two diagonally opposite corners of a rectangular region enclosing the oval". It's generally easier to work with center and height/width. Rotation may look strange if width != height (this is because the rectangular region is still used internally, and Tk doesn't rotate rectangles).
|
303
302
|
|
304
303
|
Options (in addition to the generic options) are:
|
305
304
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
305
|
+
option| values
|
306
|
+
------| ------
|
307
|
+
`extent:angle`| angular span of the arc
|
308
|
+
`start:angle`| angle of rotation of the arc, measured _counterclockwise_ from the positive x-axis
|
309
|
+
`style:sty`| `pieslice`, `chord`, or `arc`
|
311
310
|
|
312
311
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M119
|
313
312
|
|
314
|
-
|
313
|
+
#### line
|
315
314
|
|
316
|
-
|
315
|
+
*`lineX1,Y1,X2,Y2...,key:val...`*
|
317
316
|
|
318
317
|
Draw a line or other one-dimensional curve.
|
319
318
|
|
320
|
-
The curve follows the sequence of points X1 Y1, X2 Y2,
|
319
|
+
The curve follows the sequence of points `X1 Y1, X2 Y2, ....`
|
321
320
|
|
322
321
|
Options (in addition to the generic options) are:
|
323
322
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
323
|
+
option| values
|
324
|
+
------| ------
|
325
|
+
`arrow:val`| `none`, `first`, `last`, or `both`
|
326
|
+
`arrowshape:N+N+N`| three numbers separated by a \+ character(*)
|
327
|
+
`capstyle:style`| `butt`, `projecting`, `round`
|
328
|
+
`joinstyle:style`| `miter`, `bevel`, `round`
|
329
|
+
`smooth:bool`| `true` or `false`
|
330
|
+
`splinesteps:number`| number of smoothing steps
|
331
331
|
|
332
332
|
(*) Paraphrasing the Tk documentation on arrowshape: The first number gives the distance along the line from the neck of the arrowhead to its tip. The second number gives the distance along the line from the trailing points of the arrowhead to the tip, and the third number gives the distance from the outside edge of the line to the trailing points.
|
333
333
|
|
334
334
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M139
|
335
335
|
|
336
|
-
|
336
|
+
#### oval
|
337
337
|
|
338
|
-
|
338
|
+
*`ovalX1,Y1,X2,Y2,key:val...`*
|
339
339
|
|
340
340
|
Draws a circle or oval.
|
341
341
|
|
342
|
-
The points X1 Y1 and X2 Y2 define the diagonally opposite corners of the bounding box of the oval.
|
342
|
+
The points `X1 Y1` and `X2 Y2` define the diagonally opposite corners of the bounding box of the oval.
|
343
343
|
|
344
344
|
There are no options other than the generic options.
|
345
345
|
|
346
346
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M146
|
347
347
|
|
348
|
-
|
348
|
+
#### rect
|
349
349
|
|
350
|
-
|
350
|
+
*`rectX1,Y1,X2,Y2,key:val...`*
|
351
351
|
|
352
352
|
Draws a rectangle.
|
353
353
|
|
354
|
-
The points X1 Y1 and X2 Y2 define the diagonally opposite corners.
|
354
|
+
The points `X1 Y1` and `X2 Y2` define the diagonally opposite corners.
|
355
355
|
|
356
|
-
|
356
|
+
*Note: A rect is not rotatable. Use a polygon instead.*
|
357
357
|
|
358
358
|
There are no options other than the generic options.
|
359
359
|
|
360
360
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M151
|
361
361
|
|
362
|
-
|
362
|
+
#### poly
|
363
363
|
|
364
|
-
|
364
|
+
*`polyX1,Y1,X2,Y2,...key:val...`*
|
365
365
|
|
366
366
|
Draw a polygon or closed curve.
|
367
367
|
|
368
|
-
The edges or curve segments follow the sequence of points X1 Y1, X2 Y2,
|
368
|
+
The edges or curve segments follow the sequence of points `X1 Y1, X2 Y2, ....` and the last point is connected to the first.
|
369
369
|
|
370
370
|
Options (in addition to the generic options) are:
|
371
371
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
372
|
+
option| values
|
373
|
+
------| ------
|
374
|
+
`joinstyle:val`| `miter`, `bevel`, or `round`
|
375
|
+
`smooth:bool`| `true` or `false`
|
376
|
+
`splinesteps:number`| number of smoothing steps
|
376
377
|
|
377
378
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M147
|
378
379
|
|
379
|
-
|
380
|
+
#### text
|
380
381
|
|
381
|
-
|
382
|
+
*`textX,Y,key:val...`*
|
382
383
|
|
383
384
|
Draws text string at the indicated location. (Text is not rotatable.)
|
384
385
|
|
385
386
|
Options (in addition to the generic options) are:
|
386
387
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
388
|
+
option| values
|
389
|
+
------| ------
|
390
|
+
`anchor:anchorPos`| `center`, `n`, `nw`, ...
|
391
|
+
`font:fontName`| font name
|
392
|
+
`justify:how`| `left`, `right`, or `center`
|
393
|
+
`text:string`| string to display(**)
|
394
|
+
`width:lineLength`| length at which line is wrapped
|
393
395
|
|
394
396
|
(**) text with embedded spaces can be specified only via a param command.
|
395
397
|
|
396
398
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M152
|
397
399
|
|
398
|
-
|
400
|
+
#### image
|
399
401
|
|
400
|
-
|
402
|
+
*`imageX,Y,key:val...`*
|
401
403
|
|
402
404
|
Draws an image from a file at the indicated location. (An image is not rotatable.)
|
403
405
|
|
@@ -405,135 +407,136 @@ Tk supports only GIF, by default, though Tk can be extended to support other for
|
|
405
407
|
|
406
408
|
Options (in addition to the generic options) are:
|
407
409
|
|
408
|
-
|
409
|
-
|
410
|
-
|
410
|
+
option| values
|
411
|
+
------| ------
|
412
|
+
`anchor:anchorPos`| `center`, `n`, `nw`, ...
|
413
|
+
`image:imageFileName`| file name of the gif file
|
411
414
|
|
412
415
|
Note that tkar is smart about caching image data. The file is read once, no matter how many times it is referenced in different shapes.
|
413
416
|
|
414
417
|
See http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm#M134
|
415
418
|
|
416
|
-
|
419
|
+
#### polybox
|
417
420
|
|
418
|
-
|
421
|
+
*`polyboxDX,DY`*
|
419
422
|
|
420
|
-
Draws a rotatable rectangle extending DX units on each side of the Y axis, and extending DY units above and below the X axis.
|
423
|
+
Draws a rotatable rectangle extending `DX` units on each side of the Y axis, and extending `DY` units above and below the X axis.
|
421
424
|
|
422
425
|
Not a Tk primitive, but a simple poly-derived shape that can be used to draw a rectangle with rotation. This doesn't have an offset parameter. If the rectangle needs to be offset from the shape origin, use a polygon.
|
423
426
|
|
424
427
|
There are no options other than the generic options.
|
425
428
|
|
426
429
|
|
427
|
-
|
430
|
+
## Object manipulation
|
428
431
|
|
429
|
-
|
432
|
+
*`add SHAPE_NAME ID FLAGS LAYER X Y R [PARAM0 PARAM1 ...]`*
|
430
433
|
|
431
|
-
Add an object to the canvas. The shape of the object is determined by the SHAPE_NAME, which must have been defined using the
|
434
|
+
Add an object to the canvas. The shape of the object is determined by the SHAPE_NAME, which must have been defined using the `shape` command.
|
432
435
|
|
433
|
-
The ID must be a unique nonnegative integer in the range 0..2^32-1. If an object with that ID already exists (with any shape), the new object will replace the existing object.
|
436
|
+
The `ID` must be a unique nonnegative integer in the range 0..2^32-1. If an object with that `ID` already exists (with any shape), the new object will replace the existing object.
|
434
437
|
|
435
|
-
FLAGS is a string which is currently unused but will be used to set various flags (such as clickable and draggable).
|
438
|
+
`FLAGS` is a string which is currently unused but will be used to set various flags (such as clickable and draggable).
|
436
439
|
|
437
|
-
LAYER is a nonnegative integer in the range 0..2^32-1 which specifies the drawing order. Higher numbers cause objects to be drawn on top of objects with lower layer numbers.
|
440
|
+
`LAYER` is a nonnegative integer in the range 0..2^32-1 which specifies the drawing order. Higher numbers cause objects to be drawn on top of objects with lower layer numbers.
|
438
441
|
|
439
|
-
The X Y and R parameters are floating point signed decimal numbers describing the global coordinates and rotation of the object. These numbers define the origin and rotation that are used to draw the primitives of SHAPE_NAME
|
442
|
+
The `X` `Y` and `R` parameters are floating point signed decimal numbers describing the global coordinates and rotation of the object. These numbers define the origin and rotation that are used to draw the primitives of `SHAPE_NAME`. See the `moveto` and `rot` commands.
|
440
443
|
|
441
|
-
The PARAM parameters are as described for the
|
444
|
+
The `PARAM` parameters are as described for the `param` command. A `PARAM` given in the add command cannot include spaces. However, a `PARAM` given with the `param` command _can_ include spaces.
|
442
445
|
|
443
|
-
Only the PARAM fields are optional--all others are required.
|
446
|
+
Only the `PARAM` fields are optional--all others are required.
|
444
447
|
|
445
|
-
|
448
|
+
*`del ID`*
|
446
449
|
|
447
|
-
Deletes the object with the specified ID from the canvas.
|
450
|
+
Deletes the object with the specified `ID` from the canvas.
|
448
451
|
|
449
|
-
|
452
|
+
*`delete_all`*
|
450
453
|
|
451
454
|
Deletes all objects. Does not delete shape definitions.
|
452
455
|
|
453
|
-
|
456
|
+
*`moveto ID X Y`*
|
454
457
|
|
455
|
-
Move the object with the specified ID to canvas coordinates X Y
|
458
|
+
Move the object with the specified `ID` to canvas coordinates `X` `Y`. (The coordinate system is left handed unless the --flip command line option is used.)
|
456
459
|
|
457
|
-
|
460
|
+
*`rot ID R`*
|
458
461
|
|
459
|
-
Rotate the object with the specified ID to R degrees (absolute, not relative to current rotation). (Uses radians if the --radians command line option is given.)
|
462
|
+
Rotate the object with the specified `ID` to `R` degrees (absolute, not relative to current rotation). (Uses radians if the --radians command line option is given.)
|
460
463
|
|
461
|
-
|
464
|
+
*`param ID N VALUE`*
|
462
465
|
|
463
|
-
Set the N-th parameter (index starting from 0) of object ID to VALUE
|
466
|
+
Set the N-th parameter (index starting from 0) of object `ID` to `VALUE`. Params can be used to control many aspects of a shape, including colors, dimensions, offsets, line characteristics, boolean flags, text, etc.
|
464
467
|
|
465
468
|
It is not possible to modify the flags, layer, or shape--use an add command to do that (if you add an object with the same ID as before, the old object will be deleted).
|
466
469
|
|
467
|
-
|
470
|
+
*`scale_obj ID xf yf`*
|
468
471
|
|
469
|
-
Scales the object in the x dimension by a x factor of
|
472
|
+
Scales the object in the x dimension by a x factor of `xf` and in the y dimension by a factor of `yf`. A factor of 1.0 means no scaling. A factor of 2.0 means double size, and so on.
|
470
473
|
|
471
|
-
|
474
|
+
## Abbreviations
|
472
475
|
|
473
476
|
Most commands have abbreviated or alternate versions. The following list shows all commands with alternates indicated by a | character and abbreviations indicated by a > character (for example, update can be abbreviated as "u" or "up").
|
474
477
|
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
478
|
+
a>dd
|
479
|
+
d>el>ete
|
480
|
+
m>ove>to
|
481
|
+
r>ot>ate
|
482
|
+
p>ar>am
|
483
|
+
s>h>ape
|
484
|
+
u>p>date
|
485
|
+
title
|
486
|
+
background|bg
|
487
|
+
height
|
488
|
+
width
|
489
|
+
zoom_to|zoom
|
490
|
+
view_at|view
|
491
|
+
view_id
|
492
|
+
wait
|
493
|
+
follow
|
494
|
+
done
|
495
|
+
bound>s
|
496
|
+
load
|
497
|
+
exit
|
498
|
+
delete_all
|
499
|
+
scale>_obj
|
500
|
+
echo
|
501
|
+
window_xy
|
502
|
+
|
503
|
+
|
504
|
+
## Tkar outputs
|
502
505
|
|
503
506
|
Tkar sends outputs back on the stream to the controlling process. Typically this stream is either the stdout of tkar or a socket. Tkar also writes output to stderr.
|
504
507
|
|
505
|
-
|
508
|
+
### User command messages
|
506
509
|
|
507
510
|
Tkar sends back outputs as the result of user interaction. These output commands can be used to update the controlling program's model of the objects, or to implement simple GUI widgets (buttons, sliders, control points, etc.).
|
508
511
|
|
509
|
-
|
512
|
+
*`drag DRAG_ID X Y`*
|
510
513
|
|
511
|
-
User has dragged the object with id DRAG_ID to X Y
|
514
|
+
User has dragged the object with id `DRAG_ID` to `X` `Y`.
|
512
515
|
|
513
|
-
|
516
|
+
*`drop DRAG_ID [TARGET_ID]`*
|
514
517
|
|
515
|
-
User has dropped the object with id DRAG_ID
|
518
|
+
User has dropped the object with id `DRAG_ID`. If `TARGET_ID` is given, the object was dropped on top of the object with id `TARGET_ID`.
|
516
519
|
|
517
|
-
|
520
|
+
*`click ID`*
|
518
521
|
|
519
|
-
User has clicked on object with id ID
|
522
|
+
User has clicked on object with id `ID`.
|
520
523
|
|
521
|
-
|
524
|
+
*`doubleclick ID`*
|
522
525
|
|
523
|
-
User has doubleclicked on object with id ID
|
526
|
+
User has doubleclicked on object with id `ID`.
|
524
527
|
|
525
|
-
|
528
|
+
*`quit`*
|
526
529
|
|
527
530
|
User has pressed Ctrl-q
|
528
531
|
|
529
|
-
|
532
|
+
*`update`*
|
530
533
|
|
531
534
|
Update cycle has finished. This message is sent back out by tkar once for every update command that comes into tkar. This is useful to keep the two programs, tkar and the controlling program, in sync.
|
532
535
|
|
533
|
-
|
536
|
+
### Error messages
|
534
537
|
|
535
538
|
Error messages are also sent back to the controlling process on the stream.
|
536
539
|
|
537
|
-
|
540
|
+
### stderr messages
|
538
541
|
|
539
542
|
Tkar uses stderr as a second destination for outputs, separate from the stream used by the controlling process. This is useful for diagnostics and logging. If the -v (verbose) command-line option is given, the stderr output copies all input commands. This can be used to create a replayable record of the animation. The stderr stream also includes error messages.
|