#!/bin/sh
#next line restarts script using wish: \
exec wish "$0" "$@"
#############################################################################
# Visual Tcl v1.10 Project
#
#############################################################################
# Author: Mirko Vukusic
# email : mirko@efst.hr
# Split, Croatia
   
#################################
# GLOBAL VARIABLES
#
set tk_strictMotif 1
global FILE; 
global INSTALL_DIR; 
global g; 
global g1; 
global g2; 
global g3; 
global g4; 
global g5; 
global g6; 
global g7; 
global gg1; 
global gg2; 
global gs; 
global gs1; 
global gs2; 
global gs3; 
global gs4; 
global gs5; 
global h1; 
global h11; 
global h2; 
global h22; 
global h3; 
global h4; 
global h5; 
global h6; 
global h7; 
global h8; 
global hh1; 
global hh2; 
global p1; 
global p2; 
global p3; 
global p4; 
global p5; 
global p6; 
global p7; 
global s; 
global s1; 
global s10; 
global s11; 
global s12; 
global s2; 
global s3; 
global s4; 
global s5; 
global s6; 
global s8; 
global s9; 
global widget; 
    set widget(general) {.top17.fra33}
    set widget(ghost) {.top17.fra30}
    set widget(page) {.top17.fra24}
    set widget(rev,.top17.fra24) {page}
    set widget(rev,.top17.fra27) {style}
    set widget(rev,.top17.fra29) {titles}
    set widget(rev,.top17.fra30) {ghost}
    set widget(rev,.top17.fra33) {general}
    set widget(style) {.top17.fra27}
    set widget(titles) {.top17.fra29}

#################################
# USER DEFINED PROCEDURES
#
proc init {argc argv} {
global FILE INSTALL_DIR
if {[file readable ~/.a2print/a2printrc]==0} then {
    file mkdir ~/.a2print
        if {[file readable /usr/local/lib/a2print/a2printrc]} then {
            file copy /usr/local/lib/a2print/a2printrc ~/.a2print
            } else {
                puts "Cannot find configuration file a2printrc in ~/.a2print directory"
                puts "Cannot find default configuration file a2printrc in /usr/local/a2print directory"
                puts "If you didn't install a2print in /usr/local/lib/a2print directory please copy a2printrc from your installation directory to ~/.a2print directory"
                exit
        }
}
foreach FILE $argv {}
set OPTFILE [open ~/.a2print/a2printrc]
gets $OPTFILE INSTALL_DIR
close $OPTFILE
image create photo a2icon -file $INSTALL_DIR/a2print-icon.gif
}

init $argc $argv


proc a2psinit {} {
global g7
if {$g7=="1"} then {
    .top17.fra33.but28 configure -text "a2ps ENABLED" -relief raised -background tan
    } else {
        .top17.fra33.but28 configure -text "a2ps DISABLED" -relief sunken -background Red
        }
}

proc column0 {} {
.top17.fra27.lab20 configure -background tan
.top17.fra27.sca20 configure -trough tan
.top17.fra27.lab17 configure -foreground #939393
}

proc column1 {n} {
.top17.fra27.lab20 configure -background White
.top17.fra27.sca20 configure -trough #c3c3c3
.top17.fra27.lab17 configure -foreground Black
font0
lines0
global s
set s "-l$n"
}

proc font0 {} {
.top17.fra27.lab18 configure -background tan
.top17.fra27.sca47 configure -trough tan
.top17.fra27.lab44 configure -foreground #939393
}

proc font1 {n} {
.top17.fra27.lab18 configure -background White
.top17.fra27.sca47 configure -trough #c3c3c3
.top17.fra27.lab44 configure -foreground Black
lines0
column0
global s
set s "-f$n"
}

proc gsinit {} {
global gs
if {$gs=="1"} then {
    .top17.fra30.but20 configure -text "Disable Ghostscript printing"
    place .top17.fra30.fra24 -x 0 -y 0 -width 0 -height 0 -in .top17.fra30
    } else {
        .top17.fra30.but20 configure -text "Enable Ghostscript printing"
    place .top17.fra30.fra24 -x 5 -y 35 -width 380 -height 160 -in .top17.fra30
        }
}

proc header {state} {
global hh1
if {$state==1} then {
    .top17.fra29.but19 configure -relief sunken
    .top17.fra29.ent63 configure -state normal -background White
    set hh1 "Header ON"
    .top17.fra29.ent24 configure -state normal -background White
    .top17.fra29.ent65 configure -state normal -background White
    .top17.fra29.ent66 configure -state normal -background White

    } else {
    .top17.fra29.but19 configure -relief raised
    .top17.fra29.ent63 configure -state disabled -background tan
    set hh1 "Header OFF"
    .top17.fra29.ent24 configure -state disabled -background tan
    .top17.fra29.ent65 configure -state disabled -background tan
    .top17.fra29.ent66 configure -state disabled -background tan
}
}

proc lines0 {} {
.top17.fra27.lab19 configure -background tan
.top17.fra27.sca51 configure -trough tan
.top17.fra27.lab45 configure -foreground #939393
}

proc lines1 {n} {
.top17.fra27.lab19 configure -background White
.top17.fra27.sca51 configure -trough #c3c3c3
.top17.fra27.lab45 configure -foreground Black
column0
font0
global s
set s "-L$n"
}

proc plugcheck {} {
set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
set ret [file readable ~/.a2print/$gs3.printerc]
return $ret
}

