This file is indexed.

/usr/share/tkgate-1.8.7/scripts/print.tcl is in tkgate-data 1.8.7-4.

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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
#   Copyright (C) 1987-2007 by Jeffery P. Hansen
#
#   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 the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Last edit by hansen on Tue May 25 09:10:18 2004
#

#Some common paper sizes (in mm):
#Chu ban			220 x 288
#Ko bosho	    		330 x 470
#Mino, Hosokawa, Hodomura	330 x 850
#Mino ban, Hodomura ban 	610 x 860
#Naka bosho 			364 x 500
#O bosho 			394 x 530
#O biro bosho 			440 x 576
#Takenaga bosho 		515 x 757
#Fotopapier
#Mutsugiri 			203 x 254
#Yatsugiri (hele plaat) 	165 x 216
#Yotsugiri 			254 x 305
#Diversen
#Briefkaart (officieel) 	100 x 148
#Kiku 4 (boeken) 		227 x 306
#Kiku 5 (boeken) 		151 x 227
#Meishi (visitekaartje) 	55 x 91


set pd_isfile 1
set pd_file ""
set pd_select all
set pd_oldSelect all
set pd_ok 0
set pd_selectList {}
set pd_mergeSmall 1
set pd_epsf 0
set pd_title ""
set pd_print $tkg_printCommand
if { $lang == "en" }  {
  set pd_paper $tkg_printPgSize
} else {
  set pd_paper $tkg_printPgSizeA4
}
set pd_orient $tkg_printPgOrient
set pd_style $tkg_printStyle
set pd_index $tkg_printIndex
set pd_graph $tkg_printGraph
set pd_duplexMode $tkg_printDuplex
set pd_inclib 0
set pd_encoding Latin1

set prs_start 0
set prs_end 0
set prs_isFull 0
set prs_range {0 0 0}
set prs_scale 1

set pd_filter ".ps"
set pd_filetypes {
    {{PostScript}	{.ps}}
    {{All Files}	*}
}

array set pd_paperSizes {
    0 "Letter (8 1/2 x 11 in.)"
    1 "Legal (8 1/2 x 14 in.)"
    2 "Tabloid (11 x 17 in.)"
    3 "Executive (7 1/2 x 10 in.)"
    4 "A4 (210 x 297 mm)"
    5 "A3 (297 x 420 mm)"
    6 "A2 (420 x 594 mm)"
    7 "A1 (594 x 841 mm)"
    8 "B5 (176 x 250 mm)"
    9 "B4 (250 x 353 mm)"
    10 "B3 (353 x 500 mm)"
    11 "B2 (500 x 707 mm)"
    12 "SRA2 (450 x 640 mm)"
    13 "RA2 (430 x 610 mm)"
    14 "yatsugiri (6.5 x 8.5 in)"
    15 "mutsugiri (8 x 10 in)"
    16 "yotsugiri (10 x 12 in)"
}

proc tkg_retrSelMods {w} {
  global pd_select pd_selectList

  set pd_selectList {}
  if { $pd_select == "sel" } {
    foreach m [$w.mods.lb curselection] {
      lappend pd_selectList [$w.mods.lb get $m]
    }
  }
}

proc tkg_outSelect {lpr file} {
  global pd_isfile
  if { $pd_isfile } {
    $lpr.l configure -foreground dimgray
    $lpr.e configure -foreground dimgray -state disabled
    $file.l configure -foreground black
    $file.e configure -foreground black -state normal
    $file.b configure -foreground black -state normal
    $file.epsf configure -foreground black -state normal
    focus $file.e
  } else {
    $lpr.l configure -foreground black
    $lpr.e configure -foreground black -state normal
    $file.l configure -foreground dimgray
    $file.e configure -foreground dimgray -state disabled
    $file.b configure -foreground dimgray -state disabled
    $file.epsf configure -foreground dimgray -state disabled
    focus $lpr.e
  }
  tkg_prntEPSF
}

