This file is indexed.

/usr/share/elmerfront/tcl/ecif_tk_procsMessage.tcl is in elmer-common 6.1.0.svn.5396.dfsg-2ubuntu1.

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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#/*****************************************************************************/
# *
# *  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_procsMessage.tcl
#Language:  Tcl
#Date:      16.11.98
#Version:   1.00
#Author(s): Martti Verho
#Revisions: 
#
#Abstract:  Message box handling procedures
#
#************************************************************************


# For debugging!
# ==============
# Displays debug message in a Tk-message box
# Arguments {msg header} with default values
#
proc print { {msg "Debugging!"} {title "ELMER_FRONT_DEBUG_TCL_PRINT"} } {
  global Info

  if { !$Info(ELMER_FRONT_DEBUG_TCL_PRINT) } {
    return
  }

  #set msg [join $msg ]
  #tk_dialog .mBox $title $msg error 0 "OK"

  tk_messageBox -title $title -message $msg -default ok
}

proc MESSU0 { {msg ""} } {
  global Info

  set Info(messuCounter) 0
  
  MSG "MESSU-0 $msg  "
}


proc MESSU { {msg ""} } {
  global Info

  incr Info(messuCounter)
  
  MSG "MESSU-$Info(messuCounter) $msg  "
}


# Show debug message in the main window info area
#
proc MSG {messu {color ""} {nof_line_feeds 0} {append 1}} {
  global Info

  if { !$Info(ELMER_FRONT_DEBUG_TCL_PRINT) } {
    return
  }
  
  Message::showMessage $messu $color $nof_line_feeds $append
}


# Show debug message in the main window info area
# for a matching name
#
proc MSGN { name wanted_name messu {color ""} {nof_line_feeds 0} {append 1}} {
  global Info

  if { !$Info(ELMER_FRONT_DEBUG_TCL_PRINT) } {
    return
  }
  
  if { $name != $wanted_name } {
    return
  }

  Message::showMessage $messu $color $nof_line_feeds $append
}



#########################
### MESSAGE BOX procs ###
#########################


# Show message in the main window info area (a listbox)
#
proc Message::showMessage {messu {color ""} {nof_line_feeds 0} {append 1}} {
  global Info

  set last_row [$Info(messageWindow,listBox) size]

  # Limit the size of the listbox
  if { $last_row > $Info(messageWindow,maxSize) } {
    $Info(messageWindow,listBox) delete 0 0
  }

  # Replace last line (delete first last line)
  if { $append == 0 } {
    incr last_row -1
    $Info(messageWindow,listBox) delete $last_row end
  }

  # Insert new line at the end
  $Info(messageWindow,listBox) insert end $messu

  if { $color != "" } {
    $Info(messageWindow,listBox) itemconfigure end -fg $color
  }

  # Possible extra ( > 0) linefeeds
  set x 0
  while {$x < $nof_line_feeds} {
    $Info(messageWindow,listBox) insert end ""
    incr x
  }

  # Make last line visible
  $Info(messageWindow,listBox) see end
}


# Clear all messages in messagae area
#
proc Message::clearMessageArea {} {
  global Info
  
  set msg [list "All messages in the log area will be deleted!\n\n" \
                $Info(continueOk)
          ]

  if { ![Message::verifyAction $Info(noviceUser) $msg] } {
    return
  }

  $Info(messageWindow,listBox) delete 0 end
}


# Displays a Tk-message box
# NOTE: Global variable Info(messageIcon) is used for icon!
#
proc Message::dispMessage { {msg ""} {title ""} {parent ""} {type ok} {default ok} } {
  global Info

  if { $msg == "" } {
    set msg "Error!"
  }

  if { $title == "" } {
    set title "$Info(FRONT_NAME) message"
  }

  #--Set defaults and check
  if { $parent == "" && [info exists Info(thisWindow)] } {
    set parent $Info(thisWindow)
  } 

  if { $parent == "" || ![winfo exists $parent] } {
    set parent .
  }

  # Icon possibly set outside
  if { [info exists Info(messageIcon)] } {
    set icon $Info(messageIcon)  
  } else {
    set icon info
  }

  set msg [join $msg ]

  return [tk_messageBox -message $msg     \
                        -title $title     \
                        -type $type       \
                        -default $default \
                        -icon $icon       \
                        -parent $parent]

  # Back to default icon
  set Info(messageIcon) info

}


