This file is indexed.

/usr/share/astk/print.tcl is in code-aster-gui 1.13.1-2.

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
#########################################################################
# COPYRIGHT (C) 2003         EDF R&D              WWW.CODE-ASTER.ORG    #
#                                                                       #
# 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; IF NOT, WRITE TO : EDF R&D CODE_ASTER,       #
#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.        #
#########################################################################

# $Id: print.tcl 2302 2006-10-26 11:29:20Z courtois $

# reaction a Impression
#################################################################
proc print_conf { } {
   global impr_sel
   global old_impr old_inv
   set fen .fen_impr
   catch {destroy $fen}
   toplevel $fen
   wm withdraw $fen
   wm title $fen [ashare::mess ihm 247]
   wm transient $fen .
   grab set $fen
   
# sauvegarde le tableau outils avant modif
   copie_tabl astk::print old_impr
   if { $astk::print(nb) > 0 } {
      set impr_sel $astk::print(0,label)
   }
   print_conf_list $fen

   wm deiconify $fen
}

# recréer la liste des imprimantes
#################################################################
proc print_conf_list { fen } {
   global impr_sel last_impr_sel

   catch {destroy $fen.haut}
   catch {destroy $fen.liste}
   catch {destroy $fen.bas}

   # le 1er coup ET quand on veut recréer la liste, il faut raffraichir
   set last_impr_sel -1

   pack [frame $fen.haut -relief flat -bd 0] -fill x -expand yes
   pack [frame $fen.liste -relief solid -bd 1] -fill x
   pack [frame $fen.bas -relief solid -bd 0] -fill both -expand yes

   pack [frame $fen.haut.choix_impr -relief solid -bd 0] -side left -fill x -expand yes
   if { $astk::print(nb) > 0 } {
      set MenuImpr [tk_optionMenu $fen.haut.choix_impr.pr impr_sel $astk::print(0,label)]
      $MenuImpr entryconfigure 0 -font $astk::ihm(font,labmenu) -command "print_conf_para $fen.liste \"$astk::print(0,label)\""
      for {set j 1} {$j < $astk::print(nb)} {incr j} {
         $MenuImpr add radiobutton
         $MenuImpr entryconfigure $j -label $astk::print($j,label) -font $astk::ihm(font,labmenu) -variable impr_sel -command "print_conf_para $fen.liste \"$astk::print($j,label)\""
      }
      $MenuImpr add radiobutton
      $MenuImpr entryconfigure $j -label [ashare::mess ihm 255] -font $astk::ihm(font,labmenu) -variable impr_sel -command "add_print $fen $MenuImpr"
   #
      $fen.haut.choix_impr.pr configure -font $astk::ihm(font,labmenu) -bg $astk::ihm(couleur,liste)
      pack $fen.haut.choix_impr.pr
      print_conf_para $fen.liste "$impr_sel"
   } else {
      set MenuImpr [tk_optionMenu $fen.haut.choix_impr.pr impr_sel [ashare::mess ihm 255]]
      $MenuImpr entryconfigure 0 -font $astk::ihm(font,labmenu) -command "add_print $fen $MenuImpr"
      pack $fen.haut.choix_impr.pr
   }
   $MenuImpr configure \
        -foreground $astk::ihm(couleur,menu_foreground) \
        -background $astk::ihm(couleur,menu_background)
   button $fen.haut.help -image [image create photo -file $astk::icon(help)] \
         -bd 0 -command "grab release $fen ; aff_aide . 190"
   pack $fen.haut.help -anchor ne -side right

   pack [frame $fen.bas.valid -relief solid -bd 0] -side left -fill both -expand yes
      pack [frame $fen.bas.valid.m -relief solid -bd 0]
      button $fen.bas.valid.m.annuler -font $astk::ihm(font,labbout) -text [ashare::mess ihm 85] \
         -background $astk::ihm(couleur,annul) \
         -command "annule_mod_print $fen"
      button $fen.bas.valid.m.ok -font $astk::ihm(font,labbout) -text "Ok" \
         -background $astk::ihm(couleur,valid) \
         -command "save_print ; destroy $fen ; grab release $fen"
      pack $fen.bas.valid.m.ok $fen.bas.valid.m.annuler -side left -padx 10 -pady 5
   
   pack [frame $fen.bas.del -relief solid -bd 0] -side right
   button $fen.bas.del.bout -font $astk::ihm(font,labbout) -text [ashare::mess ihm 256] \
      -background $astk::ihm(couleur,suppr) \
      -command "del_print $fen"
   pack $fen.bas.del.bout -side left -padx 10 -pady 5
}

