/[ascend]/trunk/tcltk98/TK/browser.tcl
ViewVC logotype

Contents of /trunk/tcltk98/TK/browser.tcl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations) (download) (as text)
Sat Nov 13 16:40:11 2004 UTC (17 years ago) by aw0a
File MIME type: text/x-tcl
File size: 19716 byte(s)
try again to commit moving tcl stuff
1 # browser.tcl
2 # by Benjamin A. Allan and Kirk A. Abbott
3 # Created: January 1994
4 # Part of ASCEND
5 # Revision: $Revision: 1.43 $
6 # Last modified on: $Date: 1998/06/18 15:55:20 $
7 # Last modified by: $Author: mthomas $
8 # Revision control file: $RCSfile: browser.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: browser.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(browser.tcl) { .browser}
39 set autoLoadList(browser.tcl) {0}
40
41 # procedures to show toplevel windows
42
43
44 # procedure to show window ShowWindow.browser
45 proc ShowWindow.browser { args} { # xf ignore me 7
46
47 global ascBrowVect ascGlobalVect
48 StartupSrc.browser
49
50 # build widget .browser
51 if {"[info procs XFEdit]" != ""} {
52 catch "XFDestroy .browser"
53 } {
54 catch "destroy .browser"
55 }
56 toplevel .browser
57
58 # Window manager configurations
59 wm iconify .browser
60 wm positionfrom .browser user
61 wm sizefrom .browser user
62 wm iconname .browser {Browser}
63 wm minsize .browser 100 100
64 wm title .browser {A4 Browser}
65 wm protocol .browser WM_DELETE_WINDOW {Toggle_Remote ascBrowVect}
66
67
68 # build widget .browser.main_frm
69 frame .browser.main_frm
70
71 # build widget .browser.main_frm.child_box
72 frame .browser.main_frm.child_box
73
74 # build widget .browser.main_frm.child_box.scrollbar2
75 scrollbar .browser.main_frm.child_box.scrollbar2 \
76 -command {.browser.main_frm.child_box.listbox1 yview}
77
78 # build widget .browser.main_frm.child_box.scrollbar3
79 scrollbar .browser.main_frm.child_box.scrollbar3 \
80 -command {.browser.main_frm.child_box.listbox1 xview} \
81 -orient {horizontal}
82
83 # build widget .browser.main_frm.child_box.listbox1
84 listbox .browser.main_frm.child_box.listbox1 \
85 -relief {raised} \
86 -xscrollcommand {.browser.main_frm.child_box.scrollbar3 set} \
87 -yscrollcommand {.browser.main_frm.child_box.scrollbar2 set} \
88 -font $ascBrowVect(font) \
89 -width 18 \
90 -height 2 \
91 -exportselection 0
92
93
94 # pack widget .browser.main_frm.child_box
95 pack append .browser.main_frm.child_box \
96 .browser.main_frm.child_box.scrollbar2 {right frame center filly} \
97 .browser.main_frm.child_box.listbox1 {top frame center expand fill} \
98 .browser.main_frm.child_box.scrollbar3 {bottom frame center fillx}
99
100 # build widget .browser.main_frm.parents_box
101 frame .browser.main_frm.parents_box
102
103 # build widget .browser.main_frm.parents_box.scrollbar2
104 scrollbar .browser.main_frm.parents_box.scrollbar2 \
105 -command {.browser.main_frm.parents_box.listbox1 yview}
106
107 # build widget .browser.main_frm.parents_box.scrollbar3
108 scrollbar .browser.main_frm.parents_box.scrollbar3 \
109 -command {.browser.main_frm.parents_box.listbox1 xview} \
110 -orient {horizontal}
111
112 # build widget .browser.main_frm.parents_box.listbox1
113 listbox .browser.main_frm.parents_box.listbox1\
114 -relief {raised} \
115 -xscrollcommand {.browser.main_frm.parents_box.scrollbar3 set} \
116 -yscrollcommand {.browser.main_frm.parents_box.scrollbar2 set} \
117 -font $ascBrowVect(font) \
118 -width 12 \
119 -height 2
120
121 # pack widget .browser.main_frm.parents_box
122 pack append .browser.main_frm.parents_box \
123 .browser.main_frm.parents_box.scrollbar2 {left frame center filly} \
124 .browser.main_frm.parents_box.listbox1 {top frame center expand fill} \
125 .browser.main_frm.parents_box.scrollbar3 {bottom frame center fillx}
126
127 # pack widget .browser.main_frm
128 pack append .browser.main_frm \
129 .browser.main_frm.parents_box {left frame center filly} \
130 .browser.main_frm.child_box {left frame center expand fill}
131
132
133 # build widget .browser.local_frm
134 frame .browser.local_frm
135
136 # build widget .browser.local_frm.child_box
137 frame .browser.local_frm.child_box
138
139 # build widget .browser.local_frm.child_box.scrollbar2
140 scrollbar .browser.local_frm.child_box.scrollbar2 \
141 -command {.browser.local_frm.child_box.listbox1 yview}
142
143 # build widget .browser.local_frm.child_box.scrollbar3
144 scrollbar .browser.local_frm.child_box.scrollbar3 \
145 -command {.browser.local_frm.child_box.listbox1 xview} \
146 -orient {horizontal}
147
148 # build widget .browser.local_frm.child_box.listbox1
149 listbox .browser.local_frm.child_box.listbox1 \
150 -relief {raised} \
151 -xscrollcommand {.browser.local_frm.child_box.scrollbar3 set} \
152 -yscrollcommand {.browser.local_frm.child_box.scrollbar2 set} \
153 -font $ascBrowVect(font) \
154 -width 18 \
155 -height 2 \
156 -exportselection 0
157
158
159 # pack widget .browser.local_frm.child_box
160 pack append .browser.local_frm.child_box \
161 .browser.local_frm.child_box.scrollbar2 {right frame center filly} \
162 .browser.local_frm.child_box.listbox1 {top frame center expand fill} \
163 .browser.local_frm.child_box.scrollbar3 {bottom frame center fillx}
164
165 # build widget .browser.local_frm.check_box
166 frame .browser.local_frm.check_box
167
168 set rr .browser.local_frm.check_box
169
170 # The command option of these checkbuttons is ugly.
171 # should instead of passing an arg, just use the traces
172 # on ascBrowVect(localshow,*) to set a (lasttoggled) value
173 # so that Brow_do_UpdateLocalBox doesn't need an argument.
174
175 # build rr.b1
176 checkbutton $rr.b1 \
177 -variable ascBrowVect(localshow,REAL_ATOM_INST) \
178 -command {Brow_do_UpdateLocalBox REAL_ATOM_INST} \
179 -text RV
180
181 # build rr.b2
182 checkbutton $rr.b2 \
183 -variable ascBrowVect(localshow,INTEGER_ATOM_INST) \
184 -command {Brow_do_UpdateLocalBox INTEGER_ATOM_INST} \
185 -text DV
186
187 # build rr.b3
188 checkbutton $rr.b3 \
189 -variable ascBrowVect(localshow,REL_INST) \
190 -command {Brow_do_UpdateLocalBox REL_INST} \
191 -text RR
192
193 # build rr.b4
194 checkbutton $rr.b4 \
195 -variable ascBrowVect(localshow,LREL_INST) \
196 -command {Brow_do_UpdateLocalBox LREL_INST} \
197 -text LR
198
199 # build rr.b5
200 checkbutton $rr.b5 \
201 -variable ascBrowVect(localshow,REAL_CONSTANT_INST) \
202 -command {Brow_do_UpdateLocalBox REAL_CONSTANT_INST} \
203 -text RC
204
205 # build rr.b6
206 checkbutton $rr.b6 \
207 -variable ascBrowVect(localshow,SET_ATOM_INST) \
208 -command {Brow_do_UpdateLocalBox SET_ATOM_INST} \
209 -text DC
210
211 # build rr.label
212 label $rr.label \
213 -textvariable ascBrowVect(locallabel) \
214 -justify right
215
216 # pack widget .browser.local_frm.check_box
217 pack append .browser.local_frm.check_box \
218 $rr.b1 {left frame center fill} \
219 $rr.b2 {left frame center fill} \
220 $rr.b3 {left frame center fill} \
221 $rr.b4 {left frame center fill} \
222 $rr.b5 {left frame center fill} \
223 $rr.b6 {left frame center fill} \
224 $rr.label {left frame center expand fill}
225
226 # pack widget .browser.main_frm
227 pack append .browser.local_frm \
228 .browser.local_frm.child_box {top frame center expand fill} \
229 .browser.local_frm.check_box {top frame center fill}
230
231 #
232 # Build the menu bar and submenus
233 #
234 menu .browser.menubar \
235 -tearoffcommand .BROWSER.MENUBAR \
236 -tearoff 0
237
238 # The Display menu
239 menu .browser.menubar.display \
240 -tearoffcommand .BROWSER.MENUBAR.DISPLAY \
241 -tearoff 0
242 .browser.menubar.display add command \
243 -command {Brow_do_DispAttr} \
244 -label {Attributes} \
245 -accelerator {Alt-d a} \
246 -underline 0
247 .browser.menubar.display add command \
248 -command {Brow_do_DispRelations} \
249 -label {Relations} \
250 -accelerator {Alt-d r} \
251 -underline 0
252 .browser.menubar.display add command \
253 -command {Brow_do_DispCondRels} \
254 -label {Conditional Relations} \
255 -accelerator {Alt-d c} \
256 -underline 0
257 .browser.menubar.display add command \
258 -command {Brow_do_DispLogRels} \
259 -label {Logical Relations} \
260 -accelerator {Alt-d l} \
261 -underline 0
262 .browser.menubar.display add command \
263 -command {Brow_do_DispCondLogRels} \
264 -label {Conditional Logical Relations} \
265 -accelerator {Alt-d o} \
266 -underline 1
267 .browser.menubar.display add command \
268 -command {Brow_do_DispWhens} \
269 -label {Whens} \
270 -accelerator {Alt-d w} \
271 -underline 0
272 .browser.menubar.display add separator
273 .browser.menubar.display add command \
274 -command {Brow_do_Plot} \
275 -accelerator {Alt-d p} \
276 -label {Plot} \
277 -underline 0
278 .browser.menubar.display add command \
279 -command {Brow_do_Statistics} \
280 -accelerator {Alt-d s} \
281 -label {Statistics} \
282 -underline 0
283
284 # The File menu
285 menu .browser.menubar.file \
286 -tearoffcommand .BROWSER.MENUBAR.FILE \
287 -tearoff 0
288 .browser.menubar.file add command \
289 -command {Brow_do_Write} \
290 -label {Write values...} \
291 -accelerator {Alt-f w} \
292 -underline 0
293 .browser.menubar.file add command \
294 -command {Brow_do_Read} \
295 -label {Read values...} \
296 -accelerator {Alt-f r} \
297 -underline 0
298 .browser.menubar.file add separator
299 .browser.menubar.file add command \
300 -command {Toggle_Remote ascBrowVect} \
301 -accelerator {Alt-f c} \
302 -label {Close window} \
303 -underline 0
304 .browser.menubar.file add command \
305 -command {Script_do_Exit} \
306 -accelerator {Alt-f e} \
307 -label {Exit ASCEND...} \
308 -underline 0
309
310 # The Edit menu
311 menu .browser.menubar.edit \
312 -tearoffcommand .BROWSER.MENUBAR.EDIT \
313 -tearoff 0
314 .browser.menubar.edit add command \
315 -command {Browser_do_Methods} \
316 -label {Run method...} \
317 -accelerator {Alt-e u} \
318 -underline 1
319 .browser.menubar.edit add command \
320 -command {Browser_do_ClearVars} \
321 -accelerator {Alt-e c} \
322 -label {Clear Vars} \
323 -underline 0
324 .browser.menubar.edit add separator
325 .browser.menubar.edit add command \
326 -command {Browser_do_SetValue} \
327 -accelerator {Alt-e v} \
328 -label {Set value...} \
329 -underline 4
330 # -command {Brow_do_ParentsSetValue}
331 .browser.menubar.edit add command \
332 -command {Browser_do_Refine} \
333 -accelerator {Alt-e r} \
334 -label {Refine...} \
335 -underline 0
336 .browser.menubar.edit add command \
337 -command {Browser_do_Merge} \
338 -accelerator {Alt-e m} \
339 -label {Merge...} \
340 -underline 0
341 .browser.menubar.edit add separator
342 .browser.menubar.edit add cascade \
343 -label {Compile} \
344 -menu {.browser.menubar.edit.compile}
345
346 # build widget .browser.menubar.edit.compile
347 menu .browser.menubar.edit.compile \
348 -tearoffcommand .BROWSER.MENUBAR.EDIT.COMPILE \
349 -tearoff 0
350 .browser.menubar.edit.compile add command \
351 -command {Browser_do_Resume} \
352 -accelerator {F5} \
353 -underline -1 \
354 -label {Resume Compilation}
355 .browser.menubar.edit.compile add command \
356 -command {Browser_do_CreatePart} \
357 -label {Create Part} \
358 -state disabled
359
360
361 # The Export menu
362 menu .browser.menubar.export \
363 -tearoffcommand .BROWSER.MENUBAR.EXPORT \
364 -tearoff 0
365 .browser.menubar.export add command \
366 -command {Brow_do_Export2Solver} \
367 -label {to Solver} \
368 -accelerator {Alt-x s} \
369 -underline 3
370 .browser.menubar.export add command \
371 -command {Brow_do_Export2Probe} \
372 -label {Many to Probe ...} \
373 -accelerator {Alt-x m} \
374 -underline 0
375 .browser.menubar.export add command \
376 -command {Brow_do_ExportOne2Probe} \
377 -accelerator {Alt-x p} \
378 -label {Item to Probe} \
379 -underline 8
380
381
382 # The Find menu
383 menu .browser.menubar.find \
384 -tearoffcommand .BROWSER.MENUBAR.FIND \
385 -tearoff 0
386 .browser.menubar.find add command \
387 -command {Brow_do_FindbyName} \
388 -label {By name...} \
389 -accelerator {Alt-i n} \
390 -underline 3
391 .browser.menubar.find add command \
392 -command {Brow_do_FindbyType} \
393 -label {By type...} \
394 -accelerator {Alt-i t} \
395 -underline 3
396 .browser.menubar.find add command \
397 -command {Brow_do_FindAliases} \
398 -label {Aliases} \
399 -accelerator {Alt-i a} \
400 -underline 0
401 .browser.menubar.find add command \
402 -command {Brow_do_FindISAs} \
403 -label {Where created} \
404 -accelerator {Alt-i w} \
405 -underline 0
406 .browser.menubar.find add command \
407 -command {Brow_do_FindClique} \
408 -accelerator {Alt-i c} \
409 -label {Clique} \
410 -underline 0
411 .browser.menubar.find add command \
412 -command {Brow_do_FindEligible} \
413 -label {Eligible variables} \
414 -accelerator {Alt-i e} \
415 -underline 0
416 .browser.menubar.find add command \
417 -command {Brow_do_FindActive} \
418 -label {Active relations} \
419 -accelerator {Alt-i r} \
420 -underline 7
421 .browser.menubar.find add command \
422 -command {Brow_do_FindOpers} \
423 -label {Operands} \
424 -accelerator {Alt-i o} \
425 -underline 0
426 .browser.menubar.find add command \
427 -command {Brow_do_FindParents} \
428 -label {Parents} \
429 -accelerator {Alt-i p} \
430 -underline 0
431 .browser.menubar.find add command \
432 -command {Brow_do_FindPendings} \
433 -label {Pendings} \
434 -accelerator {Alt-i d} \
435 -underline 3
436
437
438 # The Help menu
439 menu .browser.menubar.help \
440 -tearoffcommand .BROWSER.MENUBAR.HELP \
441 -tearoff 0
442 .browser.menubar.help add command \
443 -command {Brow_do_Help} \
444 -label {On Browser} \
445 -underline 3
446
447
448 # The Options menu
449 menu .browser.menubar.options \
450 -tearoffcommand .BROWSER.MENUBAR.options \
451 -tearoff 0
452 .browser.menubar.options add checkbutton \
453 -command {Brow_do_TypeorValue} \
454 -offvalue {PASSED} \
455 -onvalue {} \
456 -variable {ascBrowVect(HidePassed)} \
457 -accelerator {Alt-o p} \
458 -underline 5 \
459 -label {Hide Passed Parts}
460 .browser.menubar.options add checkbutton \
461 -command {Brow_do_TypeorValue} \
462 -offvalue ATOMS \
463 -onvalue {} \
464 -variable {ascBrowVect(ShowAtoms)} \
465 -accelerator {Alt-o a} \
466 -underline 9 \
467 -label {Suppress atoms}
468 .browser.menubar.options add checkbutton \
469 -command {Brow_do_TypeorValue} \
470 -offvalue {TYPE} \
471 -onvalue {VALUE} \
472 -variable {ascBrowVect(TypeorValue)} \
473 -accelerator {Alt-o v} \
474 -underline 13 \
475 -label {Display Atom Values}
476 .browser.menubar.options add checkbutton \
477 -offvalue {0} \
478 -onvalue {1} \
479 -variable {ascBrowVect(dimconsistency)} \
480 -accelerator {Alt-o d} \
481 -underline 6 \
482 -label {Check dimensionality}
483 .browser.menubar.options add command \
484 -command {Brow_do_SaveOptions} \
485 -label {Save options} \
486 -accelerator {Alt-o s} \
487 -underline 0
488 .browser.menubar.options add separator
489 .browser.menubar.options add command \
490 -command {Brow_do_HideNames} \
491 -label {Hide names...} \
492 -accelerator {Alt-o h} \
493 -underline 0
494 .browser.menubar.options add command \
495 -command {Brow_do_UnHideNames} \
496 -accelerator {Alt-o u} \
497 -label {Unhide names...} \
498 -underline 0
499
500 # The View menu
501 menu .browser.menubar.view \
502 -tearoffcommand .BROWSER.MENUBAR.VIEW \
503 -tearoff 0
504 .browser.menubar.view add command \
505 -command {Brow_do_Font} \
506 -label {Font ...} \
507 -accelerator {Alt-v f} \
508 -underline 0
509 .browser.menubar.view add checkbutton \
510 -offvalue {0} \
511 -onvalue {1} \
512 -variable {ascBrowVect(visibility)} \
513 -label {Open automatically} \
514 -accelerator {Alt-v o} \
515 -underline 0
516 .browser.menubar.view add command \
517 -command {View_Set_Save_Options browser} \
518 -label {Save window appearance} \
519 -accelerator {Alt-v s} \
520 -underline 0
521
522 #
523 # Add the menus as cascades of the toplevel's menu;
524 # add the toplevel's menu to the toplevel
525 #
526 .browser.menubar add cascade \
527 -menu .browser.menubar.file \
528 -label {File} \
529 -underline 0
530 .browser.menubar add cascade \
531 -menu .browser.menubar.edit \
532 -label {Edit} \
533 -underline 0
534 .browser.menubar add cascade \
535 -menu .browser.menubar.display \
536 -label {Display} \
537 -underline 0
538 .browser.menubar add cascade \
539 -menu .browser.menubar.find \
540 -label {Find} \
541 -underline 1
542 .browser.menubar add cascade \
543 -menu .browser.menubar.options \
544 -label {Options} \
545 -underline 0
546 .browser.menubar add cascade \
547 -menu .browser.menubar.view \
548 -label {View} \
549 -underline 0
550 .browser.menubar add cascade \
551 -menu .browser.menubar.export \
552 -label {Export} \
553 -underline 1
554 .browser.menubar add cascade \
555 -menu .browser.menubar.help \
556 -label {Help} \
557 -underline 0
558 .browser configure \
559 -menu .browser.menubar
560
561
562 #
563 # Add the main frame to the browser toplevel
564 #
565 pack append .browser \
566 .browser.main_frm {top frame center expand fill} \
567 .browser.local_frm {top frame center expand fill}
568
569 EndSrc.browser
570
571 if {"[info procs XFEdit]" != ""} {
572 catch "XFMiscBindWidgetTree .browser"
573 after 2 "catch {XFEditSetShowWindows}"
574 }
575 }
576
577 # proc DestroyWindow.browser {}
578 proc DestroyWindow.browser {} {# xf ignore me 7
579 if {"[info procs XFEdit]" != ""} {
580 if {"[info commands .browser]" != ""} {
581 global xfShowWindow.browser
582 set xfShowWindow.browser 0
583 XFEditSetPath .
584 after 2 "XFSaveAsProc .browser; XFEditSetShowWindows"
585 }
586 } {
587 catch "destroy .browser"
588 update
589 }
590 }
591
592 # proc StartupSrc.browser {args}
593 proc StartupSrc.browser {args} {
594 # browser startup entrance
595 global ascBrowVect ascGlobalVect env
596 if {[catch {set ascBrowVect(windowname)} ]} {
597 set ascBrowVect(minsize) 100x100
598 set ascBrowVect(geometry) 200x400+10+10
599 set ascBrowVect(iconname) Browser
600 set ascBrowVect(initialstate) normal
601 set ascBrowVect(font) "-*-*"
602 }
603 if {[catch {set ascGlobalVect(font)} ]} {
604 set ascGlobalVect(font) "-*-*"
605 set ascGlobalVect(labelfont) "-*-*"
606 set ascGlobalVect(tbg) "white"
607 set ascGlobalVect(tfg) "black"
608 set ascGlobalVect(bg) "white"
609 set ascGlobalVect(fg) "black"
610 set ascGlobalVect(afg) "white"
611 set ascGlobalVect(abg) "black"
612 set ascGlobalVect(sfg) "white"
613 set ascGlobalVect(sbg) "black"
614 set ascGlobalVect(visibility) 1
615 set ascGlobalVect(c_loaded) "0"
616 set ascGlobalVect(toolbitmap) \
617 "@$env(ASCENDBITMAPS)/toolAttributes.xbm"
618 }
619 }
620
621 # proc EndSrc.browser {}
622 proc EndSrc.browser {} {
623 # browser startup exit
624 global ascBrowVect
625 set ascBrowVect(geometry) [sanegeometry $ascBrowVect(geometry)]
626 set minw [lindex [split $ascBrowVect(minsize) x] 0]
627 set minh [lindex [split $ascBrowVect(minsize) x] 1]
628 set gw [lindex [split [lindex [split $ascBrowVect(geometry) +] 0] x] 0]
629 set gh [lindex [split [lindex [split $ascBrowVect(geometry) +] 0] x] 1]
630 set gp "+[lindex [split [split $ascBrowVect(geometry) x] +] 1]+[lindex [split [split $ascBrowVect(geometry) x] +] 2]"
631 if {[expr $gw < $minw]} {set gw $minw}
632 if {[expr $gh < $minh]} {set gh $minh}
633 set gwh "${gw}x${gh}"
634 wm minsize .browser $minw $minh
635 wm geometry .browser [osgpos $gwh$gp]
636 wm iconname .browser $ascBrowVect(iconname)
637
638 if {$ascBrowVect(initialstate)!="iconic" && \
639 $ascBrowVect(initialstate)!="iconified" &&
640 $ascBrowVect(initialstate)!="withdrawn"} {
641 wm deiconify .browser
642 }
643 if {"$ascBrowVect(initialstate)"=="withdrawn"} {
644 wm withdraw .browser
645 }
646 }
647
648
649 # Internal procedures
650
651 # eof
652 #

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22