proc tkg_prntEPSF {} {
  global pd_epsf pd_isfile pd_select pd_oldSelect


  catch {
    set w1 .prntdlg.right.mod
    set w2 .prntdlg.right.style

    if { $pd_epsf && $pd_isfile } {
	$w1.sel.all configure -foreground dimgray -state disabled
	$w1.sel.cur configure -foreground dimgray -state disabled
	$w1.sel.use configure -foreground dimgray -state disabled
	$w1.sel.sel configure -foreground dimgray -state disabled
	$w1.mods.lb configure -foreground dimgray -selectforeground dimgray
	$w1.lib     configure -foreground dimgray -state disabled
	$w2.idx     configure -foreground dimgray -state disabled
	$w2.graph   configure -foreground dimgray -state disabled
	$w2.mrgsml  configure -foreground dimgray -state disabled
	$w2.part.scale   configure -foreground dimgray -state disabled
	$w2.part.multi   configure -foreground dimgray -state disabled
	$w2.l   configure -foreground dimgray
#	$w1.l   configure -foreground dimgray

	set pd_oldSelect $pd_select
	set pd_select cur
    } {
	$w1.sel.all configure -foreground black -state normal
	$w1.sel.cur configure -foreground black -state normal
	$w1.sel.use configure -foreground black -state normal
	$w1.sel.sel configure -foreground black -state normal
	$w1.mods.lb configure -foreground black -selectforeground black
	$w1.lib     configure -foreground black -state normal
	$w2.idx     configure -foreground black -state normal
	$w2.graph   configure -foreground black -state normal
	$w2.mrgsml  configure -foreground black -state normal
	$w2.part.scale   configure -foreground black -state normal
	$w2.part.multi   configure -foreground black -state normal
	$w2.l   configure -foreground black
#	$w1.l   configure -foreground black

	set pd_select $pd_oldSelect
    }
  }
}

#
# Called when the module select mode is pressed
#
proc tkg_prntModuleMode {w} {
  global pd_select
   
  if { $pd_select == "sel" } {
    $w.mods.lb configure -foreground black -selectforeground black
  } else {
    $w.mods.lb configure -foreground dimgray -selectforeground dimgray
  }
}

proc tkg_paperSelLabel {w n} {
  global pd_paper
  set pd_paper $n
#  set label [$w.size.mb.menu entrycget $n -label]
#  $w.size.mb configure -text $label

  tkg_prntConfigPC
}

proc tkg_setPaperSize {w psize} {
  global pd_paperSizes

  set n 0
  for {set id [array startsearch pd_paperSizes]} {[array anymore pd_paperSizes $id]} {} {
    set k [array nextelement pd_paperSizes $id]
    set v $pd_paperSizes($k)
    if { $v == $psize } {
      set n $k
      break
    }
  }
  array donesearch pd_paperSizes $id

  tkg_paperSelLabel $w $n
}

proc tkg_prntOutSel {w lpr file} {
  frame $w -relief groove -bd 2
  frame $w.pad
  pack $w.pad -pady 3
#  label $w.label  -text "[m print.outto]:"
  radiobutton $w.print -text [m print.printer] -value 0 -variable pd_isfile -command "tkg_outSelect $lpr $file"
  radiobutton $w.file -text [m print.file] -value 1 -variable pd_isfile -command "tkg_outSelect $lpr $file"
#  pack $w.label 
  pack $w.print $w.file -side left -padx 5 -pady 5
}

proc tkg_prntLprSel {w r} {
  frame $w -relief groove -bd 2
  label $w.l  -text "[m print.prcmd]:"
  entry $w.e -textvariable pd_print
  pack $w.l $w.e -side left -padx 5 -pady 5
}

proc tkg_prntFileSel {w} {

  frame $w -relief groove -bd 2
  frame $w.pad
  pack $w.pad -pady 5

  label $w.l -text "[m print.filename]:"
  entry $w.e -textvariable pd_file -width 30
  button $w.b -text [m b.browse] -command {
    global pd_filter pd_filetypes pd_file
    set file [tk_getSaveFile -defaultextension $pd_filter -filetypes $pd_filetypes -parent .prntdlg]
    if { $file != "" } { 
      set pd_file $file
      .prntdlg.left.file.e icursor end
      .prntdlg.left.file.e xview end
    }
  }

  checkbutton $w.epsf -text [m print.epssave] -variable pd_epsf -command tkg_prntEPSF

  pack $w.epsf -side bottom -pady 5 -padx 5 -anchor w
  pack $w.l -pady 3 -padx 5 -anchor w
  pack $w.e -side left -padx 5 -fill x
  pack $w.b -side left -padx 5
}

