[go: up one dir, main page]

File: calltkman.tcl

package info (click to toggle)
tkman 2.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 908 kB
  • ctags: 292
  • sloc: tcl: 8,264; makefile: 250; sh: 145
file content (77 lines) | stat: -rw-r--r-- 2,768 bytes parent folder | download | duplicates (6)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
# Adding the code for callTkMan to your .tkman file causes tkman to
# bring up a second window labeled "callTkMan".  The intent of this
# window is to provide a convenient mechanism for kicking off tkman
# searches without keeping the entire tkman window open on your screen.
# The callTkMan window has 2 buttons and an entry box.  The first button
# labeled "Raise tkman" simply deiconifies the main tkman window if it is
# iconified and raises it.  The second button labeled "Use current
# selection" will deiconify and raise the tkman window and then run a
# search for the current selection as if you had typed it into the entry
# box at the top of the tkman window.  The entry box is labeled "Enter
# topic:" and allows you to type a topic into this entry box and when
# you hit return it will deiconify and raise the tkman window and then
# act as if you had typed it into the entry box at the top of the tkman
# window.  I routinely close my tkman window to save screen real estate
# but always keep the callTkMan window in an unobscured position on the
# screen so I can quickly kick off a man search.

# There are several options in installing this code.  First, an individual
# may append this file to then end of the ~/.tkman file.  Second, the
# code may be added to the file tkman.tcl before the `make install'
# thus creating the callTkMan window for everyone who shares the executable.
# Finally, one can delete the last line of the file--the invocation line
# "callTkManInit"--and append the remaining code to tkman.tcl before the 
# `make'. This final option doesn't show the callTkMan window by default,
# but rather makes it available to interested parties via a single
# addition to the ~/.tkman file, namely the addition of a single line
# that reads "callTkManInit"

# questions to  Neil.Smithline@eng.sun.com


proc callTkManInit {} {
    set w .callTkMan

    toplevel $w

    button $w.raise -text {Raise tkman} -command manRaise
    button $w.cur -text {Use current selection} -command manCurSel
    label $w.label -text {Enter topic: }
    entry $w.entry -text {Use current selection} \
	-textvariable mantextsel -relief sunken
    bind $w.entry <KeyPress-Return> manEntry
    frame $w.frame -relief raised -borderwidth 2
    
    pack $w.raise $w.cur -side top -expand 1 -fill x
    pack $w.label -side left -in $w.frame
    pack $w.entry -side left -expand 1 -fill x -in $w.frame
    pack $w.frame -side top -expand 1 -fill x
    raise $w.label
    raise $w.entry
    wm maxsize $w 800 800


    $w configure
}

proc manRaise {} {
	raise .man
	wm deiconify .man
}

proc manCurSel {} {
	doMan [selection get]
}

proc manEntry {} {
	global mantextsel
	doMan $mantextsel
}


proc doMan {topic} {
	manRaise
	manShowMan $topic
}

callTkManInit