proc pluginit {} {
global gs3 INSTALL_DIR
.top17.fra30.lis23 delete 0 end
.top17.fra30.lis23 insert end OTHER
foreach plugs [lsort [glob -nocomplain $INSTALL_DIR/*.printer]] {eval .top17.fra30.lis23 insert end [file rootname [file tail $plugs]]}
set size [.top17.fra30.lis23 size]
set i 0
while {[expr $i<$size] & [.top17.fra30.lis23 get $i] != $gs3} {incr i}
if {$i==$size} then {
    tk_messageBox -default ok -icon error -message "I didn't find the plugin from your configuration file. Switching back to \"OTHER\" option!" -title "Plugin ERROR" -type ok
    set i 0
}
.top17.fra30.lis23 selection clear 0 end
.top17.fra30.lis23 selection set $i
}

proc print {} {
global p1 p2 p3 p4 p5 p6 p7 g g1 g2 g3 g4 g5 g6 g7 gg1 gg2 h1 h1 h11 h2 h22 h3 h4 h5 h6 h7 h8 hh1 hh2 s s1 s2 s3 s4 s5 s6 s8 s9 s10 s11 s12 gs gs1 gs2 gs3 gs4 gs5 FILE

if {$g==2 & $gg2==""} then {tk_messageBox -default ok -icon error -message "You selected \"Output to file\" and didn't select a file!\nSelect a file first!" -title "ERROR" -type ok;return}
if {$g==1 & $gg1==""} then {tk_messageBox -default ok -icon error -message "You selected \"Output to printer\" and didn't select a printer!\nSelect a printer first!" -title "ERROR" -type ok;return}

if $g7 then {
    if {$s8==0} then {set h "--strip-level=4 "} else {set h "--strip-level=$s8 "}
    if {$s10==1} then {set h "$h--line-numbers=$s11 "} else {set h "$h--line-numbers=0 "}
    switch -glob $s12 {
    AUTO {set h "$h--automatic-style=yes "}
    DISABLE {set h "$h--automatic-style=no "}
    * {set h "$h--pretty-print=$s12 "}
    }
    set SPACE " "
    if {$hh2=="Underlay ON"} then {set h22 $h2} else {set h22 " "}
    if {$hh1=="Header ON"} then {
    set OPTS [concat -q {--header=$h1} {--underlay=$h22} {--left-title=$h3$SPACE} {--right-title=$SPACE$h4} {--footer=$h5} {--left-footer=$h6} {--right-footer=$h7} {--center-title=$h8$SPACE} -M$p1 $p2 --columns=$p3 --rows=$p4 --borders $p5 --margin=$p6 --major=$p7 $s -T$s3 --truncate-lines $s4 --encoding=$s5 --strip-level=$s8 --prologue=$s9 -n$g2 $g3 --graphic-symbols=$g4 --non-printable-format=$g5 $g6 $h $FILE]
    } else {
        set OPTS [concat -q {--underlay=$h22} {--footer=$h5} {--left-footer=$h6} {--right-footer=$h7} -M$p1 $p2 --columns=$p3 --rows=$p4 --borders $p5 --margin=$p6 --major=$p7 $s -T$s3 --truncate-lines $s4 --encoding=$s5 --strip-level=$s8 --prologue=$s9 -n$g2 $g3 --graphic-symbols=$g4 --non-printable-format=$g5 $g6 $h $FILE]
        }
} else {
    if $gs then {
    if  {[plugcheck]==0} then { tk_messageBox -default ok -icon error -message "Your printer is not configured!\n Use \"configure\" button in \"ghostscript\" tab" -title "Error" -type ok; return }
set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
set OPTFILE [open ~/.a2print/$gs3.printerc r]
gets $OPTFILE GSOPTS
close $OPTFILE

    switch $g {
    1 {eval exec gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 \{-sOutputFile=\|lpr -P$gg1\} $FILE; exit}
    2 {tk_messageBox -default ok -icon info -message "Printing to file $gg2 using ghostscript.\n\nThis may take a while, depending on a size of text and printing quality!" -title "Printing via ghostscript..." -type ok
       eval exec gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 -sOutputFile=$gg2 $FILE; exit}
    3 {eval exec gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 -sOutputFile=- $FILE; exit}
    }
    } else {
            switch $g {
        1 {eval exec lpr -P$gg1 $FILE; exit}
        2 {tk_messageBox -default ok -icon info -message "this doesn't make sense!\nYou disabled both ghostscript and a2ps and want to print to file!?\n\n That's the same as copying a file!" -title "Error" -type ok; return }
        3 {exit}
        }
    }
}

if $gs then {
    if  {[plugcheck]==0} then { tk_messageBox -default ok -icon error -message "Your printer is not configured!\n Use \"configure\" button in \"ghostscript\" tab" -title "Error" -type ok; return }
set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
set OPTFILE [open ~/.a2print/$gs3.printerc r]
gets $OPTFILE GSOPTS
close $OPTFILE

    switch $g {
    1 {eval exec a2ps -o- $OPTS | gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 \{-sOutputFile=\|lpr -P$gg1\} -;exit}
    2 {tk_messageBox -default ok -icon info -message "Printing to file $gg2 using ghostscript.\n\nThis may take a while, depending on a size of text and printing quality!" -title "Printing via ghostscript..." -type ok
        eval exec a2ps -o- $OPTS | gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 -sOutputFile=$gg2 -;exit}
    3 {eval exec a2ps -o- $OPTS | gs -q -dNOPAUSE -dSAFER -dBATCH $gs5 $GSOPTS $gs2 -sPAPERSIZE=$gs1 -sOutputFile=- -;exit}
    }        

} else {
    switch $g {
    1 {set g1 -P$gg1}
    2 {set g1 -o$gg2}
    3 {set g1 -o-}
    }
    eval exec a2ps $g1 $OPTS
    exit
}
}

proc read_options {} {
global p1 p2 p3 p4 p5 p6 p7 g g1 g2 g3 g4 g5 g6 g7 gg1 gg2 h1 h1 h11 h2 h22 h3 h4 h5 h6 h7 h8 hh1 hh2 s s1 s2 s3 s4 s5 s6 s8 s9 s10 s11 s12 gs gs1 gs2 gs3 gs4 gs5 INSTALL_DIR
set OPTFILE [open ~/.a2print/a2printrc r]
gets $OPTFILE INSTALL_DIR
gets $OPTFILE p1
gets $OPTFILE p2
gets $OPTFILE p3
gets $OPTFILE p4
gets $OPTFILE p5
gets $OPTFILE p6
gets $OPTFILE p7
gets $OPTFILE g
gets $OPTFILE g1
gets $OPTFILE g2
gets $OPTFILE g3
gets $OPTFILE g4
gets $OPTFILE g5
gets $OPTFILE g6
gets $OPTFILE g7
gets $OPTFILE gg1
gets $OPTFILE gg2
gets $OPTFILE h1
gets $OPTFILE h11
gets $OPTFILE h2
gets $OPTFILE h22
gets $OPTFILE h3
gets $OPTFILE h4
gets $OPTFILE h5
gets $OPTFILE h6
gets $OPTFILE h7
gets $OPTFILE h8
gets $OPTFILE hh1
gets $OPTFILE hh2
gets $OPTFILE s
gets $OPTFILE s1
gets $OPTFILE s2
gets $OPTFILE s3
gets $OPTFILE s4
gets $OPTFILE s5
gets $OPTFILE s6
gets $OPTFILE s8
gets $OPTFILE s9
gets $OPTFILE s10
gets $OPTFILE s11
gets $OPTFILE s12
gets $OPTFILE gs
gets $OPTFILE gs1
gets $OPTFILE gs2
gets $OPTFILE gs3
gets $OPTFILE gs4
gets $OPTFILE gs5
close $OPTFILE
if {[string match -f* $s]} then {font1 $s1}
if {[string match -L* $s]} then {lines1 $s2}
if {[string match -l* $s]} then {column1 $s6}
if {$hh1=="Header OFF"} then {header 0} else {header 1}
if {$hh2=="Underlay ON"} then {
    .top17.fra29.but20 configure -relief sunken
    .top17.fra29.ent64 configure -state normal -background White
    set h22 $h2} else {
        .top17.fra29.but20 configure -relief raised
        .top17.fra29.ent64 configure -state disabled -background tan
        set hh2 "Underlay OFF"
        set h22 ""
}
pluginit
gsinit
a2psinit
}

proc showpage {ime} {
.top17.but31 configure -relief raised
.top17.but18 configure -relief raised
.top17.but19 configure -relief raised
.top17.but20 configure -relief raised
.top17.but27 configure -relief raised
place .top17.fra29 -x 0 -y 0 -width 0 -height 0 -in .top17
place .top17.fra24 -x 0 -y 0 -width 0 -height 0 -in .top17
place .top17.fra27 -x 0 -y 0 -width 0 -height 0 -in .top17
place .top17.fra33 -x 0 -y 0 -width 0 -height 0 -in .top17
place .top17.fra30 -x 0 -y 0 -width 0 -height 0 -in .top17
place $ime -x 5 -y 35 -width 390 -height 235 -in .top17
}

proc main {argc argv} {
global FILE INSTALL_DIR
read_options
if {"$FILE"==""} then {set FILE [tk_getOpenFile]}
if {"$FILE"==""} then {exit}
bind .top17 <Destroy> { exit }
}

proc Window {args} {
global vTcl
    set cmd [lindex $args 0]
    set name [lindex $args 1]
    set newname [lindex $args 2]
    set rest [lrange $args 3 end]
    if {$name == "" || $cmd == ""} {return}
    if {$newname == ""} {
        set newname $name
    }
    set exists [winfo exists $newname]
    switch $cmd {
        show {
            if {$exists == "1" && $name != "."} {wm deiconify $name; return}
            if {[info procs vTclWindow(pre)$name] != ""} {
                eval "vTclWindow(pre)$name $newname $rest"
            }
            if {[info procs vTclWindow$name] != ""} {
                eval "vTclWindow$name $newname $rest"
            }
            if {[info procs vTclWindow(post)$name] != ""} {
                eval "vTclWindow(post)$name $newname $rest"
            }
        }
        hide    { if $exists {wm withdraw $newname; return} }
        iconify { if $exists {wm iconify $newname; return} }
        destroy { if $exists {destroy $newname; return} }
    }
}

#################################
# VTCL GENERATED GUI PROCEDURES
#

proc vTclWindow. {base} {
    if {$base == ""} {
        set base .
    }
    ###################
    # CREATING WIDGETS
    ###################
    wm focusmodel $base passive
    wm geometry $base 1x1+0+0
    wm maxsize $base 1009 738
    wm minsize $base 1 1
    wm overrideredirect $base 0
    wm resizable $base 0 0
    wm withdraw $base
    wm title $base "vt.tcl"
    ###################
    # SETTING GEOMETRY
    ###################
}

proc vTclWindow.top17 {base} {
    if {$base == ""} {
        set base .top17
    }
    if {[winfo exists $base]} {
        wm deiconify $base; return
    }
    ###################
    # CREATING WIDGETS
    ###################
    toplevel $base -class Toplevel \
        -background tan 
    wm focusmodel $base passive
    wm geometry $base 505x275+231+273
    wm maxsize $base 1009 738
    wm minsize $base 1 1
    wm overrideredirect $base 0
    wm resizable $base 0 0
    wm deiconify $base
    wm title $base "a2print"
    bind $base <Destroy> {
        exit
    }
    button $base.but18 \
        -background #e7c79e \
        -command {showpage $widget(page)
.top17.but18 configure -relief sunken} \
        -highlightthickness 0 -padx 9 -pady 3 -text {Page Setup} 
    button $base.but19 \
        -background #e7c79e \
        -command {showpage $widget(style)
.top17.but19 configure -relief sunken} \
        -highlightthickness 0 -padx 9 -pady 3 -text Style 
    button $base.but20 \
        -background #e7c79e \
        -command {showpage $widget(titles)
.top17.but20 configure -relief sunken} \
        -highlightthickness 0 -padx 9 -pady 3 -text Headers 
    button $base.but22 \
        -background tan -command {puts $FILE
exit} -highlightthickness 0 \
        -padx 9 -pady 3 -text Cancel -wraplength 60 
    button $base.but31 \
        -background #e7c79e \
        -command {showpage $widget(general)
.top17.but31 configure -relief sunken} \
        -highlightthickness 0 -padx 9 -pady 3 -relief sunken -text General 
    button $base.but21 \
        -background tan \
        -command {set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
set OPTFILE [open ~/.a2print/a2printrc w]
puts $OPTFILE $INSTALL_DIR
puts $OPTFILE $p1
puts $OPTFILE $p2
puts $OPTFILE $p3
puts $OPTFILE $p4
puts $OPTFILE $p5
puts $OPTFILE $p6
puts $OPTFILE $p7
puts $OPTFILE $g
puts $OPTFILE $g1
puts $OPTFILE $g2
puts $OPTFILE $g3
puts $OPTFILE $g4
puts $OPTFILE $g5
puts $OPTFILE $g6
puts $OPTFILE $g7
puts $OPTFILE $gg1
puts $OPTFILE $gg2
puts $OPTFILE $h1
puts $OPTFILE $h11
puts $OPTFILE $h2
puts $OPTFILE $h22
puts $OPTFILE $h3
puts $OPTFILE $h4
puts $OPTFILE $h5
puts $OPTFILE $h6
puts $OPTFILE $h7
puts $OPTFILE $h8
puts $OPTFILE $hh1
puts $OPTFILE $hh2
puts $OPTFILE $s
puts $OPTFILE $s1
puts $OPTFILE $s2
puts $OPTFILE $s3
puts $OPTFILE $s4
puts $OPTFILE $s5
puts $OPTFILE $s6
puts $OPTFILE $s8
puts $OPTFILE $s9
puts $OPTFILE $s10
puts $OPTFILE $s11
puts $OPTFILE $s12
puts $OPTFILE $gs
puts $OPTFILE $gs1
puts $OPTFILE $gs2
puts $OPTFILE $gs3
puts $OPTFILE $gs4
puts $OPTFILE $gs5
close $OPTFILE} \
        -highlightthickness 0 -padx 9 -pady 3 -text Save -wraplength 60 
    button $base.but23 \
        -background tan -command {print} \
        -highlightthickness 0 -padx 9 \
        -pady 3 -text PRINT 
    button $base.but17 \
        -background tan \
        -command {if $g7 then {
    set SPACE " "
    if {$s8==0} then {set h "--strip-level=4 "} else {set h "--strip-level=$s8 "}
    if {$s10==1} then {set h "$h--line-numbers=$s11 "} else {set h "$h--line-numbers=0 "}
    switch -glob $s12 {
    AUTO {set h "$h--automatic-style=yes "}
    DISABLE {set h "$h--automatic-style=no "}
    * {set h "$h--pretty-print=$s12 "}
    }
    if {$g==1} then {set g1 -P$gg1}
    if {$g==2} then {set g1 -o$gg2}
    if {$g==3} then {set g1 -o-}
    if {$hh2=="Underlay ON"} then {set h22 $h2} else {set h22 " "}
    if {$hh1=="Header ON"} then {
    set OPTS [concat -q {--header=$h1} {--underlay=$h22} {--left-title=$h3$SPACE} {--right-title=$SPACE$h4} {--footer=$h5} {--left-footer=$h6} {--right-footer=$h7} {--center-title=$h8$SPACE} -M$p1 $p2 --columns=$p3 --rows=$p4 --borders $p5 --margin=$p6 --major=$p7 $s -T$s3 --truncate-lines $s4 --encoding=$s5 --prologue=$s9 -n$g2 $g3 --graphic-symbols=$g4 --non-printable-format=$g5 $g6 $h -Pgv $FILE]
    } else {
        set OPTS [concat -q {--underlay=$h22} {--footer=$h5} {--left-footer=$h6} {--right-footer=$h7} -M$p1 $p2 --columns=$p3 --rows=$p4 --borders $p5 --margin=$p6 --major=$p7 $s -T$s3 --truncate-lines $s4 --encoding=$s5 --strip-level=$s8 --prologue=$s9 -n$g2 $g3 --graphic-symbols=$g4 --non-printable-format=$g5 $g6 -B $h -Pgv $FILE]
        }
    eval exec a2ps $OPTS } else {
        eval exec ghostview $FILE
        }} \
        -highlightthickness 0 -padx 9 -pady 3 -text {Print preview} \
        -wraplength 500 
    button $base.but24 \
        -background tan -command read_options -highlightthickness 0 -padx 9 \
        -pady 3 -text Load -wraplength 50 
    message $base.mes17 \
        -aspect 500 -background tan -padx 5 -pady 2 -text Options: 
    button $base.but26 \
        -background tan -borderwidth 1 -command {Window show .top18} \
        -highlightthickness 0 -image a2icon -padx 9 -pady 3 -relief flat \
        -text button 
    button $base.but27 \
        -background #e7c79e \
        -command {showpage $widget(ghost)
.top17.but27 configure -relief sunken} \
        -highlightthickness 0 -padx 9 -pady 3 -text Ghostscript 
    frame $base.fra30 \
        -background tan -borderwidth 2 -height 75 -relief groove -width 125 
    menubutton $base.fra30.men31 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra30.men31.01 -padx 4 -pady 3 -relief raised -text a4 \
        -textvariable gs1 
    menu $base.fra30.men31.01 \
        -background tan -tearoff 0 
    $base.fra30.men31.01 add command \
        -command {set gs1 a4} -label a4 
    $base.fra30.men31.01 add command \
        -command {set gs1 a5} -label a5 
    $base.fra30.men31.01 add command \
        -command {set gs1 letter} -label letter 
    $base.fra30.men31.01 add command \
        -command {set gs1 legal} -label legal 
    $base.fra30.men31.01 add command \
        -command {set gs1 note} -label note 
    $base.fra30.men31.01 add command \
        -command {set gs1 a0} -label a0 
    $base.fra30.men31.01 add command \
        -command {set gs1 a10} -label a10 
    $base.fra30.men31.01 add command \
        -command {set gs1 11x17} -label 11x17 
    $base.fra30.men31.01 add command \
        -command {set gs1 a1} -label a1 
    $base.fra30.men31.01 add command \
        -command {set gs1 a2} -label a2 
    $base.fra30.men31.01 add command \
        -command {set gs1 a3} -label a3 
    $base.fra30.men31.01 add command \
        -command {set gs1 a6} -label a6 
    $base.fra30.men31.01 add command \
        -command {set gs1 a7} -label a7 
    $base.fra30.men31.01 add command \
        -command {set gs1 a8} -label a8 
    $base.fra30.men31.01 add command \
        -command {set gs1 a9} -label a9 
    $base.fra30.men31.01 add command \
        -command {set gs1 archA} -label archA 
    $base.fra30.men31.01 add command \
        -command {set gs1 archB} -label archB 
    $base.fra30.men31.01 add command \
        -command {set gs1 archC} -label archC 
    $base.fra30.men31.01 add command \
        -command {set gs1 archD} -label archD 
    $base.fra30.men31.01 add command \
        -command {set gs1 archE} -label archE 
    $base.fra30.men31.01 add command \
        -command {set gs1 b0} -label b0 
    $base.fra30.men31.01 add command \
        -command {set gs1 b1} -label b1 
    $base.fra30.men31.01 add command \
        -command {set gs1 b2} -label b2 
    $base.fra30.men31.01 add command \
        -command {set gs1 b3} -label b3 
    $base.fra30.men31.01 add command \
        -command {set gs1 b4} -label b4 
    $base.fra30.men31.01 add command \
        -command {set gs1 b5} -label b5 
    $base.fra30.men31.01 add command \
        -command {set gs1 flsa} -label flsa 
    $base.fra30.men31.01 add command \
        -command {set gs1 halfletter} -label halfletter 
    $base.fra30.men31.01 add command \
        -command {set gs1 ledger} -label ledger 
    label $base.fra30.lab33 \
        -background tan -borderwidth 1 -text {Paper size:} 
    checkbutton $base.fra30.che35 \
        -background tan -borderwidth 1 -highlightthickness 0 -offvalue { } \
        -onvalue -dNOPLATFONTS -text NOPLATFONTS -variable gs2 
    message $base.fra30.mes19 \
        -aspect 1000 -background tan -foreground #920000 -padx 5 -pady 2 \
        -text {Configuration for non-postscript printers only:} 
    listbox $base.fra30.lis23 \
        -background White -exportselection 0 -highlightthickness 0 \
        -yscrollcommand {.top17.fra30.scr17 set} 
    scrollbar $base.fra30.scr17 \
        -activerelief sunken -background bisque4 \
        -command {.top17.fra30.lis23 yview} -highlightthickness 0 \
        -orient vert -width 12 
    message $base.fra30.mes18 \
        -aspect 300 -background tan -padx 5 -pady 2 \
        -text {Printer plug-in configurators:} 
    button $base.fra30.but19 \
        -background tan -borderwidth 1 \
        -command {set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
if {$gs3=="OTHER"} then {tk_messageBox -default ok -icon info -message "OTHER is used if the apropriate plugin is not available. Use \"aditional gs options\" to insert your own options." -title "Info" -type ok} else {
    if {[file readable $INSTALL_DIR/$gs3.printer.info]} then {
        set OPTFILE [open $INSTALL_DIR/$gs3.printer.info r]
        tk_messageBox -default ok -icon info -message [read $OPTFILE] -title "Info" -type ok
        close $OPTFILE
        } else {
            tk_messageBox -default ok -icon error -message "Info file doesn't exist or is not readable. Check your plugin installation!" -title "Error" -type ok
        }
}} \
        -highlightthickness 0 -padx 9 -pady 3 -text Info 
    button $base.fra30.but22 \
        -background tan -borderwidth 1 \
        -command {set gs3 [.top17.fra30.lis23 get [.top17.fra30.lis23 curselection]]
if {$gs3=="OTHER"} then {tk_messageBox -default ok -icon info -message "OTHER is used if the apropriate plugin is not available. Use \"aditional gs options\" to insert your own options." -title "Info" -type ok} else {
    if {[file readable $INSTALL_DIR/$gs3.printer.info]} then {
        exec wish $INSTALL_DIR/$gs3.printer $INSTALL_DIR
        } else {
        tk_messageBox -default ok -icon error -message "Plugin file doesn't exist or is not readable. Check your plugin installation! Plugin files must be in $INSTALL_DIR directory!" -title "Error" -type ok
    }
}} \
        -highlightthickness 0 -padx 9 -pady 3 -text Configure 
    button $base.fra30.but20 \
        -background tan \
        -command {if $gs then {set gs 0} else {set gs 1}
gsinit} \
        -highlightthickness 0 -padx 9 -pady 3 \
        -text {Disable Ghostscript printing} 
    label $base.fra30.lab28 \
        -background tan -bitmap question -relief ridge 
    button $base.fra30.but29 \
        -background tan -borderwidth 1 \
        -command {exec wish $INSTALL_DIR/viewer.tcl $INSTALL_DIR/ghostscript.help} \
        -highlightthickness 0 -padx 9 -pady 3 -text Help 
    entry $base.fra30.ent20 \
        -background white -highlightthickness 0 -textvariable gs5 
    label $base.fra30.lab21 \
        -background tan -borderwidth 1 -text {Aditional gs options:} \
        -wraplength 100 
    frame $base.fra30.fra24 \
        -background tan -borderwidth 2 -height 75 -width 125 
    message $base.fra30.fra24.01 \
        -aspect 500 -background tan \
        -font -Adobe-Helvetica-Bold-R-Normal--*-320-*-*-*-*-*-* \
        -foreground #727076 -padx 5 -pady 2 -text DISABLED 
    frame $base.fra29 \
        -background tan -borderwidth 2 -height 75 -relief groove -width 125 
    label $base.fra29.lab58 \
        -background tan -borderwidth 1 -text {left title:} 
    label $base.fra29.lab59 \
        -background tan -borderwidth 1 -text {right title:} 
    label $base.fra29.lab60 \
        -background tan -borderwidth 1 -text {left footer:} 
    label $base.fra29.lab61 \
        -background tan -borderwidth 1 -text {right footer:} 
    label $base.fra29.lab62 \
        -background tan -borderwidth 1 -text footer: 
    entry $base.fra29.ent63 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -textvariable h1 
    entry $base.fra29.ent64 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -textvariable h2 
    entry $base.fra29.ent65 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -textvariable h3 
    entry $base.fra29.ent66 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -textvariable h4 
    entry $base.fra29.ent67 \
        -background white -borderwidth 1 -highlightthickness 0 \
        -textvariable h5 
    entry $base.fra29.ent68 \
        -background white -borderwidth 1 -highlightthickness 0 \
        -textvariable h6 
    entry $base.fra29.ent69 \
        -background white -borderwidth 1 -highlightthickness 0 \
        -textvariable h7 
    button $base.fra29.but19 \
        -background tan -borderwidth 1 \
        -command {if {$hh1=="Header OFF"} then {header 1} else {header 0}} \
        -highlightthickness 0 -padx 9 -pady 3 -relief sunken \
        -text {Header ON} -textvariable hh1 
    button $base.fra29.but20 \
        -background tan -borderwidth 1 \
        -command {if {"$hh2"=="Underlay OFF"} then {.top17.fra29.but20 configure -relief sunken; .top17.fra29.ent64 configure -state normal -background White; set hh2 "Underlay ON"; if {[string length $h2]} then {set h22 "--underlay=\"$h2\" "} else {set h22 ""}} else {.top17.fra29.but20 configure -relief raised; .top17.fra29.ent64 configure -state disabled -background tan;set hh2 "Underlay OFF";set h22 ""}} \
        -highlightthickness 0 -padx 9 -pady 3 -relief sunken \
        -text {Underlay ON} -textvariable hh2 
    label $base.fra29.lab22 \
        -background tan -borderwidth 1 -text title: 
    entry $base.fra29.ent24 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -textvariable h8 
    button $base.fra29.but25 \
        -background tan -borderwidth 1 \
        -command {exec wish $INSTALL_DIR/viewer.tcl $INSTALL_DIR/meta.help &} \
        -highlightthickness 0 -padx 9 -pady 3 -text {Help on meta sequences} \
        -wraplength 100 
    label $base.fra29.lab27 \
        -background tan -bitmap info -relief ridge 
    frame $base.fra27 \
        -background tan -borderwidth 2 -height 75 -relief groove -width 125 
    label $base.fra27.lab44 \
        -background tan -borderwidth 1 -text Fontsize: 
    label $base.fra27.lab45 \
        -background tan -borderwidth 1 -foreground #939393 -text Lines: \
        -wraplength 80 
    label $base.fra27.lab46 \
        -background tan -borderwidth 1 -text {Tab size:} 
    scale $base.fra27.sca47 \
        -background tan -borderwidth 1 -command font1 -from 1.0 \
        -highlightthickness 0 -orient horiz -showvalue 0 -variable s1 
    scale $base.fra27.sca51 \
        -background tan -borderwidth 1 -command lines1 -from 1.0 \
        -highlightthickness 0 -orient horiz -showvalue 0 -to 200.0 \
        -troughcolor tan -variable s2 
    scale $base.fra27.sca52 \
        -background tan -borderwidth 1 -from 1.0 -highlightthickness 0 \
        -orient horiz -showvalue 0 -to 50.0 -variable s3 
    label $base.fra27.lab17 \
        -background tan -borderwidth 1 -foreground #939393 -text Columns: \
        -wraplength 80 
    scale $base.fra27.sca20 \
        -background tan -borderwidth 1 -command column1 -from 1.0 \
        -highlightthickness 0 -orient horiz -showvalue 0 -to 200.0 \
        -troughcolor tan -variable s6 
    label $base.fra27.lab18 \
        -background White -borderwidth 1 -text 12 -textvariable s1 
    label $base.fra27.lab19 \
        -background tan -borderwidth 1 -text 60 -textvariable s2 
    label $base.fra27.lab20 \
        -background tan -borderwidth 1 -text 60 -textvariable s6 
    label $base.fra27.lab21 \
        -background white -borderwidth 1 -text 5 -textvariable s3 
    label $base.fra27.lab32 \
        -background tan -borderwidth 1 -text {Strip level:} 
    label $base.fra27.lab34 \
        -background tan -borderwidth 1 -text {Style (.pro):} 
    menubutton $base.fra27.men35 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra27.men35.m -padx 4 -pady 3 -relief raised -text 1 \
        -textvariable s8 
    menu $base.fra27.men35.m \
        -background tan -tearoff 0 
    $base.fra27.men35.m add command \
        -accelerator {  - all comments canceled} -command {set s8 3} -label 3 
    $base.fra27.men35.m add command \
        -accelerator {  - strong comments not printed} -command {set s8 2} \
        -label 2 
    $base.fra27.men35.m add command \
        -accelerator {  - regular comments not printed} -command {set s8 1} \
        -label 1
    $base.fra27.men35.m add command \
        -accelerator {  - print everything} -command {set s8 0} -label 0 
    menubutton $base.fra27.men37 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra27.men37.m -padx 4 -pady 3 -relief raised -text color \
        -textvariable s9 
    menu $base.fra27.men37.m \
        -background tan -tearoff 0 
    $base.fra27.men37.m add command \
        -command {set s9 "black+white"} -label black+white 
    $base.fra27.men37.m add command \
        -command {set s9 gray} -label gray 
    $base.fra27.men37.m add command \
        -command {set s9 gray2} -label gray2 
    $base.fra27.men37.m add command \
        -command {set s9 color} -label color 
    label $base.fra27.lab38 \
        -background tan -borderwidth 1 -text Language: 
    entry $base.fra27.ent23 \
        -background White -borderwidth 1 -highlightthickness 0 \
        -justify center -textvariable s11 
    label $base.fra27.lab24 \
        -background tan -borderwidth 1 -text lines 
    checkbutton $base.fra27.che26 \
        -background tan -borderwidth 1 -highlightthickness 0 \
        -text {line numbers every } -variable s10 
    menubutton $base.fra27.men28 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra27.men28.m -padx 4 -pady 3 -relief raised \
        -text DISABLE -textvariable s12 
    menu $base.fra27.men28.m \
        -background tan -tearoff 0 
    $base.fra27.men28.m add command \
        -command {set s12 DISABLE} -label DISABLE 
    $base.fra27.men28.m add command \
        -command {set s12 AUTO} -label AUTO 
    $base.fra27.men28.m add cascade \
        -label OTHER -menu .top17.fra27.men28.m.men29 
    $base.fra27.men28.m add command \
        -command {set s12 C} -label C 
    $base.fra27.men28.m add command \
        -command {set s12 C++} -label C++ 
    $base.fra27.men28.m add command \
        -command {set s12 common-lisp} -label common-lisp 
    $base.fra27.men28.m add command \
        -command {set s12 Fortran} -label Fortran 
    $base.fra27.men28.m add command \
        -command {set s12 java} -label java 
    $base.fra27.men28.m add command \
        -command {set s12 mailfolder} -label mailfolder 
    $base.fra27.men28.m add command \
        -command {set s12 modula-3} -label modula-3 
    $base.fra27.men28.m add command \
        -command {set s12 ObjectiveC} -label ObjectiveC 
    $base.fra27.men28.m add command \
        -command {set s12 oracle} -label oracle 
    $base.fra27.men28.m add command \
        -command {set s12 Pascal} -label Pascal 
    $base.fra27.men28.m add command \
        -command {set s12 PreScript} -label PreScript 
    $base.fra27.men28.m add command \
        -command {set s12 PostScript} -label PostScript 
    $base.fra27.men28.m add command \
        -command {set s12 prolog} -label prolog 
    $base.fra27.men28.m add command \
        -command {set s12 sh} -label sh 
    $base.fra27.men28.m add command \
        -command {set s12 sql} -label sql 
    $base.fra27.men28.m add command \
        -command {set s12 sql92} -label sql92 
    $base.fra27.men28.m add command \
        -command {set s12 tcl} -label tcl 
    $base.fra27.men28.m add command \
        -command {set s12 tk} -label tk 
    $base.fra27.men28.m add command \
        -command {set s12 zsh} -label zsh 
    menu $base.fra27.men28.m.men29 \
        -background tan -tearoff 0 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 ada} -label ada 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 caml} -label caml 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 claire} -label claire 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 coq-vernicular} -label coq-vernicular 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 eiffel} -label eiffel 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 initora} -label initora 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 lace} -label lace 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 68000} -label 68000 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 o2c} -label o2c 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 oberon} -label oberon 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 octave} -label octave 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 plsql} -label plsql 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 Promela} -label Promela 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 python} -label python 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 sather} -label sather 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 scheme} -label scheme 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 SDL-88} -label SDL-88 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 Unity} -label Unity 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 VERILOG} -label VERILOG 
    $base.fra27.men28.m.men29 add command \
        -command {set s12 VHDL} -label VHDL 
    menu $base.fra27.men28.m.men30 \
        -background tan 
    menu $base.fra27.men28.m.men31 \
        -background tan 
    menu $base.fra27.men28.m.men32 \
        -background tan 
    menu $base.fra27.men28.m.men33 \
        -background tan 
    menu $base.fra27.men28.m.men34 \
        -background tan 
    menu $base.fra27.men28.m.men35 \
        -background tan 
    menu $base.fra27.men28.m.men36 \
        -background tan 
    menu $base.fra27.men28.m.men37 \
        -background tan 
    menu $base.fra27.men28.m.men38 \
        -background tan 
    menu $base.fra27.men28.m.men39 \
        -background tan 
    menu $base.fra27.men28.m.men40 \
        -background tan 
    menu $base.fra27.men28.m.men41 \
        -background tan 
    menu $base.fra27.men28.m.men42 \
        -background tan 
    menu $base.fra27.men28.m.men43 \
        -background tan 
    menu $base.fra27.men28.m.men44 \
        -background tan 
    menu $base.fra27.men28.m.men45 \
        -background tan 
    menu $base.fra27.men28.m.men46 \
        -background tan 
    menu $base.fra27.men28.m.men47 \
        -background tan 
    menu $base.fra27.men28.m.men48 \
        -background tan 
    menu $base.fra27.men28.m.men49 \
        -background tan 
    frame $base.fra24 \
        -background tan -borderwidth 2 -height 75 -relief groove -width 125 
    menubutton $base.fra24.men17 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra24.men17.m -padx 4 -pady 3 -relief raised -text A4 \
        -textvariable p1 
    menu $base.fra24.men17.m \
        -background tan -tearoff 0 
    $base.fra24.men17.m add command \
        -accelerator 842x1190 -command {set p1 A3
set gs1 a3} -label A3 
    $base.fra24.men17.m add command \
        -accelerator 595x842 -command {set p1 A4
set gs1 a4} -label A4 
    $base.fra24.men17.m add command \
        -accelerator 420x595 -command {set p1 A5
set gs1 a5} -label A5 
    $base.fra24.men17.m add command \
        -accelerator 729x1032 -command {set p1 B4
set gs1 b4} -label B4 
    $base.fra24.men17.m add command \
        -accelerator 516x729 -command {set p1 B5
set gs1 b5} -label B5 
    $base.fra24.men17.m add command \
        -accelerator 612x792 -command {set p1 Letter
set gs1 letter} \
        -label Letter 
    $base.fra24.men17.m add command \
        -accelerator 612x1008 -command {set p1 Legal
set gs1 legal} \
        -label Legal 
    $base.fra24.men17.m add command \
        -accelerator 792x1224 -command {set p1 Tabloid
set gs1 a4} \
        -label Tabloid 
    $base.fra24.men17.m add command \
        -accelerator 1224x792 -command {set p1 Ledger
set gs1 ledger} \
        -label Ledger 
    $base.fra24.men17.m add command \
        -accelerator 396x612 -command {set p1 Statement
set gs1 a4} \
        -label Statement 
    $base.fra24.men17.m add command \
        -accelerator 540x720 -command {set p1 Executive
set gs1 a4} \
        -label Executive 
    $base.fra24.men17.m add command \
        -accelerator 612x936 -command {set p1 Folio
set gs a4} -label Folio 
    $base.fra24.men17.m add command \
        -accelerator 610x780 -command {set p1 Quarto
set gs a4} -label Quarto 
    $base.fra24.men17.m add command \
        -accelerator 720x1008 -command {set p1 10x14
set gs a4} -label 10x14 
    $base.fra24.men17.m add command \
        -accelerator 595x842 -command {set p1 A4dj
set gs a4} -label A4dj 
    $base.fra24.men17.m add command \
        -accelerator 612x792 -command {set p1 Letterdj
set gs letter} \
        -label Letterdj 
    radiobutton $base.fra24.rad19 \
        -background tan -highlightthickness 0 -text portrait -value -R \
        -variable p2 
    radiobutton $base.fra24.rad20 \
        -background tan -highlightthickness 0 -text landscape -value -r \
        -variable p2 
    label $base.fra24.lab21 \
        -background tan -borderwidth 1 -text columns: 
    entry $base.fra24.ent23 \
        -background #fefefe -borderwidth 1 -highlightthickness 0 \
        -justify right -textvariable p3 
    scale $base.fra24.sca24 \
        -background tan -borderwidth 1 -from 1.0 -highlightthickness 0 \
        -orient horiz -showvalue 0 -to 10.0 -variable p3 
    label $base.fra24.lab25 \
        -background tan -borderwidth 1 -justify left -text rows: 
    entry $base.fra24.ent26 \
        -background #fefefe -borderwidth 1 -highlightthickness 0 \
        -justify right -textvariable p4 
    scale $base.fra24.sca27 \
        -background tan -borderwidth 1 -from 1.0 -highlightthickness 0 \
        -orient horiz -showvalue 0 -to 10.0 -variable p4 
    checkbutton $base.fra24.che28 \
        -background tan -borderwidth 1 -highlightthickness 0 -offvalue no \
        -onvalue yes -text {borders arround columns} -variable p5 
    label $base.fra24.lab29 \
        -background tan -borderwidth 1 -text {Interior margin:} \
        -wraplength 45 
    entry $base.fra24.ent30 \
        -background #fefefe -borderwidth 1 -highlightthickness 0 \
        -justify right -textvariable p6 
    message $base.fra24.mes25 \
        -aspect 1000 -background tan -padx 5 -pady 2 -text {VIRTUAL SHEETS:} 
    message $base.fra24.mes26 \
        -background tan -padx 5 -pady 2 -text {First fill:} 
    radiobutton $base.fra24.rad27 \
        -background tan -highlightthickness 0 -text cols -value columns \
        -variable p7 
    radiobutton $base.fra24.rad28 \
        -background tan -highlightthickness 0 -text rows -value rows \
        -variable p7 
    label $base.fra24.lab34 \
        -background tan -borderwidth 1 -text {Paper size:} 
    frame $base.fra33 \
        -background tan -borderwidth 2 -height 75 -relief groove -width 125 
    label $base.fra33.lab34 \
        -background tan -borderwidth 1 -text {Output to:} 
    radiobutton $base.fra33.rad35 \
        -background tan -command {set g1 -P$gg1} -highlightthickness 0 \
        -text printer: -value 1 -variable g 
    radiobutton $base.fra33.rad36 \
        -background tan -command {set g1 -o$gg2} -highlightthickness 0 \
        -text file: -value 2 -variable g 
    entry $base.fra33.ent37 \
        -background white -highlightthickness 0 -textvariable gg1 
    entry $base.fra33.ent38 \
        -background white -highlightthickness 0 -textvariable gg2 
    radiobutton $base.fra33.rad39 \
        -background tan -command {set g1 -o-} -highlightthickness 0 \
        -text {standard output} -value 3 -variable g 
    label $base.fra33.lab40 \
        -background tan -borderwidth 1 -text Copies: 
    entry $base.fra33.ent41 \
        -background white -highlightthickness 0 -justify right \
        -textvariable g2 
    checkbutton $base.fra33.che42 \
        -background tan -borderwidth 1 -highlightthickness 0 -offvalue no \
        -onvalue yes -text {symbols convertion} -variable g4 
    checkbutton $base.fra33.che43 \
        -background tan -borderwidth 1 -highlightthickness 0 -justify left \
        -offvalue -s1 -onvalue -s2 -text {two-sided printing} -variable g3 
    label $base.fra33.lab20 \
        -background tan -borderwidth 1 -text {Non-printable chars format:} \
        -wraplength 100 
    menubutton $base.fra33.men21 \
        -background tan -borderwidth 1 -indicatoron 1 \
        -menu .top17.fra33.men21.01 -padx 4 -pady 3 -relief raised \
        -text space -textvariable g5 
    menu $base.fra33.men21.01 \
        -background tan -tearoff 0 
    $base.fra33.men21.01 add command \
        -accelerator {( ^M  M-^B ...)} -command {set g5 caret} -label caret 
    $base.fra33.men21.01 add command \
        -command {set g5 space} -label space 
    menubutton $base.fra33.men29 \
        -background tan -borderwidth 1 -indicatoron 1 -justify left \
        -menu .top17.fra33.men29.01 -padx 4 -pady 3 -relief raised \
        -text Latin1 -textvariable s5 
    menu $base.fra33.men29.01 \
        -background tan -tearoff 0 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-1) -command {set s5 Latin1} -label Latin1 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-2) -command {set s5 Latin2} -label Latin2 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-3) -command {set s5 Latin3} -label Latin3 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-4) -command {set s5 Latin4} -label Latin4 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-9) -command {set s5 Latin5} -label Latin5 
    $base.fra33.men29.01 add command \
        -accelerator (ISO8859-10) -command {set s5 Latin6} -label Latin6 
    $base.fra33.men29.01 add command \
        -accelerator (7bit) -command {set s5 ASCII} -label ASCII 
    $base.fra33.men29.01 add command \
        -accelerator {(HP 8 Roman)} -command {set s5 HP} -label HP 
    $base.fra33.men29.01 add command \
        -accelerator Macintoch -command {set s5 Mac} -label Mac 
    $base.fra33.men29.01 add command \
        -accelerator {(PC Text)} -command {set s5 IBMPC} -label IBMPC 
    $base.fra33.men29.01 add command \
        -accelerator {(PC Graphic)} -command {set s5 PCG} -label PCG 
    $base.fra33.men29.01 add command \
        -accelerator (Microsoft) -command {set s5 CP-1250} -label CP-1250 
    label $base.fra33.lab31 \
        -background tan -borderwidth 1 -text Encoding: 
    checkbutton $base.fra33.che36 \
        -background tan -borderwidth 1 -highlightthickness 0 -offvalue no \
        -onvalue yes -text {Cut long lines} -variable s4 
    label $base.fra33.lab24 \
        -background tan -borderwidth 1 -text {aditional a2ps parameters:} \
        -wraplength 100 
    entry $base.fra33.ent25 \
        -background white -highlightthickness 0 -textvariable g6 
    button $base.fra33.but39 \
        -background tan -borderwidth 1 \
        -command {set gg2 [tk_getSaveFile -title "Save as file..."]} \
        -highlightthickness 0 -padx 9 -pady 3 -text browse 
    button $base.fra33.but28 \
        -background tan \
        -command {if $g7 then {set g7 0} else {set g7 1}
a2psinit} \
        -highlightthickness 0 -padx 9 -pady 3 -text {a2ps ENABLED} \
        -wraplength 80 
    ###################
    # SETTING GEOMETRY
    ###################
    place $base.but18 \
        -x 80 -y 5 -width 85 -height 24 -anchor nw -bordermode ignore 
    place $base.but19 \
        -x 165 -y 5 -width 75 -height 24 -anchor nw -bordermode ignore 
    place $base.but20 \
        -x 240 -y 5 -width 75 -height 24 -anchor nw -bordermode ignore 
    place $base.but22 \
        -x 400 -y 180 -width 100 -height 39 -anchor nw -bordermode ignore 
    place $base.but31 \
        -x 5 -y 5 -width 75 -height 24 -anchor nw -bordermode ignore 
    place $base.but21 \
        -x 450 -y 150 -width 50 -height 24 -anchor nw -bordermode ignore 
    place $base.but23 \
        -x 400 -y 230 -width 100 -height 39 -anchor nw -bordermode ignore 
    place $base.but17 \
        -x 400 -y 95 -width 100 -height 24 -anchor nw -bordermode ignore 
    place $base.but24 \
        -x 400 -y 150 -width 50 -height 24 -anchor nw -bordermode ignore 
    place $base.mes17 \
        -x 410 -y 130 -width 68 -height 16 -anchor nw -bordermode ignore 
    place $base.but26 \
        -x 400 -y 35 -width 100 -height 29 -anchor nw -bordermode ignore 
    place $base.but27 \
        -x 315 -y 5 -width 80 -anchor nw -bordermode ignore 
    place $base.fra30 \
        -x 0 -y 0 -width 0 -height 0 -anchor nw -bordermode ignore 
    place $base.fra30.men31 \
        -x 225 -y 40 -width 95 -height 19 -anchor nw -bordermode ignore 
    place $base.fra30.lab33 \
        -x 150 -y 40 -width 71 -height 18 -anchor nw -bordermode ignore 
    place $base.fra30.che35 \
        -x 10 -y 40 -anchor nw -bordermode ignore 
    place $base.fra30.mes19 \
        -x 5 -y 5 -width 378 -height 31 -anchor nw -bordermode ignore 
    place $base.fra30.lis23 \
        -x 115 -y 70 -width 181 -height 69 -anchor nw -bordermode ignore 
    place $base.fra30.scr17 \
        -x 290 -y 70 -width 16 -height 69 -anchor nw -bordermode ignore 
    place $base.fra30.mes18 \
        -x 10 -y 75 -width 103 -height 51 -anchor nw -bordermode ignore 
    place $base.fra30.but19 \
        -x 315 -y 70 -width 68 -height 22 -anchor nw -bordermode ignore 
    place $base.fra30.but22 \
        -x 315 -y 105 -width 68 -height 32 -anchor nw -bordermode ignore 
    place $base.fra30.but20 \
        -x 10 -y 205 -anchor nw -bordermode ignore 
    place $base.fra30.lab28 \
        -x 350 -y 198 -width 36 -height 33 -anchor nw -bordermode ignore 
    place $base.fra30.but29 \
        -x 299 -y 198 -width 51 -height 33 -anchor nw -bordermode ignore 
    place $base.fra30.ent20 \
        -x 115 -y 150 -width 266 -height 20 -anchor nw -bordermode ignore 
    place $base.fra30.lab21 \
        -x 40 -y 143 -width 72 -height 32 -anchor nw -bordermode ignore 
    place $base.fra30.fra24 \
        -x 0 -y 0 -width 0 -height 0 -anchor nw -bordermode ignore 
    place $base.fra30.fra24.01 \
        -x 45 -y 45 -width 288 -height 56 -anchor nw -bordermode ignore 
    place $base.fra29 \
        -x 0 -y 0 -width 0 -height 0 -anchor nw 
    place $base.fra29.lab58 \
        -x 10 -y 85 -width 60 -height 18 -anchor nw -bordermode ignore 
    place $base.fra29.lab59 \
        -x 5 -y 110 -anchor nw -bordermode ignore 
    place $base.fra29.lab60 \
        -x 11 -y 152 -anchor nw -bordermode ignore 
    place $base.fra29.lab61 \
        -x 5 -y 176 -anchor nw -bordermode ignore 
    place $base.fra29.lab62 \
        -x 33 -y 131 -anchor nw -bordermode ignore 
    place $base.fra29.ent63 \
        -x 90 -y 7 -width 294 -height 20 -anchor nw -bordermode ignore 
    place $base.fra29.ent64 \
        -x 90 -y 31 -width 294 -height 20 -anchor nw -bordermode ignore 
    place $base.fra29.ent65 \
        -x 70 -y 81 -width 314 -height 20 -anchor nw -bordermode ignore 
    place $base.fra29.ent66 \
        -x 70 -y 105 -width 314 -height 20 -anchor nw -bordermode ignore 
    place $base.fra29.ent67 \
        -x 80 -y 130 -width 304 -height 18 -anchor nw -bordermode ignore 
    place $base.fra29.ent68 \
        -x 80 -y 153 -width 304 -height 18 -anchor nw -bordermode ignore 
    place $base.fra29.ent69 \
        -x 80 -y 175 -width 304 -height 18 -anchor nw -bordermode ignore 
    place $base.fra29.but19 \
        -x 5 -y 7 -width 85 -height 19 -anchor nw -bordermode ignore 
    place $base.fra29.but20 \
        -x 5 -y 31 -width 85 -height 19 -anchor nw -bordermode ignore 
    place $base.fra29.lab22 \
        -x 30 -y 60 -width 40 -height 18 -anchor nw -bordermode ignore 
    place $base.fra29.ent24 \
        -x 70 -y 57 -width 314 -height 20 -anchor nw -bordermode ignore 
    place $base.fra29.but25 \
        -x 252 -y 198 -height 33 -anchor nw -bordermode ignore 
    place $base.fra29.lab27 \
        -x 350 -y 198 -width 36 -height 33 -anchor nw -bordermode ignore 
    place $base.fra27 \
        -x 0 -y 0 -width 0 -height 0 -anchor nw 
    place $base.fra27.lab44 \
        -x 17 -y 10 -anchor nw -bordermode ignore 
    place $base.fra27.lab45 \
        -x 35 -y 30 -anchor nw -bordermode ignore 
    place $base.fra27.lab46 \
        -x 26 -y 205 -width 57 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.sca47 \
        -x 120 -y 10 -width 252 -height 19 -anchor nw -bordermode ignore 
    place $base.fra27.sca51 \
        -x 120 -y 30 -width 252 -height 19 -anchor nw -bordermode ignore 
    place $base.fra27.sca52 \
        -x 125 -y 205 -width 247 -height 19 -anchor nw -bordermode ignore 
    place $base.fra27.lab17 \
        -x 15 -y 50 -anchor nw -bordermode ignore 
    place $base.fra27.sca20 \
        -x 120 -y 50 -width 252 -height 19 -anchor nw -bordermode ignore 
    place $base.fra27.lab18 \
        -x 85 -y 10 -width 31 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.lab19 \
        -x 85 -y 30 -width 31 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.lab20 \
        -x 85 -y 50 -width 31 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.lab21 \
        -x 90 -y 205 -width 31 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.lab32 \
        -x 15 -y 162 -width 69 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.lab34 \
        -x 180 -y 127 -width 79 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.men35 \
        -x 90 -y 160 -width 54 -height 22 -anchor nw -bordermode ignore 
    place $base.fra27.men37 \
        -x 265 -y 125 -width 104 -height 22 -anchor nw -bordermode ignore 
    place $base.fra27.lab38 \
        -x 195 -y 162 -width 64 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.ent23 \
        -x 195 -y 85 -width 31 -height 20 -anchor nw -bordermode ignore 
    place $base.fra27.lab24 \
        -x 231 -y 85 -width 36 -height 18 -anchor nw -bordermode ignore 
    place $base.fra27.che26 \
        -x 55 -y 85 -anchor nw -bordermode ignore 
    place $base.fra27.men28 \
        -x 265 -y 160 -width 107 -height 22 -anchor nw -bordermode ignore 
    place $base.fra24 \
        -x 0 -y 0 -width 0 -height 0 -anchor nw 
    place $base.fra24.men17 \
        -x 85 -y 20 -width 95 -height 19 -anchor nw -bordermode ignore 
    place $base.fra24.rad19 \
        -x 210 -y 20 -anchor nw -bordermode ignore 
    place $base.fra24.rad20 \
        -x 210 -y 45 -anchor nw -bordermode ignore 
    place $base.fra24.lab21 \
        -x 25 -y 180 -anchor nw -bordermode ignore 
    place $base.fra24.ent23 \
        -x 85 -y 175 -width 31 -height 20 -anchor nw -bordermode ignore 
    place $base.fra24.sca24 \
        -x 120 -y 180 -width 179 -height 21 -anchor nw -bordermode ignore 
    place $base.fra24.lab25 \
        -x 40 -y 205 -width 46 -height 23 -anchor nw -bordermode ignore 
    place $base.fra24.ent26 \
        -x 85 -y 205 -width 31 -height 20 -anchor nw -bordermode ignore 
    place $base.fra24.sca27 \
        -x 120 -y 205 -width 179 -height 21 -anchor nw -bordermode ignore 
    place $base.fra24.che28 \
        -x 190 -y 95 -anchor nw -bordermode ignore 
    place $base.fra24.lab29 \
        -x 20 -y 85 -width 59 -height 38 -anchor nw -bordermode ignore 
    place $base.fra24.ent30 \
        -x 85 -y 95 -width 31 -height 20 -anchor nw -bordermode ignore 
    place $base.fra24.mes25 \
        -x 15 -y 145 -width 118 -height 26 -anchor nw -bordermode ignore 
    place $base.fra24.mes26 \
        -x 305 -y 155 -anchor nw -bordermode ignore 
    place $base.fra24.rad27 \
        -x 310 -y 180 -anchor nw -bordermode ignore 
    place $base.fra24.rad28 \
        -x 310 -y 205 -anchor nw -bordermode ignore 
    place $base.fra24.lab34 \
        -x 10 -y 20 -width 71 -height 18 -anchor nw -bordermode ignore 
    place $base.fra33 \
        -x 5 -y 35 -width 390 -height 235 -anchor nw 
    place $base.fra33.lab34 \
        -x 55 -y 130 -width 62 -height 23 -anchor nw -bordermode ignore 
    place $base.fra33.rad35 \
        -x 129 -y 130 -width 66 -height 25 -anchor nw -bordermode ignore 
    place $base.fra33.rad36 \
        -x 125 -y 155 -width 54 -height 20 -anchor nw -bordermode ignore 
    place $base.fra33.ent37 \
        -x 200 -y 130 -width 126 -height 20 -anchor nw -bordermode ignore 
    place $base.fra33.ent38 \
        -x 180 -y 155 -anchor nw -bordermode ignore 
    place $base.fra33.rad39 \
        -x 127 -y 179 -anchor nw -bordermode ignore 
    place $base.fra33.lab40 \
        -x 275 -y 72 -anchor nw -bordermode ignore 
    place $base.fra33.ent41 \
        -x 325 -y 70 -width 31 -height 20 -anchor nw -bordermode ignore 
    place $base.fra33.che42 \
        -x 20 -y 70 -anchor nw -bordermode ignore 
    place $base.fra33.che43 \
        -x 20 -y 45 -anchor nw -bordermode ignore 
    place $base.fra33.lab20 \
        -x 220 -y 5 -width 91 -height 33 -anchor nw -bordermode ignore 
    place $base.fra33.men21 \
        -x 310 -y 10 -width 68 -height 22 -anchor nw -bordermode ignore 
    place $base.fra33.men29 \
        -x 85 -y 10 -width 119 -height 24 -anchor nw -bordermode ignore 
    place $base.fra33.lab31 \
        -x 15 -y 13 -anchor nw -bordermode ignore 
    place $base.fra33.che36 \
        -x 20 -y 95 -anchor nw -bordermode ignore 
    place $base.fra33.lab24 \
        -x 5 -y 200 -anchor nw -bordermode ignore 
    place $base.fra33.ent25 \
        -x 100 -y 205 -width 281 -height 20 -anchor nw -bordermode ignore 
    place $base.fra33.but39 \
        -x 325 -y 156 -width 55 -height 20 -anchor nw -bordermode ignore 
    place $base.fra33.but28 \
        -x 10 -y 155 -anchor nw -bordermode ignore 
}

proc vTclWindow.top18 {base} {
    if {$base == ""} {
        set base .top18
    }
    if {[winfo exists $base]} {
        wm deiconify $base; return
    }
    ###################
    # CREATING WIDGETS
    ###################
    toplevel $base -class Toplevel \
        -background tan 
    wm focusmodel $base passive
    wm geometry $base 200x200+395+274
    wm maxsize $base 1009 738
    wm minsize $base 1 1
    wm overrideredirect $base 0
    wm resizable $base 0 0
    wm title $base "About"
    button $base.but20 \
        -activebackground Tan -background tan -borderwidth 0 \
        -disabledforeground #000000 -highlightbackground Tan \
        -highlightthickness 0 -image a2icon -padx 9 -pady 3 -relief flat \
        -text button 
    message $base.mes21 \
        -aspect 500 -background tan -padx 5 -pady 2 -text {Version 0.91b} 
    message $base.mes22 \
        -aspect 300 -background tan -padx 5 -pady 2 \
        -text {Author: Mirko Vukusic       email: mirko@efst.hr            Split, Croatia www.efst.hr/~mirko/a2print} 
    button $base.but23 \
        -background tan -command {Window hide .top18} -highlightthickness 0 \
        -padx 9 -pady 3 -text OK 
    ###################
    # SETTING GEOMETRY
    ###################
    place $base.but20 \
        -x 5 -y 5 -width 190 -height 49 -anchor nw -bordermode ignore 
    place $base.mes21 \
        -x 10 -y 55 -width 183 -height 26 -anchor nw -bordermode ignore 
    place $base.mes22 \
        -x 15 -y 90 -width 178 -height 66 -anchor nw -bordermode ignore 
    place $base.but23 \
        -x 85 -y 165 -anchor nw -bordermode ignore 
}

Window show .
Window show .top17

main $argc $argv