proc tkg_prntTitleSel {w} {
  frame $w -relief groove -bd 2
  label $w.l  -text "[m print.doctit]:"
  entry $w.e -textvariable pd_title -width 44
  pack $w.l $w.e -anchor w -padx 5 -pady 5
}

proc tkg_prntModSel {w} {
  frame $w -relief groove -bd 2
  frame $w.pad
  pack $w.pad -pady 3

#  label $w.l  -text "[m print.prmod]:"

  frame $w.sel

  radiobutton $w.sel.all -text [m print.all] -value all -variable pd_select -command "tkg_prntModuleMode $w"
  radiobutton $w.sel.cur -text [m print.cur] -value cur -variable pd_select -command  "tkg_prntModuleMode $w"
  radiobutton $w.sel.use -text [m print.use] -value use -variable pd_select -command  "tkg_prntModuleMode $w"
  radiobutton $w.sel.sel -text [m print.sel] -value sel -variable pd_select -command "tkg_prntModuleMode $w"
  pack $w.sel.all  $w.sel.cur  $w.sel.use  $w.sel.sel -side left

  checkbutton $w.lib -text [m print.inclib] -variable pd_inclib

  frame $w.mods
  listbox $w.mods.lb -height 5 -yscrollcommand "$w.mods.vb set" -selectmode extended
  scrollbar $w.mods.vb -command "$w.mods.lb yview"
  pack $w.mods.lb $w.mods.vb -side left -fill y

  set n [.sbar.blklst.f.list size]
  for {set i 0} {$i < $n} {incr i} {
    set e [.sbar.blklst.f.list get $i]
    $w.mods.lb insert $i $e
  }

#  pack $w.l -padx 5 -pady 5 -anchor w
  pack $w.sel  -padx 5 -pady 5 -anchor w
  pack $w.mods -padx 5 -pady 5
  pack $w.lib  -padx 5 -pady 5 -anchor w

  tkg_prntModuleMode $w

  helpon $w.sel.all [m ho.print.selall]
  helpon $w.sel.cur [m ho.print.selcur]
  helpon $w.sel.use [m ho.print.seluse]
  helpon $w.sel.sel [m ho.print.selsel]
#  helpon $w.l [m ho.print.modlist]
}

#
# Dialog element for selecting page size.
#
proc tkg_prntPaperSel {w r} {
  global pd_paper pd_paperSizes

  frame $w -relief $r -bd 2
  frame $w.pad
  pack $w.pad -pady 3

  frame $w.size

  label $w.size.l -text "[m print.papsz]:"

  set curSize $pd_paperSizes($pd_paper)
  set N [array size pd_paperSizes]

#  menubutton $w.size.mb -menu $w.size.mb.menu -text $curSize -indicatoron 1 -relief raised -bd 2
#  menu $w.size.mb.menu -tearoff 0

#  for {set i 0} {$i < $N} {incr i} {
#    $w.size.mb.menu add command -label $pd_paperSizes($i) -command "tkg_paperSelLabel $w $i"
#  }
  Dropbox::new $w.size.mb -value $curSize -command tkg_setPaperSize -width 25
  for {set i 0} {$i < $N} {incr i} {
    Dropbox::itemadd $w.size.mb [list "$pd_paperSizes($i)"]
  }



  pack $w.size.l $w.size.mb -side left -padx 5 -pady 5 -anchor w

  frame $w.o
  label $w.o.l -text "[m print.orient]: "
  radiobutton $w.o.p -text [m print.portrait] -variable pd_orient -value portrait -command tkg_prntConfigPC
  radiobutton $w.o.ls -text [m print.landscape] -variable pd_orient -value landscape -command tkg_prntConfigPC
  pack $w.o.l $w.o.p $w.o.ls  -side left -padx 5 -pady 5 -anchor w

  frame $w.dup
  checkbutton $w.dup.b -text [m print.2side] -variable pd_duplexMode
  pack  $w.dup.b -padx 5 -pady 5

  pack $w.size -anchor w -ipady 10
  pack $w.o -anchor w
  pack $w.dup -anchor w

  tkg_paperSelLabel $w $pd_paper
}