#################################################################
proc print_conf_para {fen impr} {
   global last_impr_sel
   set nimpr -1
   for {set i 0} {$i < $astk::print(nb)} {incr i} {
      if { $astk::print($i,label) == $impr } {
         set nimpr $i
         break
      }
   }
# si pas de chgt, on sort
   set mod 0
   catch { if { $impr == $last_impr_sel } { set mod 1 } }
   if { $mod } { return }
   set last_impr_sel $impr

   catch {destroy $fen.f}
   pack [frame $fen.f -relief raised -bd 0]

# serv
   pack [frame $fen.f.serv -relief solid -bd 0] -anchor w
   label $fen.f.serv.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 15] -width 25 -anchor w
   #entry $fen.f.serv.path -width 30 -font $astk::ihm(font,val) -textvariable astk::print($nimpr,serv)
   set m2 [tk_optionMenu $fen.f.serv.path astk::print($nimpr,serv) $astk::config(-1,nom)]
   $m2 configure \
        -foreground $astk::ihm(couleur,menu_foreground) \
        -background $astk::ihm(couleur,menu_background)
   $m2 entryconfigure 0 -font $astk::ihm(font,lablst)
   for {set j 0} {$j < $astk::config(nb_serv)} {incr j} {
      set j1 [expr $j + 1]
      $m2 add radiobutton
      $m2 entryconfigure $j1 -label $astk::config($j,nom) -font $astk::ihm(font,lablst) -variable astk::print($nimpr,serv)
   }
   pack $fen.f.serv.lbl $fen.f.serv.path -pady 3 -side left

# file
   pack [frame $fen.f.file -relief solid -bd 0] -anchor w
   label $fen.f.file.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 257] -width 25 -anchor w
   entry $fen.f.file.path -width 30 -font $astk::ihm(font,val) -textvariable astk::print($nimpr,file)
   pack $fen.f.file.lbl $fen.f.file.path -pady 3 -side left

# cmde
   pack [frame $fen.f.dist -relief solid -bd 0] -anchor w
   label $fen.f.dist.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 156] -width 25 -anchor w
    entry $fen.f.dist.cmde -width 80 -font $astk::ihm(font,val) -textvariable astk::print($nimpr,cmde)
   pack $fen.f.dist.lbl $fen.f.dist.cmde -pady 3 -side left
}

# annule les modifs des imprimantes
#################################################################
proc annule_mod_print { fen } {
   global old_impr
   set mod 0
   # vérifie que l'on n'a pas ajouté d'imprimante
   if { $old_impr(nb) != $astk::print(nb) } {
      set mod 1
   } else {
      set lmv [array get old_impr]
      set nbl [expr [llength $lmv] / 2]
      for {set i 0} {$i < $nbl} {incr i} {
         set k  [expr $i * 2]
         set k1 [expr $k + 1]
         if { $astk::print([lindex $lmv $k]) != [lindex $lmv $k1] } {
            set mod 1
            if { $ashare::dbg >= 5 } {
               ashare::log "<DEBUG> (annule_mod_print) [lindex $lmv $k] old =[lindex $lmv $k1] ; new=$astk::print([lindex $lmv $k])"
            } else {
               break
            }
         }
      }
   }
   # est-ce qu'il y a eu des modifs
   if { $mod } {
   # demande confirmation
      set iret [ tk_messageBox -message [ashare::mess ihm 88] \
         -title [ashare::mess ihm 143] -type yesno -icon question ]
      if { $ashare::dbg >= 4 } {
         ashare::log "<DEBUG> (annule_mod_print) choix : $iret"
      }
      if { $iret == "yes" } {
         set mod 0
      }
   }
   # on sort
   if { $mod == 0 } {
      copie_tabl old_impr astk::print
      destroy $fen
      grab release $fen
   } else {
      raise $fen
   }
}

