/usr/share/elmerfront/tcl/ecif_tk_labelDisplayPanel.tcl is in elmer-common 6.1.0.svn.5396.dfsg2-4ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | #/*****************************************************************************/
# *
# * Elmer, A Finite Element Software for Multiphysical Problems
# *
# * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
# *
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program (in file fem/GPL-2); if not, write to the
# * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# * Boston, MA 02110-1301, USA.
# *
# *****************************************************************************/
#***********************************************************************
#Program: ELMER Front
#Module: ecif_tk_labelDisplayPanel.tcl
#Language: Tcl
#Date: 10.02.00
#Version: 1.00
#Author(s): Martti Verho
#Revisions:
#
#Abstract: A panel for selecting object labels to be displayed
#
#************************************************************************
#--Select labels to be displayed
#
proc LabelDisplay::openPanel {} {
global Info LabelDisplay Model ModelFlags
upvar #0 LabelDisplay theArray
set w $LabelDisplay(winName)
set wgeom $LabelDisplay(winGeometry)
#--Store windows-id in globArray
set id [winfo atom $w]
set LabelDisplay(winId) $id
set Info(thisWindow) $w
set this $w
if { 1 == [Util::checkPanelWindow LabelDisplay $id "Labels" $wgeom] } {
raise $LabelDisplay(winName)
focus -force $LabelDisplay(winName)
return
}
if { $Model(GEOMETRY_DIMENSION) == "3D" } {
set LabelDisplay(targets) "FACE EDGE VERTEX"
set LabelDisplay(texts) "Boundary Edge Vertex"
} else {
set LabelDisplay(targets) "EDGE VERTEX"
set LabelDisplay(texts) "Boundary Vertex"
}
#---Store old values
foreach trg $LabelDisplay(targets) {
set ModelFlags(LABEL_DISPLAY_$trg,old) $ModelFlags(LABEL_DISPLAY_$trg)
}
set LabelDisplay(dataChanged) 0
set LabelDisplay(dataModified) 0
toplevel $w
focus $w
#--Window properties
wm title $w $LabelDisplay(winTitle)
wm geometry $w $wgeom
#----WIDGET DEFINITION AND PACKING
#
set fpx1 $Info(framePadX1)
set fpy1 $Info(framePadY1)
set fpx2 $Info(framePadX2)
set fpy2 $Info(framePadY2)
#---Outer frames
set f1 [frame $w.f1] ;#outer frame
set f11 [frame $w.f1.f1] ;#-check box + body name and color frame
set f12 [frame $w.f1.f2] ;#-All None button area
set f2 [frame $w.f2] ; #Apply+Ok+cancel buttons frame
#---Label checkbuttons
foreach trg $LabelDisplay(targets) txt $LabelDisplay(texts) {
set var_name "ModelFlags(LABEL_DISPLAY_$trg)"
set f [frame $f11.f$trg]
set cb [checkbutton $f.cb$id -indicatoron 1 -variable $var_name -text $txt]
$cb configure -command "LabelDisplay::setDisplayMode"
set state normal
# For mesh only geometry, we do not have
# boundary labels!
if { !$ModelFlags(GEOMETRY_TYPE_CAD) } {
if { $trg == "FACE" || $trg == "EDGE" } {
set state disabled
}
}
$cb configure -state $state
bind $cb <ButtonRelease-1> "Panel::panelDataChanged 1 LabelDisplay $cb {%A %K}"
pack $cb -side left -anchor w
pack $f -side top -anchor w -expand 1
}
#-All, None buttons
set all_btn [button $f12.all -text All -command "LabelDisplay::all" \
-width 3]
set none_btn [button $f12.none -text None -command "LabelDisplay::none" \
-width 3]
pack $all_btn $none_btn -side top -expand 1 -pady $fpy2
set ap $Info(defaultApplyState)
set ca $Info(defaultCancelState)
#-Buttons
set ok_btn [button $f2.ok -text OK -command "LabelDisplay::panelOk $this"]
set cn_btn [button $f2.cancel -text Cancel -command "LabelDisplay::panelCancel $this" \
-state $ca]
set ap_btn [button $f2.apply -text Apply -command "LabelDisplay::panelApply" \
-state $ap]
focus $ok_btn
set LabelDisplay(applyButton) $ap_btn
set LabelDisplay(cancelButton) $cn_btn
pack $ok_btn $cn_btn $ap_btn -side left -expand 1 -padx $fpx1
pack $f1 -side top -anchor w -expand 1 -padx $fpx2 -pady $fpy2
pack $f1.f1 -side left -expand 1 -padx $fpx2
pack $f1.f2 -side left -expand 1 -padx $fpx2
pack $f2 -side top -expand 1 -padx $fpx2 -pady $fpy2
}
proc LabelDisplay::all {} {
global LabelDisplay ModelFlags
set changed 0
foreach trg $LabelDisplay(targets) {
if { $ModelFlags(LABEL_DISPLAY_$trg) != 1 } {
set changed 1
}
set ModelFlags(LABEL_DISPLAY_$trg) 1
}
if {$changed} {
Panel::panelDataChanged 1 LabelDisplay
LabelDisplay::setDisplayMode
}
}
proc LabelDisplay::none {} {
global LabelDisplay ModelFlags
set changed 0
foreach trg $LabelDisplay(targets) {
if { $ModelFlags(LABEL_DISPLAY_$trg) != 0 } {
set changed 1
}
set ModelFlags(LABEL_DISPLAY_$trg) 0
}
if {$changed} {
Panel::panelDataChanged 1 LabelDisplay
LabelDisplay::setDisplayMode
}
}
proc LabelDisplay::setDisplayMode {} {
global LabelDisplay
# Refresh label display
Util::updateGui
foreach trg $LabelDisplay(targets) {
Util::setFlagValue LABEL_DISPLAY LABEL_DISPLAY_$trg
}
}
proc LabelDisplay::panelOk {w} {
global LabelDisplay
LabelDisplay::panelApply
Panel::cancel $w
}
proc LabelDisplay::panelApply {} {
global LabelDisplay ModelFlags
#---No changes
if { !$LabelDisplay(dataChanged) } {
return
}
if { -1 == [ LabelDisplay::panelCheck] } {
return
}
Panel::panelDataChanged 0 LabelDisplay
Panel::panelDataModified 0 LabelDisplay
#---Store old values
foreach trg $LabelDisplay(targets) {
set ModelFlags(LABEL_DISPLAY_$trg,old) $ModelFlags(LABEL_DISPLAY_$trg)
}
LabelDisplay::setDisplayMode
}
proc LabelDisplay::panelCancel {w} {
global LabelDisplay ModelFlags
if {$LabelDisplay(dataChanged)} {
# Restore previous values
foreach trg $LabelDisplay(targets) {
set ModelFlags(LABEL_DISPLAY_$trg) $ModelFlags(LABEL_DISPLAY_$trg,old)
}
# Refresh display
LabelDisplay::panelApply
}
Panel::cancel $w
}
proc LabelDisplay::panelCheck {} {
global LabelDisplay
#-Ok
return 1
}
#ecif_labelDisplayPanel.tcl
|