proc tkg_prntStyleSel {w r} {
  frame $w -relief $r -bd 2

#  label $w.l -text 

  frame $w.part
  radiobutton $w.part.scale -text [m print.scale] -variable pd_style -value fit
  radiobutton $w.part.multi -text [m print.partition] -variable pd_style -value part
  pack $w.part.scale $w.part.multi -anchor w

  checkbutton $w.idx -text [m print.incidx] -variable pd_index
  checkbutton $w.graph -text [m print.incgraph] -variable pd_graph
  checkbutton $w.mrgsml -text [m print.4up] -variable pd_mergeSmall

  frame $w.sp1
  frame $w.sp2

#  pack $w.l -anchor w -padx 5 
  pack $w.sp1 -anchor w -padx 5 -pady 5
  pack $w.part -anchor w -padx 5 
  pack $w.sp2 -anchor w -padx 5  -pady 10
  pack $w.idx -anchor w -padx 5 
  pack $w.graph -anchor w -padx 5 
  pack $w.mrgsml -anchor w -padx 5 
}

#
# Print a file from the command line.
#
proc tkg_commandLinePrint {isFile name opts} {
  global pd_isfile pd_print pd_file pd_title pd_ok
  global tkg_currentFile tkg_displayFile
  global pd_file pd_paper pd_paperSizes pd_orient pd_style pd_select pd_selectList
  global pd_epsf pd_index pd_title pd_mergeSmall pd_duplexMode pd_inclib pd_graph pd_encoding

  set pd_title $tkg_displayFile
  set p [string last "/" $pd_file]
  if { $p >= 0 } { set pd_file [string range $pd_file [expr $p + 1] end]}

  scan $pd_paperSizes($pd_paper) "%s" curSize

  foreach o $opts {
    puts OPT=$o
  }

  if {$isFile} {
    gat_print -file $name -paper $curSize -orient $pd_orient -style $pd_style -select $pd_select -modlist $pd_selectList -epsf $pd_epsf -index $pd_index -title $pd_title -merge $pd_mergeSmall -duplex $pd_duplexMode -graph $pd_graph -inclib $pd_inclib -encoding $pd_encoding
  } { 
    gat_print -printer $name -paper $curSize -orient $pd_orient -style $pd_style -select $pd_select -modlist $pd_selectList -epsf $pd_epsf -index $pd_index -title $pd_title -merge $pd_mergeSmall -duplex $pd_duplexMode -graph $pd_graph -inclib $pd_inclib -encoding $pd_encoding
  }
}

#
# Dialog box for printing circuits

