blob: c24c58db2a7946621a0473d879d37bf05b760bd9 (
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# Copyright (C) 1999-2016
# Smithsonian Astrophysical Observatory, Cambridge, MA, USA
# For conditions of distribution and use, see copyright notice in "copyright"
package provide DS9 1.0
proc PSPageSetup {} {
global ps
global ed
set ed(ok) 0
array set ed [array get ps]
set w {.pagesetup}
DialogCreate $w [msgcat::mc {Page Setup}] ed(ok)
# Layout
set f [ttk::labelframe $w.layout -text {Layout}]
ttk::label $f.torient -text [msgcat::mc {Orientation}]
ttk::radiobutton $f.portrait -text [msgcat::mc {Portrait}] \
-variable ed(orient) -value portrait
ttk::radiobutton $f.landscape -text [msgcat::mc {Landscape}] \
-variable ed(orient) -value landscape
ttk::label $f.tscale -text [msgcat::mc {Scale}]
ttk::entry $f.scale -textvariable ed(scale) -width 7
ttk::label $f.uscale -text {%}
grid $f.torient $f.portrait $f.landscape -padx 2 -pady 2 -sticky w
grid $f.tscale $f.scale $f.uscale -padx 2 -pady 2 -sticky w
# Page Size
set f [ttk::labelframe $w.size -text {Page Size}]
ttk::radiobutton $f.letter -text "[msgcat::mc {Letter}](8.5 x 11 in)"\
-variable ed(size) -value letter
ttk::radiobutton $f.legal -text "[msgcat::mc {Legal}](8.5 x 14 in)"\
-variable ed(size) -value legal
ttk::radiobutton $f.tabloid -text "[msgcat::mc {Tabloid}](11 x 17 in)"\
-variable ed(size) -value tabloid
ttk::radiobutton $f.poster -text "[msgcat::mc {Poster}](36 x 48 in)"\
-variable ed(size) -value poster
ttk::radiobutton $f.a4 -text {A4(210 x 297 mm)} \
-variable ed(size) -value a4
ttk::radiobutton $f.other -text "[msgcat::mc {Other}] (inches)" \
-variable ed(size) -value other
ttk::radiobutton $f.othermm -text "[msgcat::mc {Other}] (mm)" \
-variable ed(size) -value othermm
ttk::label $f.title3 -text [msgcat::mc {Width}]
ttk::entry $f.width -textvariable ed(width) -width 10
ttk::label $f.title4 -text [msgcat::mc {Height}]
ttk::entry $f.height -textvariable ed(height) -width 10
grid $f.letter -padx 2 -pady 2 -sticky w
grid $f.legal -padx 2 -pady 2 -sticky w
grid $f.tabloid -padx 2 -pady 2 -sticky w
grid $f.poster -padx 2 -pady 2 -sticky w
grid $f.a4 -padx 2 -pady 2 -sticky w
grid $f.other $f.title3 $f.width -padx 2 -pady 2 -sticky w
grid $f.othermm $f.title4 $f.height -padx 2 -pady 2 -sticky w
# Buttons
set f [ttk::frame $w.buttons]
ttk::button $f.ok -text [msgcat::mc {OK}] -command {set ed(ok) 1} \
-default active
ttk::button $f.cancel -text [msgcat::mc {Cancel}] -command {set ed(ok) 0}
pack $f.ok $f.cancel -side left -expand true -padx 2 -pady 4
bind $w <Return> {set ed(ok) 1}
# Fini
grid $w.layout -sticky news
grid $w.size -sticky news
grid $w.buttons -sticky ew
grid rowconfigure $w 0 -weight 1
grid rowconfigure $w 1 -weight 1
grid columnconfigure $w 0 -weight 1
DialogCenter $w
DialogWait $w ed(ok) $w.buttons.ok
DialogDismiss $w
if {$ed(ok)} {
array set ps [array get ed]
}
set rr $ed(ok)
unset ed
return $rr
}
proc PrefsDialogPageSetup {} {
global dprefs
set w $dprefs(tab)
$dprefs(list) insert end [msgcat::mc {Page Setup}]
lappend dprefs(tabs) [ttk::frame $w.pagesetup]
# Layout
set f [ttk::labelframe $w.pagesetup.layout -text {Layout}]
ttk::label $f.torient -text [msgcat::mc {Orientation}]
ttk::radiobutton $f.portrait -text [msgcat::mc {Portrait}] \
-variable pps(orient) -value portrait
ttk::radiobutton $f.landscape -text [msgcat::mc {Landscape}] \
-variable pps(orient) -value landscape
ttk::label $f.tscale -text [msgcat::mc {Scale}]
ttk::entry $f.scale -textvariable pps(scale) -width 7
ttk::label $f.uscale -text {%}
grid $f.torient $f.portrait $f.landscape -padx 2 -pady 2 -sticky w
grid $f.tscale $f.scale $f.uscale -padx 2 -pady 2 -sticky w
# Page Size
set f [ttk::labelframe $w.pagesetup.size -text {Page Size}]
ttk::radiobutton $f.letter -text "[msgcat::mc {Letter}](8.5 x 11 in)"\
-variable pps(size) -value letter
ttk::radiobutton $f.legal -text "[msgcat::mc {Legal}](8.5 x 14 in)"\
-variable pps(size) -value legal
ttk::radiobutton $f.tabloid -text "[msgcat::mc {Tabloid}](11 x 17 in)"\
-variable pps(size) -value tabloid
ttk::radiobutton $f.poster -text "[msgcat::mc {Poster}](36 x 48 in)"\
-variable pps(size) -value poster
ttk::radiobutton $f.a4 -text {A4(210 x 297 mm)} \
-variable pps(size) -value a4
ttk::radiobutton $f.other -text "[msgcat::mc {Other}] (inches)" \
-variable pps(size) -value other
ttk::radiobutton $f.othermm -text "[msgcat::mc {Other}] (mm)" \
-variable pps(size) -value othermm
ttk::label $f.title3 -text [msgcat::mc {Width}]
ttk::entry $f.width -textvariable pps(width) -width 10
ttk::label $f.title4 -text [msgcat::mc {Height}]
ttk::entry $f.height -textvariable pps(height) -width 10
grid $f.letter -padx 2 -pady 2 -sticky w
grid $f.legal -padx 2 -pady 2 -sticky w
grid $f.tabloid -padx 2 -pady 2 -sticky w
grid $f.poster -padx 2 -pady 2 -sticky w
grid $f.a4 -padx 2 -pady 2 -sticky w
grid $f.other $f.title3 $f.width -padx 2 -pady 2 -sticky w
grid $f.othermm $f.title4 $f.height -padx 2 -pady 2 -sticky w
pack $w.pagesetup.layout $w.pagesetup.size \
-side top -fill both -expand true
}
# Process Cmds
proc ProcessPageSetupCmd {varname iname} {
upvar $varname var
upvar $iname i
global ds9
switch $ds9(wm) {
x11 -
win32 {ProcessPSPageSetupCmd var i}
aqua {
ProcessPSPageSetupCmd var i
# MacOSXPageSetup
}
wwin32 {Win32PageSetup}
}
}
proc ProcessSendPageSetupCmd {proc id param} {
global ds9
switch $ds9(wm) {
x11 {ProcessSendPSPageSetupCmd $proc $id $param}
aqua -
win32 {}
}
}
proc ProcessPSPageSetupCmd {varname iname} {
upvar $varname var
upvar $iname i
global ps
switch -- [string tolower [lindex $var $i]] {
orientation -
orient {incr i; set ps(orient) [string tolower [lindex $var $i]]}
pagescale -
scale {incr i; set ps(scale) [lindex $var $i]}
pagesize -
size {incr i; set ps(size) [string tolower [lindex $var $i]] }
}
}
proc ProcessSendPSPageSetupCmd {proc id param} {
global ps
switch -- [string tolower $param] {
orientation -
orient {$proc $id "$ps(orient)\n"}
pagescale -
scale {$proc $id "$ps(scale)\n"}
pagesize -
size {$proc $id "$ps(size)\n"}
}
}
|