]> www.wagner.pp.ru Git - oss/ck.git/blob - d.sh
Ck console graphics toolkit
[oss/ck.git] / d.sh
1 #
2 # Write out list of default widget options
3 #
4
5 defscript1() {
6     cat >/tmp/d$$.tcl <<'EOD'
7 set count 0
8 foreach c [lsort -ascii [info commands]] {
9     if {$c == "puts" || $c == "vwait"} {
10         continue
11     }
12     if {[catch {$c .w$count} tmp]} {
13         continue
14     }
15     if {"$tmp" != ".w$count"} {
16         continue
17     }
18     if {[catch {.w$count configure} clist]} {
19         incr count
20         continue
21     }
22     puts stderr [format "\n\t\t\t%s\n" $c]
23     foreach i [lsort -ascii $clist] {
24         if {[llength $i] > 2} {
25             puts stderr [format "%-35s\t%s" [lindex $i 0] [lindex $i 3]]
26         }
27     }
28     incr count
29 }
30 exit 0
31 EOD
32 echo /tmp/d$$.tcl
33 }
34
35 #
36 # Write out list of class bindings
37 #
38
39 defscript2() {
40     cat >/tmp/d$$.tcl <<'EOD'
41 proc all w { return $w }
42 set count 0
43 foreach c [lsort -ascii [info commands]] {
44     if {$c == "puts" || $c == "vwait"} {
45         continue
46     }
47     if {[catch {$c .w$count} tmp]} {
48         continue
49     }
50     if {"$tmp" != ".w$count"} {
51         continue
52     }
53     set class $c
54     if {$class != "all" && [catch {winfo class .w$count} class]} {
55         incr count
56         continue
57     }
58     puts stderr [format "\n\t\t\t%s\n" $class]
59     set out ""
60     set icnt 0
61     foreach i [lsort -ascii [bind $class]] {
62         append out [format "%-19.19s" $i]
63         incr icnt
64         if {$icnt % 4 == 0} {
65             append out "\n"
66         } else {
67             append out " "
68         }
69     }
70     if {$out == ""} {
71         set out "*** no events bound to class ***"
72     }
73     puts stderr [string trimright $out "\n"]
74     incr count
75 }
76 exit 0
77 EOD
78 echo /tmp/d$$.tcl
79 }
80
81
82 SCRIPT=`defscript1`
83
84 rm -f def.list
85 exec 2>def.list
86 echo "Terminals w/ color" >&2
87 echo "------------------" >&2
88 TERM=color_xterm ./cwsh $SCRIPT
89 echo -e "\f" >&2
90 echo "Terminals w/o color" >&2
91 echo "-------------------" >&2
92 TERM=vt100 ./cwsh $SCRIPT
93 rm -f $SCRIPT
94
95 SCRIPT=`defscript2`
96
97 echo -e "\f" >&2
98 echo "Events bound to classes" >&2
99 echo "-----------------------" >&2
100 TERM=vt100 ./cwsh $SCRIPT
101 rm -f $SCRIPT
102