proc tkg_printDlg {} {
  global pd_isfile pd_print pd_file pd_title pd_ok
  global tkg_currentFile tkg_displayFile

  set w .prntdlg

  if { [catch {toplevel $w}] } {
    return
  }

  wm transient $w .

  set pd_title $tkg_displayFile
  set pd_file  [replaceExtension $tkg_currentFile ".ps"]
  set p [string last "/" $pd_file]
  if { $p >= 0 } { set pd_file [string range $pd_file [expr $p + 1] end]}

  set pd_ok 0

  wm resizable $w 0 0
  wm title $w "TKGate: Print"
  wm geometry $w [offsetgeometry . 50 50 ]

  frame $w.left
  frame $w.right

  tkg_prntOutSel $w.left.out $w.left.lpr $w.left.file
  tkg_prntLprSel $w.left.lpr groove
  tkg_prntFileSel $w.left.file
  tkg_prntPaperSel $w.left.paper groove
  tkg_prntTitleSel $w.left.title
  tkg_prntStyleSel $w.right.style groove
  tkg_prntModSel $w.right.mod
  okcancel $w.okc "global pd_ok; set pd_ok 1; tkg_retrSelMods $w.right.mod; destroy .prntdlg" { destroy .prntdlg }

  bind $w <Return> "global pd_ok; set pd_ok 1; tkg_retrSelMods $w.right.mod; destroy .prntdlg"

  pack $w.okc -fill both -side bottom
  pack $w.left $w.right -side left -fill both -padx 3 -pady 5

  pack $w.left.out -padx 5 -pady 5 -fill both
  pack $w.left.lpr -padx 5 -pady 5 -fill both
  pack $w.left.file -padx 5 -pady 5 -fill both
  pack $w.left.paper -padx 5 -pady 5 -fill both -expand 1
  pack $w.left.title -padx 5 -pady 5 -fill both
  pack $w.right.style -padx 5 -pady 5 -fill both
  pack $w.right.mod -padx 5 -pady 5 -fill both -expand 1

  tkg_outSelect $w.left.lpr $w.left.file

  grab set $w
  tkwait window $w
  grab release $w

  if {$pd_ok} {
    global pd_file pd_paper pd_paperSizes pd_orient pd_style pd_select pd_selectList
    global pd_epsf pd_index pd_title pd_mergeSmall pd_duplexMode pd_inclib pd_graph pd_encoding

    scan $pd_paperSizes($pd_paper) "%s" curSize

    if {$pd_isfile} {
      gat_print -file $pd_file -paper $curSize -orient $pd_orient -style $pd_style -select $pd_select -modlist $pd_selectList -epsf $pd_epsf -index $pd_index -title $pd_title -merge $pd_mergeSmall -duplex $pd_duplexMode -graph $pd_graph -inclib $pd_inclib -encoding $pd_encoding
    } { 
      gat_print -printer $pd_print -paper $curSize -orient $pd_orient -style $pd_style -select $pd_select -modlist $pd_selectList -epsf $pd_epsf -index $pd_index -title $pd_title -merge $pd_mergeSmall -duplex $pd_duplexMode -graph $pd_graph -inclib $pd_inclib -encoding $pd_encoding
    }
  }
}

#############################################################################

proc tkg_prntRangeSelSetState {w} {
  global prs_isFull

  if { $prs_isFull } {
    $w.g.sl configure -foreground dimgray
    $w.g.el configure -foreground dimgray
    $w.g.se configure -foreground dimgray -state disabled
    $w.g.ee configure -foreground dimgray -state disabled
  } {
    $w.g.sl configure -foreground black
    $w.g.el configure -foreground black
    $w.g.se configure -foreground black -state normal
    $w.g.ee configure -foreground black -state normal
  }

  tkg_prntConfigPC
}

proc tkg_prntRangeSel {w} {
  global prs_start prs_end prs_range prs_isFull

  frame $w -relief raised -bd 2
  label $w.l  -text [m print.range]

  set prs_range [gat_getTraceData]

  set prs_start [lindex $prs_range 0]
  set prs_end [lindex $prs_range 1]
  set prs_traceEnd [lindex $prs_range 2]

  if { $prs_start == 0 && $prs_end == $prs_traceEnd} {
    set prs_isFull 1
  } else {
    set prs_isFull 0
  }

  radiobutton $w.full -text [m print.fulltr] -variable prs_isFull -value 1 -command "tkg_prntRangeSelSetState $w"
  radiobutton $w.part -text [m print.parttr] -variable prs_isFull -value 0 -command "tkg_prntRangeSelSetState $w"

  frame $w.g
  label $w.g.sl -text [m print.start]
  label $w.g.el -text [m print.end]
  entry $w.g.se -textvariable prs_start
  entry $w.g.ee -textvariable prs_end
  grid $w.g.sl -row 0 -column 0 -sticky e -padx 5 -pady 5
  grid $w.g.se -row 0 -column 1 -padx 5 -pady 5
  grid $w.g.el -row 1 -column 0 -sticky e -padx 5 -pady 5
  grid $w.g.ee -row 1 -column 1 -padx 5 -pady 5

  pack $w.l -padx 5 -pady 5 -anchor w
  pack $w.full -padx 5 -pady 2 -anchor w
  pack $w.part -padx 5 -pady 2 -anchor w
  pack $w.g -padx 5 -pady 5

  tkg_prntRangeSelSetState $w

  helpon $w.full [m ho.print.fulltrace]
  helpon $w.part [m ho.print.parttrace]
  helpon $w.g.sl [m ho.print.parttracestart]
  helpon $w.g.el [m ho.print.parttraceend]

  pack $w -fill x
}

