blob: 4913bdd9a80714be10c1b99c75d7322cc29b3174 (
plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# goto line number
# based on code from gitk, Copyright (C) Paul Mackerras
class linebar {
field w
field ctext
field linenum {}
constructor new {i_w i_text args} {
global use_ttk NS
set w $i_w
set ctext $i_text
${NS}::frame $w
${NS}::label $w.l -text [mc "Goto Line:"]
entry $w.ent -textvariable ${__this}::linenum -background lightgreen
${NS}::button $w.bn -text [mc Go] -command [cb _incrgoto]
pack $w.l -side left
pack $w.bn -side right
pack $w.ent -side left -expand 1 -fill x
eval grid conf $w -sticky we $args
grid remove $w
bind $w.ent <Return> [cb _incrgoto]
bind $w.ent <Escape> [list linebar::hide $this]
bind $w <Destroy> [list delete_this $this]
return $this
}
method show {} {
if {![visible $this]} {
grid $w
}
focus -force $w.ent
}
method hide {} {
if {[visible $this]} {
focus $ctext
grid remove $w
}
}
method visible {} {
return [winfo ismapped $w]
}
method editor {} {
return $w.ent
}
method _incrgoto {} {
if {$linenum ne {}} {
$ctext see $linenum.0
hide $this
}
}
}
|