# ajoute une imprimante
# fen : fenetre parent
#################################################################
proc add_print { fen men } {
   global impr_sel last_impr_sel
   global getValue_val
   # retire le focus au parent
   grab release $fen

   set new [expr $astk::print(nb)]
   set valint [list]
   for {set i 0} {$i<$new} {incr i} {
      lappend valint $astk::print($i,label)
   }
   getValue_fen $fen 255 258 $valint "" non_vide
   tkwait window .fen_getv
   grab set $fen
# valide le nom de l'imprimante
   set valid 1
   if { $getValue_val == "_VIDE" } {
      set valid 0
   }
   if { $valid } {
      set astk::print($new,label) $getValue_val
      incr astk::print(nb)
      # initialisation
      # valeurs obligatoires
      set nbm [llength $ashare::mots(SSF_pr)]
      for {set i 0} {$i<$nbm} {incr i} {
         set mcle [lindex $ashare::mots(SSF_pr) $i]
         set val ""
         # quelques valeurs particulières
         if { $mcle == "serv" } {
            set val $astk::local_server
         }
         set astk::print($new,$mcle) $val
      }
      # nom dans le menu
      set impr_sel $astk::print($new,label)
      print_conf_list $fen
      raise $fen
   } else {
      set impr_sel $last_impr_sel
      print_conf_para $fen "$impr_sel"
      raise $fen
   }
}

# supprime une imprimante
#################################################################
proc del_print { fen } {
   global impr_sel
   set nimpr -1
   for {set i 0} {$i < $astk::print(nb)} {incr i} {
      if { $astk::print($i,label) == $impr_sel } {
         set nimpr $i
         break
      }
   }
# demande confirmation
    set iret [ tk_messageBox -message [ashare::mess ihm 259] \
       -title [ashare::mess ihm 260] -type yesno -icon question ]
    if { $ashare::dbg >= 4 } {
        ashare::log "<DEBUG> (del_print) retour : $iret"
   }
    if { $iret != "yes" } {
      raise $fen
        return 1
   }
# liste des mots-clés
   set mots_cles $ashare::mots(MCF_pr)
   append mots_cles $ashare::mots(SSF_pr)
   set nbm [llength $mots_cles]
# suppression
   if { $ashare::dbg >= 5 } {
      ashare::log "<DEBUG> (del_print) Suppr $astk::print($nimpr,label) (numero $nimpr)" }
# décalage
   incr astk::print(nb) -1
   for { set j $nimpr } { $j < $astk::print(nb) } {incr j} {
      set j1 [expr $j + 1]
      if { $ashare::dbg >= 5 } {
         ashare::log "<DEBUG> (del_print) Copie $astk::print($j1,label) de $j1 en $j"
      }
      for { set k 0 } { $k < $nbm } { incr k } {
         set mcs [lindex $mots_cles $k]
         set astk::print($j,$mcs) $astk::print($j1,$mcs)
      }
   }
   # suppression du dernier outil
   if { $ashare::dbg >= 5 } {
      ashare::log "<DEBUG> (del_print) Suppr outil $j"
   }
   for { set k 0 } { $k < $nbm } { incr k } {
      set mcs [lindex $mots_cles $k]
      unset astk::print($j,$mcs)
   }
   set impr_sel $astk::print(0,label)
   print_conf_list $fen
   raise $fen
   return 0
}