home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/moat
-
- global interp
-
- proc findInterp {w} {
- set interps [interps]
-
- xmFormDialog $w.dsh managed
- xmList $w.dsh.list \
- -visibleItemCount [llength $interps] \
- -selectionPolicy single_select
- foreach i $interps {
- $w.dsh.list addItem $i 0
- }
-
- $w.dsh.list manageChild
- $w.dsh.list singleSelectionCallback "foundInterp %item $w"
- }
-
- proc foundInterp {item w} {
- global interp
-
- set interp $item
- [$w.dsh parent] destroyWidget
- .main.form.label setValues \
- -labelString $interp
-
- findTree .
- }
-
- proc findTree {w} {
- global interp
-
- set children [send $interp "$w getValues -children c; set c"]
- if {$children != ""} {
- foreach i [split $children ", "] {
- if {$i != {}} {
- .main.form.tree addItem $i 0
- }
- if {$i != {} && [send $interp "$i isComposite"] == "true"} {
- findTree $i
- }
- }
- }
- }
-
- proc findResources {w} {
- global interp
-
- . defineCursor coffee_mug
- .main.form.resources setValues \
- -items "" -itemCount 0
- set resources [send $interp "$w resources"]
- # puts stdout $resources
- set resources [lsort $resources]
-
- # unmap so we don't get flickering on reset
- .main.form.resources unmapWidget
- foreach i $resources {
- set item "[lindex $i 1]: [lindex $i 4]"
- .main.form.resources addItem $item 0
- }
- .main.form.resources mapWidget
- . defineCursor ""
- }
-
- xtAppInitialize
-
- xmMainWindow .main managed
- xmForm .main.form managed
-
- xmLabel .main.form.label managed \
- -labelString "" \
- -topAttachment attach_form \
- -leftAttachment attach_form \
- -rightAttachment attach_form
- xmScrolledList .main.form.tree managed \
- -selectionPolicy single_select \
- -topAttachment attach_widget \
- -topWidget .main.form.label \
- -leftAttachment attach_form \
- -rightAttachment attach_position \
- -rightPosition 50 \
- -bottomAttachment attach_form
- xmScrolledList .main.form.resources managed \
- -topAttachment attach_widget \
- -topWidget .main.form.label \
- -leftAttachment attach_position \
- -leftPosition 50 \
- -rightAttachment attach_form \
- -bottomAttachment attach_form
-
- # I am not supporting simple menu functions, so do this the long way
-
- # top menu bar
- xmMenuBar .main.menuBar managed
- xmCascadeButton .main.menuBar.file managed \
- -labelString File \
- -mnemonic F
- xmCascadeButton .main.menuBar.help managed \
- -labelString Help \
- -mnemonic H
-
- # file pulldown
- xmPulldownMenu .main.menuBar.fileMenu
- xmPushButton .main.menuBar.fileMenu.Open managed \
- -mnemonic O
- xmPushButton .main.menuBar.fileMenu.Quit managed \
- -mnemonic Q
- .main.menuBar.file setValues -subMenuId .main.menuBar.fileMenu
-
- # callbacks for file menu
- .main.menuBar.fileMenu.Quit activateCallback "exit 0"
- .main.menuBar.fileMenu.Open activateCallback "findInterp %w"
-
-
- # help pulldown
- xmPulldownMenu .main.menuBar.helpMenu managed
- xmPushButton .main.menuBar.helpMenu.help managed \
- -labelString Help \
- -mnemonic H
- .main.menuBar.help setValues -subMenuId .main.menuBar.helpMenu
-
- .main.menuBar setValues -menuHelpWidget .main.menuBar.help
-
- .main setValues -workWindow .main.form \
- -menuBar .main.menuBar
-
- .main.form.tree singleSelectionCallback {findResources %item}
-
-
- . realizeWidget
- . mainLoop
-
-