# Displays an Ok message in a Tk-message box
# Arguments {msg title} with default values
proc Message::dispOkMessage { {msg ""}
                     {title ""}
                     {parent "" }
                   } {
  return [Message::dispMessage $msg $title $parent ok ok]
}


# Displays an OkCancel verify box
#
# NOTE: verify_level is the highest user level which IS asked
# If it is 'powerUser', then all are asked!
#
# 
proc Message::verifyAction {verify_level {msg ""} {default ok} {icon warning} {title ""} {parent "" }} {
  global Info

  if { $verify_level < $Info(userLevel) } {
    return 1
  }

  set Info(messageIcon) $icon

  if { "cancel" == [Message::dispMessage $msg $title $parent okcancel $default] } {
    return 0
  } else {
    return 1
  }
}


# Displays an OkCancel message in a Tk-message box, ok as default
# Arguments {msg title} with default values
#
proc Message::dispOkCancelMessage {{msg ""} {title ""} {parent "" }} {
  return [Message::dispMessage $msg $title $parent okcancel ok]
}


# Displays an OkCancel message in a Tk-message box, cancel as default
# Arguments {msg title} with default values
#
proc Message::dispCancelOkMessage {{msg ""} {title ""} {parent "" }} {
  return [Message::dispMessage $msg $title $parent okcancel cancel]
}


# Displays an YesNoCancel message in a Tk-message box, Yes as default
# Arguments {msg title} with default values
#
proc Message::dispYesNoCancelMessage {{msg ""} {title ""} {parent "" } } {
  return [Message::dispMessage $msg $title $parent yesnocancel yes]
}


# Displays an YesNoCancel message in a Tk-message box, Cancel as default
# Arguments {msg title} with default values
#
proc Message::dispCancelYesNoMessage { {msg ""} {title ""} {parent "" }} {
  return [Message::dispMessage $msg $title $parent yesnocancel cancel]
}

# Displays an YesNo message in a Tk-message box, No as default
# Arguments {msg title} with default values
#
proc Message::dispYesNoMessage { {msg ""} {title ""} {parent "" }} {
  return [Message::dispMessage $msg $title $parent yesno no]
}


# Displays a yes-no dialog box
# Arguments {msg header} with default values
#
proc Message::dispYesNo {{msg "Error!"} {header ""}} {
  global Info

  set msg_str [join $msg ]

  if { $header == "" } {
    set header "$Info(FRONT_NAME) message!"
  }

  set result [tk_dialog .mBox $header $msg_str error 0 "Cancel" "OK"]

  switch $result {
    0 {return "cancel"}
    1 {return "ok"}
  } 
}


# Displays field help message
#
proc Message::helpMessage {globArray fld parent} {
  global Info
  upvar #0 $globArray theArray 

  # If field help defined
  #
  if { [info exist theArray(help,$fld)] } {
    set msg $theArray(help,$fld)

  # If no help for the field
  # NOTE: currently nothing is displayed
  } else {
    set msg "No help available for this field!"

    if { !$Info(ELMER_FRONT_DEBUG_TCL) } {
      return
    }
  }

  set arr [Panel::panelNameGuiToMenu $globArray]
  set var [DataField::fieldNameGuiToSif $fld]

  #set title "$arr:    $var"
  #tk_messageBox -message $msg -title $title -parent $parent -icon question

  set title "$var"
  tk_dialog  $parent.help $title $msg "" 0 Ok

}


# end ecif_tk_procsMessage.tcl
# ****************************