1 |
# mtx.tcl |
2 |
# by Benjamin A. Allan and Kirk A. Abbott |
3 |
# Created: January 1994 |
4 |
# Part of ASCEND |
5 |
# Revision: $Revision: 1.10 $ |
6 |
# Last modified on: $Date: 1998/06/18 15:55:33 $ |
7 |
# Last modified by: $Author: mthomas $ |
8 |
# Revision control file: $RCSfile: mtx.tcl,v $ |
9 |
# |
10 |
# This file is part of the ASCEND Tcl/Tk Interface. |
11 |
# |
12 |
# Copyright (C) 1994-1998 Carnegie Mellon University |
13 |
# |
14 |
# The ASCEND Tcl/Tk Interface is free software; you can redistribute |
15 |
# it and/or modify it under the terms of the GNU General Public |
16 |
# License as published by the Free Software Foundation; either |
17 |
# version 2 of the License, or (at your option) any later version. |
18 |
# |
19 |
# The ASCEND Tcl/Tk Interface is distributed in hope that it will be |
20 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
21 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 |
# GNU General Public License for more details. |
23 |
# |
24 |
# You should have received a copy of the GNU General Public License |
25 |
# along with the program; if not, write to the Free Software |
26 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the |
27 |
# file named COPYING. COPYING is found in ../compiler. |
28 |
|
29 |
# Module: mtx.tcl |
30 |
# Tcl version: 7.1 (Tcl/Tk/XF) |
31 |
# Tk version: 3.4 |
32 |
# XF version: 2.2 |
33 |
# |
34 |
|
35 |
# module contents |
36 |
global moduleList |
37 |
global autoLoadList |
38 |
set moduleList(mtx.tcl) { ShowWindow.mtx .mtx} |
39 |
set autoLoadList(mtx.tcl) {0} |
40 |
|
41 |
# procedures to show toplevel windows |
42 |
|
43 |
|
44 |
# procedure to show window .mtx |
45 |
# proc ShowWindow.mtx {args} |
46 |
proc ShowWindow.mtx {args} {# xf ignore me 7 |
47 |
|
48 |
global ascMtxVect ascGlobalVect ascSolvVect |
49 |
StartupSrc.mtx |
50 |
|
51 |
# build widget .mtx |
52 |
if {"[info procs XFEdit]" != ""} { |
53 |
catch "XFDestroy .mtx" |
54 |
} { |
55 |
catch "destroy .mtx" |
56 |
} |
57 |
toplevel .mtx |
58 |
|
59 |
# Window manager configurations |
60 |
wm positionfrom .mtx user |
61 |
wm sizefrom .mtx "" |
62 |
wm maxsize .mtx 1152 900 |
63 |
wm title .mtx {MtxView Incidence} |
64 |
wm geometry .mtx $ascMtxVect(geometry) |
65 |
wm protocol .mtx WM_DELETE_WINDOW {Mtx_do_OK} |
66 |
|
67 |
|
68 |
# build widget .mtx.btn_mtx_red |
69 |
button .mtx.btn_mtx_red \ |
70 |
-command {Mtx_do_Redraw} \ |
71 |
-font $ascMtxVect(font) \ |
72 |
-text { Redraw } |
73 |
|
74 |
# build widget .mtx.btn_ok |
75 |
label .mtx.btn_ok \ |
76 |
-font $ascMtxVect(font) \ |
77 |
-text { Magnification: } |
78 |
|
79 |
# build widget .mtx.can_mtx |
80 |
frame .mtx.can_mtx |
81 |
|
82 |
# build widget .mtx.can_mtx.scrollbar1 |
83 |
scrollbar .mtx.can_mtx.scrollbar1 \ |
84 |
-command {.mtx.can_mtx.canvas2 yview} |
85 |
|
86 |
# build widget .mtx.can_mtx.scrollbar3 |
87 |
scrollbar .mtx.can_mtx.scrollbar3 \ |
88 |
-command {.mtx.can_mtx.canvas2 xview} \ |
89 |
-orient {horizontal} |
90 |
|
91 |
# build widget .mtx.can_mtx.canvas2 |
92 |
canvas .mtx.can_mtx.canvas2 \ |
93 |
-height {207} \ |
94 |
-insertofftime {600} \ |
95 |
-scrollregion {0c 0c 20c 20c} \ |
96 |
-width {295} \ |
97 |
-xscrollcommand {.mtx.can_mtx.scrollbar3 set} \ |
98 |
-yscrollcommand {.mtx.can_mtx.scrollbar1 set} |
99 |
|
100 |
# pack widget .mtx.can_mtx |
101 |
pack append .mtx.can_mtx \ |
102 |
.mtx.can_mtx.scrollbar1 {right frame center filly} \ |
103 |
.mtx.can_mtx.canvas2 {top frame center expand fill} \ |
104 |
.mtx.can_mtx.scrollbar3 {top frame center fillx} |
105 |
|
106 |
# build widget .mtx.col |
107 |
frame .mtx.col \ |
108 |
-relief {raised} |
109 |
|
110 |
# build widget .mtx.col.entry5 |
111 |
entry .mtx.col.entry5 \ |
112 |
-font $ascMtxVect(font) \ |
113 |
-exportselection {0} \ |
114 |
-textvariable {ascMtxVect(varnum)} |
115 |
|
116 |
# build widget .mtx.col.label4 |
117 |
label .mtx.col.label4 \ |
118 |
-font $ascMtxVect(font) \ |
119 |
-width 10 \ |
120 |
-text {Variable:} |
121 |
|
122 |
# pack widget .mtx.col |
123 |
pack append .mtx.col \ |
124 |
.mtx.col.label4 {left frame center} \ |
125 |
.mtx.col.entry5 {top frame center expand fill} |
126 |
|
127 |
# build widget .mtx.eqn |
128 |
frame .mtx.eqn \ |
129 |
-relief {raised} |
130 |
|
131 |
# build widget .mtx.eqn.entry5 |
132 |
entry .mtx.eqn.entry5 \ |
133 |
-font $ascMtxVect(font) \ |
134 |
-exportselection {0} \ |
135 |
-textvariable {ascMtxVect(eqnname)} |
136 |
|
137 |
# build widget .mtx.eqn.label4 |
138 |
label .mtx.eqn.label4 \ |
139 |
-font $ascMtxVect(font) \ |
140 |
-width 10 \ |
141 |
-text {Eqn Name:} |
142 |
|
143 |
# pack widget .mtx.eqn |
144 |
pack append .mtx.eqn \ |
145 |
.mtx.eqn.label4 {left frame center} \ |
146 |
.mtx.eqn.entry5 {top frame center expand fill} |
147 |
|
148 |
# build widget .mtx.row |
149 |
frame .mtx.row \ |
150 |
-relief {raised} |
151 |
|
152 |
# build widget .mtx.row.entry5 |
153 |
entry .mtx.row.entry5 \ |
154 |
-font $ascMtxVect(font) \ |
155 |
-exportselection {0} \ |
156 |
-textvariable {ascMtxVect(eqnnum)} |
157 |
|
158 |
# build widget .mtx.row.label4 |
159 |
label .mtx.row.label4 \ |
160 |
-font $ascMtxVect(font) \ |
161 |
-width 10 \ |
162 |
-text {Equation:} |
163 |
|
164 |
# pack widget .mtx.row |
165 |
pack append .mtx.row \ |
166 |
.mtx.row.label4 {left frame center} \ |
167 |
.mtx.row.entry5 {top frame center expand fill} |
168 |
|
169 |
# build widget .mtx.var |
170 |
frame .mtx.var |
171 |
|
172 |
# build widget .mtx.var.entry5 |
173 |
entry .mtx.var.entry5 \ |
174 |
-font $ascMtxVect(font) \ |
175 |
-exportselection {0} \ |
176 |
-textvariable {ascMtxVect(varname)} |
177 |
|
178 |
# build widget .mtx.var.label4 |
179 |
label .mtx.var.label4 \ |
180 |
-font $ascMtxVect(font) \ |
181 |
-width 10 \ |
182 |
-text {Var Name:} |
183 |
|
184 |
# pack widget .mtx.var |
185 |
pack append .mtx.var \ |
186 |
.mtx.var.label4 {left frame center} \ |
187 |
.mtx.var.entry5 {top frame center expand fill} |
188 |
|
189 |
# build widget .mtx.blk |
190 |
frame .mtx.blk \ |
191 |
-relief {raised} |
192 |
|
193 |
# build widget .mtx.blk.entry5 |
194 |
entry .mtx.blk.entry5 \ |
195 |
-font $ascMtxVect(font) \ |
196 |
-exportselection {0} \ |
197 |
-width 8 \ |
198 |
-textvariable {ascMtxVect(blknumber)} |
199 |
|
200 |
# build widget .mtx.blk.label4 |
201 |
label .mtx.blk.label4 \ |
202 |
-font $ascMtxVect(font) \ |
203 |
-width 10 \ |
204 |
-text {Block:} |
205 |
|
206 |
# build widget .mtx.blk.printblk_btn |
207 |
button .mtx.blk.printblk_btn \ |
208 |
-command {Mtx_do_PrintBlock} \ |
209 |
-font $ascMtxVect(font) \ |
210 |
-text {PrintBlock } |
211 |
|
212 |
# build widget .mtx.blk.print_btn |
213 |
button .mtx.blk.print_btn \ |
214 |
-command {Mtx_do_Print} \ |
215 |
-font $ascMtxVect(font) \ |
216 |
-text {Print } |
217 |
|
218 |
# pack widget .mtx.blk |
219 |
pack append .mtx.blk \ |
220 |
.mtx.blk.label4 {left frame center} \ |
221 |
.mtx.blk.entry5 {left frame center expand fill} |
222 |
# .mtx.blk.print_btn {right frame center expand fill} \ |
223 |
.mtx.blk.printblk_btn {right frame center expand fill} |
224 |
|
225 |
# build widget .mtx.zoom |
226 |
scale .mtx.zoom \ |
227 |
-from {1} \ |
228 |
-orient {horizontal} \ |
229 |
-to {14} |
230 |
|
231 |
# |
232 |
# Build the menubar and the menus |
233 |
# |
234 |
menu .mtx.menubar \ |
235 |
-tearoffcommand .MTX.MENUBAR \ |
236 |
-tearoff 0 |
237 |
|
238 |
# The File menu |
239 |
menu .mtx.menubar.file \ |
240 |
-tearoffcommand .MTX.MENUBAR.FILE \ |
241 |
-tearoff 0 |
242 |
.mtx.menubar.file add command \ |
243 |
-command {Mtx_do_Print} \ |
244 |
-label {Print...} \ |
245 |
-underline 0 |
246 |
.mtx.menubar.file add command \ |
247 |
-command {Mtx_do_PrintBlock} \ |
248 |
-label {Print block...} \ |
249 |
-underline 6 |
250 |
.mtx.menubar.file add separator |
251 |
.mtx.menubar.file add command \ |
252 |
-command {Mtx_do_OK} \ |
253 |
-label {Close window} \ |
254 |
-underline 0 |
255 |
|
256 |
# The Help menu |
257 |
menu .mtx.menubar.help \ |
258 |
-tearoffcommand .MTX.MENUBAR.HELP \ |
259 |
-tearoff 0 |
260 |
.mtx.menubar.help add command \ |
261 |
-command {Mtx_do_Help} \ |
262 |
-label {On Mtx View Incidence} \ |
263 |
-underline 3 |
264 |
|
265 |
# The View menu |
266 |
menu .mtx.menubar.view \ |
267 |
-tearoffcommand .MTX.MENUBAR.VIEW \ |
268 |
-tearoff 0 |
269 |
.mtx.menubar.view add command \ |
270 |
-command {Mtx_do_Font} \ |
271 |
-label {Font...} \ |
272 |
-underline 0 |
273 |
|
274 |
|
275 |
# Add the menus to the menubar and the menubar to the toplebel |
276 |
.mtx.menubar add cascade \ |
277 |
-menu .mtx.menubar.file \ |
278 |
-label {File} \ |
279 |
-underline 0 |
280 |
.mtx.menubar add cascade \ |
281 |
-menu .mtx.menubar.view \ |
282 |
-label {View} \ |
283 |
-underline 0 |
284 |
.mtx.menubar add cascade \ |
285 |
-menu .mtx.menubar.help \ |
286 |
-label {Help} \ |
287 |
-underline 0 |
288 |
.mtx configure \ |
289 |
-menu .mtx.menubar |
290 |
|
291 |
# pack widget .mtx |
292 |
pack append .mtx \ |
293 |
.mtx.col {top frame center fill} \ |
294 |
.mtx.var {top frame center fillx} \ |
295 |
.mtx.row {top frame center fill} \ |
296 |
.mtx.eqn {top frame center fill} \ |
297 |
.mtx.blk {top frame center fillx} \ |
298 |
.mtx.can_mtx {top frame center expand fill} \ |
299 |
.mtx.btn_mtx_red {right frame center fill} \ |
300 |
.mtx.zoom {right frame center expand fillx} \ |
301 |
.mtx.btn_ok {right frame center fill} |
302 |
|
303 |
# build canvas items .mtx.can_mtx.canvas2 |
304 |
|
305 |
EndSrc.mtx |
306 |
|
307 |
if {"[info procs XFEdit]" != ""} { |
308 |
catch "XFMiscBindWidgetTree .mtx" |
309 |
after 2 "catch {XFEditSetShowWindows}" |
310 |
} |
311 |
} |
312 |
|
313 |
# proc DestroyWindow.mtx {} |
314 |
proc DestroyWindow.mtx {} {# xf ignore me 7 |
315 |
if {"[info procs XFEdit]" != ""} { |
316 |
if {"[info commands .mtx]" != ""} { |
317 |
global xfShowWindow.mtx |
318 |
set xfShowWindow.mtx 0 |
319 |
XFEditSetPath . |
320 |
after 2 "XFSaveAsProc .mtx; XFEditSetShowWindows" |
321 |
} |
322 |
} { |
323 |
catch "destroy .mtx" |
324 |
update |
325 |
} |
326 |
} |
327 |
|
328 |
# proc StartupSrc.mtx {args} |
329 |
proc StartupSrc.mtx {args} { |
330 |
# mtx startup entrance |
331 |
global ascMtxVect ascSolvVect |
332 |
if {[info exists ascMtxVect(font)]} { |
333 |
return |
334 |
} |
335 |
if {[ catch {set ascMtxVect(font) $ascSolvVect(font)} ]} { |
336 |
set ascMtxVect(font) "-*-*" |
337 |
} |
338 |
} |
339 |
|
340 |
# proc EndSrc.mtx {} |
341 |
proc EndSrc.mtx {} { |
342 |
# mtx startup exit |
343 |
global ascMtxVect |
344 |
# if {$ascMtxVect(initialstate)!="uniconified"} {wm iconify .mtx} |
345 |
} |
346 |
|
347 |
|
348 |
# User defined procedures |
349 |
|
350 |
|
351 |
# Internal procedures |
352 |
|
353 |
# eof |
354 |
# |
355 |
|