blob: fe0ad11efe41f532f75aa87fe5fc3b0931fb49b8 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# Copyright (C) 1999-2018
# Smithsonian Astrophysical Observatory, Cambridge, MA, USA
# For conditions of distribution and use, see copyright notice in "copyright"
package provide DS9 1.0
proc CreateMagnifier {} {
global imagnifier
global ds9
set ds9(magnifier) [canvas $ds9(panel).mag -width $imagnifier(size) \
-height $imagnifier(size) \
-relief groove \
-borderwidth 2 \
-highlightthickness 0 \
-insertofftime 0 \
-takefocus 0]
$ds9(magnifier) create magnifier$ds9(visual) \
-width $imagnifier(size) \
-height $imagnifier(size) \
-command magnifier \
-tag magnifier \
-helvetica $ds9(helvetica) \
-courier $ds9(courier) \
-times $ds9(times)
}
proc MagnifierDef {} {
global imagnifier
global pmagnifier
set imagnifier(size) 128
# prefs only
set pmagnifier(cursor) 1
set pmagnifier(zoom) 4
set pmagnifier(region) 1
set pmagnifier(color) white
}
proc UpdateMagnifier {which x y} {
global view
if {$view(magnifier)} {
$which magnifier update $x $y
}
}
proc MagnifierFrameBackup {ch which} {
global pmagnifier
puts $ch "$which magnifier graphics $pmagnifier(region)"
puts $ch "$which magnifier cursor $pmagnifier(cursor)"
puts $ch "$which magnifier zoom $pmagnifier(zoom)"
puts $ch "$which magnifier color $pmagnifier(color)"
}
# Prefs Cmds
proc MagnifierRegion {} {
global pmagnifier
global ds9
foreach ff $ds9(frames) {
$ff magnifier graphics $pmagnifier(region)
}
}
proc MagnifierCursor {} {
global pmagnifier
global ds9
foreach ff $ds9(frames) {
$ff magnifier cursor $pmagnifier(cursor)
}
}
proc MagnifierZoom {} {
global pmagnifier
global ds9
foreach ff $ds9(frames) {
$ff magnifier zoom $pmagnifier(zoom)
}
}
proc MagnifierColor {} {
global pmagnifier
global ds9
foreach ff $ds9(frames) {
$ff magnifier color $pmagnifier(color)
}
}
# Prefs
proc PrefsDialogMagnifier {} {
global dprefs
global pmagnifier
set w $dprefs(tab)
$dprefs(list) insert end [msgcat::mc {Magnifier}]
lappend dprefs(tabs) [ttk::frame $w.magnifier]
set f [ttk::labelframe $w.magnifier.param -text [msgcat::mc {Magnifier}]]
ttk::label $f.tshow -text [msgcat::mc {Show}]
ttk::checkbutton $f.graphics -text [msgcat::mc {Graphics}] \
-variable pmagnifier(region) -command MagnifierRegion
ttk::checkbutton $f.cursor -text [msgcat::mc {Cursor}] \
-variable pmagnifier(cursor) -command MagnifierCursor
ttk::label $f.tcolor -text [msgcat::mc {Color}]
ColorMenuButton $f.color pmagnifier color MagnifierColor
ttk::label $f.tx -text [msgcat::mc {Magnification}]
ttk::radiobutton $f.x1 -text {1x} \
-variable pmagnifier(zoom) -value 1 -command MagnifierZoom
ttk::radiobutton $f.x2 -text {2x} \
-variable pmagnifier(zoom) -value 2 -command MagnifierZoom
ttk::radiobutton $f.x4 -text {4x} \
-variable pmagnifier(zoom) -value 4 -command MagnifierZoom
ttk::radiobutton $f.x8 -text {8x} \
-variable pmagnifier(zoom) -value 8 -command MagnifierZoom
ttk::radiobutton $f.x16 -text {16x} \
-variable pmagnifier(zoom) -value 16 -command MagnifierZoom
grid $f.tshow $f.graphics - $f.cursor - -padx 2 -pady 2 -sticky w
grid $f.tcolor $f.color - - -padx 2 -pady 2 -sticky w
grid $f.tx $f.x1 $f.x2 $f.x4 $f.x8 $f.x16 -padx 2 -pady 2 -sticky w
pack $f -side top -fill both -expand true
}
# Process Cmds
proc ProcessMagnifierCmd {varname iname} {
upvar $varname var
upvar $iname i
magnifier::YY_FLUSH_BUFFER
magnifier::yy_scan_string [lrange $var $i end]
magnifier::yyparse
incr i [expr $magnifier::yycnt-1]
}
proc ProcessSendMagnifierCmd {proc id param {sock {}} {fn {}}} {
global parse
set parse(proc) $proc
set parse(id) $id
magnifiersend::YY_FLUSH_BUFFER
magnifiersend::yy_scan_string $param
magnifiersend::yyparse
}
|