#!/usr/bin/wishx -f # # xphoto: A simple graphical user interface for photopc-3.05J15 and the # Nikon Coolpix 950 (Firmware v1.3 or higher) and the # Nikon Coolpix 990 (Firmware v1.1 or higher) Digital Cameras # # Copyright (C) 2001 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. */ # ========================= configuration ================================= # Generally, only this section will need to be configured for your system. # Links to the jpeg, Imagemagick, and Quicktime utilities can be found on # http://www.math.ualberta.ca/imaging/ # Location of initialization file global initfile set initfile "~/.xphotorc" # Location of photopc global photopc set photopc "photopc" # Location of jpeg viewer global jpegviewer set jpegviewer "xv" # Location of jpeg viewer with reverse video (optional) global jpegreverse set jpegreverse "xv -rv" # Location of jpeg comment utility wrjpgcom global wrjpgcom set wrjpgcom "wrjpgcom" # Location of jpeg comment utility rdjpgcom global rdjpgcom set rdjpgcom "rdjpgcom" # Location of Quicktime movie player (movie must be taken manually) global quicktimeplayer set quicktimeplayer "xmovie" # Location of ImageMagick utility convert global convert set convert "convert" # It is normally not necessary to modify anything beyond this point. # =========================== title ==================================== set colour "lemon chiffon" . configure -background $colour frame .title -background $colour label .title.label -text { X P H O T O 3.1} -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 initstate set initstate 0 global optcolor set optcolor purple # Variables global model global resolution global aperture global lens global dzoom global zoom global adjust global whitebalance global metering global lcdstate global keepstate global transferstate global viewstate global colorstate global usb global lcd global keep global color global opt_resolution set opt_resolution " " proc open_options {} { \ destroy .opt toplevel .opt wm title .opt {options} global optcolor .opt configure -background $optcolor frame .opt.command .opt.command configure -background $optcolor button .opt.command.ok -text {OK} -command ok_options button .opt.command.apply -text {Apply} -command apply_options button .opt.command.save -text {Save} -command save_options button .opt.command.cancel -text {Cancel} -command cancel_options 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 frame .opt.c .opt.c configure -background $optcolor # ============================== model ======================================= global model global opt_model global usb set opt_model $model 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 # =========================== 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.aperture -relief sunken -borderwidth 2 menubutton .opt.aperture.menu -text {aperture} \ -menu {.opt.aperture.menu.sub} -relief raised menu .opt.aperture.menu.sub -tearoff {0} label .opt.aperture.label -textvariable opt_aperture .opt.aperture.menu.sub add command -command {setaper Auto} -label {Auto} .opt.aperture.menu.sub add command -command {setaper Hi} -label {Hi} .opt.aperture.menu.sub add command -command {setaper Med} -label {Med} .opt.aperture.menu.sub add command -command {setaper Lo} -label {Lo} pack .opt.aperture.menu \ .opt.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.focus -relief sunken -borderwidth 2 menubutton .opt.focus.menu -text {focus} \ -menu {.opt.focus.menu.sub} -relief raised menu .opt.focus.menu.sub -tearoff {0} label .opt.focus.label -textvariable opt_focus .opt.focus.menu.sub add command -command {setfocus Macro} -label {Macro} .opt.focus.menu.sub add command -command {setfocus Normal} -label {Normal} .opt.focus.menu.sub add command -command {setfocus Infinity} -label {Infinity} pack .opt.focus.menu \ .opt.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_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_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.4 \ -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 164 -orient horizontal -state normal -label {exposure adjust} 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 # ============================ count ===================================== global count global opt_count set opt_count $count frame .opt.b.count -relief raised -borderwidth 2 label .opt.b.count.label -text "count" entry .opt.b.count.value -width 10 -textvariable opt_count pack .opt.b.count.label .opt.b.count.value .opt.b.count # ============================ timer ===================================== global timer global opt_timer set opt_timer $timer frame .opt.b.timer -relief raised -borderwidth 2 label .opt.b.timer.label -text "timer (sec)" entry .opt.b.timer.value -width 10 -textvariable opt_timer pack .opt.b.timer.label .opt.b.timer.value .opt.b.timer # =========================== flash ==================================== global flash global opt_flash set opt_flash $flash frame .opt.flash -relief sunken -borderwidth 2 menubutton .opt.flash.menu -text {flash} \ -menu {.opt.flash.menu.sub} -relief raised menu .opt.flash.menu.sub -tearoff {0} label .opt.flash.label -textvariable opt_flash .opt.flash.menu.sub add command -command {setflash Auto} -label {Auto} .opt.flash.menu.sub add command -command {setflash Force} -label {Force} .opt.flash.menu.sub add command -command {setflash Off} -label {Off} .opt.flash.menu.sub add command -command {setflash AntiRedeye} -label {AntiRedeye} .opt.flash.menu.sub add command -command {setflash SlowSync} -label {SlowSync} pack .opt.flash.menu \ .opt.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.c.lcd -relief raised -borderwidth 2 checkbutton .opt.c.lcd.button -text {LCD} -variable opt_lcdstate pack .opt.c.lcd.button # ============================ keep =========================================== global keepstate global opt_keepstate set opt_keepstate $keepstate frame .opt.c.keep -relief raised -borderwidth 2 checkbutton .opt.c.keep.button -text {Keep} -variable opt_keepstate pack .opt.c.keep.button # ========================== transfer ========================================= global transferstate global opt_transferstate set opt_transferstate $transferstate frame .opt.c.transfer -relief raised -borderwidth 2 checkbutton .opt.c.transfer.button -text {Transfer} -variable opt_transferstate pack .opt.c.transfer.button # ========================== view ========================================= global viewstate global opt_viewstate set opt_viewstate $viewstate frame .opt.c.view -relief raised -borderwidth 2 checkbutton .opt.c.view.button -text {Auto view} -variable opt_viewstate pack .opt.c.view.button # ======================= color ============================== global colorstate global opt_colorstate set opt_colorstate $colorstate frame .opt.c.color -relief raised -borderwidth 2 checkbutton .opt.c.color.button -text {Color} -variable opt_colorstate pack .opt.c.color.button # ======================= erase ============================== global erase global opt_erase set opt_erase 0 frame .opt.c.erase -relief raised -borderwidth 2 checkbutton .opt.c.erase.button -text {Erase card} -variable opt_erase pack .opt.c.erase.button # ======================= download ============================== global download global opt_download set opt_download 0 frame .opt.c.download -relief raised -borderwidth 2 checkbutton .opt.c.download.button -text {Download card} -variable opt_download pack .opt.c.download.button pack .opt.command -side bottom pack .opt.c.lcd -side left -padx 5 -pady 5 pack .opt.c.color -side left -padx 5 -pady 5 pack .opt.c.keep -side left -padx 5 -pady 5 pack .opt.c.transfer -side left -padx 5 -pady 5 pack .opt.c.view -side left -padx 5 -pady 5 pack .opt.c.download -side left -padx 5 -pady 5 pack .opt.c.erase -side left -padx 5 -pady 5 pack .opt.c -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.count -side left -padx 5 -pady 5 pack .opt.b.timer -side left -padx 5 -pady 5 pack .opt.b -side bottom 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.aperture -side left -padx 5 -pady 5 pack .opt.focus -side left -padx 5 -pady 5 pack .opt.flash -side left -padx 5 -pady 5 } proc init {} \ { global photopc global model global resolution global lens global dzoom global adjust global whitebalance global metering global lcd global color global zoom global shutter global count global timer global aperture global focus global flash global exposure global usb global lcdstate global keepstate global transferstate global viewstate global colorstate global initstate setmodel $model setlcd $lcdstate setkeep $keepstate 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 {$count <= 0} {set count 1} exec $photopc -q $usb adjust $adjust whitebalance $whitebalance \ metering $metering resolution $resolution color $color \ shutter $shutterval aperture $aperture \ $exposurecmd $exposureval flash $flash \ focus $focus zoom $zoom dzoom $lens dzoom $dzoom mode $lcd set initstate 1 } proc apply_options {} \ { global photopc global model global resolution global lens global dzoom global lcd global adjust global whitebalance global metering global lcdstate global keepstate global transferstate global viewstate global colorstate global zoom global shutter global count global timer 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_keepstate global opt_transferstate global opt_viewstate global opt_colorstate global opt_zoom global opt_shutter global opt_count global opt_timer global opt_aperture global opt_focus global opt_flash global opt_exposure global opt_lcdstate global opt_keepstate global opt_transferstate global opt_viewstate global opt_colorstate global opt_erase global opt_download 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 keepstate $opt_keepstate set transferstate $opt_transferstate set viewstate $opt_viewstate set colorstate $opt_colorstate set zoom $opt_zoom set shutter $opt_shutter set count $opt_count set timer $opt_timer set aperture $opt_aperture set focus $opt_focus set flash $opt_flash set exposure $opt_exposure init if {$opt_download} { system $photopc $usb image All . set opt_download 0 } if {$opt_erase} { exec $photopc $usb eraseall exec $photopc $usb mode $lcd set opt_erase 0 } } proc expose {} \ { global photopc global model global flash global aperture global resolution global dzoom global lcd global usb global imagename global jpegviewer global keep global transferstate global viewstate global count global timer global filename global opt_count variable total variable number variable file set total $count while {$count > 0} { if {$timer && ($count < $total || $total == 1)} { after [expr $timer*1000] update } set number [expr $total-$count] if {[regsub %d $filename $number file] == 0} { set file $imagename.jpg } variable rc if {$transferstate} { set rc [system $photopc $usb dzoom 1.0X snapshot \ image last $file $keep dzoom $dzoom mode $lcd] } else { set rc [system $photopc $usb dzoom 1.0X snapshot \ $keep dzoom $dzoom mode $lcd] } set count [expr $count-1] if {$rc == 0 && $transferstate && $viewstate} { exec $jpegviewer $file & } set opt_count $count update } set count $total set opt_count $count update } proc ok_options {} \ { apply_options destroy .opt } proc cancel_options {} \ { destroy .opt } proc save_options {} \ { 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_keepstate global opt_transferstate global opt_viewstate global opt_colorstate global opt_zoom global opt_shutter global opt_count global opt_timer global opt_aperture global opt_focus global opt_flash global opt_exposure set fd [open $initfile w] puts $fd "set model $opt_model" puts $fd "set resolution $opt_resolution" puts $fd "set lens $opt_lens" puts $fd "set dzoom $opt_dzoom" puts $fd "set adjust $opt_adjust" puts $fd "set whitebalance $opt_whitebalance" puts $fd "set metering $opt_metering" puts $fd "set lcdstate $opt_lcdstate" puts $fd "set keepstate $opt_keepstate" puts $fd "set transferstate $opt_transferstate" puts $fd "set viewstate $opt_viewstate" puts $fd "set colorstate $opt_colorstate" puts $fd "set zoom $opt_zoom" puts $fd "set shutter $opt_shutter" puts $fd "set count $opt_count" puts $fd "set timer $opt_timer" puts $fd "set aperture $opt_aperture" puts $fd "set focus $opt_focus" puts $fd "set flash $opt_flash" puts $fd "set exposure $opt_exposure" close $fd } 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 keepstate global transferstate global viewstate global colorstate global zoom global shutter global count global timer 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 keepstate 0 set transferstate 1 set viewstate 1 set colorstate 1 set zoom 23.4 set shutter 0 set count 1 set timer 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 setkeep {arg} { global keep if {$arg} {set keep " "} else {set keep "eraselast"} } proc setcolor {arg} { global color if {$arg} {set color On} else {set color Off} } proc setmodel {arg} { global opt_model global opt_resolution global usb set opt_model $arg if {$opt_model == "Coolpix-990-USB"} { set usb "-u" } else { set 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"} } } # =========================== 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_options} 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 dzoom Telephoto dzoom 1.0X adjust Standard \ whitebalance Auto metering Center aperture Auto focus Normal \ flash Auto exposure+ 0 shutter Auto color On mode Off } pack .init.off.button # =========================== preview ==================================== frame .init.preview -relief raised -borderwidth 2 button .init.preview.button -text "PREVIEW" -background orange -relief flat \ -command { \ exec $photopc -q $usb preview - | $jpegviewer - & } 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"} { variable file regsub %d $filename 0 file exec cp $file $imagename.jpg} if { [file exists $imagename.jpg] } { exec $jpegviewer $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 $jpegreverse $imagename.jpg &} pack .command.reverse.button # =========================== movie ==================================== frame .init.movie -relief raised -borderwidth 2 button .init.movie.button -text "MOVIE" -background lightgreen -relief flat \ -command { \ set rc [system $photopc $usb image last $imagename.mov] if {$rc == 0} {exec $quicktimeplayer $imagename.mov &} } pack .init.movie.button # =========================== store ==================================== frame .command.store -relief raised -borderwidth 2 global writeok button .command.store.button -text "STORE" -background magenta -relief flat \ -command { \ if {$filename != ""} { variable file regsub %d $filename 0 file if { [file exists $file] } {overwrite $file} else {store $file} } } proc store {file} \ { global labelcolour global label global imagename global usefilename global comment global jpegviewer global wrjpgcom global convert global resolution if {$resolution != "Hi"} { exec $wrjpgcom -replace -comment "$comment" $imagename.jpg > $file } else { if {$file != "$imagename.jpg"} { exec cp $imagename.jpg $file } } if {$usefilename || $label != ""} { if {$usefilename} {set text $file\n$label} else {set text $label} exec $convert -quality 98 -font helvetica -pen $labelcolour -pointsize 20 -draw "text 1,1 '$text'" $file $file exec $jpegviewer $file &} } proc overwrite {file} \ { destroy .ow toplevel .ow wm title .ow {} frame .ow.command set text "Overwrite $file?" label .ow.command.store -text $text button .ow.command.ok -background green -text {OK} -command {destroy .ow; store $file;} 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 setmodel $model # =========================== 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 25 -pady 5 pack .command.store -side left -padx 22 -pady 5 pack .command.load -side left -padx 30 -pady 5 pack .command.reverse -side left -padx 25 -pady 5 pack .command.quit -side left -padx 30 -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