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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
# 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 CreateMenuBar {} {
global ds9
# we need this first, before the configure command
menu $ds9(mb)
AppleMenu $ds9(mb)
$ds9(top) configure -menu $ds9(mb)
$ds9(mb) add cascade -label [msgcat::mc {File}] -menu $ds9(mb).file
$ds9(mb) add cascade -label [msgcat::mc {Edit}] -menu $ds9(mb).edit
$ds9(mb) add cascade -label [msgcat::mc {View}] -menu $ds9(mb).view
$ds9(mb) add cascade -label [msgcat::mc {Frame}] -menu $ds9(mb).frame
$ds9(mb) add cascade -label [msgcat::mc {Bin}] -menu $ds9(mb).bin
$ds9(mb) add cascade -label [msgcat::mc {Zoom}] -menu $ds9(mb).zoom
$ds9(mb) add cascade -label [msgcat::mc {Scale}] -menu $ds9(mb).scale
$ds9(mb) add cascade -label [msgcat::mc {Color}] -menu $ds9(mb).color
$ds9(mb) add cascade -label [msgcat::mc {Region}] -menu $ds9(mb).region
$ds9(mb) add cascade -label [msgcat::mc {WCS}] -menu $ds9(mb).wcs
$ds9(mb) add cascade -label [msgcat::mc {Analysis}] -menu $ds9(mb).analysis
FileMainMenu
EditMainMenu
ViewMainMenu
FrameMainMenu
BinMainMenu
ZoomMainMenu
ScaleMainMenu
ColorMainMenu
RegionMainMenu
WCSMainMenu
AnalysisMainMenu
HelpMainMenu
}
proc AppleMenu {mb} {
global ds9
switch $ds9(wm) {
x11 -
win32 {}
aqua {
# apple menu
menu $mb.apple
$mb add cascade -menu $mb.apple
$mb.apple add command \
-label [msgcat::mc {About SAOImageDS9}] \
-command AboutBox
# -command ::tk::mac::standardAboutPanel
}
}
}
# CoordMenu
proc CoordMenu {w varname system other sky skyformat cmd} {
upvar #0 $varname var
global $varname
menu $w
$w add radiobutton -label [msgcat::mc {WCS}] \
-variable ${varname}($system) -value wcs -command $cmd
$w add cascade -label [msgcat::mc {Multiple WCS}] -menu $w.wcs
menu $w.wcs
foreach l {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
$w.wcs add radiobutton -label "[msgcat::mc {WCS}] $l" \
-variable ${varname}($system) -value "wcs$l" -command $cmd
}
switch -- $other {
1 {
$w add separator
$w add radiobutton -label [msgcat::mc {Image}] \
-variable ${varname}($system) -value image -command $cmd
$w add radiobutton -label [msgcat::mc {Physical}] \
-variable ${varname}($system) -value physical -command $cmd
$w add radiobutton -label [msgcat::mc {Amplifier}] \
-variable ${varname}($system) -value amplifier -command $cmd
$w add radiobutton -label [msgcat::mc {Detector}] \
-variable ${varname}($system) -value detector -command $cmd
}
2 {
$w add separator
$w add radiobutton -label [msgcat::mc {Image}] \
-variable ${varname}($system) -value image -command $cmd
}
}
if {$sky != {}} {
$w add separator
$w add radiobutton -label [msgcat::mc {FK4}] \
-variable ${varname}($sky) -value fk4 -command $cmd
$w add radiobutton -label [msgcat::mc {FK5}] \
-variable ${varname}($sky) -value fk5 -command $cmd
$w add radiobutton -label [msgcat::mc {ICRS}] \
-variable ${varname}($sky) -value icrs -command $cmd
$w add radiobutton -label [msgcat::mc {Galactic}] \
-variable ${varname}($sky) -value galactic -command $cmd
$w add radiobutton -label [msgcat::mc {Ecliptic}] \
-variable ${varname}($sky) -value ecliptic -command $cmd
}
if {$skyformat != {}} {
$w add separator
$w add radiobutton -label [msgcat::mc {Degrees}] \
-variable ${varname}($skyformat) -value degrees -command $cmd
$w add radiobutton -label {Sexagesimal} \
-variable ${varname}($skyformat) -value sexagesimal -command $cmd
}
}
proc CoordMenuButton {w varname system other sky skyformat cmd} {
upvar #0 $varname var
global $varname
CoordMenuButtonCmd $varname $system $sky {}
ttk::menubutton $w -textvariable ${varname}($system,msg) -menu $w.menu
CoordMenu $w.menu $varname $system $other $sky $skyformat \
[list CoordMenuButtonCmd $varname $system $sky $cmd]
}
proc CoordMenuButtonCmd {varname system sky cmd} {
upvar #0 $varname var
global $varname
set ${varname}($system,msg) [msgcat::mc $var($system)]
if {$sky != {}} {
switch -- $var($system) {
image -
physical -
amplifier -
detector {}
default {
if {[info exists var(frame)]} {
if {$var(frame) != {}} {
if {[$var(frame) has wcs celestial $var($system)]} {
set ${varname}($system,msg) [msgcat::mc $var($sky)]
}
}
}
}
}
}
if {$cmd != {}} {
eval $cmd
}
}
proc CoordMenuEnable {w varname system image sky skyformat} {
upvar #0 $varname var
global $varname
if {![info exists var(frame)]} {
return
}
if {$var(frame) == {}} {
return
}
if {[$var(frame) has wcs wcs]} {
$w entryconfig [msgcat::mc {WCS}] -state normal
} else {
$w entryconfig [msgcat::mc {WCS}] -state disabled
}
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach ll {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
if {[$var(frame) has wcs "wcs${ll}"]} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state normal
} else {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state disabled
}
}
if {$image != {}} {
$w entryconfig [msgcat::mc {Image}] -state normal
$w entryconfig [msgcat::mc {Physical}] -state normal
$w entryconfig [msgcat::mc {Amplifier}] -state normal
$w entryconfig [msgcat::mc {Detector}] -state normal
}
if {$sky != {}} {
if {[$var(frame) has wcs equatorial $var($system)]} {
$w entryconfig [msgcat::mc {FK4}] -state normal
$w entryconfig [msgcat::mc {FK5}] -state normal
$w entryconfig [msgcat::mc {ICRS}] -state normal
$w entryconfig [msgcat::mc {Galactic}] -state normal
$w entryconfig [msgcat::mc {Ecliptic}] -state normal
} else {
$w entryconfig [msgcat::mc {FK4}] -state disabled
$w entryconfig [msgcat::mc {FK5}] -state disabled
$w entryconfig [msgcat::mc {ICRS}] -state disabled
$w entryconfig [msgcat::mc {Galactic}] -state disabled
$w entryconfig [msgcat::mc {Ecliptic}] -state disabled
}
}
if {$skyformat != {}} {
if {[$var(frame) has wcs celestial $var($system)]} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig {Sexagesimal} -state normal
} else {
$w entryconfig [msgcat::mc {Degrees}] -state disabled
$w entryconfig {Sexagesimal} -state disabled
}
}
}
proc CoordMenuEnable3d {w varname system sky skyformat} {
upvar #0 $varname var
global $varname
if {![info exists var(frame)]} {
return
}
if {$var(frame) == {}} {
return
}
if {[$var(frame) has wcs 3d wcs]} {
$w entryconfig [msgcat::mc {WCS}] -state normal
} else {
$w entryconfig [msgcat::mc {WCS}] -state disabled
}
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach ll {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
if {[$var(frame) has wcs 3d "wcs${ll}"]} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state normal
} else {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state disabled
}
}
$w entryconfig [msgcat::mc {Image}] -state normal
if {$sky != {}} {
if {[$var(frame) has wcs equatorial $var($system)]} {
$w entryconfig [msgcat::mc {FK4}] -state normal
$w entryconfig [msgcat::mc {FK5}] -state normal
$w entryconfig [msgcat::mc {ICRS}] -state normal
$w entryconfig [msgcat::mc {Galactic}] -state normal
$w entryconfig [msgcat::mc {Ecliptic}] -state normal
} else {
$w entryconfig [msgcat::mc {FK4}] -state disabled
$w entryconfig [msgcat::mc {FK5}] -state disabled
$w entryconfig [msgcat::mc {ICRS}] -state disabled
$w entryconfig [msgcat::mc {Galactic}] -state disabled
$w entryconfig [msgcat::mc {Ecliptic}] -state disabled
}
}
if {$skyformat != {}} {
if {[$var(frame) has wcs celestial $var($system)]} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig {Sexagesimal} -state normal
} else {
$w entryconfig [msgcat::mc {Degrees}] -state disabled
$w entryconfig {Sexagesimal} -state disabled
}
}
}
proc CoordMenuReset {w varname system image sky skyformat} {
upvar #0 $varname var
global $varname
$w entryconfig [msgcat::mc {WCS}] -state normal
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach l {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $l" -state normal
}
if {$image != {}} {
$w entryconfig [msgcat::mc {Image}] -state normal
$w entryconfig [msgcat::mc {Physical}] -state normal
$w entryconfig [msgcat::mc {Amplifier}] -state normal
$w entryconfig [msgcat::mc {Detector}] -state normal
}
if {$sky != {}} {
$w entryconfig [msgcat::mc {FK4}] -state normal
$w entryconfig [msgcat::mc {FK5}] -state normal
$w entryconfig [msgcat::mc {ICRS}] -state normal
$w entryconfig [msgcat::mc {Galactic}] -state normal
$w entryconfig [msgcat::mc {Ecliptic}] -state normal
}
if {$skyformat != {}} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig {Sexagesimal} -state normal
}
}
proc CoordMenuReset3d {w varname system sky skyformat} {
upvar #0 $varname var
global $varname
$w entryconfig [msgcat::mc {WCS}] -state normal
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach l {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $l" -state normal
}
$w entryconfig [msgcat::mc {Image}] -state normal
if {$sky != {}} {
$w entryconfig [msgcat::mc {FK4}] -state normal
$w entryconfig [msgcat::mc {FK5}] -state normal
$w entryconfig [msgcat::mc {ICRS}] -state normal
$w entryconfig [msgcat::mc {Galactic}] -state normal
$w entryconfig [msgcat::mc {Ecliptic}] -state normal
}
if {$skyformat != {}} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig {Sexagesimal} -state normal
}
}
# DistMenu
proc DistMenu {w varname system other format cmd} {
upvar #0 $varname var
global $varname
menu $w
$w add radiobutton -label [msgcat::mc {WCS}] \
-variable ${varname}($system) -value wcs -command $cmd
$w add cascade -label [msgcat::mc {Multiple WCS}] \
-menu $w.wcs
menu $w.wcs
foreach l {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
$w.wcs add radiobutton -label "[msgcat::mc {WCS}] $l" \
-variable ${varname}($system) -value "wcs$l" -command $cmd
}
if {$other} {
$w add separator
$w add radiobutton -label [msgcat::mc {Image}] \
-variable ${varname}($system) -value image -command $cmd
$w add radiobutton -label [msgcat::mc {Physical}] \
-variable ${varname}($system) -value physical -command $cmd
$w add radiobutton -label [msgcat::mc {Amplifier}] \
-variable ${varname}($system) -value amplifier -command $cmd
$w add radiobutton -label [msgcat::mc {Detector}] \
-variable ${varname}($system) -value detector -command $cmd
}
if {$format != {}} {
$w add separator
$w add radiobutton -label [msgcat::mc {Degrees}] \
-variable ${varname}($format) -value degrees -command $cmd
$w add radiobutton -label [msgcat::mc {ArcMin}] \
-variable ${varname}($format) -value arcmin -command $cmd
$w add radiobutton -label [msgcat::mc {ArcSec}] \
-variable ${varname}($format) -value arcsec -command $cmd
}
}
proc DistMenuButton {w varname system other format cmd} {
upvar #0 $varname var
global $varname
DistMenuButtonCmd $varname $system $format {}
ttk::menubutton $w -textvariable ${varname}($system,msg) -menu $w.menu
DistMenu $w.menu $varname $system $other $format \
[list DistMenuButtonCmd $varname $system $format $cmd]
}
proc DistMenuButtonCmd {varname system format cmd} {
upvar #0 $varname var
global $varname
set ${varname}($system,msg) [msgcat::mc $var($system)]
if {$format != {}} {
switch -- $var($system) {
image -
physical -
amplifier -
detector {}
default {
if {[info exists var(frame)]} {
if {$var(frame) != {}} {
if {[$var(frame) has wcs celestial $var($system)]} {
set ${varname}($system,msg) [msgcat::mc $var($format)]
}
}
}
}
}
}
if {$cmd != {}} {
eval $cmd
}
}
proc DistMenuEnable {w varname system other format} {
upvar #0 $varname var
global $varname
if {![info exists var(frame)]} {
return
}
if {$var(frame) == {}} {
return
}
if {[$var(frame) has wcs wcs]} {
$w entryconfig [msgcat::mc {WCS}] -state normal
} else {
$w entryconfig [msgcat::mc {WCS}] -state disabled
}
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach ll {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
if {[$var(frame) has wcs "wcs${ll}"]} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state normal
} else {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state disabled
}
}
if {$other} {
$w entryconfig [msgcat::mc {Image}] -state normal
$w entryconfig [msgcat::mc {Physical}] -state normal
$w entryconfig [msgcat::mc {Amplifier}] -state normal
$w entryconfig [msgcat::mc {Detector}] -state normal
}
if {$format != {}} {
if {[$var(frame) has wcs celestial $var($system)]} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig [msgcat::mc {ArcMin}] -state normal
$w entryconfig [msgcat::mc {ArcSec}] -state normal
} else {
$w entryconfig [msgcat::mc {Degrees}] -state disabled
$w entryconfig [msgcat::mc {ArcMin}] -state disabled
$w entryconfig [msgcat::mc {ArcSec}] -state disabled
}
}
}
proc DistMenuReset {w varname system other format} {
upvar #0 $varname var
global $varname
$w entryconfig [msgcat::mc {WCS}] -state normal
$w entryconfig [msgcat::mc {Multiple WCS}] -state normal
foreach ll {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
$w.wcs entryconfig "[msgcat::mc {WCS}] $ll" -state normal
}
if {$other} {
$w entryconfig [msgcat::mc {Image}] -state normal
$w entryconfig [msgcat::mc {Physical}] -state normal
$w entryconfig [msgcat::mc {Amplifier}] -state normal
$w entryconfig [msgcat::mc {Detector}] -state normal
}
if {$format != {}} {
$w entryconfig [msgcat::mc {Degrees}] -state normal
$w entryconfig [msgcat::mc {ArcMin}] -state normal
$w entryconfig [msgcat::mc {ArcSec}] -state normal
}
}
# EditMenu
proc EditMenu {mb varname} {
upvar #0 $varname var
global $varname
global ds9
menu $mb.edit
$mb.edit add command -label [msgcat::mc {Cut}] \
-command "EntryCut $var(top)" -accelerator "${ds9(ctrl)}X"
$mb.edit add command -label [msgcat::mc {Copy}] \
-command "EntryCopy $var(top)" -accelerator "${ds9(ctrl)}C"
$mb.edit add command -label [msgcat::mc {Paste}] \
-command "EntryPaste $var(top)" -accelerator "${ds9(ctrl)}V"
}
# ColorMenu
proc ColorMenu {w varname color cmd} {
upvar #0 $varname var
global $varname
menu $w
$w add radiobutton -label [msgcat::mc {Black}] \
-variable ${varname}($color) -value black -command $cmd
$w add radiobutton -label [msgcat::mc {White}] \
-variable ${varname}($color) -value white -command $cmd
$w add radiobutton -label [msgcat::mc {Red}] \
-variable ${varname}($color) -value red -command $cmd
$w add radiobutton -label [msgcat::mc {Green}] \
-variable ${varname}($color) -value green -command $cmd
$w add radiobutton -label [msgcat::mc {Blue}] \
-variable ${varname}($color) -value blue -command $cmd
$w add radiobutton -label [msgcat::mc {Cyan}] \
-variable ${varname}($color) -value cyan -command $cmd
$w add radiobutton -label [msgcat::mc {Magenta}] \
-variable ${varname}($color) -value magenta -command $cmd
$w add radiobutton -label [msgcat::mc {Yellow}] \
-variable ${varname}($color) -value yellow -command $cmd
$w add separator
$w add command -label "[msgcat::mc {Other Color}]..." \
-command [list ColorMenuOther $varname $color $cmd]
}
proc ColorMenuOther {varname color cmd} {
upvar #0 $varname var
global $varname
if {[EntryDialog [msgcat::mc {Color}] [msgcat::mc {Enter Color}] 20 ${varname}($color)]} {
eval $cmd
}
}
proc ColorMenuButton {w varname color cmd} {
upvar #0 $varname var
global $varname
ttk::menubutton $w -textvariable ${varname}($color) -menu $w.menu
ColorMenu $w.menu $varname $color $cmd
}
# FontMenu
proc FontMenu {w varname font size weight slant cmd} {
upvar #0 $varname var
global $varname
menu $w
$w add radiobutton -label {Times} -variable ${varname}($font) \
-value times -command $cmd
$w add radiobutton -label {Helvetica} -variable ${varname}($font) \
-value helvetica -command $cmd
$w add radiobutton -label {Courier} -variable ${varname}($font) \
-value courier -command $cmd
$w add separator
$w add radiobutton -label {9} -variable ${varname}($size) \
-value 9 -command $cmd
$w add radiobutton -label {10} -variable ${varname}($size) \
-value 10 -command $cmd
$w add radiobutton -label {12} -variable ${varname}($size) \
-value 12 -command $cmd
$w add radiobutton -label {14} -variable ${varname}($size) \
-value 14 -command $cmd
$w add radiobutton -label {16} -variable ${varname}($size) \
-value 16 -command $cmd
$w add radiobutton -label {20} -variable ${varname}($size) \
-value 20 -command $cmd
$w add radiobutton -label {24} -variable ${varname}($size) \
-value 24 -command $cmd
$w add radiobutton -label {30} -variable ${varname}($size) \
-value 30 -command $cmd
$w add radiobutton -label {36} -variable ${varname}($size) \
-value 36 -command $cmd
$w add radiobutton -label {72} -variable ${varname}($size) \
-value 72 -command $cmd
$w add separator
$w add command -label "[msgcat::mc {Other Font Size}]..." \
-command [list FontMenuSize $varname $size $cmd]
$w add separator
$w add radiobutton -label [msgcat::mc {Normal}] \
-variable ${varname}($weight) -value normal -command $cmd
$w add radiobutton -label [msgcat::mc {Bold}] \
-variable ${varname}($weight) -value bold -command $cmd
$w add separator
$w add radiobutton -label [msgcat::mc {Roman}] \
-variable ${varname}($slant) -value roman -command $cmd
$w add radiobutton -label [msgcat::mc {Italic}] \
-variable ${varname}($slant) -value italic -command $cmd
}
proc FontMenuSize {varname size cmd} {
upvar #0 $varname var
global $varname
if {[EntryDialog [msgcat::mc {Font Size}] [msgcat::mc {Enter Font Size}] 20 ${varname}($size)]} {
eval $cmd
}
}
proc FontMenuButton {w varname font size weight slant cmd} {
upvar #0 $varname var
global $varname
ttk::menubutton $w -textvariable ${varname}($font) -menu $w.menu
FontMenu $w.menu $varname $font $size $weight $slant $cmd
}
# WidthDashMenu
proc WidthDashMenu {w varname width dash cmd1 cmd2} {
upvar #0 $varname var
global $varname
menu $w
$w add radiobutton -label {1} -variable ${varname}($width) \
-value 1 -command $cmd1
$w add radiobutton -label {2} -variable ${varname}($width) \
-value 2 -command $cmd1
$w add radiobutton -label {3} -variable ${varname}($width) \
-value 3 -command $cmd1
$w add radiobutton -label {4} -variable ${varname}($width) \
-value 4 -command $cmd1
if {$dash != {}} {
$w add separator
$w add checkbutton -label [msgcat::mc {Dash}] \
-variable ${varname}($dash) -command $cmd2
}
}
proc WidthDashMenuButton {w varname width dash cmd1 cmd2} {
upvar #0 $varname var
global $varname
ttk::menubutton $w -textvariable ${varname}($width) -menu $w.menu
WidthDashMenu $w.menu $varname $width $dash $cmd1 $cmd2
}
# Prefs
proc PrefsDialogMenu {} {
global dprefs
set w $dprefs(tab)
$dprefs(list) insert end [msgcat::mc {Menus and Buttons}]
lappend dprefs(tabs) [ttk::frame $w.menu]
PrefsDialogFileMenu $w.menu
PrefsDialogEditMenu $w.menu
PrefsDialogViewMenu $w.menu
PrefsDialogFrameMenu $w.menu
PrefsDialogBinMenu $w.menu
PrefsDialogZoomMenu $w.menu
PrefsDialogScaleMenu $w.menu
PrefsDialogColorMenu $w.menu
PrefsDialogRegionMenu $w.menu
PrefsDialogWCSMenu $w.menu
PrefsDialogAnalysisMenu $w.menu
PrefsDialogHelpMenu $w.menu
}
proc ConfigureButtons {menu state} {
global ds9
global pbuttons
foreach aa [array names pbuttons "$menu,*"] {
set bb [lindex [split $aa {,}] 1]
$ds9(buttons).$menu.$bb configure -state $state
}
}
|