1 # scanconv.tcl --
2 #
3 # Talks to amxd to control scan converter and provides GUI
4 #
5 # Copyright (c) 2000-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 Import enable
32
33 import 405Client
34
35 global g_mode
36
37 Class ScanConvInterface
38
39 ScanConvInterface instproc init {amxHost amxPort {base ""}} {
40 global g_mode
41 $self instvar 405_
42
43 set 405_ [new 405Client $amxHost $amxPort]
44 $self InitUI $base
45 }
46
47 ScanConvInterface instproc InitUI {{base_frame ""}} {
48 global g_mode
49 $self instvar 405_
50
51 wm title . "Scan Converter Adjustment"
52 wm minsize . 150 0
53
54 set g_mode "1024x768"
55
56 set cur_frame "$base_frame.select_frame"
57 frame $cur_frame
58 pack $cur_frame -fill x -side left -pady 10
59 label $cur_frame.label -text "Mode"
60 pack $cur_frame.label -side top
61 frame $cur_frame.640
62 pack $cur_frame.640 -side top -fill x -padx 20
63 radiobutton $cur_frame.640.but -text "640x480" -variable g_mode -value "640x480" -command "$self changeMode"
64 pack $cur_frame.640.but -side left
65 frame $cur_frame.800
66 pack $cur_frame.800 -side top -fill x -padx 20
67 radiobutton $cur_frame.800.but -text "800x600" -variable g_mode -value "800x600" -command "$self changeMode"
68 pack $cur_frame.800.but -side left
69 frame $cur_frame.1024
70 pack $cur_frame.1024 -side top -fill x -padx 20
71 radiobutton $cur_frame.1024.but -text "1024x768" -variable g_mode -value "1024x768" -command "$self changeMode"
72 pack $cur_frame.1024.but -side left
73 frame $cur_frame.sgi
74 pack $cur_frame.sgi -side top -fill x -padx 20
75 radiobutton $cur_frame.sgi.but -text "sgi" -variable g_mode -value "sgi" -command "$self changeMode"
76 pack $cur_frame.sgi.but -side left
77
78 set g_mode "1024x768"
79
80
81 set cur_frame "$base_frame.size_frame"
82 frame $cur_frame
83 pack $cur_frame -side left -pady 10 -padx 10
84 label $cur_frame.label -text "Size"
85 pack $cur_frame.label -side top
86
87 set canv "$cur_frame.position_canvas"
88 canvas $canv -width 150 -height 100 -borderwidth 0
89 pack $canv -side top
90 set widearrow "10 4 10 9 19 0 10 -9 10 -4 -10 -4 -10 -9 -19 0 -10 9 -10 4"
91
92 set p_wide [eval $canv create polygon $widearrow -tags \{wide arrow\}]
93 set narrowarrow "-19 4 -9 4 -9 9 0 0 9 9 9 4 19 4 19 -4 9 -4 9 -9 0 0 -9 -9 -9 -4 -19 -4"
94 set p_narrow [eval $canv create polygon $narrowarrow -tags \{narrow arrow\}]
95 set tallarrow "4 10 9 10 0 19 -9 10 -4 10 -4 -10 -9 -10 0 -19 9 -10 4 -10"
96 set p_tall [eval $canv create polygon $tallarrow -tags \{tall arrow\}]
97 set shortarrow "0 0 9 9 4 9 4 19 -4 19 -4 9 -9 9 0 0 -9 -9 -4 -9 -4 -19 4 -19 4 -9 9 -9"
98 set p_short [eval $canv create polygon $shortarrow -tags \{short arrow\}]
99
100
101 $canv bind wide <ButtonPress-1> "$405_ scanConv_adjustSize wide"
102 $canv bind narrow <ButtonPress-1> "$405_ scanConv_adjustSize narrow"
103 $canv bind tall <ButtonPress-1> "$405_ scanConv_adjustSize tall"
104 $canv bind short <ButtonPress-1> "$405_ scanConv_adjustSize short"
105
106 #"$405_ scanConv_adjustPosition up"
107 $canv move wide -20 -12
108 $canv move narrow -20 12
109 $canv move tall 25 0
110 $canv move short 47 0
111 $canv move all 45 35
112 $canv scale all 0 0 1.4 1.4
113
114
115 set cur_frame "$base_frame.position_frame"
116 frame $cur_frame
117 pack $cur_frame -side left -pady 10 -padx 10
118 label $cur_frame.label -text "Position"
119 pack $cur_frame.label -side top
120
121 set canv "$cur_frame.position_canvas"
122 canvas $canv -width 100 -height 100 -borderwidth 0
123 pack $canv -side top
124 set uparrow " -6 -9 -6 -23 -14 -23 0 -35 14 -23 6 -23 6 -9 -6 -9"
125 set dnarrow " -6 9 -6 23 -14 23 0 35 14 23 6 23 6 9 -6 9"
126 set ltarrow " -9 -6 -23 -6 -23 -14 -35 0 -23 14 -23 6 -9 6 -9 -6"
127 set rtarrow " 9 -6 23 -6 23 -14 35 0 23 14 23 6 9 6 9 -6"
128 set p_up [eval $canv create polygon $uparrow -tags \{up arrow\}]
129 set p_dn [eval $canv create polygon $dnarrow -tags \{dn arrow\}]
130 set p_lt [eval $canv create polygon $ltarrow -tags \{lt arrow\}]
131 set p_rt [eval $canv create polygon $rtarrow -tags \{rt arrow\}]
132 $canv bind up <ButtonPress-1> "$405_ scanConv_adjustPosition up"
133 $canv bind dn <ButtonPress-1> "$405_ scanConv_adjustPosition down"
134 $canv bind lt <ButtonPress-1> "$405_ scanConv_adjustPosition left"
135 $canv bind rt <ButtonPress-1> "$405_ scanConv_adjustPosition right"
136 $canv scale all 0 0 1.2 1.2
137 # 0,0 is the top left, so move 0, 0 to the center of the canvas
138 $canv move all 50 50
139 }
140
141 ScanConvInterface instproc changeMode {} {
142 global g_mode
143 $self instvar 405_
144
145 $405_ scanConv_switchMode $g_mode
146 }
147
148 ScanConvInterface instproc destroy {} {
149 $self instvar 405_
150
151 $405_ closeConnection
152 }
153
154
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.