blob: f8999e6ec8ff505291ddf1e688af2c8be083dca2 (
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
|
#
#
#
#
#
# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl,v 3.1 1997/12/14 10:03:55 hohndel Exp $
#
# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
# 1997 by Dirk H Hohndel <hohndel@XFree86.Org>
#
# See the file "LICENSE" for information regarding redistribution terms,
# and for a DISCLAIMER OF ALL WARRANTIES.
#
#
# routines to select the modes that the user actually wants to use
#
proc Modeselect_create_widgets { win } {
global MonitorIDs monDevNum monCanvas MonitorDescriptions
global pc98_EGC messages
set w [winpathprefix $win]
if !$pc98_EGC {
frame $w.modesel -width 640 -height 420 \
-relief ridge -borderwidth 5
} else {
frame $w.modesel -width 640 -height 400 \
-relief ridge -borderwidth 5
}
frame $w.modesel.top
frame $w.modesel.mid -relief sunken -borderwidth 3
frame $w.modesel.bot
pack $w.modesel.top -side top
pack $w.modesel.mid -side top -expand yes
pack $w.modesel.bot -side top
label $w.modesel.top.title -text "Select the modes you want to use"
frame $w.modesel.type
pack $w.modesel.top.title $w.modesel.type -in $w.modesel.top -side top
set canv [canvas $w.modesel.buttons]
checkbutton $w.modesel.buttons.m640x480 \
-text $messages(modeselect.2) \
-indicatoron no -variable m640x480 \
-command [list modesel_enable $win " 640x480*"]
lappend lbuttons $w.modesel.buttons.m640x480
checkbutton $w.modesel.buttons.m800x600 \
-text $messages(modeselect.3) \
-indicatoron no -variable m800x600 \
-command [list modesel_enable $win " 800x600*"]
lappend lbuttons $w.modesel.buttons.m800x600
checkbutton $w.modesel.buttons.m1024x768 \
-text $messages(modeselect.4) \
-indicatoron no -variable m1024x768 \
-command [list modesel_enable $win "1024x768*"]
lappend lbuttons $w.modesel.buttons.m1024x768
checkbutton $w.modesel.buttons.m1152x864 \
-text $messages(modeselect.5) \
-indicatoron no -variable m1152x864 \
-command [list modesel_enable $win "1152x864*"]
lappend lbuttons $w.modesel.buttons.m1152x864
checkbutton $w.modesel.buttons.m1280x1024 \
-text $messages(modeselect.6) \
-indicatoron no -variable m1280x1024 \
-command [list modesel_enable $win "1280x1024*"]
lappend lbuttons $w.modesel.buttons.m1280x1024
checkbutton $w.modesel.buttons.m1600x1200 \
-text $messages(modeselect.7) \
-indicatoron no -variable m1600x1200 \
-command [list modesel_enable $win "1600x1200*"]
lappend lbuttons $w.modesel.buttons.m1600x1200
checkbutton $w.modesel.buttons.m640x400 \
-text $messages(modeselect.8) \
-indicatoron no -variable m640x400 \
-command [list modesel_enable $win " 640x400*"]
lappend lbuttons $w.modesel.buttons.m640x400
checkbutton $w.modesel.buttons.m320x200 \
-text $messages(modeselect.9) \
-indicatoron no -variable m320x200 \
-command [list modesel_enable $win " 320x200*"]
lappend lbuttons $w.modesel.buttons.m320x200
checkbutton $w.modesel.buttons.m320x240 \
-text $messages(modeselect.10) \
-indicatoron no -variable m320x240 \
-command [list modesel_enable $win " 320x240*"]
lappend lbuttons $w.modesel.buttons.m320x240
checkbutton $w.modesel.buttons.m400x300 \
-text $messages(modeselect.11) \
-indicatoron no -variable m400x300 \
-command [list modesel_enable $win " 400x300*"]
lappend lbuttons $w.modesel.buttons.m400x300
checkbutton $w.modesel.buttons.m480x300 \
-text $messages(modeselect.12) \
-indicatoron no -variable m480x300 \
-command [list modesel_enable $win " 480x300*"]
lappend lbuttons $w.modesel.buttons.m480x300
checkbutton $w.modesel.buttons.m512x384 \
-text $messages(modeselect.13) \
-indicatoron no -variable m512x384 \
-command [list modesel_enable $win " 512x384*"]
lappend lbuttons $w.modesel.buttons.m512x384
set ht 0
set wd 0
foreach wb $lbuttons {
set bwd [winfo reqwidth $wb]
if {$wd < $bwd} {set wd $bwd}
}
foreach wb $lbuttons {
$canv create window \
[expr ($wd-[winfo reqwidth $wb])/2] $ht \
-anchor nw -window $wb
set ht [expr $ht + [winfo reqheight $wb]]
}
$canv configure -yscrollcommand [list $w.modesel.sb set] \
-scrollregion [list 0 0 $wd $ht] \
-width $wd
scrollbar $w.modesel.sb \
-command [list $canv yview]
pack $canv -in $w.modesel.mid \
-side left -fill both -expand yes -pady 2m
pack $w.modesel.sb -in $w.modesel.mid -side right \
-fill y -expand yes
frame $w.modesel.dcd
label $w.modesel.dcd.title -text $messages(modeselect.14)
radiobutton $w.modesel.8bpp -text $messages(modeselect.15) \
-indicatoron false -variable ColorDepth \
-value "depth8" -underline 19 \
-command [list modesel_color_select $w 8]
radiobutton $w.modesel.16bpp -text $messages(modeselect.16) \
-indicatoron false -variable ColorDepth \
-value "depth16" -underline 19 \
-command [list modesel_color_select $w 16]
radiobutton $w.modesel.24bpp -text $messages(modeselect.17) \
-indicatoron false -variable ColorDepth \
-value "depth24" -underline 19 \
-command [list modesel_color_select $w 24]
radiobutton $w.modesel.32bpp -text $messages(modeselect.18) \
-indicatoron false -variable ColorDepth \
-value "depth32" -underline 19 \
-command [list modesel_color_select $w 32]
pack $w.modesel.8bpp $w.modesel.16bpp $w.modesel.24bpp \
$w.modesel.32bpp -side left -fill x -expand yes \
-in $w.modesel.dcd
pack $w.modesel.dcd.title $w.modesel.dcd -side left -fill y -expand yes
}
proc Modeselection_activate { win } {
set w [winpathprefix $win]
pack $w.modesel -side top -fill both -expand yes
}
proc Modeselection_deactivate { win } {
set w [winpathprefix $win]
pack forget $w.modesel
}
proc modesel_color_select { win val } {
global DefaultColorDepth
set w [winpathprefix $win]
set DefaultColorDepth $val
}
proc modesel_enable { win val } {
global MonitorStdModes SelectedMonitorModes haveSelectedModes
set w [winpathprefix $win]
set haveSelectedModes 1
# we need to handle the fact that these are toggle buttons, so every
# other time this is selected, the user actually wants to deselect
# the entries
# this would be much easier if I have a way to remove pairs from an array...
if { [array get SelectedMonitorModes $val] != "" } {
# puts stderr "$val already existed"
#
foreach desc [array names SelectedMonitorModes $val] {
if [string match \#removed $SelectedMonitorModes($desc)] {
# ok, we're enabling again
set SelectedMonitorModes($desc) $MonitorStdModes($desc)
} else {
# puts stderr "invalidating for $desc"
set SelectedMonitorModes($desc) "#removed"
}
}
} else {
# puts stderr "add $val to selected modes"
foreach desc [array names MonitorStdModes $val] {
set modeline $MonitorStdModes($desc)
# puts stderr "$desc :: $modeline"
set SelectedMonitorModes($desc) $modeline
}
}
# foreach desc [array names SelectedMonitorModes] {
# puts stderr "$desc -> $SelectedMonitorModes($desc)"
# }
}
|