#! /usr/bin/wishx -f # # xphoto: A simple graphical user interface for photopc-3.05J9 and the # Nikon Coolpix 950 and 990 Digital Cameras # Copyright (C) 2000 John C. Bowman # #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. */ # # =========================== title ==================================== set colour "lemon chiffon" . configure -background $colour frame .title -background $colour label .title.label -text { X P H O T O 1.7} -font "-*-new century schoolbook-*-*-*-*-*-100-*-*-*-*-*-*" -borderwidth 10 -relief raised -background sienna -foreground yellow pack .title.label -anchor center -fill x -pady 20 global comment set comment "" global label set label "" global labelcolour set labelcolour "red" global imagename set imagename "image" global filename set filename "" global usefilename set usefilename 0 global initfile set initfile "~/.xphotorc" global initstate set initstate 0 global optcolor set optcolor purple global erasequeue set erasequeue " " # Variables global model global resolution global aperture global lens global dzoom global zoom global adjust global whitebalance global metering global lcdstate global colorstate global usb global lcd global color set opt_resolution "" set opt_model "" set opt_usb " " proc open_settings {} { \ destroy .opt toplevel .opt wm title .opt {settings} global optcolor .opt configure -background $optcolor frame .opt.command .opt.command configure -background $optcolor button .opt.command.ok -text {OK} -command ok_settings button .opt.command.apply -text {Apply} -command apply_settings button .opt.command.save -text {Save} -command save_settings button .opt.command.cancel -text {Cancel} -command cancel_settings pack .opt.command.ok -side left -padx 5 -pady 5 pack .opt.command.apply -side left -padx 5 -pady 5 pack .opt.command.save -side left -padx 5 -pady 5 pack .opt.command.cancel -side left -padx 5 -pady 5 frame .opt.b .opt.b configure -background $optcolor # ============================== model ======================================= global model global opt_model global usb global opt_usb set opt_model $model set opt_usb $usb frame .opt.model -relief sunken -borderwidth 2 menubutton .opt.model.menu -text {model} \ -menu {.opt.model.menu.sub} -relief raised menu .opt.model.menu.sub -tearoff {0} label .opt.model.label -textvariable opt_model .opt.model.menu.sub add command -command {setmodel "Coolpix-950"} -label {Coolpix-950} .opt.model.menu.sub add command -command {setmodel "Coolpix-990"} -label {Coolpix-990} .opt.model.menu.sub add command -command {setmodel "Coolpix-990-USB"} -label {Coolpix-990 USB} pack .opt.model.menu \ .opt.model.label \ -anchor s proc setmodel {arg} { global opt_model global opt_lens global opt_dzoom global opt_resolution global opt_usb set opt_model $arg if {$opt_model == "Coolpix-990-USB"} { set opt_usb "-u" } else { set opt_usb " " } if {$opt_model == "Coolpix-950"} { if {$opt_resolution == "3:2-Hi"} {set opt_resolution "Hi"} if {$opt_resolution == "3:2-Fine"} {set opt_resolution "Fine"} if {$opt_resolution == "3:2-Normal"} {set opt_resolution "Normal"} } else { set opt_lens Telephoto set opt_dzoom 1.0X } } # =========================== resolution ==================================== global resolution global opt_resolution set opt_resolution $resolution frame .opt.resolution -relief sunken -borderwidth 2 menubutton .opt.resolution.menu -text {resolution} \ -menu {.opt.resolution.menu.sub} -relief raised menu .opt.resolution.menu.sub -tearoff {0} label .opt.resolution.label -textvariable opt_resolution .opt.resolution.menu.sub add command -command {setres Hi} -label {Hi} .opt.resolution.menu.sub add command -command {setres Fine} -label {Fine} .opt.resolution.menu.sub add command -command {setres Normal} -label {Normal} .opt.resolution.menu.sub add command -command {setres Basic} -label {Basic} .opt.resolution.menu.sub add command -command {setres XGA-Fine} -label {XGA-Fine} .opt.resolution.menu.sub add command -command {setres XGA-Normal} -label {XGA-Normal} .opt.resolution.menu.sub add command -command {setres XGA-Basic} -label {XGA-Basic} .opt.resolution.menu.sub add command -command {setres VGA-Fine} -label {VGA-Fine} .opt.resolution.menu.sub add command -command {setres VGA-Normal} -label {VGA-Normal} .opt.resolution.menu.sub add command -command {setres VGA-Basic} -label {VGA-Basic} .opt.resolution.menu.sub add command -command {setres990 3:2-Hi} -label {3:2-Hi} .opt.resolution.menu.sub add command -command {setres990 3:2-Fine} -label {3:2-Fine} .opt.resolution.menu.sub add command -command {setres990 3:2-Normal} -label {3:2-Normal} pack .opt.resolution.menu \ .opt.resolution.label \ -anchor s proc setres {arg} { global opt_resolution set opt_resolution $arg } proc setres990 {arg} { global opt_model if {$opt_model != "Coolpix-950"} { global opt_resolution set opt_resolution $arg } } # =========================== aperture ==================================== global aperture global opt_aperture set opt_aperture $aperture frame .opt.b.aperture -relief sunken -borderwidth 2 menubutton .opt.b.aperture.menu -text {aperture} \ -menu {.opt.b.aperture.menu.sub} -relief raised menu .opt.b.aperture.menu.sub -tearoff {0} label .opt.b.aperture.label -textvariable opt_aperture .opt.b.aperture.menu.sub add command -command {setaper Auto} -label {Auto} .opt.b.aperture.menu.sub add command -command {setaper Hi} -label {Hi} .opt.b.aperture.menu.sub add command -command {setaper Med} -label {Med} .opt.b.aperture.menu.sub add command -command {setaper Lo} -label {Lo} pack .opt.b.aperture.menu \ .opt.b.aperture.label \ -anchor s proc setaper {arg} { global opt_aperture set opt_aperture $arg } # =========================== focus ======================================= global focus global opt_focus set opt_focus $focus frame .opt.b.focus -relief sunken -borderwidth 2 menubutton .opt.b.focus.menu -text {focus} \ -menu {.opt.b.focus.menu.sub} -relief raised menu .opt.b.focus.menu.sub -tearoff {0} label .opt.b.focus.label -textvariable opt_focus .opt.b.focus.menu.sub add command -command {setfocus Macro} -label {Macro} .opt.b.focus.menu.sub add command -command {setfocus Normal} -label {Normal} .opt.b.focus.menu.sub add command -command {setfocus Infinity} -label {Infinity} pack .opt.b.focus.menu \ .opt.b.focus.label \ -anchor s proc setfocus {arg} { global opt_focus set opt_focus $arg } # =========================== lens ==================================== global lens global opt_lens set opt_lens $lens frame .opt.lens -relief sunken -borderwidth 2 menubutton .opt.lens.menu -text {lens} \ -menu {.opt.lens.menu.sub} -relief raised menu .opt.lens.menu.sub -tearoff {0} label .opt.lens.label -textvariable opt_lens .opt.lens.menu.sub add command -command {setlens Telephoto} -label {Telephoto} .opt.lens.menu.sub add command -command {setlens Wide} -label {Wide} .opt.lens.menu.sub add command -command {setlens Fisheye} -label {Fisheye} pack .opt.lens.menu \ .opt.lens.label \ -anchor s proc setlens {arg} { global opt_model if {$opt_model != "Coolpix-950"} {set arg Telephoto} global opt_lens set opt_lens $arg } # =========================== dzoom ==================================== global dzoom global opt_dzoom set opt_dzoom $dzoom frame .opt.dzoom -relief sunken -borderwidth 2 menubutton .opt.dzoom.menu -text {dzoom} \ -menu {.opt.dzoom.menu.sub} -relief raised menu .opt.dzoom.menu.sub -tearoff {0} label .opt.dzoom.label -textvariable opt_dzoom .opt.dzoom.menu.sub add command -command {setdzoom 1.0X} -label {1.0X} .opt.dzoom.menu.sub add command -command {setdzoom 1.25X} -label {1.25X} .opt.dzoom.menu.sub add command -command {setdzoom 1.6X} -label {1.6X} .opt.dzoom.menu.sub add command -command {setdzoom 2.0X} -label {2.0X} .opt.dzoom.menu.sub add command -command {setdzoom 2.5X} -label {2.5X} pack .opt.dzoom.menu \ .opt.dzoom.label \ -anchor s proc setdzoom {arg} { global opt_model if {$opt_model != "Coolpix-950"} {set arg 1.0X} global opt_dzoom set opt_dzoom $arg } # =========================== zoom ====================================== global zoom global opt_zoom set opt_zoom $zoom global llimit frame .opt.b.zoom -relief raised -borderwidth 2 scale .opt.b.zoom.value -command {setzoom} -variable opt_zoom -from 7.2 -to 23.1 \ -resolution 0.1 -length 160 -orient horizontal -state normal -label {optical zoom (mm)} pack .opt.b.zoom.value .opt.b.zoom .opt.b.zoom.value set $zoom proc setzoom {arg} { global opt_zoom global opt_model if {$opt_model == "Coolpix-950"} { if {$arg > 20.0} {set arg 20.0} } else { if {$arg < 8.2} {set arg 8.2} } set opt_zoom $arg } # =========================== exposure ================================== global exposure global opt_exposure set opt_exposure $exposure frame .opt.b.exposure -relief raised -borderwidth 2 scale .opt.b.exposure.value -command {setexposure} -from -2.0 -to 2.0\ -resolution 0.1 -length 82 -orient horizontal -state normal -label {exposure} pack .opt.b.exposure.value .opt.b.exposure .opt.b.exposure.value set $exposure proc setexposure {arg} { global opt_exposure set opt_exposure $arg } # =========================== shutter ==================================== global shutter global opt_shutter set opt_shutter $shutter frame .opt.b.shutter -relief raised -borderwidth 2 label .opt.b.shutter.label -text "shutter (usec or 1/n sec)" entry .opt.b.shutter.value -width 10 -textvariable opt_shutter pack .opt.b.shutter.label .opt.b.shutter.value .opt.b.shutter # =========================== flash ==================================== global flash global opt_flash set opt_flash $flash frame .opt.b.flash -relief sunken -borderwidth 2 menubutton .opt.b.flash.menu -text {flash} \ -menu {.opt.b.flash.menu.sub} -relief raised menu .opt.b.flash.menu.sub -tearoff {0} label .opt.b.flash.label -textvariable opt_flash .opt.b.flash.menu.sub add command -command {setflash Auto} -label {Auto} .opt.b.flash.menu.sub add command -command {setflash Force} -label {Force} .opt.b.flash.menu.sub add command -command {setflash Off} -label {Off} .opt.b.flash.menu.sub add command -command {setflash AntiRedeye} -label {AntiRedeye} .opt.b.flash.menu.sub add command -command {setflash SlowSync} -label {SlowSync} pack .opt.b.flash.menu \ .opt.b.flash.label \ -anchor s proc setflash {arg} { global opt_flash set opt_flash $arg } # =========================== adjust ==================================== global adjust global opt_adjust set opt_adjust $adjust frame .opt.adjust -relief sunken -borderwidth 2 menubutton .opt.adjust.menu -text {adjust} \ -menu {.opt.adjust.menu.sub} -relief raised menu .opt.adjust.menu.sub -tearoff {0} label .opt.adjust.label -textvariable opt_adjust .opt.adjust.menu.sub add command -command {setadjust Standard} -label {Standard} .opt.adjust.menu.sub add command -command {setadjust Contrast+} -label {Contrast+} .opt.adjust.menu.sub add command -command {setadjust Contrast-} -label {Contrast-} .opt.adjust.menu.sub add command -command {setadjust Lighten} -label {Lighten} .opt.adjust.menu.sub add command -command {setadjust Darken} -label {Darken} pack .opt.adjust.menu \ .opt.adjust.label \ -anchor s proc setadjust {arg} { global opt_adjust set opt_adjust $arg } # =========================== whitebalance ==================================== global whitebalance global opt_whitebalance set opt_whitebalance $whitebalance frame .opt.whitebalance -relief sunken -borderwidth 2 menubutton .opt.whitebalance.menu -text {white balance} \ -menu {.opt.whitebalance.menu.sub} -relief raised menu .opt.whitebalance.menu.sub -tearoff {0} label .opt.whitebalance.label -textvariable opt_whitebalance .opt.whitebalance.menu.sub add command -command {setwhitebalance Auto} -label {Auto} .opt.whitebalance.menu.sub add command -command {setwhitebalance Sunny} -label {Sunny} .opt.whitebalance.menu.sub add command -command {setwhitebalance Incandescent} -label {Incandescent} .opt.whitebalance.menu.sub add command -command {setwhitebalance Fluorescent} -label {Fluorescent} .opt.whitebalance.menu.sub add command -command {setwhitebalance Flash} -label {Flash} .opt.whitebalance.menu.sub add command -command {setwhitebalance Preset} -label {Preset} .opt.whitebalance.menu.sub add command -command {setwhitebalance Cloudy} -label {Cloudy} pack .opt.whitebalance.menu \ .opt.whitebalance.label \ -anchor s proc setwhitebalance {arg} { global opt_whitebalance set opt_whitebalance $arg } # =========================== metering ==================================== global metering global opt_metering set opt_metering $metering frame .opt.metering -relief sunken -borderwidth 2 menubutton .opt.metering.menu -text {metering} \ -menu {.opt.metering.menu.sub} -relief raised menu .opt.metering.menu.sub -tearoff {0} label .opt.metering.label -textvariable opt_metering .opt.metering.menu.sub add command -command {setmetering Center} -label {Center} .opt.metering.menu.sub add command -command {setmetering Spot} -label {Spot} .opt.metering.menu.sub add command -command {setmetering Matrix} -label {Matrix} pack .opt.metering.menu \ .opt.metering.label \ -anchor s proc setmetering {arg} { global opt_metering set opt_metering $arg } # ============================ lcd =========================================== global lcdstate global opt_lcdstate set opt_lcdstate $lcdstate frame .opt.b.lcd -relief raised -borderwidth 2 checkbutton .opt.b.lcd.button -text {LCD} -variable opt_lcdstate pack .opt.b.lcd.button # ======================= color ============================== global colorstate global opt_colorstate set opt_colorstate $colorstate frame .opt.b.color -relief raised -borderwidth 2 checkbutton .opt.b.color.button -text {Color} -variable opt_colorstate pack .opt.b.color.button # ======================= erase ============================== global erase global opt_erase set opt_erase 0 frame .opt.erase -relief raised -borderwidth 2 checkbutton .opt.erase.button -text {Erase} -variable opt_erase pack .opt.erase.button # ======================= download ============================== global download global opt_download set opt_download 0 frame .opt.download -relief raised -borderwidth 2 checkbutton .opt.download.button -text {Download Card} -variable opt_download pack .opt.download.button pack .opt.command -side bottom pack .opt.b.zoom -side left -padx 5 -pady 5 pack .opt.b.exposure -side left -padx 5 -pady 5 pack .opt.b.shutter -side left -padx 5 -pady 5 pack .opt.b.aperture -side left -padx 5 -pady 5 pack .opt.b.focus -side left -padx 5 -pady 5 pack .opt.b.flash -side left -padx 5 -pady 5 pack .opt.b -side bottom pack .opt.b.lcd -side left -padx 5 -pady 5 pack .opt.b.color -side left -padx 5 -pady 5 pack .opt.model -side left -padx 5 -pady 5 pack .opt.resolution -side left -padx 5 -pady 5 pack .opt.lens -side left -padx 5 -pady 5 pack .opt.dzoom -side left -padx 5 -pady 5 pack .opt.adjust -side left -padx 5 -pady 5 pack .opt.whitebalance -side left -padx 5 -pady 5 pack .opt.metering -side left -padx 5 -pady 5 pack .opt.download -side left -padx 5 -pady 5 pack .opt.erase -side left -padx 5 -pady 5 } proc init {} \ { global model global resolution global lens global dzoom global adjust global whitebalance global metering global lcd global color global zoom global shutter global aperture global focus global flash global exposure global usb global lcdstate global colorstate global erasequeue global initstate setlcd $lcdstate setcolor $colorstate if {$exposure >= 0.0} { set exposurecmd "exposure+" set exposureval [expr $exposure*10] } else { set exposurecmd "exposure-" set exposureval [expr -$exposure*10] } if {$shutter == 0} { set shutterval "Auto" } else { set shutterval $shutter } if {$model != "Coolpix-950" && $lcdstate == 1} { exec photopc -q $usb adjust $adjust whitebalance $whitebalance \ metering $metering resolution VGA-Basic color $color \ shutter $shutterval \ $exposurecmd $exposureval mode $lcd \ focus Macro focus $focus zoom $zoom flash Off $erasequeue resetlcd set erasequeue "eraselast" } else { exec photopc -q $usb adjust $adjust whitebalance $whitebalance \ metering $metering resolution VGA-Basic color $color \ shutter $shutterval aperture $aperture \ $exposurecmd $exposureval flash $flash \ focus Macro focus $focus zoom $zoom dzoom $lens dzoom $dzoom $erasequeue mode $lcd set erasequeue " " } set initstate 1 } proc apply_settings {} \ { global model global resolution global lens global dzoom global adjust global whitebalance global metering global lcdstate global colorstate global zoom global shutter global aperture global focus global flash global exposure global usb global opt_model global opt_resolution global opt_lens global opt_dzoom global opt_adjust global opt_whitebalance global opt_metering global opt_lcdstate global opt_colorstate global opt_zoom global opt_shutter global opt_aperture global opt_focus global opt_flash global opt_exposure global opt_usb global opt_lcdstate global opt_colorstate global opt_erase global opt_download global erasequeue set model $opt_model set resolution $opt_resolution set lens $opt_lens set dzoom $opt_dzoom set adjust $opt_adjust set whitebalance $opt_whitebalance set metering $opt_metering set lcdstate $opt_lcdstate set colorstate $opt_colorstate set zoom $opt_zoom set shutter $opt_shutter set aperture $opt_aperture set focus $opt_focus set flash $opt_flash set exposure $opt_exposure set usb $opt_usb if {$opt_erase && $opt_download == 0} { set erasequeue "eraseall" set opt_erase 0 } init if {$opt_download} { global eraseall if {$opt_erase} { set eraseall "eraseall" set opt_erase 0 } else { set eraseall " " } if {$model != "Coolpix-950" && $lcdstate == 1} { exec sh -c "photopc $usb $erasequeue image All . $eraseall resetlcd" & set erasequeue "eraselast" } else { exec sh -c "photopc $usb $erasequeue image All . $eraseall" & set erasequeue " " } set opt_download 0 } } proc expose {arg} \ { global model global lcdstate global flash global aperture global erasequeue global resolution global dzoom global lcd global usb global imagename if {$model != "Coolpix-950" && $lcdstate == 1} { exec sh -c "photopc $usb dzoom 1.0X flash $flash aperture $aperture $erasequeue resolution $resolution snapshot image last $imagename.jpg eraselast dzoom $dzoom flash Off resetlcd; xv $arg $imagename.jpg" &; set erasequeue "eraselast" } else { exec sh -c "photopc $usb dzoom 1.0X $erasequeue resolution $resolution snapshot image last $imagename.jpg eraselast dzoom $dzoom mode $lcd; xv $arg $imagename.jpg" &; set erasequeue " " } } proc ok_settings {} \ { apply_settings destroy .opt } proc cancel_settings {} \ { destroy .opt } proc save_settings {} \ { global initfile global opt_model global opt_resolution global opt_lens global opt_dzoom global opt_adjust global opt_whitebalance global opt_metering global opt_lcdstate global opt_colorstate global opt_zoom global opt_shutter global opt_aperture global opt_focus global opt_flash global opt_exposure global opt_usb write_file $initfile \ "set model $opt_model" \ "set resolution $opt_resolution" \ "set lens $opt_lens"\ "set dzoom $opt_dzoom"\ "set adjust $opt_adjust"\ "set whitebalance $opt_whitebalance"\ "set metering $opt_metering"\ "set lcdstate $opt_lcdstate"\ "set colorstate $opt_colorstate"\ "set zoom $opt_zoom"\ "set shutter $opt_shutter"\ "set aperture $opt_aperture"\ "set focus $opt_focus"\ "set flash $opt_flash"\ "set exposure $opt_exposure"\ "set usb $opt_usb" } proc reset {} \ { defaults init } proc defaults {} \ { global initfile global model global resolution global lens global dzoom global adjust global whitebalance global metering global lcdstate global colorstate global zoom global shutter global aperture global focus global flash global exposure global usb # Default parameter values set model Coolpix-990-USB set resolution Fine set lens Telephoto set adjust Standard set whitebalance Auto set metering Center set dzoom 1.0X set lcdstate 1 set colorstate 1 set zoom 23.1 set shutter 0 set aperture Auto set focus Infinity set flash Off set exposure 0 set usb "-u" if {[file exists $initfile]} {source $initfile} } proc setlcd {arg} { global lcd if {$arg} {set lcd Record} else {set lcd Off} } proc setcolor {arg} { global color if {$arg} {set color On} else {set color Off} } # =========================== init ==================================== frame .init .init configure -background $colour # =========================== options ==================================== frame .init.options -relief raised -borderwidth 2 button .init.options.button -text "OPTIONS" -relief flat \ -background $optcolor -command {open_settings} pack .init.options.button # =========================== reset ==================================== frame .init.reset -relief raised -borderwidth 2 button .init.reset.button -text "ON/RESET" -relief flat \ -background yellow -foreground black -command {reset} pack .init.reset.button # ============================ off ===================================== frame .init.off -relief raised -borderwidth 2 button .init.off.button -text "OFF" -relief flat \ -background red -foreground black -command {exec photopc -q $usb $erasequeue flash Auto color On dzoom 1.0X mode Off; set erasequeue " "} pack .init.off.button # =========================== preview ==================================== frame .init.preview -relief raised -borderwidth 2 button .init.preview.button -text "PREVIEW" -background orange -relief flat \ -command { \ if {$model != "Coolpix-990-USB" && $initstate == 0} {reset} if {$model == "Coolpix-990" && $lcdstate == 1} { exec photopc -q $usb preview - mode $lcd flash Off $erasequeue resetlcd | xv - &; set erasequeue "eraselast"} else { exec photopc -q $usb preview - | xv - &} } pack .init.preview.button # =========================== expose ==================================== frame .command .command configure -background $colour frame .command.expose -relief raised -borderwidth 2 button .command.expose.button -text "EXPOSE" -background green -relief flat \ -command {if {$initstate == 0} {reset}; expose ""} pack .command.expose.button # ============================ load ===================================== frame .command.load -relief raised -borderwidth 2 button .command.load.button -text "LOAD" -background salmon -relief flat \ -command { if {$filename != "" && $filename != "$imagename.jpg"} {exec cp $filename $imagename.jpg} if { [file exists $imagename.jpg] } { exec xv $imagename.jpg & set comment [exec rdjpgcom $imagename.jpg] } } pack .command.load.button # =========================== reverse ==================================== frame .command.reverse -relief raised -borderwidth 2 button .command.reverse.button -text "REVERSE" -background black -foreground green \ -relief flat \ -command {exec xv -rv $imagename.jpg &} # -command {if {$initstate == 0} {reset}; expose "-rv"} pack .command.reverse.button # =========================== movie ==================================== frame .init.movie -relief raised -borderwidth 2 button .init.movie.button -text "MOVIE" -background lightgreen -relief flat \ -command { \ if {$model == "Coolpix-990" && $lcdstate == 1} { exec sh -c "photopc $usb image last $imagename.mov resetlcd && xmovie $imagename.mov" & } else { exec sh -c "photopc $usb image last $imagename.mov && xmovie $imagename.mov" & } } pack .init.movie.button # =========================== save ==================================== frame .command.store -relief raised -borderwidth 2 global writeok button .command.store.button -text "STORE" -background magenta -relief flat \ -command { \ if {$filename != ""} { if { [file exists $filename] } {overwrite $filename} else {store $filename} } } proc store {filename} \ { global labelcolour global label global imagename global usefilename global comment exec sh -c "wrjpgcom -replace -comment '$comment' $imagename.jpg > $filename" if {$usefilename || $label != ""} { if {$usefilename} {set text $filename\n$label} else {set text $label} exec convert -quality 98 -font helvetica -pen $labelcolour -pointsize 20 -draw "text 1,1 '$text'" $filename $filename exec xv $filename &} } proc overwrite {filename} \ { destroy .ow toplevel .ow wm title .ow {} frame .ow.command set text "Overwrite $filename?" label .ow.command.store -text $text button .ow.command.ok -background green -text {OK} -command {store $filename; destroy .ow} button .ow.command.no -background red -text {NO} -command {destroy .ow} pack .ow.command.store -side top pack .ow.command.ok -side left -padx 20 -pady 10 pack .ow.command.no -side left -padx 20 -pady 10 pack .ow.command -side bottom } proc ok_write {} \ { set writeok 1 destroy .ow } proc no_write {} \ { set writeok 0 destroy .ow } pack .command.store.button # =========================== quit ==================================== frame .command.quit -relief raised -borderwidth 2 button .command.quit.button -text "QUIT" -relief flat -background cyan -command {exit} pack .command.quit.button defaults # =========================== model ==================================== frame .init.model label .init.model.label -textvariable model -background $colour pack .init.model.label frame .comment .comment configure -background $colour label .comment.text -background $colour -text "Comment: " entry .comment.name -background $colour -width 80 -textvariable comment pack .comment.text -side left pack .comment.name -side right frame .label menubutton .label.menu -background $colour -text {Label:} \ -menu {.label.menu.sub} -relief raised menu .label.menu.sub -tearoff {0} .label.menu.sub add command -background $colour -command {setcolour red $colour} -foreground red -label {Red} .label.menu.sub add command -background $colour -command {setcolour blue $colour} -foreground blue -label {Blue} .label.menu.sub add command -background $colour -command {setcolour magenta $colour} -foreground magenta -label {Magenta} .label.menu.sub add command -background $colour -command {setcolour black $colour} -foreground black -label {Black} .label.menu.sub add command -background black -command {setcolour green black} -foreground green -label {Green} .label.menu.sub add command -background black -command {setcolour yellow black} -foreground yellow -label {Yellow} .label.menu.sub add command -background black -command {setcolour cyan black} -foreground cyan -label {Cyan} .label.menu.sub add command -background black -command {setcolour white black} -foreground white -label {White} entry .label.name -background $colour -foreground $labelcolour -width 50 -textvariable label frame .file .file configure -background $colour entry .file.name -background $colour -foreground black -width 25 -textvariable filename menubutton .file.menu -background $colour -text {File:} \ -menu {.file.menu.sub} -relief raised menu .file.menu.sub -tearoff {0} .file.menu.sub add checkbutton -background $colour -label {Store File Name with Label} -variable usefilename pack .file.menu -side left pack .file.name -side left proc setcolour {arg backcol} { destroy .label.name global labelcolour global colour global label global usefilename set labelcolour $arg entry .label.name -background $backcol -foreground $labelcolour -width 50 -textvariable label pack .label.name } pack .label.menu -side left pack .label.name -side right pack .label.menu \ .label.name\ -anchor s pack .init.model -side top pack .init.reset -side left -padx 25 -pady 5 pack .init.off -side left -padx 25 -pady 5 pack .init.options -side left -padx 25 -pady 5 pack .init.movie -side left -padx 25 -pady 5 pack .init.preview -side left -padx 25 -pady 5 pack .command.expose -side left -padx 35 -pady 5 pack .command.reverse -side left -padx 10 -pady 5 pack .command.load -side left -padx 30 -pady 5 pack .command.store -side left -padx 30 -pady 5 pack .command.quit -side left -padx 35 -pady 5 pack .title pack .init -side top -padx 5 -pady 5 pack .command -side top -padx 5 -pady 5 pack .comment -side bottom -pady 5 pack .label -side right -padx 5 -pady 5 pack .file -side bottom -padx 5 -pady 5