#!/usr/local/bin/wish # (Function) # Tkpstoedit executes the "pstoedit" command with output # formats selectable from a menu. # (Update Record) # 96/11/11 K.Fujii Original version. # # tkpstoedit.f0.rbbox.fmtlist: xfig tgif gnuplot pdf flatps java # # # #-- # Set preferences. #-- set biglabelfont "helvbo14" set labelfont "helvb12" set messagefont "helvb12" set helpfont "fixed" set itemfont "fixed" set bg1color #d9d9d9 set bg2color #c9c9c9 set bg3color #4fdf5e4e8600 set bg4color #4fdf5e4e8600 set fwdcolor "black" set fwacolor $fwdcolor set fw2color "yellow" set fw3color "yellow" set txfcolor $fwdcolor set txbcolor $bg2color set sbfcolor $bg1color set sbbcolor $bg2color set sbacolor $bg1color #-- # Define message dialog proc. #-- proc help_dialog {fh msg} { global messagefont helpfont message $fh.msg -text $msg -font $helpfont -aspect 600 button $fh.ok -text OK -command { set val 0 } -font $messagefont pack $fh.msg $fh.ok -side top tkwait variable val destroy . } #-- # Set File. #-- if { $argc != 1 } { help_dialog "" " Tkpstoedit invokes pstoedit with a format menu. \n\ Syntax: \n\ \t tkpstoedit \"\\"" exit 0 } else { set infile [lindex $argv 0] } #-- # Set default format. #-- set outfmt "xfig" set default_fmtlist "xfig tgif gnuplot pdf flatps java" wm title . "Tkpstoedit [exec basename $infile]" #-- # Set frames. #-- frame .f0 -bd 4 -bg $bg1color frame .f0.lbbox -bd 2 -relief groove -bg $bg4color frame .f0.rbbox -bd 2 -relief sunken -bg $bg2color frame .f0.swbox -bd 2 -relief flat -bg $bg1color #-- # Set header label. #-- label .f0.lbbox.label -text "Make Your Choice" -font $biglabelfont \ -background $bg4color -foreground $fw3color -height 2 pack .f0.lbbox.label -side top -fill both #-- # Set up switch box. #-- set frb .f0.rbbox set fmtlist [option get $frb fmtlist {}] if { $fmtlist == "" } { set fmtlist $default_fmtlist } foreach ux $fmtlist { radiobutton .f0.rbbox.$ux \ -text [format " %-8s" $ux] -value $ux -variable outfmt \ -font $itemfont -relief flat \ -highlightthickness 0 \ -activeforeground $fwacolor \ -activebackground $bg2color \ -background $bg2color \ -height 1 -width 14 pack .f0.rbbox.$ux -side top -fill both -anchor w } #-- # Set up button. #-- button .f0.swbox.cancel -text "Quit" \ -command { exit 0 } -font $labelfont \ -highlightthickness 0 \ -foreground $fw3color \ -activeforeground $fw3color \ -width 7 button .f0.swbox.ok -text "OK" \ -command { exec_command $outfmt } -font $labelfont \ -highlightthickness 0 \ -activeforeground $fwacolor \ -width 7 pack .f0.swbox.cancel .f0.swbox.ok -padx 0 -anchor w -fill both -side left #-- # Pack everything. #-- pack .f0.lbbox .f0.rbbox .f0.swbox -fill both -anchor w -side top pack .f0 wm minsize . 1 1 #-- # Execute command. #-- proc exec_command {outfmt} { global env infile set outfile [exec basename [exec basename [exec basename $infile .epsf] .eps] .ps] switch $outfmt { xfig { set fmt "fig" ; set outfile $outfile.fig } tgif { set fmt "tgif" ; set outfile $outfile.obj } gnuplot { set fmt "gnuplot" ; set outfile $outfile.data } pdf { set fmt "pdf" ; set outfile $outfile.pdf } flatps { set fmt "ps" ; set outfile $outfile.flat.ps } java { set fmt "java" ; set outfile $outfile.java } default { set fmt "fig" ; set outfile $outfile.fig } } exec pstoedit -f $fmt "$infile" "$outfile" & }