# # Copyright 2003 (c) Pointwise, Inc. # All rights reserved. # # This sample Gridgen script is not supported by Pointwise, Inc. # It is provided freely for demonstration purposes only. # SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE. # gg::tkLoad catch { set scriptDir [file dirname [info script]] source [file join $scriptDir pwiLogo.glf] } set ColorALL 1 set ColorSOME 2 set ColorNONE 3 set allStyles {} foreach dom [gg::domGetAll] { lappend allStyles "[gg::domDisp $dom -linecolor] [gg::domDisp $dom -surfacecolor]" } proc restoreColors {} { global allStyles for { set i 0 } { $i < [llength $allStyles] } { incr i } { gg::domDisp [lindex [gg::domGetAll] $i] -linecolor [lindex [lindex $allStyles $i] 0] -surfacecolor [lindex [lindex $allStyles $i] 1] } } proc getAssociativity { dom } { gg::domReport $dom data {REFERENCE STRUCTURE} if { $data(numDBPts)==0 } { return NONE } if { $data(numDBPts)==$data(pointsTotal) } { return ALL } return SOME } proc setColors {} { global ColorALL ColorSOME ColorNONE foreach dom [gg::domGetAll] { set associativity [getAssociativity $dom] gg::domDisp $dom -norefresh -linecolor [expr [set Color${associativity}]-1] -surfacecolor [expr [set Color${associativity}]-1] } } proc makeWindow { } { global ColorALL ColorSOME ColorNONE label .title -text "Color Domains By DB Associativity" set font [.title cget -font] .title configure -font [font create -family [font actual $font -family] -weight bold] pack .title -expand 1 -side top pack [frame .hr1 -relief sunken -height 2 -bd 1] -side top -padx 2 -fill x -pady 1 pack [frame .inputs] -padx 2 pack [frame .left] -in .inputs -side left -fill y pack [frame .middle] -in .inputs -side left -fill y pack [frame .right] -in .inputs -side left -fill y pack [label .lblALL -text "All Points:"] -padx 2 -anchor e -in .left -pady 5 pack [label .lblSOME -text "Some Points:"] -padx 2 -anchor e -in .left -pady 5 pack [label .lblNONE -text "No Points:"] -padx 2 -anchor e -in .left -pady 5 set m [tk_optionMenu .optsALL ColorALL 1 2 3 4 5 6 7] for { set i 0 } { $i < 7 } { incr i } { $m entryconfigure $i -command ".sampleALL configure -background [gg::dispColor $i]" } pack .optsALL -in .middle set m [tk_optionMenu .optsSOME ColorSOME 1 2 3 4 5 6 7] for { set i 0 } { $i < 7 } { incr i } { $m entryconfigure $i -command ".sampleSOME configure -background [gg::dispColor $i]" } pack .optsSOME -in .middle set m [tk_optionMenu .optsNONE ColorNONE 1 2 3 4 5 6 7] for { set i 0 } { $i < 7 } { incr i } { $m entryconfigure $i -command ".sampleNONE configure -background [gg::dispColor $i]" } pack .optsNONE -in .middle pack [frame .sampleALL -background [gg::dispColor [expr $ColorALL-1]] -width 1c -height .5c] -padx 2 -in .right -pady 5 pack [frame .sampleSOME -background [gg::dispColor [expr $ColorSOME-1]] -width 1c -height .5c] -padx 2 -in .right -pady 5 pack [frame .sampleNONE -background [gg::dispColor [expr $ColorNONE-1]] -width 1c -height .5c] -padx 2 -in .right -pady 5 pack [frame .hr2 -relief sunken -height 2 -bd 1] -side top -padx 2 -fill x -pady 1 pack [frame .buttons] -fill x -padx 2 -pady 1 pack [button .buttons.preview -text "Preview" -command { wm withdraw .; setColors; gg::dispInteract "Preview Database Coloring"; if {[winfo exists .]} { wm deiconify . } }] -side right -padx 2 pack [button .buttons.cancel -text "Cancel" -command { restoreColors; exit }] -side right -padx 2 pack [button .buttons.ok -text "OK" -command { setColors; exit }] -side right -padx 2 if {![catch {pwiLogoCreate .buttons.logo 1} b]} { $b configure -bd 0 -relief flat pack $b -side left -padx 5 -fill y } } makeWindow gg::tkLoop # # DISCLAIMER: # TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS # ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED # TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED # BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY # FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES # WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF # BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE # USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN # ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE # FAULT OR NEGLIGENCE OF POINTWISE. #