#!/bin/sh # Bounce this Tcl/Tk script through sh(1) so we're not path-dependent. \ exec wish8.4 "$0" ${1+"$@"} ######################################################################## ## Global variables ######################################################################## set libDir "SETUPLIBDIR" set g_focalLength "50.0" set g_CoC "0.033" set g_previousUnit "m" set g_subjectDistance "1.0" set g_aperture "1.8" set g_filmFormat "35mm" ######################################################################## ## Pull in support code ######################################################################## if { ! [ file isdirectory $libDir ] } { puts "f/Calc does not appear to be installed correctly." puts "You may need to reinstall the program.\n" exit } package require Tix source "$libDir/LensMath.tcl" source "$libDir/Dialogs.tcl" ######################################################################## ## Global utility procedures ######################################################################## proc SuggestCoCListChange { name1 name2 op } { global g_CoC global g_filmFormat set g_CoC [ GetCoCForFormat $g_filmFormat ] } ######################################################################## ## Set up the program's UI ######################################################################## wm title . "f/Calc" wm resizable . 0 0 #### Set up the default fonts, if this is the Unix version of Tcl/Tk if { [ string match "unix" $tcl_platform(platform) ] } { font create Normal -family helvetica -size 10 font create Bold -family helvetica -size 10 -weight bold font create Txt -family courier -size 10 option add *font Normal option add *Text.font Txt option add *Listbox.font Normal option add *Entry.font Normal option add *Label.font Normal } #### Create the top-level containers tixNoteBook .noteBook -ipadx 6 -ipady 3 tixButtonBox .buttonBox -border 0 -pady 2 #### Add buttons to the box at the bottom of the window .buttonBox add about -text About -command ShowAboutDialog .buttonBox add help -text Help -command ShowHelp .buttonBox add exit -text Exit -underline 1 -command "exit" #### Display the main UI widgets pack .buttonBox -fill x -padx 5 -pady 2 -side bottom pack .noteBook -expand yes -fill both -padx 5 -pady 3 -side top #### Set up accelerator bindings bind all "exit" ######################################################################## ## Pull in the code that handles each tab ######################################################################## source "$libDir/fNumbers.tcl" source "$libDir/DoF.tcl" source "$libDir/Hyperfocal.tcl" source "$libDir/FoV.tcl" source "$libDir/AoV.tcl" source "$libDir/Magnification.tcl" source "$libDir/SpotMeter.tcl"