-
Notifications
You must be signed in to change notification settings - Fork 0
/
figures.tcl
50 lines (40 loc) · 1.27 KB
/
figures.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- tcl -*- Copyright (c) 2012-2024 Andreas Kupries
# # ## ### ##### ######## ############# #####################
## Handle tklib/diagram figures (documentation)
namespace eval ::kettle { namespace export figures }
kettle tool declare {
dia dia.kit dia.tcl dia.exe
}
# # ## ### ##### ######## ############# #####################
## API.
proc ::kettle::figures {{figsrcdir doc/figures}} {
# Overwrite self, we run only once for effect.
proc ::kettle::figures args {}
# Heuristic search for documentation files.
# Aborts caller when nothing is found.
lassign [path scan \
tklib/diagram \
$figsrcdir \
{path diagram-file}] \
root figures
# Put the figures into recipes.
recipe define figures {
(Re)generate the documentation figures.
} {figsrcdir figures} {
path in $figsrcdir {
io puts "Generating (tklib) diagrams..."
path exec {*}[tool get dia] convert -t -o . png {*}$figures
}
} $root $figures
recipe define show-figures {
Show the documentation figures in a Tk GUI
} {figsrcdir figures} {
path in $figsrcdir {
io puts "Showing (tklib) diagrams..."
path exec {*}[tool get dia] show -t {*}$figures
}
} $root $figures
return
}
# # ## ### ##### ######## ############# #####################
return