proc tkg_prntConfigPC args {
  global prs_start prs_end prs_range prs_isFull prs_numepochs prs_scale pd_paper
  global page_estimate pd_orient

  if { $prs_isFull } {
    set start 0
    set end [lindex $prs_range 2]
  } {
    set start $prs_start
    set end $prs_end
  }

  set page_estimate [gat_tracePageEst -orient $pd_orient -start $start -end $end -scale $prs_scale -paper $pd_paper]
}

proc tkg_prntRangeScale {w} {
  global page_estimate

  set sc_max 1000
  set sc_min 10
  set sc_default 70

  frame $w -relief raised -bd 2

  scale $w.s -label [m print.epcm] -from $sc_max -to $sc_min -length 200 -orient horizontal -variable prs_scale -command tkg_prntConfigPC
  $w.s set $sc_default

  label $w.l -text "[m print.estpg]: "

  set page_estimate 0
  label $w.pc -textvariable page_estimate

  pack $w.s -padx 5 -pady 5
  pack $w.l $w.pc -side left -padx 5 -pady 5

  pack $w -fill x
}


#
# Dialog box for scope traces
#
proc tkg_scopePrintDlg {} {
  global pd_isfile pd_print pd_file pd_title pd_ok
  global tkg_currentFile tkg_displayFile
  global prs_start prs_end prs_scale

  if { ![tkg_simCheck] } return

  set w .prntdlg

  if { [catch {toplevel $w}] } {
    return
  }

  wm transient $w .scope

  set pd_title $tkg_displayFile
  set pd_file  [replaceExtension $tkg_currentFile "_trace.ps"]
  set p [string last "/" $pd_file]
  if { $p >= 0 } { set pd_file [string range $pd_file [expr $p + 1] end]}

  set pd_ok 0

  wm resizable $w 0 0
  wm title $w "TKGate: Scope Print"
  wm geometry $w [offsetgeometry . 50 50 ]

  frame $w.left
  frame $w.right

  tkg_prntOutSel $w.left.out $w.left.lpr $w.left.file
  tkg_prntLprSel $w.left.lpr raised
  tkg_prntFileSel $w.left.file
  tkg_prntPaperSel $w.left.paper raised
  tkg_prntTitleSel $w.left.title
  tkg_prntRangeSel $w.right.range
  tkg_prntRangeScale $w.right.scale
  okcancel $w.okc "global pd_ok; set pd_ok 1; destroy .prntdlg" { destroy .prntdlg }

  bind $w <Return> "global pd_ok; set pd_ok 1; destroy .prntdlg"

  pack $w.okc -fill both -side bottom
  pack $w.left $w.right -side left -fill both

  pack $w.left.out -ipadx 5 -ipady 5 -fill both
  pack $w.left.lpr -ipadx 5 -ipady 5 -fill both
  pack $w.left.file -ipadx 5 -ipady 5 -fill both
  pack $w.left.paper -ipadx 5 -ipady 5 -fill both -expand 1
  pack $w.left.title -ipadx 5 -ipady 5 -fill both

  tkg_outSelect $w.left.lpr $w.left.file

  grab set $w
  tkwait window $w
  grab release $w

  if {$pd_ok} {
    global pd_file pd_paper pd_paperSizes pd_orient pd_epsf pd_title pd_duplexMode page_estimate

    if { $page_estimate > 40 } {
      if {[tk_messageBox -type yesno -default no -message [m err.manypages]] != "yes"} {
	return
      }
    }

    scan $pd_paperSizes($pd_paper) "%s" curSize

    if {$pd_isfile} {
      gat_tracePrint -file $pd_file -paper $curSize -orient $pd_orient -epsf $pd_epsf -title $pd_title -duplex $pd_duplexMode -scale $prs_scale -start $prs_start -end $prs_end
    } { 
      gat_tracePrint -printer $pd_print -paper $curSize -orient $pd_orient -epsf $pd_epsf -title $pd_title -duplex $pd_duplexMode -scale $prs_scale -start $prs_start -end $prs_end
    }
  }
}