0000: 23 21 2f 62 69 6e 2f 73 68 0a 23 2d 2a 2d 74 63 #!/bin/sh.#-*-tc
0010: 6c 2d 2a 2d 0a 23 20 74 68 65 20 6e 65 78 74 20 l-*-.# the next
0020: 6c 69 6e 65 20 72 65 73 74 61 72 74 73 20 75 73 line restarts us
0030: 69 6e 67 20 77 69 73 68 20 5c 0a 65 78 65 63 20 ing wish \.exec
0040: 77 69 73 68 20 22 24 30 22 20 2d 2d 20 24 7b 31 wish "$0" -- ${1
0050: 2b 22 24 40 22 7d 0a 0a 73 65 74 20 63 6f 6d 6d +"$@"}..set comm
0060: 73 20 5b 6c 69 73 74 20 74 6b 42 75 74 74 6f 6e s [list tkButton
0070: 49 6e 76 6f 6b 65 20 74 6b 54 65 78 74 53 65 6c Invoke tkTextSel
0080: 65 63 74 54 6f 20 74 6b 45 6e 74 72 79 49 6e 73 ectTo tkEntryIns
0090: 65 72 74 20 74 6b 45 6e 74 72 79 42 61 63 6b 73 ert tkEntryBacks
00a0: 70 61 63 65 20 5c 0a 20 20 20 20 74 6b 5f 74 65 pace \. tk_te
00b0: 78 74 43 75 74 20 74 6b 5f 74 65 78 74 43 6f 70 xtCut tk_textCop
00c0: 79 20 74 6b 5f 74 65 78 74 50 61 73 74 65 20 74 y tk_textPaste t
00d0: 6b 5f 66 6f 63 75 73 4e 65 78 74 20 74 6b 5f 66 k_focusNext tk_f
00e0: 6f 63 75 73 50 72 65 76 20 74 6b 54 65 78 74 43 ocusPrev tkTextC
00f0: 6c 6f 73 65 73 74 47 61 70 20 5c 0a 20 20 20 20 losestGap \.
0100: 74 6b 54 65 78 74 41 75 74 6f 53 63 61 6e 20 74 tkTextAutoScan t
0110: 6b 43 61 6e 63 65 6c 52 65 70 65 61 74 20 74 6b kCancelRepeat tk
0120: 54 61 62 54 6f 57 69 6e 64 6f 77 5d 0a 0a 66 6f TabToWindow]..fo
0130: 72 65 61 63 68 20 69 20 24 63 6f 6d 6d 73 20 7b reach i $comms {
0140: 0a 20 20 20 20 61 75 74 6f 5f 6c 6f 61 64 20 24 . auto_load $
0150: 69 0a 20 20 20 20 69 66 20 7b 21 5b 6c 6c 65 6e i. if {![llen
0160: 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e gth [info comman
0170: 64 73 20 24 69 5d 5d 7d 20 7b 0a 09 74 6b 3a 3a ds $i]]} {..tk::
0180: 75 6e 73 75 70 70 6f 72 74 65 64 3a 3a 45 78 70 unsupported::Exp
0190: 6f 73 65 50 72 69 76 61 74 65 43 6f 6d 6d 61 6e osePrivateComman
01a0: 64 20 24 69 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 d $i. }.}..#
01b0: 24 49 64 3a 20 74 6b 64 69 66 66 2e 74 63 6c 2c $Id: tkdiff.tcl,
01c0: 76 20 31 2e 35 20 32 30 30 39 2d 30 33 2d 32 35 v 1.5 2009-03-25
01d0: 20 32 33 3a 34 37 3a 35 39 20 72 61 6d 73 61 6e 23:47:59 ramsan
01e0: 20 45 78 70 20 24 0a 0a 23 23 23 23 23 23 23 23 Exp $..########
01f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0200: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0210: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0220: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0230: 23 23 23 23 23 23 23 0a 23 0a 23 20 54 6b 44 69 #######.#.# TkDi
0240: 66 66 20 2d 2d 20 41 20 67 72 61 70 68 69 63 61 ff -- A graphica
0250: 6c 20 66 72 6f 6e 74 2d 65 6e 64 20 74 6f 20 64 l front-end to d
0260: 69 66 66 20 66 6f 72 20 55 6e 69 78 20 61 6e 64 iff for Unix and
0270: 20 57 69 6e 64 6f 77 73 2e 0a 23 20 43 6f 70 79 Windows..# Copy
0280: 72 69 67 68 74 20 28 43 29 20 31 39 39 34 2d 31 right (C) 1994-1
0290: 39 39 38 20 62 79 20 4a 6f 68 6e 20 4d 2e 20 4b 998 by John M. K
02a0: 6c 61 73 73 61 2e 0a 23 20 43 6f 70 79 72 69 67 lassa..# Copyrig
02b0: 68 74 20 28 43 29 20 31 39 39 39 2d 32 30 30 31 ht (C) 1999-2001
02c0: 20 62 79 20 41 63 63 75 52 65 76 20 49 6e 63 2e by AccuRev Inc.
02d0: 0a 23 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 .# Copyright (C)
02e0: 20 32 30 30 32 2d 32 30 30 35 20 62 79 20 4a 6f 2002-2005 by Jo
02f0: 68 6e 20 4d 2e 20 4b 6c 61 73 73 61 2e 0a 23 0a hn M. Klassa..#.
0300: 23 20 54 6b 44 69 66 66 20 48 6f 6d 65 20 50 61 # TkDiff Home Pa
0310: 67 65 3a 20 68 74 74 70 3a 2f 2f 74 6b 64 69 66 ge: http://tkdif
0320: 66 2e 73 6f 75 72 63 65 66 6f 72 67 65 2e 6e 65 f.sourceforge.ne
0330: 74 0a 23 0a 23 20 55 73 61 67 65 3a 20 20 73 65 t.#.# Usage: se
0340: 65 20 22 74 6b 64 69 66 66 20 2d 68 22 20 6f 72 e "tkdiff -h" or
0350: 20 22 74 6b 64 69 66 66 20 2d 2d 68 65 6c 70 22 "tkdiff --help"
0360: 0a 23 0a 23 20 54 68 69 73 20 70 72 6f 67 72 61 .#.# This progra
0370: 6d 20 69 73 20 66 72 65 65 20 73 6f 66 74 77 61 m is free softwa
0380: 72 65 3b 20 79 6f 75 20 63 61 6e 20 72 65 64 69 re; you can redi
0390: 73 74 72 69 62 75 74 65 20 69 74 20 61 6e 64 2f stribute it and/
03a0: 6f 72 20 6d 6f 64 69 66 79 0a 23 20 69 74 20 75 or modify.# it u
03b0: 6e 64 65 72 20 74 68 65 20 74 65 72 6d 73 20 6f nder the terms o
03c0: 66 20 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61 f the GNU Genera
03d0: 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 l Public License
03e0: 20 61 73 20 70 75 62 6c 69 73 68 65 64 20 62 79 as published by
03f0: 0a 23 20 74 68 65 20 46 72 65 65 20 53 6f 66 74 .# the Free Soft
0400: 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f 6e 3b ware Foundation;
0410: 20 65 69 74 68 65 72 20 76 65 72 73 69 6f 6e 20 either version
0420: 32 20 6f 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2 of the License
0430: 2c 20 6f 72 0a 23 20 28 61 74 20 79 6f 75 72 20 , or.# (at your
0440: 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c 61 74 65 option) any late
0450: 72 20 76 65 72 73 69 6f 6e 2e 0a 23 0a 23 20 54 r version..#.# T
0460: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 his program is d
0470: 69 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 istributed in th
0480: 65 20 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 e hope that it w
0490: 69 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 23 ill be useful,.#
04a0: 20 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 but WITHOUT ANY
04b0: 20 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f WARRANTY; witho
04c0: 75 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c ut even the impl
04d0: 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a ied warranty of.
04e0: 23 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 # MERCHANTABILIT
04f0: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 Y or FITNESS FOR
0500: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 A PARTICULAR PU
0510: 52 50 4f 53 45 2e 20 20 20 20 20 20 20 20 53 65 RPOSE. Se
0520: 65 20 74 68 65 0a 23 20 47 4e 55 20 47 65 6e 65 e the.# GNU Gene
0530: 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e ral Public Licen
0540: 73 65 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 se for more deta
0550: 69 6c 73 2e 0a 23 0a 23 20 59 6f 75 20 73 68 6f ils..#.# You sho
0560: 75 6c 64 20 68 61 76 65 20 72 65 63 65 69 76 65 uld have receive
0570: 64 20 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 d a copy of the
0580: 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c GNU General Publ
0590: 69 63 20 4c 69 63 65 6e 73 65 0a 23 20 61 6c 6f ic License.# alo
05a0: 6e 67 20 77 69 74 68 20 74 68 69 73 20 70 72 6f ng with this pro
05b0: 67 72 61 6d 3b 20 69 66 20 6e 6f 74 2c 20 77 72 gram; if not, wr
05c0: 69 74 65 20 74 6f 20 74 68 65 20 46 72 65 65 20 ite to the Free
05d0: 53 6f 66 74 77 61 72 65 0a 23 20 46 6f 75 6e 64 Software.# Found
05e0: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 ation, Inc., 59
05f0: 54 65 6d 70 6c 65 20 50 6c 61 63 65 2c 20 53 75 Temple Place, Su
0600: 69 74 65 20 33 33 30 2c 20 42 6f 73 74 6f 6e 2c ite 330, Boston,
0610: 20 4d 41 20 30 32 31 31 31 2d 31 33 30 37 20 55 MA 02111-1307 U
0620: 53 41 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 SA.#############
0630: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0640: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0650: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0660: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0670: 23 23 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 ##..package requ
0680: 69 72 65 20 54 6b 20 38 2e 30 0a 0a 23 20 43 68 ire Tk 8.0..# Ch
0690: 61 6e 67 65 20 74 6f 20 74 20 66 6f 72 20 74 72 ange to t for tr
06a0: 61 63 65 20 69 6e 66 6f 20 6f 6e 20 73 74 64 65 ace info on stde
06b0: 72 72 0a 73 65 74 20 67 28 64 65 62 75 67 29 20 rr.set g(debug)
06c0: 66 0a 0a 23 20 67 65 74 20 74 68 69 73 20 6f 75 f..# get this ou
06d0: 74 20 6f 66 20 74 68 65 20 77 61 79 20 2d 2d 20 t of the way --
06e0: 77 65 20 77 61 6e 74 20 74 6f 20 64 72 61 77 20 we want to draw
06f0: 74 68 65 20 77 68 6f 6c 65 20 75 73 65 72 20 69 the whole user i
0700: 6e 74 65 72 66 61 63 65 0a 23 20 62 65 68 69 6e nterface.# behin
0710: 64 20 74 68 65 20 73 63 65 6e 65 73 2c 20 74 68 d the scenes, th
0720: 65 6e 20 70 6f 70 20 75 70 20 69 6e 20 61 6c 6c en pop up in all
0730: 20 6f 66 20 69 74 73 20 77 65 6c 6c 2d 6c 61 69 of its well-lai
0740: 64 2d 6f 75 74 20 67 6c 6f 72 79 0a 73 65 74 20 d-out glory.set
0750: 73 63 72 65 65 6e 57 69 64 74 68 20 5b 77 69 6e screenWidth [win
0760: 66 6f 20 76 72 6f 6f 74 77 69 64 74 68 20 2e 5d fo vrootwidth .]
0770: 0a 73 65 74 20 73 63 72 65 65 6e 48 65 69 67 68 .set screenHeigh
0780: 74 20 5b 77 69 6e 66 6f 20 76 72 6f 6f 74 68 65 t [winfo vroothe
0790: 69 67 68 74 20 2e 5d 0a 77 6d 20 77 69 74 68 64 ight .].wm withd
07a0: 72 61 77 20 2e 0a 0a 23 20 73 65 74 20 61 20 63 raw ...# set a c
07b0: 6f 75 70 6c 65 20 6f 27 20 67 6c 6f 62 61 6c 73 ouple o' globals
07c0: 20 74 68 61 74 20 77 65 20 6d 69 67 68 74 20 6e that we might n
07d0: 65 65 64 20 73 6f 6f 6e 65 72 20 74 68 61 6e 20 eed sooner than
07e0: 6c 61 74 65 72 0a 73 65 74 20 67 28 6e 61 6d 65 later.set g(name
07f0: 29 20 22 54 6b 44 69 66 66 22 0a 73 65 74 20 67 ) "TkDiff".set g
0800: 28 76 65 72 73 69 6f 6e 29 20 22 34 2e 31 22 0a (version) "4.1".
0810: 73 65 74 20 67 28 73 74 61 72 74 65 64 29 20 30 set g(started) 0
0820: 0a 0a 23 20 46 49 58 4d 45 20 2d 20 6d 6f 76 65 ..# FIXME - move
0830: 20 74 6f 20 70 72 65 66 65 72 65 6e 63 65 73 0a to preferences.
0840: 6f 70 74 69 6f 6e 20 61 64 64 20 22 2a 54 65 61 option add "*Tea
0850: 72 4f 66 66 22 20 66 61 6c 73 65 20 31 30 30 0a rOff" false 100.
0860: 6f 70 74 69 6f 6e 20 61 64 64 20 22 2a 42 6f 72 option add "*Bor
0870: 64 65 72 57 69 64 74 68 22 20 31 20 31 30 30 0a derWidth" 1 100.
0880: 6f 70 74 69 6f 6e 20 61 64 64 20 22 2a 54 6f 6f option add "*Too
0890: 6c 54 69 70 2e 62 61 63 6b 67 72 6f 75 6e 64 22 lTip.background"
08a0: 20 4c 69 67 68 74 47 6f 6c 64 65 6e 72 6f 64 31 LightGoldenrod1
08b0: 0a 6f 70 74 69 6f 6e 20 61 64 64 20 22 2a 54 6f .option add "*To
08c0: 6f 6c 54 69 70 2e 66 6f 72 65 67 72 6f 75 6e 64 olTip.foreground
08d0: 22 20 62 6c 61 63 6b 0a 0a 23 20 64 65 74 65 72 " black..# deter
08e0: 6d 69 6e 65 20 74 68 65 20 77 69 6e 64 6f 77 69 mine the windowi
08f0: 6e 67 20 70 6c 61 74 66 6f 72 6d 2c 20 73 69 6e ng platform, sin
0900: 63 65 20 74 68 65 72 65 20 61 72 65 20 64 69 66 ce there are dif
0910: 66 65 72 65 6e 74 20 77 61 79 73 20 74 6f 0a 23 ferent ways to.#
0920: 20 64 6f 20 74 68 69 73 20 66 6f 72 20 64 69 66 do this for dif
0930: 66 65 72 65 6e 74 20 76 65 72 73 69 6f 6e 73 20 ferent versions
0940: 6f 66 20 74 63 6c 0a 69 66 20 7b 5b 63 61 74 63 of tcl.if {[catc
0950: 68 20 7b 74 6b 20 77 69 6e 64 6f 77 69 6e 67 73 h {tk windowings
0960: 79 73 74 65 6d 7d 20 67 28 77 69 6e 64 6f 77 69 ystem} g(windowi
0970: 6e 67 53 79 73 74 65 6d 29 5d 7d 20 7b 0a 20 20 ngSystem)]} {.
0980: 20 20 69 66 20 7b 22 24 3a 3a 74 63 6c 5f 70 6c if {"$::tcl_pl
0990: 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 atform(platform)
09a0: 22 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d 20 " == "windows"}
09b0: 7b 0a 09 73 65 74 20 67 28 77 69 6e 64 6f 77 69 {..set g(windowi
09c0: 6e 67 53 79 73 74 65 6d 29 20 22 77 69 6e 33 32 ngSystem) "win32
09d0: 22 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b ". } elseif {
09e0: 22 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d "$::tcl_platform
09f0: 28 70 6c 61 74 66 6f 72 6d 29 22 20 3d 3d 20 22 (platform)" == "
0a00: 75 6e 69 78 22 7d 20 7b 0a 09 73 65 74 20 67 28 unix"} {..set g(
0a10: 77 69 6e 64 6f 77 69 6e 67 53 79 73 74 65 6d 29 windowingSystem)
0a20: 20 22 78 31 31 22 0a 20 20 20 20 7d 20 65 6c 73 "x11". } els
0a30: 65 69 66 20 7b 22 24 3a 3a 74 63 6c 5f 70 6c 61 eif {"$::tcl_pla
0a40: 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 22 tform(platform)"
0a50: 20 3d 3d 20 22 6d 61 63 69 6e 74 6f 73 68 22 7d == "macintosh"}
0a60: 20 7b 0a 09 73 65 74 20 67 28 77 69 6e 64 6f 77 {..set g(window
0a70: 69 6e 67 53 79 73 74 65 6d 29 20 22 63 6c 61 73 ingSystem) "clas
0a80: 73 69 63 22 0a 20 20 20 20 7d 20 65 6c 73 65 20 sic". } else
0a90: 7b 0a 09 23 20 74 68 69 73 20 73 68 6f 75 6c 64 {..# this should
0aa0: 20 6e 65 76 65 72 20 68 61 70 70 65 6e 2c 20 62 never happen, b
0ab0: 75 74 20 6a 75 73 74 20 74 6f 20 62 65 20 73 75 ut just to be su
0ac0: 72 65 2e 2e 2e 0a 09 73 65 74 20 67 28 77 69 6e re.....set g(win
0ad0: 64 6f 77 69 6e 67 53 79 73 74 65 6d 29 20 22 78 dowingSystem) "x
0ae0: 31 31 22 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 64 11". }.}..# d
0af0: 65 74 65 72 6d 69 6e 65 20 74 68 65 20 6e 61 6d etermine the nam
0b00: 65 20 6f 66 20 74 68 65 20 74 65 6d 70 6f 72 61 e of the tempora
0b10: 72 79 20 64 69 72 65 63 74 6f 72 79 20 61 6e 64 ry directory and
0b20: 20 74 68 65 20 6e 61 6d 65 20 6f 66 0a 23 20 74 the name of.# t
0b30: 68 65 20 72 63 20 66 69 6c 65 2c 20 62 6f 74 68 he rc file, both
0b40: 20 6f 66 20 77 68 69 63 68 20 61 72 65 20 64 65 of which are de
0b50: 70 65 6e 64 65 6e 74 20 6f 6e 20 74 68 65 20 70 pendent on the p
0b60: 6c 61 74 66 6f 72 6d 2e 0a 23 20 54 68 69 73 20 latform..# This
0b70: 69 73 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 is overridden by
0b80: 20 74 68 65 20 70 72 65 66 65 72 65 6e 63 65 20 the preference
0b90: 69 6e 20 2e 74 6b 64 69 66 66 72 63 20 65 78 63 in .tkdiffrc exc
0ba0: 65 70 74 20 66 6f 72 20 74 68 65 20 76 65 72 79 ept for the very
0bb0: 20 66 69 72 73 74 0a 23 20 74 69 6d 65 20 79 6f first.# time yo
0bc0: 75 20 72 75 6e 0a 73 77 69 74 63 68 20 2d 2d 20 u run.switch --
0bd0: 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 $::tcl_platform(
0be0: 70 6c 61 74 66 6f 72 6d 29 20 7b 0a 77 69 6e 64 platform) {.wind
0bf0: 6f 77 73 20 7b 0a 09 69 66 20 7b 5b 69 6e 66 6f ows {..if {[info
0c00: 20 65 78 69 73 74 73 20 65 6e 76 28 54 45 4d 50 exists env(TEMP
0c10: 29 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f )]} {.. set o
0c20: 70 74 73 28 74 6d 70 64 69 72 29 20 5b 66 69 6c pts(tmpdir) [fil
0c30: 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 24 65 6e e nativename $en
0c40: 76 28 54 45 4d 50 29 5d 0a 09 7d 20 65 6c 73 65 v(TEMP)]..} else
0c50: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 70 74 73 {.. set opts
0c60: 28 74 6d 70 64 69 72 29 20 43 3a 2f 74 65 6d 70 (tmpdir) C:/temp
0c70: 0a 09 7d 0a 09 73 65 74 20 62 61 73 65 72 63 66 ..}..set basercf
0c80: 69 6c 65 20 22 5f 74 6b 64 69 66 66 2e 72 63 22 ile "_tkdiff.rc"
0c90: 0a 09 23 20 4e 61 74 69 76 65 20 6c 6f 6f 6b 20 ..# Native look
0ca0: 66 6f 72 20 74 6f 6f 6c 62 61 72 0a 09 73 65 74 for toolbar..set
0cb0: 20 6f 70 74 73 28 66 61 6e 63 79 42 75 74 74 6f opts(fancyButto
0cc0: 6e 73 29 20 31 0a 09 73 65 74 20 6f 70 74 73 28 ns) 1..set opts(
0cd0: 72 65 6c 69 65 66 29 20 66 6c 61 74 0a 20 20 20 relief) flat.
0ce0: 20 7d 0a 64 65 66 61 75 6c 74 20 7b 0a 09 69 66 }.default {..if
0cf0: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 65 {[info exists e
0d00: 6e 76 28 54 4d 50 44 49 52 29 5d 7d 20 7b 0a 09 nv(TMPDIR)]} {..
0d10: 20 20 20 20 73 65 74 20 6f 70 74 73 28 74 6d 70 set opts(tmp
0d20: 64 69 72 29 20 24 65 6e 76 28 54 4d 50 44 49 52 dir) $env(TMPDIR
0d30: 29 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 )..} else {..
0d40: 20 73 65 74 20 6f 70 74 73 28 74 6d 70 64 69 72 set opts(tmpdir
0d50: 29 20 2f 74 6d 70 0a 09 7d 0a 09 73 65 74 20 62 ) /tmp..}..set b
0d60: 61 73 65 72 63 66 69 6c 65 20 22 2e 74 6b 64 69 asercfile ".tkdi
0d70: 66 66 72 63 22 0a 09 23 20 4e 61 74 69 76 65 20 ffrc"..# Native
0d80: 6c 6f 6f 6b 20 66 6f 72 20 74 6f 6f 6c 62 61 72 look for toolbar
0d90: 0a 09 73 65 74 20 6f 70 74 73 28 66 61 6e 63 79 ..set opts(fancy
0da0: 42 75 74 74 6f 6e 73 29 20 30 0a 09 73 65 74 20 Buttons) 0..set
0db0: 6f 70 74 73 28 72 65 6c 69 65 66 29 20 72 61 69 opts(relief) rai
0dc0: 73 65 64 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 63 sed. }.}..# c
0dd0: 6f 6d 70 75 74 65 20 70 72 65 66 65 72 65 6e 63 ompute preferenc
0de0: 65 73 20 66 69 6c 65 20 6c 6f 63 61 74 69 6f 6e es file location
0df0: 2e 20 4e 6f 74 65 20 74 68 61 74 20 54 4b 44 49 . Note that TKDI
0e00: 46 46 52 43 20 63 61 6e 20 68 6f 6c 64 20 65 69 FFRC can hold ei
0e10: 74 68 65 72 0a 23 20 61 20 64 69 72 65 63 74 6f ther.# a directo
0e20: 72 79 20 6f 72 20 61 20 66 69 6c 65 2c 20 74 68 ry or a file, th
0e30: 6f 75 67 68 20 77 65 20 64 6f 63 75 6d 65 6e 74 ough we document
0e40: 20 69 74 20 61 73 20 62 65 69 6e 67 20 61 20 66 it as being a f
0e50: 69 6c 65 20 6e 61 6d 65 0a 69 66 20 7b 5b 69 6e ile name.if {[in
0e60: 66 6f 20 65 78 69 73 74 73 20 65 6e 76 28 54 4b fo exists env(TK
0e70: 44 49 46 46 52 43 29 5d 7d 20 7b 0a 20 20 20 20 DIFFRC)]} {.
0e80: 73 65 74 20 72 63 66 69 6c 65 20 24 65 6e 76 28 set rcfile $env(
0e90: 54 4b 44 49 46 46 52 43 29 0a 20 20 20 20 69 66 TKDIFFRC). if
0ea0: 20 7b 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 {[file isdirect
0eb0: 6f 72 79 20 24 72 63 66 69 6c 65 5d 7d 20 7b 0a ory $rcfile]} {.
0ec0: 09 73 65 74 20 72 63 66 69 6c 65 20 5b 66 69 6c .set rcfile [fil
0ed0: 65 20 6a 6f 69 6e 20 24 72 63 66 69 6c 65 20 24 e join $rcfile $
0ee0: 62 61 73 65 72 63 66 69 6c 65 5d 0a 20 20 20 20 basercfile].
0ef0: 7d 0a 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 }.} elseif {[inf
0f00: 6f 20 65 78 69 73 74 73 20 65 6e 76 28 48 4f 4d o exists env(HOM
0f10: 45 29 5d 7d 20 7b 0a 20 20 20 20 73 65 74 20 72 E)]} {. set r
0f20: 63 66 69 6c 65 20 5b 66 69 6c 65 20 6a 6f 69 6e cfile [file join
0f30: 20 24 65 6e 76 28 48 4f 4d 45 29 20 24 62 61 73 $env(HOME) $bas
0f40: 65 72 63 66 69 6c 65 5d 0a 7d 20 65 6c 73 65 20 ercfile].} else
0f50: 7b 0a 20 20 20 20 73 65 74 20 72 63 66 69 6c 65 {. set rcfile
0f60: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 22 2f 22 20 [file join "/"
0f70: 24 62 61 73 65 72 63 66 69 6c 65 5d 0a 7d 0a 0a $basercfile].}..
0f80: 23 20 54 72 79 20 74 6f 20 66 69 6e 64 20 61 20 # Try to find a
0f90: 70 6c 65 61 73 69 6e 67 20 6e 61 74 69 76 65 20 pleasing native
0fa0: 6c 6f 6f 6b 20 66 6f 72 20 65 61 63 68 20 70 6c look for each pl
0fb0: 61 74 66 6f 72 6d 2e 0a 23 20 46 6f 6e 74 73 2e atform..# Fonts.
0fc0: 0a 73 65 74 20 73 79 73 66 6f 6e 74 20 5b 66 6f .set sysfont [fo
0fd0: 6e 74 20 61 63 74 75 61 6c 20 73 79 73 74 65 6d nt actual system
0fe0: 5d 0a 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 73 ].#debug-info "s
0ff0: 79 73 74 65 6d 20 66 6f 6e 74 3a 20 24 73 79 73 ystem font: $sys
1000: 66 6f 6e 74 22 0a 0a 23 20 53 65 65 20 77 68 61 font"..# See wha
1010: 74 20 74 68 65 20 6e 61 74 69 76 65 20 6d 65 6e t the native men
1020: 75 20 66 6f 6e 74 20 69 73 0a 2e 20 63 6f 6e 66 u font is.. conf
1030: 69 67 75 72 65 20 2d 6d 65 6e 75 20 2e 6e 61 74 igure -menu .nat
1040: 69 76 65 0a 6d 65 6e 75 20 2e 6e 61 74 69 76 65 ive.menu .native
1050: 0a 73 65 74 20 6d 65 6e 75 66 6f 6e 74 20 5b 6c .set menufont [l
1060: 69 6e 64 65 78 20 5b 2e 6e 61 74 69 76 65 20 63 index [.native c
1070: 6f 6e 66 69 67 75 72 65 20 2d 66 6f 6e 74 5d 20 onfigure -font]
1080: 33 5d 0a 64 65 73 74 72 6f 79 20 2e 6e 61 74 69 3].destroy .nati
1090: 76 65 0a 0a 23 20 46 69 6e 64 20 6f 75 74 20 77 ve..# Find out w
10a0: 68 61 74 20 74 68 65 20 74 6b 20 64 65 66 61 75 hat the tk defau
10b0: 6c 74 20 69 73 0a 6c 61 62 65 6c 20 2e 74 65 73 lt is.label .tes
10c0: 74 6c 62 6c 20 2d 74 65 78 74 20 22 4c 41 42 45 tlbl -text "LABE
10d0: 4c 22 0a 73 65 74 20 6c 61 62 65 6c 66 6f 6e 74 L".set labelfont
10e0: 20 5b 66 6f 6e 74 20 61 63 74 75 61 6c 20 5b 6c [font actual [l
10f0: 69 6e 64 65 78 20 5b 2e 74 65 73 74 6c 62 6c 20 index [.testlbl
1100: 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f 6e 74 5d configure -font]
1110: 20 33 5d 5d 0a 64 65 73 74 72 6f 79 20 2e 74 65 3]].destroy .te
1120: 73 74 6c 62 6c 0a 0a 74 65 78 74 20 2e 74 65 73 stlbl..text .tes
1130: 74 74 65 78 74 0a 73 65 74 20 74 65 78 74 66 6f ttext.set textfo
1140: 6e 74 20 5b 66 6f 6e 74 20 61 63 74 75 61 6c 20 nt [font actual
1150: 5b 6c 69 6e 64 65 78 20 5b 2e 74 65 73 74 74 65 [lindex [.testte
1160: 78 74 20 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f xt configure -fo
1170: 6e 74 5d 20 33 5d 5d 0a 64 65 73 74 72 6f 79 20 nt] 3]].destroy
1180: 2e 74 65 73 74 74 65 78 74 0a 0a 65 6e 74 72 79 .testtext..entry
1190: 20 2e 74 65 73 74 65 6e 74 0a 73 65 74 20 77 28 .testent.set w(
11a0: 73 65 6c 63 6f 6c 6f 72 29 20 5b 6c 69 6e 64 65 selcolor) [linde
11b0: 78 20 5b 2e 74 65 73 74 65 6e 74 20 63 6f 6e 66 x [.testent conf
11c0: 69 67 75 72 65 20 2d 73 65 6c 65 63 74 62 61 63 igure -selectbac
11d0: 6b 67 72 6f 75 6e 64 5d 20 34 5d 0a 73 65 74 20 kground] 4].set
11e0: 65 6e 74 72 79 66 6f 6e 74 20 5b 6c 69 6e 64 65 entryfont [linde
11f0: 78 20 5b 2e 74 65 73 74 65 6e 74 20 63 6f 6e 66 x [.testent conf
1200: 69 67 75 72 65 20 2d 66 6f 6e 74 5d 20 33 5d 0a igure -font] 3].
1210: 64 65 73 74 72 6f 79 20 2e 74 65 73 74 65 6e 74 destroy .testent
1220: 0a 23 20 74 68 65 20 61 62 6f 76 65 20 72 65 73 .# the above res
1230: 75 6c 74 73 20 69 6e 20 61 20 6e 65 61 72 6c 79 ults in a nearly
1240: 20 75 6e 64 69 73 74 69 6e 67 75 69 73 68 61 62 undistinguishab
1250: 6c 65 20 64 61 72 6b 65 72 20 67 72 61 79 20 66 le darker gray f
1260: 6f 72 20 74 68 65 0a 23 20 73 65 6c 65 63 74 65 or the.# selecte
1270: 64 20 63 6f 6c 6f 72 20 28 72 68 38 20 77 69 74 d color (rh8 wit
1280: 68 20 74 6b 20 38 2e 33 2e 33 2d 37 34 29 20 22 h tk 8.3.3-74) "
1290: 23 63 33 63 33 63 33 22 0a 73 65 74 20 77 28 73 #c3c3c3".set w(s
12a0: 65 6c 63 6f 6c 6f 72 29 20 22 23 62 30 33 30 36 elcolor) "#b0306
12b0: 30 22 0a 0a 23 20 4d 61 6b 65 20 73 75 72 65 20 0"..# Make sure
12c0: 66 6f 6e 20 73 69 7a 65 20 69 73 20 73 70 65 63 fon size is spec
12d0: 69 66 69 65 64 20 69 6e 20 70 6f 69 6e 74 73 20 ified in points
12e0: 6e 6f 74 20 70 69 78 65 6c 73 2e 20 20 41 71 75 not pixels. Aqu
12f0: 61 54 6b 20 64 6f 65 73 6e 27 74 2e 0a 69 66 20 aTk doesn't..if
1300: 7b 21 20 5b 72 65 67 65 78 70 20 2d 2d 20 7b 2d {! [regexp -- {-
1310: 7d 20 24 6c 61 62 65 6c 66 6f 6e 74 5d 7d 20 7b } $labelfont]} {
1320: 0a 20 20 20 20 72 65 67 73 75 62 20 7b 20 28 5c . regsub { (\
1330: 64 2b 29 7d 20 24 6c 61 62 65 6c 66 6f 6e 74 20 d+)} $labelfont
1340: 7b 20 2d 5c 31 7d 20 6c 61 62 65 6c 66 6f 6e 74 { -\1} labelfont
1350: 0a 7d 0a 69 66 20 7b 21 20 5b 72 65 67 65 78 70 .}.if {! [regexp
1360: 20 2d 2d 20 7b 2d 7d 20 24 6d 65 6e 75 66 6f 6e -- {-} $menufon
1370: 74 5d 7d 20 7b 0a 20 20 20 20 72 65 67 73 75 62 t]} {. regsub
1380: 20 7b 20 28 5c 64 2b 29 7d 20 24 6d 65 6e 75 66 { (\d+)} $menuf
1390: 6f 6e 74 20 7b 20 2d 5c 31 7d 20 6d 65 6e 75 66 ont { -\1} menuf
13a0: 6f 6e 74 0a 7d 0a 69 66 20 7b 21 20 5b 72 65 67 ont.}.if {! [reg
13b0: 65 78 70 20 2d 2d 20 7b 2d 7d 20 24 74 65 78 74 exp -- {-} $text
13c0: 66 6f 6e 74 5d 7d 20 7b 0a 20 20 20 20 72 65 67 font]} {. reg
13d0: 73 75 62 20 7b 20 28 5c 64 2b 29 7d 20 24 74 65 sub { (\d+)} $te
13e0: 78 74 66 6f 6e 74 20 7b 20 2d 5c 31 7d 20 74 65 xtfont { -\1} te
13f0: 78 74 66 6f 6e 74 0a 7d 0a 69 66 20 7b 21 20 5b xtfont.}.if {! [
1400: 72 65 67 65 78 70 20 2d 2d 20 7b 2d 7d 20 24 65 regexp -- {-} $e
1410: 6e 74 72 79 66 6f 6e 74 5d 7d 20 7b 0a 20 20 20 ntryfont]} {.
1420: 20 72 65 67 73 75 62 20 7b 20 28 5c 64 2b 29 7d regsub { (\d+)}
1430: 20 24 65 6e 74 72 79 66 6f 6e 74 20 7b 20 2d 5c $entryfont { -\
1440: 31 7d 20 65 6e 74 72 79 66 6f 6e 74 0a 7d 0a 23 1} entryfont.}.#
1450: 64 65 62 75 67 2d 69 6e 66 6f 20 22 6d 65 6e 75 debug-info "menu
1460: 66 6f 6e 74 20 24 6d 65 6e 75 66 6f 6e 74 22 0a font $menufont".
1470: 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 6c 61 62 #debug-info "lab
1480: 65 6c 66 6f 6e 74 20 24 6c 61 62 65 6c 66 6f 6e elfont $labelfon
1490: 74 22 0a 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 t".#debug-info "
14a0: 74 65 78 74 66 6f 6e 74 20 24 74 65 78 74 66 6f textfont $textfo
14b0: 6e 74 22 0a 23 64 65 62 75 67 2d 69 6e 66 6f 20 nt".#debug-info
14c0: 22 65 6e 74 72 79 66 6f 6e 74 20 24 65 6e 74 72 "entryfont $entr
14d0: 79 66 6f 6e 74 22 0a 0a 73 65 74 20 66 6f 6e 74 yfont"..set font
14e0: 20 5b 6c 69 73 74 20 24 74 65 78 74 66 6f 6e 74 [list $textfont
14f0: 5d 0a 23 72 61 6d 73 61 6e 0a 23 73 65 74 20 62 ].#ramsan.#set b
1500: 6f 6c 64 20 5b 6c 69 73 74 20 5b 63 6f 6e 63 61 old [list [conca
1510: 74 20 24 74 65 78 74 66 6f 6e 74 20 62 6f 6c 64 t $textfont bold
1520: 5d 5d 0a 73 65 74 20 62 6f 6c 64 20 5b 6c 69 73 ]].set bold [lis
1530: 74 20 5b 63 6f 6e 63 61 74 20 24 74 65 78 74 66 t [concat $textf
1540: 6f 6e 74 20 2d 77 65 69 67 68 74 20 62 6f 6c 64 ont -weight bold
1550: 5d 5d 0a 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 ]].#debug-info "
1560: 66 6f 6e 74 3a 20 24 66 6f 6e 74 22 0a 23 64 65 font: $font".#de
1570: 62 75 67 2d 69 6e 66 6f 20 22 62 6f 6c 64 3a 20 bug-info "bold:
1580: 24 62 6f 6c 64 5c 6e 22 0a 6f 70 74 69 6f 6e 20 $bold\n".option
1590: 61 64 64 20 2a 4c 61 62 65 6c 2e 66 6f 6e 74 20 add *Label.font
15a0: 24 6c 61 62 65 6c 66 6f 6e 74 20 75 73 65 72 44 $labelfont userD
15b0: 65 66 61 75 6c 74 0a 6f 70 74 69 6f 6e 20 61 64 efault.option ad
15c0: 64 20 2a 42 75 74 74 6f 6e 2e 66 6f 6e 74 20 24 d *Button.font $
15d0: 6c 61 62 65 6c 66 6f 6e 74 20 75 73 65 72 44 65 labelfont userDe
15e0: 66 61 75 6c 74 0a 6f 70 74 69 6f 6e 20 61 64 64 fault.option add
15f0: 20 2a 4d 65 6e 75 2e 66 6f 6e 74 20 24 6d 65 6e *Menu.font $men
1600: 75 66 6f 6e 74 20 75 73 65 72 44 65 66 61 75 6c ufont userDefaul
1610: 74 0a 6f 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e t.option add *En
1620: 74 72 79 2e 66 6f 6e 74 20 24 65 6e 74 72 79 66 try.font $entryf
1630: 6f 6e 74 20 75 73 65 72 44 65 66 61 75 6c 74 0a ont userDefault.
1640: 0a 23 20 54 68 69 73 20 6d 61 6b 65 73 20 74 6b .# This makes tk
1650: 5f 6d 65 73 73 61 67 65 42 6f 78 20 75 73 65 20 _messageBox use
1660: 6f 75 72 20 66 6f 6e 74 2e 20 20 54 68 65 20 64 our font. The d
1670: 65 66 61 75 6c 74 20 74 65 6e 64 73 20 74 6f 20 efault tends to
1680: 62 65 20 74 65 72 72 69 62 6c 65 0a 23 20 6e 6f be terrible.# no
1690: 20 6d 61 74 74 65 72 20 77 68 61 74 20 70 6c 61 matter what pla
16a0: 74 66 6f 72 6d 0a 6f 70 74 69 6f 6e 20 61 64 64 tform.option add
16b0: 20 2a 44 69 61 6c 6f 67 2e 6d 73 67 2e 66 6f 6e *Dialog.msg.fon
16c0: 74 20 24 6c 61 62 65 6c 66 6f 6e 74 20 75 73 65 t $labelfont use
16d0: 72 44 65 66 61 75 6c 74 0a 0a 23 20 49 6e 69 74 rDefault..# Init
16e0: 69 61 6c 69 7a 65 20 61 72 72 61 79 73 0a 61 72 ialize arrays.ar
16f0: 72 61 79 20 73 65 74 20 67 20 7b 0a 20 20 20 20 ray set g {.
1700: 61 6e 63 66 69 6c 65 73 65 74 20 20 20 20 20 20 ancfileset
1710: 30 0a 20 20 20 20 63 6f 6e 66 6c 69 63 74 73 65 0. conflictse
1720: 74 20 20 20 20 20 30 0a 20 20 20 20 61 6e 63 66 t 0. ancf
1730: 69 6c 65 20 20 20 20 20 20 20 20 20 22 22 0a 20 ile "".
1740: 20 20 20 63 68 61 6e 67 65 66 69 6c 65 20 20 20 changefile
1750: 20 20 20 22 74 6b 64 69 66 66 2d 63 68 61 6e 67 "tkdiff-chang
1760: 65 2d 62 61 72 73 2e 6f 75 74 22 0a 20 20 20 20 e-bars.out".
1770: 64 65 73 74 72 6f 79 20 20 20 20 20 20 20 20 20 destroy
1780: 22 22 0a 20 20 20 20 69 67 6e 6f 72 65 5f 65 76 "". ignore_ev
1790: 65 6e 74 2c 31 20 20 30 0a 20 20 20 20 69 67 6e ent,1 0. ign
17a0: 6f 72 65 5f 65 76 65 6e 74 2c 32 20 20 30 0a 20 ore_event,2 0.
17b0: 20 20 20 69 67 6e 6f 72 65 5f 68 65 76 65 6e 74 ignore_hevent
17c0: 2c 31 20 30 0a 20 20 20 20 69 67 6e 6f 72 65 5f ,1 0. ignore_
17d0: 68 65 76 65 6e 74 2c 32 20 30 0a 20 20 20 20 69 hevent,2 0. i
17e0: 6e 69 74 4f 4b 20 20 20 20 20 20 20 20 20 20 30 nitOK 0
17f0: 0a 20 20 20 20 6d 61 70 62 6f 72 64 65 72 20 20 . mapborder
1800: 20 20 20 20 20 30 0a 20 20 20 20 6d 61 70 68 65 0. maphe
1810: 69 67 68 74 20 20 20 20 20 20 20 30 0a 20 20 20 ight 0.
1820: 20 6d 65 72 67 65 66 69 6c 65 20 20 20 20 20 20 mergefile
1830: 20 22 22 0a 20 20 20 20 72 65 74 75 72 6e 56 61 "". returnVa
1840: 6c 75 65 20 20 20 20 20 30 0a 20 20 20 20 73 68 lue 0. sh
1850: 6f 77 6d 65 72 67 65 20 20 20 20 20 20 20 30 0a owmerge 0.
1860: 20 20 20 20 73 74 61 72 74 65 64 20 20 20 20 20 started
1870: 20 20 20 20 30 0a 20 20 20 20 6d 65 72 67 65 66 0. mergef
1880: 69 6c 65 73 65 74 20 20 20 20 30 0a 20 20 20 20 ileset 0.
1890: 74 65 6d 70 66 69 6c 65 73 20 20 20 20 20 20 20 tempfiles
18a0: 22 22 0a 20 20 20 20 74 68 75 6d 62 4d 69 6e 48 "". thumbMinH
18b0: 65 69 67 68 74 20 20 31 30 0a 20 20 20 20 74 68 eight 10. th
18c0: 75 6d 62 48 65 69 67 68 74 20 20 20 20 20 31 30 umbHeight 10
18d0: 0a 20 20 20 20 74 68 75 6d 62 44 65 6c 74 61 59 . thumbDeltaY
18e0: 20 20 20 20 20 30 0a 7d 0a 0a 61 72 72 61 79 20 0.}..array
18f0: 73 65 74 20 66 69 6e 66 6f 20 7b 0a 20 20 20 20 set finfo {.
1900: 66 2c 31 20 20 20 20 20 20 20 20 20 20 22 22 0a f,1 "".
1910: 20 20 20 20 66 2c 32 20 20 20 20 20 20 20 20 20 f,2
1920: 20 22 22 0a 20 20 20 20 70 74 68 2c 31 20 20 20 "". pth,1
1930: 20 20 20 20 20 22 22 0a 20 20 20 20 70 74 68 2c "". pth,
1940: 32 20 20 20 20 20 20 20 20 22 22 0a 20 20 20 20 2 "".
1950: 72 65 76 73 2c 31 20 20 20 20 20 20 20 22 22 0a revs,1 "".
1960: 20 20 20 20 72 65 76 73 2c 32 20 20 20 20 20 20 revs,2
1970: 20 22 22 0a 20 20 20 20 6c 62 6c 2c 31 20 20 20 "". lbl,1
1980: 20 20 20 20 20 22 22 0a 20 20 20 20 6c 62 6c 2c "". lbl,
1990: 32 20 20 20 20 20 20 20 20 22 22 0a 20 20 20 20 2 "".
19a0: 75 73 65 72 6c 62 6c 2c 31 20 20 20 20 22 22 0a userlbl,1 "".
19b0: 20 20 20 20 75 73 65 72 6c 62 6c 2c 32 20 20 20 userlbl,2
19c0: 20 22 22 0a 20 20 20 20 74 69 74 6c 65 20 20 20 "". title
19d0: 20 20 20 20 20 7b 7d 0a 20 20 20 20 74 6d 70 2c {}. tmp,
19e0: 31 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 74 1 0. t
19f0: 6d 70 2c 32 20 20 20 20 20 20 20 20 30 0a 7d 0a mp,2 0.}.
1a00: 0a 23 20 54 68 65 73 65 20 6f 70 74 69 6f 6e 73 .# These options
1a10: 20 6d 61 79 20 62 65 20 63 68 61 6e 67 65 64 20 may be changed
1a20: 61 74 20 72 75 6e 74 69 6d 65 0a 61 72 72 61 79 at runtime.array
1a30: 20 73 65 74 20 6f 70 74 73 20 7b 0a 20 20 20 20 set opts {.
1a40: 61 75 74 6f 63 65 6e 74 65 72 20 20 20 20 20 20 autocenter
1a50: 20 20 31 0a 20 20 20 20 61 75 74 6f 73 65 6c 65 1. autosele
1a60: 63 74 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 ct 0.
1a70: 63 6f 6c 6f 72 63 62 73 20 20 20 20 20 20 20 20 colorcbs
1a80: 30 0a 20 20 20 20 63 75 73 74 6f 6d 43 6f 64 65 0. customCode
1a90: 20 20 20 20 20 20 20 20 7b 7d 0a 20 20 20 20 64 {}. d
1aa0: 69 66 66 63 6d 64 20 20 20 20 20 20 20 20 22 64 iffcmd "d
1ab0: 69 66 66 22 0a 20 20 20 20 69 67 6e 6f 72 65 62 iff". ignoreb
1ac0: 6c 61 6e 6b 73 6f 70 74 20 22 2d 62 22 0a 20 20 lanksopt "-b".
1ad0: 20 20 69 67 6e 6f 72 65 62 6c 61 6e 6b 73 20 30 ignoreblanks 0
1ae0: 0a 20 20 20 20 65 64 69 74 6f 72 20 20 20 20 20 . editor
1af0: 20 20 20 22 22 0a 20 20 20 20 67 65 6f 6d 65 74 "". geomet
1b00: 72 79 20 20 20 20 20 20 20 20 22 38 30 78 33 30 ry "80x30
1b10: 22 0a 20 20 20 20 73 68 6f 77 63 62 73 20 20 20 ". showcbs
1b20: 20 20 20 20 20 31 0a 20 20 20 20 73 68 6f 77 6c 1. showl
1b30: 6e 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 73 n 1. s
1b40: 68 6f 77 6d 61 70 20 20 20 20 20 20 20 20 31 0a howmap 1.
1b50: 20 20 20 20 73 68 6f 77 6c 69 6e 65 76 69 65 77 showlineview
1b60: 20 30 0a 20 20 20 20 73 68 6f 77 69 6e 6c 69 6e 0. showinlin
1b70: 65 31 20 30 0a 20 20 20 20 73 68 6f 77 69 6e 6c e1 0. showinl
1b80: 69 6e 65 32 20 31 0a 20 20 20 20 73 79 6e 63 73 ine2 1. syncs
1b90: 63 72 6f 6c 6c 20 20 20 20 20 20 20 20 31 0a 20 croll 1.
1ba0: 20 20 20 74 6f 6f 6c 62 61 72 49 63 6f 6e 73 20 toolbarIcons
1bb0: 31 0a 20 20 20 20 74 61 67 63 62 73 20 20 20 20 1. tagcbs
1bc0: 20 20 20 20 30 0a 20 20 20 20 74 61 67 6c 6e 20 0. tagln
1bd0: 20 20 20 20 20 20 20 30 0a 20 20 20 20 74 61 67 0. tag
1be0: 74 65 78 74 20 20 20 20 20 20 20 20 31 0a 20 20 text 1.
1bf0: 20 20 74 61 62 73 74 6f 70 73 20 20 20 20 38 0a tabstops 8.
1c00: 7d 0a 0a 23 20 72 65 70 6f 72 74 69 6e 67 20 6f }..# reporting o
1c10: 70 74 69 6f 6e 73 0a 61 72 72 61 79 20 73 65 74 ptions.array set
1c20: 20 72 65 70 6f 72 74 20 7b 0a 20 20 20 20 64 6f report {. do
1c30: 53 69 64 65 4c 65 66 74 20 20 20 20 20 20 20 20 SideLeft
1c40: 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 64 0. d
1c50: 6f 4c 69 6e 65 4e 75 6d 62 65 72 73 4c 65 66 74 oLineNumbersLeft
1c60: 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 64 1. d
1c70: 6f 43 68 61 6e 67 65 4d 61 72 6b 65 72 73 4c 65 oChangeMarkersLe
1c80: 66 74 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 ft 1.
1c90: 20 64 6f 54 65 78 74 4c 65 66 74 20 20 20 20 20 doTextLeft
1ca0: 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 1.
1cb0: 20 20 64 6f 53 69 64 65 52 69 67 68 74 20 20 20 doSideRight
1cc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 1.
1cd0: 20 20 20 20 64 6f 4c 69 6e 65 4e 75 6d 62 65 72 doLineNumber
1ce0: 73 52 69 67 68 74 20 20 20 20 20 20 20 20 20 31 sRight 1
1cf0: 0a 20 20 20 20 64 6f 43 68 61 6e 67 65 4d 61 72 . doChangeMar
1d00: 6b 65 72 73 52 69 67 68 74 20 31 0a 20 20 20 20 kersRight 1.
1d10: 64 6f 54 65 78 74 52 69 67 68 74 20 20 20 20 20 doTextRight
1d20: 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 1.
1d30: 20 20 66 69 6c 65 6e 61 6d 65 20 20 20 20 20 20 filename
1d40: 20 20 20 20 20 20 20 20 20 20 20 22 74 6b 64 69 "tkdi
1d50: 66 66 2e 6f 75 74 22 0a 7d 0a 0a 69 66 20 7b 5b ff.out".}..if {[
1d60: 73 74 72 69 6e 67 20 66 69 72 73 74 20 22 63 6f string first "co
1d70: 6c 6f 72 22 20 5b 77 69 6e 66 6f 20 76 69 73 75 lor" [winfo visu
1d80: 61 6c 20 2e 5d 5d 20 3e 3d 20 30 7d 20 7b 0a 20 al .]] >= 0} {.
1d90: 20 20 20 23 20 57 65 20 68 61 76 65 20 63 6f 6c # We have col
1da0: 6f 72 0a 20 20 20 20 23 20 28 62 75 74 2c 20 6c or. # (but, l
1db0: 65 74 27 73 20 6e 6f 74 20 67 6f 20 63 72 61 7a et's not go craz
1dc0: 79 2e 2e 2e 29 0a 0a 20 20 20 20 73 65 74 20 63 y...).. set c
1dd0: 6f 6c 6f 72 64 65 6c 20 54 6f 6d 61 74 6f 0a 20 olordel Tomato.
1de0: 20 20 20 73 65 74 20 63 6f 6c 6f 72 69 6e 73 20 set colorins
1df0: 50 61 6c 65 47 72 65 65 6e 0a 20 20 20 20 73 65 PaleGreen. se
1e00: 74 20 63 6f 6c 6f 72 63 68 67 20 44 6f 64 67 65 t colorchg Dodge
1e10: 72 42 6c 75 65 0a 0a 20 20 20 20 61 72 72 61 79 rBlue.. array
1e20: 20 73 65 74 20 6f 70 74 73 20 5b 73 75 62 73 74 set opts [subst
1e30: 20 7b 0a 09 74 65 78 74 6f 70 74 20 20 20 20 22 {..textopt "
1e40: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 77 68 69 74 -background whit
1e50: 65 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 62 6c e -foreground bl
1e60: 61 63 6b 20 2d 66 6f 6e 74 20 24 66 6f 6e 74 22 ack -font $font"
1e70: 0a 09 63 75 72 72 74 61 67 20 20 20 20 22 2d 62 ..currtag "-b
1e80: 61 63 6b 67 72 6f 75 6e 64 20 4b 68 61 6b 69 22 ackground Khaki"
1e90: 0a 09 64 69 66 66 74 61 67 20 20 20 20 22 2d 62 ..difftag "-b
1ea0: 61 63 6b 67 72 6f 75 6e 64 20 67 72 61 79 22 0a ackground gray".
1eb0: 09 64 65 6c 74 61 67 20 20 20 20 20 22 2d 62 61 .deltag "-ba
1ec0: 63 6b 67 72 6f 75 6e 64 20 24 63 6f 6c 6f 72 64 ckground $colord
1ed0: 65 6c 20 2d 66 6f 6e 74 20 24 62 6f 6c 64 22 0a el -font $bold".
1ee0: 09 69 6e 73 74 61 67 20 20 20 20 20 22 2d 62 61 .instag "-ba
1ef0: 63 6b 67 72 6f 75 6e 64 20 24 63 6f 6c 6f 72 69 ckground $colori
1f00: 6e 73 20 2d 66 6f 6e 74 20 24 62 6f 6c 64 22 0a ns -font $bold".
1f10: 09 63 68 67 74 61 67 20 20 20 20 20 22 2d 62 61 .chgtag "-ba
1f20: 63 6b 67 72 6f 75 6e 64 20 4c 69 67 68 74 53 74 ckground LightSt
1f30: 65 65 6c 42 6c 75 65 22 0a 09 6f 76 65 72 6c 61 eelBlue"..overla
1f40: 70 74 61 67 20 22 2d 62 61 63 6b 67 72 6f 75 6e ptag "-backgroun
1f50: 64 20 79 65 6c 6c 6f 77 22 0a 09 62 79 74 65 74 d yellow"..bytet
1f60: 61 67 20 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 ag "-backgrou
1f70: 6e 64 20 62 6c 75 65 20 2d 66 6f 72 65 67 72 6f nd blue -foregro
1f80: 75 6e 64 20 77 68 69 74 65 22 0a 09 69 6e 6c 69 und white"..inli
1f90: 6e 65 74 61 67 20 20 22 2d 62 61 63 6b 67 72 6f netag "-backgro
1fa0: 75 6e 64 20 24 63 6f 6c 6f 72 63 68 67 20 2d 66 und $colorchg -f
1fb0: 6f 6e 74 20 24 62 6f 6c 64 22 0a 09 2d 20 20 20 ont $bold"..-
1fc0: 20 20 20 20 20 20 20 22 2d 62 61 63 6b 67 72 6f "-backgro
1fd0: 75 6e 64 20 24 63 6f 6c 6f 72 64 65 6c 20 2d 66 und $colordel -f
1fe0: 6f 72 65 67 72 6f 75 6e 64 20 24 63 6f 6c 6f 72 oreground $color
1ff0: 69 6e 73 22 0a 09 2b 20 20 20 20 20 20 20 20 20 ins"..+
2000: 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 63 "-background $c
2010: 6f 6c 6f 72 69 6e 73 20 2d 66 6f 72 65 67 72 6f olorins -foregro
2020: 75 6e 64 20 24 63 6f 6c 6f 72 64 65 6c 22 0a 09 und $colordel"..
2030: 21 20 20 20 20 20 20 20 20 20 20 22 2d 62 61 63 ! "-bac
2040: 6b 67 72 6f 75 6e 64 20 24 63 6f 6c 6f 72 63 68 kground $colorch
2050: 67 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 24 63 g -foreground $c
2060: 6f 6c 6f 72 63 68 67 22 0a 09 3f 20 20 20 20 20 olorchg"..?
2070: 20 20 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e "-backgroun
2080: 64 20 79 65 6c 6c 6f 77 20 2d 66 6f 72 65 67 72 d yellow -foregr
2090: 6f 75 6e 64 20 79 65 6c 6c 6f 77 22 0a 09 6d 61 ound yellow"..ma
20a0: 70 69 6e 73 20 20 20 20 20 22 24 63 6f 6c 6f 72 pins "$color
20b0: 69 6e 73 22 0a 09 6d 61 70 64 65 6c 20 20 20 20 ins"..mapdel
20c0: 20 22 24 63 6f 6c 6f 72 64 65 6c 22 0a 09 6d 61 "$colordel"..ma
20d0: 70 63 68 67 20 20 20 20 20 22 24 63 6f 6c 6f 72 pchg "$color
20e0: 63 68 67 22 0a 20 20 20 20 7d 5d 0a 0a 7d 20 65 chg". }]..} e
20f0: 6c 73 65 20 7b 0a 20 20 20 20 23 20 41 73 73 75 lse {. # Assu
2100: 6d 65 20 6f 6e 6c 79 20 62 6c 61 63 6b 20 61 6e me only black an
2110: 64 20 77 68 69 74 65 0a 20 20 20 20 73 65 74 20 d white. set
2120: 62 67 20 22 62 6c 61 63 6b 22 0a 20 20 20 20 61 bg "black". a
2130: 72 72 61 79 20 73 65 74 20 6f 70 74 73 20 5b 73 rray set opts [s
2140: 75 62 73 74 20 7b 0a 09 74 65 78 74 6f 70 74 20 ubst {..textopt
2150: 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 "-background
2160: 77 68 69 74 65 20 2d 66 6f 72 65 67 72 6f 75 6e white -foregroun
2170: 64 20 62 6c 61 63 6b 20 2d 66 6f 6e 74 20 24 66 d black -font $f
2180: 6f 6e 74 22 0a 09 63 75 72 72 74 61 67 20 20 20 ont"..currtag
2190: 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 62 6c "-background bl
21a0: 61 63 6b 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 ack -foreground
21b0: 77 68 69 74 65 22 0a 09 64 69 66 66 74 61 67 20 white"..difftag
21c0: 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 "-background
21d0: 77 68 69 74 65 20 2d 66 6f 72 65 67 72 6f 75 6e white -foregroun
21e0: 64 20 62 6c 61 63 6b 20 2d 66 6f 6e 74 20 24 62 d black -font $b
21f0: 6f 6c 64 22 0a 09 64 65 6c 74 61 67 20 20 20 20 old"..deltag
2200: 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 62 6c "-background bl
2210: 61 63 6b 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 ack -foreground
2220: 77 68 69 74 65 22 0a 09 69 6e 73 74 61 67 20 20 white"..instag
2230: 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 "-background
2240: 62 6c 61 63 6b 20 2d 66 6f 72 65 67 72 6f 75 6e black -foregroun
2250: 64 20 77 68 69 74 65 22 0a 09 63 68 67 74 61 67 d white"..chgtag
2260: 20 20 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e "-backgroun
2270: 64 20 62 6c 61 63 6b 20 2d 66 6f 72 65 67 72 6f d black -foregro
2280: 75 6e 64 20 77 68 69 74 65 22 0a 09 6f 76 65 72 und white"..over
2290: 6c 61 70 74 61 67 20 22 2d 62 61 63 6b 67 72 6f laptag "-backgro
22a0: 75 6e 64 20 62 6c 61 63 6b 20 2d 66 6f 72 65 67 und black -foreg
22b0: 72 6f 75 6e 64 20 77 68 69 74 65 22 0a 09 62 79 round white"..by
22c0: 74 65 74 61 67 20 20 20 20 22 2d 75 6e 64 65 72 tetag "-under
22d0: 6c 69 6e 65 20 31 22 0a 09 69 6e 6c 69 6e 65 74 line 1"..inlinet
22e0: 61 67 20 20 22 2d 75 6e 64 65 72 6c 69 6e 65 20 ag "-underline
22f0: 31 22 0a 09 2d 20 20 20 20 20 20 20 20 20 20 22 1"..- "
2300: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 62 6c 61 63 -background blac
2310: 6b 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 77 68 k -foreground wh
2320: 69 74 65 22 0a 09 2b 20 20 20 20 20 20 20 20 20 ite"..+
2330: 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 62 6c "-background bl
2340: 61 63 6b 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 ack -foreground
2350: 77 68 69 74 65 22 0a 09 21 20 20 20 20 20 20 20 white"..!
2360: 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e 64 20 "-background
2370: 62 6c 61 63 6b 20 2d 66 6f 72 65 67 72 6f 75 6e black -foregroun
2380: 64 20 77 68 69 74 65 22 0a 09 3f 20 20 20 20 20 d white"..?
2390: 20 20 20 20 20 22 2d 62 61 63 6b 67 72 6f 75 6e "-backgroun
23a0: 64 20 62 6c 61 63 6b 20 2d 66 6f 72 65 67 72 6f d black -foregro
23b0: 75 6e 64 20 77 68 69 74 65 22 0a 09 6d 61 70 69 und white"..mapi
23c0: 6e 73 20 20 20 20 20 22 62 6c 61 63 6b 22 0a 09 ns "black"..
23d0: 6d 61 70 64 65 6c 20 20 20 20 20 22 62 6c 61 63 mapdel "blac
23e0: 6b 22 0a 09 6d 61 70 63 68 67 20 20 20 20 20 22 k"..mapchg "
23f0: 62 6c 61 63 6b 22 0a 20 20 20 20 7d 5d 0a 7d 0a black". }].}.
2400: 0a 23 20 6d 61 6b 65 20 73 75 72 65 20 77 72 61 .# make sure wra
2410: 70 70 69 6e 67 20 69 73 20 74 75 72 6e 65 64 20 pping is turned
2420: 6f 66 66 2e 20 54 68 69 73 20 6d 69 67 68 74 20 off. This might
2430: 70 69 73 73 20 6f 66 66 20 61 20 66 65 77 20 70 piss off a few p
2440: 65 6f 70 6c 65 2c 0a 23 20 62 75 74 20 69 74 20 eople,.# but it
2450: 77 6f 75 6c 64 20 73 63 72 65 77 20 75 70 20 74 would screw up t
2460: 68 65 20 64 69 73 70 6c 61 79 20 74 6f 20 68 61 he display to ha
2470: 76 65 20 74 68 69 6e 67 73 20 77 72 61 70 0a 73 ve things wrap.s
2480: 65 74 20 6f 70 74 73 28 74 65 78 74 6f 70 74 29 et opts(textopt)
2490: 20 22 24 6f 70 74 73 28 74 65 78 74 6f 70 74 29 "$opts(textopt)
24a0: 20 2d 77 72 61 70 20 6e 6f 6e 65 22 0a 0a 23 20 -wrap none"..#
24b0: 54 68 69 73 20 70 72 6f 63 20 69 73 20 75 73 65 This proc is use
24c0: 64 20 69 6e 20 74 68 65 20 72 63 20 66 69 6c 65 d in the rc file
24d0: 0a 70 72 6f 63 20 64 65 66 69 6e 65 20 7b 6e 61 .proc define {na
24e0: 6d 65 20 76 61 6c 75 65 7d 20 7b 0a 20 20 20 20 me value} {.
24f0: 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 20 global opts.
2500: 73 65 74 20 6f 70 74 73 28 24 6e 61 6d 65 29 20 set opts($name)
2510: 24 76 61 6c 75 65 0a 7d 0a 0a 23 20 53 6f 75 72 $value.}..# Sour
2520: 63 65 20 74 68 65 20 72 63 20 66 69 6c 65 2c 20 ce the rc file,
2530: 77 68 69 63 68 20 6d 61 79 20 6f 76 65 72 72 69 which may overri
2540: 64 65 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 64 de some of the d
2550: 65 66 61 75 6c 74 73 0a 23 20 41 6e 79 20 65 72 efaults.# Any er
2560: 72 6f 72 73 20 77 69 6c 6c 20 62 65 20 72 65 70 rors will be rep
2570: 6f 72 74 65 64 2e 20 42 65 66 6f 72 65 20 64 6f orted. Before do
2580: 69 6e 67 20 73 6f 2c 20 77 65 20 6e 65 65 64 20 ing so, we need
2590: 74 6f 20 64 65 66 69 6e 65 20 74 68 65 0a 23 20 to define the.#
25a0: 22 64 65 66 69 6e 65 22 20 70 72 6f 63 2c 20 77 "define" proc, w
25b0: 68 69 63 68 20 6c 65 74 73 20 74 68 65 20 72 63 hich lets the rc
25c0: 20 66 69 6c 65 20 68 61 76 65 20 61 20 73 6c 69 file have a sli
25d0: 67 68 74 6c 79 20 6d 6f 72 65 20 68 75 6d 61 6e ghtly more human
25e0: 2d 66 72 69 65 6e 64 6c 79 0a 23 20 69 6e 74 65 -friendly.# inte
25f0: 72 66 61 63 65 2e 20 4f 6c 64 2d 73 74 79 6c 65 rface. Old-style
2600: 20 2e 72 63 20 66 69 6c 65 73 20 73 68 6f 75 6c .rc files shoul
2610: 64 20 73 74 69 6c 6c 20 6c 6f 61 64 20 6a 75 73 d still load jus
2620: 74 20 66 69 6e 65 20 66 6f 72 20 6e 6f 77 2c 20 t fine for now,
2630: 74 68 6f 75 67 68 0a 23 20 69 74 20 6f 75 67 68 though.# it ough
2640: 74 20 74 6f 20 62 65 20 6e 6f 74 65 64 20 6e 65 t to be noted ne
2650: 77 20 2e 72 63 20 66 69 6c 65 73 20 77 6f 6e 27 w .rc files won'
2660: 74 20 62 65 20 61 62 6c 65 20 74 6f 20 62 65 20 t be able to be
2670: 70 72 6f 63 65 73 73 65 64 20 62 79 20 6f 6c 64 processed by old
2680: 65 72 0a 23 20 76 65 72 73 69 6f 6e 73 20 6f 66 er.# versions of
2690: 20 54 6b 44 69 66 66 2e 20 54 68 61 74 20 73 68 TkDiff. That sh
26a0: 6f 75 6c 64 6e 27 74 20 62 65 20 61 20 70 72 6f ouldn't be a pro
26b0: 62 6c 65 6d 2e 0a 69 66 20 7b 5b 66 69 6c 65 20 blem..if {[file
26c0: 65 78 69 73 74 73 20 24 72 63 66 69 6c 65 5d 7d exists $rcfile]}
26d0: 20 7b 0a 20 20 20 20 69 66 20 7b 5b 63 61 74 63 {. if {[catc
26e0: 68 20 7b 73 6f 75 72 63 65 20 24 72 63 66 69 6c h {source $rcfil
26f0: 65 7d 20 65 72 72 6f 72 5d 7d 20 7b 0a 09 73 65 e} error]} {..se
2700: 74 20 73 74 61 72 74 75 70 45 72 72 6f 72 20 5b t startupError [
2710: 6a 6f 69 6e 20 5b 6c 69 73 74 20 22 54 68 65 72 join [list "Ther
2720: 65 20 77 61 73 20 61 6e 20 65 72 72 6f 72 20 69 e was an error i
2730: 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 79 6f 75 n processing you
2740: 72 20 5c 0a 09 20 20 73 74 61 72 74 75 70 20 66 r \.. startup f
2750: 69 6c 65 2e 22 20 22 5c 6e 24 67 28 6e 61 6d 65 ile." "\n$g(name
2760: 29 20 77 69 6c 6c 20 73 74 69 6c 6c 20 72 75 6e ) will still run
2770: 2c 20 62 75 74 20 73 6f 6d 65 20 6f 66 20 79 6f , but some of yo
2780: 75 72 20 5c 0a 09 20 20 70 72 65 66 65 72 65 6e ur \.. preferen
2790: 63 65 73 22 20 22 5c 6e 6d 61 79 20 6e 6f 74 20 ces" "\nmay not
27a0: 62 65 20 69 6e 20 65 66 66 65 63 74 2e 22 20 22 be in effect." "
27b0: 5c 6e 5c 6e 46 69 6c 65 3a 20 24 72 63 66 69 6c \n\nFile: $rcfil
27c0: 65 22 20 5c 0a 09 20 20 22 5c 6e 45 72 72 6f 72 e" \.. "\nError
27d0: 3a 20 24 65 72 72 6f 72 22 5d 20 22 20 22 5d 0a : $error"] " "].
27e0: 20 20 20 20 7d 0a 7d 0a 0a 23 20 61 20 68 61 63 }.}..# a hac
27f0: 6b 20 74 6f 20 68 61 6e 64 6c 65 20 6f 6c 64 65 k to handle olde
2800: 72 20 70 72 65 66 65 72 65 6e 63 65 73 20 66 69 r preferences fi
2810: 6c 65 73 2e 2e 2e 0a 23 20 69 66 20 74 68 65 20 les....# if the
2820: 75 73 65 72 20 68 61 73 20 61 20 64 69 66 66 6f user has a diffo
2830: 70 74 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 pt defined in th
2840: 65 69 72 20 72 63 20 66 69 6c 65 2c 20 77 65 27 eir rc file, we'
2850: 6c 6c 20 6d 61 67 69 63 61 6c 6c 79 0a 23 20 63 ll magically.# c
2860: 6f 6e 76 65 72 74 20 74 68 61 74 20 74 6f 20 64 onvert that to d
2870: 69 66 66 63 6d 64 2e 2e 2e 0a 69 66 20 7b 5b 69 iffcmd....if {[i
2880: 6e 66 6f 20 65 78 69 73 74 73 20 6f 70 74 73 28 nfo exists opts(
2890: 64 69 66 66 6f 70 74 29 5d 7d 20 7b 0a 20 20 20 diffopt)]} {.
28a0: 20 73 65 74 20 6f 70 74 73 28 64 69 66 66 63 6d set opts(diffcm
28b0: 64 29 20 22 64 69 66 66 20 24 6f 70 74 73 28 64 d) "diff $opts(d
28c0: 69 66 66 6f 70 74 29 22 0a 7d 0a 0a 23 20 57 6f iffopt)".}..# Wo
28d0: 72 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 20 62 61 rk-around for ba
28e0: 64 20 66 6f 6e 74 20 61 70 70 72 6f 78 69 6d 61 d font approxima
28f0: 74 69 6f 6e 73 2c 0a 23 20 61 73 20 73 75 67 67 tions,.# as sugg
2900: 65 73 74 65 64 20 62 79 20 44 6f 6e 20 4c 69 62 ested by Don Lib
2910: 65 73 20 28 6c 69 62 65 73 40 6e 69 73 74 2e 67 es (libes@nist.g
2920: 6f 76 29 2e 0a 63 61 74 63 68 20 7b 74 6b 20 73 ov)..catch {tk s
2930: 63 61 6c 69 6e 67 20 5b 65 78 70 72 20 7b 31 30 caling [expr {10
2940: 30 2e 30 20 2f 20 37 32 7d 5d 7d 0a 0a 23 23 23 0.0 / 72}]}..###
2950: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2960: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2970: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2980: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2990: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 0a 23 ############.#.#
29a0: 20 48 45 52 45 20 42 45 47 49 4e 20 54 48 45 20 HERE BEGIN THE
29b0: 50 52 4f 43 53 0a 23 23 23 23 23 23 23 23 23 23 PROCS.##########
29c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a00: 23 23 23 23 23 0a 0a 23 23 23 23 23 23 23 23 23 #####..#########
2a10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a50: 23 23 23 23 23 23 0a 23 20 45 78 69 74 20 77 69 ######.# Exit wi
2a60: 74 68 20 70 72 6f 70 65 72 20 63 6f 64 65 0a 23 th proper code.#
2a70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2aa0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2ab0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
2ac0: 72 6f 63 20 64 6f 2d 65 78 69 74 20 7b 7b 72 65 roc do-exit {{re
2ad0: 74 75 72 6e 63 6f 64 65 20 7b 7d 7d 7d 20 7b 0a turncode {}}} {.
2ae0: 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 debug-info "
2af0: 64 6f 2d 65 78 69 74 20 28 24 72 65 74 75 72 6e do-exit ($return
2b00: 63 6f 64 65 29 22 0a 20 20 20 20 67 6c 6f 62 61 code)". globa
2b10: 6c 20 67 0a 0a 20 20 20 20 23 20 77 65 20 64 6f l g.. # we do
2b20: 6e 27 74 20 70 61 72 74 69 63 75 6c 61 72 6c 79 n't particularly
2b30: 20 63 61 72 65 20 69 66 20 64 65 6c 2d 74 6d 70 care if del-tmp
2b40: 20 66 61 69 6c 73 2e 0a 20 20 20 20 63 61 74 63 fails.. catc
2b50: 68 20 7b 64 65 6c 2d 74 6d 70 7d 0a 20 20 20 20 h {del-tmp}.
2b60: 69 66 20 7b 24 72 65 74 75 72 6e 63 6f 64 65 20 if {$returncode
2b70: 3d 3d 20 22 22 7d 20 7b 0a 09 73 65 74 20 72 65 == ""} {..set re
2b80: 74 75 72 6e 63 6f 64 65 20 24 67 28 72 65 74 75 turncode $g(retu
2b90: 72 6e 56 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 rnValue). }.
2ba0: 20 20 20 23 20 65 78 69 74 20 77 69 74 68 20 61 # exit with a
2bb0: 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 72 65 n appropriate re
2bc0: 74 75 72 6e 20 76 61 6c 75 65 0a 20 20 20 20 65 turn value. e
2bd0: 78 69 74 20 24 72 65 74 75 72 6e 63 6f 64 65 0a xit $returncode.
2be0: 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 }..#############
2bf0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c30: 23 23 0a 23 20 4d 6f 64 61 6c 20 65 72 72 6f 72 ##.# Modal error
2c40: 20 64 69 61 6c 6f 67 2e 0a 23 23 23 23 23 23 23 dialog..#######
2c50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c90: 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 64 6f ########.proc do
2ca0: 2d 65 72 72 6f 72 20 7b 6d 73 67 7d 20 7b 0a 20 -error {msg} {.
2cb0: 20 20 20 67 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 global g..
2cc0: 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 64 6f 2d debug-info "do-
2cd0: 65 72 72 6f 72 20 28 24 6d 73 67 29 22 0a 20 20 error ($msg)".
2ce0: 20 20 74 6b 5f 6d 65 73 73 61 67 65 42 6f 78 20 tk_messageBox
2cf0: 2d 6d 65 73 73 61 67 65 20 22 24 6d 73 67 22 20 -message "$msg"
2d00: 2d 74 69 74 6c 65 20 22 24 67 28 6e 61 6d 65 29 -title "$g(name)
2d10: 3a 20 45 72 72 6f 72 22 20 2d 69 63 6f 6e 20 65 : Error" -icon e
2d20: 72 72 6f 72 20 2d 74 79 70 65 20 6f 6b 0a 7d 0a rror -type ok.}.
2d30: 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
2d40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d80: 0a 23 20 54 68 72 6f 77 20 75 70 20 61 20 6d 6f .# Throw up a mo
2d90: 64 61 6c 20 65 72 72 6f 72 20 64 69 61 6c 6f 67 dal error dialog
2da0: 20 6f 72 20 70 72 69 6e 74 20 61 20 6d 65 73 73 or print a mess
2db0: 61 67 65 20 74 6f 20 73 74 64 65 72 72 2e 20 20 age to stderr.
2dc0: 46 6f 72 0a 23 20 55 6e 69 78 20 77 65 20 70 72 For.# Unix we pr
2dd0: 69 6e 74 20 74 6f 20 73 74 64 65 72 72 20 61 6e int to stderr an
2de0: 64 20 65 78 69 74 20 69 66 20 74 68 65 20 6d 61 d exit if the ma
2df0: 69 6e 20 77 69 6e 64 6f 77 20 68 61 73 6e 27 74 in window hasn't
2e00: 20 62 65 65 6e 0a 23 20 63 72 65 61 74 65 64 2c been.# created,
2e10: 20 6f 74 68 65 72 77 69 73 65 20 70 75 74 20 75 otherwise put u
2e20: 70 20 61 20 64 69 61 6c 6f 67 20 61 6e 64 20 74 p a dialog and t
2e30: 68 72 6f 77 20 61 6e 20 65 78 63 65 70 74 69 6f hrow an exceptio
2e40: 6e 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 n..#############
2e50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e90: 23 23 0a 70 72 6f 63 20 66 61 74 61 6c 2d 65 72 ##.proc fatal-er
2ea0: 72 6f 72 20 7b 6d 73 67 7d 20 7b 0a 20 20 20 20 ror {msg} {.
2eb0: 64 65 62 75 67 2d 69 6e 66 6f 20 22 66 61 74 61 debug-info "fata
2ec0: 6c 2d 65 72 72 6f 72 20 28 24 6d 73 67 29 22 0a l-error ($msg)".
2ed0: 20 20 20 20 67 6c 6f 62 61 6c 20 67 20 74 63 6c global g tcl
2ee0: 5f 70 6c 61 74 66 6f 72 6d 0a 0a 20 20 20 20 69 _platform.. i
2ef0: 66 20 7b 24 67 28 73 74 61 72 74 65 64 29 7d 20 f {$g(started)}
2f00: 7b 0a 09 74 6b 5f 6d 65 73 73 61 67 65 42 6f 78 {..tk_messageBox
2f10: 20 2d 74 69 74 6c 65 20 22 45 72 72 6f 72 22 20 -title "Error"
2f20: 2d 69 63 6f 6e 20 65 72 72 6f 72 20 2d 74 79 70 -icon error -typ
2f30: 65 20 6f 6b 20 2d 6d 65 73 73 61 67 65 20 24 6d e ok -message $m
2f40: 73 67 0a 09 64 6f 2d 65 78 69 74 20 32 0a 20 20 sg..do-exit 2.
2f50: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 70 75 74 73 } else {..puts
2f60: 20 73 74 64 65 72 72 20 24 6d 73 67 0a 09 64 65 stderr $msg..de
2f70: 6c 2d 74 6d 70 0a 09 64 6f 2d 65 78 69 74 20 32 l-tmp..do-exit 2
2f80: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
2f90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fa0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fd0: 23 23 23 23 23 23 23 23 23 0a 23 20 52 65 74 75 #########.# Retu
2fe0: 72 6e 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 61 rn the name of a
2ff0: 20 74 65 6d 70 6f 72 61 72 79 20 66 69 6c 65 0a temporary file.
3000: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3010: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3020: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3030: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3040: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
3050: 70 72 6f 63 20 74 6d 70 66 69 6c 65 20 7b 6e 7d proc tmpfile {n}
3060: 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 {. debug-inf
3070: 6f 20 22 74 6d 70 66 69 6c 65 20 28 24 6e 29 22 o "tmpfile ($n)"
3080: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 . global opts
3090: 0a 20 20 20 20 73 65 74 20 74 6d 70 64 69 72 20 . set tmpdir
30a0: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
30b0: 20 24 6f 70 74 73 28 74 6d 70 64 69 72 29 5d 0a $opts(tmpdir)].
30c0: 20 20 20 20 73 65 74 20 74 6d 70 66 69 6c 65 20 set tmpfile
30d0: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 74 6d 70 64 [file join $tmpd
30e0: 69 72 20 22 5b 70 69 64 5d 2d 24 6e 22 5d 0a 20 ir "[pid]-$n"].
30f0: 20 20 20 72 65 74 75 72 6e 20 24 74 6d 70 66 69 return $tmpfi
3100: 6c 65 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 le.}..##########
3110: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3120: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3130: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3140: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3150: 23 23 23 23 23 0a 23 20 45 78 65 63 75 74 65 20 #####.# Execute
3160: 61 20 63 6f 6d 6d 61 6e 64 2e 0a 23 20 52 65 74 a command..# Ret
3170: 75 72 6e 73 20 22 24 73 74 64 6f 75 74 20 24 73 urns "$stdout $s
3180: 74 64 65 72 72 20 24 65 78 69 74 63 6f 64 65 22 tderr $exitcode"
3190: 20 69 66 20 65 78 69 74 20 63 6f 64 65 20 21 3d if exit code !=
31a0: 20 30 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 0.#############
31b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31f0: 23 23 0a 70 72 6f 63 20 72 75 6e 2d 63 6f 6d 6d ##.proc run-comm
3200: 61 6e 64 20 7b 63 6d 64 7d 20 7b 0a 20 20 20 20 and {cmd} {.
3210: 64 65 62 75 67 2d 69 6e 66 6f 20 22 72 75 6e 2d debug-info "run-
3220: 63 6f 6d 6d 61 6e 64 20 28 24 63 6d 64 29 22 0a command ($cmd)".
3230: 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 20 global opts
3240: 65 72 72 6f 72 43 6f 64 65 0a 0a 20 20 20 20 73 errorCode.. s
3250: 65 74 20 73 74 64 65 72 72 20 22 22 0a 20 20 20 et stderr "".
3260: 20 73 65 74 20 65 78 69 74 63 6f 64 65 20 30 0a set exitcode 0.
3270: 20 20 20 20 73 65 74 20 65 72 72 66 69 6c 65 20 set errfile
3280: 5b 74 6d 70 66 69 6c 65 20 22 72 22 5d 0a 0a 20 [tmpfile "r"]..
3290: 20 20 20 73 65 74 20 66 61 69 6c 65 64 20 5b 63 set failed [c
32a0: 61 74 63 68 20 22 24 63 6d 64 20 5c 22 32 3e 24 atch "$cmd \"2>$
32b0: 65 72 72 66 69 6c 65 5c 22 22 20 73 74 64 6f 75 errfile\"" stdou
32c0: 74 5d 0a 20 20 20 20 23 20 52 65 61 64 20 73 74 t]. # Read st
32d0: 64 65 72 72 20 6f 75 74 70 75 74 0a 20 20 20 20 derr output.
32e0: 63 61 74 63 68 20 7b 0a 09 73 65 74 20 68 6e 64 catch {..set hnd
32f0: 6c 20 5b 6f 70 65 6e 20 22 24 65 72 72 66 69 6c l [open "$errfil
3300: 65 22 20 72 5d 0a 09 73 65 74 20 73 74 64 65 72 e" r]..set stder
3310: 72 20 5b 72 65 61 64 20 24 68 6e 64 6c 5d 0a 09 r [read $hndl]..
3320: 63 6c 6f 73 65 20 24 68 6e 64 6c 0a 20 20 20 20 close $hndl.
3330: 7d 0a 20 20 20 20 69 66 20 7b 24 66 61 69 6c 65 }. if {$faile
3340: 64 7d 20 7b 0a 09 73 77 69 74 63 68 20 2d 2d 20 d} {..switch --
3350: 5b 6c 69 6e 64 65 78 20 24 65 72 72 6f 72 43 6f [lindex $errorCo
3360: 64 65 20 30 5d 20 7b 0a 09 22 43 48 49 4c 44 53 de 0] {.."CHILDS
3370: 54 41 54 55 53 22 20 7b 0a 09 09 73 65 74 20 65 TATUS" {...set e
3380: 78 69 74 63 6f 64 65 20 5b 6c 69 6e 64 65 78 20 xitcode [lindex
3390: 24 65 72 72 6f 72 43 6f 64 65 20 32 5d 0a 09 20 $errorCode 2]..
33a0: 20 20 20 7d 0a 09 22 50 4f 53 49 58 22 20 7b 0a }.."POSIX" {.
33b0: 09 09 69 66 20 7b 24 73 74 64 65 72 72 20 3d 3d ..if {$stderr ==
33c0: 20 22 22 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 ""} {... set
33d0: 20 73 74 64 65 72 72 20 24 73 74 64 6f 75 74 0a stderr $stdout.
33e0: 09 09 7d 0a 09 09 73 65 74 20 65 78 69 74 63 6f ..}...set exitco
33f0: 64 65 20 2d 31 0a 09 20 20 20 20 7d 0a 09 64 65 de -1.. }..de
3400: 66 61 75 6c 74 20 7b 0a 09 09 73 65 74 20 65 78 fault {...set ex
3410: 69 74 63 6f 64 65 20 2d 31 0a 09 20 20 20 20 7d itcode -1.. }
3420: 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 ..}. }.. c
3430: 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 atch {file delet
3440: 65 20 24 65 72 72 66 69 6c 65 7d 0a 20 20 20 20 e $errfile}.
3450: 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 22 24 73 return [list "$s
3460: 74 64 6f 75 74 22 20 22 24 73 74 64 65 72 72 22 tdout" "$stderr"
3470: 20 22 24 65 78 69 74 63 6f 64 65 22 5d 0a 7d 0a "$exitcode"].}.
3480: 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
3490: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34d0: 0a 23 20 45 78 65 63 75 74 65 20 61 20 63 6f 6d .# Execute a com
34e0: 6d 61 6e 64 2e 20 20 44 69 65 20 69 66 20 75 6e mand. Die if un
34f0: 73 75 63 63 65 73 73 66 75 6c 2e 0a 23 23 23 23 successful..####
3500: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3510: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3520: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3530: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3540: 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
3550: 20 64 69 65 2d 75 6e 6c 65 73 73 20 7b 63 6d 64 die-unless {cmd
3560: 20 66 69 6c 65 7d 20 7b 0a 20 20 20 20 23 64 65 file} {. #de
3570: 62 75 67 2d 69 6e 66 6f 20 22 64 69 65 2d 75 6e bug-info "die-un
3580: 6c 65 73 73 20 28 24 63 6d 64 20 24 66 69 6c 65 less ($cmd $file
3590: 29 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 )". global op
35a0: 74 73 20 65 72 72 6f 72 43 6f 64 65 0a 0a 20 20 ts errorCode..
35b0: 20 20 73 65 74 20 66 69 6c 65 20 5b 73 74 72 69 set file [stri
35c0: 6e 67 20 74 72 69 6d 20 24 66 69 6c 65 20 22 5c ng trim $file "\
35d0: 22 22 5d 0a 20 20 20 20 73 65 74 20 72 65 73 75 ""]. set resu
35e0: 6c 74 20 5b 72 75 6e 2d 63 6f 6d 6d 61 6e 64 20 lt [run-command
35f0: 22 24 63 6d 64 20 5c 22 3e 24 66 69 6c 65 5c 22 "$cmd \">$file\"
3600: 22 5d 0a 20 20 20 20 73 65 74 20 73 74 64 6f 75 "]. set stdou
3610: 74 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 75 6c t [lindex $resul
3620: 74 20 30 5d 0a 20 20 20 20 73 65 74 20 73 74 64 t 0]. set std
3630: 65 72 72 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 err [lindex $res
3640: 75 6c 74 20 31 5d 0a 20 20 20 20 73 65 74 20 65 ult 1]. set e
3650: 78 69 74 63 6f 64 65 20 5b 6c 69 6e 64 65 78 20 xitcode [lindex
3660: 24 72 65 73 75 6c 74 20 32 5d 0a 0a 20 20 20 20 $result 2]..
3670: 69 66 20 7b 24 65 78 69 74 63 6f 64 65 20 21 3d if {$exitcode !=
3680: 20 30 7d 20 7b 0a 09 66 61 74 61 6c 2d 65 72 72 0} {..fatal-err
3690: 6f 72 20 22 24 73 74 64 65 72 72 5c 6e 24 73 74 or "$stderr\n$st
36a0: 64 6f 75 74 22 0a 20 20 20 20 7d 0a 7d 0a 0a 23 dout". }.}..#
36b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
3700: 20 46 69 6c 74 65 72 20 50 56 43 53 20 6f 75 74 Filter PVCS out
3710: 70 75 74 20 66 69 6c 65 73 20 74 68 61 74 20 68 put files that h
3720: 61 76 65 20 43 52 2d 43 52 2d 4c 46 20 65 6e 64 ave CR-CR-LF end
3730: 2d 6f 66 2d 6c 69 6e 65 73 0a 23 23 23 23 23 23 -of-lines.######
3740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3750: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3760: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3770: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3780: 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 66 #########.proc f
3790: 69 6c 74 65 72 43 52 43 52 4c 46 20 7b 66 69 6c ilterCRCRLF {fil
37a0: 65 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 e} {. debug-i
37b0: 6e 66 6f 20 22 66 69 6c 74 65 72 43 52 43 4c 46 nfo "filterCRCLF
37c0: 20 28 24 66 69 6c 65 29 22 0a 20 20 20 20 73 65 ($file)". se
37d0: 74 20 6f 75 74 66 69 6c 65 20 5b 74 6d 70 66 69 t outfile [tmpfi
37e0: 6c 65 20 39 5d 0a 20 20 20 20 73 65 74 20 69 6e le 9]. set in
37f0: 70 20 5b 6f 70 65 6e 20 24 66 69 6c 65 20 72 5d p [open $file r]
3800: 0a 20 20 20 20 73 65 74 20 6f 75 74 20 5b 6f 70 . set out [op
3810: 65 6e 20 24 6f 75 74 66 69 6c 65 20 77 5d 0a 20 en $outfile w].
3820: 20 20 20 66 63 6f 6e 66 69 67 75 72 65 20 24 69 fconfigure $i
3830: 6e 70 20 2d 74 72 61 6e 73 6c 61 74 69 6f 6e 20 np -translation
3840: 62 69 6e 61 72 79 0a 20 20 20 20 66 63 6f 6e 66 binary. fconf
3850: 69 67 75 72 65 20 24 6f 75 74 20 2d 74 72 61 6e igure $out -tran
3860: 73 6c 61 74 69 6f 6e 20 62 69 6e 61 72 79 0a 20 slation binary.
3870: 20 20 20 73 65 74 20 43 52 20 5b 66 6f 72 6d 61 set CR [forma
3880: 74 20 25 63 20 31 33 5d 0a 20 20 20 20 77 68 69 t %c 13]. whi
3890: 6c 65 20 7b 21 5b 65 6f 66 20 24 69 6e 70 5d 7d le {![eof $inp]}
38a0: 20 7b 0a 09 73 65 74 20 6c 69 6e 65 20 5b 67 65 {..set line [ge
38b0: 74 73 20 24 69 6e 70 5d 0a 09 69 66 20 7b 5b 73 ts $inp]..if {[s
38c0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6c 69 tring length $li
38d0: 6e 65 5d 20 26 26 20 21 5b 65 6f 66 20 24 69 6e ne] && ![eof $in
38e0: 70 5d 7d 20 7b 0a 09 20 20 20 20 72 65 67 73 75 p]} {.. regsu
38f0: 62 20 2d 61 6c 6c 20 22 24 43 52 24 43 52 22 20 b -all "$CR$CR"
3900: 24 6c 69 6e 65 20 24 43 52 20 6c 69 6e 65 0a 09 $line $CR line..
3910: 20 20 20 20 70 75 74 73 20 24 6f 75 74 20 24 6c puts $out $l
3920: 69 6e 65 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 20 ine..}. }.
3930: 20 63 6c 6f 73 65 20 24 69 6e 70 0a 20 20 20 20 close $inp.
3940: 63 6c 6f 73 65 20 24 6f 75 74 0a 20 20 20 20 66 close $out. f
3950: 69 6c 65 20 72 65 6e 61 6d 65 20 2d 66 6f 72 63 ile rename -forc
3960: 65 20 24 6f 75 74 66 69 6c 65 20 24 66 69 6c 65 e $outfile $file
3970: 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 .}..############
3980: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3990: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
39a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
39b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
39c0: 23 23 23 0a 23 20 52 65 74 75 72 6e 20 74 68 65 ###.# Return the
39d0: 20 73 6d 61 6c 6c 65 73 74 20 6f 66 20 74 77 6f smallest of two
39e0: 20 76 61 6c 75 65 73 0a 23 23 23 23 23 23 23 23 values.########
39f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3a00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3a10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3a20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3a30: 23 23 23 23 23 23 23 0a 70 72 6f 63 20 6d 69 6e #######.proc min
3a40: 20 7b 61 20 62 7d 20 7b 0a 20 20 20 20 72 65 74 {a b} {. ret
3a50: 75 72 6e 20 5b 65 78 70 72 20 7b 24 61 20 3c 20 urn [expr {$a <
3a60: 24 62 20 3f 20 24 61 20 3a 20 24 62 7d 5d 0a 7d $b ? $a : $b}].}
3a70: 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
3a80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3a90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3aa0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3ab0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3ac0: 23 0a 23 20 52 65 74 75 72 6e 20 74 68 65 20 6c #.# Return the l
3ad0: 61 72 67 65 73 74 20 6f 66 20 74 77 6f 20 76 61 argest of two va
3ae0: 6c 75 65 73 0a 23 23 23 23 23 23 23 23 23 23 23 lues.###########
3af0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b30: 23 23 23 23 0a 70 72 6f 63 20 6d 61 78 20 7b 61 ####.proc max {a
3b40: 20 62 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e b} {. return
3b50: 20 5b 65 78 70 72 20 7b 24 61 20 3e 20 24 62 20 [expr {$a > $b
3b60: 3f 20 24 61 20 3a 20 24 62 7d 5d 0a 7d 0a 0a 23 ? $a : $b}].}..#
3b70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3b90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3ba0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3bb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
3bc0: 20 54 6f 67 67 6c 65 20 63 68 61 6e 67 65 20 62 Toggle change b
3bd0: 61 72 73 0a 23 23 23 23 23 23 23 23 23 23 23 23 ars.############
3be0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3bf0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3c00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3c10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3c20: 23 23 23 0a 70 72 6f 63 20 64 6f 2d 73 68 6f 77 ###.proc do-show
3c30: 2d 63 68 61 6e 67 65 62 61 72 73 20 7b 7b 73 68 -changebars {{sh
3c40: 6f 77 20 7b 7d 7d 7d 20 7b 0a 20 20 20 20 64 65 ow {}}} {. de
3c50: 62 75 67 2d 69 6e 66 6f 20 22 64 6f 2d 73 68 6f bug-info "do-sho
3c60: 77 2d 63 68 61 6e 67 65 62 61 72 73 20 28 24 73 w-changebars ($s
3c70: 68 6f 77 29 22 0a 20 20 20 20 67 6c 6f 62 61 6c how)". global
3c80: 20 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c opts. global
3c90: 20 77 0a 0a 20 20 20 20 69 66 20 7b 24 73 68 6f w.. if {$sho
3ca0: 77 20 21 3d 20 7b 7d 7d 20 7b 0a 09 73 65 74 20 w != {}} {..set
3cb0: 6f 70 74 73 28 73 68 6f 77 63 62 73 29 20 24 73 opts(showcbs) $s
3cc0: 68 6f 77 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 how. }.. i
3cd0: 66 20 7b 24 6f 70 74 73 28 73 68 6f 77 63 62 73 f {$opts(showcbs
3ce0: 29 7d 20 7b 0a 09 67 72 69 64 20 24 77 28 4c 65 )} {..grid $w(Le
3cf0: 66 74 43 42 29 20 2d 72 6f 77 20 30 20 2d 63 6f ftCB) -row 0 -co
3d00: 6c 75 6d 6e 20 32 20 2d 73 74 69 63 6b 79 20 6e lumn 2 -sticky n
3d10: 73 0a 09 67 72 69 64 20 24 77 28 52 69 67 68 74 s..grid $w(Right
3d20: 43 42 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 CB) -row 0 -colu
3d30: 6d 6e 20 31 20 2d 73 74 69 63 6b 79 20 6e 73 0a mn 1 -sticky ns.
3d40: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 67 72 } else {..gr
3d50: 69 64 20 66 6f 72 67 65 74 20 24 77 28 4c 65 66 id forget $w(Lef
3d60: 74 43 42 29 0a 09 67 72 69 64 20 66 6f 72 67 65 tCB)..grid forge
3d70: 74 20 24 77 28 52 69 67 68 74 43 42 29 0a 20 20 t $w(RightCB).
3d80: 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 }.}..#########
3d90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3da0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3db0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3dc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3dd0: 23 23 23 23 23 23 0a 23 20 54 6f 67 67 6c 65 20 ######.# Toggle
3de0: 69 67 6e 6f 72 65 20 77 68 69 74 65 20 73 70 61 ignore white spa
3df0: 63 65 73 0a 23 23 23 23 23 23 23 23 23 23 23 23 ces.############
3e00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3e10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3e20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3e30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3e40: 23 23 23 0a 70 72 6f 63 20 64 6f 2d 73 68 6f 77 ###.proc do-show
3e50: 2d 69 67 6e 6f 72 65 62 6c 61 6e 6b 73 20 7b 7b -ignoreblanks {{
3e60: 73 68 6f 77 49 67 6e 20 7b 7d 7d 7d 20 7b 0a 20 showIgn {}}} {.
3e70: 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 global opts.
3e80: 20 20 20 67 6c 6f 62 61 6c 20 66 69 6e 66 6f 0a global finfo.
3e90: 0a 20 20 20 20 69 66 20 7b 24 73 68 6f 77 49 67 . if {$showIg
3ea0: 6e 20 21 3d 20 7b 7d 7d 20 7b 0a 09 73 65 74 20 n != {}} {..set
3eb0: 6f 70 74 73 28 69 67 6e 6f 72 65 62 6c 61 6e 6b opts(ignoreblank
3ec0: 73 29 20 24 73 68 6f 77 49 67 6e 0a 20 20 20 20 s) $showIgn.
3ed0: 7d 0a 20 20 20 20 69 66 20 7b 24 66 69 6e 66 6f }. if {$finfo
3ee0: 28 70 74 68 2c 31 29 20 21 3d 20 7b 7d 20 26 26 (pth,1) != {} &&
3ef0: 20 24 66 69 6e 66 6f 28 70 74 68 2c 32 29 20 21 $finfo(pth,2) !
3f00: 3d 20 7b 7d 7d 20 7b 0a 09 72 65 63 6f 6d 70 75 = {}} {..recompu
3f10: 74 65 2d 64 69 66 66 0a 20 20 20 20 7d 0a 7d 0a te-diff. }.}.
3f20: 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
3f30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3f40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3f50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3f60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3f70: 0a 23 20 54 6f 67 67 6c 65 20 6c 69 6e 65 20 6e .# Toggle line n
3f80: 75 6d 62 65 72 73 2e 0a 23 23 23 23 23 23 23 23 umbers..########
3f90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3fa0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3fb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3fc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3fd0: 23 23 23 23 23 23 23 0a 70 72 6f 63 20 64 6f 2d #######.proc do-
3fe0: 73 68 6f 77 2d 6c 69 6e 65 6e 75 6d 62 65 72 73 show-linenumbers
3ff0: 20 7b 7b 73 68 6f 77 4c 6e 20 7b 7d 7d 7d 20 7b {{showLn {}}} {
4000: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 . global opts
4010: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 . global w..
4020: 20 20 20 69 66 20 7b 24 73 68 6f 77 4c 6e 20 21 if {$showLn !
4030: 3d 20 7b 7d 7d 20 7b 0a 09 73 65 74 20 6f 70 74 = {}} {..set opt
4040: 73 28 73 68 6f 77 6c 6e 29 20 24 73 68 6f 77 4c s(showln) $showL
4050: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 n. }.. if
4060: 7b 24 6f 70 74 73 28 73 68 6f 77 6c 6e 29 7d 20 {$opts(showln)}
4070: 7b 0a 09 67 72 69 64 20 24 77 28 4c 65 66 74 49 {..grid $w(LeftI
4080: 6e 66 6f 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c nfo) -row 0 -col
4090: 75 6d 6e 20 31 20 2d 73 74 69 63 6b 79 20 6e 73 umn 1 -sticky ns
40a0: 65 77 0a 09 67 72 69 64 20 24 77 28 52 69 67 68 ew..grid $w(Righ
40b0: 74 49 6e 66 6f 29 20 2d 72 6f 77 20 30 20 2d 63 tInfo) -row 0 -c
40c0: 6f 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 olumn 0 -sticky
40d0: 6e 73 65 77 0a 20 20 20 20 7d 20 65 6c 73 65 20 nsew. } else
40e0: 7b 0a 09 67 72 69 64 20 66 6f 72 67 65 74 20 24 {..grid forget $
40f0: 77 28 4c 65 66 74 49 6e 66 6f 29 0a 09 67 72 69 w(LeftInfo)..gri
4100: 64 20 66 6f 72 67 65 74 20 24 77 28 52 69 67 68 d forget $w(Righ
4110: 74 49 6e 66 6f 29 0a 20 20 20 20 7d 0a 7d 0a 0a tInfo). }.}..
4120: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4130: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4140: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4150: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4160: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
4170: 23 20 53 68 6f 77 20 6c 69 6e 65 20 6e 75 6d 62 # Show line numb
4180: 65 72 73 20 69 6e 20 69 6e 66 6f 20 77 69 6e 64 ers in info wind
4190: 6f 77 73 0a 23 23 23 23 23 23 23 23 23 23 23 23 ows.############
41a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
41b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
41c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
41d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
41e0: 23 23 23 0a 70 72 6f 63 20 64 72 61 77 2d 6c 69 ###.proc draw-li
41f0: 6e 65 2d 6e 75 6d 62 65 72 73 20 7b 7d 20 7b 0a ne-numbers {} {.
4200: 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 global g.
4210: 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 24 global w.. $
4220: 77 28 4c 65 66 74 49 6e 66 6f 29 20 63 6f 6e 66 w(LeftInfo) conf
4230: 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 igure -state nor
4240: 6d 61 6c 0a 20 20 20 20 24 77 28 52 69 67 68 74 mal. $w(Right
4250: 49 6e 66 6f 29 20 63 6f 6e 66 69 67 75 72 65 20 Info) configure
4260: 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 -state normal.
4270: 20 20 24 77 28 4c 65 66 74 43 42 29 20 63 6f 6e $w(LeftCB) con
4280: 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f figure -state no
4290: 72 6d 61 6c 0a 20 20 20 20 24 77 28 52 69 67 68 rmal. $w(Righ
42a0: 74 43 42 29 20 63 6f 6e 66 69 67 75 72 65 20 2d tCB) configure -
42b0: 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a 20 20 state normal..
42c0: 20 20 73 65 74 20 6c 69 6e 65 73 28 4c 65 66 74 set lines(Left
42d0: 29 20 5b 6c 69 6e 64 65 78 20 5b 73 70 6c 69 74 ) [lindex [split
42e0: 20 5b 24 77 28 4c 65 66 74 54 65 78 74 29 20 69 [$w(LeftText) i
42f0: 6e 64 65 78 20 65 6e 64 2d 31 6c 69 6e 65 73 5d ndex end-1lines]
4300: 20 2e 5d 20 30 5d 0a 20 20 20 20 73 65 74 20 6c .] 0]. set l
4310: 69 6e 65 73 28 52 69 67 68 74 29 20 5b 6c 69 6e ines(Right) [lin
4320: 64 65 78 20 5b 73 70 6c 69 74 20 5b 24 77 28 52 dex [split [$w(R
4330: 69 67 68 74 54 65 78 74 29 20 69 6e 64 65 78 20 ightText) index
4340: 65 6e 64 2d 31 6c 69 6e 65 73 5d 20 2e 5d 20 30 end-1lines] .] 0
4350: 5d 0a 0a 20 20 20 20 23 20 53 6d 61 6c 6c 65 73 ].. # Smalles
4360: 74 20 6c 69 6e 65 20 63 6f 75 6e 74 0a 20 20 20 t line count.
4370: 20 73 65 74 20 6d 69 6e 6c 69 6e 65 73 20 5b 6d set minlines [m
4380: 69 6e 20 24 6c 69 6e 65 73 28 4c 65 66 74 29 20 in $lines(Left)
4390: 24 6c 69 6e 65 73 28 52 69 67 68 74 29 5d 0a 0a $lines(Right)]..
43a0: 20 20 20 20 23 20 63 61 63 68 65 20 61 6c 6c 20 # cache all
43b0: 74 68 65 20 62 6c 61 6e 6b 20 6c 69 6e 65 73 20 the blank lines
43c0: 66 6f 72 20 74 68 65 20 69 6e 66 6f 20 61 6e 64 for the info and
43d0: 20 63 62 20 77 69 6e 64 6f 77 73 2c 20 61 6e 64 cb windows, and
43e0: 20 64 6f 0a 20 20 20 20 23 20 6f 6e 65 20 62 69 do. # one bi
43f0: 67 20 69 6e 73 65 72 74 20 61 66 74 65 72 20 77 g insert after w
4400: 65 27 72 65 20 64 6f 6e 65 2e 20 54 68 69 73 20 e're done. This
4410: 73 65 65 6d 73 20 74 6f 20 62 65 20 6d 75 63 68 seems to be much
4420: 20 71 75 69 63 6b 65 72 0a 20 20 20 20 23 20 74 quicker. # t
4430: 68 61 6e 20 69 6e 73 65 72 74 69 6e 67 20 74 68 han inserting th
4440: 65 6d 20 69 6e 20 74 68 65 20 77 69 64 67 65 74 em in the widget
4450: 73 20 6f 6e 65 20 6c 69 6e 65 20 61 74 20 61 20 s one line at a
4460: 74 69 6d 65 2e 0a 20 20 20 20 73 65 74 20 6c 69 time.. set li
4470: 6e 65 73 74 75 66 66 20 7b 7d 0a 20 20 20 20 73 nestuff {}. s
4480: 65 74 20 63 62 73 74 75 66 66 20 7b 7d 0a 20 20 et cbstuff {}.
4490: 20 20 66 6f 72 20 7b 73 65 74 20 69 20 31 7d 20 for {set i 1}
44a0: 7b 24 69 20 3c 20 24 6d 69 6e 6c 69 6e 65 73 7d {$i < $minlines}
44b0: 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 61 70 70 {incr i} {..app
44c0: 65 6e 64 20 6c 69 6e 65 73 74 75 66 66 20 22 24 end linestuff "$
44d0: 69 5c 6e 22 0a 09 61 70 70 65 6e 64 20 63 62 73 i\n"..append cbs
44e0: 74 75 66 66 20 22 20 5c 6e 22 20 3b 23 20 66 6f tuff " \n" ;# fo
44f0: 72 20 6e 6f 77 2c 20 6a 75 73 74 20 70 75 74 20 r now, just put
4500: 69 6e 20 70 6c 61 63 65 20 68 6f 6c 64 65 72 73 in place holders
4510: 2e 2e 2e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 24 .... }.. $
4520: 77 28 4c 65 66 74 49 6e 66 6f 29 20 69 6e 73 65 w(LeftInfo) inse
4530: 72 74 20 65 6e 64 20 24 6c 69 6e 65 73 74 75 66 rt end $linestuf
4540: 66 0a 20 20 20 20 24 77 28 52 69 67 68 74 49 6e f. $w(RightIn
4550: 66 6f 29 20 69 6e 73 65 72 74 20 65 6e 64 20 24 fo) insert end $
4560: 6c 69 6e 65 73 74 75 66 66 0a 20 20 20 20 24 77 linestuff. $w
4570: 28 4c 65 66 74 43 42 29 20 69 6e 73 65 72 74 20 (LeftCB) insert
4580: 65 6e 64 20 24 63 62 73 74 75 66 66 0a 20 20 20 end $cbstuff.
4590: 20 24 77 28 52 69 67 68 74 43 42 29 20 69 6e 73 $w(RightCB) ins
45a0: 65 72 74 20 65 6e 64 20 24 63 62 73 74 75 66 66 ert end $cbstuff
45b0: 0a 0a 20 20 20 20 23 20 49 6e 73 65 72 74 20 72 .. # Insert r
45c0: 65 6d 61 69 6e 69 6e 67 20 6c 69 6e 65 20 6e 75 emaining line nu
45d0: 6d 62 65 72 73 2e 20 57 65 27 6c 6c 20 63 61 63 mbers. We'll cac
45e0: 68 65 20 74 68 65 20 73 74 75 66 66 20 74 6f 20 he the stuff to
45f0: 62 65 0a 20 20 20 20 23 20 69 6e 73 65 72 74 65 be. # inserte
4600: 64 20 73 6f 20 77 65 20 63 61 6e 20 64 6f 20 6a d so we can do j
4610: 75 73 74 20 6f 6e 65 20 63 61 6c 6c 20 69 6e 20 ust one call in
4620: 74 6f 20 74 68 65 20 77 69 64 67 65 74 2e 20 54 to the widget. T
4630: 68 69 73 0a 20 20 20 20 23 20 73 68 6f 75 6c 64 his. # should
4640: 20 62 65 20 6d 75 63 68 20 66 61 73 74 65 72 2c be much faster,
4650: 20 72 65 6c 61 74 69 76 65 6c 79 20 73 70 65 61 relatively spea
4660: 6b 69 6e 67 2c 20 74 68 65 6e 20 69 6e 73 65 72 king, then inser
4670: 74 69 6e 67 0a 20 20 20 20 23 20 64 61 74 61 20 ting. # data
4680: 6f 6e 65 20 6c 69 6e 65 20 61 74 20 61 20 74 69 one line at a ti
4690: 6d 65 2e 0a 20 20 20 20 66 6f 72 65 61 63 68 20 me.. foreach
46a0: 6d 6f 64 20 7b 4c 65 66 74 20 52 69 67 68 74 7d mod {Left Right}
46b0: 20 7b 0a 09 73 65 74 20 6c 69 6e 65 73 74 75 66 {..set linestuf
46c0: 66 20 7b 7d 0a 09 73 65 74 20 63 62 73 74 75 66 f {}..set cbstuf
46d0: 66 20 7b 7d 0a 09 66 6f 72 20 7b 73 65 74 20 69 f {}..for {set i
46e0: 20 24 6d 69 6e 6c 69 6e 65 73 7d 20 7b 24 69 20 $minlines} {$i
46f0: 3c 20 24 6c 69 6e 65 73 28 24 6d 6f 64 29 7d 20 < $lines($mod)}
4700: 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 20 20 20 20 {incr i} {..
4710: 61 70 70 65 6e 64 20 6c 69 6e 65 73 74 75 66 66 append linestuff
4720: 20 22 24 69 5c 6e 22 0a 09 20 20 20 20 61 70 70 "$i\n".. app
4730: 65 6e 64 20 63 62 73 74 75 66 66 20 22 20 5c 6e end cbstuff " \n
4740: 22 20 3b 23 20 66 6f 72 20 6e 6f 77 2c 20 6a 75 " ;# for now, ju
4750: 73 74 20 70 75 74 20 69 6e 20 70 6c 61 63 65 20 st put in place
4760: 68 6f 6c 64 65 72 73 2e 2e 2e 0a 09 7d 0a 09 24 holders.....}..$
4770: 77 28 24 7b 6d 6f 64 7d 49 6e 66 6f 29 20 69 6e w(${mod}Info) in
4780: 73 65 72 74 20 65 6e 64 20 24 6c 69 6e 65 73 74 sert end $linest
4790: 75 66 66 0a 09 24 77 28 24 7b 6d 6f 64 7d 43 42 uff..$w(${mod}CB
47a0: 29 20 69 6e 73 65 72 74 20 65 6e 64 20 24 63 62 ) insert end $cb
47b0: 73 74 75 66 66 0a 20 20 20 20 7d 0a 0a 20 20 20 stuff. }..
47c0: 20 24 77 28 4c 65 66 74 43 42 29 20 63 6f 6e 66 $w(LeftCB) conf
47d0: 69 67 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 igure -state dis
47e0: 61 62 6c 65 64 0a 20 20 20 20 24 77 28 52 69 67 abled. $w(Rig
47f0: 68 74 43 42 29 20 63 6f 6e 66 69 67 75 72 65 20 htCB) configure
4800: 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a -state disabled.
4810: 0a 20 20 20 20 24 77 28 4c 65 66 74 49 6e 66 6f . $w(LeftInfo
4820: 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
4830: 74 65 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20 te disabled.
4840: 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 63 6f $w(RightInfo) co
4850: 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 64 nfigure -state d
4860: 69 73 61 62 6c 65 64 0a 7d 0a 0a 23 23 23 23 23 isabled.}..#####
4870: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4880: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4890: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
48a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
48b0: 23 23 23 23 23 23 23 23 23 23 0a 23 20 50 6f 70 ##########.# Pop
48c0: 20 75 70 20 61 20 77 69 6e 64 6f 77 20 66 6f 72 up a window for
48d0: 20 66 69 6c 65 20 6d 65 72 67 65 2e 0a 23 23 23 file merge..###
48e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
48f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4900: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4910: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4920: 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f ############.pro
4930: 63 20 70 6f 70 75 70 2d 6d 65 72 67 65 20 7b 7b c popup-merge {{
4940: 77 72 69 74 65 70 72 6f 63 20 6d 65 72 67 65 2d writeproc merge-
4950: 77 72 69 74 65 2d 66 69 6c 65 7d 7d 20 7b 0a 20 write-file}} {.
4960: 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 70 debug-info "p
4970: 6f 70 75 70 2d 6d 65 72 67 65 20 28 24 77 72 69 opup-merge ($wri
4980: 74 65 70 72 6f 63 29 22 0a 20 20 20 20 67 6c 6f teproc)". glo
4990: 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c bal g. global
49a0: 20 77 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 6d w.. if {$g(m
49b0: 65 72 67 65 66 69 6c 65 73 65 74 29 7d 20 7b 0a ergefileset)} {.
49c0: 09 24 77 72 69 74 65 70 72 6f 63 0a 09 72 65 74 .$writeproc..ret
49d0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 urn. }.. s
49e0: 65 74 20 74 79 70 65 73 20 7b 0a 09 7b 7b 54 65 et types {..{{Te
49f0: 78 74 20 46 69 6c 65 73 7d 20 20 20 20 20 20 20 xt Files}
4a00: 20 20 7b 2e 74 78 74 7d 7d 0a 09 7b 7b 41 6c 6c {.txt}}..{{All
4a10: 20 46 69 6c 65 73 7d 20 20 20 20 20 20 20 20 20 Files}
4a20: 7b 2a 7d 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 {*}}. }..
4a30: 73 65 74 20 70 61 74 68 20 5b 74 6b 5f 67 65 74 set path [tk_get
4a40: 53 61 76 65 46 69 6c 65 20 2d 64 65 66 61 75 6c SaveFile -defaul
4a50: 74 65 78 74 65 6e 73 69 6f 6e 20 22 22 20 2d 66 textension "" -f
4a60: 69 6c 65 74 79 70 65 73 20 24 74 79 70 65 73 20 iletypes $types
4a70: 5c 0a 20 20 20 20 20 20 2d 69 6e 69 74 69 61 6c \. -initial
4a80: 66 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 file [file nativ
4a90: 65 6e 61 6d 65 20 24 67 28 6d 65 72 67 65 66 69 ename $g(mergefi
4aa0: 6c 65 29 5d 5d 0a 0a 20 20 20 20 69 66 20 7b 5b le)]].. if {[
4ab0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 string length $p
4ac0: 61 74 68 5d 20 3e 20 30 7d 20 7b 0a 09 73 65 74 ath] > 0} {..set
4ad0: 20 67 28 6d 65 72 67 65 66 69 6c 65 29 20 24 70 g(mergefile) $p
4ae0: 61 74 68 0a 09 24 77 72 69 74 65 70 72 6f 63 0a ath..$writeproc.
4af0: 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 }.}..#######
4b00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b40: 23 23 23 23 23 23 23 23 0a 23 20 53 70 6c 69 74 ########.# Split
4b50: 20 61 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 a file containi
4b60: 6e 67 20 43 56 53 20 63 6f 6e 66 6c 69 63 74 20 ng CVS conflict
4b70: 6d 61 72 6b 65 72 73 20 69 6e 74 6f 20 74 77 6f markers into two
4b80: 20 74 65 6d 70 6f 72 61 72 79 20 66 69 6c 65 73 temporary files
4b90: 0a 23 20 20 20 20 6e 61 6d 65 20 20 20 20 20 20 .# name
4ba0: 20 20 4e 61 6d 65 20 6f 66 20 66 69 6c 65 20 63 Name of file c
4bb0: 6f 6e 74 61 69 6e 69 6e 67 20 63 6f 6e 66 6c 69 ontaining confli
4bc0: 63 74 20 6d 61 72 6b 65 72 73 0a 23 20 52 65 74 ct markers.# Ret
4bd0: 75 72 6e 73 20 74 68 65 20 6e 61 6d 65 73 20 6f urns the names o
4be0: 66 20 74 68 65 20 74 77 6f 20 74 65 6d 70 6f 72 f the two tempor
4bf0: 61 72 79 20 66 69 6c 65 73 20 61 6e 64 20 74 68 ary files and th
4c00: 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 0a 23 e names of the.#
4c10: 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 72 65 files that were
4c20: 20 6d 65 72 67 65 64 0a 23 23 23 23 23 23 23 23 merged.########
4c30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4c40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4c50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4c60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4c70: 23 23 23 23 23 23 23 0a 70 72 6f 63 20 73 70 6c #######.proc spl
4c80: 69 74 2d 63 6f 6e 66 6c 69 63 74 66 69 6c 65 20 it-conflictfile
4c90: 7b 6e 61 6d 65 7d 20 7b 0a 20 20 20 20 64 65 62 {name} {. deb
4ca0: 75 67 2d 69 6e 66 6f 20 22 63 6f 6e 66 6c 69 63 ug-info "conflic
4cb0: 74 73 20 28 24 6e 61 6d 65 29 22 0a 20 20 20 20 ts ($name)".
4cc0: 67 6c 6f 62 61 6c 20 67 20 6f 70 74 73 0a 0a 20 global g opts..
4cd0: 20 20 20 73 65 74 20 66 69 72 73 74 20 24 7b 6e set first ${n
4ce0: 61 6d 65 7d 2e 31 0a 20 20 20 20 73 65 74 20 73 ame}.1. set s
4cf0: 65 63 6f 6e 64 20 24 7b 6e 61 6d 65 7d 2e 32 0a econd ${name}.2.
4d00: 0a 20 20 20 20 73 65 74 20 74 65 6d 70 31 20 5b . set temp1 [
4d10: 74 6d 70 66 69 6c 65 20 31 5d 0a 20 20 20 20 73 tmpfile 1]. s
4d20: 65 74 20 74 65 6d 70 32 20 5b 74 6d 70 66 69 6c et temp2 [tmpfil
4d30: 65 20 32 5d 0a 0a 20 20 20 20 69 66 20 7b 5b 63 e 2].. if {[c
4d40: 61 74 63 68 20 7b 73 65 74 20 69 6e 70 75 74 20 atch {set input
4d50: 5b 6f 70 65 6e 20 24 6e 61 6d 65 20 72 5d 7d 5d [open $name r]}]
4d60: 7d 20 7b 0a 09 66 61 74 61 6c 2d 65 72 72 6f 72 } {..fatal-error
4d70: 20 22 43 6f 75 6c 64 6e 27 74 20 6f 70 65 6e 20 "Couldn't open
4d80: 66 69 6c 65 20 27 24 6e 61 6d 65 27 22 0a 20 20 file '$name'".
4d90: 20 20 7d 0a 20 20 20 20 73 65 74 20 66 69 72 73 }. set firs
4da0: 74 20 5b 6f 70 65 6e 20 24 74 65 6d 70 31 20 77 t [open $temp1 w
4db0: 5d 0a 20 20 20 20 6c 61 70 70 65 6e 64 20 67 28 ]. lappend g(
4dc0: 74 65 6d 70 66 69 6c 65 73 29 20 24 74 65 6d 70 tempfiles) $temp
4dd0: 31 0a 20 20 20 20 73 65 74 20 73 65 63 6f 6e 64 1. set second
4de0: 20 5b 6f 70 65 6e 20 24 74 65 6d 70 32 20 77 5d [open $temp2 w]
4df0: 0a 20 20 20 20 6c 61 70 70 65 6e 64 20 67 28 74 . lappend g(t
4e00: 65 6d 70 66 69 6c 65 73 29 20 24 74 65 6d 70 32 empfiles) $temp2
4e10: 0a 0a 20 20 20 20 73 65 74 20 66 69 72 73 74 6e .. set firstn
4e20: 61 6d 65 20 22 22 0a 20 20 20 20 73 65 74 20 73 ame "". set s
4e30: 65 63 6f 6e 64 6e 61 6d 65 20 22 22 0a 20 20 20 econdname "".
4e40: 20 73 65 74 20 6f 75 74 70 75 74 20 33 0a 0a 20 set output 3..
4e50: 20 20 20 73 65 74 20 66 69 72 73 74 4d 61 74 63 set firstMatc
4e60: 68 20 22 22 0a 20 20 20 20 73 65 74 20 73 65 63 h "". set sec
4e70: 6f 6e 64 4d 61 74 63 68 20 22 22 0a 20 20 20 20 ondMatch "".
4e80: 73 65 74 20 74 68 69 72 64 4d 61 74 63 68 20 22 set thirdMatch "
4e90: 22 0a 0a 20 20 20 20 77 68 69 6c 65 20 7b 5b 67 ".. while {[g
4ea0: 65 74 73 20 24 69 6e 70 75 74 20 6c 69 6e 65 5d ets $input line]
4eb0: 20 3e 3d 20 30 7d 20 7b 0a 09 69 66 20 7b 24 66 >= 0} {..if {$f
4ec0: 69 72 73 74 4d 61 74 63 68 20 3d 3d 20 22 22 7d irstMatch == ""}
4ed0: 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 72 65 67 {.. if {[reg
4ee0: 65 78 70 20 7b 5e 3c 3c 3c 3c 3c 3c 3c 2a 20 2b exp {^<<<<<<<* +
4ef0: 28 2e 2a 29 7d 20 24 6c 69 6e 65 5d 7d 20 7b 0a (.*)} $line]} {.
4f00: 09 09 73 65 74 20 66 69 72 73 74 4d 61 74 63 68 ..set firstMatch
4f10: 20 7b 5e 3c 3c 3c 3c 3c 3c 3c 2a 20 2b 28 2e 2a {^<<<<<<<* +(.*
4f20: 29 7d 0a 09 09 73 65 74 20 73 65 63 6f 6e 64 4d )}...set secondM
4f30: 61 74 63 68 20 7b 5e 3d 3d 3d 3d 3d 3d 3d 2a 7d atch {^=======*}
4f40: 0a 09 09 73 65 74 20 74 68 69 72 64 4d 61 74 63 ...set thirdMatc
4f50: 68 20 7b 5e 3e 3e 3e 3e 3e 3e 3e 2a 20 2b 28 2e h {^>>>>>>>* +(.
4f60: 2a 29 7d 0a 09 20 20 20 20 7d 20 65 6c 73 65 69 *)}.. } elsei
4f70: 66 20 7b 5b 72 65 67 65 78 70 20 7b 5e 3e 3e 3e f {[regexp {^>>>
4f80: 3e 3e 3e 3e 2a 20 2b 28 2e 2a 29 7d 20 24 6c 69 >>>>* +(.*)} $li
4f90: 6e 65 5d 7d 20 7b 0a 09 09 73 65 74 20 66 69 72 ne]} {...set fir
4fa0: 73 74 4d 61 74 63 68 20 7b 5e 3e 3e 3e 3e 3e 3e stMatch {^>>>>>>
4fb0: 3e 2a 20 2b 28 2e 2a 29 7d 0a 09 09 73 65 74 20 >* +(.*)}...set
4fc0: 73 65 63 6f 6e 64 4d 61 74 63 68 20 7b 5e 3c 3c secondMatch {^<<
4fd0: 3c 3c 3c 3c 3c 2a 20 2b 28 2e 2a 29 7d 0a 09 09 <<<<<* +(.*)}...
4fe0: 73 65 74 20 74 68 69 72 64 4d 61 74 63 68 20 7b set thirdMatch {
4ff0: 5e 3d 3d 3d 3d 3d 3d 3d 2a 7d 0a 09 20 20 20 20 ^=======*}..
5000: 7d 0a 09 7d 0a 09 69 66 20 7b 24 66 69 72 73 74 }..}..if {$first
5010: 4d 61 74 63 68 20 21 3d 20 22 22 7d 20 7b 0a 09 Match != ""} {..
5020: 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 70 20 if {[regexp
5030: 24 66 69 72 73 74 4d 61 74 63 68 20 24 6c 69 6e $firstMatch $lin
5040: 65 5d 7d 20 7b 0a 09 09 73 65 74 20 6f 75 74 70 e]} {...set outp
5050: 75 74 20 32 0a 09 09 69 66 20 7b 24 73 65 63 6f ut 2...if {$seco
5060: 6e 64 6e 61 6d 65 20 3d 3d 20 22 22 7d 20 7b 0a ndname == ""} {.
5070: 09 09 20 20 20 20 72 65 67 65 78 70 20 24 66 69 .. regexp $fi
5080: 72 73 74 4d 61 74 63 68 20 24 6c 69 6e 65 20 61 rstMatch $line a
5090: 6c 6c 20 73 65 63 6f 6e 64 6e 61 6d 65 0a 09 09 ll secondname...
50a0: 7d 0a 09 20 20 20 20 7d 20 65 6c 73 65 69 66 20 }.. } elseif
50b0: 7b 5b 72 65 67 65 78 70 20 24 73 65 63 6f 6e 64 {[regexp $second
50c0: 4d 61 74 63 68 20 24 6c 69 6e 65 5d 7d 20 7b 0a Match $line]} {.
50d0: 09 09 73 65 74 20 6f 75 74 70 75 74 20 31 0a 09 ..set output 1..
50e0: 09 69 66 20 7b 24 66 69 72 73 74 6e 61 6d 65 20 .if {$firstname
50f0: 3d 3d 20 22 22 7d 20 7b 0a 09 09 20 20 20 20 72 == ""} {... r
5100: 65 67 65 78 70 20 24 73 65 63 6f 6e 64 4d 61 74 egexp $secondMat
5110: 63 68 20 24 6c 69 6e 65 20 61 6c 6c 20 66 69 72 ch $line all fir
5120: 73 74 6e 61 6d 65 0a 09 09 7d 0a 09 20 20 20 20 stname...}..
5130: 7d 20 65 6c 73 65 69 66 20 7b 5b 72 65 67 65 78 } elseif {[regex
5140: 70 20 24 74 68 69 72 64 4d 61 74 63 68 20 24 6c p $thirdMatch $l
5150: 69 6e 65 5d 7d 20 7b 0a 09 09 73 65 74 20 6f 75 ine]} {...set ou
5160: 74 70 75 74 20 33 0a 09 09 69 66 20 7b 24 66 69 tput 3...if {$fi
5170: 72 73 74 6e 61 6d 65 20 3d 3d 20 22 22 7d 20 7b rstname == ""} {
5180: 0a 09 09 20 20 20 20 72 65 67 65 78 70 20 24 74 ... regexp $t
5190: 68 69 72 64 4d 61 74 63 68 20 24 6c 69 6e 65 20 hirdMatch $line
51a0: 61 6c 6c 20 66 69 72 73 74 6e 61 6d 65 0a 09 09 all firstname...
51b0: 7d 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a }.. } else {.
51c0: 09 09 69 66 20 7b 24 6f 75 74 70 75 74 20 26 20 ..if {$output &
51d0: 31 7d 20 7b 0a 09 09 20 20 20 20 70 75 74 73 20 1} {... puts
51e0: 24 66 69 72 73 74 20 24 6c 69 6e 65 0a 09 09 7d $first $line...}
51f0: 0a 09 09 69 66 20 7b 24 6f 75 74 70 75 74 20 26 ...if {$output &
5200: 20 32 7d 20 7b 0a 09 09 20 20 20 20 70 75 74 73 2} {... puts
5210: 20 24 73 65 63 6f 6e 64 20 24 6c 69 6e 65 0a 09 $second $line..
5220: 09 7d 0a 09 20 20 20 20 7d 0a 09 7d 20 65 6c 73 .}.. }..} els
5230: 65 20 7b 0a 09 20 20 20 20 70 75 74 73 20 24 66 e {.. puts $f
5240: 69 72 73 74 20 24 6c 69 6e 65 0a 09 20 20 20 20 irst $line..
5250: 70 75 74 73 20 24 73 65 63 6f 6e 64 20 24 6c 69 puts $second $li
5260: 6e 65 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 20 20 ne..}. }.
5270: 63 6c 6f 73 65 20 24 69 6e 70 75 74 0a 20 20 20 close $input.
5280: 20 63 6c 6f 73 65 20 24 66 69 72 73 74 0a 20 20 close $first.
5290: 20 20 63 6c 6f 73 65 20 24 73 65 63 6f 6e 64 0a close $second.
52a0: 0a 20 20 20 20 69 66 20 7b 24 66 69 72 73 74 6e . if {$firstn
52b0: 61 6d 65 20 3d 3d 20 22 22 7d 20 7b 0a 09 73 65 ame == ""} {..se
52c0: 74 20 66 69 72 73 74 6e 61 6d 65 20 22 6f 6c 64 t firstname "old
52d0: 22 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b ". }. if {
52e0: 24 73 65 63 6f 6e 64 6e 61 6d 65 20 3d 3d 20 22 $secondname == "
52f0: 22 7d 20 7b 0a 09 73 65 74 20 73 65 63 6f 6e 64 "} {..set second
5300: 6e 61 6d 65 20 22 6e 65 77 22 0a 20 20 20 20 7d name "new". }
5310: 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 22 7b 24 .. return "{$
5320: 74 65 6d 70 31 7d 20 7b 24 74 65 6d 70 32 7d 20 temp1} {$temp2}
5330: 7b 24 66 69 72 73 74 6e 61 6d 65 7d 20 7b 24 73 {$firstname} {$s
5340: 65 63 6f 6e 64 6e 61 6d 65 7d 22 0a 7d 0a 0a 23 econdname}".}..#
5350: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5360: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5370: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5380: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5390: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
53a0: 20 47 65 74 20 61 20 72 65 76 69 73 69 6f 6e 20 Get a revision
53b0: 6f 66 20 61 20 66 69 6c 65 0a 23 20 20 20 66 20 of a file.# f
53c0: 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 file
53d0: 6e 61 6d 65 0a 23 20 20 20 69 6e 64 65 78 20 20 name.# index
53e0: 20 69 6e 64 65 78 20 69 6e 20 66 69 6e 66 6f 20 index in finfo
53f0: 61 72 72 61 79 0a 23 20 20 20 72 20 20 20 20 20 array.# r
5400: 20 20 20 20 20 20 20 72 65 76 69 73 69 6f 6e 2c revision,
5410: 20 22 22 20 66 6f 72 20 68 65 61 64 20 72 65 76 "" for head rev
5420: 69 73 69 6f 6e 0a 23 23 23 23 23 23 23 23 23 23 ision.##########
5430: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5440: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5450: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5460: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
5470: 23 23 23 23 23 0a 70 72 6f 63 20 67 65 74 2d 66 #####.proc get-f
5480: 69 6c 65 2d 72 65 76 20 7b 66 20 69 6e 64 65 78 ile-rev {f index
5490: 20 7b 72 20 22 22 7d 7d 20 7b 0a 20 20 20 20 64 {r ""}} {. d
54a0: 65 62 75 67 2d 69 6e 66 6f 20 22 67 65 74 2d 66 ebug-info "get-f
54b0: 69 6c 65 2d 72 65 76 20 28 24 66 20 24 69 6e 64 ile-rev ($f $ind
54c0: 65 78 20 5c 22 24 72 5c 22 29 22 0a 20 20 20 20 ex \"$r\")".
54d0: 67 6c 6f 62 61 6c 20 66 69 6e 66 6f 0a 20 20 20 global finfo.
54e0: 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 global opts.
54f0: 20 67 6c 6f 62 61 6c 20 74 63 6c 5f 70 6c 61 74 global tcl_plat
5500: 66 6f 72 6d 0a 0a 20 20 20 20 69 66 20 7b 22 24 form.. if {"$
5510: 72 22 20 3d 3d 20 22 22 7d 20 7b 0a 09 73 65 74 r" == ""} {..set
5520: 20 72 65 76 20 22 48 45 41 44 22 0a 09 73 65 74 rev "HEAD"..set
5530: 20 61 63 72 65 76 20 22 48 45 41 44 22 0a 09 73 acrev "HEAD"..s
5540: 65 74 20 61 63 6f 70 74 20 22 22 0a 09 73 65 74 et acopt ""..set
5550: 20 63 76 73 6f 70 74 20 22 22 0a 09 73 65 74 20 cvsopt ""..set
5560: 73 76 6e 6f 70 74 20 22 22 0a 09 73 65 74 20 72 svnopt ""..set r
5570: 63 73 6f 70 74 20 22 22 0a 09 73 65 74 20 73 63 csopt ""..set sc
5580: 63 73 6f 70 74 20 22 22 0a 09 73 65 74 20 62 6b csopt ""..set bk
5590: 6f 70 74 20 22 22 0a 09 73 65 74 20 70 76 63 73 opt ""..set pvcs
55a0: 6f 70 74 20 22 22 0a 09 73 65 74 20 70 34 66 69 opt ""..set p4fi
55b0: 6c 65 20 22 24 66 22 0a 20 20 20 20 7d 20 65 6c le "$f". } el
55c0: 73 65 20 7b 0a 09 73 65 74 20 72 65 76 20 22 72 se {..set rev "r
55d0: 24 72 22 0a 09 73 65 74 20 61 63 72 65 76 20 22 $r"..set acrev "
55e0: 5c 22 24 72 5c 22 22 0a 09 73 65 74 20 61 63 6f \"$r\""..set aco
55f0: 70 74 20 22 2d 76 20 5c 22 24 72 5c 22 22 0a 09 pt "-v \"$r\""..
5600: 73 65 74 20 63 76 73 6f 70 74 20 22 2d 72 20 24 set cvsopt "-r $
5610: 72 22 0a 09 73 65 74 20 73 76 6e 6f 70 74 20 22 r"..set svnopt "
5620: 2d 72 20 24 72 22 0a 09 73 65 74 20 72 63 73 6f -r $r"..set rcso
5630: 70 74 20 22 24 72 22 0a 09 73 65 74 20 73 63 63 pt "$r"..set scc
5640: 73 6f 70 74 20 22 2d 72 24 72 22 0a 09 73 65 74 sopt "-r$r"..set
5650: 20 62 6b 6f 70 74 20 22 2d 72 24 72 22 0a 09 73 bkopt "-r$r"..s
5660: 65 74 20 70 76 63 73 6f 70 74 20 22 2d 72 24 72 et pvcsopt "-r$r
5670: 22 0a 09 73 65 74 20 70 34 66 69 6c 65 20 22 24 "..set p4file "$
5680: 66 23 24 72 22 0a 20 20 20 20 7d 0a 0a 20 20 20 f#$r". }..
5690: 20 73 65 74 20 66 69 6e 66 6f 28 70 74 68 2c 24 set finfo(pth,$
56a0: 69 6e 64 65 78 29 20 5b 74 6d 70 66 69 6c 65 20 index) [tmpfile
56b0: 24 69 6e 64 65 78 5d 0a 20 20 20 20 73 65 74 20 $index]. set
56c0: 66 69 6e 66 6f 28 74 6d 70 2c 24 69 6e 64 65 78 finfo(tmp,$index
56d0: 29 20 31 0a 0a 20 20 20 20 23 20 4e 42 3a 20 69 ) 1.. # NB: i
56e0: 74 20 77 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 t would probably
56f0: 20 62 65 20 61 20 47 6f 6f 64 20 54 68 69 6e 67 be a Good Thing
5700: 20 74 6f 20 6d 6f 76 65 20 74 68 65 20 64 65 66 to move the def
5710: 69 6e 69 74 69 6f 6e 0a 20 20 20 20 23 20 6f 66 inition. # of
5720: 20 74 68 65 20 76 61 72 69 6f 75 73 20 63 6f 6d the various com
5730: 6d 61 6e 64 20 74 6f 20 65 78 65 63 2c 20 74 6f mand to exec, to
5740: 20 74 68 65 20 70 72 65 66 65 72 65 6e 63 65 73 the preferences
5750: 20 64 69 61 6c 6f 67 2e 0a 0a 20 20 20 20 72 65 dialog... re
5760: 67 73 75 62 20 2d 61 6c 6c 20 7b 5c 24 7d 20 24 gsub -all {\$} $
5770: 66 20 7b 5c 24 7d 20 66 0a 20 20 20 20 73 65 74 f {\$} f. set
5780: 20 64 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 dirname [file d
5790: 69 72 6e 61 6d 65 20 24 66 5d 0a 20 20 20 20 73 irname $f]. s
57a0: 65 74 20 74 61 69 6c 6e 61 6d 65 20 5b 66 69 6c et tailname [fil
57b0: 65 20 74 61 69 6c 20 24 66 5d 0a 0a 20 20 20 20 e tail $f]..
57c0: 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 24 66 22 debug-info " $f"
57d0: 0a 20 20 20 20 23 20 46 6f 72 20 43 56 53 2c 20 . # For CVS,
57e0: 69 66 20 69 74 20 69 73 6e 27 74 20 63 68 65 63 if it isn't chec
57f0: 6b 65 64 20 6f 75 74 20 74 68 65 72 65 20 69 73 ked out there is
5800: 20 6e 65 69 74 68 65 72 20 61 20 43 56 53 20 6e neither a CVS n
5810: 6f 72 20 52 43 53 0a 20 20 20 20 23 20 64 69 72 or RCS. # dir
5820: 65 63 74 6f 72 79 2e 20 20 49 74 20 77 69 6c 6c ectory. It will
5830: 20 68 6f 77 65 76 65 72 20 68 61 76 65 20 61 20 however have a
5840: 2c 76 20 73 75 66 66 69 78 20 6a 75 73 74 20 6c ,v suffix just l
5850: 69 6b 65 20 72 63 73 2e 0a 20 20 20 20 23 20 54 ike rcs.. # T
5860: 68 65 72 65 20 69 73 20 6e 6f 74 20 6e 65 63 65 here is not nece
5870: 73 73 61 72 69 6c 79 20 61 20 52 43 53 20 64 69 ssarily a RCS di
5880: 72 65 63 74 6f 72 79 20 66 6f 72 20 52 43 53 2c rectory for RCS,
5890: 20 65 69 74 68 65 72 2e 20 54 68 65 20 66 69 6c either. The fil
58a0: 65 0a 20 20 20 20 23 20 61 6c 77 61 79 73 20 68 e. # always h
58b0: 61 73 20 61 20 2c 76 20 73 75 66 66 69 78 2e 0a as a ,v suffix..
58c0: 0a 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 69 . if {[file i
58d0: 73 64 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 sdirectory [file
58e0: 20 6a 6f 69 6e 20 24 64 69 72 6e 61 6d 65 20 43 join $dirname C
58f0: 56 53 5d 5d 7d 20 7b 0a 09 73 65 74 20 63 6d 64 VS]]} {..set cmd
5900: 20 22 63 76 73 22 0a 09 69 66 20 7b 24 3a 3a 74 "cvs"..if {$::t
5910: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 cl_platform(plat
5920: 66 6f 72 6d 29 20 3d 3d 20 22 77 69 6e 64 6f 77 form) == "window
5930: 73 22 7d 20 7b 0a 09 20 20 20 20 61 70 70 65 6e s"} {.. appen
5940: 64 20 63 6d 64 20 22 2e 65 78 65 22 0a 09 7d 0a d cmd ".exe"..}.
5950: 09 73 65 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 .set finfo(lbl,$
5960: 69 6e 64 65 78 29 20 22 24 66 20 28 43 56 53 20 index) "$f (CVS
5970: 24 72 65 76 29 22 0a 09 64 65 62 75 67 2d 69 6e $rev)"..debug-in
5980: 66 6f 20 22 20 20 53 65 74 74 69 6e 67 20 6c 62 fo " Setting lb
5990: 6c 20 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e l $finfo(lbl,$in
59a0: 64 65 78 29 22 0a 09 64 69 65 2d 75 6e 6c 65 73 dex)"..die-unles
59b0: 73 20 22 65 78 65 63 20 24 63 6d 64 20 75 70 64 s "exec $cmd upd
59c0: 61 74 65 20 2d 70 20 24 63 76 73 6f 70 74 20 5c ate -p $cvsopt \
59d0: 22 24 66 5c 22 22 20 22 5c 22 24 66 69 6e 66 6f "$f\"" "\"$finfo
59e0: 28 70 74 68 2c 24 69 6e 64 65 78 29 5c 22 22 0a (pth,$index)\"".
59f0: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 66 } elseif {[f
5a00: 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 ile isdirectory
5a10: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 6e [file join $dirn
5a20: 61 6d 65 20 2e 73 76 6e 5d 5d 7d 20 7b 0a 09 73 ame .svn]]} {..s
5a30: 65 74 20 63 6d 64 20 22 73 76 6e 22 0a 09 69 66 et cmd "svn"..if
5a40: 20 7b 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 {$::tcl_platfor
5a50: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 m(platform) == "
5a60: 77 69 6e 64 6f 77 73 22 7d 20 7b 0a 09 20 20 20 windows"} {..
5a70: 20 61 70 70 65 6e 64 20 63 6d 64 20 22 2e 65 78 append cmd ".ex
5a80: 65 22 0a 09 7d 0a 09 69 66 20 7b 22 24 72 22 20 e"..}..if {"$r"
5a90: 3d 3d 20 22 22 20 7c 7c 20 22 24 72 65 76 22 20 == "" || "$rev"
5aa0: 3d 3d 20 22 72 42 41 53 45 22 7d 20 7b 0a 09 20 == "rBASE"} {..
5ab0: 20 20 20 73 65 74 20 66 69 6e 66 6f 28 6c 62 6c set finfo(lbl
5ac0: 2c 24 69 6e 64 65 78 29 20 22 24 66 20 28 53 56 ,$index) "$f (SV
5ad0: 4e 20 42 41 53 45 29 22 0a 09 20 20 20 20 64 65 N BASE)".. de
5ae0: 62 75 67 2d 69 6e 66 6f 20 22 20 20 53 65 74 74 bug-info " Sett
5af0: 69 6e 67 20 6c 62 6c 20 24 66 69 6e 66 6f 28 6c ing lbl $finfo(l
5b00: 62 6c 2c 24 69 6e 64 65 78 29 22 0a 09 20 20 20 bl,$index)"..
5b10: 20 64 69 65 2d 75 6e 6c 65 73 73 20 22 65 78 65 die-unless "exe
5b20: 63 20 63 61 74 20 24 64 69 72 6e 61 6d 65 2f 2e c cat $dirname/.
5b30: 73 76 6e 2f 74 65 78 74 2d 62 61 73 65 2f 24 74 svn/text-base/$t
5b40: 61 69 6c 6e 61 6d 65 2e 73 76 6e 2d 62 61 73 65 ailname.svn-base
5b50: 22 20 5c 0a 09 20 20 20 20 20 20 24 66 69 6e 66 " \.. $finf
5b60: 6f 28 70 74 68 2c 24 69 6e 64 65 78 29 0a 09 7d o(pth,$index)..}
5b70: 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 else {.. set
5b80: 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 finfo(lbl,$inde
5b90: 78 29 20 22 24 66 20 28 53 56 4e 20 24 72 65 76 x) "$f (SVN $rev
5ba0: 29 22 0a 09 20 20 20 20 64 65 62 75 67 2d 69 6e )".. debug-in
5bb0: 66 6f 20 22 20 20 53 65 74 74 69 6e 67 20 6c 62 fo " Setting lb
5bc0: 6c 20 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e l $finfo(lbl,$in
5bd0: 64 65 78 29 22 0a 09 20 20 20 20 64 69 65 2d 75 dex)".. die-u
5be0: 6e 6c 65 73 73 20 22 65 78 65 63 20 24 63 6d 64 nless "exec $cmd
5bf0: 20 63 61 74 20 24 73 76 6e 6f 70 74 20 24 66 22 cat $svnopt $f"
5c00: 20 24 66 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 $finfo(pth,$ind
5c10: 65 78 29 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 ex)..}. } els
5c20: 65 69 66 20 7b 5b 66 69 6c 65 20 69 73 64 69 72 eif {[file isdir
5c30: 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 6a 6f 69 ectory [file joi
5c40: 6e 20 24 64 69 72 6e 61 6d 65 20 53 43 43 53 5d n $dirname SCCS]
5c50: 5d 7d 20 7b 0a 09 69 66 20 7b 5b 73 63 63 73 2d ]} {..if {[sccs-
5c60: 69 73 2d 62 6b 5d 7d 20 7b 0a 09 20 20 20 20 73 is-bk]} {.. s
5c70: 65 74 20 63 6d 64 20 22 62 6b 22 0a 09 20 20 20 et cmd "bk"..
5c80: 20 73 65 74 20 6f 70 74 20 24 62 6b 6f 70 74 0a set opt $bkopt.
5c90: 09 20 20 20 20 73 65 74 20 66 69 6e 66 6f 28 6c . set finfo(l
5ca0: 62 6c 2c 24 69 6e 64 65 78 29 20 22 24 66 20 28 bl,$index) "$f (
5cb0: 62 69 74 6b 65 65 70 65 72 20 24 72 65 76 29 22 bitkeeper $rev)"
5cc0: 0a 09 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f .. debug-info
5cd0: 20 22 20 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 " Setting lbl
5ce0: 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 $finfo(lbl,$inde
5cf0: 78 29 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 x)"..} else {..
5d00: 20 20 20 73 65 74 20 66 69 6e 66 6f 28 6c 62 6c set finfo(lbl
5d10: 2c 24 69 6e 64 65 78 29 20 22 24 66 20 28 53 43 ,$index) "$f (SC
5d20: 43 53 20 24 72 65 76 29 22 0a 09 20 20 20 20 64 CS $rev)".. d
5d30: 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 53 65 74 ebug-info " Set
5d40: 74 69 6e 67 20 6c 62 6c 20 24 66 69 6e 66 6f 28 ting lbl $finfo(
5d50: 6c 62 6c 2c 24 69 6e 64 65 78 29 22 0a 09 20 20 lbl,$index)"..
5d60: 20 20 73 65 74 20 6f 70 74 20 24 73 63 63 73 6f set opt $sccso
5d70: 70 74 0a 09 20 20 20 20 73 65 74 20 63 6d 64 20 pt.. set cmd
5d80: 22 73 63 63 73 22 0a 09 7d 0a 09 69 66 20 7b 24 "sccs"..}..if {$
5d90: 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 ::tcl_platform(p
5da0: 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 77 69 6e latform) == "win
5db0: 64 6f 77 73 22 7d 20 7b 0a 09 20 20 20 20 61 70 dows"} {.. ap
5dc0: 70 65 6e 64 20 63 6d 64 20 22 2e 65 78 65 22 0a pend cmd ".exe".
5dd0: 09 7d 0a 09 64 69 65 2d 75 6e 6c 65 73 73 20 22 .}..die-unless "
5de0: 65 78 65 63 20 24 63 6d 64 20 67 65 74 20 2d 70 exec $cmd get -p
5df0: 20 24 6f 70 74 20 5c 22 24 66 5c 22 22 20 22 5c $opt \"$f\"" "\
5e00: 22 24 66 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 "$finfo(pth,$ind
5e10: 65 78 29 5c 22 22 0a 0a 0a 20 20 20 20 7d 20 65 ex)\""... } e
5e20: 6c 73 65 69 66 20 7b 5b 66 69 6c 65 20 69 73 64 lseif {[file isd
5e30: 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 6a irectory [file j
5e40: 6f 69 6e 20 24 64 69 72 6e 61 6d 65 20 52 43 53 oin $dirname RCS
5e50: 5d 5d 7d 20 7b 0a 09 73 65 74 20 63 6d 64 20 22 ]]} {..set cmd "
5e60: 63 6f 22 0a 09 69 66 20 7b 24 3a 3a 74 63 6c 5f co"..if {$::tcl_
5e70: 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 platform(platfor
5e80: 6d 29 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d m) == "windows"}
5e90: 20 7b 0a 09 20 20 20 20 61 70 70 65 6e 64 20 63 {.. append c
5ea0: 6d 64 20 22 2e 65 78 65 22 0a 09 7d 0a 09 73 65 md ".exe"..}..se
5eb0: 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 t finfo(lbl,$ind
5ec0: 65 78 29 20 22 24 66 20 28 52 43 53 20 24 72 65 ex) "$f (RCS $re
5ed0: 76 29 22 0a 09 64 65 62 75 67 2d 69 6e 66 6f 20 v)"..debug-info
5ee0: 22 20 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 24 " Setting lbl $
5ef0: 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 finfo(lbl,$index
5f00: 29 22 0a 09 64 69 65 2d 75 6e 6c 65 73 73 20 22 )"..die-unless "
5f10: 65 78 65 63 20 24 63 6d 64 20 2d 70 24 72 63 73 exec $cmd -p$rcs
5f20: 6f 70 74 20 5c 22 24 66 5c 22 22 20 22 5c 22 24 opt \"$f\"" "\"$
5f30: 66 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 65 78 finfo(pth,$index
5f40: 29 5c 22 22 0a 0a 20 20 20 20 7d 20 65 6c 73 65 )\"".. } else
5f50: 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 if {[file exists
5f60: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
5f70: 6e 61 6d 65 20 24 74 61 69 6c 6e 61 6d 65 2c 76 name $tailname,v
5f80: 5d 5d 7d 20 7b 0a 09 73 65 74 20 63 6d 64 20 22 ]]} {..set cmd "
5f90: 63 6f 22 0a 09 69 66 20 7b 24 3a 3a 74 63 6c 5f co"..if {$::tcl_
5fa0: 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 platform(platfor
5fb0: 6d 29 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d m) == "windows"}
5fc0: 20 7b 0a 09 20 20 20 20 61 70 70 65 6e 64 20 63 {.. append c
5fd0: 6d 64 20 22 2e 65 78 65 22 0a 09 7d 0a 09 73 65 md ".exe"..}..se
5fe0: 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 t finfo(lbl,$ind
5ff0: 65 78 29 20 22 24 66 20 28 52 43 53 20 24 72 65 ex) "$f (RCS $re
6000: 76 29 22 0a 09 64 65 62 75 67 2d 69 6e 66 6f 20 v)"..debug-info
6010: 22 20 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 24 " Setting lbl $
6020: 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 finfo(lbl,$index
6030: 29 22 0a 09 64 69 65 2d 75 6e 6c 65 73 73 20 22 )"..die-unless "
6040: 65 78 65 63 20 24 63 6d 64 20 2d 70 24 72 63 73 exec $cmd -p$rcs
6050: 6f 70 74 20 5c 22 24 66 5c 22 22 20 5c 22 22 24 opt \"$f\"" \""$
6060: 66 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 65 78 finfo(pth,$index
6070: 29 5c 22 22 0a 0a 20 20 20 20 7d 20 65 6c 73 65 )\"".. } else
6080: 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 if {[file exists
6090: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
60a0: 6e 61 6d 65 20 76 63 73 2e 63 66 67 5d 5d 7d 20 name vcs.cfg]]}
60b0: 7b 0a 09 73 65 74 20 63 6d 64 20 22 67 65 74 22 {..set cmd "get"
60c0: 0a 09 69 66 20 7b 24 3a 3a 74 63 6c 5f 70 6c 61 ..if {$::tcl_pla
60d0: 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20 tform(platform)
60e0: 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d 20 7b 0a == "windows"} {.
60f0: 09 20 20 20 20 61 70 70 65 6e 64 20 63 6d 64 20 . append cmd
6100: 22 2e 65 78 65 22 0a 09 7d 0a 09 73 65 74 20 66 ".exe"..}..set f
6110: 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 29 info(lbl,$index)
6120: 20 22 24 66 20 28 50 56 43 53 20 24 72 65 76 29 "$f (PVCS $rev)
6130: 22 0a 09 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 "..debug-info "
6140: 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 24 66 69 Setting lbl $fi
6150: 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 29 22 nfo(lbl,$index)"
6160: 0a 09 64 69 65 2d 75 6e 6c 65 73 73 20 22 65 78 ..die-unless "ex
6170: 65 63 20 24 63 6d 64 20 2d 70 20 24 70 76 63 73 ec $cmd -p $pvcs
6180: 6f 70 74 20 5c 22 24 66 5c 22 22 20 22 5c 22 24 opt \"$f\"" "\"$
6190: 66 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 65 78 finfo(pth,$index
61a0: 29 5c 22 22 0a 09 66 69 6c 74 65 72 43 52 43 52 )\""..filterCRCR
61b0: 4c 46 20 24 66 69 6e 66 6f 28 70 74 68 2c 24 69 LF $finfo(pth,$i
61c0: 6e 64 65 78 29 0a 0a 20 20 20 20 7d 20 65 6c 73 ndex).. } els
61d0: 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 eif {[info exist
61e0: 73 20 3a 3a 65 6e 76 28 50 34 43 4c 49 45 4e 54 s ::env(P4CLIENT
61f0: 29 5d 7d 20 7b 0a 09 73 65 74 20 63 6d 64 20 22 )]} {..set cmd "
6200: 70 34 22 0a 09 69 66 20 7b 24 3a 3a 74 63 6c 5f p4"..if {$::tcl_
6210: 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 platform(platfor
6220: 6d 29 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d m) == "windows"}
6230: 20 7b 0a 09 20 20 20 20 61 70 70 65 6e 64 20 63 {.. append c
6240: 6d 64 20 22 2e 65 78 65 22 0a 09 7d 0a 09 73 65 md ".exe"..}..se
6250: 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 t finfo(lbl,$ind
6260: 65 78 29 20 22 24 66 20 28 50 65 72 66 6f 72 63 ex) "$f (Perforc
6270: 65 20 24 72 65 76 29 22 0a 09 64 65 62 75 67 2d e $rev)"..debug-
6280: 69 6e 66 6f 20 22 20 20 53 65 74 74 69 6e 67 20 info " Setting
6290: 6c 62 6c 20 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 lbl $finfo(lbl,$
62a0: 69 6e 64 65 78 29 22 0a 09 64 69 65 2d 75 6e 6c index)"..die-unl
62b0: 65 73 73 20 22 65 78 65 63 20 24 63 6d 64 20 70 ess "exec $cmd p
62c0: 72 69 6e 74 20 2d 71 20 5c 22 24 70 34 66 69 6c rint -q \"$p4fil
62d0: 65 5c 22 22 20 22 5c 22 24 66 69 6e 66 6f 28 70 e\"" "\"$finfo(p
62e0: 74 68 2c 24 69 6e 64 65 78 29 5c 22 22 0a 0a 20 th,$index)\""..
62f0: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e } elseif {[in
6300: 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 fo exists ::env(
6310: 41 43 43 55 52 45 56 5f 42 49 4e 29 5d 7d 20 7b ACCUREV_BIN)]} {
6320: 0a 09 73 65 74 20 63 6d 64 20 22 61 63 63 75 72 ..set cmd "accur
6330: 65 76 22 0a 09 69 66 20 7b 24 3a 3a 74 63 6c 5f ev"..if {$::tcl_
6340: 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 platform(platfor
6350: 6d 29 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d m) == "windows"}
6360: 20 7b 0a 09 20 20 20 20 61 70 70 65 6e 64 20 63 {.. append c
6370: 6d 64 20 22 2e 65 78 65 22 0a 09 7d 0a 09 73 65 md ".exe"..}..se
6380: 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 t finfo(lbl,$ind
6390: 65 78 29 20 22 24 66 20 28 24 61 63 72 65 76 29 ex) "$f ($acrev)
63a0: 22 0a 09 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 "..debug-info "
63b0: 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 24 66 69 Setting lbl $fi
63c0: 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 29 22 nfo(lbl,$index)"
63d0: 0a 09 64 69 65 2d 75 6e 6c 65 73 73 20 22 65 78 ..die-unless "ex
63e0: 65 63 20 24 63 6d 64 20 63 61 74 20 24 61 63 6f ec $cmd cat $aco
63f0: 70 74 20 5c 22 24 66 5c 22 22 20 22 5c 22 24 66 pt \"$f\"" "\"$f
6400: 69 6e 66 6f 28 70 74 68 2c 24 69 6e 64 65 78 29 info(pth,$index)
6410: 5c 22 22 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 \"". } elseif
6420: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
6430: 3a 65 6e 76 28 43 4c 45 41 52 43 41 53 45 5f 52 :env(CLEARCASE_R
6440: 4f 4f 54 29 5d 7d 20 7b 0a 09 73 65 74 20 63 6d OOT)]} {..set cm
6450: 64 20 22 63 6c 65 61 72 74 6f 6f 6c 22 0a 0a 09 d "cleartool"...
6460: 73 65 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 set finfo(lbl,$i
6470: 6e 64 65 78 29 20 22 24 66 20 28 43 6c 65 61 72 ndex) "$f (Clear
6480: 43 61 73 65 20 24 72 65 76 29 22 0a 09 64 65 62 Case $rev)"..deb
6490: 75 67 2d 69 6e 66 6f 20 22 20 20 53 65 74 74 69 ug-info " Setti
64a0: 6e 67 20 6c 62 6c 20 24 66 69 6e 66 6f 28 6c 62 ng lbl $finfo(lb
64b0: 6c 2c 24 69 6e 64 65 78 29 22 0a 0a 09 63 61 74 l,$index)"...cat
64c0: 63 68 20 7b 65 78 65 63 20 24 63 6d 64 20 6c 73 ch {exec $cmd ls
64d0: 20 2d 73 20 24 66 7d 20 63 74 6c 73 0a 0a 09 23 -s $f} ctls...#
64e0: 20 67 65 74 20 74 68 65 20 70 61 74 68 20 6e 61 get the path na
64f0: 6d 65 20 74 6f 20 66 69 6c 65 20 6d 69 6e 75 73 me to file minus
6500: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 69 6e the revision in
6510: 66 6f 0a 09 23 20 28 65 69 74 68 65 72 20 43 48 fo..# (either CH
6520: 45 43 4b 45 44 4f 55 54 20 6f 72 20 61 20 6e 75 ECKEDOUT or a nu
6530: 6d 62 65 72 29 0a 09 69 66 20 7b 21 5b 72 65 67 mber)..if {![reg
6540: 65 78 70 20 7b 28 5c 53 2b 29 2f 28 5b 5e 2f 5d exp {(\S+)/([^/]
6550: 2b 29 24 7d 20 24 63 74 6c 73 20 64 75 6d 6d 79 +)$} $ctls dummy
6560: 20 70 61 74 68 20 63 68 65 63 6b 65 64 6f 75 74 path checkedout
6570: 5d 7d 20 7b 0a 09 20 20 20 20 70 75 74 73 20 22 ]} {.. puts "
6580: 43 6f 75 6c 64 6e 27 74 20 70 61 72 73 65 20 63 Couldn't parse c
6590: 74 20 6c 73 20 6f 75 74 70 75 74 20 27 24 63 74 t ls output '$ct
65a0: 6c 73 27 22 0a 09 20 20 20 20 65 78 69 74 0a 09 ls'".. exit..
65b0: 7d 0a 0a 09 63 61 74 63 68 20 7b 65 78 65 63 20 }...catch {exec
65c0: 24 63 6d 64 20 6c 73 68 69 73 74 6f 72 79 20 2d $cmd lshistory -
65d0: 6c 61 73 74 20 35 30 20 24 66 7d 20 63 74 6c 73 last 50 $f} ctls
65e0: 68 69 73 74 6f 72 79 0a 0a 09 73 65 74 20 6c 69 history...set li
65f0: 6e 65 73 20 5b 73 70 6c 69 74 20 24 63 74 6c 73 nes [split $ctls
6600: 68 69 73 74 6f 72 79 20 22 5c 6e 22 5d 0a 09 73 history "\n"]..s
6610: 65 74 20 70 72 65 64 65 63 65 73 73 6f 72 20 22 et predecessor "
6620: 22 0a 0a 09 23 20 66 69 6e 64 20 74 68 65 20 70 "...# find the p
6630: 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 0a revious version.
6640: 09 69 66 20 7b 24 63 68 65 63 6b 65 64 6f 75 74 .if {$checkedout
6650: 20 3d 3d 20 22 43 48 45 43 4b 45 44 4f 55 54 22 == "CHECKEDOUT"
6660: 20 7c 7c 20 24 63 68 65 63 6b 65 64 6f 75 74 20 || $checkedout
6670: 3d 3d 20 30 7d 20 7b 0a 09 20 20 20 20 69 66 20 == 0} {.. if
6680: 7b 24 63 68 65 63 6b 65 64 6f 75 74 20 3d 3d 20 {$checkedout ==
6690: 30 7d 20 7b 0a 09 09 73 65 74 20 70 61 74 68 20 0} {...set path
66a0: 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 70 [file dirname $p
66b0: 61 74 68 5d 0a 09 20 20 20 20 7d 0a 0a 09 20 20 ath].. }...
66c0: 20 20 73 65 74 20 70 61 74 74 65 72 6e 20 22 63 set pattern "c
66d0: 72 65 61 74 65 20 76 65 72 73 69 6f 6e 20 5c 22 reate version \"
66e0: 28 24 70 61 74 68 2f 5c 5b 5e 2f 5c 5d 2b 29 5c ($path/\[^/\]+)\
66f0: 22 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 ""..} else {..
6700: 20 20 69 6e 63 72 20 63 68 65 63 6b 65 64 6f 75 incr checkedou
6710: 74 20 2d 31 0a 0a 09 20 20 20 20 73 65 74 20 70 t -1... set p
6720: 61 74 74 65 72 6e 20 22 63 72 65 61 74 65 20 76 attern "create v
6730: 65 72 73 69 6f 6e 20 5c 22 28 24 70 61 74 68 2f ersion \"($path/
6740: 24 63 68 65 63 6b 65 64 6f 75 74 29 5c 22 22 0a $checkedout)\"".
6750: 09 7d 0a 0a 09 23 20 73 65 61 72 63 68 20 74 68 .}...# search th
6760: 65 20 68 69 73 74 6f 72 79 20 6f 66 20 74 68 65 e history of the
6770: 20 66 69 6c 65 20 66 6f 72 20 74 68 65 20 6c 61 file for the la
6780: 74 65 73 74 20 76 65 72 73 69 6f 6e 20 6f 6e 20 test version on
6790: 6f 75 72 20 62 72 61 6e 63 68 0a 09 66 6f 72 65 our branch..fore
67a0: 61 63 68 20 6c 20 24 6c 69 6e 65 73 20 7b 0a 09 ach l $lines {..
67b0: 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 70 20 if {[regexp
67c0: 24 70 61 74 74 65 72 6e 20 24 6c 20 64 75 6d 6d $pattern $l dumm
67d0: 79 20 70 72 65 64 65 63 65 73 73 6f 72 5d 7d 20 y predecessor]}
67e0: 7b 0a 09 09 62 72 65 61 6b 0a 09 20 20 20 20 7d {...break.. }
67f0: 0a 09 7d 0a 0a 09 69 66 20 7b 24 70 72 65 64 65 ..}...if {$prede
6800: 63 65 73 73 6f 72 20 21 3d 20 22 22 7d 20 7b 0a cessor != ""} {.
6810: 09 20 20 20 20 73 65 74 20 66 69 6e 66 6f 28 70 . set finfo(p
6820: 74 68 2c 24 69 6e 64 65 78 29 20 24 70 72 65 64 th,$index) $pred
6830: 65 63 65 73 73 6f 72 0a 09 20 20 20 20 64 65 62 ecessor.. deb
6840: 75 67 2d 69 6e 66 6f 20 22 20 20 53 65 74 74 69 ug-info " Setti
6850: 6e 67 20 6c 62 6c 20 66 72 6f 6d 20 70 72 65 64 ng lbl from pred
6860: 65 63 65 73 73 6f 72 20 24 66 69 6e 66 6f 28 6c ecessor $finfo(l
6870: 62 6c 2c 24 69 6e 64 65 78 29 22 0a 09 7d 20 65 bl,$index)"..} e
6880: 6c 73 65 20 7b 0a 09 20 20 20 20 70 75 74 73 20 lse {.. puts
6890: 22 43 6f 75 6c 64 6e 27 74 20 64 65 61 6c 20 77 "Couldn't deal w
68a0: 69 74 68 20 24 66 2c 20 65 78 69 74 69 6e 67 2e ith $f, exiting.
68b0: 2e 2e 22 0a 09 20 20 20 20 65 78 69 74 0a 09 7d ..".. exit..}
68c0: 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 66 . } else {..f
68d0: 61 74 61 6c 2d 65 72 72 6f 72 20 22 46 69 6c 65 atal-error "File
68e0: 20 27 24 66 27 20 69 73 20 6e 6f 74 20 70 61 72 '$f' is not par
68f0: 74 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 20 t of a revision
6900: 63 6f 6e 74 72 6f 6c 20 73 79 73 74 65 6d 22 0a control system".
6910: 20 20 20 20 7d 0a 20 20 20 20 23 20 48 65 61 64 }. # Head
6920: 65 72 20 61 62 6f 76 65 20 65 61 63 68 20 66 69 er above each fi
6930: 6c 65 20 2d 20 69 66 20 75 73 65 72 20 68 61 73 le - if user has
6940: 20 73 70 65 63 69 66 69 65 64 20 2d 4c 2c 20 6f specified -L, o
6950: 76 65 72 72 69 64 65 0a 20 20 20 20 23 64 65 62 verride. #deb
6960: 75 67 2d 69 6e 66 6f 20 22 20 20 24 66 69 6e 66 ug-info " $finf
6970: 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 29 22 0a 20 o(lbl,$index)".
6980: 20 20 20 69 66 20 7b 24 66 69 6e 66 6f 28 75 73 if {$finfo(us
6990: 65 72 6c 62 6c 2c 24 69 6e 64 65 78 29 20 21 3d erlbl,$index) !=
69a0: 20 7b 7d 7d 20 7b 0a 09 73 65 74 20 66 69 6e 66 {}} {..set finf
69b0: 6f 28 6c 62 6c 2c 24 69 6e 64 65 78 29 20 24 66 o(lbl,$index) $f
69c0: 69 6e 66 6f 28 75 73 65 72 6c 62 6c 2c 24 69 6e info(userlbl,$in
69d0: 64 65 78 29 0a 09 64 65 62 75 67 2d 69 6e 66 6f dex)..debug-info
69e0: 20 22 20 20 55 73 65 72 20 6c 61 62 65 6c 3a 20 " User label:
69f0: 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 65 $finfo(lbl,$inde
6a00: 78 29 22 0a 20 20 20 20 7d 0a 7d 0a 0a 70 72 6f x)". }.}..pro
6a10: 63 20 73 63 63 73 2d 69 73 2d 62 6b 20 7b 7d 20 c sccs-is-bk {}
6a20: 7b 0a 20 20 20 20 73 65 74 20 63 6d 64 20 5b 61 {. set cmd [a
6a30: 75 74 6f 5f 65 78 65 63 6f 6b 20 22 62 6b 22 5d uto_execok "bk"]
6a40: 0a 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 . set result
6a50: 30 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 0. if {[strin
6a60: 67 20 6c 65 6e 67 74 68 20 24 63 6d 64 5d 20 3e g length $cmd] >
6a70: 20 30 7d 20 7b 0a 09 69 66 20 7b 21 5b 63 61 74 0} {..if {![cat
6a80: 63 68 20 7b 65 78 65 63 20 62 6b 20 72 6f 6f 74 ch {exec bk root
6a90: 7d 20 65 72 72 6f 72 5d 7d 20 7b 0a 09 20 20 20 } error]} {..
6aa0: 20 73 65 74 20 72 65 73 75 6c 74 20 31 0a 09 7d set result 1..}
6ab0: 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 . }. retur
6ac0: 6e 20 24 72 65 73 75 6c 74 0a 7d 0a 0a 23 23 23 n $result.}..###
6ad0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6ae0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6af0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6b00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6b10: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 53 ############.# S
6b20: 65 74 75 70 20 6f 72 64 69 6e 61 72 79 20 66 69 etup ordinary fi
6b30: 6c 65 0a 23 20 20 20 66 20 20 20 20 20 20 20 20 le.# f
6b40: 20 20 20 20 66 69 6c 65 20 6e 61 6d 65 0a 23 20 file name.#
6b50: 20 20 69 6e 64 65 78 20 20 20 69 6e 64 65 78 20 index index
6b60: 69 6e 20 66 69 6e 66 6f 20 61 72 72 61 79 0a 23 in finfo array.#
6b70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6b80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6b90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6ba0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6bb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
6bc0: 72 6f 63 20 67 65 74 2d 66 69 6c 65 20 7b 66 20 roc get-file {f
6bd0: 69 6e 64 65 78 7d 20 7b 0a 20 20 20 20 64 65 62 index} {. deb
6be0: 75 67 2d 69 6e 66 6f 20 22 67 65 74 2d 66 69 6c ug-info "get-fil
6bf0: 65 20 28 24 66 20 24 69 6e 64 65 78 29 22 0a 20 e ($f $index)".
6c00: 20 20 20 67 6c 6f 62 61 6c 20 66 69 6e 66 6f 0a global finfo.
6c10: 0a 20 20 20 20 23 73 65 74 20 66 69 6e 66 6f 28 . #set finfo(
6c20: 66 2c 24 69 6e 64 65 78 29 20 24 66 0a 20 20 20 f,$index) $f.
6c30: 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 if {[file exist
6c40: 73 20 24 66 5d 20 21 3d 20 31 7d 20 7b 0a 09 66 s $f] != 1} {..f
6c50: 61 74 61 6c 2d 65 72 72 6f 72 20 22 46 69 6c 65 atal-error "File
6c60: 20 27 24 66 27 20 64 6f 65 73 20 6e 6f 74 20 65 '$f' does not e
6c70: 78 69 73 74 22 0a 09 72 65 74 75 72 6e 20 31 0a xist"..return 1.
6c80: 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 5b 66 }. if {[f
6c90: 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 ile isdirectory
6ca0: 24 66 5d 7d 20 7b 0a 09 66 61 74 61 6c 2d 65 72 $f]} {..fatal-er
6cb0: 72 6f 72 20 22 27 24 66 27 20 69 73 20 61 20 64 ror "'$f' is a d
6cc0: 69 72 65 63 74 6f 72 79 22 0a 09 72 65 74 75 72 irectory"..retur
6cd0: 6e 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 n 1. }.. #
6ce0: 20 48 65 61 64 65 72 20 61 62 6f 76 65 20 65 61 Header above ea
6cf0: 63 68 20 66 69 6c 65 20 2d 20 75 73 65 20 66 69 ch file - use fi
6d00: 6c 65 6e 61 6d 65 20 75 6e 6c 65 73 73 0a 20 20 lename unless.
6d10: 20 20 23 20 75 73 65 72 20 68 61 73 20 73 70 65 # user has spe
6d20: 63 69 66 69 65 64 20 6f 6e 65 20 77 69 74 68 20 cified one with
6d30: 2d 4c 0a 20 20 20 20 73 65 74 20 66 69 6e 66 6f -L. set finfo
6d40: 28 6c 62 6c 2c 24 69 6e 64 65 78 29 20 22 24 66 (lbl,$index) "$f
6d50: 22 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f ". debug-info
6d60: 20 22 20 20 53 65 74 74 69 6e 67 20 6c 62 6c 20 " Setting lbl
6d70: 20 24 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 $finfo(lbl,$ind
6d80: 65 78 29 22 0a 20 20 20 20 69 66 20 7b 24 66 69 ex)". if {$fi
6d90: 6e 66 6f 28 75 73 65 72 6c 62 6c 2c 24 69 6e 64 nfo(userlbl,$ind
6da0: 65 78 29 20 21 3d 20 7b 7d 7d 20 7b 0a 09 73 65 ex) != {}} {..se
6db0: 74 20 66 69 6e 66 6f 28 6c 62 6c 2c 24 69 6e 64 t finfo(lbl,$ind
6dc0: 65 78 29 20 24 66 69 6e 66 6f 28 75 73 65 72 6c ex) $finfo(userl
6dd0: 62 6c 2c 24 69 6e 64 65 78 29 0a 09 64 65 62 75 bl,$index)..debu
6de0: 67 2d 69 6e 66 6f 20 22 20 20 55 73 65 72 20 6c g-info " User l
6df0: 61 62 65 6c 3a 20 24 66 69 6e 66 6f 28 6c 62 6c abel: $finfo(lbl
6e00: 2c 24 69 6e 64 65 78 29 22 0a 20 20 20 20 7d 0a ,$index)". }.
6e10: 20 20 20 20 73 65 74 20 66 69 6e 66 6f 28 70 74 set finfo(pt
6e20: 68 2c 24 69 6e 64 65 78 29 20 22 24 66 22 0a 20 h,$index) "$f".
6e30: 20 20 20 73 65 74 20 66 69 6e 66 6f 28 74 6d 70 set finfo(tmp
6e40: 2c 24 69 6e 64 65 78 29 20 30 0a 20 20 20 20 72 ,$index) 0. r
6e50: 65 74 75 72 6e 20 30 0a 7d 0a 0a 23 23 23 23 23 eturn 0.}..#####
6e60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6e70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6e80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6e90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6ea0: 23 23 23 23 23 23 23 23 23 23 0a 23 20 52 65 61 ##########.# Rea
6eb0: 64 20 74 68 65 20 63 6f 6d 6d 61 6e 64 6c 69 6e d the commandlin
6ec0: 65 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 e.##############
6ed0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6ee0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6ef0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6f00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6f10: 23 0a 70 72 6f 63 20 63 6f 6d 6d 61 6e 64 6c 69 #.proc commandli
6f20: 6e 65 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 ne {} {. debu
6f30: 67 2d 69 6e 66 6f 20 22 63 6f 6d 6d 61 6e 64 6c g-info "commandl
6f40: 69 6e 65 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 ine". global
6f50: 61 72 67 76 0a 20 20 20 20 67 6c 6f 62 61 6c 20 argv. global
6f60: 61 72 67 63 0a 20 20 20 20 64 65 62 75 67 2d 69 argc. debug-i
6f70: 6e 66 6f 20 22 20 20 61 72 67 76 3a 20 24 61 72 nfo " argv: $ar
6f80: 67 76 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 gv". global f
6f90: 69 6e 66 6f 0a 20 20 20 20 67 6c 6f 62 61 6c 20 info. global
6fa0: 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 opts. global
6fb0: 67 0a 0a 20 20 20 20 73 65 74 20 67 28 69 6e 69 g.. set g(ini
6fc0: 74 4f 4b 29 20 30 0a 20 20 20 20 73 65 74 20 61 tOK) 0. set a
6fd0: 72 67 69 6e 64 65 78 20 30 0a 20 20 20 20 73 65 rgindex 0. se
6fe0: 74 20 72 65 76 73 20 30 0a 20 20 20 20 73 65 74 t revs 0. set
6ff0: 20 70 74 68 73 20 30 0a 20 20 20 20 73 65 74 20 pths 0. set
7000: 6c 62 6c 73 20 30 0a 20 20 20 20 23 20 4c 6f 6f lbls 0. # Loo
7010: 70 20 74 68 72 6f 75 67 68 20 61 72 67 76 2c 20 p through argv,
7020: 73 74 6f 72 69 6e 67 20 72 65 76 69 73 69 6f 6e storing revision
7030: 20 61 72 67 73 20 69 6e 20 72 65 76 20 61 6e 64 args in rev and
7040: 20 66 69 6c 65 20 61 72 67 73 20 69 6e 0a 20 20 file args in.
7050: 20 20 23 20 66 69 6e 66 6f 2e 20 72 65 76 73 20 # finfo. revs
7060: 61 6e 64 20 70 74 68 73 20 61 72 65 20 63 6f 75 and pths are cou
7070: 6e 74 65 72 73 2e 0a 20 20 20 20 77 68 69 6c 65 nters.. while
7080: 20 7b 24 61 72 67 69 6e 64 65 78 20 3c 20 24 61 {$argindex < $a
7090: 72 67 63 7d 20 7b 0a 09 73 65 74 20 61 72 67 20 rgc} {..set arg
70a0: 5b 6c 69 6e 64 65 78 20 24 61 72 67 76 20 24 61 [lindex $argv $a
70b0: 72 67 69 6e 64 65 78 5d 0a 09 73 77 69 74 63 68 rgindex]..switch
70c0: 20 2d 72 65 67 65 78 70 20 2d 2d 20 24 61 72 67 -regexp -- $arg
70d0: 20 7b 0a 09 22 5e 2d 68 22 20 2d 0a 09 22 5e 2d {.."^-h" -.."^-
70e0: 2d 68 65 6c 70 22 20 7b 0a 09 09 64 6f 2d 75 73 -help" {...do-us
70f0: 61 67 65 20 63 6c 69 6e 65 0a 09 09 65 78 69 74 age cline...exit
7100: 20 30 0a 09 20 20 20 20 7d 0a 09 22 5e 2d 61 24 0.. }.."^-a$
7110: 22 20 7b 0a 09 09 69 6e 63 72 20 61 72 67 69 6e " {...incr argin
7120: 64 65 78 0a 09 09 73 65 74 20 67 28 61 6e 63 66 dex...set g(ancf
7130: 69 6c 65 29 20 5b 6c 69 6e 64 65 78 20 24 61 72 ile) [lindex $ar
7140: 67 76 20 24 61 72 67 69 6e 64 65 78 5d 0a 09 20 gv $argindex]..
7150: 20 20 20 7d 0a 09 22 5e 2d 61 2e 2a 22 20 7b 0a }.."^-a.*" {.
7160: 09 09 73 65 74 20 67 28 61 6e 63 66 69 6c 65 29 ..set g(ancfile)
7170: 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24 [string range $
7180: 61 72 67 20 32 20 65 6e 64 5d 0a 09 20 20 20 20 arg 2 end]..
7190: 7d 0a 09 22 5e 2d 76 24 22 20 2d 0a 09 22 5e 2d }.."^-v$" -.."^-
71a0: 72 24 22 20 7b 0a 09 09 69 6e 63 72 20 61 72 67 r$" {...incr arg
71b0: 69 6e 64 65 78 0a 09 09 69 6e 63 72 20 72 65 76 index...incr rev
71c0: 73 0a 09 09 73 65 74 20 66 69 6e 66 6f 28 72 65 s...set finfo(re
71d0: 76 73 2c 24 72 65 76 73 29 20 5b 6c 69 6e 64 65 vs,$revs) [linde
71e0: 78 20 24 61 72 67 76 20 24 61 72 67 69 6e 64 65 x $argv $arginde
71f0: 78 5d 0a 09 20 20 20 20 7d 0a 09 22 5e 2d 76 2e x].. }.."^-v.
7200: 2a 22 20 2d 0a 09 22 5e 2d 72 2e 2a 22 20 7b 0a *" -.."^-r.*" {.
7210: 09 09 69 6e 63 72 20 72 65 76 73 0a 09 09 73 65 ..incr revs...se
7220: 74 20 66 69 6e 66 6f 28 72 65 76 73 2c 24 72 65 t finfo(revs,$re
7230: 76 73 29 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 vs) [string rang
7240: 65 20 24 61 72 67 20 32 20 65 6e 64 5d 0a 09 20 e $arg 2 end]..
7250: 20 20 20 7d 0a 09 22 5e 2d 4c 24 22 20 7b 0a 09 }.."^-L$" {..
7260: 09 69 6e 63 72 20 61 72 67 69 6e 64 65 78 0a 09 .incr argindex..
7270: 09 69 6e 63 72 20 6c 62 6c 73 0a 09 09 73 65 74 .incr lbls...set
7280: 20 66 69 6e 66 6f 28 75 73 65 72 6c 62 6c 2c 24 finfo(userlbl,$
7290: 6c 62 6c 73 29 20 5b 6c 69 6e 64 65 78 20 24 61 lbls) [lindex $a
72a0: 72 67 76 20 24 61 72 67 69 6e 64 65 78 5d 0a 09 rgv $argindex]..
72b0: 20 20 20 20 7d 0a 09 22 5e 2d 4c 2e 2a 22 20 7b }.."^-L.*" {
72c0: 0a 09 09 69 6e 63 72 20 6c 62 6c 73 0a 09 09 73 ...incr lbls...s
72d0: 65 74 20 66 69 6e 66 6f 28 75 73 65 72 6c 62 6c et finfo(userlbl
72e0: 2c 24 6c 62 6c 73 29 20 5b 73 74 72 69 6e 67 20 ,$lbls) [string
72f0: 72 61 6e 67 65 20 24 61 72 67 20 32 20 65 6e 64 range $arg 2 end
7300: 5d 0a 09 20 20 20 20 7d 0a 09 22 5e 2d 63 6f 6e ].. }.."^-con
7310: 66 6c 69 63 74 24 22 20 7b 0a 09 09 73 65 74 20 flict$" {...set
7320: 67 28 63 6f 6e 66 6c 69 63 74 73 65 74 29 20 31 g(conflictset) 1
7330: 0a 09 20 20 20 20 7d 0a 09 22 5e 2d 6f 24 22 20 .. }.."^-o$"
7340: 7b 0a 09 09 69 6e 63 72 20 61 72 67 69 6e 64 65 {...incr arginde
7350: 78 0a 09 09 73 65 74 20 67 28 6d 65 72 67 65 66 x...set g(mergef
7360: 69 6c 65 29 20 5b 6c 69 6e 64 65 78 20 24 61 72 ile) [lindex $ar
7370: 67 76 20 24 61 72 67 69 6e 64 65 78 5d 0a 09 20 gv $argindex]..
7380: 20 20 20 7d 0a 09 22 5e 2d 6f 2e 2a 22 20 7b 0a }.."^-o.*" {.
7390: 09 09 73 65 74 20 67 28 6d 65 72 67 65 66 69 6c ..set g(mergefil
73a0: 65 29 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 e) [string range
73b0: 20 24 61 72 67 20 32 20 65 6e 64 5d 0a 09 20 20 $arg 2 end]..
73c0: 20 20 7d 0a 09 22 5e 2d 70 73 6e 22 20 7b 0a 09 }.."^-psn" {..
73d0: 09 23 20 49 67 6e 6f 72 65 20 74 68 65 20 43 61 .# Ignore the Ca
73e0: 72 62 6f 6e 20 50 72 6f 63 65 73 73 20 53 65 72 rbon Process Ser
73f0: 69 61 6c 20 4e 75 6d 62 65 72 0a 09 09 73 65 74 ial Number...set
7400: 20 61 72 67 76 20 5b 6c 72 65 70 6c 61 63 65 20 argv [lreplace
7410: 24 61 72 67 76 20 24 61 72 67 69 6e 64 65 78 20 $argv $argindex
7420: 24 61 72 67 69 6e 64 65 78 5d 0a 09 09 69 6e 63 $argindex]...inc
7430: 72 20 61 72 67 63 20 2d 31 0a 09 09 69 6e 63 72 r argc -1...incr
7440: 20 61 72 67 69 6e 64 65 78 0a 09 20 20 20 20 7d argindex.. }
7450: 0a 09 22 5e 2d 22 20 7b 0a 09 09 61 70 70 65 6e .."^-" {...appen
7460: 64 20 6f 70 74 73 28 64 69 66 66 63 6d 64 29 20 d opts(diffcmd)
7470: 22 20 24 61 72 67 20 22 0a 09 20 20 20 20 7d 0a " $arg ".. }.
7480: 09 64 65 66 61 75 6c 74 20 7b 0a 09 09 69 6e 63 .default {...inc
7490: 72 20 70 74 68 73 0a 09 09 73 65 74 20 66 69 6e r pths...set fin
74a0: 66 6f 28 70 74 68 2c 24 70 74 68 73 29 20 24 61 fo(pth,$pths) $a
74b0: 72 67 0a 09 09 73 65 74 20 66 69 6e 66 6f 28 66 rg...set finfo(f
74c0: 2c 24 70 74 68 73 29 20 24 61 72 67 0a 09 20 20 ,$pths) $arg..
74d0: 20 20 7d 0a 09 7d 0a 09 69 6e 63 72 20 61 72 67 }..}..incr arg
74e0: 69 6e 64 65 78 0a 20 20 20 20 7d 0a 0a 20 20 20 index. }..
74f0: 20 23 20 41 64 64 20 6f 75 72 20 63 6f 75 6e 74 # Add our count
7500: 65 72 73 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 ers to the globa
7510: 6c 20 61 72 72 61 79 0a 20 20 20 20 23 20 4e 6f l array. # No
7520: 77 20 63 68 65 63 6b 20 68 6f 77 20 6d 61 6e 79 w check how many
7530: 20 72 65 76 69 73 69 6f 6e 20 61 6e 64 20 66 69 revision and fi
7540: 6c 65 20 61 72 67 73 20 77 65 20 68 61 76 65 2e le args we have.
7550: 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 . debug-info
7560: 22 20 20 24 70 74 68 73 20 66 69 6c 65 73 2c 20 " $pths files,
7570: 24 72 65 76 73 20 72 65 76 69 73 69 6f 6e 73 22 $revs revisions"
7580: 0a 20 20 20 20 23 20 4d 61 79 62 65 20 61 64 6a . # Maybe adj
7590: 75 73 74 6d 65 6e 74 20 69 73 20 6e 65 65 64 65 ustment is neede
75a0: 64 0a 20 20 20 20 69 66 20 7b 24 72 65 76 73 20 d. if {$revs
75b0: 3d 3d 20 31 20 26 26 20 24 70 74 68 73 20 3d 3d == 1 && $pths ==
75c0: 20 30 7d 20 7b 0a 20 20 20 20 20 20 20 23 20 74 0} {. # t
75d0: 6b 64 69 66 66 20 2d 72 20 46 49 4c 45 3b 20 73 kdiff -r FILE; s
75e0: 61 6d 65 20 61 73 20 74 6b 64 69 66 66 20 46 49 ame as tkdiff FI
75f0: 4c 45 0a 20 20 20 20 20 20 20 73 65 74 20 66 69 LE. set fi
7600: 6e 66 6f 28 70 74 68 73 2c 31 29 20 24 66 69 6e nfo(pths,1) $fin
7610: 66 6f 28 72 65 76 73 2c 31 29 0a 20 20 20 20 20 fo(revs,1).
7620: 20 20 73 65 74 20 66 69 6e 66 6f 28 66 2c 31 29 set finfo(f,1)
7630: 20 24 66 69 6e 66 6f 28 72 65 76 73 2c 31 29 0a $finfo(revs,1).
7640: 20 20 20 20 20 20 20 69 6e 63 72 20 70 74 68 73 incr pths
7650: 20 31 0a 20 20 20 20 20 20 20 69 6e 63 72 20 72 1. incr r
7660: 65 76 73 20 2d 31 0a 20 20 20 20 20 20 20 75 6e evs -1. un
7670: 73 65 74 20 66 69 6e 66 6f 28 72 65 76 73 2c 31 set finfo(revs,1
7680: 29 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b ). } elseif {
7690: 24 72 65 76 73 20 3d 3d 20 32 20 26 26 20 24 70 $revs == 2 && $p
76a0: 74 68 73 20 3d 3d 20 30 7d 20 7b 0a 20 20 20 20 ths == 0} {.
76b0: 20 20 20 23 20 74 6b 64 69 66 66 20 2d 72 52 45 # tkdiff -rRE
76c0: 56 20 2d 72 20 46 49 4c 45 3b 20 73 61 6d 65 20 V -r FILE; same
76d0: 61 73 20 74 6b 64 69 66 66 20 2d 72 52 45 56 20 as tkdiff -rREV
76e0: 46 49 4c 45 0a 20 20 20 20 20 20 20 73 65 74 20 FILE. set
76f0: 66 69 6e 66 6f 28 70 74 68 73 2c 31 29 20 24 66 finfo(pths,1) $f
7700: 69 6e 66 6f 28 72 65 76 73 2c 32 29 0a 20 20 20 info(revs,2).
7710: 20 20 20 20 73 65 74 20 66 69 6e 66 6f 28 66 2c set finfo(f,
7720: 31 29 20 24 66 69 6e 66 6f 28 72 65 76 73 2c 32 1) $finfo(revs,2
7730: 29 0a 20 20 20 20 20 20 20 69 6e 63 72 20 70 74 ). incr pt
7740: 68 73 20 31 0a 20 20 20 20 20 20 20 69 6e 63 72 hs 1. incr
7750: 20 72 65 76 73 20 2d 31 0a 20 20 20 20 20 20 20 revs -1.
7760: 75 6e 73 65 74 20 66 69 6e 66 6f 28 72 65 76 73 unset finfo(revs
7770: 2c 32 29 0a 20 20 20 20 7d 0a 20 20 20 20 23 20 ,2). }. #
7780: 57 68 61 74 20 68 61 76 65 20 77 65 20 67 6f 74 What have we got
7790: 20 6e 6f 77 3f 0a 20 20 20 20 64 65 62 75 67 2d now?. debug-
77a0: 69 6e 66 6f 20 22 20 20 24 70 74 68 73 20 66 69 info " $pths fi
77b0: 6c 65 73 2c 20 24 72 65 76 73 20 72 65 76 69 73 les, $revs revis
77c0: 69 6f 6e 73 22 0a 20 20 20 20 69 66 20 7b 24 72 ions". if {$r
77d0: 65 76 73 20 3d 3d 20 30 20 26 26 20 24 70 74 68 evs == 0 && $pth
77e0: 73 20 3d 3d 20 30 7d 20 7b 0a 09 23 20 52 65 74 s == 0} {..# Ret
77f0: 75 72 6e 20 22 65 6d 70 74 79 22 20 66 6c 61 67 urn "empty" flag
7800: 2c 20 61 6e 64 20 77 65 27 6c 6c 20 64 6f 20 61 , and we'll do a
7810: 20 70 6f 70 2d 75 70 0a 09 72 65 74 75 72 6e 20 pop-up..return
7820: 31 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 1. } elseif {
7830: 24 72 65 76 73 20 3e 20 31 20 26 26 20 24 70 74 $revs > 1 && $pt
7840: 68 73 20 21 3d 20 31 7d 20 7b 0a 09 70 75 74 73 hs != 1} {..puts
7850: 20 73 74 64 65 72 72 20 22 45 72 72 6f 72 3a 20 stderr "Error:
7860: 79 6f 75 20 73 70 65 63 69 66 69 65 64 20 24 70 you specified $p
7870: 74 68 73 20 66 69 6c 65 28 73 29 20 61 6e 64 20 ths file(s) and
7880: 24 72 65 76 73 20 72 65 76 69 73 69 6f 6e 28 73 $revs revision(s
7890: 29 22 0a 09 64 6f 2d 75 73 61 67 65 20 63 6c 69 )"..do-usage cli
78a0: 6e 65 0a 09 65 78 69 74 20 31 0a 20 20 20 20 7d ne..exit 1. }
78b0: 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 6d 65 72 .. if {$g(mer
78c0: 67 65 66 69 6c 65 29 20 21 3d 20 22 22 7d 20 7b gefile) != ""} {
78d0: 0a 20 20 20 20 20 20 73 65 74 20 67 28 6d 65 72 . set g(mer
78e0: 67 65 66 69 6c 65 73 65 74 29 20 31 0a 20 20 20 gefileset) 1.
78f0: 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 30 0a }. return 0.
7900: 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 }..#############
7910: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7920: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7930: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7940: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7950: 23 23 0a 23 20 50 72 6f 63 65 73 73 20 74 68 65 ##.# Process the
7960: 20 61 72 67 75 6d 65 6e 74 73 2c 20 77 68 65 74 arguments, whet
7970: 68 65 72 20 66 72 6f 6d 20 74 68 65 20 63 6f 6d her from the com
7980: 6d 61 6e 64 20 6c 69 6e 65 20 6f 72 20 66 72 6f mand line or fro
7990: 6d 20 74 68 65 20 64 69 61 6c 6f 67 0a 23 23 23 m the dialog.###
79a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
79b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
79c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
79d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
79e0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f ############.pro
79f0: 63 20 61 73 73 65 6d 62 6c 65 2d 61 72 67 73 20 c assemble-args
7a00: 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 {} {. debug-i
7a10: 6e 66 6f 20 22 61 73 73 65 6d 62 6c 65 2d 61 72 nfo "assemble-ar
7a20: 67 73 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 gs". global f
7a30: 69 6e 66 6f 0a 20 20 20 20 67 6c 6f 62 61 6c 20 info. global
7a40: 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 opts. global
7a50: 67 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 61 6e g.. if {$g(an
7a60: 63 66 69 6c 65 29 20 21 3d 20 22 22 7d 20 7b 0a cfile) != ""} {.
7a70: 09 73 65 74 20 67 28 61 6e 63 66 69 6c 65 73 65 .set g(ancfilese
7a80: 74 29 20 31 0a 20 20 20 20 7d 0a 20 20 20 20 64 t) 1. }. d
7a90: 65 62 75 67 2d 69 6e 66 6f 20 22 20 63 6f 6e 66 ebug-info " conf
7aa0: 6c 69 63 74 3a 20 24 67 28 63 6f 6e 66 6c 69 63 lict: $g(conflic
7ab0: 74 73 65 74 29 22 0a 20 20 20 20 64 65 62 75 67 tset)". debug
7ac0: 2d 69 6e 66 6f 20 22 20 61 6e 63 65 73 74 6f 72 -info " ancestor
7ad0: 3a 20 24 67 28 61 6e 63 66 69 6c 65 73 65 74 29 : $g(ancfileset)
7ae0: 20 24 67 28 61 6e 63 66 69 6c 65 29 22 0a 20 20 $g(ancfile)".
7af0: 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 6d debug-info " m
7b00: 65 72 67 65 66 69 6c 65 20 73 65 74 3a 20 24 67 ergefile set: $g
7b10: 28 6d 65 72 67 65 66 69 6c 65 73 65 74 29 20 24 (mergefileset) $
7b20: 67 28 6d 65 72 67 65 66 69 6c 65 29 22 0a 20 20 g(mergefile)".
7b30: 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 64 debug-info " d
7b40: 69 66 66 20 63 6f 6d 6d 61 6e 64 3a 20 24 6f 70 iff command: $op
7b50: 74 73 28 64 69 66 66 63 6d 64 29 20 22 0a 0a 20 ts(diffcmd) "..
7b60: 20 20 20 23 20 43 6f 75 6e 74 20 75 70 20 68 6f # Count up ho
7b70: 77 20 6d 61 6e 79 20 66 69 6c 65 73 20 61 6e 64 w many files and
7b80: 20 72 65 76 73 20 77 65 20 67 6f 74 20 66 72 6f revs we got fro
7b90: 6d 20 74 68 65 20 47 55 49 20 6f 72 20 63 6f 6d m the GUI or com
7ba0: 6d 61 6e 64 6c 69 6e 65 0a 20 20 20 20 73 65 74 mandline. set
7bb0: 20 70 74 68 73 20 30 0a 20 20 20 20 66 6f 72 65 pths 0. fore
7bc0: 61 63 68 20 70 20 5b 61 72 72 61 79 20 6e 61 6d ach p [array nam
7bd0: 65 73 20 66 69 6e 66 6f 20 66 2c 2a 5d 20 7b 0a es finfo f,*] {.
7be0: 09 69 66 20 7b 24 66 69 6e 66 6f 28 24 70 29 20 .if {$finfo($p)
7bf0: 21 3d 20 22 22 7d 20 7b 0a 09 20 20 20 20 69 6e != ""} {.. in
7c00: 63 72 20 70 74 68 73 0a 09 7d 0a 20 20 20 20 7d cr pths..}. }
7c10: 0a 20 20 20 20 73 65 74 20 72 65 76 73 20 30 0a . set revs 0.
7c20: 20 20 20 20 66 6f 72 65 61 63 68 20 72 20 5b 61 foreach r [a
7c30: 72 72 61 79 20 6e 61 6d 65 73 20 66 69 6e 66 6f rray names finfo
7c40: 20 72 65 76 73 2c 2a 5d 20 7b 0a 09 69 66 20 7b revs,*] {..if {
7c50: 24 66 69 6e 66 6f 28 24 72 29 20 21 3d 20 22 22 $finfo($r) != ""
7c60: 7d 20 7b 0a 09 20 20 20 20 69 6e 63 72 20 72 65 } {.. incr re
7c70: 76 73 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 vs..}. }..
7c80: 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 24 70 debug-info " $p
7c90: 74 68 73 20 66 69 6c 65 73 2c 20 24 72 65 76 73 ths files, $revs
7ca0: 20 72 65 76 69 73 69 6f 6e 73 22 0a 20 20 20 20 revisions".
7cb0: 69 66 20 7b 24 72 65 76 73 20 3d 3d 20 30 20 26 if {$revs == 0 &
7cc0: 26 20 24 70 74 68 73 20 3d 3d 20 30 7d 20 7b 0a & $pths == 0} {.
7cd0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 .return. }.
7ce0: 20 20 69 66 20 7b 24 67 28 63 6f 6e 66 6c 69 63 if {$g(conflic
7cf0: 74 73 65 74 29 7d 20 7b 0a 09 69 66 20 7b 24 72 tset)} {..if {$r
7d00: 65 76 73 20 3d 3d 20 30 20 26 26 20 24 70 74 68 evs == 0 && $pth
7d10: 73 20 3d 3d 20 31 7d 20 7b 0a 09 20 20 20 20 23 s == 1} {.. #
7d20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7d30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7d40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7d50: 23 23 23 23 23 23 23 23 23 23 23 0a 09 20 20 20 ###########..
7d60: 20 23 20 74 6b 64 69 66 66 20 2d 63 6f 6e 66 6c # tkdiff -confl
7d70: 69 63 74 20 46 49 4c 45 0a 09 20 20 20 20 23 23 ict FILE.. ##
7d80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7d90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7da0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7db0: 23 23 23 23 23 23 23 23 23 23 0a 09 20 20 20 20 ##########..
7dc0: 73 65 74 20 66 69 6c 65 73 20 5b 73 70 6c 69 74 set files [split
7dd0: 2d 63 6f 6e 66 6c 69 63 74 66 69 6c 65 20 22 24 -conflictfile "$
7de0: 66 69 6e 66 6f 28 66 2c 31 29 22 5d 0a 09 20 20 finfo(f,1)"]..
7df0: 20 20 69 66 20 7b 5b 67 65 74 2d 66 69 6c 65 20 if {[get-file
7e00: 5b 6c 69 6e 64 65 78 20 22 24 66 69 6c 65 73 22 [lindex "$files"
7e10: 20 30 5d 20 31 5d 7d 20 7b 72 65 74 75 72 6e 7d 0] 1]} {return}
7e20: 0a 09 20 20 20 20 69 66 20 7b 5b 67 65 74 2d 66 .. if {[get-f
7e30: 69 6c 65 20 5b 6c 69 6e 64 65 78 20 22 24 66 69 ile [lindex "$fi
7e40: 6c 65 73 22 20 31 5d 20 32 5d 7d 20 7b 72 65 74 les" 1] 2]} {ret
7e50: 75 72 6e 7d 0a 09 20 20 20 20 23 20 41 20 63 6f urn}.. # A co
7e60: 6e 66 6c 69 63 74 20 66 69 6c 65 20 6d 61 79 20 nflict file may
7e70: 63 6f 6d 65 20 66 72 6f 6d 20 6d 65 72 67 65 2c come from merge,
7e80: 20 63 76 73 2c 20 6f 72 20 76 6d 72 67 2e 20 20 cvs, or vmrg.
7e90: 54 68 65 0a 09 20 20 20 20 23 20 6e 61 6d 65 73 The.. # names
7ea0: 20 6f 66 20 74 68 65 20 66 69 6c 65 73 2f 72 65 of the files/re
7eb0: 76 69 73 69 6f 6e 73 20 64 65 70 65 6e 64 20 6f visions depend o
7ec0: 6e 20 68 6f 77 20 69 74 20 77 61 73 20 6d 61 64 n how it was mad
7ed0: 65 20 61 6e 64 0a 09 20 20 20 20 23 20 61 72 65 e and.. # are
7ee0: 20 74 61 6b 65 6e 20 66 72 6f 6d 20 74 68 65 20 taken from the
7ef0: 3c 3c 3c 3c 3c 3c 3c 20 61 6e 64 20 3e 3e 3e 3e <<<<<<< and >>>>
7f00: 3e 3e 3e 20 6c 69 6e 65 73 20 69 6e 73 69 64 65 >>> lines inside
7f10: 20 69 74 2e 0a 09 20 20 20 20 73 65 74 20 66 69 it... set fi
7f20: 6e 66 6f 28 6c 62 6c 2c 31 29 20 5b 6c 69 6e 64 nfo(lbl,1) [lind
7f30: 65 78 20 22 24 66 69 6c 65 73 22 20 32 5d 0a 09 ex "$files" 2]..
7f40: 20 20 20 20 73 65 74 20 66 69 6e 66 6f 28 6c 62 set finfo(lb
7f50: 6c 2c 32 29 20 5b 6c 69 6e 64 65 78 20 22 24 66 l,2) [lindex "$f
7f60: 69 6c 65 73 22 20 33 5d 0a 09 7d 20 65 6c 73 65 iles" 3]..} else
7f70: 20 7b 0a 09 20 20 20 20 66 61 74 61 6c 2d 65 72 {.. fatal-er
7f80: 72 6f 72 20 22 55 73 61 67 65 3a 20 74 6b 64 69 ror "Usage: tkdi
7f90: 66 66 20 2d 63 6f 6e 66 6c 69 63 74 20 46 49 4c ff -conflict FIL
7fa0: 45 22 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 E"..}. } else
7fb0: 20 7b 0a 09 69 66 20 7b 24 72 65 76 73 20 3d 3d {..if {$revs ==
7fc0: 20 32 20 26 26 20 24 70 74 68 73 20 3d 3d 20 31 2 && $pths == 1
7fd0: 7d 20 7b 0a 09 20 20 20 20 23 23 23 23 23 23 23 } {.. #######
7fe0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7ff0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8000: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8010: 23 23 23 23 23 0a 09 20 20 20 20 23 20 20 74 6b #####.. # tk
8020: 64 69 66 66 20 2d 72 52 45 56 31 20 2d 72 52 45 diff -rREV1 -rRE
8030: 56 32 20 46 49 4c 45 0a 09 20 20 20 20 23 23 23 V2 FILE.. ###
8040: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8050: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8060: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8070: 23 23 23 23 23 23 23 23 23 0a 09 20 20 20 20 73 #########.. s
8080: 65 74 20 66 20 24 66 69 6e 66 6f 28 66 2c 31 29 et f $finfo(f,1)
8090: 0a 09 20 20 20 20 67 65 74 2d 66 69 6c 65 2d 72 .. get-file-r
80a0: 65 76 20 22 24 66 22 20 31 20 22 24 66 69 6e 66 ev "$f" 1 "$finf
80b0: 6f 28 72 65 76 73 2c 31 29 22 0a 09 20 20 20 20 o(revs,1)"..
80c0: 67 65 74 2d 66 69 6c 65 2d 72 65 76 20 22 24 66 get-file-rev "$f
80d0: 22 20 32 20 22 24 66 69 6e 66 6f 28 72 65 76 73 " 2 "$finfo(revs
80e0: 2c 32 29 22 0a 0a 09 7d 20 65 6c 73 65 69 66 20 ,2)"...} elseif
80f0: 7b 24 72 65 76 73 20 3d 3d 20 31 20 26 26 20 24 {$revs == 1 && $
8100: 70 74 68 73 20 3d 3d 20 31 7d 20 7b 0a 09 20 20 pths == 1} {..
8110: 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ##############
8120: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8130: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8140: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 09 ##############..
8150: 20 20 20 20 23 20 20 74 6b 64 69 66 66 20 2d 72 # tkdiff -r
8160: 52 45 56 20 46 49 4c 45 0a 09 20 20 20 20 23 23 REV FILE.. ##
8170: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8180: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8190: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
81a0: 23 23 23 23 23 23 23 23 23 23 0a 09 20 20 20 20 ##########..
81b0: 73 65 74 20 66 20 24 66 69 6e 66 6f 28 66 2c 31 set f $finfo(f,1
81c0: 29 0a 09 20 20 20 20 67 65 74 2d 66 69 6c 65 2d ).. get-file-
81d0: 72 65 76 20 22 24 66 22 20 31 20 22 24 66 69 6e rev "$f" 1 "$fin
81e0: 66 6f 28 72 65 76 73 2c 31 29 22 0a 09 20 20 20 fo(revs,1)"..
81f0: 20 69 66 20 7b 5b 67 65 74 2d 66 69 6c 65 20 22 if {[get-file "
8200: 24 66 22 20 32 5d 7d 20 7b 72 65 74 75 72 6e 7d $f" 2]} {return}
8210: 0a 0a 09 7d 20 65 6c 73 65 69 66 20 7b 24 72 65 ...} elseif {$re
8220: 76 73 20 3d 3d 20 30 20 26 26 20 24 70 74 68 73 vs == 0 && $pths
8230: 20 3d 3d 20 32 7d 20 7b 0a 09 20 20 20 20 23 23 == 2} {.. ##
8240: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8250: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8260: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8270: 23 23 23 23 23 23 23 23 23 23 0a 09 20 20 20 20 ##########..
8280: 23 20 20 74 6b 64 69 66 66 20 46 49 4c 45 31 20 # tkdiff FILE1
8290: 46 49 4c 45 32 0a 09 20 20 20 20 23 23 23 23 23 FILE2.. #####
82a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
82b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
82c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
82d0: 23 23 23 23 23 23 23 0a 09 20 20 20 20 73 65 74 #######.. set
82e0: 20 66 31 20 24 66 69 6e 66 6f 28 66 2c 31 29 0a f1 $finfo(f,1).
82f0: 09 20 20 20 20 73 65 74 20 66 32 20 24 66 69 6e . set f2 $fin
8300: 66 6f 28 66 2c 32 29 0a 09 20 20 20 20 69 66 20 fo(f,2).. if
8310: 7b 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f {[file isdirecto
8320: 72 79 20 24 66 31 5d 20 26 26 20 5b 66 69 6c 65 ry $f1] && [file
8330: 20 69 73 64 69 72 65 63 74 6f 72 79 20 24 66 32 isdirectory $f2
8340: 5d 7d 20 7b 0a 09 09 66 61 74 61 6c 2d 65 72 72 ]} {...fatal-err
8350: 6f 72 20 22 45 69 74 68 65 72 20 3c 66 69 6c 65 or "Either <file
8360: 31 3e 20 6f 72 20 3c 66 69 6c 65 32 3e 20 6d 75 1> or <file2> mu
8370: 73 74 20 62 65 20 61 20 70 6c 61 69 6e 20 66 69 st be a plain fi
8380: 6c 65 22 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 le".. }...
8390: 20 69 66 20 7b 5b 66 69 6c 65 20 69 73 64 69 72 if {[file isdir
83a0: 65 63 74 6f 72 79 20 24 66 31 5d 7d 20 7b 0a 09 ectory $f1]} {..
83b0: 09 73 65 74 20 66 31 20 5b 66 69 6c 65 20 6a 6f .set f1 [file jo
83c0: 69 6e 20 24 66 31 20 5b 66 69 6c 65 20 74 61 69 in $f1 [file tai
83d0: 6c 20 24 66 32 5d 5d 0a 09 20 20 20 20 7d 20 65 l $f2]].. } e
83e0: 6c 73 65 69 66 20 7b 5b 66 69 6c 65 20 69 73 64 lseif {[file isd
83f0: 69 72 65 63 74 6f 72 79 20 24 66 32 5d 7d 20 7b irectory $f2]} {
8400: 0a 09 09 73 65 74 20 66 32 20 5b 66 69 6c 65 20 ...set f2 [file
8410: 6a 6f 69 6e 20 24 66 32 20 5b 66 69 6c 65 20 74 join $f2 [file t
8420: 61 69 6c 20 24 66 31 5d 5d 0a 09 20 20 20 20 7d ail $f1]].. }
8430: 0a 0a 09 20 20 20 20 69 66 20 7b 5b 67 65 74 2d ... if {[get-
8440: 66 69 6c 65 20 22 24 66 31 22 20 31 5d 7d 20 7b file "$f1" 1]} {
8450: 72 65 74 75 72 6e 7d 0a 09 20 20 20 20 69 66 20 return}.. if
8460: 7b 5b 67 65 74 2d 66 69 6c 65 20 22 24 66 32 22 {[get-file "$f2"
8470: 20 32 5d 7d 20 7b 72 65 74 75 72 6e 7d 0a 0a 09 2]} {return}...
8480: 7d 20 65 6c 73 65 69 66 20 7b 24 72 65 76 73 20 } elseif {$revs
8490: 3d 3d 20 30 20 26 26 20 24 70 74 68 73 20 3d 3d == 0 && $pths ==
84a0: 20 31 7d 20 7b 0a 09 20 20 20 20 23 23 23 23 23 1} {.. #####
84b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
84c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
84d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
84e0: 23 23 23 23 23 23 23 0a 09 20 20 20 20 23 20 20 #######.. #
84f0: 74 6b 64 69 66 66 20 46 49 4c 45 0a 09 20 20 20 tkdiff FILE..
8500: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
8510: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8520: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8530: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 09 20 #############..
8540: 20 20 20 73 65 74 20 66 20 24 66 69 6e 66 6f 28 set f $finfo(
8550: 66 2c 31 29 0a 09 20 20 20 20 67 65 74 2d 66 69 f,1).. get-fi
8560: 6c 65 2d 72 65 76 20 22 24 66 22 20 31 0a 09 20 le-rev "$f" 1..
8570: 20 20 20 69 66 20 7b 5b 67 65 74 2d 66 69 6c 65 if {[get-file
8580: 20 22 24 66 22 20 32 5d 7d 20 7b 72 65 74 75 72 "$f" 2]} {retur
8590: 6e 7d 0a 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 n}...} else {..
85a0: 20 20 20 64 6f 2d 65 72 72 6f 72 20 22 45 72 72 do-error "Err
85b0: 6f 72 3a 20 79 6f 75 20 73 70 65 63 69 66 69 65 or: you specifie
85c0: 64 20 24 70 74 68 73 20 66 69 6c 65 28 73 29 20 d $pths file(s)
85d0: 61 6e 64 20 24 72 65 76 73 20 72 65 76 69 73 69 and $revs revisi
85e0: 6f 6e 28 73 29 22 0a 09 20 20 20 20 64 6f 2d 75 on(s)".. do-u
85f0: 73 61 67 65 20 67 75 69 0a 09 20 20 20 20 74 6b sage gui.. tk
8600: 77 61 69 74 20 77 69 6e 64 6f 77 20 2e 75 73 61 wait window .usa
8610: 67 65 0a 09 20 20 20 20 72 65 74 75 72 6e 20 31 ge.. return 1
8620: 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 ..}. }.. s
8630: 65 74 20 66 69 6e 66 6f 28 74 69 74 6c 65 29 20 et finfo(title)
8640: 22 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6e "[file tail $fin
8650: 66 6f 28 6c 62 6c 2c 31 29 5d 20 76 73 2e 20 5b fo(lbl,1)] vs. [
8660: 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6e 66 6f file tail $finfo
8670: 28 6c 62 6c 2c 32 29 5d 22 0a 20 20 20 20 64 65 (lbl,2)]". de
8680: 62 75 67 2d 69 6e 66 6f 20 22 20 20 53 65 74 74 bug-info " Sett
8690: 69 6e 67 20 74 69 74 6c 65 20 24 66 69 6e 66 6f ing title $finfo
86a0: 28 74 69 74 6c 65 29 22 0a 20 20 20 20 73 65 74 (title)". set
86b0: 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 6c 65 20 rootname [file
86c0: 72 6f 6f 74 6e 61 6d 65 20 24 66 69 6e 66 6f 28 rootname $finfo(
86d0: 70 74 68 2c 31 29 5d 0a 20 20 20 20 23 20 20 20 pth,1)]. #
86e0: 20 73 65 74 20 70 61 74 68 20 20 20 20 20 20 20 set path
86f0: 20 20 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 [file dirname
8700: 20 20 20 20 20 20 20 20 20 20 24 66 69 6e 66 6f $finfo
8710: 28 70 74 68 2c 31 29 5d 0a 20 20 20 20 73 65 74 (pth,1)]. set
8720: 20 70 61 74 68 20 5b 70 77 64 5d 0a 20 20 20 20 path [pwd].
8730: 73 65 74 20 73 75 66 66 69 78 20 5b 66 69 6c 65 set suffix [file
8740: 20 65 78 74 65 6e 73 69 6f 6e 20 24 66 69 6e 66 extension $finf
8750: 6f 28 70 74 68 2c 31 29 5d 0a 20 20 20 20 69 66 o(pth,1)]. if
8760: 20 7b 21 20 24 67 28 6d 65 72 67 65 66 69 6c 65 {! $g(mergefile
8770: 73 65 74 29 7d 20 7b 0a 09 73 65 74 20 67 28 6d set)} {..set g(m
8780: 65 72 67 65 66 69 6c 65 29 20 5b 66 69 6c 65 20 ergefile) [file
8790: 6a 6f 69 6e 20 24 70 61 74 68 20 22 24 7b 72 6f join $path "${ro
87a0: 6f 74 6e 61 6d 65 7d 2d 6d 65 72 67 65 24 73 75 otname}-merge$su
87b0: 66 66 69 78 22 5d 0a 20 20 20 20 7d 0a 20 20 20 ffix"]. }.
87c0: 20 73 65 74 20 67 28 69 6e 69 74 4f 4b 29 20 31 set g(initOK) 1
87d0: 0a 20 20 20 20 66 6f 72 65 61 63 68 20 69 6e 66 . foreach inf
87e0: 20 5b 6c 73 6f 72 74 20 5b 61 72 72 61 79 20 6e [lsort [array n
87f0: 61 6d 65 73 20 66 69 6e 66 6f 5d 5d 20 7b 0a 09 ames finfo]] {..
8800: 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 20 20 debug-info "
8810: 24 69 6e 66 3a 20 24 66 69 6e 66 6f 28 24 69 6e $inf: $finfo($in
8820: 66 29 22 0a 20 20 20 20 7d 0a 20 20 20 20 64 65 f)". }. de
8830: 62 75 67 2d 69 6e 66 6f 20 22 20 24 72 65 76 73 bug-info " $revs
8840: 20 72 65 76 73 20 20 24 70 74 68 73 20 66 69 6c revs $pths fil
8850: 65 73 22 0a 0a 20 20 20 20 77 6d 20 74 69 74 6c es".. wm titl
8860: 65 20 2e 20 22 24 66 69 6e 66 6f 28 74 69 74 6c e . "$finfo(titl
8870: 65 29 20 2d 20 24 67 28 6e 61 6d 65 29 20 24 67 e) - $g(name) $g
8880: 28 76 65 72 73 69 6f 6e 29 22 0a 20 20 20 20 72 (version)". r
8890: 65 74 75 72 6e 20 30 0a 7d 0a 0a 23 23 23 23 23 eturn 0.}..#####
88a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
88b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
88c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
88d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
88e0: 23 23 23 23 23 23 23 23 23 23 0a 23 20 53 65 74 ##########.# Set
88f0: 20 75 70 20 74 68 65 20 64 69 73 70 6c 61 79 0a up the display.
8900: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8910: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8920: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8930: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
8940: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
8950: 70 72 6f 63 20 63 72 65 61 74 65 2d 64 69 73 70 proc create-disp
8960: 6c 61 79 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 lay {} {. deb
8970: 75 67 2d 69 6e 66 6f 20 22 63 72 65 61 74 65 2d ug-info "create-
8980: 64 69 73 70 6c 61 79 22 0a 0a 20 20 20 20 67 6c display".. gl
8990: 6f 62 61 6c 20 67 20 6f 70 74 73 20 62 67 20 74 obal g opts bg t
89a0: 6b 5f 76 65 72 73 69 6f 6e 0a 20 20 20 20 67 6c k_version. gl
89b0: 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c 6f 62 61 obal w. globa
89c0: 6c 20 74 6d 70 6f 70 74 73 0a 0a 20 20 20 20 23 l tmpopts.. #
89d0: 20 74 68 65 73 65 20 61 72 65 20 74 68 65 20 66 these are the f
89e0: 6f 75 72 20 6d 61 6a 6f 72 20 61 72 65 61 73 20 our major areas
89f0: 6f 66 20 74 68 65 20 47 55 49 3a 0a 20 20 20 20 of the GUI:.
8a00: 23 20 6d 65 6e 75 62 61 72 20 2d 20 74 68 65 20 # menubar - the
8a10: 6d 65 6e 75 62 61 72 20 28 64 75 68 29 0a 20 20 menubar (duh).
8a20: 20 20 23 20 74 6f 6f 6c 62 61 72 20 2d 20 74 68 # toolbar - th
8a30: 65 20 74 6f 6f 6c 62 61 72 20 28 64 75 68 2c 20 e toolbar (duh,
8a40: 61 67 61 69 6e 29 0a 20 20 20 20 23 20 63 6c 69 again). # cli
8a50: 65 6e 74 20 20 2d 20 74 68 65 20 61 72 65 61 20 ent - the area
8a60: 77 69 74 68 20 74 68 65 20 74 65 78 74 20 77 69 with the text wi
8a70: 64 67 65 74 73 20 61 6e 64 20 74 68 65 20 67 72 dgets and the gr
8a80: 61 70 68 69 63 61 6c 20 6d 61 70 0a 20 20 20 20 aphical map.
8a90: 23 20 73 74 61 74 75 73 20 75 73 20 20 20 20 20 # status us
8aa0: 20 20 20 20 2d 20 61 20 62 6f 74 74 6f 6d 20 73 - a bottom s
8ab0: 74 61 74 75 73 20 6c 69 6e 65 0a 0a 20 20 20 20 tatus line..
8ac0: 23 20 74 68 69 73 20 62 6c 6f 63 6b 20 6f 66 20 # this block of
8ad0: 64 65 73 74 72 6f 79 73 20 69 73 20 6f 6e 6c 79 destroys is only
8ae0: 20 66 6f 72 20 73 74 61 6e 64 2d 61 6c 6f 6e 65 for stand-alone
8af0: 20 74 65 73 74 69 6e 67 20 6f 66 0a 20 20 20 20 testing of.
8b00: 23 20 74 68 65 20 47 55 49 20 63 6f 64 65 2c 20 # the GUI code,
8b10: 61 6e 64 20 63 61 6e 20 62 65 20 62 6c 6f 77 6e and can be blown
8b20: 20 61 77 61 79 20 28 6f 72 20 6e 6f 74 2c 20 69 away (or not, i
8b30: 66 20 77 65 20 77 61 6e 74 20 74 6f 0a 20 20 20 f we want to.
8b40: 20 23 20 62 65 20 61 62 6c 65 20 74 6f 20 63 61 # be able to ca
8b50: 6c 6c 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 ll this routine
8b60: 74 6f 20 72 65 63 72 65 61 74 65 20 74 68 65 20 to recreate the
8b70: 64 69 73 70 6c 61 79 2e 2e 2e 29 0a 20 20 20 20 display...).
8b80: 63 61 74 63 68 20 7b 0a 09 64 65 73 74 72 6f 79 catch {..destroy
8b90: 20 2e 6d 65 6e 75 62 61 72 0a 09 64 65 73 74 72 .menubar..destr
8ba0: 6f 79 20 2e 74 6f 6f 6c 62 61 72 0a 09 64 65 73 oy .toolbar..des
8bb0: 74 72 6f 79 20 2e 63 6c 69 65 6e 74 0a 09 64 65 troy .client..de
8bc0: 73 74 72 6f 79 20 2e 6d 61 70 0a 09 64 65 73 74 stroy .map..dest
8bd0: 72 6f 79 20 2e 73 74 61 74 75 73 0a 20 20 20 20 roy .status.
8be0: 7d 0a 0a 20 20 20 20 23 20 63 72 65 61 74 65 20 }.. # create
8bf0: 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 66 72 the top level fr
8c00: 61 6d 65 73 20 61 6e 64 20 73 74 6f 72 65 20 74 ames and store t
8c10: 68 65 6d 20 69 6e 20 61 20 67 6c 6f 62 61 6c 0a hem in a global.
8c20: 20 20 20 20 23 20 61 72 72 61 79 2e 2e 0a 20 20 # array...
8c30: 20 20 73 65 74 20 77 28 63 6c 69 65 6e 74 29 20 set w(client)
8c40: 2e 63 6c 69 65 6e 74 0a 20 20 20 20 73 65 74 20 .client. set
8c50: 77 28 6d 65 6e 75 62 61 72 29 20 2e 6d 65 6e 75 w(menubar) .menu
8c60: 62 61 72 0a 20 20 20 20 73 65 74 20 77 28 74 6f bar. set w(to
8c70: 6f 6c 62 61 72 29 20 2e 74 6f 6f 6c 62 61 72 0a olbar) .toolbar.
8c80: 20 20 20 20 73 65 74 20 77 28 73 74 61 74 75 73 set w(status
8c90: 29 20 2e 73 74 61 74 75 73 0a 0a 20 20 20 20 23 ) .status.. #
8ca0: 20 6f 74 68 65 72 20 72 61 6e 64 6f 6d 20 77 69 other random wi
8cb0: 6e 64 6f 77 73 2e 2e 2e 0a 20 20 20 20 73 65 74 ndows.... set
8cc0: 20 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 20 w(preferences)
8cd0: 2e 70 72 65 66 0a 20 20 20 20 73 65 74 20 77 28 .pref. set w(
8ce0: 66 69 6e 64 44 69 61 6c 6f 67 29 20 2e 66 69 6e findDialog) .fin
8cf0: 64 44 69 61 6c 6f 67 0a 20 20 20 20 73 65 74 20 dDialog. set
8d00: 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 2e 70 6f w(popupMenu) .po
8d10: 70 75 70 4d 65 6e 75 0a 0a 20 20 20 20 23 20 6e pupMenu.. # n
8d20: 6f 77 2c 20 73 69 6d 70 6c 79 20 62 75 69 6c 64 ow, simply build
8d30: 20 61 6c 6c 20 74 68 65 20 70 69 65 63 65 73 0a all the pieces.
8d40: 20 20 20 20 62 75 69 6c 64 2d 6d 65 6e 75 62 61 build-menuba
8d50: 72 0a 20 20 20 20 62 75 69 6c 64 2d 74 6f 6f 6c r. build-tool
8d60: 62 61 72 0a 20 20 20 20 62 75 69 6c 64 2d 63 6c bar. build-cl
8d70: 69 65 6e 74 0a 20 20 20 20 62 75 69 6c 64 2d 73 ient. build-s
8d80: 74 61 74 75 73 0a 20 20 20 20 62 75 69 6c 64 2d tatus. build-
8d90: 70 6f 70 75 70 4d 65 6e 75 0a 0a 20 20 20 20 66 popupMenu.. f
8da0: 72 61 6d 65 20 2e 73 65 70 61 72 61 74 6f 72 31 rame .separator1
8db0: 20 2d 68 65 69 67 68 74 20 32 20 2d 62 6f 72 64 -height 2 -bord
8dc0: 65 72 77 69 64 74 68 20 32 20 2d 72 65 6c 69 65 erwidth 2 -relie
8dd0: 66 20 67 72 6f 6f 76 65 0a 20 20 20 20 66 72 61 f groove. fra
8de0: 6d 65 20 2e 73 65 70 61 72 61 74 6f 72 32 20 2d me .separator2 -
8df0: 68 65 69 67 68 74 20 32 20 2d 62 6f 72 64 65 72 height 2 -border
8e00: 77 69 64 74 68 20 32 20 2d 72 65 6c 69 65 66 20 width 2 -relief
8e10: 67 72 6f 6f 76 65 0a 0a 20 20 20 20 23 20 2e 2e groove.. # ..
8e20: 2e 20 61 6e 64 20 66 69 74 20 69 74 20 61 6c 6c . and fit it all
8e30: 20 74 6f 67 65 74 68 65 72 2e 2e 2e 0a 20 20 20 together....
8e40: 20 2e 20 63 6f 6e 66 69 67 75 72 65 20 2d 6d 65 . configure -me
8e50: 6e 75 20 24 77 28 6d 65 6e 75 62 61 72 29 0a 20 nu $w(menubar).
8e60: 20 20 20 70 61 63 6b 20 24 77 28 74 6f 6f 6c 62 pack $w(toolb
8e70: 61 72 29 20 2d 73 69 64 65 20 74 6f 70 20 2d 66 ar) -side top -f
8e80: 69 6c 6c 20 78 20 2d 65 78 70 61 6e 64 20 6e 0a ill x -expand n.
8e90: 20 20 20 20 70 61 63 6b 20 2e 73 65 70 61 72 61 pack .separa
8ea0: 74 6f 72 31 20 2d 73 69 64 65 20 74 6f 70 20 2d tor1 -side top -
8eb0: 66 69 6c 6c 20 78 20 2d 65 78 70 61 6e 64 20 6e fill x -expand n
8ec0: 0a 0a 20 20 20 20 70 61 63 6b 20 24 77 28 63 6c .. pack $w(cl
8ed0: 69 65 6e 74 29 20 2d 73 69 64 65 20 74 6f 70 20 ient) -side top
8ee0: 2d 66 69 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 -fill both -expa
8ef0: 6e 64 20 79 0a 20 20 20 20 70 61 63 6b 20 2e 73 nd y. pack .s
8f00: 65 70 61 72 61 74 6f 72 32 20 2d 73 69 64 65 20 eparator2 -side
8f10: 74 6f 70 20 2d 66 69 6c 6c 20 78 20 2d 65 78 70 top -fill x -exp
8f20: 61 6e 64 20 6e 0a 0a 20 20 20 20 70 61 63 6b 20 and n.. pack
8f30: 24 77 28 73 74 61 74 75 73 29 20 2d 73 69 64 65 $w(status) -side
8f40: 20 62 6f 74 74 6f 6d 20 2d 66 69 6c 6c 20 78 20 bottom -fill x
8f50: 2d 65 78 70 61 6e 64 20 6e 0a 0a 20 20 20 20 23 -expand n.. #
8f60: 20 61 70 70 6c 79 20 75 73 65 72 20 70 72 65 66 apply user pref
8f70: 65 72 65 6e 63 65 73 20 62 79 20 63 61 6c 6c 69 erences by calli
8f80: 6e 67 20 74 68 65 20 70 72 6f 63 20 74 68 61 74 ng the proc that
8f90: 20 67 65 74 73 0a 20 20 20 20 23 20 63 61 6c 6c gets. # call
8fa0: 65 64 20 77 68 65 6e 20 74 68 65 20 75 73 65 72 ed when the user
8fb0: 20 70 72 65 73 73 65 73 20 22 41 70 70 6c 79 22 presses "Apply"
8fc0: 20 66 72 6f 6d 20 74 68 65 20 70 72 65 66 65 72 from the prefer
8fd0: 65 6e 63 65 73 0a 20 20 20 20 23 20 77 69 6e 64 ences. # wind
8fe0: 6f 77 2e 20 54 68 61 74 20 70 72 6f 63 20 75 73 ow. That proc us
8ff0: 65 73 20 61 20 67 6c 6f 62 61 6c 20 76 61 72 69 es a global vari
9000: 61 62 6c 65 20 6e 61 6d 65 64 20 22 74 6d 70 6f able named "tmpo
9010: 70 74 73 22 0a 20 20 20 20 23 20 77 68 69 63 68 pts". # which
9020: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 74 68 65 should have the
9030: 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 74 68 65 values from the
9040: 20 64 69 61 6c 6f 67 2e 20 53 69 6e 63 65 20 77 dialog. Since w
9050: 65 0a 20 20 20 20 23 20 61 72 65 6e 27 74 20 75 e. # aren't u
9060: 73 69 6e 67 20 74 68 65 20 64 69 61 6c 6f 67 2c sing the dialog,
9070: 20 77 65 20 6e 65 65 64 20 74 6f 20 70 6f 70 75 we need to popu
9080: 6c 61 74 65 20 74 68 69 73 20 61 72 72 61 79 0a late this array.
9090: 20 20 20 20 23 20 6d 61 6e 75 61 6c 6c 79 0a 20 # manually.
90a0: 20 20 20 66 6f 72 65 61 63 68 20 6b 65 79 20 5b foreach key [
90b0: 61 72 72 61 79 20 6e 61 6d 65 73 20 6f 70 74 73 array names opts
90c0: 5d 20 7b 0a 09 73 65 74 20 3a 3a 74 6d 70 6f 70 ] {..set ::tmpop
90d0: 74 73 28 24 6b 65 79 29 20 24 6f 70 74 73 28 24 ts($key) $opts($
90e0: 6b 65 79 29 0a 20 20 20 20 7d 0a 20 20 20 20 61 key). }. a
90f0: 70 70 6c 79 20 30 0a 0a 20 20 20 20 23 20 4d 61 pply 0.. # Ma
9100: 6b 65 20 73 75 72 65 20 74 65 6d 70 6f 72 61 72 ke sure temporar
9110: 79 20 66 69 6c 65 73 20 67 65 74 20 64 65 6c 65 y files get dele
9120: 74 65 64 0a 20 20 20 20 23 62 69 6e 64 20 2e 20 ted. #bind .
9130: 3c 44 65 73 74 72 6f 79 3e 20 7b 64 65 6c 2d 74 <Destroy> {del-t
9140: 6d 70 7d 0a 0a 20 20 20 20 23 20 6f 74 68 65 72 mp}.. # other
9150: 20 6d 69 73 63 2e 20 62 69 6e 64 69 6e 67 73 0a misc. bindings.
9160: 20 20 20 20 63 6f 6d 6d 6f 6e 2d 6e 61 76 69 67 common-navig
9170: 61 74 69 6f 6e 20 24 77 28 4c 65 66 74 54 65 78 ation $w(LeftTex
9180: 74 29 20 24 77 28 4c 65 66 74 49 6e 66 6f 29 20 t) $w(LeftInfo)
9190: 24 77 28 4c 65 66 74 43 42 29 20 24 77 28 52 69 $w(LeftCB) $w(Ri
91a0: 67 68 74 54 65 78 74 29 20 5c 0a 20 20 20 20 20 ghtText) \.
91b0: 20 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 24 $w(RightInfo) $
91c0: 77 28 52 69 67 68 74 43 42 29 0a 0a 20 20 20 20 w(RightCB)..
91d0: 23 20 6e 6f 72 6d 61 6c 6c 79 2c 20 6b 65 79 62 # normally, keyb
91e0: 6f 61 72 64 20 74 72 61 76 65 72 73 61 6c 20 75 oard traversal u
91f0: 73 69 6e 67 20 74 61 62 20 61 6e 64 20 73 68 69 sing tab and shi
9200: 66 74 2d 74 61 62 20 69 73 6e 27 74 0a 20 20 20 ft-tab isn't.
9210: 20 23 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 # enabled for t
9220: 65 78 74 20 77 69 64 67 65 74 73 2c 20 73 69 6e ext widgets, sin
9230: 63 65 20 74 68 65 20 64 65 66 61 75 6c 74 20 62 ce the default b
9240: 69 6e 64 69 6e 67 20 66 6f 72 20 74 68 65 73 65 inding for these
9250: 0a 20 20 20 20 23 20 6b 65 79 73 20 69 73 20 74 . # keys is t
9260: 6f 20 61 63 74 75 61 6c 6c 79 20 69 6e 73 65 72 o actually inser
9270: 74 20 74 68 65 20 74 61 62 20 63 68 61 72 61 63 t the tab charac
9280: 74 65 72 2e 20 42 65 63 61 75 73 65 20 61 6c 6c ter. Because all
9290: 20 6f 66 0a 20 20 20 20 23 20 6f 75 72 20 74 65 of. # our te
92a0: 78 74 20 77 69 64 67 65 74 73 20 61 72 65 20 66 xt widgets are f
92b0: 6f 72 20 64 69 73 70 6c 61 79 20 6f 6e 6c 79 2c or display only,
92c0: 20 6c 65 74 27 73 20 72 65 64 65 66 69 6e 65 20 let's redefine
92d0: 74 68 65 0a 20 20 20 20 23 20 64 65 66 61 75 6c the. # defaul
92e0: 74 20 62 69 6e 64 69 6e 67 20 73 6f 20 74 68 65 t binding so the
92f0: 20 67 6c 6f 62 61 6c 20 3c 54 61 62 3e 20 61 6e global <Tab> an
9300: 64 20 3c 53 68 69 66 74 2d 54 61 62 3e 20 62 69 d <Shift-Tab> bi
9310: 6e 64 69 6e 67 73 0a 20 20 20 20 23 20 61 72 65 ndings. # are
9320: 20 75 73 65 64 2e 0a 20 20 20 20 62 69 6e 64 20 used.. bind
9330: 54 65 78 74 20 3c 54 61 62 3e 20 7b 63 6f 6e 74 Text <Tab> {cont
9340: 69 6e 75 65 7d 0a 20 20 20 20 62 69 6e 64 20 54 inue}. bind T
9350: 65 78 74 20 3c 53 68 69 66 74 2d 54 61 62 3e 20 ext <Shift-Tab>
9360: 7b 63 6f 6e 74 69 6e 75 65 7d 0a 0a 20 20 20 20 {continue}..
9370: 23 20 69 66 20 74 68 65 20 75 73 65 72 20 74 6f # if the user to
9380: 67 67 6c 65 73 20 73 63 72 6f 6c 6c 62 61 72 20 ggles scrollbar
9390: 73 79 6e 63 69 6e 67 2c 20 77 65 20 77 61 6e 74 syncing, we want
93a0: 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 0a 20 20 to make sure.
93b0: 20 20 23 20 74 68 65 79 20 73 79 6e 63 20 75 70 # they sync up
93c0: 20 69 6d 6d 65 64 69 61 74 65 6c 79 0a 20 20 20 immediately.
93d0: 20 74 72 61 63 65 20 76 61 72 69 61 62 6c 65 20 trace variable
93e0: 6f 70 74 73 28 73 79 6e 63 73 63 72 6f 6c 6c 29 opts(syncscroll)
93f0: 20 77 20 74 6f 67 67 6c 65 53 79 6e 63 53 63 72 w toggleSyncScr
9400: 6f 6c 6c 0a 20 20 20 20 77 6d 20 64 65 69 63 6f oll. wm deico
9410: 6e 69 66 79 20 2e 0a 20 20 20 20 66 6f 63 75 73 nify .. focus
9420: 20 2d 66 6f 72 63 65 20 24 77 28 52 69 67 68 74 -force $w(Right
9430: 54 65 78 74 29 0a 20 20 20 20 75 70 64 61 74 65 Text). update
9440: 20 69 64 6c 65 74 61 73 6b 73 0a 20 20 20 20 23 idletasks. #
9450: 20 4e 65 65 64 20 74 68 69 73 20 74 6f 20 6d 61 Need this to ma
9460: 6b 65 20 74 68 65 20 70 61 6e 65 2d 72 65 73 69 ke the pane-resi
9470: 7a 69 6e 67 20 62 65 68 61 76 65 0a 20 20 20 20 zing behave.
9480: 67 72 69 64 20 70 72 6f 70 61 67 61 74 65 20 24 grid propagate $
9490: 77 28 63 6c 69 65 6e 74 29 20 66 0a 7d 0a 0a 23 w(client) f.}..#
94a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
94b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
94c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
94d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
94e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
94f0: 20 77 68 65 6e 20 74 68 65 20 75 73 65 72 20 63 when the user c
9500: 68 61 6e 67 65 73 20 74 68 65 20 22 73 79 6e 63 hanges the "sync
9510: 20 73 63 72 6f 6c 6c 62 61 72 73 22 20 6f 70 74 scrollbars" opt
9520: 69 6f 6e 2c 20 77 65 20 77 61 6e 74 20 74 6f 0a ion, we want to.
9530: 23 20 73 79 6e 63 20 75 70 20 74 68 65 20 6c 65 # sync up the le
9540: 66 74 20 73 63 72 6f 6c 6c 62 61 72 20 77 69 74 ft scrollbar wit
9550: 68 20 74 68 65 20 72 69 67 68 74 20 69 66 20 74 h the right if t
9560: 68 65 79 20 74 75 72 6e 20 74 68 65 20 6f 70 74 hey turn the opt
9570: 69 6f 6e 20 6f 6e 0a 23 23 23 23 23 23 23 23 23 ion on.#########
9580: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9590: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
95a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
95b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
95c0: 23 23 23 23 23 23 0a 70 72 6f 63 20 74 6f 67 67 ######.proc togg
95d0: 6c 65 53 79 6e 63 53 63 72 6f 6c 6c 20 7b 61 72 leSyncScroll {ar
95e0: 67 73 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c gs} {. global
95f0: 20 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c opts. global
9600: 20 77 0a 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 w.. if {$opt
9610: 73 28 73 79 6e 63 73 63 72 6f 6c 6c 29 20 3d 3d s(syncscroll) ==
9620: 20 31 7d 20 7b 0a 09 65 76 61 6c 20 76 73 63 72 1} {..eval vscr
9630: 6f 6c 6c 2d 73 79 6e 63 20 7b 7b 7d 7d 20 32 20 oll-sync {{}} 2
9640: 5b 24 77 28 52 69 67 68 74 54 65 78 74 29 20 79 [$w(RightText) y
9650: 76 69 65 77 5d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 view]. }.}..#
9660: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9670: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9680: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9690: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
96a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
96b0: 20 73 68 6f 77 20 74 68 65 20 70 6f 70 75 70 20 show the popup
96c0: 6d 65 6e 75 2c 20 6f 70 74 69 6f 6e 61 6c 6c 79 menu, optionally
96d0: 20 63 68 61 6e 67 69 6e 67 20 73 6f 6d 65 20 6f changing some o
96e0: 66 20 74 68 65 20 65 6e 74 72 69 65 73 20 62 61 f the entries ba
96f0: 73 65 64 20 6f 6e 0a 23 20 77 68 65 72 65 20 74 sed on.# where t
9700: 68 65 20 75 73 65 72 20 63 6c 69 63 6b 65 64 0a he user clicked.
9710: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9720: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9730: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9750: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
9760: 70 72 6f 63 20 73 68 6f 77 2d 70 6f 70 75 70 4d proc show-popupM
9770: 65 6e 75 20 7b 78 20 79 7d 20 7b 0a 20 20 20 20 enu {x y} {.
9780: 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c 6f global w. glo
9790: 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 20 77 bal g.. set w
97a0: 69 6e 64 6f 77 20 5b 77 69 6e 66 6f 20 63 6f 6e indow [winfo con
97b0: 74 61 69 6e 69 6e 67 20 24 78 20 24 79 5d 0a 20 taining $x $y].
97c0: 20 20 20 69 66 20 7b 5b 77 69 6e 66 6f 20 63 6c if {[winfo cl
97d0: 61 73 73 20 24 77 69 6e 64 6f 77 5d 20 3d 3d 20 ass $window] ==
97e0: 22 54 65 78 74 22 7d 20 7b 0a 09 24 77 28 70 6f "Text"} {..$w(po
97f0: 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f pupMenu) entryco
9800: 6e 66 69 67 75 72 65 20 22 46 69 6e 64 2e 2e 2e nfigure "Find...
9810: 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a " -state normal.
9820: 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 65 .$w(popupMenu) e
9830: 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 46 ntryconfigure "F
9840: 69 6e 64 20 4e 65 61 72 65 73 74 2a 22 20 2d 73 ind Nearest*" -s
9850: 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 tate normal..$w(
9860: 70 6f 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 popupMenu) entry
9870: 63 6f 6e 66 69 67 75 72 65 20 22 45 64 69 74 2a configure "Edit*
9880: 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a " -state normal.
9890: 0a 09 69 66 20 7b 24 77 69 6e 64 6f 77 20 3d 3d ..if {$window ==
98a0: 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 7c 7c $w(LeftText) ||
98b0: 20 24 77 69 6e 64 6f 77 20 3d 3d 20 24 77 28 4c $window == $w(L
98c0: 65 66 74 49 6e 66 6f 29 20 7c 7c 20 24 77 69 6e eftInfo) || $win
98d0: 64 6f 77 20 3d 3d 20 5c 0a 09 20 20 24 77 28 4c dow == \.. $w(L
98e0: 65 66 74 43 42 29 7d 20 7b 0a 09 20 20 20 20 24 eftCB)} {.. $
98f0: 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 63 6f 6e w(popupMenu) con
9900: 66 69 67 75 72 65 20 2d 74 69 74 6c 65 20 22 46 figure -title "F
9910: 69 6c 65 20 31 22 0a 09 20 20 20 20 73 65 74 20 ile 1".. set
9920: 67 28 61 63 74 69 76 65 57 69 6e 64 6f 77 29 20 g(activeWindow)
9930: 24 77 28 4c 65 66 74 54 65 78 74 29 0a 09 7d 20 $w(LeftText)..}
9940: 65 6c 73 65 20 7b 0a 09 20 20 20 20 24 77 28 70 else {.. $w(p
9950: 6f 70 75 70 4d 65 6e 75 29 20 63 6f 6e 66 69 67 opupMenu) config
9960: 75 72 65 20 2d 74 69 74 6c 65 20 22 46 69 6c 65 ure -title "File
9970: 20 32 22 0a 09 20 20 20 20 73 65 74 20 67 28 61 2".. set g(a
9980: 63 74 69 76 65 57 69 6e 64 6f 77 29 20 24 77 28 ctiveWindow) $w(
9990: 52 69 67 68 74 54 65 78 74 29 0a 09 7d 0a 0a 20 RightText)..}..
99a0: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 24 77 28 } else {..$w(
99b0: 70 6f 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 popupMenu) entry
99c0: 63 6f 6e 66 69 67 75 72 65 20 22 46 69 6e 64 2e configure "Find.
99d0: 2e 2e 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 .." -state disab
99e0: 6c 65 64 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e led..$w(popupMen
99f0: 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 u) entryconfigur
9a00: 65 20 22 46 69 6e 64 20 4e 65 61 72 65 73 74 2a e "Find Nearest*
9a10: 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 " -state disable
9a20: 64 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 d..$w(popupMenu)
9a30: 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 entryconfigure
9a40: 22 45 64 69 74 2a 22 20 2d 73 74 61 74 65 20 64 "Edit*" -state d
9a50: 69 73 61 62 6c 65 64 0a 20 20 20 20 7d 0a 20 20 isabled. }.
9a60: 20 20 74 6b 5f 70 6f 70 75 70 20 24 77 28 70 6f tk_popup $w(po
9a70: 70 75 70 4d 65 6e 75 29 20 24 78 20 24 79 0a 7d pupMenu) $x $y.}
9a80: 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
9a90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9aa0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9ab0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9ac0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9ad0: 23 0a 23 20 62 75 69 6c 64 20 74 68 65 20 72 69 #.# build the ri
9ae0: 67 68 74 2d 63 6c 69 63 6b 20 70 6f 70 75 70 20 ght-click popup
9af0: 6d 65 6e 75 0a 23 23 23 23 23 23 23 23 23 23 23 menu.###########
9b00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9b10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9b20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9b30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
9b40: 23 23 23 23 0a 70 72 6f 63 20 62 75 69 6c 64 2d ####.proc build-
9b50: 70 6f 70 75 70 4d 65 6e 75 20 7b 7d 20 7b 0a 20 popupMenu {} {.
9b60: 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 62 debug-info "b
9b70: 75 69 6c 64 2d 70 6f 70 75 70 4d 65 6e 75 22 0a uild-popupMenu".
9b80: 20 20 20 20 67 6c 6f 62 61 6c 20 77 20 67 0a 0a global w g..
9b90: 20 20 20 20 23 20 74 68 69 73 20 72 6f 75 74 69 # this routi
9ba0: 6e 65 20 61 73 73 75 6d 65 73 20 74 68 65 20 6f ne assumes the o
9bb0: 74 68 65 72 20 77 69 6e 64 6f 77 73 20 61 6c 72 ther windows alr
9bc0: 65 61 64 79 20 65 78 69 73 74 2e 2e 2e 0a 20 20 eady exist....
9bd0: 20 20 6d 65 6e 75 20 24 77 28 70 6f 70 75 70 4d menu $w(popupM
9be0: 65 6e 75 29 0a 20 20 20 20 66 6f 72 65 61 63 68 enu). foreach
9bf0: 20 77 69 6e 20 5b 6c 69 73 74 20 4c 65 66 74 54 win [list LeftT
9c00: 65 78 74 20 52 69 67 68 74 54 65 78 74 20 4c 65 ext RightText Le
9c10: 66 74 49 6e 66 6f 20 52 69 67 68 74 49 6e 66 6f ftInfo RightInfo
9c20: 20 4c 65 66 74 43 42 20 52 69 67 68 74 43 42 20 LeftCB RightCB
9c30: 5c 0a 20 20 20 20 20 20 6d 61 70 43 61 6e 76 61 \. mapCanva
9c40: 73 5d 20 7b 0a 09 62 69 6e 64 20 24 77 28 24 77 s] {..bind $w($w
9c50: 69 6e 29 20 3c 33 3e 20 7b 73 68 6f 77 2d 70 6f in) <3> {show-po
9c60: 70 75 70 4d 65 6e 75 20 25 58 20 25 59 7d 0a 20 pupMenu %X %Y}.
9c70: 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 6d 20 }.. set m
9c80: 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 0a 20 20 $w(popupMenu).
9c90: 20 20 24 6d 20 61 64 64 20 63 6f 6d 6d 61 6e 64 $m add command
9ca0: 20 2d 6c 61 62 65 6c 20 22 46 69 72 73 74 20 44 -label "First D
9cb0: 69 66 66 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 iff" -underline
9cc0: 30 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 0 -command [list
9cd0: 20 70 6f 70 75 70 4d 65 6e 75 20 5c 0a 20 20 20 popupMenu \.
9ce0: 20 20 20 66 69 72 73 74 5d 20 2d 61 63 63 65 6c first] -accel
9cf0: 65 72 61 74 6f 72 20 22 66 22 0a 20 20 20 20 24 erator "f". $
9d00: 6d 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c m add command -l
9d10: 61 62 65 6c 20 22 50 72 65 76 69 6f 75 73 20 44 abel "Previous D
9d20: 69 66 66 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 iff" -underline
9d30: 30 20 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 20 20 20 0 -command \.
9d40: 20 20 20 5b 6c 69 73 74 20 70 6f 70 75 70 4d 65 [list popupMe
9d50: 6e 75 20 70 72 65 76 69 6f 75 73 5d 20 2d 61 63 nu previous] -ac
9d60: 63 65 6c 65 72 61 74 6f 72 20 22 70 22 0a 20 20 celerator "p".
9d70: 20 20 24 6d 20 61 64 64 20 63 6f 6d 6d 61 6e 64 $m add command
9d80: 20 2d 6c 61 62 65 6c 20 22 43 65 6e 74 65 72 20 -label "Center
9d90: 43 75 72 72 65 6e 74 20 44 69 66 66 22 20 2d 75 Current Diff" -u
9da0: 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d nderline 0 -comm
9db0: 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 73 and \. [lis
9dc0: 74 20 70 6f 70 75 70 4d 65 6e 75 20 63 65 6e 74 t popupMenu cent
9dd0: 65 72 5d 20 2d 61 63 63 65 6c 65 72 61 74 6f 72 er] -accelerator
9de0: 20 22 63 22 0a 20 20 20 20 24 6d 20 61 64 64 20 "c". $m add
9df0: 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
9e00: 4e 65 78 74 20 44 69 66 66 22 20 2d 75 6e 64 65 Next Diff" -unde
9e10: 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d 61 6e 64 rline 0 -command
9e20: 20 5b 6c 69 73 74 20 70 6f 70 75 70 4d 65 6e 75 [list popupMenu
9e30: 20 5c 0a 20 20 20 20 20 20 6e 65 78 74 5d 20 2d \. next] -
9e40: 61 63 63 65 6c 65 72 61 74 6f 72 20 22 6e 22 0a accelerator "n".
9e50: 20 20 20 20 24 6d 20 61 64 64 20 63 6f 6d 6d 61 $m add comma
9e60: 6e 64 20 2d 6c 61 62 65 6c 20 22 4c 61 73 74 20 nd -label "Last
9e70: 44 69 66 66 22 20 2d 75 6e 64 65 72 6c 69 6e 65 Diff" -underline
9e80: 20 30 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 0 -command [lis
9e90: 74 20 70 6f 70 75 70 4d 65 6e 75 20 5c 0a 20 20 t popupMenu \.
9ea0: 20 20 20 20 6c 61 73 74 5d 20 2d 61 63 63 65 6c last] -accel
9eb0: 65 72 61 74 6f 72 20 22 6c 22 0a 20 20 20 20 24 erator "l". $
9ec0: 6d 20 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a m add separator.
9ed0: 20 20 20 20 24 6d 20 61 64 64 20 63 6f 6d 6d 61 $m add comma
9ee0: 6e 64 20 2d 6c 61 62 65 6c 20 22 46 69 6e 64 20 nd -label "Find
9ef0: 4e 65 61 72 65 73 74 20 44 69 66 66 22 20 2d 75 Nearest Diff" -u
9f00: 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d nderline 0 -comm
9f10: 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 73 and \. [lis
9f20: 74 20 70 6f 70 75 70 4d 65 6e 75 20 6e 65 61 72 t popupMenu near
9f30: 65 73 74 5d 20 2d 61 63 63 65 6c 65 72 61 74 6f est] -accelerato
9f40: 72 20 22 44 6f 75 62 6c 65 2d 43 6c 69 63 6b 22 r "Double-Click"
9f50: 0a 20 20 20 20 24 6d 20 61 64 64 20 73 65 70 61 . $m add sepa
9f60: 72 61 74 6f 72 0a 20 20 20 20 24 6d 20 61 64 64 rator. $m add
9f70: 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 command -label
9f80: 22 46 69 6e 64 2e 2e 2e 22 20 2d 75 6e 64 65 72 "Find..." -under
9f90: 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d 61 6e 64 20 line 0 -command
9fa0: 5b 6c 69 73 74 20 70 6f 70 75 70 4d 65 6e 75 20 [list popupMenu
9fb0: 66 69 6e 64 5d 0a 20 20 20 20 24 6d 20 61 64 64 find]. $m add
9fc0: 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 command -label
9fd0: 22 45 64 69 74 22 20 2d 75 6e 64 65 72 6c 69 6e "Edit" -underlin
9fe0: 65 20 30 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 e 0 -command [li
9ff0: 73 74 20 70 6f 70 75 70 4d 65 6e 75 20 65 64 69 st popupMenu edi
a000: 74 5d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 t].}..##########
a010: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a020: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a030: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a040: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a050: 23 23 23 23 23 0a 23 20 68 61 6e 64 6c 65 20 70 #####.# handle p
a060: 6f 70 75 70 20 6d 65 6e 75 20 63 6f 6d 6d 61 6e opup menu comman
a070: 64 73 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 ds.#############
a080: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a090: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a0a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a0b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a0c0: 23 23 0a 70 72 6f 63 20 70 6f 70 75 70 4d 65 6e ##.proc popupMen
a0d0: 75 20 7b 63 6f 6d 6d 61 6e 64 20 61 72 67 73 7d u {command args}
a0e0: 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 {. debug-inf
a0f0: 6f 20 22 70 6f 70 75 70 4d 65 6e 75 20 28 24 63 o "popupMenu ($c
a100: 6f 6d 6d 61 6e 64 20 24 61 72 67 73 29 22 0a 20 ommand $args)".
a110: 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 global g.
a120: 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 73 77 global w.. sw
a130: 69 74 63 68 20 2d 2d 20 24 63 6f 6d 6d 61 6e 64 itch -- $command
a140: 20 7b 0a 20 20 20 20 63 65 6e 74 65 72 20 7b 0a {. center {.
a150: 09 20 20 20 20 63 65 6e 74 65 72 0a 09 7d 0a 20 . center..}.
a160: 20 20 20 65 64 69 74 20 7b 0a 09 20 20 20 20 64 edit {.. d
a170: 6f 2d 65 64 69 74 0a 09 7d 0a 20 20 20 20 66 69 o-edit..}. fi
a180: 6e 64 20 7b 0a 09 20 20 20 20 64 6f 2d 66 69 6e nd {.. do-fin
a190: 64 0a 09 7d 0a 20 20 20 20 66 69 72 73 74 20 7b d..}. first {
a1a0: 0a 09 20 20 20 20 6d 6f 76 65 20 66 69 72 73 74 .. move first
a1b0: 0a 09 7d 0a 20 20 20 20 6c 61 73 74 20 7b 0a 09 ..}. last {..
a1c0: 20 20 20 20 6d 6f 76 65 20 6c 61 73 74 0a 09 7d move last..}
a1d0: 0a 20 20 20 20 6e 65 78 74 20 7b 0a 09 20 20 20 . next {..
a1e0: 20 6d 6f 76 65 20 31 0a 09 7d 0a 20 20 20 20 70 move 1..}. p
a1f0: 72 65 76 69 6f 75 73 20 7b 0a 09 20 20 20 20 6d revious {.. m
a200: 6f 76 65 20 2d 31 0a 09 7d 0a 20 20 20 20 6e 65 ove -1..}. ne
a210: 61 72 65 73 74 20 7b 0a 09 20 20 20 20 6d 6f 76 arest {.. mov
a220: 65 4e 65 61 72 65 73 74 20 24 67 28 61 63 74 69 eNearest $g(acti
a230: 76 65 57 69 6e 64 6f 77 29 20 78 79 20 5b 77 69 veWindow) xy [wi
a240: 6e 66 6f 20 70 6f 69 6e 74 65 72 78 20 24 67 28 nfo pointerx $g(
a250: 61 63 74 69 76 65 57 69 6e 64 6f 77 29 5d 20 5c activeWindow)] \
a260: 0a 09 20 20 20 20 20 20 5b 77 69 6e 66 6f 20 70 .. [winfo p
a270: 6f 69 6e 74 65 72 79 20 24 67 28 61 63 74 69 76 ointery $g(activ
a280: 65 57 69 6e 64 6f 77 29 5d 0a 09 7d 0a 20 20 20 eWindow)]..}.
a290: 20 7d 0a 7d 0a 0a 23 20 52 65 73 69 7a 65 20 74 }.}..# Resize t
a2a0: 68 65 20 74 65 78 74 20 77 69 6e 64 6f 77 73 20 he text windows
a2b0: 72 65 6c 61 74 69 76 65 20 74 6f 20 65 61 63 68 relative to each
a2c0: 20 6f 74 68 65 72 2e 20 20 54 68 65 20 38 2e 34 other. The 8.4
a2d0: 20 6d 65 74 68 6f 64 20 77 6f 72 6b 73 0a 23 20 method works.#
a2e0: 6d 75 63 68 20 62 65 74 74 65 72 2e 0a 70 72 6f much better..pro
a2f0: 63 20 70 61 6e 65 5f 64 72 61 67 20 7b 77 69 6e c pane_drag {win
a300: 20 78 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c x} {. global
a310: 20 77 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 w. global fi
a320: 6e 66 6f 0a 20 20 20 20 67 6c 6f 62 61 6c 20 74 nfo. global t
a330: 6b 5f 76 65 72 73 69 6f 6e 0a 0a 20 20 20 20 73 k_version.. s
a340: 65 74 20 72 65 6c 58 20 5b 65 78 70 72 20 24 78 et relX [expr $x
a350: 20 2d 20 5b 77 69 6e 66 6f 20 72 6f 6f 74 78 20 - [winfo rootx
a360: 24 77 69 6e 5d 5d 0a 20 20 20 20 73 65 74 20 6d $win]]. set m
a370: 61 78 58 20 5b 77 69 6e 66 6f 20 77 69 64 74 68 axX [winfo width
a380: 20 24 77 69 6e 5d 0a 20 20 20 20 73 65 74 20 66 $win]. set f
a390: 72 61 63 20 5b 65 78 70 72 20 69 6e 74 28 28 64 rac [expr int((d
a3a0: 6f 75 62 6c 65 28 24 72 65 6c 58 29 20 2f 20 24 ouble($relX) / $
a3b0: 6d 61 78 58 29 20 2a 20 31 30 30 29 5d 0a 20 20 maxX) * 100)].
a3c0: 20 20 69 66 20 7b 24 74 6b 5f 76 65 72 73 69 6f if {$tk_versio
a3d0: 6e 20 3c 20 38 2e 34 7d 20 7b 0a 20 20 20 20 20 n < 8.4} {.
a3e0: 20 69 66 20 7b 24 66 72 61 63 20 3c 20 31 35 7d if {$frac < 15}
a3f0: 20 7b 20 73 65 74 20 66 72 61 63 20 31 35 20 7d { set frac 15 }
a400: 0a 20 20 20 20 20 20 69 66 20 7b 24 66 72 61 63 . if {$frac
a410: 20 3e 20 38 35 7d 20 7b 20 73 65 74 20 66 72 61 > 85} { set fra
a420: 63 20 38 35 20 7d 0a 20 20 20 20 20 20 23 64 65 c 85 }. #de
a430: 62 75 67 2d 69 6e 66 6f 20 22 66 72 61 63 20 24 bug-info "frac $
a440: 66 72 61 63 22 0a 20 20 20 20 20 20 73 65 74 20 frac". set
a450: 4c 20 24 66 72 61 63 0a 20 20 20 20 20 20 73 65 L $frac. se
a460: 74 20 52 20 5b 65 78 70 72 20 31 30 30 20 2d 20 t R [expr 100 -
a470: 24 66 72 61 63 5d 0a 20 20 20 20 20 20 2e 63 6c $frac]. .cl
a480: 69 65 6e 74 2e 6c 65 66 74 6c 61 62 65 6c 20 63 ient.leftlabel c
a490: 6f 6e 66 69 67 75 72 65 20 2d 77 69 64 74 68 20 onfigure -width
a4a0: 5b 65 78 70 72 20 24 4c 20 2a 20 32 5d 0a 20 20 [expr $L * 2].
a4b0: 20 20 20 20 2e 63 6c 69 65 6e 74 2e 72 69 67 68 .client.righ
a4c0: 74 6c 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65 tlabel configure
a4d0: 20 2d 77 69 64 74 68 20 5b 65 78 70 72 20 24 52 -width [expr $R
a4e0: 20 2a 20 32 5d 0a 20 20 20 20 7d 20 65 6c 73 65 * 2]. } else
a4f0: 20 7b 0a 20 20 20 20 20 20 69 66 20 7b 24 66 72 {. if {$fr
a500: 61 63 20 3c 20 35 7d 20 7b 20 73 65 74 20 66 72 ac < 5} { set fr
a510: 61 63 20 35 20 7d 0a 20 20 20 20 20 20 69 66 20 ac 5 }. if
a520: 7b 24 66 72 61 63 20 3e 20 39 35 7d 20 7b 20 73 {$frac > 95} { s
a530: 65 74 20 66 72 61 63 20 39 35 20 7d 0a 20 20 20 et frac 95 }.
a540: 20 20 20 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 #debug-info "
a550: 66 72 61 63 20 24 66 72 61 63 22 0a 20 20 20 20 frac $frac".
a560: 20 20 73 65 74 20 4c 20 24 66 72 61 63 0a 20 20 set L $frac.
a570: 20 20 20 20 73 65 74 20 52 20 5b 65 78 70 72 20 set R [expr
a580: 31 30 30 20 2d 20 24 66 72 61 63 5d 0a 20 20 20 100 - $frac].
a590: 20 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f grid columnco
a5a0: 6e 66 69 67 75 72 65 20 24 77 69 6e 20 30 20 2d nfigure $win 0 -
a5b0: 77 65 69 67 68 74 20 24 4c 0a 20 20 20 20 20 20 weight $L.
a5c0: 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 grid columnconfi
a5d0: 67 75 72 65 20 24 77 69 6e 20 32 20 2d 77 65 69 gure $win 2 -wei
a5e0: 67 68 74 20 24 52 0a 20 20 20 20 7d 0a 20 20 20 ght $R. }.
a5f0: 20 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 6e #debug-info " n
a600: 65 77 3a 20 24 4c 20 24 52 22 0a 7d 0a 0a 23 23 ew: $L $R".}..##
a610: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a620: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a630: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a640: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a650: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 #############.#
a660: 62 75 69 6c 64 20 74 68 65 20 6d 61 69 6e 20 63 build the main c
a670: 6c 69 65 6e 74 20 64 69 73 70 6c 61 79 20 28 74 lient display (t
a680: 68 65 20 74 65 78 74 20 77 69 64 67 65 74 73 2c he text widgets,
a690: 20 73 63 72 6f 6c 6c 62 61 72 73 2c 20 74 68 61 scrollbars, tha
a6a0: 74 0a 23 20 73 6f 72 74 20 6f 66 20 66 6c 75 66 t.# sort of fluf
a6b0: 66 29 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 f).#############
a6c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a6d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a6e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a6f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
a700: 23 23 0a 70 72 6f 63 20 62 75 69 6c 64 2d 63 6c ##.proc build-cl
a710: 69 65 6e 74 20 7b 7d 20 7b 0a 20 20 20 20 64 65 ient {} {. de
a720: 62 75 67 2d 69 6e 66 6f 20 22 62 75 69 6c 64 2d bug-info "build-
a730: 63 6c 69 65 6e 74 22 0a 20 20 20 20 67 6c 6f 62 client". glob
a740: 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 al g. global
a750: 77 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 w. global opt
a760: 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6d 61 70 s. global map
a770: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 74 6b 5f 76 . global tk_v
a780: 65 72 73 69 6f 6e 0a 0a 20 20 20 20 66 72 61 6d ersion.. fram
a790: 65 20 24 77 28 63 6c 69 65 6e 74 29 20 2d 62 64 e $w(client) -bd
a7a0: 20 32 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 0a 2 -relief flat.
a7b0: 0a 20 20 20 20 23 20 73 65 74 20 75 70 20 67 6c . # set up gl
a7c0: 6f 62 61 6c 20 76 61 72 69 61 62 6c 65 73 20 74 obal variables t
a7d0: 6f 20 72 65 66 65 72 65 6e 63 65 20 74 68 65 20 o reference the
a7e0: 77 69 64 67 65 74 73 2c 20 73 6f 0a 20 20 20 20 widgets, so.
a7f0: 23 20 77 65 20 64 6f 6e 27 74 20 68 61 76 65 20 # we don't have
a800: 74 6f 20 75 73 65 20 68 61 72 64 63 6f 64 65 64 to use hardcoded
a810: 20 77 69 64 67 65 74 20 70 61 74 68 73 20 65 6c widget paths el
a820: 73 65 77 68 65 72 65 0a 20 20 20 20 23 20 69 6e sewhere. # in
a830: 20 74 68 65 20 63 6f 64 65 0a 20 20 20 20 23 0a the code. #.
a840: 20 20 20 20 23 20 54 65 78 74 20 20 2d 20 68 6f # Text - ho
a850: 6c 64 73 20 74 68 65 20 74 65 78 74 20 6f 66 20 lds the text of
a860: 74 68 65 20 66 69 6c 65 0a 20 20 20 20 23 20 49 the file. # I
a870: 6e 66 6f 20 20 2d 20 73 6f 72 74 2d 6f 66 20 22 nfo - sort-of "
a880: 69 6e 76 69 73 69 62 6c 65 22 20 74 65 78 74 20 invisible" text
a890: 77 69 64 67 65 74 20 77 68 69 63 68 20 69 73 20 widget which is
a8a0: 6b 65 70 74 20 69 6e 20 73 79 6e 63 0a 20 20 20 kept in sync.
a8b0: 20 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 #
a8c0: 77 69 74 68 20 74 68 65 20 74 65 78 74 20 77 69 with the text wi
a8d0: 64 67 65 74 20 61 6e 64 20 68 6f 6c 64 73 20 6c dget and holds l
a8e0: 69 6e 65 20 6e 75 6d 62 65 72 73 0a 20 20 20 20 ine numbers.
a8f0: 23 20 43 42 20 20 20 20 2d 20 63 6f 6e 74 61 69 # CB - contai
a900: 6e 73 20 63 68 61 6e 67 65 62 61 72 73 20 6f 72 ns changebars or
a910: 20 73 74 61 74 75 73 20 6f 72 20 73 6f 6d 65 74 status or somet
a920: 68 69 6e 67 20 6c 69 6b 65 20 74 68 61 74 2e 2e hing like that..
a930: 2e 0a 20 20 20 20 23 20 56 53 42 20 20 20 2d 20 .. # VSB -
a940: 76 65 72 74 69 63 61 6c 20 73 63 72 6f 6c 6c 62 vertical scrollb
a950: 61 72 0a 20 20 20 20 23 20 48 53 42 20 20 20 2d ar. # HSB -
a960: 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 73 63 72 6f horizontal scro
a970: 6c 6c 62 61 72 0a 20 20 20 20 23 20 4c 61 62 65 llbar. # Labe
a980: 6c 20 2d 20 6c 61 62 65 6c 20 74 6f 20 68 6f 6c l - label to hol
a990: 64 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 d the name of th
a9a0: 65 20 66 69 6c 65 0a 20 20 20 20 73 65 74 20 77 e file. set w
a9b0: 28 4c 65 66 74 54 65 78 74 29 20 24 77 28 63 6c (LeftText) $w(cl
a9c0: 69 65 6e 74 29 2e 6c 65 66 74 2e 74 65 78 74 0a ient).left.text.
a9d0: 20 20 20 20 73 65 74 20 77 28 4c 65 66 74 49 6e set w(LeftIn
a9e0: 66 6f 29 20 24 77 28 63 6c 69 65 6e 74 29 2e 6c fo) $w(client).l
a9f0: 65 66 74 2e 69 6e 66 6f 0a 20 20 20 20 73 65 74 eft.info. set
aa00: 20 77 28 4c 65 66 74 43 42 29 20 24 77 28 63 6c w(LeftCB) $w(cl
aa10: 69 65 6e 74 29 2e 6c 65 66 74 2e 63 68 61 6e 67 ient).left.chang
aa20: 65 42 61 72 73 0a 20 20 20 20 73 65 74 20 77 28 eBars. set w(
aa30: 4c 65 66 74 56 53 42 29 20 24 77 28 63 6c 69 65 LeftVSB) $w(clie
aa40: 6e 74 29 2e 6c 65 66 74 2e 76 73 62 0a 20 20 20 nt).left.vsb.
aa50: 20 73 65 74 20 77 28 4c 65 66 74 48 53 42 29 20 set w(LeftHSB)
aa60: 24 77 28 63 6c 69 65 6e 74 29 2e 6c 65 66 74 2e $w(client).left.
aa70: 68 73 62 0a 20 20 20 20 73 65 74 20 77 28 4c 65 hsb. set w(Le
aa80: 66 74 4c 61 62 65 6c 29 20 24 77 28 63 6c 69 65 ftLabel) $w(clie
aa90: 6e 74 29 2e 6c 65 66 74 6c 61 62 65 6c 0a 0a 20 nt).leftlabel..
aaa0: 20 20 20 73 65 74 20 77 28 52 69 67 68 74 54 65 set w(RightTe
aab0: 78 74 29 20 24 77 28 63 6c 69 65 6e 74 29 2e 72 xt) $w(client).r
aac0: 69 67 68 74 2e 74 65 78 74 0a 20 20 20 20 73 65 ight.text. se
aad0: 74 20 77 28 52 69 67 68 74 49 6e 66 6f 29 20 24 t w(RightInfo) $
aae0: 77 28 63 6c 69 65 6e 74 29 2e 72 69 67 68 74 2e w(client).right.
aaf0: 69 6e 66 6f 0a 20 20 20 20 73 65 74 20 77 28 52 info. set w(R
ab00: 69 67 68 74 43 42 29 20 24 77 28 63 6c 69 65 6e ightCB) $w(clien
ab10: 74 29 2e 72 69 67 68 74 2e 63 68 61 6e 67 65 42 t).right.changeB
ab20: 61 72 73 0a 20 20 20 20 73 65 74 20 77 28 52 69 ars. set w(Ri
ab30: 67 68 74 56 53 42 29 20 24 77 28 63 6c 69 65 6e ghtVSB) $w(clien
ab40: 74 29 2e 72 69 67 68 74 2e 76 73 62 0a 20 20 20 t).right.vsb.
ab50: 20 73 65 74 20 77 28 52 69 67 68 74 48 53 42 29 set w(RightHSB)
ab60: 20 24 77 28 63 6c 69 65 6e 74 29 2e 72 69 67 68 $w(client).righ
ab70: 74 2e 68 73 62 0a 20 20 20 20 73 65 74 20 77 28 t.hsb. set w(
ab80: 52 69 67 68 74 4c 61 62 65 6c 29 20 24 77 28 63 RightLabel) $w(c
ab90: 6c 69 65 6e 74 29 2e 72 69 67 68 74 6c 61 62 65 lient).rightlabe
aba0: 6c 0a 0a 20 20 20 20 73 65 74 20 77 28 42 6f 74 l.. set w(Bot
abb0: 74 6f 6d 54 65 78 74 29 20 24 77 28 63 6c 69 65 tomText) $w(clie
abc0: 6e 74 29 2e 62 6f 74 74 6f 6d 74 65 78 74 0a 0a nt).bottomtext..
abd0: 20 20 20 20 73 65 74 20 77 28 6d 61 70 29 20 24 set w(map) $
abe0: 77 28 63 6c 69 65 6e 74 29 2e 6d 61 70 0a 20 20 w(client).map.
abf0: 20 20 73 65 74 20 77 28 6d 61 70 43 61 6e 76 61 set w(mapCanva
ac00: 73 29 20 24 77 28 6d 61 70 29 2e 63 61 6e 76 61 s) $w(map).canva
ac10: 73 0a 0a 20 20 20 20 23 20 74 68 65 73 65 20 64 s.. # these d
ac20: 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 62 65 20 on't need to be
ac30: 67 6c 6f 62 61 6c 2e 2e 2e 0a 20 20 20 20 73 65 global.... se
ac40: 74 20 6c 65 66 74 46 72 61 6d 65 20 24 77 28 63 t leftFrame $w(c
ac50: 6c 69 65 6e 74 29 2e 6c 65 66 74 0a 20 20 20 20 lient).left.
ac60: 73 65 74 20 72 69 67 68 74 46 72 61 6d 65 20 24 set rightFrame $
ac70: 77 28 63 6c 69 65 6e 74 29 2e 72 69 67 68 74 0a w(client).right.
ac80: 0a 20 20 20 20 23 20 77 65 27 6c 6c 20 63 72 65 . # we'll cre
ac90: 61 74 65 20 65 61 63 68 20 77 69 64 67 65 74 20 ate each widget
aca0: 74 77 69 63 65 3b 20 6f 6e 63 65 20 66 6f 72 20 twice; once for
acb0: 74 68 65 20 6c 65 66 74 20 73 69 64 65 0a 20 20 the left side.
acc0: 20 20 23 20 61 6e 64 20 6f 6e 63 65 20 66 6f 72 # and once for
acd0: 20 74 68 65 20 72 69 67 68 74 2e 0a 20 20 20 20 the right..
ace0: 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 41 73 debug-info " As
acf0: 73 69 67 6e 69 6e 67 20 6c 61 62 65 6c 73 20 74 signing labels t
ad00: 6f 20 68 65 61 64 65 72 73 22 0a 20 20 20 20 73 o headers". s
ad10: 63 61 6e 20 24 6f 70 74 73 28 67 65 6f 6d 65 74 can $opts(geomet
ad20: 72 79 29 20 22 25 64 78 25 64 22 20 77 69 64 74 ry) "%dx%d" widt
ad30: 68 20 68 65 69 67 68 74 0a 20 20 20 20 6c 61 62 h height. lab
ad40: 65 6c 20 24 77 28 4c 65 66 74 4c 61 62 65 6c 29 el $w(LeftLabel)
ad50: 20 2d 62 64 20 31 20 2d 72 65 6c 69 65 66 20 66 -bd 1 -relief f
ad60: 6c 61 74 20 2d 74 65 78 74 76 61 72 69 61 62 6c lat -textvariabl
ad70: 65 20 66 69 6e 66 6f 28 6c 62 6c 2c 31 29 20 2d e finfo(lbl,1) -
ad80: 77 69 64 74 68 20 24 77 69 64 74 68 0a 20 20 20 width $width.
ad90: 20 6c 61 62 65 6c 20 24 77 28 52 69 67 68 74 4c label $w(RightL
ada0: 61 62 65 6c 29 20 2d 62 64 20 31 20 2d 72 65 6c abel) -bd 1 -rel
adb0: 69 65 66 20 66 6c 61 74 20 2d 74 65 78 74 76 61 ief flat -textva
adc0: 72 69 61 62 6c 65 20 66 69 6e 66 6f 28 6c 62 6c riable finfo(lbl
add0: 2c 32 29 20 2d 77 69 64 74 68 20 24 77 69 64 74 ,2) -width $widt
ade0: 68 0a 0a 20 20 20 20 23 20 74 68 69 73 20 68 6f h.. # this ho
adf0: 6c 64 73 20 74 68 65 20 74 65 78 74 20 77 69 64 lds the text wid
ae00: 67 65 74 73 20 61 6e 64 20 74 68 65 20 73 63 72 gets and the scr
ae10: 6f 6c 6c 62 61 72 73 2e 20 54 68 65 20 72 65 61 ollbars. The rea
ae20: 73 6f 6e 0a 20 20 20 20 23 20 66 6f 72 20 74 68 son. # for th
ae30: 65 20 66 72 61 6d 65 20 69 73 20 70 75 72 65 6c e frame is purel
ae40: 79 20 66 6f 72 20 61 65 73 74 68 65 74 69 63 73 y for aesthetics
ae50: 2e 20 49 74 20 6a 75 73 74 20 6c 6f 6f 6b 73 0a . It just looks.
ae60: 20 20 20 20 23 20 6e 69 63 65 72 2c 20 49 4d 48 # nicer, IMH
ae70: 4f 2c 20 74 6f 20 22 65 6d 62 65 64 22 20 74 68 O, to "embed" th
ae80: 65 20 73 63 72 6f 6c 6c 62 61 72 73 20 77 69 74 e scrollbars wit
ae90: 68 69 6e 20 74 68 65 20 74 65 78 74 0a 20 20 20 hin the text.
aea0: 20 23 20 77 69 64 67 65 74 0a 20 20 20 20 66 72 # widget. fr
aeb0: 61 6d 65 20 24 6c 65 66 74 46 72 61 6d 65 20 2d ame $leftFrame -
aec0: 62 64 20 31 20 2d 72 65 6c 69 65 66 20 73 75 6e bd 1 -relief sun
aed0: 6b 65 6e 0a 0a 20 20 20 20 66 72 61 6d 65 20 24 ken.. frame $
aee0: 72 69 67 68 74 46 72 61 6d 65 20 2d 62 64 20 31 rightFrame -bd 1
aef0: 20 2d 72 65 6c 69 65 66 20 73 75 6e 6b 65 6e 0a -relief sunken.
af00: 0a 20 20 20 20 73 63 72 6f 6c 6c 62 61 72 20 24 . scrollbar $
af10: 77 28 4c 65 66 74 48 53 42 29 20 2d 62 6f 72 64 w(LeftHSB) -bord
af20: 65 72 77 69 64 74 68 20 31 20 2d 6f 72 69 65 6e erwidth 1 -orien
af30: 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 63 6f t horizontal -co
af40: 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c mmand \. [l
af50: 69 73 74 20 24 77 28 4c 65 66 74 54 65 78 74 29 ist $w(LeftText)
af60: 20 78 76 69 65 77 5d 0a 0a 20 20 20 20 73 63 72 xview].. scr
af70: 6f 6c 6c 62 61 72 20 24 77 28 52 69 67 68 74 48 ollbar $w(RightH
af80: 53 42 29 20 2d 62 6f 72 64 65 72 77 69 64 74 68 SB) -borderwidth
af90: 20 31 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 1 -orient horiz
afa0: 6f 6e 74 61 6c 20 2d 63 6f 6d 6d 61 6e 64 20 5c ontal -command \
afb0: 0a 20 20 20 20 20 20 5b 6c 69 73 74 20 24 77 28 . [list $w(
afc0: 52 69 67 68 74 54 65 78 74 29 20 78 76 69 65 77 RightText) xview
afd0: 5d 0a 0a 20 20 20 20 73 63 72 6f 6c 6c 62 61 72 ].. scrollbar
afe0: 20 24 77 28 4c 65 66 74 56 53 42 29 20 2d 62 6f $w(LeftVSB) -bo
aff0: 72 64 65 72 77 69 64 74 68 20 31 20 2d 6f 72 69 rderwidth 1 -ori
b000: 65 6e 74 20 76 65 72 74 69 63 61 6c 20 2d 63 6f ent vertical -co
b010: 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c mmand \. [l
b020: 69 73 74 20 24 77 28 4c 65 66 74 54 65 78 74 29 ist $w(LeftText)
b030: 20 79 76 69 65 77 5d 0a 0a 20 20 20 20 73 63 72 yview].. scr
b040: 6f 6c 6c 62 61 72 20 24 77 28 52 69 67 68 74 56 ollbar $w(RightV
b050: 53 42 29 20 2d 62 6f 72 64 65 72 77 69 64 74 68 SB) -borderwidth
b060: 20 31 20 2d 6f 72 69 65 6e 74 20 76 65 72 74 69 1 -orient verti
b070: 63 61 6c 20 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 20 cal -command \.
b080: 20 20 20 20 20 5b 6c 69 73 74 20 24 77 28 52 69 [list $w(Ri
b090: 67 68 74 54 65 78 74 29 20 79 76 69 65 77 5d 0a ghtText) yview].
b0a0: 0a 0a 20 20 20 20 74 65 78 74 20 24 77 28 4c 65 .. text $w(Le
b0b0: 66 74 54 65 78 74 29 20 2d 70 61 64 78 20 30 20 ftText) -padx 0
b0c0: 2d 77 72 61 70 20 6e 6f 6e 65 20 2d 77 69 64 74 -wrap none -widt
b0d0: 68 20 24 77 69 64 74 68 20 2d 68 65 69 67 68 74 h $width -height
b0e0: 20 24 68 65 69 67 68 74 20 5c 0a 20 20 20 20 20 $height \.
b0f0: 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30 20 -borderwidth 0
b100: 2d 73 65 74 67 72 69 64 20 31 20 2d 79 73 63 72 -setgrid 1 -yscr
b110: 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 ollcommand [list
b120: 20 76 73 63 72 6f 6c 6c 2d 73 79 6e 63 20 5c 0a vscroll-sync \.
b130: 20 20 20 20 20 20 22 24 77 28 4c 65 66 74 49 6e "$w(LeftIn
b140: 66 6f 29 20 24 77 28 4c 65 66 74 43 42 29 22 20 fo) $w(LeftCB)"
b150: 31 5d 20 2d 78 73 63 72 6f 6c 6c 63 6f 6d 6d 61 1] -xscrollcomma
b160: 6e 64 20 5b 6c 69 73 74 20 68 73 63 72 6f 6c 6c nd [list hscroll
b170: 2d 73 79 6e 63 20 31 5d 0a 0a 20 20 20 20 74 65 -sync 1].. te
b180: 78 74 20 24 77 28 52 69 67 68 74 54 65 78 74 29 xt $w(RightText)
b190: 20 2d 70 61 64 78 20 30 20 2d 77 72 61 70 20 6e -padx 0 -wrap n
b1a0: 6f 6e 65 20 2d 77 69 64 74 68 20 24 77 69 64 74 one -width $widt
b1b0: 68 20 2d 68 65 69 67 68 74 20 24 68 65 69 67 68 h -height $heigh
b1c0: 74 20 5c 0a 20 20 20 20 20 20 2d 62 6f 72 64 65 t \. -borde
b1d0: 72 77 69 64 74 68 20 30 20 2d 73 65 74 67 72 69 rwidth 0 -setgri
b1e0: 64 20 31 20 2d 79 73 63 72 6f 6c 6c 63 6f 6d 6d d 1 -yscrollcomm
b1f0: 61 6e 64 20 5b 6c 69 73 74 20 76 73 63 72 6f 6c and [list vscrol
b200: 6c 2d 73 79 6e 63 20 5c 0a 20 20 20 20 20 20 22 l-sync \. "
b210: 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 24 77 $w(RightInfo) $w
b220: 28 52 69 67 68 74 43 42 29 22 20 32 5d 20 2d 78 (RightCB)" 2] -x
b230: 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 5b 6c scrollcommand [l
b240: 69 73 74 20 68 73 63 72 6f 6c 6c 2d 73 79 6e 63 ist hscroll-sync
b250: 20 32 5d 0a 0a 20 20 20 20 74 65 78 74 20 24 77 2].. text $w
b260: 28 4c 65 66 74 49 6e 66 6f 29 20 2d 68 65 69 67 (LeftInfo) -heig
b270: 68 74 20 30 20 2d 70 61 64 78 20 30 20 2d 77 69 ht 0 -padx 0 -wi
b280: 64 74 68 20 36 20 2d 62 6f 72 64 65 72 77 69 64 dth 6 -borderwid
b290: 74 68 20 30 20 2d 73 65 74 67 72 69 64 20 31 20 th 0 -setgrid 1
b2a0: 5c 0a 20 20 20 20 20 20 2d 79 73 63 72 6f 6c 6c \. -yscroll
b2b0: 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 76 73 command [list vs
b2c0: 63 72 6f 6c 6c 2d 73 79 6e 63 20 22 24 77 28 4c croll-sync "$w(L
b2d0: 65 66 74 43 42 29 20 24 77 28 4c 65 66 74 54 65 eftCB) $w(LeftTe
b2e0: 78 74 29 22 20 31 5d 0a 0a 20 20 20 20 74 65 78 xt)" 1].. tex
b2f0: 74 20 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 t $w(RightInfo)
b300: 2d 68 65 69 67 68 74 20 30 20 2d 70 61 64 78 20 -height 0 -padx
b310: 30 20 2d 77 69 64 74 68 20 36 20 2d 62 6f 72 64 0 -width 6 -bord
b320: 65 72 77 69 64 74 68 20 30 20 2d 73 65 74 67 72 erwidth 0 -setgr
b330: 69 64 20 31 20 5c 0a 20 20 20 20 20 20 2d 79 73 id 1 \. -ys
b340: 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 5b 6c 69 crollcommand [li
b350: 73 74 20 76 73 63 72 6f 6c 6c 2d 73 79 6e 63 20 st vscroll-sync
b360: 22 24 77 28 52 69 67 68 74 43 42 29 20 24 77 28 "$w(RightCB) $w(
b370: 52 69 67 68 74 54 65 78 74 29 22 20 32 5d 0a 0a RightText)" 2]..
b380: 20 20 20 20 23 20 65 61 63 68 20 61 6e 64 20 65 # each and e
b390: 76 65 72 79 20 6c 69 6e 65 20 69 6e 20 61 20 74 very line in a t
b3a0: 65 78 74 20 77 69 6e 64 6f 77 20 77 69 6c 6c 20 ext window will
b3b0: 68 61 76 65 20 61 20 63 6f 72 72 65 73 70 6f 6e have a correspon
b3c0: 64 69 6e 67 20 6c 69 6e 65 0a 20 20 20 20 23 20 ding line. #
b3d0: 69 6e 20 74 68 69 73 20 77 69 64 67 65 74 2e 20 in this widget.
b3e0: 41 6e 64 20 65 61 63 68 20 6c 69 6e 65 20 69 6e And each line in
b3f0: 20 74 68 69 73 20 77 69 64 67 65 74 20 77 69 6c this widget wil
b400: 6c 20 62 65 20 63 6f 6d 70 6f 73 65 64 20 6f 66 l be composed of
b410: 0a 20 20 20 20 23 20 61 20 73 69 6e 67 6c 65 20 . # a single
b420: 63 68 61 72 61 63 74 65 72 20 28 65 69 74 68 65 character (eithe
b430: 72 20 22 2b 22 2c 20 22 2d 22 20 6f 72 20 22 21 r "+", "-" or "!
b440: 22 20 66 6f 72 20 69 6e 73 65 72 74 69 6f 6e 2c " for insertion,
b450: 20 64 65 6c 65 74 69 6f 6e 0a 20 20 20 20 23 20 deletion. #
b460: 6f 72 20 63 68 61 6e 67 65 2c 20 72 65 73 70 65 or change, respe
b470: 63 74 69 76 65 6c 79 0a 20 20 20 20 74 65 78 74 ctively. text
b480: 20 24 77 28 4c 65 66 74 43 42 29 20 2d 68 65 69 $w(LeftCB) -hei
b490: 67 68 74 20 30 20 2d 70 61 64 78 20 30 20 2d 68 ght 0 -padx 0 -h
b4a0: 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 ighlightthicknes
b4b0: 73 20 30 20 2d 77 72 61 70 20 6e 6f 6e 65 20 5c s 0 -wrap none \
b4c0: 0a 20 20 20 20 20 20 2d 66 6f 72 65 67 72 6f 75 . -foregrou
b4d0: 6e 64 20 77 68 69 74 65 20 2d 77 69 64 74 68 20 nd white -width
b4e0: 31 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30 1 -borderwidth 0
b4f0: 20 2d 79 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 -yscrollcommand
b500: 20 5c 0a 20 20 20 20 20 20 5b 6c 69 73 74 20 76 \. [list v
b510: 73 63 72 6f 6c 6c 2d 73 79 6e 63 20 22 24 77 28 scroll-sync "$w(
b520: 4c 65 66 74 49 6e 66 6f 29 20 24 77 28 4c 65 66 LeftInfo) $w(Lef
b530: 74 54 65 78 74 29 22 20 31 5d 0a 0a 20 20 20 20 tText)" 1]..
b540: 74 65 78 74 20 24 77 28 52 69 67 68 74 43 42 29 text $w(RightCB)
b550: 20 2d 68 65 69 67 68 74 20 30 20 2d 70 61 64 78 -height 0 -padx
b560: 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 0 -highlightthi
b570: 63 6b 6e 65 73 73 20 30 20 2d 77 72 61 70 20 6e ckness 0 -wrap n
b580: 6f 6e 65 20 5c 0a 20 20 20 20 20 20 2d 62 61 63 one \. -bac
b590: 6b 67 72 6f 75 6e 64 20 77 68 69 74 65 20 2d 66 kground white -f
b5a0: 6f 72 65 67 72 6f 75 6e 64 20 77 68 69 74 65 20 oreground white
b5b0: 2d 77 69 64 74 68 20 31 20 2d 62 6f 72 64 65 72 -width 1 -border
b5c0: 77 69 64 74 68 20 30 20 5c 0a 20 20 20 20 20 20 width 0 \.
b5d0: 2d 79 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 -yscrollcommand
b5e0: 5b 6c 69 73 74 20 76 73 63 72 6f 6c 6c 2d 73 79 [list vscroll-sy
b5f0: 6e 63 20 22 24 77 28 52 69 67 68 74 49 6e 66 6f nc "$w(RightInfo
b600: 29 20 24 77 28 52 69 67 68 74 54 65 78 74 29 22 ) $w(RightText)"
b610: 20 32 5d 0a 0a 20 20 20 20 23 20 74 68 69 73 20 2].. # this
b620: 77 69 64 67 65 74 20 69 73 20 74 68 65 20 74 77 widget is the tw
b630: 6f 20 6c 69 6e 65 20 64 69 73 70 6c 61 79 20 73 o line display s
b640: 68 6f 77 69 6e 67 20 74 68 65 20 63 75 72 72 65 howing the curre
b650: 6e 74 20 6c 69 6e 65 2c 20 73 6f 0a 20 20 20 20 nt line, so.
b660: 23 20 6f 6e 65 20 63 61 6e 20 63 6f 6d 70 61 72 # one can compar
b670: 65 20 63 68 61 72 61 63 74 65 72 20 62 79 20 63 e character by c
b680: 68 61 72 61 63 74 65 72 20 69 66 20 6e 65 63 65 haracter if nece
b690: 73 73 61 72 79 2e 0a 20 20 20 20 74 65 78 74 20 ssary.. text
b6a0: 24 77 28 42 6f 74 74 6f 6d 54 65 78 74 29 20 2d $w(BottomText) -
b6b0: 77 72 61 70 20 6e 6f 6e 65 20 2d 62 6f 72 64 65 wrap none -borde
b6c0: 72 77 69 64 74 68 20 31 20 2d 68 65 69 67 68 74 rwidth 1 -height
b6d0: 20 32 20 2d 77 69 64 74 68 20 30 0a 0a 20 20 20 2 -width 0..
b6e0: 20 23 20 74 68 69 73 20 69 73 20 68 6f 77 20 77 # this is how w
b6f0: 65 20 68 69 67 68 6c 69 67 68 74 20 62 79 74 65 e highlight byte
b700: 73 20 74 68 61 74 20 61 72 65 20 64 69 66 66 65 s that are diffe
b710: 72 65 6e 74 2e 2e 2e 0a 20 20 20 20 23 20 74 68 rent.... # th
b720: 65 20 62 6f 74 74 6f 6d 20 77 69 6e 64 6f 77 20 e bottom window
b730: 28 6c 69 6e 65 76 69 65 77 29 20 75 73 65 73 20 (lineview) uses
b740: 72 65 76 65 72 73 65 20 76 69 64 65 6f 20 74 6f reverse video to
b750: 20 68 69 67 68 6c 69 67 68 74 0a 20 20 20 20 23 highlight. #
b760: 20 64 69 66 66 73 2c 20 73 6f 20 77 65 20 6e 65 diffs, so we ne
b770: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
b780: 20 77 68 61 74 20 72 65 76 65 72 73 65 20 76 69 what reverse vi
b790: 64 65 6f 20 69 73 2c 20 61 6e 64 0a 20 20 20 20 deo is, and.
b7a0: 23 20 64 65 66 69 6e 65 20 74 68 65 20 74 61 67 # define the tag
b7b0: 20 61 70 70 72 6f 70 72 69 61 74 65 6c 79 0a 20 appropriately.
b7c0: 20 20 20 65 76 61 6c 20 24 77 28 42 6f 74 74 6f eval $w(Botto
b7d0: 6d 54 65 78 74 29 20 74 61 67 20 63 6f 6e 66 69 mText) tag confi
b7e0: 67 75 72 65 20 64 69 66 66 20 24 6f 70 74 73 28 gure diff $opts(
b7f0: 62 79 74 65 74 61 67 29 0a 0a 20 20 20 20 23 20 bytetag).. #
b800: 53 65 74 20 75 70 20 74 65 78 74 20 74 61 67 73 Set up text tags
b810: 20 66 6f 72 20 74 68 65 20 27 63 75 72 72 65 6e for the 'curren
b820: 74 20 64 69 66 66 27 20 28 74 68 65 20 6f 6e 65 t diff' (the one
b830: 20 63 68 6f 73 65 6e 20 62 79 20 74 68 65 20 27 chosen by the '
b840: 6e 65 78 74 27 0a 20 20 20 20 23 20 61 6e 64 20 next'. # and
b850: 27 70 72 65 76 27 20 62 75 74 74 6f 6e 73 29 20 'prev' buttons)
b860: 61 6e 64 20 61 6e 79 20 6f 6c 27 20 64 69 66 66 and any ol' diff
b870: 20 72 65 67 69 6f 6e 2e 20 20 41 6c 6c 20 64 69 region. All di
b880: 66 66 20 72 65 67 69 6f 6e 73 20 61 72 65 0a 20 ff regions are.
b890: 20 20 20 23 20 67 69 76 65 6e 20 74 68 65 20 27 # given the '
b8a0: 64 69 66 66 27 20 74 61 67 20 69 6e 69 74 69 61 diff' tag initia
b8b0: 6c 6c 79 2e 2e 2e 20 20 20 20 20 20 20 20 20 41 lly... A
b8c0: 73 20 27 6e 65 78 74 27 20 61 6e 64 20 27 70 72 s 'next' and 'pr
b8d0: 65 76 27 20 61 72 65 20 5c 0a 09 70 72 65 73 73 ev' are \..press
b8e0: 65 64 2c 0a 20 20 20 20 23 20 74 6f 20 73 63 72 ed,. # to scr
b8f0: 6f 6c 6c 20 74 68 72 6f 75 67 68 20 74 68 65 20 oll through the
b900: 64 69 66 66 65 72 65 6e 63 65 73 2c 20 6f 6e 65 differences, one
b910: 20 70 61 72 74 69 63 75 6c 61 72 20 64 69 66 66 particular diff
b920: 20 72 65 67 69 6f 6e 20 69 73 0a 20 20 20 20 23 region is. #
b930: 20 61 6c 77 61 79 73 20 63 68 6f 73 65 6e 20 61 always chosen a
b940: 73 20 74 68 65 20 27 63 75 72 72 65 6e 74 20 64 s the 'current d
b950: 69 66 66 27 2c 20 61 6e 64 20 69 73 20 73 65 74 iff', and is set
b960: 20 6f 66 66 20 66 72 6f 6d 20 74 68 65 20 6f 74 off from the ot
b970: 68 65 72 73 0a 20 20 20 20 23 20 76 69 61 20 74 hers. # via t
b980: 68 65 20 27 64 69 66 66 27 20 74 61 67 20 2d 2d he 'diff' tag --
b990: 20 69 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 in particular,
b9a0: 73 6f 20 74 68 61 74 20 69 74 27 73 20 6f 62 76 so that it's obv
b9b0: 69 6f 75 73 20 77 68 69 63 68 20 64 69 66 66 73 ious which diffs
b9c0: 0a 20 20 20 20 23 20 69 6e 20 74 68 65 20 6c 65 . # in the le
b9d0: 66 74 20 61 6e 64 20 72 69 67 68 74 2d 68 61 6e ft and right-han
b9e0: 64 20 74 65 78 74 20 77 69 64 67 65 74 73 20 6d d text widgets m
b9f0: 61 74 63 68 2e 0a 0a 20 20 20 20 66 6f 72 65 61 atch... forea
ba00: 63 68 20 77 69 64 67 65 74 20 5b 6c 69 73 74 20 ch widget [list
ba10: 24 77 28 4c 65 66 74 54 65 78 74 29 20 24 77 28 $w(LeftText) $w(
ba20: 4c 65 66 74 49 6e 66 6f 29 20 24 77 28 4c 65 66 LeftInfo) $w(Lef
ba30: 74 43 42 29 20 24 77 28 52 69 67 68 74 54 65 78 tCB) $w(RightTex
ba40: 74 29 20 5c 0a 20 20 20 20 20 20 24 77 28 52 69 t) \. $w(Ri
ba50: 67 68 74 49 6e 66 6f 29 20 24 77 28 52 69 67 68 ghtInfo) $w(Righ
ba60: 74 43 42 29 5d 20 7b 0a 09 65 76 61 6c 20 22 24 tCB)] {..eval "$
ba70: 77 69 64 67 65 74 20 63 6f 6e 66 69 67 75 72 65 widget configure
ba80: 20 24 6f 70 74 73 28 74 65 78 74 6f 70 74 29 22 $opts(textopt)"
ba90: 0a 09 66 6f 72 65 61 63 68 20 74 61 67 20 7b 64 ..foreach tag {d
baa0: 69 66 66 74 61 67 20 63 75 72 72 74 61 67 20 69 ifftag currtag i
bab0: 6e 6c 69 6e 65 74 61 67 20 64 65 6c 74 61 67 20 nlinetag deltag
bac0: 69 6e 73 74 61 67 20 63 68 67 74 61 67 20 5c 0a instag chgtag \.
bad0: 09 20 20 6f 76 65 72 6c 61 70 74 61 67 20 2b 20 . overlaptag +
bae0: 2d 20 21 20 3f 7d 20 7b 0a 09 20 20 20 20 65 76 - ! ?} {.. ev
baf0: 61 6c 20 22 24 77 69 64 67 65 74 20 74 61 67 20 al "$widget tag
bb00: 63 6f 6e 66 69 67 75 72 65 20 24 74 61 67 20 24 configure $tag $
bb10: 6f 70 74 73 28 24 74 61 67 29 22 0a 09 7d 0a 20 opts($tag)"..}.
bb20: 20 20 20 7d 0a 0a 20 20 20 20 23 20 61 64 6a 75 }.. # adju
bb30: 73 74 20 74 68 65 20 74 61 67 20 70 72 69 6f 72 st the tag prior
bb40: 69 74 69 65 73 20 61 20 62 69 74 2e 2e 2e 0a 20 ities a bit....
bb50: 20 20 20 66 6f 72 65 61 63 68 20 77 69 6e 64 6f foreach windo
bb60: 77 20 5b 6c 69 73 74 20 4c 65 66 74 54 65 78 74 w [list LeftText
bb70: 20 52 69 67 68 74 54 65 78 74 20 4c 65 66 74 43 RightText LeftC
bb80: 42 20 52 69 67 68 74 43 42 20 4c 65 66 74 49 6e B RightCB LeftIn
bb90: 66 6f 20 52 69 67 68 74 49 6e 66 6f 5d 20 7b 0a fo RightInfo] {.
bba0: 09 24 77 28 24 77 69 6e 64 6f 77 29 20 74 61 67 .$w($window) tag
bbb0: 20 72 61 69 73 65 20 64 65 6c 74 61 67 20 63 75 raise deltag cu
bbc0: 72 72 74 61 67 0a 09 24 77 28 24 77 69 6e 64 6f rrtag..$w($windo
bbd0: 77 29 20 74 61 67 20 72 61 69 73 65 20 63 68 67 w) tag raise chg
bbe0: 74 61 67 20 63 75 72 72 74 61 67 0a 09 24 77 28 tag currtag..$w(
bbf0: 24 77 69 6e 64 6f 77 29 20 74 61 67 20 72 61 69 $window) tag rai
bc00: 73 65 20 69 6e 73 74 61 67 20 63 75 72 72 74 61 se instag currta
bc10: 67 0a 09 24 77 28 24 77 69 6e 64 6f 77 29 20 74 g..$w($window) t
bc20: 61 67 20 72 61 69 73 65 20 63 75 72 72 74 61 67 ag raise currtag
bc30: 20 64 69 66 66 74 61 67 0a 09 24 77 28 24 77 69 difftag..$w($wi
bc40: 6e 64 6f 77 29 20 74 61 67 20 72 61 69 73 65 20 ndow) tag raise
bc50: 69 6e 6c 69 6e 65 74 61 67 0a 20 20 20 20 7d 0a inlinetag. }.
bc60: 0a 20 20 20 20 23 20 74 68 65 73 65 20 74 61 67 . # these tag
bc70: 73 20 61 72 65 20 73 70 65 63 69 66 69 63 20 74 s are specific t
bc80: 6f 20 63 68 61 6e 67 65 20 62 61 72 73 0a 20 20 o change bars.
bc90: 20 20 66 6f 72 65 61 63 68 20 77 69 64 67 65 74 foreach widget
bca0: 20 5b 6c 69 73 74 20 24 77 28 4c 65 66 74 43 42 [list $w(LeftCB
bcb0: 29 20 24 77 28 52 69 67 68 74 43 42 29 5d 20 7b ) $w(RightCB)] {
bcc0: 0a 09 65 76 61 6c 20 22 24 77 69 64 67 65 74 20 ..eval "$widget
bcd0: 74 61 67 20 63 6f 6e 66 69 67 75 72 65 20 2b 20 tag configure +
bce0: 24 6f 70 74 73 28 2b 29 22 0a 09 65 76 61 6c 20 $opts(+)"..eval
bcf0: 22 24 77 69 64 67 65 74 20 74 61 67 20 63 6f 6e "$widget tag con
bd00: 66 69 67 75 72 65 20 2d 20 24 6f 70 74 73 28 2d figure - $opts(-
bd10: 29 22 0a 09 65 76 61 6c 20 22 24 77 69 64 67 65 )"..eval "$widge
bd20: 74 20 74 61 67 20 63 6f 6e 66 69 67 75 72 65 20 t tag configure
bd30: 21 20 24 6f 70 74 73 28 21 29 22 0a 09 65 76 61 ! $opts(!)"..eva
bd40: 6c 20 22 24 77 69 64 67 65 74 20 74 61 67 20 63 l "$widget tag c
bd50: 6f 6e 66 69 67 75 72 65 20 3f 20 24 6f 70 74 73 onfigure ? $opts
bd60: 28 3f 29 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 (?)". }..
bd70: 23 20 62 75 69 6c 64 20 74 68 65 20 6d 61 70 2e # build the map.
bd80: 2e 2e 0a 20 20 20 20 23 20 77 65 20 77 61 6e 74 ... # we want
bd90: 20 74 68 65 20 6d 61 70 20 74 6f 20 62 65 20 74 the map to be t
bda0: 68 65 20 73 61 6d 65 20 77 69 64 74 68 20 61 73 he same width as
bdb0: 20 61 20 73 63 72 6f 6c 6c 62 61 72 2c 20 73 6f a scrollbar, so
bdc0: 20 77 65 27 6c 6c 0a 20 20 20 20 23 20 73 74 65 we'll. # ste
bdd0: 61 6c 20 73 6f 6d 65 20 69 6e 66 6f 72 6d 61 74 al some informat
bde0: 69 6f 6e 20 66 72 6f 6d 20 6f 6e 65 20 6f 66 20 ion from one of
bdf0: 74 68 65 20 73 63 72 6f 6c 6c 62 61 72 73 20 77 the scrollbars w
be00: 65 20 6a 75 73 74 0a 20 20 20 20 23 20 63 72 65 e just. # cre
be10: 61 74 65 64 2e 2e 2e 0a 20 20 20 20 73 65 74 20 ated.... set
be20: 63 77 69 64 74 68 20 5b 77 69 6e 66 6f 20 72 65 cwidth [winfo re
be30: 71 77 69 64 74 68 20 24 77 28 4c 65 66 74 56 53 qwidth $w(LeftVS
be40: 42 29 5d 0a 20 20 20 20 73 65 74 20 68 74 20 5b B)]. set ht [
be50: 24 77 28 4c 65 66 74 56 53 42 29 20 63 67 65 74 $w(LeftVSB) cget
be60: 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b -highlightthick
be70: 6e 65 73 73 5d 0a 20 20 20 20 73 65 74 20 63 77 ness]. set cw
be80: 69 64 74 68 20 5b 65 78 70 72 20 7b 24 63 77 69 idth [expr {$cwi
be90: 64 74 68 20 2d 28 24 68 74 2a 32 29 7d 5d 0a 20 dth -($ht*2)}].
bea0: 20 20 20 73 65 74 20 63 6f 6c 6f 72 20 5b 24 77 set color [$w
beb0: 28 4c 65 66 74 56 53 42 29 20 63 67 65 74 20 2d (LeftVSB) cget -
bec0: 74 72 6f 75 67 68 63 6f 6c 6f 72 5d 0a 0a 20 20 troughcolor]..
bed0: 20 20 73 65 74 20 6d 61 70 20 5b 66 72 61 6d 65 set map [frame
bee0: 20 24 77 28 63 6c 69 65 6e 74 29 2e 6d 61 70 20 $w(client).map
bef0: 2d 62 64 20 31 20 2d 72 65 6c 69 65 66 20 73 75 -bd 1 -relief su
bf00: 6e 6b 65 6e 20 2d 74 61 6b 65 66 6f 63 75 73 20 nken -takefocus
bf10: 30 20 5c 0a 20 20 20 20 20 20 2d 68 69 67 68 6c 0 \. -highl
bf20: 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 5d ightthickness 0]
bf30: 0a 0a 20 20 20 20 23 20 6e 6f 77 20 66 6f 72 20 .. # now for
bf40: 74 68 65 20 72 65 61 6c 20 6d 61 70 2e 2e 2e 0a the real map....
bf50: 20 20 20 20 69 6d 61 67 65 20 63 72 65 61 74 65 image create
bf60: 20 70 68 6f 74 6f 20 6d 61 70 0a 0a 20 20 20 20 photo map..
bf70: 63 61 6e 76 61 73 20 24 77 28 6d 61 70 43 61 6e canvas $w(mapCan
bf80: 76 61 73 29 20 2d 77 69 64 74 68 20 5b 65 78 70 vas) -width [exp
bf90: 72 20 7b 24 63 77 69 64 74 68 20 2b 20 31 7d 5d r {$cwidth + 1}]
bfa0: 20 5c 0a 20 20 20 20 20 20 2d 79 73 63 72 6f 6c \. -yscrol
bfb0: 6c 63 6f 6d 6d 61 6e 64 20 6d 61 70 2d 72 65 73 lcommand map-res
bfc0: 69 7a 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 ize -background
bfd0: 24 63 6f 6c 6f 72 20 2d 62 6f 72 64 65 72 77 69 $color -borderwi
bfe0: 64 74 68 20 30 20 5c 0a 20 20 20 20 20 20 2d 72 dth 0 \. -r
bff0: 65 6c 69 65 66 20 73 75 6e 6b 65 6e 20 2d 68 69 elief sunken -hi
c000: 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 ghlightthickness
c010: 20 30 0a 20 20 20 20 24 77 28 6d 61 70 43 61 6e 0. $w(mapCan
c020: 76 61 73 29 20 63 72 65 61 74 65 20 69 6d 61 67 vas) create imag
c030: 65 20 31 20 31 20 2d 69 6d 61 67 65 20 6d 61 70 e 1 1 -image map
c040: 20 2d 61 6e 63 68 6f 72 20 6e 77 0a 20 20 20 20 -anchor nw.
c050: 70 61 63 6b 20 24 77 28 6d 61 70 43 61 6e 76 61 pack $w(mapCanva
c060: 73 29 20 2d 73 69 64 65 20 74 6f 70 20 2d 66 69 s) -side top -fi
c070: 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 ll both -expand
c080: 79 0a 0a 20 20 20 20 23 20 49 27 6d 20 6e 6f 74 y.. # I'm not
c090: 20 74 6f 6f 20 70 6c 65 61 73 65 64 20 77 69 74 too pleased wit
c0a0: 68 20 74 68 65 73 65 20 62 69 6e 64 69 6e 67 73 h these bindings
c0b0: 20 2d 2d 20 69 74 20 72 65 73 75 6c 74 73 20 69 -- it results i
c0c0: 6e 20 61 20 72 61 74 68 65 72 0a 20 20 20 20 23 n a rather. #
c0d0: 20 6a 65 72 6b 79 2c 20 63 70 75 2d 69 6e 74 65 jerky, cpu-inte
c0e0: 6e 73 69 76 65 20 6d 61 6e 65 75 76 65 72 20 73 nsive maneuver s
c0f0: 69 6e 63 65 20 77 69 74 68 20 65 61 63 68 20 6d ince with each m
c100: 6f 76 65 20 6f 66 20 74 68 65 20 6d 6f 75 73 65 ove of the mouse
c110: 0a 20 20 20 20 23 20 77 65 20 61 72 65 20 66 69 . # we are fi
c120: 6e 64 69 6e 67 20 61 6e 64 20 74 61 67 67 69 6e nding and taggin
c130: 67 20 74 68 65 20 6e 65 61 72 65 73 74 20 64 69 g the nearest di
c140: 66 66 2e 20 42 75 74 2c 20 77 68 61 74 20 2a 73 ff. But, what *s
c150: 68 6f 75 6c 64 2a 0a 20 20 20 20 23 20 69 74 20 hould*. # it
c160: 64 6f 3f 0a 20 20 20 20 23 0a 20 20 20 20 23 20 do?. #. #
c170: 49 20 74 68 69 6e 6b 20 77 68 61 74 20 49 20 2a I think what I *
c180: 77 61 6e 74 2a 20 69 74 20 74 6f 20 64 6f 20 69 want* it to do i
c190: 73 20 75 70 64 61 74 65 20 74 68 65 20 63 6f 6d s update the com
c1a0: 62 6f 62 6f 78 20 61 6e 64 20 73 74 61 74 75 73 bobox and status
c1b0: 0a 20 20 20 20 23 20 62 61 72 20 73 6f 20 74 68 . # bar so th
c1c0: 65 20 75 73 65 72 20 63 61 6e 20 73 65 65 20 77 e user can see w
c1d0: 68 65 72 65 20 69 6e 20 74 68 65 20 73 63 68 65 here in the sche
c1e0: 6d 65 20 6f 66 20 74 68 69 6e 67 73 20 74 68 65 me of things the
c1f0: 79 20 61 72 65 2c 0a 20 20 20 20 23 20 62 75 74 y are,. # but
c200: 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 20 73 65 not actually se
c210: 6c 65 63 74 20 61 6e 79 74 68 69 6e 67 20 75 6e lect anything un
c220: 74 69 6c 20 74 68 65 79 20 72 65 6c 65 61 73 65 til they release
c230: 20 74 68 65 20 6d 6f 75 73 65 2e 0a 20 20 20 20 the mouse..
c240: 62 69 6e 64 20 24 77 28 6d 61 70 43 61 6e 76 61 bind $w(mapCanva
c250: 73 29 20 3c 42 75 74 74 6f 6e 50 72 65 73 73 2d s) <ButtonPress-
c260: 31 3e 20 5b 6c 69 73 74 20 68 61 6e 64 6c 65 4d 1> [list handleM
c270: 61 70 45 76 65 6e 74 20 42 31 2d 50 72 65 73 73 apEvent B1-Press
c280: 20 25 79 5d 0a 20 20 20 20 62 69 6e 64 20 24 77 %y]. bind $w
c290: 28 6d 61 70 43 61 6e 76 61 73 29 20 3c 42 75 74 (mapCanvas) <But
c2a0: 74 6f 6e 31 2d 4d 6f 74 69 6f 6e 3e 20 5b 6c 69 ton1-Motion> [li
c2b0: 73 74 20 68 61 6e 64 6c 65 4d 61 70 45 76 65 6e st handleMapEven
c2c0: 74 20 42 31 2d 4d 6f 74 69 6f 6e 20 25 79 5d 0a t B1-Motion %y].
c2d0: 20 20 20 20 62 69 6e 64 20 24 77 28 6d 61 70 43 bind $w(mapC
c2e0: 61 6e 76 61 73 29 20 3c 42 75 74 74 6f 6e 52 65 anvas) <ButtonRe
c2f0: 6c 65 61 73 65 2d 31 3e 20 5b 6c 69 73 74 20 68 lease-1> [list h
c300: 61 6e 64 6c 65 4d 61 70 45 76 65 6e 74 20 42 31 andleMapEvent B1
c310: 2d 52 65 6c 65 61 73 65 20 25 79 5d 0a 0a 20 20 -Release %y]..
c320: 20 20 23 20 74 68 69 73 20 69 73 20 61 20 67 72 # this is a gr
c330: 69 70 20 66 6f 72 20 72 65 73 69 7a 69 6e 67 20 ip for resizing
c340: 74 68 65 20 73 69 64 65 73 20 72 65 6c 61 74 69 the sides relati
c350: 76 65 20 74 6f 20 65 61 63 68 20 6f 74 68 65 72 ve to each other
c360: 2e 0a 20 20 20 20 62 75 74 74 6f 6e 20 24 77 28 .. button $w(
c370: 63 6c 69 65 6e 74 29 2e 67 72 69 70 20 2d 62 6f client).grip -bo
c380: 72 64 65 72 77 69 64 74 68 20 33 20 2d 72 65 6c rderwidth 3 -rel
c390: 69 65 66 20 72 61 69 73 65 64 20 5c 0a 20 20 20 ief raised \.
c3a0: 20 20 20 2d 63 75 72 73 6f 72 20 73 62 5f 68 5f -cursor sb_h_
c3b0: 64 6f 75 62 6c 65 5f 61 72 72 6f 77 20 2d 69 6d double_arrow -im
c3c0: 61 67 65 20 72 65 73 69 7a 65 0a 20 20 20 20 62 age resize. b
c3d0: 69 6e 64 20 24 77 28 63 6c 69 65 6e 74 29 2e 67 ind $w(client).g
c3e0: 72 69 70 20 3c 42 31 2d 4d 6f 74 69 6f 6e 3e 20 rip <B1-Motion>
c3f0: 7b 70 61 6e 65 5f 64 72 61 67 20 24 77 28 63 6c {pane_drag $w(cl
c400: 69 65 6e 74 29 20 25 58 7d 0a 0a 20 20 20 20 23 ient) %X}.. #
c410: 20 75 73 65 20 67 72 69 64 20 74 6f 20 6d 61 6e use grid to man
c420: 61 67 65 20 74 68 65 20 77 69 64 67 65 74 73 20 age the widgets
c430: 69 6e 20 74 68 65 20 6c 65 66 74 20 73 69 64 65 in the left side
c440: 20 66 72 61 6d 65 0a 20 20 20 20 67 72 69 64 20 frame. grid
c450: 24 77 28 4c 65 66 74 56 53 42 29 20 2d 72 6f 77 $w(LeftVSB) -row
c460: 20 30 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 0 -column 0 -st
c470: 69 63 6b 79 20 6e 73 0a 20 20 20 20 67 72 69 64 icky ns. grid
c480: 20 24 77 28 4c 65 66 74 49 6e 66 6f 29 20 2d 72 $w(LeftInfo) -r
c490: 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d ow 0 -column 1 -
c4a0: 73 74 69 63 6b 79 20 6e 73 65 77 0a 20 20 20 20 sticky nsew.
c4b0: 67 72 69 64 20 24 77 28 4c 65 66 74 43 42 29 20 grid $w(LeftCB)
c4c0: 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 32 -row 0 -column 2
c4d0: 20 2d 73 74 69 63 6b 79 20 6e 73 0a 20 20 20 20 -sticky ns.
c4e0: 67 72 69 64 20 24 77 28 4c 65 66 74 54 65 78 74 grid $w(LeftText
c4f0: 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e ) -row 0 -column
c500: 20 33 20 2d 73 74 69 63 6b 79 20 6e 73 65 77 0a 3 -sticky nsew.
c510: 20 20 20 20 67 72 69 64 20 24 77 28 4c 65 66 74 grid $w(Left
c520: 48 53 42 29 20 2d 72 6f 77 20 31 20 2d 63 6f 6c HSB) -row 1 -col
c530: 75 6d 6e 20 31 20 2d 73 74 69 63 6b 79 20 65 77 umn 1 -sticky ew
c540: 20 2d 63 6f 6c 75 6d 6e 73 70 61 6e 20 33 0a 0a -columnspan 3..
c550: 20 20 20 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 grid rowconf
c560: 69 67 75 72 65 20 24 6c 65 66 74 46 72 61 6d 65 igure $leftFrame
c570: 20 30 20 2d 77 65 69 67 68 74 20 31 0a 20 20 20 0 -weight 1.
c580: 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 grid rowconfigu
c590: 72 65 20 24 6c 65 66 74 46 72 61 6d 65 20 31 20 re $leftFrame 1
c5a0: 2d 77 65 69 67 68 74 20 30 0a 0a 20 20 20 20 67 -weight 0.. g
c5b0: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
c5c0: 75 72 65 20 24 6c 65 66 74 46 72 61 6d 65 20 30 ure $leftFrame 0
c5d0: 20 2d 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 -weight 0. g
c5e0: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
c5f0: 75 72 65 20 24 6c 65 66 74 46 72 61 6d 65 20 31 ure $leftFrame 1
c600: 20 2d 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 -weight 0. g
c610: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
c620: 75 72 65 20 24 6c 65 66 74 46 72 61 6d 65 20 32 ure $leftFrame 2
c630: 20 2d 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 -weight 0. g
c640: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
c650: 75 72 65 20 24 6c 65 66 74 46 72 61 6d 65 20 33 ure $leftFrame 3
c660: 20 2d 77 65 69 67 68 74 20 31 0a 0a 20 20 20 20 -weight 1..
c670: 23 20 6c 69 6b 65 77 69 73 65 20 66 6f 72 20 74 # likewise for t
c680: 68 65 20 72 69 67 68 74 2e 2e 2e 0a 20 20 20 20 he right....
c690: 67 72 69 64 20 24 77 28 52 69 67 68 74 56 53 42 grid $w(RightVSB
c6a0: 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e ) -row 0 -column
c6b0: 20 33 20 2d 73 74 69 63 6b 79 20 6e 73 0a 20 20 3 -sticky ns.
c6c0: 20 20 67 72 69 64 20 24 77 28 52 69 67 68 74 49 grid $w(RightI
c6d0: 6e 66 6f 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c nfo) -row 0 -col
c6e0: 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 6e 73 umn 0 -sticky ns
c6f0: 65 77 0a 20 20 20 20 67 72 69 64 20 24 77 28 52 ew. grid $w(R
c700: 69 67 68 74 43 42 29 20 2d 72 6f 77 20 30 20 2d ightCB) -row 0 -
c710: 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 63 6b 79 column 1 -sticky
c720: 20 6e 73 0a 20 20 20 20 67 72 69 64 20 24 77 28 ns. grid $w(
c730: 52 69 67 68 74 54 65 78 74 29 20 2d 72 6f 77 20 RightText) -row
c740: 30 20 2d 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 0 -column 2 -sti
c750: 63 6b 79 20 6e 73 65 77 0a 20 20 20 20 67 72 69 cky nsew. gri
c760: 64 20 24 77 28 52 69 67 68 74 48 53 42 29 20 2d d $w(RightHSB) -
c770: 72 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 30 20 row 1 -column 0
c780: 2d 73 74 69 63 6b 79 20 65 77 20 2d 63 6f 6c 75 -sticky ew -colu
c790: 6d 6e 73 70 61 6e 20 33 0a 0a 20 20 20 20 67 72 mnspan 3.. gr
c7a0: 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 72 65 20 id rowconfigure
c7b0: 24 72 69 67 68 74 46 72 61 6d 65 20 30 20 2d 77 $rightFrame 0 -w
c7c0: 65 69 67 68 74 20 31 0a 20 20 20 20 67 72 69 64 eight 1. grid
c7d0: 20 72 6f 77 63 6f 6e 66 69 67 75 72 65 20 24 72 rowconfigure $r
c7e0: 69 67 68 74 46 72 61 6d 65 20 31 20 2d 77 65 69 ightFrame 1 -wei
c7f0: 67 68 74 20 30 0a 0a 20 20 20 20 67 72 69 64 20 ght 0.. grid
c800: 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 columnconfigure
c810: 24 72 69 67 68 74 46 72 61 6d 65 20 30 20 2d 77 $rightFrame 0 -w
c820: 65 69 67 68 74 20 30 0a 20 20 20 20 67 72 69 64 eight 0. grid
c830: 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 columnconfigure
c840: 20 24 72 69 67 68 74 46 72 61 6d 65 20 31 20 2d $rightFrame 1 -
c850: 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 72 69 weight 0. gri
c860: 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 d columnconfigur
c870: 65 20 24 72 69 67 68 74 46 72 61 6d 65 20 32 20 e $rightFrame 2
c880: 2d 77 65 69 67 68 74 20 31 0a 20 20 20 20 67 72 -weight 1. gr
c890: 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 id columnconfigu
c8a0: 72 65 20 24 72 69 67 68 74 46 72 61 6d 65 20 33 re $rightFrame 3
c8b0: 20 2d 77 65 69 67 68 74 20 30 0a 0a 20 20 20 20 -weight 0..
c8c0: 23 20 75 73 65 20 67 72 69 64 20 74 6f 20 6d 61 # use grid to ma
c8d0: 6e 61 67 65 20 74 68 65 20 6c 61 62 65 6c 73 2c nage the labels,
c8e0: 20 66 72 61 6d 65 73 20 61 6e 64 20 6d 61 70 2e frames and map.
c8f0: 20 57 65 27 72 65 20 67 6f 69 6e 67 20 74 6f 0a We're going to.
c900: 20 20 20 20 23 20 74 6f 73 73 20 69 6e 20 61 6e # toss in an
c910: 20 65 78 74 72 61 20 72 6f 77 20 6a 75 73 74 20 extra row just
c920: 66 6f 72 20 74 68 65 20 62 65 6e 65 66 69 74 20 for the benefit
c930: 6f 66 20 6f 75 72 20 64 75 6d 6d 79 20 66 72 61 of our dummy fra
c940: 6d 65 2e 0a 20 20 20 20 23 20 74 68 65 20 69 6e me.. # the in
c950: 74 65 6e 74 20 69 73 20 74 68 61 74 20 74 68 65 tent is that the
c960: 20 64 75 6d 6d 79 20 66 72 61 6d 65 20 77 69 6c dummy frame wil
c970: 6c 20 6d 61 74 63 68 20 74 68 65 20 68 65 69 67 l match the heig
c980: 68 74 20 6f 66 0a 20 20 20 20 23 20 74 68 65 20 ht of. # the
c990: 68 6f 72 69 7a 6f 6e 74 61 6c 20 73 63 72 6f 6c horizontal scrol
c9a0: 6c 62 61 72 73 20 73 6f 20 74 68 65 20 6d 61 70 lbars so the map
c9b0: 20 73 74 6f 70 73 20 61 74 20 74 68 65 20 72 69 stops at the ri
c9c0: 67 68 74 20 70 6c 61 63 65 2e 2e 2e 0a 20 20 20 ght place....
c9d0: 20 67 72 69 64 20 24 77 28 4c 65 66 74 4c 61 62 grid $w(LeftLab
c9e0: 65 6c 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 el) -row 0 -colu
c9f0: 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 65 77 0a mn 0 -sticky ew.
ca00: 20 20 20 20 67 72 69 64 20 24 77 28 52 69 67 68 grid $w(Righ
ca10: 74 4c 61 62 65 6c 29 20 2d 72 6f 77 20 30 20 2d tLabel) -row 0 -
ca20: 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 63 6b 79 column 2 -sticky
ca30: 20 65 77 0a 20 20 20 20 67 72 69 64 20 24 6c 65 ew. grid $le
ca40: 66 74 46 72 61 6d 65 20 2d 72 6f 77 20 31 20 2d ftFrame -row 1 -
ca50: 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 column 0 -sticky
ca60: 20 6e 73 65 77 20 2d 72 6f 77 73 70 61 6e 20 32 nsew -rowspan 2
ca70: 0a 20 20 20 20 67 72 69 64 20 24 6d 61 70 20 2d . grid $map -
ca80: 72 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 31 20 row 1 -column 1
ca90: 2d 73 74 69 63 6b 20 6e 73 0a 20 20 20 20 67 72 -stick ns. gr
caa0: 69 64 20 24 77 28 63 6c 69 65 6e 74 29 2e 67 72 id $w(client).gr
cab0: 69 70 20 2d 72 6f 77 20 32 20 2d 63 6f 6c 75 6d ip -row 2 -colum
cac0: 6e 20 31 0a 20 20 20 20 67 72 69 64 20 24 72 69 n 1. grid $ri
cad0: 67 68 74 46 72 61 6d 65 20 2d 72 6f 77 20 31 20 ghtFrame -row 1
cae0: 2d 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 63 6b -column 2 -stick
caf0: 79 20 6e 73 65 77 20 2d 72 6f 77 73 70 61 6e 20 y nsew -rowspan
cb00: 32 0a 0a 20 20 20 20 67 72 69 64 20 72 6f 77 63 2.. grid rowc
cb10: 6f 6e 66 69 67 75 72 65 20 24 77 28 63 6c 69 65 onfigure $w(clie
cb20: 6e 74 29 20 30 20 2d 77 65 69 67 68 74 20 30 0a nt) 0 -weight 0.
cb30: 20 20 20 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 grid rowconf
cb40: 69 67 75 72 65 20 24 77 28 63 6c 69 65 6e 74 29 igure $w(client)
cb50: 20 31 20 2d 77 65 69 67 68 74 20 31 0a 20 20 20 1 -weight 1.
cb60: 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 grid rowconfigu
cb70: 72 65 20 24 77 28 63 6c 69 65 6e 74 29 20 32 20 re $w(client) 2
cb80: 2d 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 72 -weight 0. gr
cb90: 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 72 65 20 id rowconfigure
cba0: 24 77 28 63 6c 69 65 6e 74 29 20 33 20 2d 77 65 $w(client) 3 -we
cbb0: 69 67 68 74 20 30 0a 0a 20 20 20 20 69 66 20 7b ight 0.. if {
cbc0: 24 74 6b 5f 76 65 72 73 69 6f 6e 20 3c 20 38 2e $tk_version < 8.
cbd0: 34 7d 20 7b 0a 20 20 20 20 20 20 67 72 69 64 20 4} {. grid
cbe0: 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 columnconfigure
cbf0: 24 77 28 63 6c 69 65 6e 74 29 20 30 20 2d 77 65 $w(client) 0 -we
cc00: 69 67 68 74 20 31 0a 20 20 20 20 20 20 67 72 69 ight 1. gri
cc10: 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 d columnconfigur
cc20: 65 20 24 77 28 63 6c 69 65 6e 74 29 20 32 20 2d e $w(client) 2 -
cc30: 77 65 69 67 68 74 20 31 0a 20 20 20 20 7d 20 65 weight 1. } e
cc40: 6c 73 65 20 7b 0a 20 20 20 20 20 20 67 72 69 64 lse {. grid
cc50: 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 columnconfigure
cc60: 20 24 77 28 63 6c 69 65 6e 74 29 20 30 20 2d 77 $w(client) 0 -w
cc70: 65 69 67 68 74 20 31 30 30 20 2d 75 6e 69 66 6f eight 100 -unifo
cc80: 72 6d 20 61 0a 20 20 20 20 20 20 67 72 69 64 20 rm a. grid
cc90: 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 columnconfigure
cca0: 24 77 28 63 6c 69 65 6e 74 29 20 32 20 2d 77 65 $w(client) 2 -we
ccb0: 69 67 68 74 20 31 30 30 20 2d 75 6e 69 66 6f 72 ight 100 -unifor
ccc0: 6d 20 61 0a 20 20 20 20 7d 0a 20 20 20 20 67 72 m a. }. gr
ccd0: 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 id columnconfigu
cce0: 72 65 20 24 77 28 63 6c 69 65 6e 74 29 20 31 20 re $w(client) 1
ccf0: 2d 77 65 69 67 68 74 20 30 0a 0a 20 20 20 20 23 -weight 0.. #
cd00: 20 74 68 69 73 20 61 64 6a 75 73 74 73 20 74 68 this adjusts th
cd10: 65 20 76 61 72 69 61 62 6c 65 20 67 28 61 63 74 e variable g(act
cd20: 69 76 65 57 69 6e 64 6f 77 29 20 74 6f 20 62 65 iveWindow) to be
cd30: 20 77 68 61 74 65 76 65 72 20 74 65 78 74 0a 20 whatever text.
cd40: 20 20 20 23 20 77 69 64 67 65 74 20 68 61 73 20 # widget has
cd50: 74 68 65 20 66 6f 63 75 73 2e 2e 2e 0a 20 20 20 the focus....
cd60: 20 62 69 6e 64 20 24 77 28 4c 65 66 74 54 65 78 bind $w(LeftTex
cd70: 74 29 20 3c 31 3e 20 7b 73 65 74 20 67 28 61 63 t) <1> {set g(ac
cd80: 74 69 76 65 57 69 6e 64 6f 77 29 20 24 77 28 4c tiveWindow) $w(L
cd90: 65 66 74 54 65 78 74 29 7d 0a 20 20 20 20 62 69 eftText)}. bi
cda0: 6e 64 20 24 77 28 52 69 67 68 74 54 65 78 74 29 nd $w(RightText)
cdb0: 20 3c 31 3e 20 7b 73 65 74 20 67 28 61 63 74 69 <1> {set g(acti
cdc0: 76 65 57 69 6e 64 6f 77 29 20 24 77 28 52 69 67 veWindow) $w(Rig
cdd0: 68 74 54 65 78 74 29 7d 0a 0a 20 20 20 20 73 65 htText)}.. se
cde0: 74 20 67 28 61 63 74 69 76 65 57 69 6e 64 6f 77 t g(activeWindow
cdf0: 29 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 3b ) $w(LeftText) ;
ce00: 23 20 65 73 74 61 62 6c 69 73 68 20 61 20 64 65 # establish a de
ce10: 66 61 75 6c 74 0a 0a 20 20 20 20 72 65 6e 61 6d fault.. renam
ce20: 65 20 24 77 28 52 69 67 68 74 54 65 78 74 29 20 e $w(RightText)
ce30: 24 77 28 52 69 67 68 74 54 65 78 74 29 5f 0a 20 $w(RightText)_.
ce40: 20 20 20 72 65 6e 61 6d 65 20 24 77 28 4c 65 66 rename $w(Lef
ce50: 74 54 65 78 74 29 20 24 77 28 4c 65 66 74 54 65 tText) $w(LeftTe
ce60: 78 74 29 5f 0a 0a 20 20 20 20 70 72 6f 63 20 24 xt)_.. proc $
ce70: 77 28 52 69 67 68 74 54 65 78 74 29 20 7b 63 6f w(RightText) {co
ce80: 6d 6d 61 6e 64 20 61 72 67 73 7d 20 24 3a 3a 74 mmand args} $::t
ce90: 65 78 74 5f 77 69 64 67 65 74 5f 70 72 6f 63 0a ext_widget_proc.
cea0: 20 20 20 20 70 72 6f 63 20 24 77 28 4c 65 66 74 proc $w(Left
ceb0: 54 65 78 74 29 20 7b 63 6f 6d 6d 61 6e 64 20 61 Text) {command a
cec0: 72 67 73 7d 20 24 3a 3a 74 65 78 74 5f 77 69 64 rgs} $::text_wid
ced0: 67 65 74 5f 70 72 6f 63 0a 7d 0a 0a 23 23 23 23 get_proc.}..####
cee0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
cef0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
cf00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
cf10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
cf20: 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 46 75 ###########.# Fu
cf30: 6e 63 74 69 6f 6e 61 6c 69 74 79 3a 20 49 6e 6c nctionality: Inl
cf40: 69 6e 65 20 64 69 66 66 73 0a 23 20 41 74 68 72 ine diffs.# Athr
cf50: 3a 20 4d 69 63 68 61 65 6c 20 44 2e 20 42 65 79 : Michael D. Bey
cf60: 6e 6f 6e 20 3a 20 6d 64 62 20 2d 20 62 65 79 6e non : mdb - beyn
cf70: 6f 6e 40 79 61 68 6f 6f 2e 63 6f 6d 0a 23 20 44 on@yahoo.com.# D
cf80: 61 74 65 3a 20 30 34 2f 30 38 2f 32 30 30 33 20 ate: 04/08/2003
cf90: 3a 20 6d 64 62 20 2d 20 41 64 64 65 64 20 69 6e : mdb - Added in
cfa0: 6c 69 6e 65 20 63 68 61 72 61 63 74 65 72 20 64 line character d
cfb0: 69 66 66 73 2e 0a 23 20 20 20 20 20 20 20 30 34 iffs..# 04
cfc0: 2f 31 36 2f 32 30 30 33 20 3a 20 6d 64 62 20 2d /16/2003 : mdb -
cfd0: 20 52 65 77 72 6f 74 65 20 6c 6f 6e 67 65 73 74 Rewrote longest
cfe0: 2d 63 6f 6d 6d 6f 6e 2d 73 75 62 73 74 72 69 6e -common-substrin
cff0: 67 20 74 6f 20 62 65 20 66 61 73 74 65 72 2e 0a g to be faster..
d000: 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 #
d010: 20 20 20 20 20 20 20 20 20 2d 20 41 64 64 65 64 - Added
d020: 20 62 79 74 65 2d 62 79 2d 62 79 74 65 20 61 6c byte-by-byte al
d030: 67 6f 72 69 74 68 6d 2e 0a 23 0a 23 20 74 68 65 gorithm..#.# the
d040: 20 72 65 63 75 72 73 69 76 65 20 76 65 72 73 69 recursive versi
d050: 6f 6e 20 69 73 20 64 65 72 69 76 65 64 20 66 72 on is derived fr
d060: 6f 6d 20 74 68 65 20 52 61 74 63 6c 69 66 66 2f om the Ratcliff/
d070: 4f 62 65 72 73 68 65 6c 70 20 70 61 74 74 65 72 Obershelp patter
d080: 6e 0a 23 20 72 65 63 6f 67 6e 69 74 69 6f 6e 20 n.# recognition
d090: 61 6c 67 6f 72 69 74 68 6d 20 28 44 72 20 44 6f algorithm (Dr Do
d0a0: 62 62 73 20 4a 75 6c 79 20 31 39 38 38 29 2c 20 bbs July 1988),
d0b0: 77 68 65 72 65 20 77 65 20 73 65 61 72 63 68 20 where we search
d0c0: 66 6f 72 20 61 0a 23 20 6c 6f 6e 67 65 73 74 20 for a.# longest
d0d0: 63 6f 6d 6d 6f 6e 20 73 75 62 73 74 72 69 6e 67 common substring
d0e0: 20 62 65 74 77 65 65 6e 20 74 77 6f 20 73 74 72 between two str
d0f0: 69 6e 67 73 2e 20 20 54 68 69 73 20 6d 61 74 63 ings. This matc
d100: 68 20 69 73 20 75 73 65 64 20 61 73 0a 23 20 61 h is used as.# a
d110: 6e 20 61 72 63 68 6f 72 2c 20 61 72 6f 75 6e 64 n archor, around
d120: 20 77 68 69 63 68 20 77 65 20 72 65 63 75 72 73 which we recurs
d130: 69 76 65 6c 79 20 64 6f 20 74 68 65 20 73 61 6d ively do the sam
d140: 65 20 66 6f 72 20 74 68 65 20 74 77 6f 20 6c 65 e for the two le
d150: 66 74 0a 23 20 61 6e 64 20 74 77 6f 20 72 69 67 ft.# and two rig
d160: 68 74 20 72 65 6d 61 69 6e 69 6e 67 20 70 69 65 ht remaining pie
d170: 63 65 73 20 28 6f 6d 69 74 74 69 6e 67 20 74 68 ces (omitting th
d180: 65 20 61 6e 63 68 6f 72 29 2e 20 20 54 68 69 73 e anchor). This
d190: 0a 23 20 70 72 65 63 69 73 65 6c 79 20 64 65 74 .# precisely det
d1a0: 65 72 6d 69 6e 65 73 20 74 68 65 20 6c 6f 63 61 ermines the loca
d1b0: 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 74 72 tion of the intr
d1c0: 61 6c 69 6e 65 20 74 61 67 73 2e 0a 23 23 23 23 aline tags..####
d1d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
d1e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
d1f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
d200: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
d210: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
d220: 6f 63 20 6c 6f 6e 67 65 73 74 2d 63 6f 6d 6d 6f oc longest-commo
d230: 6e 2d 73 75 62 73 74 72 69 6e 67 20 7b 73 31 20 n-substring {s1
d240: 6f 66 66 31 20 6c 65 6e 31 20 73 32 20 6f 66 66 off1 len1 s2 off
d250: 32 20 6c 65 6e 32 20 6c 63 73 6f 66 66 31 5f 72 2 len2 lcsoff1_r
d260: 65 66 20 5c 0a 20 20 6c 63 73 6f 66 66 32 5f 72 ef \. lcsoff2_r
d270: 65 66 7d 20 7b 0a 20 20 20 20 75 70 76 61 72 20 ef} {. upvar
d280: 24 6c 63 73 6f 66 66 31 5f 72 65 66 20 6c 63 73 $lcsoff1_ref lcs
d290: 6f 66 66 31 0a 20 20 20 20 75 70 76 61 72 20 24 off1. upvar $
d2a0: 6c 63 73 6f 66 66 32 5f 72 65 66 20 6c 63 73 6f lcsoff2_ref lcso
d2b0: 66 66 32 0a 20 20 20 20 73 65 74 20 73 6e 69 70 ff2. set snip
d2c0: 70 65 74 20 22 22 0a 0a 20 20 20 20 73 65 74 20 pet "".. set
d2d0: 73 6e 69 70 70 65 74 6c 65 6e 20 30 0a 20 20 20 snippetlen 0.
d2e0: 20 73 65 74 20 6c 6f 6e 67 65 73 74 6c 65 6e 20 set longestlen
d2f0: 30 0a 0a 20 20 20 20 23 20 65 78 74 72 61 63 74 0.. # extract
d300: 20 6a 75 73 74 20 74 68 65 20 73 65 61 72 63 68 just the search
d310: 20 72 65 67 69 6f 6e 73 20 66 6f 72 20 65 66 66 regions for eff
d320: 69 63 69 65 6e 63 79 20 69 6e 20 73 74 72 69 6e iciency in strin
d330: 67 20 73 65 61 72 63 68 69 6e 67 0a 20 20 20 20 g searching.
d340: 73 65 74 20 73 31 20 5b 73 74 72 69 6e 67 20 72 set s1 [string r
d350: 61 6e 67 65 20 24 73 31 20 24 6f 66 66 31 20 5b ange $s1 $off1 [
d360: 65 78 70 72 20 24 6f 66 66 31 2b 24 6c 65 6e 31 expr $off1+$len1
d370: 2d 31 5d 5d 0a 20 20 20 20 73 65 74 20 73 32 20 -1]]. set s2
d380: 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24 73 [string range $s
d390: 32 20 24 6f 66 66 32 20 5b 65 78 70 72 20 24 6f 2 $off2 [expr $o
d3a0: 66 66 32 2b 24 6c 65 6e 32 2d 31 5d 5d 0a 0a 20 ff2+$len2-1]]..
d3b0: 20 20 20 73 65 74 20 6a 20 30 0a 0a 20 20 20 20 set j 0..
d3c0: 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 23 20 69 while {1} {..# i
d3d0: 6e 63 72 65 61 73 65 20 73 69 7a 65 20 6f 66 20 ncrease size of
d3e0: 6d 61 74 63 68 69 6e 67 20 73 6e 69 70 70 65 74 matching snippet
d3f0: 0a 09 77 68 69 6c 65 20 7b 24 73 6e 69 70 70 65 ..while {$snippe
d400: 74 6c 65 6e 20 3c 20 24 6c 65 6e 32 2d 24 6a 7d tlen < $len2-$j}
d410: 20 7b 0a 09 20 20 20 20 73 65 74 20 74 6d 70 20 {.. set tmp
d420: 22 24 73 6e 69 70 70 65 74 5b 73 74 72 69 6e 67 "$snippet[string
d430: 20 69 6e 64 65 78 20 24 73 32 20 5b 65 78 70 72 index $s2 [expr
d440: 20 24 6a 2b 24 73 6e 69 70 70 65 74 6c 65 6e 5d $j+$snippetlen]
d450: 5d 22 0a 09 20 20 20 20 69 66 20 7b 5b 73 74 72 ]".. if {[str
d460: 69 6e 67 20 66 69 72 73 74 20 24 74 6d 70 20 24 ing first $tmp $
d470: 73 31 5d 20 3d 3d 20 2d 31 7d 20 7b 0a 09 09 62 s1] == -1} {...b
d480: 72 65 61 6b 0a 09 20 20 20 20 7d 0a 09 20 20 20 reak.. }..
d490: 20 73 65 74 20 73 6e 69 70 70 65 74 20 24 74 6d set snippet $tm
d4a0: 70 0a 09 20 20 20 20 69 6e 63 72 20 73 6e 69 70 p.. incr snip
d4b0: 70 65 74 6c 65 6e 0a 09 7d 0a 09 69 66 20 7b 24 petlen..}..if {$
d4c0: 73 6e 69 70 70 65 74 6c 65 6e 20 3d 3d 20 30 7d snippetlen == 0}
d4d0: 20 7b 0a 09 20 20 20 20 23 20 6e 6f 74 68 69 6e {.. # nothin
d4e0: 67 20 73 74 61 72 74 69 6e 67 20 61 74 20 74 68 g starting at th
d4f0: 69 73 20 70 6f 73 69 74 69 6f 6e 0a 09 20 20 20 is position..
d500: 20 69 6e 63 72 20 6a 0a 09 20 20 20 20 69 66 20 incr j.. if
d510: 7b 24 73 6e 69 70 70 65 74 6c 65 6e 20 3e 3d 20 {$snippetlen >=
d520: 24 6c 65 6e 32 2d 24 6a 7d 20 7b 0a 09 09 62 72 $len2-$j} {...br
d530: 65 61 6b 0a 09 20 20 20 20 7d 0a 09 7d 20 65 6c eak.. }..} el
d540: 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 74 6d se {.. set tm
d550: 70 6f 66 66 20 5b 73 74 72 69 6e 67 20 66 69 72 poff [string fir
d560: 73 74 20 24 73 6e 69 70 70 65 74 20 24 73 31 5d st $snippet $s1]
d570: 0a 09 20 20 20 20 69 66 20 7b 24 74 6d 70 6f 66 .. if {$tmpof
d580: 66 20 21 3d 20 2d 31 20 26 26 20 24 73 6e 69 70 f != -1 && $snip
d590: 70 65 74 6c 65 6e 20 3e 20 24 6c 6f 6e 67 65 73 petlen > $longes
d5a0: 74 6c 65 6e 7d 20 7b 0a 09 09 23 20 6e 65 77 20 tlen} {...# new
d5b0: 6c 6f 6e 67 65 73 74 3f 0a 09 09 73 65 74 20 6c longest?...set l
d5c0: 6f 6e 67 65 73 74 20 24 73 6e 69 70 70 65 74 0a ongest $snippet.
d5d0: 09 09 73 65 74 20 6c 6f 6e 67 65 73 74 6c 65 6e ..set longestlen
d5e0: 20 24 73 6e 69 70 70 65 74 6c 65 6e 0a 09 09 73 $snippetlen...s
d5f0: 65 74 20 6c 63 73 6f 66 66 31 20 5b 65 78 70 72 et lcsoff1 [expr
d600: 20 24 6f 66 66 31 2b 24 74 6d 70 6f 66 66 5d 0a $off1+$tmpoff].
d610: 09 09 73 65 74 20 6c 63 73 6f 66 66 32 20 5b 65 ..set lcsoff2 [e
d620: 78 70 72 20 24 6f 66 66 32 2b 24 6a 5d 0a 09 20 xpr $off2+$j]..
d630: 20 20 20 7d 0a 09 20 20 20 20 23 20 64 72 6f 70 }.. # drop
d640: 20 31 73 74 20 63 68 61 72 20 6f 66 20 70 72 65 1st char of pre
d650: 66 69 78 2c 20 62 75 74 20 6b 65 65 70 20 73 69 fix, but keep si
d660: 7a 65 20 74 68 65 20 73 61 6d 65 20 61 73 20 6c ze the same as l
d670: 6f 6e 67 65 73 74 0a 09 20 20 20 20 69 66 20 7b ongest.. if {
d680: 24 73 6e 69 70 70 65 74 6c 65 6e 20 3e 3d 20 24 $snippetlen >= $
d690: 6c 65 6e 32 2d 24 6a 7d 20 7b 0a 09 09 62 72 65 len2-$j} {...bre
d6a0: 61 6b 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 73 ak.. }.. s
d6b0: 65 74 20 73 6e 69 70 70 65 74 20 22 5b 73 74 72 et snippet "[str
d6c0: 69 6e 67 20 72 61 6e 67 65 20 24 73 6e 69 70 70 ing range $snipp
d6d0: 65 74 20 31 20 65 6e 64 5d 5b 73 74 72 69 6e 67 et 1 end][string
d6e0: 20 69 6e 64 65 78 20 24 73 32 20 5c 0a 09 20 20 index $s2 \..
d6f0: 20 20 20 20 5b 65 78 70 72 20 24 6a 2b 24 73 6e [expr $j+$sn
d700: 69 70 70 65 74 6c 65 6e 5d 5d 22 0a 09 20 20 20 ippetlen]]"..
d710: 20 69 6e 63 72 20 6a 0a 09 7d 0a 20 20 20 20 7d incr j..}. }
d720: 0a 20 20 20 20 72 65 74 75 72 6e 20 24 6c 6f 6e . return $lon
d730: 67 65 73 74 6c 65 6e 0a 7d 0a 0a 70 72 6f 63 20 gestlen.}..proc
d740: 66 69 64 2d 72 61 74 63 6c 69 66 66 2d 61 75 78 fid-ratcliff-aux
d750: 20 7b 70 6f 73 20 6c 31 20 6c 32 20 73 31 20 6f {pos l1 l2 s1 o
d760: 66 66 31 20 6c 65 6e 31 20 73 32 20 6f 66 66 32 ff1 len1 s2 off2
d770: 20 6c 65 6e 32 7d 20 7b 0a 20 20 20 20 67 6c 6f len2} {. glo
d780: 62 61 6c 20 67 0a 0a 20 20 20 20 69 66 20 7b 24 bal g.. if {$
d790: 6c 65 6e 31 20 3c 3d 20 30 20 7c 7c 20 24 6c 65 len1 <= 0 || $le
d7a0: 6e 32 20 3c 3d 20 30 7d 20 7b 0a 09 69 66 20 7b n2 <= 0} {..if {
d7b0: 24 6c 65 6e 31 20 3d 3d 20 30 7d 20 7b 0a 09 20 $len1 == 0} {..
d7c0: 20 20 20 73 65 74 20 67 28 73 63 72 69 6e 6c 69 set g(scrinli
d7d0: 6e 65 2c 24 70 6f 73 2c 24 67 28 73 63 72 69 6e ne,$pos,$g(scrin
d7e0: 6c 69 6e 65 2c 24 70 6f 73 29 29 20 5b 6c 69 73 line,$pos)) [lis
d7f0: 74 20 72 20 24 6c 32 20 24 6f 66 66 32 20 5c 0a t r $l2 $off2 \.
d800: 09 20 20 20 20 20 20 5b 65 78 70 72 20 24 6f 66 . [expr $of
d810: 66 32 2b 24 6c 65 6e 32 5d 5d 0a 09 20 20 20 20 f2+$len2]]..
d820: 69 6e 63 72 20 67 28 73 63 72 69 6e 6c 69 6e 65 incr g(scrinline
d830: 2c 24 70 6f 73 29 0a 09 7d 20 65 6c 73 65 69 66 ,$pos)..} elseif
d840: 20 7b 24 6c 65 6e 32 20 3d 3d 20 30 7d 20 7b 0a {$len2 == 0} {.
d850: 09 20 20 20 20 73 65 74 20 67 28 73 63 72 69 6e . set g(scrin
d860: 6c 69 6e 65 2c 24 70 6f 73 2c 24 67 28 73 63 72 line,$pos,$g(scr
d870: 69 6e 6c 69 6e 65 2c 24 70 6f 73 29 29 20 5b 6c inline,$pos)) [l
d880: 69 73 74 20 6c 20 24 6c 31 20 24 6f 66 66 31 20 ist l $l1 $off1
d890: 5c 0a 09 20 20 20 20 20 20 5b 65 78 70 72 20 24 \.. [expr $
d8a0: 6f 66 66 31 2b 24 6c 65 6e 31 5d 5d 0a 09 20 20 off1+$len1]]..
d8b0: 20 20 69 6e 63 72 20 67 28 73 63 72 69 6e 6c 69 incr g(scrinli
d8c0: 6e 65 2c 24 70 6f 73 29 0a 09 7d 0a 09 72 65 74 ne,$pos)..}..ret
d8d0: 75 72 6e 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 urn 0. }.
d8e0: 73 65 74 20 63 6e 74 20 30 0a 20 20 20 20 73 65 set cnt 0. se
d8f0: 74 20 6c 63 73 6f 66 66 31 20 2d 31 0a 20 20 20 t lcsoff1 -1.
d900: 20 73 65 74 20 6c 63 73 6f 66 66 32 20 2d 31 0a set lcsoff2 -1.
d910: 0a 20 20 20 20 73 65 74 20 72 65 74 20 5b 6c 6f . set ret [lo
d920: 6e 67 65 73 74 2d 63 6f 6d 6d 6f 6e 2d 73 75 62 ngest-common-sub
d930: 73 74 72 69 6e 67 20 24 73 31 20 24 6f 66 66 31 string $s1 $off1
d940: 20 24 6c 65 6e 31 20 24 73 32 20 24 6f 66 66 32 $len1 $s2 $off2
d950: 20 24 6c 65 6e 32 20 6c 63 73 6f 66 66 31 20 5c $len2 lcsoff1 \
d960: 0a 20 20 20 20 20 20 6c 63 73 6f 66 66 32 5d 0a . lcsoff2].
d970: 0a 0a 20 20 20 20 69 66 20 7b 24 72 65 74 20 3e .. if {$ret >
d980: 20 30 7d 20 7b 0a 09 73 65 74 20 72 69 67 68 74 0} {..set right
d990: 6f 66 66 31 20 5b 65 78 70 72 20 24 6c 63 73 6f off1 [expr $lcso
d9a0: 66 66 31 2b 24 72 65 74 5d 0a 09 73 65 74 20 72 ff1+$ret]..set r
d9b0: 69 67 68 74 6f 66 66 32 20 5b 65 78 70 72 20 24 ightoff2 [expr $
d9c0: 6c 63 73 6f 66 66 32 2b 24 72 65 74 5d 0a 0a 09 lcsoff2+$ret]...
d9d0: 69 6e 63 72 20 63 6e 74 20 5b 65 78 70 72 20 32 incr cnt [expr 2
d9e0: 2a 24 72 65 74 5d 0a 09 69 66 20 7b 24 6c 63 73 *$ret]..if {$lcs
d9f0: 6f 66 66 31 20 3e 20 24 6f 66 66 31 20 7c 7c 20 off1 > $off1 ||
da00: 24 6c 63 73 6f 66 66 32 20 3e 20 24 6f 66 66 32 $lcsoff2 > $off2
da10: 7d 20 7b 0a 09 20 20 20 20 23 20 6c 65 66 74 0a } {.. # left.
da20: 09 20 20 20 20 69 6e 63 72 20 63 6e 74 20 5b 66 . incr cnt [f
da30: 69 64 2d 72 61 74 63 6c 69 66 66 2d 61 75 78 20 id-ratcliff-aux
da40: 24 70 6f 73 20 24 6c 31 20 24 6c 32 20 24 73 31 $pos $l1 $l2 $s1
da50: 20 24 6f 66 66 31 20 5c 0a 09 20 20 20 20 20 20 $off1 \..
da60: 5b 65 78 70 72 20 24 6c 63 73 6f 66 66 31 2d 24 [expr $lcsoff1-$
da70: 6f 66 66 31 5d 20 24 73 32 20 24 6f 66 66 32 20 off1] $s2 $off2
da80: 5b 65 78 70 72 20 24 6c 63 73 6f 66 66 32 2d 24 [expr $lcsoff2-$
da90: 6f 66 66 32 5d 5d 0a 0a 09 7d 0a 09 69 66 20 7b off2]]...}..if {
daa0: 24 72 69 67 68 74 6f 66 66 31 3c 24 6f 66 66 31 $rightoff1<$off1
dab0: 2b 24 6c 65 6e 31 20 7c 7c 20 24 72 69 67 68 74 +$len1 || $right
dac0: 6f 66 66 32 3c 24 6f 66 66 32 2b 24 6c 65 6e 32 off2<$off2+$len2
dad0: 7d 20 7b 0a 09 20 20 20 20 23 20 72 69 67 68 74 } {.. # right
dae0: 0a 09 20 20 20 20 69 6e 63 72 20 63 6e 74 20 5b .. incr cnt [
daf0: 66 69 64 2d 72 61 74 63 6c 69 66 66 2d 61 75 78 fid-ratcliff-aux
db00: 20 24 70 6f 73 20 24 6c 31 20 24 6c 32 20 24 73 $pos $l1 $l2 $s
db10: 31 20 24 72 69 67 68 74 6f 66 66 31 20 5c 0a 09 1 $rightoff1 \..
db20: 20 20 20 20 20 20 5b 65 78 70 72 20 24 6f 66 66 [expr $off
db30: 31 2b 24 6c 65 6e 31 2d 24 72 69 67 68 74 6f 66 1+$len1-$rightof
db40: 66 31 5d 20 24 73 32 20 24 72 69 67 68 74 6f 66 f1] $s2 $rightof
db50: 66 32 20 5c 0a 09 20 20 20 20 20 20 5b 65 78 70 f2 \.. [exp
db60: 72 20 24 6f 66 66 32 2b 24 6c 65 6e 32 2d 24 72 r $off2+$len2-$r
db70: 69 67 68 74 6f 66 66 32 5d 5d 0a 09 7d 0a 20 20 ightoff2]]..}.
db80: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 } else {..set
db90: 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 g(scrinline,$pos
dba0: 2c 24 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 ,$g(scrinline,$p
dbb0: 6f 73 29 29 20 5b 6c 69 73 74 20 72 20 24 6c 32 os)) [list r $l2
dbc0: 20 24 6f 66 66 32 20 5c 0a 09 20 20 5b 65 78 70 $off2 \.. [exp
dbd0: 72 20 24 6f 66 66 32 2b 24 6c 65 6e 32 5d 5d 0a r $off2+$len2]].
dbe0: 09 69 6e 63 72 20 67 28 73 63 72 69 6e 6c 69 6e .incr g(scrinlin
dbf0: 65 2c 24 70 6f 73 29 0a 09 73 65 74 20 67 28 73 e,$pos)..set g(s
dc00: 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 2c 24 67 crinline,$pos,$g
dc10: 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 29 (scrinline,$pos)
dc20: 29 20 5b 6c 69 73 74 20 6c 20 24 6c 31 20 24 6f ) [list l $l1 $o
dc30: 66 66 31 20 5c 0a 09 20 20 5b 65 78 70 72 20 24 ff1 \.. [expr $
dc40: 6f 66 66 31 2b 24 6c 65 6e 31 5d 5d 0a 09 69 6e off1+$len1]]..in
dc50: 63 72 20 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 cr g(scrinline,$
dc60: 70 6f 73 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 pos). }. r
dc70: 65 74 75 72 6e 20 24 63 6e 74 0a 7d 0a 0a 70 72 eturn $cnt.}..pr
dc80: 6f 63 20 66 69 6e 64 2d 69 6e 6c 69 6e 65 2d 64 oc find-inline-d
dc90: 69 66 66 2d 72 61 74 63 6c 69 66 66 20 7b 70 6f iff-ratcliff {po
dca0: 73 20 6c 31 20 6c 32 20 73 31 20 73 32 7d 20 7b s l1 l2 s1 s2} {
dcb0: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 0a 20 . global g..
dcc0: 20 20 20 73 65 74 20 6c 65 6e 31 20 5b 73 74 72 set len1 [str
dcd0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 31 5d 0a ing length $s1].
dce0: 20 20 20 20 73 65 74 20 6c 65 6e 32 20 5b 73 74 set len2 [st
dcf0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 32 5d ring length $s2]
dd00: 0a 20 20 20 20 69 66 20 7b 24 6c 65 6e 31 20 3d . if {$len1 =
dd10: 3d 20 30 20 7c 7c 20 24 6c 65 6e 32 20 3d 3d 20 = 0 || $len2 ==
dd20: 30 7d 20 7b 0a 09 72 65 74 75 72 6e 20 30 0a 20 0} {..return 0.
dd30: 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 }. return
dd40: 5b 66 69 64 2d 72 61 74 63 6c 69 66 66 2d 61 75 [fid-ratcliff-au
dd50: 78 20 24 70 6f 73 20 24 6c 31 20 24 6c 32 20 24 x $pos $l1 $l2 $
dd60: 73 31 20 30 20 24 6c 65 6e 31 20 24 73 32 20 30 s1 0 $len1 $s2 0
dd70: 20 24 6c 65 6e 32 5d 0a 7d 0a 0a 70 72 6f 63 20 $len2].}..proc
dd80: 66 69 6e 64 2d 69 6e 6c 69 6e 65 2d 64 69 66 66 find-inline-diff
dd90: 2d 62 79 74 65 20 7b 70 6f 73 20 6c 31 20 6c 32 -byte {pos l1 l2
dda0: 20 73 31 20 73 32 7d 20 7b 0a 20 20 20 20 67 6c s1 s2} {. gl
ddb0: 6f 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 20 obal g.. set
ddc0: 6c 65 6e 31 20 5b 73 74 72 69 6e 67 20 6c 65 6e len1 [string len
ddd0: 67 74 68 20 24 73 31 5d 0a 20 20 20 20 73 65 74 gth $s1]. set
dde0: 20 6c 65 6e 32 20 5b 73 74 72 69 6e 67 20 6c 65 len2 [string le
ddf0: 6e 67 74 68 20 24 73 32 5d 0a 20 20 20 20 69 66 ngth $s2]. if
de00: 20 7b 24 6c 65 6e 31 20 3d 3d 20 30 20 7c 7c 20 {$len1 == 0 ||
de10: 24 6c 65 6e 32 20 3d 3d 20 30 7d 20 7b 0a 09 72 $len2 == 0} {..r
de20: 65 74 75 72 6e 20 30 0a 20 20 20 20 7d 0a 0a 20 eturn 0. }..
de30: 20 20 20 73 65 74 20 63 6e 74 20 30 0a 0a 20 20 set cnt 0..
de40: 20 20 73 65 74 20 6c 65 6e 6d 69 6e 20 5b 6d 69 set lenmin [mi
de50: 6e 20 24 6c 65 6e 31 20 24 6c 65 6e 32 5d 0a 20 n $len1 $len2].
de60: 20 20 20 73 65 74 20 73 69 7a 65 20 30 0a 20 20 set size 0.
de70: 20 20 66 6f 72 20 7b 73 65 74 20 69 20 30 7d 20 for {set i 0}
de80: 7b 24 69 20 3c 20 24 6c 65 6e 6d 69 6e 7d 20 7b {$i < $lenmin} {
de90: 69 6e 63 72 20 69 7d 20 7b 0a 09 69 66 20 7b 24 incr i} {..if {$
dea0: 73 69 7a 65 20 3e 20 30 7d 20 7b 0a 09 20 20 20 size > 0} {..
deb0: 20 23 20 69 6e 20 61 20 64 69 66 66 20 73 65 63 # in a diff sec
dec0: 74 69 6f 6e 0a 09 20 20 20 20 69 66 20 7b 5b 73 tion.. if {[s
ded0: 74 72 69 6e 67 20 69 6e 64 65 78 20 24 73 31 20 tring index $s1
dee0: 24 69 5d 20 3d 3d 20 5b 73 74 72 69 6e 67 20 69 $i] == [string i
def0: 6e 64 65 78 20 24 73 32 20 24 69 5d 7d 20 7b 0a ndex $s2 $i]} {.
df00: 09 09 23 20 65 6e 64 20 6f 66 20 64 69 66 66 20 ..# end of diff
df10: 72 65 67 69 6f 6e 0a 09 09 73 65 74 20 67 28 73 region...set g(s
df20: 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 2c 24 67 crinline,$pos,$g
df30: 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 29 (scrinline,$pos)
df40: 29 20 5b 6c 69 73 74 20 72 20 24 6c 32 20 5c 0a ) [list r $l2 \.
df50: 09 09 20 20 5b 65 78 70 72 20 24 69 2d 24 73 69 .. [expr $i-$si
df60: 7a 65 5d 20 24 69 5d 0a 09 09 69 6e 63 72 20 67 ze] $i]...incr g
df70: 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 29 (scrinline,$pos)
df80: 0a 09 09 73 65 74 20 67 28 73 63 72 69 6e 6c 69 ...set g(scrinli
df90: 6e 65 2c 24 70 6f 73 2c 24 67 28 73 63 72 69 6e ne,$pos,$g(scrin
dfa0: 6c 69 6e 65 2c 24 70 6f 73 29 29 20 5b 6c 69 73 line,$pos)) [lis
dfb0: 74 20 6c 20 24 6c 31 20 5c 0a 09 09 20 20 5b 65 t l $l1 \... [e
dfc0: 78 70 72 20 24 69 2d 24 73 69 7a 65 5d 20 24 69 xpr $i-$size] $i
dfd0: 5d 0a 09 09 69 6e 63 72 20 67 28 73 63 72 69 6e ]...incr g(scrin
dfe0: 6c 69 6e 65 2c 24 70 6f 73 29 0a 09 09 73 65 74 line,$pos)...set
dff0: 20 73 69 7a 65 20 30 0a 09 09 69 6e 63 72 20 63 size 0...incr c
e000: 6e 74 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b nt.. } else {
e010: 0a 09 09 69 6e 63 72 20 73 69 7a 65 0a 09 20 20 ...incr size..
e020: 20 20 7d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 }..} else {..
e030: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 if {[string i
e040: 6e 64 65 78 20 24 73 31 20 24 69 5d 20 21 3d 20 ndex $s1 $i] !=
e050: 5b 73 74 72 69 6e 67 20 69 6e 64 65 78 20 24 73 [string index $s
e060: 32 20 24 69 5d 7d 20 7b 0a 09 09 73 65 74 20 73 2 $i]} {...set s
e070: 69 7a 65 20 31 0a 09 20 20 20 20 7d 0a 09 7d 0a ize 1.. }..}.
e080: 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 24 73 }. if {$s
e090: 69 7a 65 20 3e 20 30 7d 20 7b 0a 09 23 20 65 6e ize > 0} {..# en
e0a0: 64 20 6f 66 20 64 69 66 66 20 72 65 67 69 6f 6e d of diff region
e0b0: 0a 09 73 65 74 20 67 28 73 63 72 69 6e 6c 69 6e ..set g(scrinlin
e0c0: 65 2c 24 70 6f 73 2c 24 67 28 73 63 72 69 6e 6c e,$pos,$g(scrinl
e0d0: 69 6e 65 2c 24 70 6f 73 29 29 20 5b 6c 69 73 74 ine,$pos)) [list
e0e0: 20 72 20 24 6c 32 20 5b 65 78 70 72 20 24 69 2d r $l2 [expr $i-
e0f0: 24 73 69 7a 65 5d 20 5c 0a 09 20 20 24 6c 65 6e $size] \.. $len
e100: 32 5d 0a 09 69 6e 63 72 20 67 28 73 63 72 69 6e 2]..incr g(scrin
e110: 6c 69 6e 65 2c 24 70 6f 73 29 0a 09 73 65 74 20 line,$pos)..set
e120: 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 g(scrinline,$pos
e130: 2c 24 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 ,$g(scrinline,$p
e140: 6f 73 29 29 20 5b 6c 69 73 74 20 6c 20 24 6c 31 os)) [list l $l1
e150: 20 5b 65 78 70 72 20 24 69 2d 24 73 69 7a 65 5d [expr $i-$size]
e160: 20 5c 0a 09 20 20 24 6c 65 6e 31 5d 0a 09 69 6e \.. $len1]..in
e170: 63 72 20 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 cr g(scrinline,$
e180: 70 6f 73 29 0a 09 69 6e 63 72 20 63 6e 74 0a 20 pos)..incr cnt.
e190: 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 }. return
e1a0: 24 63 6e 74 0a 7d 0a 0a 23 23 23 23 23 23 23 23 $cnt.}..########
e1b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e1c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e1d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e1e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e1f0: 23 23 23 23 23 23 23 0a 23 20 74 68 65 20 66 6f #######.# the fo
e200: 6c 6c 6f 77 69 6e 67 20 63 6f 64 65 20 69 73 20 llowing code is
e210: 75 73 65 64 20 61 73 20 74 68 65 20 72 65 70 6c used as the repl
e220: 61 63 65 6d 65 6e 74 20 62 6f 64 79 20 66 6f 72 acement body for
e230: 20 74 68 65 20 6c 65 66 74 20 61 6e 64 0a 23 20 the left and.#
e240: 72 69 67 68 74 20 77 69 64 67 65 74 20 70 72 6f right widget pro
e250: 63 73 2e 20 54 68 65 20 70 75 72 70 6f 73 65 20 cs. The purpose
e260: 69 73 20 74 6f 20 63 61 74 63 68 20 77 68 65 6e is to catch when
e270: 20 74 68 65 20 69 6e 73 65 72 74 69 6f 6e 20 70 the insertion p
e280: 6f 69 6e 74 0a 23 20 63 68 61 6e 67 65 73 20 73 oint.# changes s
e290: 6f 20 77 65 20 63 61 6e 20 75 70 64 61 74 65 20 o we can update
e2a0: 74 68 65 20 6c 69 6e 65 20 63 6f 6d 70 61 72 69 the line compari
e2b0: 73 6f 6e 20 77 69 6e 64 6f 77 0a 23 23 23 23 23 son window.#####
e2c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e2d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e2e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e2f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e300: 23 23 23 23 23 23 23 23 23 23 0a 0a 73 65 74 20 ##########..set
e310: 74 65 78 74 5f 77 69 64 67 65 74 5f 70 72 6f 63 text_widget_proc
e320: 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a {. global w.
e330: 20 20 20 20 73 65 74 20 72 65 61 6c 20 22 5b 6c set real "[l
e340: 69 6e 64 65 78 20 5b 69 6e 66 6f 20 6c 65 76 65 index [info leve
e350: 6c 20 5b 69 6e 66 6f 20 6c 65 76 65 6c 5d 5d 20 l [info level]]
e360: 30 5d 5f 22 0a 20 20 20 20 73 65 74 20 72 65 73 0]_". set res
e370: 75 6c 74 20 5b 65 76 61 6c 20 24 72 65 61 6c 20 ult [eval $real
e380: 24 63 6f 6d 6d 61 6e 64 20 24 61 72 67 73 5d 0a $command $args].
e390: 20 20 20 20 69 66 20 7b 24 63 6f 6d 6d 61 6e 64 if {$command
e3a0: 20 3d 3d 20 22 6d 61 72 6b 22 7d 20 7b 0a 09 69 == "mark"} {..i
e3b0: 66 20 7b 5b 6c 69 6e 64 65 78 20 24 61 72 67 73 f {[lindex $args
e3c0: 20 30 5d 20 3d 3d 20 22 73 65 74 22 20 26 26 20 0] == "set" &&
e3d0: 5b 6c 69 6e 64 65 78 20 24 61 72 67 73 20 31 5d [lindex $args 1]
e3e0: 20 3d 3d 20 22 69 6e 73 65 72 74 22 7d 20 7b 0a == "insert"} {.
e3f0: 09 20 20 20 20 73 65 74 20 69 20 5b 6c 69 6e 64 . set i [lind
e400: 65 78 20 24 61 72 67 73 20 32 5d 0a 09 20 20 20 ex $args 2]..
e410: 20 73 65 74 20 69 30 20 22 24 69 20 6c 69 6e 65 set i0 "$i line
e420: 73 74 61 72 74 22 0a 09 20 20 20 20 73 65 74 20 start".. set
e430: 69 31 20 22 24 69 20 6c 69 6e 65 65 6e 64 22 0a i1 "$i lineend".
e440: 09 20 20 20 20 73 65 74 20 6c 65 66 74 20 5b 24 . set left [$
e450: 77 28 4c 65 66 74 54 65 78 74 29 5f 20 67 65 74 w(LeftText)_ get
e460: 20 24 69 30 20 24 69 31 5d 0a 09 20 20 20 20 73 $i0 $i1].. s
e470: 65 74 20 72 69 67 68 74 20 5b 24 77 28 52 69 67 et right [$w(Rig
e480: 68 74 54 65 78 74 29 5f 20 67 65 74 20 24 69 30 htText)_ get $i0
e490: 20 24 69 31 5d 0a 09 20 20 20 20 24 77 28 42 6f $i1].. $w(Bo
e4a0: 74 74 6f 6d 54 65 78 74 29 20 64 65 6c 65 74 65 ttomText) delete
e4b0: 20 31 2e 30 20 65 6e 64 0a 09 20 20 20 20 24 77 1.0 end.. $w
e4c0: 28 42 6f 74 74 6f 6d 54 65 78 74 29 20 69 6e 73 (BottomText) ins
e4d0: 65 72 74 20 65 6e 64 20 22 3c 20 24 6c 65 66 74 ert end "< $left
e4e0: 5c 6e 3e 20 24 72 69 67 68 74 22 0a 09 20 20 20 \n> $right"..
e4f0: 20 23 20 66 69 6e 64 20 63 68 61 72 61 63 74 65 # find characte
e500: 72 73 20 74 68 61 74 20 61 72 65 20 64 69 66 66 rs that are diff
e510: 65 72 65 6e 74 2c 20 61 6e 64 20 75 6e 64 65 72 erent, and under
e520: 6c 69 6e 65 20 74 68 65 6d 0a 09 20 20 20 20 69 line them.. i
e530: 66 20 7b 24 6c 65 66 74 20 21 3d 20 24 72 69 67 f {$left != $rig
e540: 68 74 7d 20 7b 0a 09 09 73 65 74 20 6c 65 66 74 ht} {...set left
e550: 20 5b 73 70 6c 69 74 20 24 6c 65 66 74 20 7b 7d [split $left {}
e560: 5d 0a 09 09 73 65 74 20 72 69 67 68 74 20 5b 73 ]...set right [s
e570: 70 6c 69 74 20 24 72 69 67 68 74 20 7b 7d 5d 0a plit $right {}].
e580: 09 09 23 20 6e 2e 62 2e 20 77 65 20 73 65 74 20 ..# n.b. we set
e590: 63 20 74 6f 20 61 6e 20 6f 66 66 73 65 74 20 65 c to an offset e
e5a0: 71 75 61 6c 20 74 6f 20 77 68 61 74 65 76 65 72 qual to whatever
e5b0: 20 77 65 20 68 61 76 65 0a 09 09 23 20 70 72 65 we have...# pre
e5c0: 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 64 61 pended to the da
e5d0: 74 61 2e 2e 2e 0a 09 09 73 65 74 20 63 20 32 0a ta......set c 2.
e5e0: 09 09 66 6f 72 65 61 63 68 20 6c 20 24 6c 65 66 ..foreach l $lef
e5f0: 74 20 72 20 24 72 69 67 68 74 20 7b 0a 09 09 20 t r $right {...
e600: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 63 if {[string c
e610: 6f 6d 70 61 72 65 20 24 6c 20 24 72 5d 20 21 3d ompare $l $r] !=
e620: 20 30 7d 20 7b 0a 09 09 20 20 20 20 20 20 20 20 0} {...
e630: 24 77 28 42 6f 74 74 6f 6d 54 65 78 74 29 20 74 $w(BottomText) t
e640: 61 67 20 61 64 64 20 64 69 66 66 20 31 2e 24 63 ag add diff 1.$c
e650: 20 22 31 2e 24 63 2b 31 63 22 0a 09 09 20 20 20 "1.$c+1c"...
e660: 20 20 20 20 20 24 77 28 42 6f 74 74 6f 6d 54 65 $w(BottomTe
e670: 78 74 29 20 74 61 67 20 61 64 64 20 64 69 66 66 xt) tag add diff
e680: 20 32 2e 24 63 20 22 32 2e 24 63 2b 31 63 22 0a 2.$c "2.$c+1c".
e690: 09 09 20 20 20 20 7d 0a 09 09 20 20 20 20 69 6e .. }... in
e6a0: 63 72 20 63 0a 09 09 7d 0a 09 09 24 77 28 42 6f cr c...}...$w(Bo
e6b0: 74 74 6f 6d 54 65 78 74 29 20 74 61 67 20 72 65 ttomText) tag re
e6c0: 6d 6f 76 65 20 64 69 66 66 20 22 31 2e 30 20 6c move diff "1.0 l
e6d0: 69 6e 65 65 6e 64 22 0a 09 09 24 77 28 42 6f 74 ineend"...$w(Bot
e6e0: 74 6f 6d 54 65 78 74 29 20 74 61 67 20 72 65 6d tomText) tag rem
e6f0: 6f 76 65 20 64 69 66 66 20 22 32 2e 30 20 6c 69 ove diff "2.0 li
e700: 6e 65 65 6e 64 22 0a 09 20 20 20 20 7d 0a 09 7d neend".. }..}
e710: 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 . }. retur
e720: 6e 20 24 72 65 73 75 6c 74 0a 7d 0a 0a 23 23 23 n $result.}..###
e730: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e750: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e760: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e770: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 63 ############.# c
e780: 72 65 61 74 65 20 28 69 66 20 6e 65 63 65 73 73 reate (if necess
e790: 61 72 79 29 20 61 6e 64 20 73 68 6f 77 20 74 68 ary) and show th
e7a0: 65 20 66 69 6e 64 20 64 69 61 6c 6f 67 0a 23 23 e find dialog.##
e7b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e7c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e7d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e7e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
e7f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
e800: 6f 63 20 73 68 6f 77 2d 66 69 6e 64 20 7b 7d 20 oc show-find {}
e810: 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f {. debug-info
e820: 20 22 73 68 6f 77 2d 66 69 6e 64 22 0a 20 20 20 "show-find".
e830: 20 67 6c 6f 62 61 6c 20 77 20 67 0a 20 20 20 20 global w g.
e840: 67 6c 6f 62 61 6c 20 74 63 6c 5f 70 6c 61 74 66 global tcl_platf
e850: 6f 72 6d 0a 0a 20 20 20 20 69 66 20 7b 21 5b 77 orm.. if {![w
e860: 69 6e 66 6f 20 65 78 69 73 74 73 20 24 77 28 66 info exists $w(f
e870: 69 6e 64 44 69 61 6c 6f 67 29 5d 7d 20 7b 0a 09 indDialog)]} {..
e880: 74 6f 70 6c 65 76 65 6c 20 24 77 28 66 69 6e 64 toplevel $w(find
e890: 44 69 61 6c 6f 67 29 0a 09 77 6d 20 67 72 6f 75 Dialog)..wm grou
e8a0: 70 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 p $w(findDialog)
e8b0: 20 2e 0a 09 77 6d 20 74 72 61 6e 73 69 65 6e 74 ...wm transient
e8c0: 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 20 $w(findDialog)
e8d0: 2e 0a 09 77 6d 20 74 69 74 6c 65 20 24 77 28 66 ...wm title $w(f
e8e0: 69 6e 64 44 69 61 6c 6f 67 29 20 22 24 67 28 6e indDialog) "$g(n
e8f0: 61 6d 65 29 20 46 69 6e 64 22 0a 0a 09 69 66 20 ame) Find"...if
e900: 7b 24 67 28 77 69 6e 64 6f 77 69 6e 67 53 79 73 {$g(windowingSys
e910: 74 65 6d 29 20 3d 3d 20 22 61 71 75 61 22 7d 20 tem) == "aqua"}
e920: 7b 0a 09 20 20 20 20 73 65 74 41 71 75 61 44 69 {.. setAquaDi
e930: 61 6c 6f 67 53 74 79 6c 65 20 24 77 28 66 69 6e alogStyle $w(fin
e940: 64 44 69 61 6c 6f 67 29 0a 09 7d 0a 0a 09 23 20 dDialog)..}...#
e950: 77 65 20 64 6f 6e 27 74 20 77 61 6e 74 20 74 68 we don't want th
e960: 65 20 77 69 6e 64 6f 77 20 74 6f 20 62 65 20 64 e window to be d
e970: 65 6c 65 74 65 64 2c 20 6a 75 73 74 20 68 69 64 eleted, just hid
e980: 64 65 6e 20 66 72 6f 6d 20 76 69 65 77 0a 09 77 den from view..w
e990: 6d 20 70 72 6f 74 6f 63 6f 6c 20 24 77 28 66 69 m protocol $w(fi
e9a0: 6e 64 44 69 61 6c 6f 67 29 20 57 4d 5f 44 45 4c ndDialog) WM_DEL
e9b0: 45 54 45 5f 57 49 4e 44 4f 57 20 5b 6c 69 73 74 ETE_WINDOW [list
e9c0: 20 77 6d 20 77 69 74 68 64 72 61 77 20 5c 0a 09 wm withdraw \..
e9d0: 20 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 $w(findDialog)
e9e0: 5d 0a 0a 09 77 6d 20 77 69 74 68 64 72 61 77 20 ]...wm withdraw
e9f0: 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 0a 09 $w(findDialog)..
ea00: 75 70 64 61 74 65 20 69 64 6c 65 74 61 73 6b 73 update idletasks
ea10: 0a 0a 09 66 72 61 6d 65 20 24 77 28 66 69 6e 64 ...frame $w(find
ea20: 44 69 61 6c 6f 67 29 2e 63 6f 6e 74 65 6e 74 20 Dialog).content
ea30: 2d 62 64 20 32 20 2d 72 65 6c 69 65 66 20 67 72 -bd 2 -relief gr
ea40: 6f 6f 76 65 0a 09 70 61 63 6b 20 24 77 28 66 69 oove..pack $w(fi
ea50: 6e 64 44 69 61 6c 6f 67 29 2e 63 6f 6e 74 65 6e ndDialog).conten
ea60: 74 20 2d 73 69 64 65 20 74 6f 70 20 2d 66 69 6c t -side top -fil
ea70: 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 l both -expand y
ea80: 20 2d 70 61 64 78 20 30 20 5c 0a 09 20 20 2d 70 -padx 0 \.. -p
ea90: 61 64 79 20 35 0a 0a 09 66 72 61 6d 65 20 24 77 ady 5...frame $w
eaa0: 28 66 69 6e 64 44 69 61 6c 6f 67 29 2e 62 75 74 (findDialog).but
eab0: 74 6f 6e 73 0a 09 70 61 63 6b 20 24 77 28 66 69 tons..pack $w(fi
eac0: 6e 64 44 69 61 6c 6f 67 29 2e 62 75 74 74 6f 6e ndDialog).button
ead0: 73 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d s -side bottom -
eae0: 66 69 6c 6c 20 78 20 2d 65 78 70 61 6e 64 20 6e fill x -expand n
eaf0: 0a 0a 09 62 75 74 74 6f 6e 20 24 77 28 66 69 6e ...button $w(fin
eb00: 64 44 69 61 6c 6f 67 29 2e 62 75 74 74 6f 6e 73 dDialog).buttons
eb10: 2e 64 6f 69 74 20 2d 74 65 78 74 20 22 46 69 6e .doit -text "Fin
eb20: 64 20 4e 65 78 74 22 20 2d 63 6f 6d 6d 61 6e 64 d Next" -command
eb30: 20 64 6f 2d 66 69 6e 64 0a 09 62 75 74 74 6f 6e do-find..button
eb40: 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 2e $w(findDialog).
eb50: 62 75 74 74 6f 6e 73 2e 64 69 73 6d 69 73 73 20 buttons.dismiss
eb60: 2d 74 65 78 74 20 22 44 69 73 6d 69 73 73 22 20 -text "Dismiss"
eb70: 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 09 20 20 22 77 -command \.. "w
eb80: 6d 20 77 69 74 68 64 72 61 77 20 24 77 28 66 69 m withdraw $w(fi
eb90: 6e 64 44 69 61 6c 6f 67 29 22 0a 09 70 61 63 6b ndDialog)"..pack
eba0: 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 2e $w(findDialog).
ebb0: 62 75 74 74 6f 6e 73 2e 64 69 73 6d 69 73 73 20 buttons.dismiss
ebc0: 2d 73 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 -side right -pad
ebd0: 79 20 35 20 2d 70 61 64 78 20 30 0a 09 70 61 63 y 5 -padx 0..pac
ebe0: 6b 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 k $w(findDialog)
ebf0: 2e 62 75 74 74 6f 6e 73 2e 64 6f 69 74 20 2d 73 .buttons.doit -s
ec00: 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 79 20 ide right -pady
ec10: 35 20 2d 70 61 64 78 20 31 0a 0a 09 73 65 74 20 5 -padx 1...set
ec20: 66 66 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 ff $w(findDialog
ec30: 29 2e 63 6f 6e 74 65 6e 74 2e 66 69 6e 64 46 72 ).content.findFr
ec40: 61 6d 65 0a 09 66 72 61 6d 65 20 24 66 66 20 2d ame..frame $ff -
ec50: 68 65 69 67 68 74 20 31 30 30 20 2d 62 64 20 32 height 100 -bd 2
ec60: 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 0a 09 70 -relief flat..p
ec70: 61 63 6b 20 24 66 66 20 2d 73 69 64 65 20 74 6f ack $ff -side to
ec80: 70 20 2d 66 69 6c 6c 20 78 20 2d 65 78 70 61 6e p -fill x -expan
ec90: 64 20 6e 20 2d 70 61 64 78 20 30 20 2d 70 61 64 d n -padx 0 -pad
eca0: 79 20 35 0a 0a 09 6c 61 62 65 6c 20 24 66 66 2e y 5...label $ff.
ecb0: 6c 61 62 65 6c 20 2d 74 65 78 74 20 22 46 69 6e label -text "Fin
ecc0: 64 20 77 68 61 74 3a 22 20 2d 75 6e 64 65 72 6c d what:" -underl
ecd0: 69 6e 65 20 32 0a 0a 09 65 6e 74 72 79 20 24 66 ine 2...entry $f
ece0: 66 2e 65 6e 74 72 79 20 2d 74 65 78 74 76 61 72 f.entry -textvar
ecf0: 69 61 62 6c 65 20 67 28 66 69 6e 64 53 74 72 69 iable g(findStri
ed00: 6e 67 29 0a 0a 09 63 68 65 63 6b 62 75 74 74 6f ng)...checkbutto
ed10: 6e 20 24 66 66 2e 73 65 61 72 63 68 43 61 73 65 n $ff.searchCase
ed20: 20 2d 74 65 78 74 20 22 49 67 6e 6f 72 65 20 43 -text "Ignore C
ed30: 61 73 65 22 20 2d 6f 66 66 76 61 6c 75 65 20 30 ase" -offvalue 0
ed40: 20 2d 6f 6e 76 61 6c 75 65 20 31 20 5c 0a 09 20 -onvalue 1 \..
ed50: 20 2d 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 -indicatoron tr
ed60: 75 65 20 2d 76 61 72 69 61 62 6c 65 20 67 28 66 ue -variable g(f
ed70: 69 6e 64 49 67 6e 6f 72 65 43 61 73 65 29 0a 0a indIgnoreCase)..
ed80: 09 67 72 69 64 20 24 66 66 2e 6c 61 62 65 6c 20 .grid $ff.label
ed90: 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 30 -row 0 -column 0
eda0: 20 2d 73 74 69 63 6b 79 20 65 0a 09 67 72 69 64 -sticky e..grid
edb0: 20 24 66 66 2e 65 6e 74 72 79 20 2d 72 6f 77 20 $ff.entry -row
edc0: 30 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 0 -column 1 -sti
edd0: 63 6b 79 20 65 77 0a 09 67 72 69 64 20 24 66 66 cky ew..grid $ff
ede0: 2e 73 65 61 72 63 68 43 61 73 65 20 2d 72 6f 77 .searchCase -row
edf0: 20 30 20 2d 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 0 -column 2 -st
ee00: 69 63 6b 79 20 77 0a 09 67 72 69 64 20 63 6f 6c icky w..grid col
ee10: 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 66 66 umnconfigure $ff
ee20: 20 30 20 2d 77 65 69 67 68 74 20 30 0a 09 67 72 0 -weight 0..gr
ee30: 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 id columnconfigu
ee40: 72 65 20 24 66 66 20 31 20 2d 77 65 69 67 68 74 re $ff 1 -weight
ee50: 20 31 0a 09 67 72 69 64 20 63 6f 6c 75 6d 6e 63 1..grid columnc
ee60: 6f 6e 66 69 67 75 72 65 20 24 66 66 20 32 20 2d onfigure $ff 2 -
ee70: 77 65 69 67 68 74 20 30 0a 0a 09 23 20 77 65 20 weight 0...# we
ee80: 6e 65 65 64 20 74 68 69 73 20 69 6e 20 6f 74 68 need this in oth
ee90: 65 72 20 70 6c 61 63 65 73 2e 2e 2e 0a 09 73 65 er places.....se
eea0: 74 20 77 28 66 69 6e 64 45 6e 74 72 79 29 20 24 t w(findEntry) $
eeb0: 66 66 2e 65 6e 74 72 79 0a 0a 09 62 69 6e 64 20 ff.entry...bind
eec0: 24 66 66 2e 65 6e 74 72 79 20 3c 52 65 74 75 72 $ff.entry <Retur
eed0: 6e 3e 20 64 6f 2d 66 69 6e 64 0a 0a 09 73 65 74 n> do-find...set
eee0: 20 6f 66 20 24 77 28 66 69 6e 64 44 69 61 6c 6f of $w(findDialo
eef0: 67 29 2e 63 6f 6e 74 65 6e 74 2e 6f 70 74 69 6f g).content.optio
ef00: 6e 73 46 72 61 6d 65 0a 09 66 72 61 6d 65 20 24 nsFrame..frame $
ef10: 6f 66 20 2d 62 64 20 32 20 2d 72 65 6c 69 65 66 of -bd 2 -relief
ef20: 20 66 6c 61 74 0a 09 70 61 63 6b 20 24 6f 66 20 flat..pack $of
ef30: 2d 73 69 64 65 20 74 6f 70 20 2d 66 69 6c 6c 20 -side top -fill
ef40: 79 20 2d 65 78 70 61 6e 64 20 79 20 2d 70 61 64 y -expand y -pad
ef50: 78 20 31 30 20 2d 70 61 64 79 20 31 30 0a 0a 09 x 10 -pady 10...
ef60: 6c 61 62 65 6c 20 24 6f 66 2e 64 69 72 65 63 74 label $of.direct
ef70: 69 6f 6e 4c 61 62 65 6c 20 2d 74 65 78 74 20 22 ionLabel -text "
ef80: 53 65 61 72 63 68 20 44 69 72 65 63 74 69 6f 6e Search Direction
ef90: 3a 22 20 2d 61 6e 63 68 6f 72 20 65 0a 09 72 61 :" -anchor e..ra
efa0: 64 69 6f 62 75 74 74 6f 6e 20 24 6f 66 2e 64 69 diobutton $of.di
efb0: 72 65 63 74 69 6f 6e 46 6f 72 77 61 72 64 20 2d rectionForward -
efc0: 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 75 65 indicatoron true
efd0: 20 2d 74 65 78 74 20 22 44 6f 77 6e 22 20 5c 0a -text "Down" \.
efe0: 09 20 20 2d 76 61 6c 75 65 20 22 2d 66 6f 72 77 . -value "-forw
eff0: 61 72 64 22 20 2d 76 61 72 69 61 62 6c 65 20 67 ard" -variable g
f000: 28 66 69 6e 64 44 69 72 65 63 74 69 6f 6e 29 0a (findDirection).
f010: 09 72 61 64 69 6f 62 75 74 74 6f 6e 20 24 6f 66 .radiobutton $of
f020: 2e 64 69 72 65 63 74 69 6f 6e 42 61 63 6b 77 61 .directionBackwa
f030: 72 64 20 2d 74 65 78 74 20 22 55 70 22 20 2d 76 rd -text "Up" -v
f040: 61 6c 75 65 20 22 2d 62 61 63 6b 77 61 72 64 22 alue "-backward"
f050: 20 5c 0a 09 20 20 2d 69 6e 64 69 63 61 74 6f 72 \.. -indicator
f060: 6f 6e 20 74 72 75 65 20 2d 76 61 72 69 61 62 6c on true -variabl
f070: 65 20 67 28 66 69 6e 64 44 69 72 65 63 74 69 6f e g(findDirectio
f080: 6e 29 0a 0a 0a 09 6c 61 62 65 6c 20 24 6f 66 2e n)....label $of.
f090: 77 69 6e 64 6f 77 4c 61 62 65 6c 20 2d 74 65 78 windowLabel -tex
f0a0: 74 20 22 57 69 6e 64 6f 77 3a 22 20 2d 61 6e 63 t "Window:" -anc
f0b0: 68 6f 72 20 65 0a 09 72 61 64 69 6f 62 75 74 74 hor e..radiobutt
f0c0: 6f 6e 20 24 6f 66 2e 77 69 6e 64 6f 77 4c 65 66 on $of.windowLef
f0d0: 74 20 2d 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 t -indicatoron t
f0e0: 72 75 65 20 2d 74 65 78 74 20 22 4c 65 66 74 22 rue -text "Left"
f0f0: 20 5c 0a 09 20 20 2d 76 61 6c 75 65 20 24 77 28 \.. -value $w(
f100: 4c 65 66 74 54 65 78 74 29 20 2d 76 61 72 69 61 LeftText) -varia
f110: 62 6c 65 20 67 28 61 63 74 69 76 65 57 69 6e 64 ble g(activeWind
f120: 6f 77 29 0a 09 72 61 64 69 6f 62 75 74 74 6f 6e ow)..radiobutton
f130: 20 24 6f 66 2e 77 69 6e 64 6f 77 52 69 67 68 74 $of.windowRight
f140: 20 2d 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 -indicatoron tr
f150: 75 65 20 2d 74 65 78 74 20 22 52 69 67 68 74 22 ue -text "Right"
f160: 20 5c 0a 09 20 20 2d 76 61 6c 75 65 20 24 77 28 \.. -value $w(
f170: 52 69 67 68 74 54 65 78 74 29 20 2d 76 61 72 69 RightText) -vari
f180: 61 62 6c 65 20 67 28 61 63 74 69 76 65 57 69 6e able g(activeWin
f190: 64 6f 77 29 0a 0a 0a 09 6c 61 62 65 6c 20 24 6f dow)....label $o
f1a0: 66 2e 73 65 61 72 63 68 4c 61 62 65 6c 20 2d 74 f.searchLabel -t
f1b0: 65 78 74 20 22 53 65 61 72 63 68 20 54 79 70 65 ext "Search Type
f1c0: 3a 22 20 2d 61 6e 63 68 6f 72 20 65 0a 09 72 61 :" -anchor e..ra
f1d0: 64 69 6f 62 75 74 74 6f 6e 20 24 6f 66 2e 73 65 diobutton $of.se
f1e0: 61 72 63 68 45 78 61 63 74 20 2d 69 6e 64 69 63 archExact -indic
f1f0: 61 74 6f 72 6f 6e 20 74 72 75 65 20 2d 74 65 78 atoron true -tex
f200: 74 20 22 45 78 61 63 74 22 20 5c 0a 09 20 20 2d t "Exact" \.. -
f210: 76 61 6c 75 65 20 22 2d 65 78 61 63 74 22 20 2d value "-exact" -
f220: 76 61 72 69 61 62 6c 65 20 67 28 66 69 6e 64 54 variable g(findT
f230: 79 70 65 29 0a 09 72 61 64 69 6f 62 75 74 74 6f ype)..radiobutto
f240: 6e 20 24 6f 66 2e 73 65 61 72 63 68 52 65 67 65 n $of.searchRege
f250: 78 70 20 2d 74 65 78 74 20 22 52 65 67 65 78 70 xp -text "Regexp
f260: 22 20 2d 76 61 6c 75 65 20 22 2d 72 65 67 65 78 " -value "-regex
f270: 70 22 20 5c 0a 09 20 20 2d 69 6e 64 69 63 61 74 p" \.. -indicat
f280: 6f 72 6f 6e 20 74 72 75 65 20 2d 76 61 72 69 61 oron true -varia
f290: 62 6c 65 20 67 28 66 69 6e 64 54 79 70 65 29 0a ble g(findType).
f2a0: 0a 09 67 72 69 64 20 24 6f 66 2e 64 69 72 65 63 ..grid $of.direc
f2b0: 74 69 6f 6e 4c 61 62 65 6c 20 2d 72 6f 77 20 31 tionLabel -row 1
f2c0: 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 69 63 -column 0 -stic
f2d0: 6b 79 20 77 0a 09 67 72 69 64 20 24 6f 66 2e 64 ky w..grid $of.d
f2e0: 69 72 65 63 74 69 6f 6e 46 6f 72 77 61 72 64 20 irectionForward
f2f0: 2d 72 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 31 -row 1 -column 1
f300: 20 2d 73 74 69 63 6b 79 20 77 0a 09 67 72 69 64 -sticky w..grid
f310: 20 24 6f 66 2e 64 69 72 65 63 74 69 6f 6e 42 61 $of.directionBa
f320: 63 6b 77 61 72 64 20 2d 72 6f 77 20 31 20 2d 63 ckward -row 1 -c
f330: 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 63 6b 79 20 olumn 2 -sticky
f340: 77 0a 0a 09 67 72 69 64 20 24 6f 66 2e 77 69 6e w...grid $of.win
f350: 64 6f 77 4c 61 62 65 6c 20 2d 72 6f 77 20 30 20 dowLabel -row 0
f360: 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b -column 0 -stick
f370: 79 20 77 0a 09 67 72 69 64 20 24 6f 66 2e 77 69 y w..grid $of.wi
f380: 6e 64 6f 77 4c 65 66 74 20 2d 72 6f 77 20 30 20 ndowLeft -row 0
f390: 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 63 6b -column 1 -stick
f3a0: 79 20 77 0a 09 67 72 69 64 20 24 6f 66 2e 77 69 y w..grid $of.wi
f3b0: 6e 64 6f 77 52 69 67 68 74 20 2d 72 6f 77 20 30 ndowRight -row 0
f3c0: 20 2d 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 63 -column 2 -stic
f3d0: 6b 79 20 77 0a 0a 09 67 72 69 64 20 24 6f 66 2e ky w...grid $of.
f3e0: 73 65 61 72 63 68 4c 61 62 65 6c 20 2d 72 6f 77 searchLabel -row
f3f0: 20 32 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 2 -column 0 -st
f400: 69 63 6b 79 20 77 0a 09 67 72 69 64 20 24 6f 66 icky w..grid $of
f410: 2e 73 65 61 72 63 68 45 78 61 63 74 20 2d 72 6f .searchExact -ro
f420: 77 20 32 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 w 2 -column 1 -s
f430: 74 69 63 6b 79 20 77 0a 09 67 72 69 64 20 24 6f ticky w..grid $o
f440: 66 2e 73 65 61 72 63 68 52 65 67 65 78 70 20 2d f.searchRegexp -
f450: 72 6f 77 20 32 20 2d 63 6f 6c 75 6d 6e 20 32 20 row 2 -column 2
f460: 2d 73 74 69 63 6b 79 20 77 0a 0a 09 67 72 69 64 -sticky w...grid
f470: 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 columnconfigure
f480: 20 24 6f 66 20 30 20 2d 77 65 69 67 68 74 20 30 $of 0 -weight 0
f490: 0a 09 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e ..grid columncon
f4a0: 66 69 67 75 72 65 20 24 6f 66 20 31 20 2d 77 65 figure $of 1 -we
f4b0: 69 67 68 74 20 30 0a 09 67 72 69 64 20 63 6f 6c ight 0..grid col
f4c0: 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 6f 66 umnconfigure $of
f4d0: 20 32 20 2d 77 65 69 67 68 74 20 31 0a 0a 09 73 2 -weight 1...s
f4e0: 65 74 20 67 28 66 69 6e 64 44 69 72 65 63 74 69 et g(findDirecti
f4f0: 6f 6e 29 20 22 2d 66 6f 72 77 61 72 64 22 0a 09 on) "-forward"..
f500: 73 65 74 20 67 28 66 69 6e 64 54 79 70 65 29 20 set g(findType)
f510: 22 2d 65 78 61 63 74 22 0a 09 73 65 74 20 67 28 "-exact"..set g(
f520: 66 69 6e 64 49 67 6e 6f 72 65 43 61 73 65 29 20 findIgnoreCase)
f530: 31 0a 09 73 65 74 20 67 28 6c 61 73 74 53 65 61 1..set g(lastSea
f540: 72 63 68 29 20 22 22 0a 09 69 66 20 7b 24 67 28 rch) ""..if {$g(
f550: 61 63 74 69 76 65 57 69 6e 64 6f 77 29 20 3d 3d activeWindow) ==
f560: 20 22 22 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 ""} {.. set
f570: 67 28 61 63 74 69 76 65 57 69 6e 64 6f 77 29 20 g(activeWindow)
f580: 5b 66 6f 63 75 73 5d 0a 09 20 20 20 20 69 66 20 [focus].. if
f590: 7b 24 67 28 61 63 74 69 76 65 57 69 6e 64 6f 77 {$g(activeWindow
f5a0: 29 20 21 3d 20 24 77 28 4c 65 66 74 54 65 78 74 ) != $w(LeftText
f5b0: 29 20 26 26 20 24 67 28 61 63 74 69 76 65 57 69 ) && $g(activeWi
f5c0: 6e 64 6f 77 29 20 21 3d 20 5c 0a 09 20 20 20 20 ndow) != \..
f5d0: 20 20 24 77 28 52 69 67 68 74 54 65 78 74 29 7d $w(RightText)}
f5e0: 20 7b 0a 09 09 73 65 74 20 67 28 61 63 74 69 76 {...set g(activ
f5f0: 65 57 69 6e 64 6f 77 29 20 24 77 28 4c 65 66 74 eWindow) $w(Left
f600: 54 65 78 74 29 0a 09 20 20 20 20 7d 0a 09 7d 0a Text).. }..}.
f610: 20 20 20 20 7d 0a 0a 20 20 20 20 63 65 6e 74 65 }.. cente
f620: 72 57 69 6e 64 6f 77 20 24 77 28 66 69 6e 64 44 rWindow $w(findD
f630: 69 61 6c 6f 67 29 0a 20 20 20 20 77 6d 20 64 65 ialog). wm de
f640: 69 63 6f 6e 69 66 79 20 24 77 28 66 69 6e 64 44 iconify $w(findD
f650: 69 61 6c 6f 67 29 0a 20 20 20 20 72 61 69 73 65 ialog). raise
f660: 20 24 77 28 66 69 6e 64 44 69 61 6c 6f 67 29 0a $w(findDialog).
f670: 20 20 20 20 61 66 74 65 72 20 69 64 6c 65 20 66 after idle f
f680: 6f 63 75 73 20 24 77 28 66 69 6e 64 45 6e 74 72 ocus $w(findEntr
f690: 79 29 0a 7d 0a 0a 0a 23 23 23 23 23 23 23 23 23 y).}...#########
f6a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f6b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f6c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f6d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f6e0: 23 23 23 23 23 23 0a 23 20 64 6f 20 74 68 65 20 ######.# do the
f6f0: 22 45 64 69 74 2d 3e 43 6f 70 79 22 20 66 75 6e "Edit->Copy" fun
f700: 63 74 69 6f 6e 61 6c 69 74 79 2c 20 62 79 20 63 ctionality, by c
f710: 6f 70 79 69 6e 67 20 74 68 65 20 63 75 72 72 65 opying the curre
f720: 6e 74 20 73 65 6c 65 63 74 69 6f 6e 0a 23 20 74 nt selection.# t
f730: 6f 20 74 68 65 20 63 6c 69 70 62 6f 61 72 64 0a o the clipboard.
f740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f750: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f760: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f770: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f780: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
f790: 70 72 6f 63 20 64 6f 2d 63 6f 70 79 20 7b 7d 20 proc do-copy {}
f7a0: 7b 0a 20 20 20 20 63 6c 69 70 62 6f 61 72 64 20 {. clipboard
f7b0: 63 6c 65 61 72 20 2d 64 69 73 70 6c 61 79 6f 66 clear -displayof
f7c0: 20 2e 0a 20 20 20 20 23 20 66 69 67 75 72 65 20 .. # figure
f7d0: 6f 75 74 20 77 68 69 63 68 20 77 69 6e 64 6f 77 out which window
f7e0: 20 68 61 73 20 74 68 65 20 73 65 6c 65 63 74 69 has the selecti
f7f0: 6f 6e 2e 2e 2e 0a 20 20 20 20 63 61 74 63 68 20 on.... catch
f800: 7b 0a 09 63 6c 69 70 62 6f 61 72 64 20 61 70 70 {..clipboard app
f810: 65 6e 64 20 5b 73 65 6c 65 63 74 69 6f 6e 20 67 end [selection g
f820: 65 74 20 2d 64 69 73 70 6c 61 79 6f 66 20 2e 5d et -displayof .]
f830: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
f840: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f850: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f860: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f870: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f880: 23 23 23 23 23 23 23 23 23 0a 23 20 73 65 61 72 #########.# sear
f890: 63 68 20 66 6f 72 20 74 68 65 20 74 65 78 74 20 ch for the text
f8a0: 69 6e 20 74 68 65 20 66 69 6e 64 20 64 69 61 6c in the find dial
f8b0: 6f 67 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 og.#############
f8c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f8d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f8e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f8f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
f900: 23 23 0a 70 72 6f 63 20 64 6f 2d 66 69 6e 64 20 ##.proc do-find
f910: 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 {} {. global
f920: 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a g. global w..
f930: 20 20 20 20 69 66 20 7b 21 5b 77 69 6e 66 6f 20 if {![winfo
f940: 65 78 69 73 74 73 20 24 77 28 66 69 6e 64 44 69 exists $w(findDi
f950: 61 6c 6f 67 29 5d 20 7c 7c 20 21 5b 77 69 6e 66 alog)] || ![winf
f960: 6f 20 69 73 6d 61 70 70 65 64 20 24 77 28 66 69 o ismapped $w(fi
f970: 6e 64 44 69 61 6c 6f 67 29 5d 7d 20 7b 0a 09 73 ndDialog)]} {..s
f980: 68 6f 77 2d 66 69 6e 64 0a 09 72 65 74 75 72 6e how-find..return
f990: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 . }.. set
f9a0: 77 69 6e 20 24 67 28 61 63 74 69 76 65 57 69 6e win $g(activeWin
f9b0: 64 6f 77 29 0a 20 20 20 20 69 66 20 7b 24 77 69 dow). if {$wi
f9c0: 6e 20 3d 3d 20 22 22 7d 20 7b 0a 09 73 65 74 20 n == ""} {..set
f9d0: 77 69 6e 20 24 77 28 4c 65 66 74 54 65 78 74 29 win $w(LeftText)
f9e0: 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 24 . }. if {$
f9f0: 67 28 6c 61 73 74 53 65 61 72 63 68 29 20 21 3d g(lastSearch) !=
fa00: 20 22 22 7d 20 7b 0a 09 69 66 20 7b 24 67 28 66 ""} {..if {$g(f
fa10: 69 6e 64 44 69 72 65 63 74 69 6f 6e 29 20 3d 3d indDirection) ==
fa20: 20 22 2d 66 6f 72 77 61 72 64 22 7d 20 7b 0a 09 "-forward"} {..
fa30: 20 20 20 20 73 65 74 20 73 74 61 72 74 20 5b 24 set start [$
fa40: 77 69 6e 20 69 6e 64 65 78 20 22 69 6e 73 65 72 win index "inser
fa50: 74 20 2b 31 63 22 5d 0a 09 7d 20 65 6c 73 65 20 t +1c"]..} else
fa60: 7b 0a 09 20 20 20 20 73 65 74 20 73 74 61 72 74 {.. set start
fa70: 20 69 6e 73 65 72 74 0a 09 7d 0a 20 20 20 20 7d insert..}. }
fa80: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 74 61 else {..set sta
fa90: 72 74 20 31 2e 30 0a 20 20 20 20 7d 0a 0a 20 20 rt 1.0. }..
faa0: 20 20 69 66 20 7b 24 67 28 66 69 6e 64 49 67 6e if {$g(findIgn
fab0: 6f 72 65 43 61 73 65 29 7d 20 7b 0a 09 73 65 74 oreCase)} {..set
fac0: 20 72 65 73 75 6c 74 20 5b 24 77 69 6e 20 73 65 result [$win se
fad0: 61 72 63 68 20 24 67 28 66 69 6e 64 44 69 72 65 arch $g(findDire
fae0: 63 74 69 6f 6e 29 20 24 67 28 66 69 6e 64 54 79 ction) $g(findTy
faf0: 70 65 29 20 2d 6e 6f 63 61 73 65 20 5c 0a 09 20 pe) -nocase \..
fb00: 20 2d 2d 20 24 67 28 66 69 6e 64 53 74 72 69 6e -- $g(findStrin
fb10: 67 29 20 24 73 74 61 72 74 5d 0a 20 20 20 20 7d g) $start]. }
fb20: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 72 65 73 else {..set res
fb30: 75 6c 74 20 5b 24 77 69 6e 20 73 65 61 72 63 68 ult [$win search
fb40: 20 24 67 28 66 69 6e 64 44 69 72 65 63 74 69 6f $g(findDirectio
fb50: 6e 29 20 24 67 28 66 69 6e 64 54 79 70 65 29 20 n) $g(findType)
fb60: 5c 0a 09 20 20 2d 2d 20 24 67 28 66 69 6e 64 53 \.. -- $g(findS
fb70: 74 72 69 6e 67 29 20 24 73 74 61 72 74 5d 0a 20 tring) $start].
fb80: 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 5b 73 74 }. if {[st
fb90: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 72 65 73 ring length $res
fba0: 75 6c 74 5d 20 3e 20 30 7d 20 7b 0a 09 23 20 69 ult] > 0} {..# i
fbb0: 66 20 74 68 69 73 20 69 73 20 61 20 72 65 67 75 f this is a regu
fbc0: 6c 61 72 20 65 78 70 72 65 73 73 69 6f 6e 20 73 lar expression s
fbd0: 65 61 72 63 68 2c 20 67 65 74 20 74 68 65 20 77 earch, get the w
fbe0: 68 6f 6c 65 20 6c 69 6e 65 20 61 6e 64 20 74 72 hole line and tr
fbf0: 79 0a 09 23 20 74 6f 20 66 69 67 75 72 65 20 6f y..# to figure o
fc00: 75 74 20 65 78 61 63 74 6c 79 20 77 68 61 74 20 ut exactly what
fc10: 6d 61 74 63 68 65 64 3b 20 6f 74 68 65 72 77 69 matched; otherwi
fc20: 73 65 20 77 65 20 6b 6e 6f 77 20 77 65 20 6d 75 se we know we mu
fc30: 73 74 0a 09 23 20 68 61 76 65 20 6d 61 74 63 68 st..# have match
fc40: 65 64 20 74 68 65 20 77 68 6f 6c 65 20 73 74 72 ed the whole str
fc50: 69 6e 67 2e 2e 2e 0a 09 69 66 20 7b 24 67 28 66 ing.....if {$g(f
fc60: 69 6e 64 54 79 70 65 29 20 3d 3d 20 22 2d 72 65 indType) == "-re
fc70: 67 65 78 70 22 7d 20 7b 0a 09 20 20 20 20 73 65 gexp"} {.. se
fc80: 74 20 6c 69 6e 65 20 5b 24 77 69 6e 20 67 65 74 t line [$win get
fc90: 20 24 72 65 73 75 6c 74 20 22 24 72 65 73 75 6c $result "$resul
fca0: 74 20 6c 69 6e 65 65 6e 64 22 5d 0a 09 20 20 20 t lineend"]..
fcb0: 20 72 65 67 65 78 70 20 24 67 28 66 69 6e 64 53 regexp $g(findS
fcc0: 74 72 69 6e 67 29 20 24 6c 69 6e 65 20 6d 61 74 tring) $line mat
fcd0: 63 68 56 61 72 0a 09 20 20 20 20 73 65 74 20 6c chVar.. set l
fce0: 65 6e 67 74 68 20 5b 73 74 72 69 6e 67 20 6c 65 ength [string le
fcf0: 6e 67 74 68 20 24 6d 61 74 63 68 56 61 72 5d 0a ngth $matchVar].
fd00: 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 .} else {.. s
fd10: 65 74 20 6c 65 6e 67 74 68 20 5b 73 74 72 69 6e et length [strin
fd20: 67 20 6c 65 6e 67 74 68 20 24 67 28 66 69 6e 64 g length $g(find
fd30: 53 74 72 69 6e 67 29 5d 0a 09 7d 0a 09 73 65 74 String)]..}..set
fd40: 20 67 28 6c 61 73 74 53 65 61 72 63 68 29 20 24 g(lastSearch) $
fd50: 72 65 73 75 6c 74 0a 09 24 77 69 6e 20 6d 61 72 result..$win mar
fd60: 6b 20 73 65 74 20 69 6e 73 65 72 74 20 24 72 65 k set insert $re
fd70: 73 75 6c 74 0a 09 24 77 69 6e 20 74 61 67 20 72 sult..$win tag r
fd80: 65 6d 6f 76 65 20 73 65 6c 20 31 2e 30 20 65 6e emove sel 1.0 en
fd90: 64 0a 09 24 77 69 6e 20 74 61 67 20 61 64 64 20 d..$win tag add
fda0: 73 65 6c 20 24 72 65 73 75 6c 74 20 22 24 72 65 sel $result "$re
fdb0: 73 75 6c 74 20 2b 20 24 7b 6c 65 6e 67 74 68 7d sult + ${length}
fdc0: 63 22 0a 09 24 77 69 6e 20 73 65 65 20 24 72 65 c"..$win see $re
fdd0: 73 75 6c 74 0a 09 66 6f 63 75 73 20 24 77 69 6e sult..focus $win
fde0: 0a 09 23 20 73 68 6f 75 6c 64 20 49 20 73 6f 6d ..# should I som
fdf0: 65 68 6f 77 20 73 6e 61 70 20 74 6f 20 74 68 65 ehow snap to the
fe00: 20 6e 65 61 72 65 73 74 20 64 69 66 66 3f 20 50 nearest diff? P
fe10: 72 6f 62 61 62 6c 79 20 6e 6f 74 2e 2e 2e 0a 20 robably not....
fe20: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 62 65 6c } else {..bel
fe30: 6c 0a 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 l.. }.}..####
fe40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fe50: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fe60: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fe70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fe80: 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 42 75 ###########.# Bu
fe90: 69 6c 64 20 74 68 65 20 6d 65 6e 75 20 62 61 72 ild the menu bar
fea0: 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
feb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fec0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fed0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fee0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
fef0: 0a 70 72 6f 63 20 62 75 69 6c 64 2d 6d 65 6e 75 .proc build-menu
ff00: 62 61 72 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 bar {} {. deb
ff10: 75 67 2d 69 6e 66 6f 20 22 62 75 69 6c 64 2d 6d ug-info "build-m
ff20: 65 6e 75 62 61 72 22 0a 20 20 20 20 67 6c 6f 62 enubar". glob
ff30: 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 al g. global
ff40: 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 opts. global
ff50: 77 0a 0a 20 20 20 20 6d 65 6e 75 20 24 77 28 6d w.. menu $w(m
ff60: 65 6e 75 62 61 72 29 0a 0a 20 20 20 20 23 20 74 enubar).. # t
ff70: 68 69 73 20 69 73 20 6a 75 73 74 20 74 65 6d 70 his is just temp
ff80: 6f 72 61 72 79 20 73 68 6f 72 74 68 61 6e 64 20 orary shorthand
ff90: 2e 2e 2e 0a 20 20 20 20 73 65 74 20 6d 65 6e 75 .... set menu
ffa0: 62 61 72 20 24 77 28 6d 65 6e 75 62 61 72 29 0a bar $w(menubar).
ffb0: 0a 0a 20 20 20 20 23 20 46 69 72 73 74 2c 20 74 .. # First, t
ffc0: 68 65 20 6d 65 6e 75 20 62 75 74 74 6f 6e 73 2e he menu buttons.
ffd0: 2e 2e 0a 20 20 20 20 73 65 74 20 66 69 6c 65 4d ... set fileM
ffe0: 65 6e 75 20 24 77 28 6d 65 6e 75 62 61 72 29 2e enu $w(menubar).
fff0: 66 69 6c 65 0a 20 20 20 20 73 65 74 20 76 69 65 file. set vie
10000 77 4d 65 6e 75 20 24 77 28 6d 65 6e 75 62 61 72 wMenu $w(menubar
10010 29 2e 76 69 65 77 0a 20 20 20 20 73 65 74 20 68 ).view. set h
10020 65 6c 70 4d 65 6e 75 20 24 77 28 6d 65 6e 75 62 elpMenu $w(menub
10030 61 72 29 2e 68 65 6c 70 0a 20 20 20 20 73 65 74 ar).help. set
10040 20 65 64 69 74 4d 65 6e 75 20 24 77 28 6d 65 6e editMenu $w(men
10050 75 62 61 72 29 2e 65 64 69 74 0a 20 20 20 20 73 ubar).edit. s
10060 65 74 20 6d 65 72 67 65 4d 65 6e 75 20 24 77 28 et mergeMenu $w(
10070 6d 65 6e 75 62 61 72 29 2e 77 69 6e 64 6f 77 0a menubar).window.
10080 20 20 20 20 73 65 74 20 6d 61 72 6b 4d 65 6e 75 set markMenu
10090 20 24 77 28 6d 65 6e 75 62 61 72 29 2e 6d 61 72 $w(menubar).mar
100a0 6b 73 0a 0a 20 20 20 20 24 77 28 6d 65 6e 75 62 ks.. $w(menub
100b0 61 72 29 20 61 64 64 20 63 61 73 63 61 64 65 20 ar) add cascade
100c0 2d 6c 61 62 65 6c 20 22 46 69 6c 65 22 20 2d 6d -label "File" -m
100d0 65 6e 75 20 24 66 69 6c 65 4d 65 6e 75 20 2d 75 enu $fileMenu -u
100e0 6e 64 65 72 6c 69 6e 65 20 30 0a 20 20 20 20 24 nderline 0. $
100f0 77 28 6d 65 6e 75 62 61 72 29 20 61 64 64 20 63 w(menubar) add c
10100 61 73 63 61 64 65 20 2d 6c 61 62 65 6c 20 22 45 ascade -label "E
10110 64 69 74 22 20 2d 6d 65 6e 75 20 24 65 64 69 74 dit" -menu $edit
10120 4d 65 6e 75 20 2d 75 6e 64 65 72 6c 69 6e 65 20 Menu -underline
10130 30 0a 20 20 20 20 24 77 28 6d 65 6e 75 62 61 72 0. $w(menubar
10140 29 20 61 64 64 20 63 61 73 63 61 64 65 20 2d 6c ) add cascade -l
10150 61 62 65 6c 20 22 56 69 65 77 22 20 2d 6d 65 6e abel "View" -men
10160 75 20 24 76 69 65 77 4d 65 6e 75 20 2d 75 6e 64 u $viewMenu -und
10170 65 72 6c 69 6e 65 20 30 0a 20 20 20 20 24 77 28 erline 0. $w(
10180 6d 65 6e 75 62 61 72 29 20 61 64 64 20 63 61 73 menubar) add cas
10190 63 61 64 65 20 2d 6c 61 62 65 6c 20 22 4d 61 72 cade -label "Mar
101a0 6b 22 20 2d 6d 65 6e 75 20 24 6d 61 72 6b 4d 65 k" -menu $markMe
101b0 6e 75 20 2d 75 6e 64 65 72 6c 69 6e 65 20 33 0a nu -underline 3.
101c0 20 20 20 20 24 77 28 6d 65 6e 75 62 61 72 29 20 $w(menubar)
101d0 61 64 64 20 63 61 73 63 61 64 65 20 2d 6c 61 62 add cascade -lab
101e0 65 6c 20 22 4d 65 72 67 65 22 20 2d 6d 65 6e 75 el "Merge" -menu
101f0 20 24 6d 65 72 67 65 4d 65 6e 75 20 2d 75 6e 64 $mergeMenu -und
10200 65 72 6c 69 6e 65 20 30 0a 20 20 20 20 24 77 28 erline 0. $w(
10210 6d 65 6e 75 62 61 72 29 20 61 64 64 20 63 61 73 menubar) add cas
10220 63 61 64 65 20 2d 6c 61 62 65 6c 20 22 48 65 6c cade -label "Hel
10230 70 22 20 2d 6d 65 6e 75 20 24 68 65 6c 70 4d 65 p" -menu $helpMe
10240 6e 75 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 0a nu -underline 0.
10250 0a 20 20 20 20 23 20 74 68 65 73 65 2c 20 68 6f . # these, ho
10260 77 65 76 65 72 2c 20 61 72 65 20 75 73 65 64 20 wever, are used
10270 69 6e 20 6f 74 68 65 72 20 70 6c 61 63 65 73 2e in other places.
10280 2e 0a 20 20 20 20 73 65 74 20 77 28 66 69 6c 65 .. set w(file
10290 4d 65 6e 75 29 20 24 66 69 6c 65 4d 65 6e 75 0a Menu) $fileMenu.
102a0 20 20 20 20 73 65 74 20 77 28 76 69 65 77 4d 65 set w(viewMe
102b0 6e 75 29 20 24 76 69 65 77 4d 65 6e 75 0a 20 20 nu) $viewMenu.
102c0 20 20 73 65 74 20 77 28 68 65 6c 70 4d 65 6e 75 set w(helpMenu
102d0 29 20 24 68 65 6c 70 4d 65 6e 75 0a 20 20 20 20 ) $helpMenu.
102e0 73 65 74 20 77 28 65 64 69 74 4d 65 6e 75 29 20 set w(editMenu)
102f0 24 65 64 69 74 4d 65 6e 75 0a 20 20 20 20 73 65 $editMenu. se
10300 74 20 77 28 6d 65 72 67 65 4d 65 6e 75 29 20 24 t w(mergeMenu) $
10310 6d 65 72 67 65 4d 65 6e 75 0a 20 20 20 20 73 65 mergeMenu. se
10320 74 20 77 28 6d 61 72 6b 4d 65 6e 75 29 20 24 6d t w(markMenu) $m
10330 61 72 6b 4d 65 6e 75 0a 0a 20 20 20 20 23 20 4e arkMenu.. # N
10340 6f 77 2c 20 74 68 65 20 6d 65 6e 75 73 2e 2e 2e ow, the menus...
10350 0a 0a 20 20 20 20 23 20 4d 61 72 6b 20 6d 65 6e .. # Mark men
10360 75 2e 2e 2e 0a 20 20 20 20 6d 65 6e 75 20 24 6d u.... menu $m
10370 61 72 6b 4d 65 6e 75 0a 20 20 20 20 24 6d 61 72 arkMenu. $mar
10380 6b 4d 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e kMenu add comman
10390 64 20 2d 6c 61 62 65 6c 20 22 4d 61 72 6b 20 43 d -label "Mark C
103a0 75 72 72 65 6e 74 20 44 69 66 66 22 20 2d 63 6f urrent Diff" -co
103b0 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 64 69 66 66 mmand [list diff
103c0 6d 61 72 6b 20 5c 0a 20 20 20 20 20 20 6d 61 72 mark \. mar
103d0 6b 5d 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 0a k] -underline 0.
103e0 20 20 20 20 24 6d 61 72 6b 4d 65 6e 75 20 61 64 $markMenu ad
103f0 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c d command -label
10400 20 22 43 6c 65 61 72 20 43 75 72 72 65 6e 74 20 "Clear Current
10410 44 69 66 66 20 4d 61 72 6b 22 20 2d 63 6f 6d 6d Diff Mark" -comm
10420 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 73 and \. [lis
10430 74 20 64 69 66 66 6d 61 72 6b 20 63 6c 65 61 72 t diffmark clear
10440 5d 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 0a 0a ] -underline 0..
10450 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 set "g(toolt
10460 69 70 2c 4d 61 72 6b 20 43 75 72 72 65 6e 74 20 ip,Mark Current
10470 44 69 66 66 29 22 20 22 43 72 65 61 74 65 20 61 Diff)" "Create a
10480 20 6d 61 72 6b 65 72 20 66 6f 72 20 74 68 65 20 marker for the
10490 63 75 72 72 65 6e 74 20 5c 0a 20 20 20 20 20 20 current \.
104a0 64 69 66 66 65 72 65 6e 63 65 20 72 65 63 6f 72 difference recor
104b0 64 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f d". set "g(to
104c0 6f 6c 74 69 70 2c 43 6c 65 61 72 20 43 75 72 72 oltip,Clear Curr
104d0 65 6e 74 20 44 69 66 66 20 4d 61 72 6b 29 22 20 ent Diff Mark)"
104e0 22 43 6c 65 61 72 20 74 68 65 20 6d 61 72 6b 65 "Clear the marke
104f0 72 20 66 6f 72 20 74 68 65 20 5c 0a 20 20 20 20 r for the \.
10500 20 20 63 75 72 72 65 6e 74 20 64 69 66 66 65 72 current differ
10510 65 6e 63 65 20 72 65 63 6f 72 64 22 0a 0a 20 20 ence record"..
10520 20 20 23 20 46 69 6c 65 20 6d 65 6e 75 2e 2e 2e # File menu...
10530 0a 20 20 20 20 6d 65 6e 75 20 24 66 69 6c 65 4d . menu $fileM
10540 65 6e 75 0a 20 20 20 20 24 66 69 6c 65 4d 65 6e enu. $fileMen
10550 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c u add command -l
10560 61 62 65 6c 20 22 4e 65 77 2e 2e 2e 22 20 2d 75 abel "New..." -u
10570 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d nderline 0 -comm
10580 61 6e 64 20 7b 64 6f 2d 6e 65 77 2d 64 69 66 66 and {do-new-diff
10590 7d 0a 20 20 20 20 24 66 69 6c 65 4d 65 6e 75 20 }. $fileMenu
105a0 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20 add separator.
105b0 20 20 24 66 69 6c 65 4d 65 6e 75 20 61 64 64 20 $fileMenu add
105c0 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
105d0 52 65 63 6f 6d 70 75 74 65 20 44 69 66 66 73 22 Recompute Diffs"
105e0 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 5c 0a -underline 0 \.
105f0 20 20 20 20 20 20 2d 61 63 63 65 6c 65 72 61 74 -accelerat
10600 6f 72 20 72 20 2d 63 6f 6d 6d 61 6e 64 20 72 65 or r -command re
10610 63 6f 6d 70 75 74 65 2d 64 69 66 66 0a 20 20 20 compute-diff.
10620 20 24 66 69 6c 65 4d 65 6e 75 20 61 64 64 20 63 $fileMenu add c
10630 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 57 ommand -label "W
10640 72 69 74 65 20 52 65 70 6f 72 74 2e 2e 2e 22 20 rite Report..."
10650 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 20 -command \.
10660 20 5b 6c 69 73 74 20 77 72 69 74 65 2d 72 65 70 [list write-rep
10670 6f 72 74 20 70 6f 70 75 70 5d 20 2d 75 6e 64 65 ort popup] -unde
10680 72 6c 69 6e 65 20 30 0a 20 20 20 20 24 66 69 6c rline 0. $fil
10690 65 4d 65 6e 75 20 61 64 64 20 73 65 70 61 72 61 eMenu add separa
106a0 74 6f 72 0a 20 20 20 20 24 66 69 6c 65 4d 65 6e tor. $fileMen
106b0 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c u add command -l
106c0 61 62 65 6c 20 22 45 78 69 74 22 20 2d 75 6e 64 abel "Exit" -und
106d0 65 72 6c 69 6e 65 20 31 20 2d 61 63 63 65 6c 65 erline 1 -accele
106e0 72 61 74 6f 72 20 71 20 5c 0a 20 20 20 20 20 20 rator q \.
106f0 2d 63 6f 6d 6d 61 6e 64 20 64 6f 2d 65 78 69 74 -command do-exit
10700 0a 0a 20 20 20 20 23 20 45 64 69 74 20 6d 65 6e .. # Edit men
10710 75 2e 2e 2e 20 20 49 66 20 79 6f 75 20 63 68 61 u... If you cha
10720 6e 67 65 2c 20 61 64 64 20 6f 72 20 72 65 6d 6f nge, add or remo
10730 76 65 20 6c 61 62 65 6c 73 2c 20 62 65 20 73 75 ve labels, be su
10740 72 65 20 61 6e 64 0a 20 20 20 20 23 20 75 70 64 re and. # upd
10750 61 74 65 20 74 68 65 20 74 6f 6f 6c 74 69 70 73 ate the tooltips
10760 2e 0a 20 20 20 20 6d 65 6e 75 20 24 65 64 69 74 .. menu $edit
10770 4d 65 6e 75 0a 20 20 20 20 24 65 64 69 74 4d 65 Menu. $editMe
10780 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d nu add command -
10790 6c 61 62 65 6c 20 22 43 6f 70 79 22 20 2d 75 6e label "Copy" -un
107a0 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d 61 derline 0 -comma
107b0 6e 64 20 64 6f 2d 63 6f 70 79 0a 20 20 20 20 24 nd do-copy. $
107c0 65 64 69 74 4d 65 6e 75 20 61 64 64 20 73 65 70 editMenu add sep
107d0 61 72 61 74 6f 72 0a 20 20 20 20 24 65 64 69 74 arator. $edit
107e0 4d 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 Menu add command
107f0 20 2d 6c 61 62 65 6c 20 22 46 69 6e 64 2e 2e 2e -label "Find...
10800 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 2d " -underline 0 -
10810 63 6f 6d 6d 61 6e 64 20 73 68 6f 77 2d 66 69 6e command show-fin
10820 64 0a 20 20 20 20 24 65 64 69 74 4d 65 6e 75 20 d. $editMenu
10830 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20 add separator.
10840 20 20 24 65 64 69 74 4d 65 6e 75 20 61 64 64 20 $editMenu add
10850 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
10860 45 64 69 74 20 46 69 6c 65 20 31 22 20 2d 63 6f Edit File 1" -co
10870 6d 6d 61 6e 64 20 7b 0a 09 73 65 74 20 67 28 61 mmand {..set g(a
10880 63 74 69 76 65 57 69 6e 64 6f 77 29 20 24 77 28 ctiveWindow) $w(
10890 4c 65 66 74 54 65 78 74 29 0a 09 64 6f 2d 65 64 LeftText)..do-ed
108a0 69 74 0a 20 20 20 20 7d 20 2d 75 6e 64 65 72 6c it. } -underl
108b0 69 6e 65 20 31 30 0a 20 20 20 20 24 65 64 69 74 ine 10. $edit
108c0 4d 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 Menu add command
108d0 20 2d 6c 61 62 65 6c 20 22 45 64 69 74 20 46 69 -label "Edit Fi
108e0 6c 65 20 32 22 20 2d 63 6f 6d 6d 61 6e 64 20 7b le 2" -command {
108f0 0a 09 73 65 74 20 67 28 61 63 74 69 76 65 57 69 ..set g(activeWi
10900 6e 64 6f 77 29 20 24 77 28 52 69 67 68 74 54 65 ndow) $w(RightTe
10910 78 74 29 0a 09 64 6f 2d 65 64 69 74 0a 20 20 20 xt)..do-edit.
10920 20 7d 20 2d 75 6e 64 65 72 6c 69 6e 65 20 31 30 } -underline 10
10930 0a 20 20 20 20 24 65 64 69 74 4d 65 6e 75 20 61 . $editMenu a
10940 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20 20 dd separator.
10950 20 24 65 64 69 74 4d 65 6e 75 20 61 64 64 20 63 $editMenu add c
10960 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 50 ommand -label "P
10970 72 65 66 65 72 65 6e 63 65 73 2e 2e 2e 22 20 2d references..." -
10980 75 6e 64 65 72 6c 69 6e 65 20 33 20 5c 0a 20 20 underline 3 \.
10990 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 63 75 73 -command cus
109a0 74 6f 6d 69 7a 65 0a 0a 20 20 20 20 73 65 74 20 tomize.. set
109b0 22 67 28 74 6f 6f 6c 74 69 70 2c 43 6f 70 79 29 "g(tooltip,Copy)
109c0 22 20 22 43 6f 70 79 20 74 68 65 20 63 75 72 72 " "Copy the curr
109d0 65 6e 74 6c 79 20 73 65 6c 65 63 74 65 64 20 74 ently selected t
109e0 65 78 74 20 74 6f 20 74 68 65 20 63 6c 69 70 62 ext to the clipb
109f0 6f 61 72 64 22 0a 20 20 20 20 73 65 74 20 22 67 oard". set "g
10a00 28 74 6f 6f 6c 74 69 70 2c 46 69 6e 64 2e 2e 2e (tooltip,Find...
10a10 29 22 20 22 50 6f 70 20 75 70 20 61 20 64 69 61 )" "Pop up a dia
10a20 6c 6f 67 20 74 6f 20 73 65 61 72 63 68 20 66 6f log to search fo
10a30 72 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 69 r a string withi
10a40 6e 20 5c 0a 20 20 20 20 20 20 65 69 74 68 65 72 n \. either
10a50 20 66 69 6c 65 22 0a 20 20 20 20 73 65 74 20 22 file". set "
10a60 67 28 74 6f 6f 6c 74 69 70 2c 45 64 69 74 20 46 g(tooltip,Edit F
10a70 69 6c 65 20 31 29 22 20 22 4c 61 75 6e 63 68 20 ile 1)" "Launch
10a80 61 6e 20 65 64 69 74 6f 72 20 6f 6e 20 74 68 65 an editor on the
10a90 20 66 69 6c 65 20 6f 6e 20 74 68 65 20 6c 65 66 file on the lef
10aa0 74 20 5c 0a 20 20 20 20 20 20 73 69 64 65 20 6f t \. side o
10ab0 66 20 74 68 65 20 77 69 6e 64 6f 77 22 0a 20 20 f the window".
10ac0 20 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 set "g(tooltip
10ad0 2c 45 64 69 74 20 46 69 6c 65 20 32 29 22 20 22 ,Edit File 2)" "
10ae0 4c 61 75 6e 63 68 20 61 6e 20 65 64 69 74 6f 72 Launch an editor
10af0 20 6f 6e 20 74 68 65 20 66 69 6c 65 20 6f 6e 20 on the file on
10b00 74 68 65 20 72 69 67 68 74 20 5c 0a 20 20 20 20 the right \.
10b10 20 20 73 69 64 65 20 6f 66 20 74 68 65 20 77 69 side of the wi
10b20 6e 64 6f 77 22 0a 20 20 20 20 73 65 74 20 22 67 ndow". set "g
10b30 28 74 6f 6f 6c 74 69 70 2c 50 72 65 66 65 72 65 (tooltip,Prefere
10b40 6e 63 65 73 2e 2e 2e 29 22 20 22 50 6f 70 20 75 nces...)" "Pop u
10b50 70 20 61 20 77 69 6e 64 6f 77 20 74 6f 20 63 75 p a window to cu
10b60 73 74 6f 6d 69 7a 65 20 24 67 28 6e 61 6d 65 29 stomize $g(name)
10b70 22 0a 0a 20 20 20 20 23 20 56 69 65 77 20 6d 65 ".. # View me
10b80 6e 75 2e 2e 2e 20 20 49 66 20 79 6f 75 20 63 68 nu... If you ch
10b90 61 6e 67 65 2c 20 61 64 64 20 6f 72 20 72 65 6d ange, add or rem
10ba0 6f 76 65 20 6c 61 62 65 6c 73 2c 20 62 65 20 73 ove labels, be s
10bb0 75 72 65 20 61 6e 64 0a 20 20 20 20 23 20 75 70 ure and. # up
10bc0 64 61 74 65 20 74 68 65 20 74 6f 6f 6c 74 69 70 date the tooltip
10bd0 73 2e 0a 20 20 20 20 6d 65 6e 75 20 24 76 69 65 s.. menu $vie
10be0 77 4d 65 6e 75 0a 20 20 20 20 24 76 69 65 77 4d wMenu. $viewM
10bf0 65 6e 75 20 61 64 64 20 63 68 65 63 6b 62 75 74 enu add checkbut
10c00 74 6f 6e 20 2d 6c 61 62 65 6c 20 22 49 67 6e 6f ton -label "Igno
10c10 72 65 20 57 68 69 74 65 20 53 70 61 63 65 73 22 re White Spaces"
10c20 20 2d 75 6e 64 65 72 6c 69 6e 65 20 38 20 5c 0a -underline 8 \.
10c30 20 20 20 20 20 20 2d 73 65 6c 65 63 74 63 6f 6c -selectcol
10c40 6f 72 20 24 77 28 73 65 6c 63 6f 6c 6f 72 29 20 or $w(selcolor)
10c50 2d 76 61 72 69 61 62 6c 65 20 6f 70 74 73 28 69 -variable opts(i
10c60 67 6e 6f 72 65 62 6c 61 6e 6b 73 29 20 5c 0a 20 gnoreblanks) \.
10c70 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 64 6f -command do
10c80 2d 73 68 6f 77 2d 69 67 6e 6f 72 65 62 6c 61 6e -show-ignoreblan
10c90 6b 73 0a 0a 20 20 20 20 24 76 69 65 77 4d 65 6e ks.. $viewMen
10ca0 75 20 61 64 64 20 63 68 65 63 6b 62 75 74 74 6f u add checkbutto
10cb0 6e 20 2d 6c 61 62 65 6c 20 22 53 68 6f 77 20 4c n -label "Show L
10cc0 69 6e 65 20 4e 75 6d 62 65 72 73 22 20 2d 75 6e ine Numbers" -un
10cd0 64 65 72 6c 69 6e 65 20 31 32 20 5c 0a 20 20 20 derline 12 \.
10ce0 20 20 20 2d 73 65 6c 65 63 74 63 6f 6c 6f 72 20 -selectcolor
10cf0 24 77 28 73 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 $w(selcolor) -va
10d00 72 69 61 62 6c 65 20 6f 70 74 73 28 73 68 6f 77 riable opts(show
10d10 6c 6e 29 20 5c 0a 20 20 20 20 20 20 2d 63 6f 6d ln) \. -com
10d20 6d 61 6e 64 20 64 6f 2d 73 68 6f 77 2d 6c 69 6e mand do-show-lin
10d30 65 6e 75 6d 62 65 72 73 0a 0a 20 20 20 20 24 76 enumbers.. $v
10d40 69 65 77 4d 65 6e 75 20 61 64 64 20 63 68 65 63 iewMenu add chec
10d50 6b 62 75 74 74 6f 6e 20 2d 6c 61 62 65 6c 20 22 kbutton -label "
10d60 53 68 6f 77 20 43 68 61 6e 67 65 20 42 61 72 73 Show Change Bars
10d70 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 31 32 20 " -underline 12
10d80 5c 0a 20 20 20 20 20 20 2d 73 65 6c 65 63 74 63 \. -selectc
10d90 6f 6c 6f 72 20 24 77 28 73 65 6c 63 6f 6c 6f 72 olor $w(selcolor
10da0 29 20 2d 76 61 72 69 61 62 6c 65 20 6f 70 74 73 ) -variable opts
10db0 28 73 68 6f 77 63 62 73 29 20 5c 0a 20 20 20 20 (showcbs) \.
10dc0 20 20 2d 63 6f 6d 6d 61 6e 64 20 64 6f 2d 73 68 -command do-sh
10dd0 6f 77 2d 63 68 61 6e 67 65 62 61 72 73 0a 0a 20 ow-changebars..
10de0 20 20 20 24 76 69 65 77 4d 65 6e 75 20 61 64 64 $viewMenu add
10df0 20 63 68 65 63 6b 62 75 74 74 6f 6e 20 2d 6c 61 checkbutton -la
10e00 62 65 6c 20 22 53 68 6f 77 20 44 69 66 66 20 4d bel "Show Diff M
10e10 61 70 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 35 ap" -underline 5
10e20 20 5c 0a 20 20 20 20 20 20 2d 73 65 6c 65 63 74 \. -select
10e30 63 6f 6c 6f 72 20 24 77 28 73 65 6c 63 6f 6c 6f color $w(selcolo
10e40 72 29 20 2d 76 61 72 69 61 62 6c 65 20 6f 70 74 r) -variable opt
10e50 73 28 73 68 6f 77 6d 61 70 29 20 2d 63 6f 6d 6d s(showmap) -comm
10e60 61 6e 64 20 64 6f 2d 73 68 6f 77 2d 6d 61 70 0a and do-show-map.
10e70 0a 20 20 20 20 24 76 69 65 77 4d 65 6e 75 20 61 . $viewMenu a
10e80 64 64 20 63 68 65 63 6b 62 75 74 74 6f 6e 20 2d dd checkbutton -
10e90 6c 61 62 65 6c 20 22 53 68 6f 77 20 4c 69 6e 65 label "Show Line
10ea0 20 43 6f 6d 70 61 72 69 73 6f 6e 20 57 69 6e 64 Comparison Wind
10eb0 6f 77 22 20 5c 0a 20 20 20 20 20 20 2d 75 6e 64 ow" \. -und
10ec0 65 72 6c 69 6e 65 20 31 31 20 2d 73 65 6c 65 63 erline 11 -selec
10ed0 74 63 6f 6c 6f 72 20 24 77 28 73 65 6c 63 6f 6c tcolor $w(selcol
10ee0 6f 72 29 20 2d 76 61 72 69 61 62 6c 65 20 6f 70 or) -variable op
10ef0 74 73 28 73 68 6f 77 6c 69 6e 65 76 69 65 77 29 ts(showlineview)
10f00 20 5c 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e \. -comman
10f10 64 20 64 6f 2d 73 68 6f 77 2d 6c 69 6e 65 76 69 d do-show-linevi
10f20 65 77 0a 0a 20 20 20 20 24 76 69 65 77 4d 65 6e ew.. $viewMen
10f30 75 20 61 64 64 20 63 68 65 63 6b 62 75 74 74 6f u add checkbutto
10f40 6e 20 2d 6c 61 62 65 6c 20 22 53 68 6f 77 20 49 n -label "Show I
10f50 6e 6c 69 6e 65 20 43 6f 6d 70 61 72 69 73 6f 6e nline Comparison
10f60 20 28 62 79 74 65 29 22 20 5c 0a 20 20 20 20 20 (byte)" \.
10f70 20 2d 73 65 6c 65 63 74 63 6f 6c 6f 72 20 24 77 -selectcolor $w
10f80 28 73 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 72 69 (selcolor) -vari
10f90 61 62 6c 65 20 6f 70 74 73 28 73 68 6f 77 69 6e able opts(showin
10fa0 6c 69 6e 65 31 29 20 5c 0a 20 20 20 20 20 20 2d line1) \. -
10fb0 63 6f 6d 6d 61 6e 64 20 64 6f 2d 73 68 6f 77 2d command do-show-
10fc0 69 6e 6c 69 6e 65 31 0a 0a 20 20 20 20 24 76 69 inline1.. $vi
10fd0 65 77 4d 65 6e 75 20 61 64 64 20 63 68 65 63 6b ewMenu add check
10fe0 62 75 74 74 6f 6e 20 2d 6c 61 62 65 6c 20 22 53 button -label "S
10ff0 68 6f 77 20 49 6e 6c 69 6e 65 20 43 6f 6d 70 61 how Inline Compa
11000 72 69 73 6f 6e 20 28 72 65 63 75 72 73 69 76 65 rison (recursive
11010 29 22 20 5c 0a 20 20 20 20 20 20 2d 73 65 6c 65 )" \. -sele
11020 63 74 63 6f 6c 6f 72 20 24 77 28 73 65 6c 63 6f ctcolor $w(selco
11030 6c 6f 72 29 20 2d 76 61 72 69 61 62 6c 65 20 6f lor) -variable o
11040 70 74 73 28 73 68 6f 77 69 6e 6c 69 6e 65 32 29 pts(showinline2)
11050 20 5c 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e \. -comman
11060 64 20 64 6f 2d 73 68 6f 77 2d 69 6e 6c 69 6e 65 d do-show-inline
11070 32 0a 0a 20 20 20 20 24 76 69 65 77 4d 65 6e 75 2.. $viewMenu
11080 20 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 0a add separator..
11090 20 20 20 20 24 76 69 65 77 4d 65 6e 75 20 61 64 $viewMenu ad
110a0 64 20 63 68 65 63 6b 62 75 74 74 6f 6e 20 2d 6c d checkbutton -l
110b0 61 62 65 6c 20 22 53 79 6e 63 68 72 6f 6e 69 7a abel "Synchroniz
110c0 65 20 53 63 72 6f 6c 6c 62 61 72 73 22 20 2d 75 e Scrollbars" -u
110d0 6e 64 65 72 6c 69 6e 65 20 30 20 5c 0a 20 20 20 nderline 0 \.
110e0 20 20 20 2d 73 65 6c 65 63 74 63 6f 6c 6f 72 20 -selectcolor
110f0 24 77 28 73 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 $w(selcolor) -va
11100 72 69 61 62 6c 65 20 6f 70 74 73 28 73 79 6e 63 riable opts(sync
11110 73 63 72 6f 6c 6c 29 0a 20 20 20 20 24 76 69 65 scroll). $vie
11120 77 4d 65 6e 75 20 61 64 64 20 63 68 65 63 6b 62 wMenu add checkb
11130 75 74 74 6f 6e 20 2d 6c 61 62 65 6c 20 22 41 75 utton -label "Au
11140 74 6f 20 43 65 6e 74 65 72 22 20 2d 75 6e 64 65 to Center" -unde
11150 72 6c 69 6e 65 20 30 20 5c 0a 20 20 20 20 20 20 rline 0 \.
11160 2d 73 65 6c 65 63 74 63 6f 6c 6f 72 20 24 77 28 -selectcolor $w(
11170 73 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 72 69 61 selcolor) -varia
11180 62 6c 65 20 6f 70 74 73 28 61 75 74 6f 63 65 6e ble opts(autocen
11190 74 65 72 29 20 2d 63 6f 6d 6d 61 6e 64 20 7b 69 ter) -command {i
111a0 66 20 5c 0a 20 20 20 20 20 20 7b 24 6f 70 74 73 f \. {$opts
111b0 28 61 75 74 6f 63 65 6e 74 65 72 29 7d 20 7b 63 (autocenter)} {c
111c0 65 6e 74 65 72 7d 7d 0a 20 20 20 20 24 76 69 65 enter}}. $vie
111d0 77 4d 65 6e 75 20 61 64 64 20 63 68 65 63 6b 62 wMenu add checkb
111e0 75 74 74 6f 6e 20 2d 6c 61 62 65 6c 20 22 41 75 utton -label "Au
111f0 74 6f 20 53 65 6c 65 63 74 22 20 2d 75 6e 64 65 to Select" -unde
11200 72 6c 69 6e 65 20 31 20 5c 0a 20 20 20 20 20 20 rline 1 \.
11210 2d 73 65 6c 65 63 74 63 6f 6c 6f 72 20 24 77 28 -selectcolor $w(
11220 73 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 72 69 61 selcolor) -varia
11230 62 6c 65 20 6f 70 74 73 28 61 75 74 6f 73 65 6c ble opts(autosel
11240 65 63 74 29 0a 0a 20 20 20 20 24 76 69 65 77 4d ect).. $viewM
11250 65 6e 75 20 61 64 64 20 73 65 70 61 72 61 74 6f enu add separato
11260 72 0a 0a 20 20 20 20 24 76 69 65 77 4d 65 6e 75 r.. $viewMenu
11270 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 add command -la
11280 62 65 6c 20 22 46 69 72 73 74 20 44 69 66 66 22 bel "First Diff"
11290 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 -underline 0 -c
112a0 6f 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 7b ommand \. {
112b0 6d 6f 76 65 20 66 69 72 73 74 7d 20 2d 61 63 63 move first} -acc
112c0 65 6c 65 72 61 74 6f 72 20 22 46 22 0a 20 20 20 elerator "F".
112d0 20 24 76 69 65 77 4d 65 6e 75 20 61 64 64 20 63 $viewMenu add c
112e0 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 50 ommand -label "P
112f0 72 65 76 69 6f 75 73 20 44 69 66 66 22 20 2d 75 revious Diff" -u
11300 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d nderline 0 -comm
11310 61 6e 64 20 7b 6d 6f 76 65 20 5c 0a 20 20 20 20 and {move \.
11320 20 20 2d 31 7d 20 2d 61 63 63 65 6c 65 72 61 74 -1} -accelerat
11330 6f 72 20 22 50 22 0a 20 20 20 20 24 76 69 65 77 or "P". $view
11340 4d 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 Menu add command
11350 20 2d 6c 61 62 65 6c 20 22 43 65 6e 74 65 72 20 -label "Center
11360 43 75 72 72 65 6e 74 20 44 69 66 66 22 20 2d 75 Current Diff" -u
11370 6e 64 65 72 6c 69 6e 65 20 30 20 5c 0a 20 20 20 nderline 0 \.
11380 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 7b 63 65 6e -command {cen
11390 74 65 72 7d 20 2d 61 63 63 65 6c 65 72 61 74 6f ter} -accelerato
113a0 72 20 22 43 22 0a 20 20 20 20 24 76 69 65 77 4d r "C". $viewM
113b0 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 enu add command
113c0 2d 6c 61 62 65 6c 20 22 4e 65 78 74 20 44 69 66 -label "Next Dif
113d0 66 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 f" -underline 0
113e0 2d 63 6f 6d 6d 61 6e 64 20 7b 6d 6f 76 65 20 31 -command {move 1
113f0 7d 20 5c 0a 20 20 20 20 20 20 2d 61 63 63 65 6c } \. -accel
11400 65 72 61 74 6f 72 20 22 4e 22 0a 20 20 20 20 24 erator "N". $
11410 76 69 65 77 4d 65 6e 75 20 61 64 64 20 63 6f 6d viewMenu add com
11420 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 4c 61 73 mand -label "Las
11430 74 20 44 69 66 66 22 20 2d 75 6e 64 65 72 6c 69 t Diff" -underli
11440 6e 65 20 30 20 2d 63 6f 6d 6d 61 6e 64 20 5c 0a ne 0 -command \.
11450 20 20 20 20 20 20 7b 6d 6f 76 65 20 6c 61 73 74 {move last
11460 7d 20 2d 61 63 63 65 6c 65 72 61 74 6f 72 20 22 } -accelerator "
11470 4c 22 0a 0a 20 20 20 20 73 65 74 20 22 67 28 74 L".. set "g(t
11480 6f 6f 6c 74 69 70 2c 53 68 6f 77 20 43 68 61 6e ooltip,Show Chan
11490 67 65 20 42 61 72 73 29 22 20 22 49 66 20 73 65 ge Bars)" "If se
114a0 74 2c 20 73 68 6f 77 20 74 68 65 20 63 68 61 6e t, show the chan
114b0 67 65 62 61 72 20 63 6f 6c 75 6d 6e 20 66 6f 72 gebar column for
114c0 20 5c 0a 20 20 20 20 20 20 20 65 61 63 68 20 6c \. each l
114d0 69 6e 65 20 6f 66 20 65 61 63 68 20 66 69 6c 65 ine of each file
114e0 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f ". set "g(too
114f0 6c 74 69 70 2c 53 68 6f 77 20 4c 69 6e 65 20 4e ltip,Show Line N
11500 75 6d 62 65 72 73 29 22 20 22 49 66 20 73 65 74 umbers)" "If set
11510 2c 20 73 68 6f 77 20 6c 69 6e 65 20 6e 75 6d 62 , show line numb
11520 65 72 73 20 62 65 73 69 64 65 20 65 61 63 68 20 ers beside each
11530 5c 0a 20 20 20 20 20 20 20 6c 69 6e 65 20 6f 66 \. line of
11540 20 65 61 63 68 20 66 69 6c 65 22 0a 20 20 20 20 each file".
11550 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c 53 set "g(tooltip,S
11560 79 6e 63 68 72 6f 6e 69 7a 65 20 53 63 72 6f 6c ynchronize Scrol
11570 6c 62 61 72 73 29 22 20 22 49 66 20 73 65 74 2c lbars)" "If set,
11580 20 73 63 72 6f 6c 6c 69 6e 67 20 65 69 74 68 65 scrolling eithe
11590 72 20 77 69 6e 64 6f 77 20 5c 0a 20 20 20 20 20 r window \.
115a0 20 20 77 69 6c 6c 20 73 63 72 6f 6c 6c 20 62 6f will scroll bo
115b0 74 68 20 77 69 6e 64 6f 77 73 22 0a 20 20 20 20 th windows".
115c0 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c 44 set "g(tooltip,D
115d0 69 66 66 20 4d 61 70 29 22 20 22 49 66 20 73 65 iff Map)" "If se
115e0 74 2c 20 64 69 73 70 6c 61 79 20 74 68 65 20 67 t, display the g
115f0 72 61 70 68 69 63 61 6c 20 5c 22 44 69 66 66 65 raphical \"Diffe
11600 72 65 6e 63 65 20 5c 0a 20 20 20 20 20 20 4d 61 rence \. Ma
11610 70 5c 22 20 69 6e 20 74 68 65 20 63 65 6e 74 65 p\" in the cente
11620 72 20 6f 66 20 74 68 65 20 64 69 73 70 6c 61 79 r of the display
11630 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f ". set "g(too
11640 6c 74 69 70 2c 53 68 6f 77 20 4c 69 6e 65 20 43 ltip,Show Line C
11650 6f 6d 70 61 72 69 73 6f 6e 20 57 69 6e 64 6f 77 omparison Window
11660 29 22 20 22 49 66 20 73 65 74 2c 20 64 69 73 70 )" "If set, disp
11670 6c 61 79 20 74 68 65 20 77 69 6e 64 6f 77 20 5c lay the window \
11680 0a 20 20 20 20 20 20 20 77 69 74 68 20 62 79 74 . with byt
11690 65 2d 62 79 2d 62 79 74 65 20 64 69 66 66 65 72 e-by-byte differ
116a0 65 6e 63 65 73 22 0a 20 20 20 20 73 65 74 20 22 ences". set "
116b0 67 28 74 6f 6f 6c 74 69 70 2c 53 68 6f 77 20 49 g(tooltip,Show I
116c0 6e 6c 69 6e 65 20 43 6f 6d 70 61 72 69 73 6f 6e nline Comparison
116d0 20 28 62 79 74 65 29 29 22 20 22 49 66 20 73 65 (byte))" "If se
116e0 74 2c 20 64 69 73 70 6c 61 79 20 69 6e 6c 69 6e t, display inlin
116f0 65 20 5c 0a 20 20 20 20 20 20 62 79 74 65 2d 62 e \. byte-b
11700 79 2d 62 79 74 65 20 64 69 66 66 65 72 65 6e 63 y-byte differenc
11710 65 73 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 es". set "g(t
11720 6f 6f 6c 74 69 70 2c 53 68 6f 77 20 49 6e 6c 69 ooltip,Show Inli
11730 6e 65 20 43 6f 6d 70 61 72 69 73 6f 6e 20 28 72 ne Comparison (r
11740 65 63 75 72 73 69 76 65 29 29 22 20 22 49 66 20 ecursive))" "If
11750 73 65 74 2c 20 64 69 73 70 6c 61 79 20 5c 0a 20 set, display \.
11760 20 20 20 20 20 69 6e 6c 69 6e 65 20 64 69 66 66 inline diff
11770 65 72 65 6e 63 65 73 20 62 61 73 65 64 20 6f 6e erences based on
11780 20 72 65 63 75 72 73 69 76 65 20 6d 61 74 63 68 recursive match
11790 69 6e 67 20 72 65 67 69 6f 6e 73 22 0a 20 20 20 ing regions".
117a0 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c set "g(tooltip,
117b0 41 75 74 6f 20 53 65 6c 65 63 74 29 22 20 22 49 Auto Select)" "I
117c0 66 20 73 65 74 2c 20 61 75 74 6f 6d 61 74 69 63 f set, automatic
117d0 61 6c 6c 79 20 73 65 6c 65 63 74 73 20 74 68 65 ally selects the
117e0 20 6e 65 61 72 65 73 74 20 5c 0a 20 20 20 20 20 nearest \.
117f0 20 20 64 69 66 66 20 72 65 63 6f 72 64 20 77 68 diff record wh
11800 69 6c 65 20 73 63 72 6f 6c 6c 69 6e 67 22 0a 20 ile scrolling".
11810 20 20 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 set "g(toolti
11820 70 2c 41 75 74 6f 20 43 65 6e 74 65 72 29 22 20 p,Auto Center)"
11830 22 49 66 20 73 65 74 2c 20 6d 6f 76 69 6e 67 20 "If set, moving
11840 74 6f 20 61 6e 6f 74 68 65 72 20 64 69 66 66 20 to another diff
11850 72 65 63 6f 72 64 20 77 69 6c 6c 20 5c 0a 20 20 record will \.
11860 20 20 20 20 20 63 65 6e 74 65 72 20 74 68 65 20 center the
11870 64 69 66 66 20 6f 6e 20 74 68 65 20 73 63 72 65 diff on the scre
11880 65 6e 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 en". set "g(t
11890 6f 6f 6c 74 69 70 2c 43 65 6e 74 65 72 20 43 75 ooltip,Center Cu
118a0 72 72 65 6e 74 20 44 69 66 66 29 22 20 22 43 65 rrent Diff)" "Ce
118b0 6e 74 65 72 20 74 68 65 20 64 69 73 70 6c 61 79 nter the display
118c0 20 61 72 6f 75 6e 64 20 74 68 65 20 5c 0a 20 20 around the \.
118d0 20 20 20 20 63 75 72 72 65 6e 74 20 64 69 66 66 current diff
118e0 20 72 65 63 6f 72 64 22 0a 20 20 20 20 73 65 74 record". set
118f0 20 22 67 28 74 6f 6f 6c 74 69 70 2c 46 69 72 73 "g(tooltip,Firs
11900 74 20 44 69 66 66 29 22 20 22 47 6f 20 74 6f 20 t Diff)" "Go to
11910 74 68 65 20 66 69 72 73 74 20 64 69 66 66 65 72 the first differ
11920 65 6e 63 65 22 0a 20 20 20 20 73 65 74 20 22 67 ence". set "g
11930 28 74 6f 6f 6c 74 69 70 2c 4c 61 73 74 20 44 69 (tooltip,Last Di
11940 66 66 29 22 20 22 47 6f 20 74 6f 20 74 68 65 20 ff)" "Go to the
11950 6c 61 73 74 20 64 69 66 66 65 72 65 6e 63 65 22 last difference"
11960 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f 6c . set "g(tool
11970 74 69 70 2c 50 72 65 76 69 6f 75 73 20 44 69 66 tip,Previous Dif
11980 66 29 22 20 22 47 6f 20 74 6f 20 74 68 65 20 64 f)" "Go to the d
11990 69 66 66 20 72 65 63 6f 72 64 20 6a 75 73 74 20 iff record just
119a0 70 72 69 6f 72 20 74 6f 20 74 68 65 20 5c 0a 20 prior to the \.
119b0 20 20 20 20 20 20 63 75 72 72 65 6e 74 20 64 69 current di
119c0 66 66 20 72 65 63 6f 72 64 22 0a 20 20 20 20 73 ff record". s
119d0 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c 4e 65 et "g(tooltip,Ne
119e0 78 74 20 44 69 66 66 29 22 20 22 47 6f 20 74 6f xt Diff)" "Go to
119f0 20 74 68 65 20 64 69 66 66 20 72 65 63 6f 72 64 the diff record
11a00 20 6a 75 73 74 20 61 66 74 65 72 20 74 68 65 20 just after the
11a10 63 75 72 72 65 6e 74 20 5c 0a 20 20 20 20 20 20 current \.
11a20 20 64 69 66 66 20 72 65 63 6f 72 64 22 0a 20 20 diff record".
11a30 20 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 set "g(tooltip
11a40 2c 49 67 6e 6f 72 65 20 57 68 69 74 65 20 53 70 ,Ignore White Sp
11a50 61 63 65 73 29 22 20 22 49 66 20 73 65 74 2c 20 aces)" "If set,
11a60 63 68 61 6e 67 65 73 20 69 6e 20 77 68 69 74 65 changes in white
11a70 73 70 61 63 65 73 20 61 72 65 20 5c 0a 20 20 20 spaces are \.
11a80 20 20 20 20 69 67 6e 6f 72 65 64 22 0a 0a 20 20 ignored"..
11a90 20 20 23 20 4d 65 72 67 65 20 6d 65 6e 75 2e 20 # Merge menu.
11aa0 49 66 20 79 6f 75 20 63 68 61 6e 67 65 2c 20 61 If you change, a
11ab0 64 64 20 6f 72 20 72 65 6d 6f 76 65 20 6c 61 62 dd or remove lab
11ac0 65 6c 73 2c 20 62 65 20 73 75 72 65 20 61 6e 64 els, be sure and
11ad0 0a 20 20 20 20 23 20 75 70 64 61 74 65 20 74 68 . # update th
11ae0 65 20 74 6f 6f 6c 74 69 70 73 2e 0a 20 20 20 20 e tooltips..
11af0 6d 65 6e 75 20 24 6d 65 72 67 65 4d 65 6e 75 0a menu $mergeMenu.
11b00 20 20 20 20 24 6d 65 72 67 65 4d 65 6e 75 20 61 $mergeMenu a
11b10 64 64 20 63 68 65 63 6b 62 75 74 74 6f 6e 20 2d dd checkbutton -
11b20 6c 61 62 65 6c 20 22 53 68 6f 77 20 4d 65 72 67 label "Show Merg
11b30 65 20 57 69 6e 64 6f 77 22 20 2d 75 6e 64 65 72 e Window" -under
11b40 6c 69 6e 65 20 39 20 5c 0a 20 20 20 20 20 20 2d line 9 \. -
11b50 73 65 6c 65 63 74 63 6f 6c 6f 72 20 24 77 28 73 selectcolor $w(s
11b60 65 6c 63 6f 6c 6f 72 29 20 2d 76 61 72 69 61 62 elcolor) -variab
11b70 6c 65 20 67 28 73 68 6f 77 6d 65 72 67 65 29 20 le g(showmerge)
11b80 2d 63 6f 6d 6d 61 6e 64 20 22 64 6f 2d 73 68 6f -command "do-sho
11b90 77 2d 6d 65 72 67 65 20 31 22 0a 20 20 20 20 24 w-merge 1". $
11ba0 6d 65 72 67 65 4d 65 6e 75 20 61 64 64 20 63 6f mergeMenu add co
11bb0 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 57 72 mmand -label "Wr
11bc0 69 74 65 20 4d 65 72 67 65 20 46 69 6c 65 2e 2e ite Merge File..
11bd0 2e 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 36 20 ." -underline 6
11be0 5c 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 \. -command
11bf0 20 70 6f 70 75 70 2d 6d 65 72 67 65 0a 20 20 20 popup-merge.
11c00 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c set "g(tooltip,
11c10 53 68 6f 77 20 4d 65 72 67 65 20 57 69 6e 64 6f Show Merge Windo
11c20 77 29 22 20 22 50 6f 70 73 20 75 70 20 61 20 77 w)" "Pops up a w
11c30 69 6e 64 6f 77 20 73 68 6f 77 69 6e 67 20 74 68 indow showing th
11c40 65 20 63 75 72 72 65 6e 74 20 5c 0a 20 20 20 20 e current \.
11c50 20 20 20 6d 65 72 67 65 20 72 65 73 75 6c 74 73 merge results
11c60 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f ". set "g(too
11c70 6c 74 69 70 2c 57 72 69 74 65 20 4d 65 72 67 65 ltip,Write Merge
11c80 20 46 69 6c 65 29 22 20 22 57 72 69 74 65 20 74 File)" "Write t
11c90 68 65 20 6d 65 72 67 65 20 66 69 6c 65 20 74 6f he merge file to
11ca0 20 64 69 73 6b 2e 20 59 6f 75 20 77 69 6c 6c 20 disk. You will
11cb0 5c 0a 20 20 20 20 20 20 20 62 65 20 70 72 6f 6d \. be prom
11cc0 70 74 65 64 20 66 6f 72 20 61 20 66 69 6c 65 6e pted for a filen
11cd0 61 6d 65 22 0a 0a 20 20 20 20 23 20 48 65 6c 70 ame".. # Help
11ce0 20 6d 65 6e 75 2e 20 49 66 20 79 6f 75 20 63 68 menu. If you ch
11cf0 61 6e 67 65 2c 20 61 64 64 20 6f 72 20 72 65 6d ange, add or rem
11d00 6f 76 65 20 6c 61 62 65 6c 73 2c 20 62 65 20 73 ove labels, be s
11d10 75 72 65 20 61 6e 64 0a 20 20 20 20 23 20 75 70 ure and. # up
11d20 64 61 74 65 20 74 68 65 20 74 6f 6f 6c 74 69 70 date the tooltip
11d30 73 2e 0a 20 20 20 20 6d 65 6e 75 20 24 68 65 6c s.. menu $hel
11d40 70 4d 65 6e 75 0a 20 20 20 20 24 68 65 6c 70 4d pMenu. $helpM
11d50 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 enu add command
11d60 2d 6c 61 62 65 6c 20 22 4f 6e 20 47 55 49 22 20 -label "On GUI"
11d70 2d 75 6e 64 65 72 6c 69 6e 65 20 33 20 2d 63 6f -underline 3 -co
11d80 6d 6d 61 6e 64 20 64 6f 2d 68 65 6c 70 0a 20 20 mmand do-help.
11d90 20 20 24 68 65 6c 70 4d 65 6e 75 20 61 64 64 20 $helpMenu add
11da0 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
11db0 4f 6e 20 43 6f 6d 6d 61 6e 64 20 4c 69 6e 65 22 On Command Line"
11dc0 20 2d 75 6e 64 65 72 6c 69 6e 65 20 33 20 5c 0a -underline 3 \.
11dd0 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 22 -command "
11de0 64 6f 2d 75 73 61 67 65 20 67 75 69 22 0a 20 20 do-usage gui".
11df0 20 20 24 68 65 6c 70 4d 65 6e 75 20 61 64 64 20 $helpMenu add
11e00 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
11e10 4f 6e 20 50 72 65 66 65 72 65 6e 63 65 73 22 20 On Preferences"
11e20 2d 75 6e 64 65 72 6c 69 6e 65 20 33 20 5c 0a 20 -underline 3 \.
11e30 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 64 6f -command do
11e40 2d 68 65 6c 70 2d 70 72 65 66 65 72 65 6e 63 65 -help-preference
11e50 73 0a 20 20 20 20 24 68 65 6c 70 4d 65 6e 75 20 s. $helpMenu
11e60 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20 add separator.
11e70 20 20 24 68 65 6c 70 4d 65 6e 75 20 61 64 64 20 $helpMenu add
11e80 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
11e90 41 62 6f 75 74 20 24 67 28 6e 61 6d 65 29 22 20 About $g(name)"
11ea0 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f -underline 0 -co
11eb0 6d 6d 61 6e 64 20 64 6f 2d 61 62 6f 75 74 0a 0a mmand do-about..
11ec0 20 20 20 20 62 69 6e 64 20 24 66 69 6c 65 4d 65 bind $fileMe
11ed0 6e 75 20 3c 3c 4d 65 6e 75 53 65 6c 65 63 74 3e nu <<MenuSelect>
11ee0 3e 20 7b 73 68 6f 77 54 6f 6f 6c 74 69 70 20 6d > {showTooltip m
11ef0 65 6e 75 20 25 57 7d 0a 20 20 20 20 62 69 6e 64 enu %W}. bind
11f00 20 24 65 64 69 74 4d 65 6e 75 20 3c 3c 4d 65 6e $editMenu <<Men
11f10 75 53 65 6c 65 63 74 3e 3e 20 7b 73 68 6f 77 54 uSelect>> {showT
11f20 6f 6f 6c 74 69 70 20 6d 65 6e 75 20 25 57 7d 0a ooltip menu %W}.
11f30 20 20 20 20 62 69 6e 64 20 24 76 69 65 77 4d 65 bind $viewMe
11f40 6e 75 20 3c 3c 4d 65 6e 75 53 65 6c 65 63 74 3e nu <<MenuSelect>
11f50 3e 20 7b 73 68 6f 77 54 6f 6f 6c 74 69 70 20 6d > {showTooltip m
11f60 65 6e 75 20 25 57 7d 0a 20 20 20 20 62 69 6e 64 enu %W}. bind
11f70 20 24 6d 61 72 6b 4d 65 6e 75 20 3c 3c 4d 65 6e $markMenu <<Men
11f80 75 53 65 6c 65 63 74 3e 3e 20 7b 73 68 6f 77 54 uSelect>> {showT
11f90 6f 6f 6c 74 69 70 20 6d 65 6e 75 20 25 57 7d 0a ooltip menu %W}.
11fa0 20 20 20 20 62 69 6e 64 20 24 6d 65 72 67 65 4d bind $mergeM
11fb0 65 6e 75 20 3c 3c 4d 65 6e 75 53 65 6c 65 63 74 enu <<MenuSelect
11fc0 3e 3e 20 7b 73 68 6f 77 54 6f 6f 6c 74 69 70 20 >> {showTooltip
11fd0 6d 65 6e 75 20 25 57 7d 0a 20 20 20 20 62 69 6e menu %W}. bin
11fe0 64 20 24 68 65 6c 70 4d 65 6e 75 20 3c 3c 4d 65 d $helpMenu <<Me
11ff0 6e 75 53 65 6c 65 63 74 3e 3e 20 7b 73 68 6f 77 nuSelect>> {show
12000 54 6f 6f 6c 74 69 70 20 6d 65 6e 75 20 25 57 7d Tooltip menu %W}
12010 0a 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f 6f .. set "g(too
12020 6c 74 69 70 2c 4f 6e 20 50 72 65 66 65 72 65 6e ltip,On Preferen
12030 63 65 73 29 22 20 22 53 68 6f 77 20 68 65 6c 70 ces)" "Show help
12040 20 6f 6e 20 74 68 65 20 75 73 65 72 2d 73 65 74 on the user-set
12050 74 61 62 6c 65 20 70 72 65 66 65 72 65 6e 63 65 table preference
12060 73 22 0a 20 20 20 20 73 65 74 20 22 67 28 74 6f s". set "g(to
12070 6f 6c 74 69 70 2c 4f 6e 20 47 55 49 29 22 20 22 oltip,On GUI)" "
12080 53 68 6f 77 20 68 65 6c 70 20 6f 6e 20 68 6f 77 Show help on how
12090 20 74 6f 20 75 73 65 20 74 68 65 20 47 72 61 70 to use the Grap
120a0 68 69 63 61 6c 20 55 73 65 72 20 5c 0a 20 20 20 hical User \.
120b0 20 20 20 49 6e 74 65 72 66 61 63 65 22 0a 20 20 Interface".
120c0 20 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 set "g(tooltip
120d0 2c 4f 6e 20 43 6f 6d 6d 61 6e 64 20 4c 69 6e 65 ,On Command Line
120e0 29 22 20 22 53 68 6f 77 20 68 65 6c 70 20 6f 6e )" "Show help on
120f0 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
12100 65 20 61 72 67 75 6d 65 6e 74 73 22 0a 20 20 20 e arguments".
12110 20 73 65 74 20 22 67 28 74 6f 6f 6c 74 69 70 2c set "g(tooltip,
12120 41 62 6f 75 74 20 24 67 28 6e 61 6d 65 29 29 22 About $g(name))"
12130 20 22 53 68 6f 77 20 69 6e 66 6f 72 6d 61 74 69 "Show informati
12140 6f 6e 20 61 62 6f 75 74 20 74 68 69 73 20 61 70 on about this ap
12150 70 6c 69 63 61 74 69 6f 6e 22 0a 7d 0a 0a 23 23 plication".}..##
12160 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12170 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12180 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12190 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
121a0 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 #############.#
121b0 53 68 6f 77 20 65 78 70 6c 61 6e 61 74 69 6f 6e Show explanation
121c0 20 6f 66 20 69 74 65 6d 20 69 6e 20 74 68 65 20 of item in the
121d0 73 74 61 74 75 73 20 62 61 72 20 61 74 20 74 68 status bar at th
121e0 65 20 62 6f 74 74 6f 6d 2e 0a 23 20 4e 6f 77 20 e bottom..# Now
121f0 75 73 65 64 20 6f 6e 6c 79 20 66 6f 72 20 6d 65 used only for me
12200 6e 75 20 69 74 65 6d 73 0a 23 23 23 23 23 23 23 nu items.#######
12210 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12220 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12230 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12240 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12250 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 73 68 ########.proc sh
12260 6f 77 54 6f 6f 6c 74 69 70 20 7b 77 68 69 63 68 owTooltip {which
12270 20 77 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c w} {. global
12280 20 74 6f 6f 6c 74 69 70 0a 20 20 20 20 67 6c 6f tooltip. glo
12290 62 61 6c 20 67 0a 20 20 20 20 73 77 69 74 63 68 bal g. switch
122a0 20 2d 2d 20 24 77 68 69 63 68 20 7b 0a 20 20 20 -- $which {.
122b0 20 6d 65 6e 75 20 7b 0a 09 20 20 20 20 69 66 20 menu {.. if
122c0 7b 5b 63 61 74 63 68 20 7b 24 77 20 65 6e 74 72 {[catch {$w entr
122d0 79 63 67 65 74 20 61 63 74 69 76 65 20 2d 6c 61 ycget active -la
122e0 62 65 6c 7d 20 6c 61 62 65 6c 5d 7d 20 7b 0a 09 bel} label]} {..
122f0 09 73 65 74 20 6c 61 62 65 6c 20 22 22 0a 09 20 .set label ""..
12300 20 20 20 7d 0a 09 20 20 20 20 69 66 20 7b 5b 69 }.. if {[i
12310 6e 66 6f 20 65 78 69 73 74 73 20 67 28 74 6f 6f nfo exists g(too
12320 6c 74 69 70 2c 24 6c 61 62 65 6c 29 5d 7d 20 7b ltip,$label)]} {
12330 0a 09 09 73 65 74 20 67 28 73 74 61 74 75 73 49 ...set g(statusI
12340 6e 66 6f 29 20 24 67 28 74 6f 6f 6c 74 69 70 2c nfo) $g(tooltip,
12350 24 6c 61 62 65 6c 29 0a 09 20 20 20 20 7d 20 65 $label).. } e
12360 6c 73 65 20 7b 0a 09 09 73 65 74 20 67 28 73 74 lse {...set g(st
12370 61 74 75 73 49 6e 66 6f 29 20 24 6c 61 62 65 6c atusInfo) $label
12380 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 75 70 64 .. }.. upd
12390 61 74 65 20 69 64 6c 65 74 61 73 6b 73 0a 09 7d ate idletasks..}
123a0 0a 20 20 20 20 62 75 74 74 6f 6e 20 7b 0a 09 20 . button {..
123b0 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
123c0 73 74 73 20 67 28 74 6f 6f 6c 74 69 70 2c 24 77 sts g(tooltip,$w
123d0 29 5d 7d 20 7b 0a 09 09 73 65 74 20 67 28 73 74 )]} {...set g(st
123e0 61 74 75 73 49 6e 66 6f 29 20 24 67 28 74 6f 6f atusInfo) $g(too
123f0 6c 74 69 70 2c 24 77 29 0a 09 20 20 20 20 7d 20 ltip,$w).. }
12400 65 6c 73 65 20 7b 0a 09 09 73 65 74 20 67 28 73 else {...set g(s
12410 74 61 74 75 73 49 6e 66 6f 29 20 22 22 0a 09 20 tatusInfo) ""..
12420 20 20 20 7d 0a 09 20 20 20 20 75 70 64 61 74 65 }.. update
12430 20 69 64 6c 65 74 61 73 6b 73 0a 09 7d 0a 20 20 idletasks..}.
12440 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 }.}..#########
12450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12460 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12470 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12480 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12490 23 23 23 23 23 23 0a 23 20 42 75 69 6c 64 20 74 ######.# Build t
124a0 68 65 20 74 6f 6f 6c 62 61 72 2c 20 69 6e 20 74 he toolbar, in t
124b0 65 78 74 20 6f 72 20 69 6d 61 67 65 20 6d 6f 64 ext or image mod
124c0 65 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 e.##############
124d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
124e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
124f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12500 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
12510 23 0a 70 72 6f 63 20 62 75 69 6c 64 2d 74 6f 6f #.proc build-too
12520 6c 62 61 72 20 7b 7d 20 7b 0a 20 20 20 20 64 65 lbar {} {. de
12530 62 75 67 2d 69 6e 66 6f 20 22 62 75 69 6c 64 2d bug-info "build-
12540 74 6f 6f 6c 62 61 72 22 0a 20 20 20 20 67 6c 6f toolbar". glo
12550 62 61 6c 20 77 20 67 0a 20 20 20 20 67 6c 6f 62 bal w g. glob
12560 61 6c 20 6f 70 74 73 0a 0a 20 20 20 20 66 72 61 al opts.. fra
12570 6d 65 20 24 77 28 74 6f 6f 6c 62 61 72 29 20 2d me $w(toolbar) -
12580 62 64 20 30 0a 0a 20 20 20 20 73 65 74 20 74 6f bd 0.. set to
12590 6f 6c 62 61 72 20 24 77 28 74 6f 6f 6c 62 61 72 olbar $w(toolbar
125a0 29 0a 0a 20 20 20 20 23 20 74 68 65 73 65 20 61 ).. # these a
125b0 72 65 20 75 73 65 64 20 69 6e 20 6f 74 68 65 72 re used in other
125c0 20 70 6c 61 63 65 73 2e 2e 0a 20 20 20 20 73 65 places... se
125d0 74 20 77 28 63 6f 6d 62 6f 29 20 24 74 6f 6f 6c t w(combo) $tool
125e0 62 61 72 2e 63 6f 6d 62 6f 0a 20 20 20 20 73 65 bar.combo. se
125f0 74 20 77 28 72 65 64 69 66 66 5f 69 6d 29 20 24 t w(rediff_im) $
12600 74 6f 6f 6c 62 61 72 2e 72 65 64 69 66 66 5f 69 toolbar.rediff_i
12610 6d 0a 20 20 20 20 73 65 74 20 77 28 72 65 64 69 m. set w(redi
12620 66 66 5f 74 78 29 20 24 74 6f 6f 6c 62 61 72 2e ff_tx) $toolbar.
12630 72 65 64 69 66 66 5f 74 78 0a 20 20 20 20 73 65 rediff_tx. se
12640 74 20 77 28 66 69 6e 64 5f 69 6d 29 20 24 74 6f t w(find_im) $to
12650 6f 6c 62 61 72 2e 66 69 6e 64 5f 69 6d 0a 20 20 olbar.find_im.
12660 20 20 73 65 74 20 77 28 66 69 6e 64 5f 74 78 29 set w(find_tx)
12670 20 24 74 6f 6f 6c 62 61 72 2e 66 69 6e 64 5f 74 $toolbar.find_t
12680 78 0a 20 20 20 20 73 65 74 20 77 28 6d 65 72 67 x. set w(merg
12690 65 43 68 6f 69 63 65 4c 61 62 65 6c 29 20 24 74 eChoiceLabel) $t
126a0 6f 6f 6c 62 61 72 2e 6d 65 72 67 65 63 68 6f 69 oolbar.mergechoi
126b0 63 65 6c 62 6c 0a 20 20 20 20 73 65 74 20 77 28 celbl. set w(
126c0 6d 65 72 67 65 43 68 6f 69 63 65 31 5f 69 6d 29 mergeChoice1_im)
126d0 20 24 74 6f 6f 6c 62 61 72 2e 6d 31 5f 69 6d 0a $toolbar.m1_im.
126e0 20 20 20 20 73 65 74 20 77 28 6d 65 72 67 65 43 set w(mergeC
126f0 68 6f 69 63 65 31 5f 74 78 29 20 24 74 6f 6f 6c hoice1_tx) $tool
12700 62 61 72 2e 6d 31 5f 74 78 0a 20 20 20 20 73 65 bar.m1_tx. se
12710 74 20 77 28 6d 65 72 67 65 43 68 6f 69 63 65 32 t w(mergeChoice2
12720 5f 69 6d 29 20 24 74 6f 6f 6c 62 61 72 2e 6d 32 _im) $toolbar.m2
12730 5f 69 6d 0a 20 20 20 20 73 65 74 20 77 28 6d 65 _im. set w(me
12740 72 67 65 43 68 6f 69 63 65 32 5f 74 78 29 20 24 rgeChoice2_tx) $
12750 74 6f 6f 6c 62 61 72 2e 6d 32 5f 74 78 0a 20 20 toolbar.m2_tx.
12760 20 20 73 65 74 20 77 28 6d 65 72 67 65 43 68 6f set w(mergeCho
12770 69 63 65 31 32 5f 69 6d 29 20 24 74 6f 6f 6c 62 ice12_im) $toolb
12780 61 72 2e 6d 31 32 5f 69 6d 0a 20 20 20 20 73 65 ar.m12_im. se
12790 74 20 77 28 6d 65 72 67 65 43 68 6f 69 63 65 31 t w(mergeChoice1
127a0 32 5f 74 78 29 20 24 74 6f 6f 6c 62 61 72 2e 6d 2_tx) $toolbar.m
127b0 31 32 5f 74 78 0a 20 20 20 20 73 65 74 20 77 28 12_tx. set w(
127c0 6d 65 72 67 65 43 68 6f 69 63 65 32 31 5f 69 6d mergeChoice21_im
127d0 29 20 24 74 6f 6f 6c 62 61 72 2e 6d 32 31 5f 69 ) $toolbar.m21_i
127e0 6d 0a 20 20 20 20 73 65 74 20 77 28 6d 65 72 67 m. set w(merg
127f0 65 43 68 6f 69 63 65 32 31 5f 74 78 29 20 24 74 eChoice21_tx) $t
12800 6f 6f 6c 62 61 72 2e 6d 32 31 5f 74 78 0a 20 20 oolbar.m21_tx.
12810 20 20 73 65 74 20 77 28 64 69 66 66 4e 61 76 4c set w(diffNavL
12820 61 62 65 6c 29 20 24 74 6f 6f 6c 62 61 72 2e 64 abel) $toolbar.d
12830 69 66 66 6e 61 76 6c 62 6c 0a 20 20 20 20 73 65 iffnavlbl. se
12840 74 20 77 28 70 72 65 76 44 69 66 66 5f 69 6d 29 t w(prevDiff_im)
12850 20 24 74 6f 6f 6c 62 61 72 2e 70 72 65 76 5f 69 $toolbar.prev_i
12860 6d 0a 20 20 20 20 73 65 74 20 77 28 70 72 65 76 m. set w(prev
12870 44 69 66 66 5f 74 78 29 20 24 74 6f 6f 6c 62 61 Diff_tx) $toolba
12880 72 2e 70 72 65 76 5f 74 78 0a 20 20 20 20 73 65 r.prev_tx. se
12890 74 20 77 28 66 69 72 73 74 44 69 66 66 5f 69 6d t w(firstDiff_im
128a0 29 20 24 74 6f 6f 6c 62 61 72 2e 66 69 72 73 74 ) $toolbar.first
128b0 5f 69 6d 0a 20 20 20 20 73 65 74 20 77 28 66 69 _im. set w(fi
128c0 72 73 74 44 69 66 66 5f 74 78 29 20 24 74 6f 6f rstDiff_tx) $too
128d0 6c 62 61 72 2e 66 69 72 73 74 5f 74 78 0a 20 20 lbar.first_tx.
128e0 20 20 73 65 74 20 77 28 6c 61 73 74 44 69 66 66 set w(lastDiff
128f0 5f 69 6d 29 20 24 74 6f 6f 6c 62 61 72 2e 6c 61 _im) $toolbar.la
12900 73 74 5f 69 6d 0a 20 20 20 20 73 65 74 20 77 28 st_im. set w(
12910 6c 61 73 74 44 69 66 66 5f 74 78 29 20 24 74 6f lastDiff_tx) $to
12920 6f 6c 62 61 72 2e 6c 61 73 74 5f 74 78 0a 20 20 olbar.last_tx.
12930 20 20 73 65 74 20 77 28 6e 65 78 74 44 69 66 66 set w(nextDiff
12940 5f 69 6d 29 20 24 74 6f 6f 6c 62 61 72 2e 6e 65 _im) $toolbar.ne
12950 78 74 5f 69 6d 0a 20 20 20 20 73 65 74 20 77 28 xt_im. set w(
12960 6e 65 78 74 44 69 66 66 5f 74 78 29 20 24 74 6f nextDiff_tx) $to
12970 6f 6c 62 61 72 2e 6e 65 78 74 5f 74 78 0a 20 20 olbar.next_tx.
12980 20 20 73 65 74 20 77 28 63 65 6e 74 65 72 44 69 set w(centerDi
12990 66 66 73 5f 69 6d 29 20 24 74 6f 6f 6c 62 61 72 ffs_im) $toolbar
129a0 2e 63 65 6e 74 65 72 5f 69 6d 0a 20 20 20 20 73 .center_im. s
129b0 65 74 20 77 28 63 65 6e 74 65 72 44 69 66 66 73 et w(centerDiffs
129c0 5f 74 78 29 20 24 74 6f 6f 6c 62 61 72 2e 63 65 _tx) $toolbar.ce
129d0 6e 74 65 72 5f 74 78 0a 20 20 20 20 73 65 74 20 nter_tx. set
129e0 77 28 6d 61 72 6b 4c 61 62 65 6c 29 20 24 74 6f w(markLabel) $to
129f0 6f 6c 62 61 72 2e 62 6b 6d 6b 6c 62 6c 0a 20 20 olbar.bkmklbl.
12a00 20 20 73 65 74 20 77 28 6d 61 72 6b 53 65 74 5f set w(markSet_
12a10 69 6d 29 20 24 74 6f 6f 6c 62 61 72 2e 62 6b 6d im) $toolbar.bkm
12a20 6b 73 65 74 5f 69 6d 0a 20 20 20 20 73 65 74 20 kset_im. set
12a30 77 28 6d 61 72 6b 53 65 74 5f 74 78 29 20 24 74 w(markSet_tx) $t
12a40 6f 6f 6c 62 61 72 2e 62 6b 6d 6b 73 65 74 5f 74 oolbar.bkmkset_t
12a50 78 0a 20 20 20 20 73 65 74 20 77 28 6d 61 72 6b x. set w(mark
12a60 43 6c 65 61 72 5f 69 6d 29 20 24 74 6f 6f 6c 62 Clear_im) $toolb
12a70 61 72 2e 62 6b 6d 6b 63 6c 65 61 72 5f 69 6d 0a ar.bkmkclear_im.
12a80 20 20 20 20 73 65 74 20 77 28 6d 61 72 6b 43 6c set w(markCl
12a90 65 61 72 5f 74 78 29 20 24 74 6f 6f 6c 62 61 72 ear_tx) $toolbar
12aa0 2e 62 6b 6d 6b 63 6c 65 61 72 5f 74 78 0a 0a 20 .bkmkclear_tx..
12ab0 20 20 20 23 20 73 65 70 61 72 61 74 6f 72 73 0a # separators.
12ac0 20 20 20 20 74 6f 6f 6c 73 65 70 20 24 74 6f 6f toolsep $too
12ad0 6c 62 61 72 2e 73 65 70 31 0a 20 20 20 20 74 6f lbar.sep1. to
12ae0 6f 6c 73 65 70 20 24 74 6f 6f 6c 62 61 72 2e 73 olsep $toolbar.s
12af0 65 70 32 0a 20 20 20 20 74 6f 6f 6c 73 65 70 20 ep2. toolsep
12b00 24 74 6f 6f 6c 62 61 72 2e 73 65 70 33 0a 20 20 $toolbar.sep3.
12b10 20 20 74 6f 6f 6c 73 65 70 20 24 74 6f 6f 6c 62 toolsep $toolb
12b20 61 72 2e 73 65 70 34 0a 20 20 20 20 74 6f 6f 6c ar.sep4. tool
12b30 73 65 70 20 24 74 6f 6f 6c 62 61 72 2e 73 65 70 sep $toolbar.sep
12b40 35 0a 20 20 20 20 74 6f 6f 6c 73 65 70 20 24 74 5. toolsep $t
12b50 6f 6f 6c 62 61 72 2e 73 65 70 36 0a 0a 20 20 20 oolbar.sep6..
12b60 20 23 20 54 68 65 20 63 6f 6d 62 6f 20 62 6f 78 # The combo box
12b70 0a 20 20 20 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a . ::combobox:
12b80 3a 63 6f 6d 62 6f 62 6f 78 20 24 74 6f 6f 6c 62 :combobox $toolb
12b90 61 72 2e 63 6f 6d 62 6f 20 2d 62 6f 72 64 65 72 ar.combo -border
12ba0 77 69 64 74 68 20 31 20 2d 65 64 69 74 61 62 6c width 1 -editabl
12bb0 65 20 66 61 6c 73 65 20 5c 0a 20 20 20 20 20 20 e false \.
12bc0 2d 63 6f 6d 6d 61 6e 64 20 6d 6f 76 65 54 6f 20 -command moveTo
12bd0 2d 77 69 64 74 68 20 32 30 0a 0a 20 20 20 20 23 -width 20.. #
12be0 20 72 65 64 69 66 66 2e 2e 2e 0a 20 20 20 20 74 rediff.... t
12bf0 6f 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 oolbutton $toolb
12c00 61 72 2e 72 65 64 69 66 66 5f 69 6d 20 2d 69 6d ar.rediff_im -im
12c10 61 67 65 20 72 65 64 69 66 66 49 6d 61 67 65 20 age rediffImage
12c20 2d 63 6f 6d 6d 61 6e 64 20 72 65 63 6f 6d 70 75 -command recompu
12c30 74 65 2d 64 69 66 66 20 5c 0a 20 20 20 20 20 20 te-diff \.
12c40 2d 62 64 20 31 0a 20 20 20 20 74 6f 6f 6c 62 75 -bd 1. toolbu
12c50 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 72 65 tton $toolbar.re
12c60 64 69 66 66 5f 74 78 20 2d 74 65 78 74 20 22 52 diff_tx -text "R
12c70 65 64 69 66 66 22 20 2d 63 6f 6d 6d 61 6e 64 20 ediff" -command
12c80 72 65 63 6f 6d 70 75 74 65 2d 64 69 66 66 20 5c recompute-diff \
12c90 0a 20 20 20 20 20 20 2d 62 64 20 31 20 2d 70 61 . -bd 1 -pa
12ca0 64 79 20 31 0a 0a 20 20 20 20 23 20 66 69 6e 64 dy 1.. # find
12cb0 2e 2e 2e 0a 20 20 20 20 74 6f 6f 6c 62 75 74 74 .... toolbutt
12cc0 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 66 69 6e 64 on $toolbar.find
12cd0 5f 69 6d 20 2d 69 6d 61 67 65 20 66 69 6e 64 49 _im -image findI
12ce0 6d 61 67 65 20 2d 63 6f 6d 6d 61 6e 64 20 64 6f mage -command do
12cf0 2d 66 69 6e 64 20 2d 62 64 20 31 0a 20 20 20 20 -find -bd 1.
12d00 74 6f 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c toolbutton $tool
12d10 62 61 72 2e 66 69 6e 64 5f 74 78 20 2d 74 65 78 bar.find_tx -tex
12d20 74 20 22 46 69 6e 64 22 20 2d 63 6f 6d 6d 61 6e t "Find" -comman
12d30 64 20 64 6f 2d 66 69 6e 64 20 2d 62 64 20 31 20 d do-find -bd 1
12d40 2d 70 61 64 79 20 31 0a 0a 20 20 20 20 23 20 6e -pady 1.. # n
12d50 61 76 69 67 61 74 69 6f 6e 20 77 69 64 67 65 74 avigation widget
12d60 73 0a 20 20 20 20 6c 61 62 65 6c 20 24 74 6f 6f s. label $too
12d70 6c 62 61 72 2e 64 69 66 66 6e 61 76 6c 62 6c 20 lbar.diffnavlbl
12d80 2d 74 65 78 74 20 22 44 69 66 66 3a 22 20 2d 70 -text "Diff:" -p
12d90 61 64 79 20 30 20 2d 62 64 20 32 20 2d 72 65 6c ady 0 -bd 2 -rel
12da0 69 65 66 20 67 72 6f 6f 76 65 0a 0a 20 20 20 20 ief groove..
12db0 74 6f 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c toolbutton $tool
12dc0 62 61 72 2e 70 72 65 76 5f 69 6d 20 2d 69 6d 61 bar.prev_im -ima
12dd0 67 65 20 70 72 65 76 44 69 66 66 49 6d 61 67 65 ge prevDiffImage
12de0 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
12df0 6d 6f 76 65 20 2d 31 5d 20 5c 0a 20 20 20 20 20 move -1] \.
12e00 20 2d 62 64 20 31 0a 20 20 20 20 74 6f 6f 6c 62 -bd 1. toolb
12e10 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 70 utton $toolbar.p
12e20 72 65 76 5f 74 78 20 2d 74 65 78 74 20 22 50 72 rev_tx -text "Pr
12e30 65 76 22 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 ev" -command [li
12e40 73 74 20 6d 6f 76 65 20 2d 31 5d 20 2d 62 64 20 st move -1] -bd
12e50 31 20 5c 0a 20 20 20 20 20 20 2d 70 61 64 79 20 1 \. -pady
12e60 31 0a 0a 20 20 20 20 74 6f 6f 6c 62 75 74 74 6f 1.. toolbutto
12e70 6e 20 24 74 6f 6f 6c 62 61 72 2e 6e 65 78 74 5f n $toolbar.next_
12e80 69 6d 20 2d 69 6d 61 67 65 20 6e 65 78 74 44 69 im -image nextDi
12e90 66 66 49 6d 61 67 65 20 2d 63 6f 6d 6d 61 6e 64 ffImage -command
12ea0 20 5b 6c 69 73 74 20 6d 6f 76 65 20 31 5d 20 5c [list move 1] \
12eb0 0a 20 20 20 20 20 20 2d 62 64 20 31 0a 20 20 20 . -bd 1.
12ec0 20 74 6f 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f toolbutton $too
12ed0 6c 62 61 72 2e 6e 65 78 74 5f 74 78 20 2d 74 65 lbar.next_tx -te
12ee0 78 74 20 22 4e 65 78 74 22 20 2d 63 6f 6d 6d 61 xt "Next" -comma
12ef0 6e 64 20 5b 6c 69 73 74 20 6d 6f 76 65 20 31 5d nd [list move 1]
12f00 20 2d 62 64 20 31 20 5c 0a 20 20 20 20 20 20 2d -bd 1 \. -
12f10 70 61 64 79 20 31 0a 0a 20 20 20 20 74 6f 6f 6c pady 1.. tool
12f20 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e button $toolbar.
12f30 66 69 72 73 74 5f 69 6d 20 2d 69 6d 61 67 65 20 first_im -image
12f40 66 69 72 73 74 44 69 66 66 49 6d 61 67 65 20 2d firstDiffImage -
12f50 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 6d 6f command [list mo
12f60 76 65 20 5c 0a 20 20 20 20 20 20 66 69 72 73 74 ve \. first
12f70 5d 20 2d 62 64 20 31 0a 20 20 20 20 74 6f 6f 6c ] -bd 1. tool
12f80 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e button $toolbar.
12f90 66 69 72 73 74 5f 74 78 20 2d 74 65 78 74 20 22 first_tx -text "
12fa0 46 69 72 73 74 22 20 2d 63 6f 6d 6d 61 6e 64 20 First" -command
12fb0 5b 6c 69 73 74 20 6d 6f 76 65 20 66 69 72 73 74 [list move first
12fc0 5d 20 5c 0a 20 20 20 20 20 20 2d 62 64 20 31 20 ] \. -bd 1
12fd0 2d 70 61 64 79 20 31 0a 0a 20 20 20 20 74 6f 6f -pady 1.. too
12fe0 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 lbutton $toolbar
12ff0 2e 6c 61 73 74 5f 69 6d 20 2d 69 6d 61 67 65 20 .last_im -image
13000 6c 61 73 74 44 69 66 66 49 6d 61 67 65 20 2d 63 lastDiffImage -c
13010 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 6d 6f 76 ommand [list mov
13020 65 20 5c 0a 20 20 20 20 20 20 6c 61 73 74 5d 20 e \. last]
13030 2d 62 64 20 31 0a 20 20 20 20 74 6f 6f 6c 62 75 -bd 1. toolbu
13040 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 6c 61 tton $toolbar.la
13050 73 74 5f 74 78 20 2d 74 65 78 74 20 22 4c 61 73 st_tx -text "Las
13060 74 22 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 t" -command [lis
13070 74 20 6d 6f 76 65 20 6c 61 73 74 5d 20 2d 62 64 t move last] -bd
13080 20 31 20 5c 0a 20 20 20 20 20 20 2d 70 61 64 79 1 \. -pady
13090 20 31 0a 0a 20 20 20 20 74 6f 6f 6c 62 75 74 74 1.. toolbutt
130a0 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 63 65 6e 74 on $toolbar.cent
130b0 65 72 5f 69 6d 20 2d 69 6d 61 67 65 20 63 65 6e er_im -image cen
130c0 74 65 72 44 69 66 66 73 49 6d 61 67 65 20 2d 63 terDiffsImage -c
130d0 6f 6d 6d 61 6e 64 20 63 65 6e 74 65 72 20 2d 62 ommand center -b
130e0 64 20 31 0a 20 20 20 20 74 6f 6f 6c 62 75 74 74 d 1. toolbutt
130f0 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 63 65 6e 74 on $toolbar.cent
13100 65 72 5f 74 78 20 2d 74 65 78 74 20 22 43 65 6e er_tx -text "Cen
13110 74 65 72 22 20 2d 63 6f 6d 6d 61 6e 64 20 63 65 ter" -command ce
13120 6e 74 65 72 20 2d 62 64 20 31 20 2d 70 61 64 79 nter -bd 1 -pady
13130 20 31 0a 0a 20 20 20 20 23 20 74 68 65 20 6d 65 1.. # the me
13140 72 67 65 20 77 69 64 67 65 74 73 0a 20 20 20 20 rge widgets.
13150 6c 61 62 65 6c 20 24 74 6f 6f 6c 62 61 72 2e 6d label $toolbar.m
13160 65 72 67 65 63 68 6f 69 63 65 6c 62 6c 20 2d 74 ergechoicelbl -t
13170 65 78 74 20 22 4d 65 72 67 65 3a 22 20 2d 70 61 ext "Merge:" -pa
13180 64 79 20 30 20 2d 62 64 20 32 20 2d 72 65 6c 69 dy 0 -bd 2 -reli
13190 65 66 20 67 72 6f 6f 76 65 0a 0a 20 20 20 20 72 ef groove.. r
131a0 61 64 69 6f 62 75 74 74 6f 6e 20 24 74 6f 6f 6c adiobutton $tool
131b0 62 61 72 2e 6d 32 5f 69 6d 20 2d 62 6f 72 64 65 bar.m2_im -borde
131c0 72 77 69 64 74 68 20 31 20 2d 69 6e 64 69 63 61 rwidth 1 -indica
131d0 74 6f 72 6f 6e 20 66 61 6c 73 65 20 5c 0a 20 20 toron false \.
131e0 20 20 20 20 2d 69 6d 61 67 65 20 6d 65 72 67 65 -image merge
131f0 43 68 6f 69 63 65 32 49 6d 61 67 65 20 2d 76 61 Choice2Image -va
13200 6c 75 65 20 32 20 2d 76 61 72 69 61 62 6c 65 20 lue 2 -variable
13210 67 28 74 6f 67 67 6c 65 29 20 2d 63 6f 6d 6d 61 g(toggle) -comma
13220 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 73 74 nd \. [list
13230 20 64 6f 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 do-merge-choice
13240 20 32 5d 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 2] -takefocus 0
13250 0a 20 20 20 20 72 61 64 69 6f 62 75 74 74 6f 6e . radiobutton
13260 20 24 74 6f 6f 6c 62 61 72 2e 6d 32 5f 74 78 20 $toolbar.m2_tx
13270 2d 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 2d -borderwidth 1 -
13280 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 75 65 indicatoron true
13290 20 2d 74 65 78 74 20 22 52 22 20 5c 0a 20 20 20 -text "R" \.
132a0 20 20 20 2d 76 61 6c 75 65 20 32 20 2d 76 61 72 -value 2 -var
132b0 69 61 62 6c 65 20 67 28 74 6f 67 67 6c 65 29 20 iable g(toggle)
132c0 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 64 -command [list d
132d0 6f 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 20 32 o-merge-choice 2
132e0 5d 20 5c 0a 20 20 20 20 20 20 2d 74 61 6b 65 66 ] \. -takef
132f0 6f 63 75 73 20 30 0a 0a 20 20 20 20 72 61 64 69 ocus 0.. radi
13300 6f 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 obutton $toolbar
13310 2e 6d 31 5f 69 6d 20 2d 62 6f 72 64 65 72 77 69 .m1_im -borderwi
13320 64 74 68 20 31 20 2d 69 6e 64 69 63 61 74 6f 72 dth 1 -indicator
13330 6f 6e 20 66 61 6c 73 65 20 5c 0a 20 20 20 20 20 on false \.
13340 20 2d 69 6d 61 67 65 20 6d 65 72 67 65 43 68 6f -image mergeCho
13350 69 63 65 31 49 6d 61 67 65 20 2d 76 61 6c 75 65 ice1Image -value
13360 20 31 20 2d 76 61 72 69 61 62 6c 65 20 67 28 74 1 -variable g(t
13370 6f 67 67 6c 65 29 20 2d 63 6f 6d 6d 61 6e 64 20 oggle) -command
13380 5c 0a 20 20 20 20 20 20 5b 6c 69 73 74 20 64 6f \. [list do
13390 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 20 31 5d -merge-choice 1]
133a0 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 0a 20 20 -takefocus 0.
133b0 20 20 72 61 64 69 6f 62 75 74 74 6f 6e 20 24 74 radiobutton $t
133c0 6f 6f 6c 62 61 72 2e 6d 31 5f 74 78 20 2d 62 6f oolbar.m1_tx -bo
133d0 72 64 65 72 77 69 64 74 68 20 31 20 2d 69 6e 64 rderwidth 1 -ind
133e0 69 63 61 74 6f 72 6f 6e 20 74 72 75 65 20 2d 74 icatoron true -t
133f0 65 78 74 20 22 4c 22 20 5c 0a 20 20 20 20 20 20 ext "L" \.
13400 2d 76 61 6c 75 65 20 31 20 2d 76 61 72 69 61 62 -value 1 -variab
13410 6c 65 20 67 28 74 6f 67 67 6c 65 29 20 2d 63 6f le g(toggle) -co
13420 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 64 6f 2d 6d mmand [list do-m
13430 65 72 67 65 2d 63 68 6f 69 63 65 20 31 5d 20 5c erge-choice 1] \
13440 0a 20 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 . -takefocu
13450 73 20 30 0a 0a 20 20 20 20 72 61 64 69 6f 62 75 s 0.. radiobu
13460 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 6d 31 tton $toolbar.m1
13470 32 5f 69 6d 20 2d 62 6f 72 64 65 72 77 69 64 74 2_im -borderwidt
13480 68 20 31 20 2d 69 6e 64 69 63 61 74 6f 72 6f 6e h 1 -indicatoron
13490 20 66 61 6c 73 65 20 5c 0a 20 20 20 20 20 20 2d false \. -
134a0 69 6d 61 67 65 20 6d 65 72 67 65 43 68 6f 69 63 image mergeChoic
134b0 65 31 32 49 6d 61 67 65 20 2d 76 61 6c 75 65 20 e12Image -value
134c0 31 32 20 2d 76 61 72 69 61 62 6c 65 20 67 28 74 12 -variable g(t
134d0 6f 67 67 6c 65 29 20 2d 63 6f 6d 6d 61 6e 64 20 oggle) -command
134e0 5c 0a 20 20 20 20 20 20 5b 6c 69 73 74 20 64 6f \. [list do
134f0 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 20 31 32 -merge-choice 12
13500 5d 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 0a 20 ] -takefocus 0.
13510 20 20 20 72 61 64 69 6f 62 75 74 74 6f 6e 20 24 radiobutton $
13520 74 6f 6f 6c 62 61 72 2e 6d 31 32 5f 74 78 20 2d toolbar.m12_tx -
13530 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 2d 69 borderwidth 1 -i
13540 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 75 65 20 ndicatoron true
13550 2d 74 65 78 74 20 22 4c 52 22 20 5c 0a 20 20 20 -text "LR" \.
13560 20 20 20 2d 76 61 6c 75 65 20 31 32 20 2d 76 61 -value 12 -va
13570 72 69 61 62 6c 65 20 67 28 74 6f 67 67 6c 65 29 riable g(toggle)
13580 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
13590 64 6f 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 20 do-merge-choice
135a0 31 32 5d 20 5c 0a 20 20 20 20 20 20 2d 74 61 6b 12] \. -tak
135b0 65 66 6f 63 75 73 20 30 0a 0a 20 20 20 20 72 61 efocus 0.. ra
135c0 64 69 6f 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 diobutton $toolb
135d0 61 72 2e 6d 32 31 5f 69 6d 20 2d 62 6f 72 64 65 ar.m21_im -borde
135e0 72 77 69 64 74 68 20 31 20 2d 69 6e 64 69 63 61 rwidth 1 -indica
135f0 74 6f 72 6f 6e 20 66 61 6c 73 65 20 5c 0a 20 20 toron false \.
13600 20 20 20 20 2d 69 6d 61 67 65 20 6d 65 72 67 65 -image merge
13610 43 68 6f 69 63 65 32 31 49 6d 61 67 65 20 2d 76 Choice21Image -v
13620 61 6c 75 65 20 32 31 20 2d 76 61 72 69 61 62 6c alue 21 -variabl
13630 65 20 67 28 74 6f 67 67 6c 65 29 20 2d 63 6f 6d e g(toggle) -com
13640 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 mand \. [li
13650 73 74 20 64 6f 2d 6d 65 72 67 65 2d 63 68 6f 69 st do-merge-choi
13660 63 65 20 32 31 5d 20 2d 74 61 6b 65 66 6f 63 75 ce 21] -takefocu
13670 73 20 30 0a 20 20 20 20 72 61 64 69 6f 62 75 74 s 0. radiobut
13680 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 2e 6d 32 31 ton $toolbar.m21
13690 5f 74 78 20 2d 62 6f 72 64 65 72 77 69 64 74 68 _tx -borderwidth
136a0 20 31 20 2d 69 6e 64 69 63 61 74 6f 72 6f 6e 20 1 -indicatoron
136b0 74 72 75 65 20 2d 74 65 78 74 20 22 52 4c 22 20 true -text "RL"
136c0 5c 0a 20 20 20 20 20 20 2d 76 61 6c 75 65 20 32 \. -value 2
136d0 31 20 2d 76 61 72 69 61 62 6c 65 20 67 28 74 6f 1 -variable g(to
136e0 67 67 6c 65 29 20 2d 63 6f 6d 6d 61 6e 64 20 5b ggle) -command [
136f0 6c 69 73 74 20 64 6f 2d 6d 65 72 67 65 2d 63 68 list do-merge-ch
13700 6f 69 63 65 20 32 31 5d 20 5c 0a 20 20 20 20 20 oice 21] \.
13710 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 0a 0a 20 -takefocus 0..
13720 20 20 20 23 20 54 68 65 20 62 6f 6f 6b 6d 61 72 # The bookmar
13730 6b 73 0a 20 20 20 20 6c 61 62 65 6c 20 24 74 6f ks. label $to
13740 6f 6c 62 61 72 2e 62 6b 6d 6b 6c 62 6c 20 2d 74 olbar.bkmklbl -t
13750 65 78 74 20 22 4d 61 72 6b 3a 22 20 2d 70 61 64 ext "Mark:" -pad
13760 79 20 30 20 2d 62 64 20 32 20 2d 72 65 6c 69 65 y 0 -bd 2 -relie
13770 66 20 67 72 6f 6f 76 65 0a 0a 20 20 20 20 74 6f f groove.. to
13780 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 olbutton $toolba
13790 72 2e 62 6b 6d 6b 73 65 74 5f 69 6d 20 2d 69 6d r.bkmkset_im -im
137a0 61 67 65 20 6d 61 72 6b 53 65 74 49 6d 61 67 65 age markSetImage
137b0 20 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 -command \.
137c0 20 20 5b 6c 69 73 74 20 64 69 66 66 6d 61 72 6b [list diffmark
137d0 20 6d 61 72 6b 5d 20 2d 62 64 20 31 0a 20 20 20 mark] -bd 1.
137e0 20 74 6f 6f 6c 62 75 74 74 6f 6e 20 24 74 6f 6f toolbutton $too
137f0 6c 62 61 72 2e 62 6b 6d 6b 73 65 74 5f 74 78 20 lbar.bkmkset_tx
13800 2d 74 65 78 74 20 22 53 65 74 22 20 2d 63 6f 6d -text "Set" -com
13810 6d 61 6e 64 20 5b 6c 69 73 74 20 64 69 66 66 6d mand [list diffm
13820 61 72 6b 20 6d 61 72 6b 5d 20 5c 0a 20 20 20 20 ark mark] \.
13830 20 20 2d 62 64 20 31 20 2d 70 61 64 79 20 31 0a -bd 1 -pady 1.
13840 0a 20 20 20 20 74 6f 6f 6c 62 75 74 74 6f 6e 20 . toolbutton
13850 24 74 6f 6f 6c 62 61 72 2e 62 6b 6d 6b 63 6c 65 $toolbar.bkmkcle
13860 61 72 5f 69 6d 20 2d 69 6d 61 67 65 20 6d 61 72 ar_im -image mar
13870 6b 43 6c 65 61 72 49 6d 61 67 65 20 2d 63 6f 6d kClearImage -com
13880 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 5b 6c 69 mand \. [li
13890 73 74 20 64 69 66 66 6d 61 72 6b 20 63 6c 65 61 st diffmark clea
138a0 72 5d 20 2d 62 64 20 31 0a 20 20 20 20 74 6f 6f r] -bd 1. too
138b0 6c 62 75 74 74 6f 6e 20 24 74 6f 6f 6c 62 61 72 lbutton $toolbar
138c0 2e 62 6b 6d 6b 63 6c 65 61 72 5f 74 78 20 2d 74 .bkmkclear_tx -t
138d0 65 78 74 20 22 43 6c 65 61 72 22 20 2d 63 6f 6d ext "Clear" -com
138e0 6d 61 6e 64 20 5b 6c 69 73 74 20 64 69 66 66 6d mand [list diffm
138f0 61 72 6b 20 5c 0a 20 20 20 20 20 20 63 6c 65 61 ark \. clea
13900 72 5d 20 2d 62 64 20 31 20 2d 70 61 64 79 20 31 r] -bd 1 -pady 1
13910 0a 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 .. set_toolti
13920 70 73 20 24 77 28 66 69 6e 64 5f 69 6d 29 20 7b ps $w(find_im) {
13930 22 50 6f 70 20 75 70 20 61 20 64 69 61 6c 6f 67 "Pop up a dialog
13940 20 74 6f 20 73 65 61 72 63 68 20 66 6f 72 20 61 to search for a
13950 20 73 74 72 69 6e 67 20 77 69 74 68 69 6e 20 5c string within \
13960 0a 20 20 20 20 20 20 65 69 74 68 65 72 20 66 69 . either fi
13970 6c 65 22 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f le"}. set_too
13980 6c 74 69 70 73 20 24 77 28 66 69 6e 64 5f 74 78 ltips $w(find_tx
13990 29 20 7b 22 50 6f 70 20 75 70 20 61 20 64 69 61 ) {"Pop up a dia
139a0 6c 6f 67 20 74 6f 20 73 65 61 72 63 68 20 66 6f log to search fo
139b0 72 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 69 r a string withi
139c0 6e 20 5c 0a 20 20 20 20 20 20 65 69 74 68 65 72 n \. either
139d0 20 66 69 6c 65 22 7d 0a 20 20 20 20 73 65 74 5f file"}. set_
139e0 74 6f 6f 6c 74 69 70 73 20 24 77 28 72 65 64 69 tooltips $w(redi
139f0 66 66 5f 69 6d 29 20 7b 22 52 65 63 6f 6d 70 75 ff_im) {"Recompu
13a00 74 65 20 61 6e 64 20 72 65 64 69 73 70 6c 61 79 te and redisplay
13a10 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 the difference
13a20 5c 0a 20 20 20 20 20 20 72 65 63 6f 72 64 73 22 \. records"
13a30 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 }. set_toolti
13a40 70 73 20 24 77 28 72 65 64 69 66 66 5f 74 78 29 ps $w(rediff_tx)
13a50 20 7b 22 52 65 63 6f 6d 70 75 74 65 20 61 6e 64 {"Recompute and
13a60 20 72 65 64 69 73 70 6c 61 79 20 74 68 65 20 64 redisplay the d
13a70 69 66 66 65 72 65 6e 63 65 20 5c 0a 20 20 20 20 ifference \.
13a80 20 20 72 65 63 6f 72 64 73 22 7d 0a 20 20 20 20 records"}.
13a90 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 24 77 28 set_tooltips $w(
13aa0 6d 65 72 67 65 43 68 6f 69 63 65 31 32 5f 69 6d mergeChoice12_im
13ab0 29 20 7b 22 73 65 6c 65 63 74 20 74 68 65 20 64 ) {"select the d
13ac0 69 66 66 20 6f 6e 20 74 68 65 20 6c 65 66 74 20 iff on the left
13ad0 74 68 65 6e 20 5c 0a 20 20 20 20 20 20 72 69 67 then \. rig
13ae0 68 74 20 66 6f 72 20 20 6d 65 72 67 69 6e 67 22 ht for merging"
13af0 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 }. set_toolti
13b00 70 73 20 24 77 28 6d 65 72 67 65 43 68 6f 69 63 ps $w(mergeChoic
13b10 65 31 32 5f 74 78 29 20 7b 22 73 65 6c 65 63 74 e12_tx) {"select
13b20 20 74 68 65 20 64 69 66 66 20 6f 6e 20 74 68 65 the diff on the
13b30 20 6c 65 66 74 20 74 68 65 6e 20 5c 0a 20 20 20 left then \.
13b40 20 20 20 72 69 67 68 74 20 66 6f 72 20 20 6d 65 right for me
13b50 72 67 69 6e 67 22 7d 0a 20 20 20 20 73 65 74 5f rging"}. set_
13b60 74 6f 6f 6c 74 69 70 73 20 24 77 28 6d 65 72 67 tooltips $w(merg
13b70 65 43 68 6f 69 63 65 31 5f 69 6d 29 20 7b 22 73 eChoice1_im) {"s
13b80 65 6c 65 63 74 20 74 68 65 20 64 69 66 66 20 6f elect the diff o
13b90 6e 20 74 68 65 20 6c 65 66 74 20 66 6f 72 20 6d n the left for m
13ba0 65 72 67 69 6e 67 22 7d 0a 20 20 20 20 73 65 74 erging"}. set
13bb0 5f 74 6f 6f 6c 74 69 70 73 20 24 77 28 6d 65 72 _tooltips $w(mer
13bc0 67 65 43 68 6f 69 63 65 31 5f 74 78 29 20 7b 22 geChoice1_tx) {"
13bd0 73 65 6c 65 63 74 20 74 68 65 20 64 69 66 66 20 select the diff
13be0 6f 6e 20 74 68 65 20 6c 65 66 74 20 66 6f 72 20 on the left for
13bf0 6d 65 72 67 69 6e 67 22 7d 0a 20 20 20 20 73 65 merging"}. se
13c00 74 5f 74 6f 6f 6c 74 69 70 73 20 24 77 28 6d 65 t_tooltips $w(me
13c10 72 67 65 43 68 6f 69 63 65 32 5f 69 6d 29 20 7b rgeChoice2_im) {
13c20 22 73 65 6c 65 63 74 20 74 68 65 20 64 69 66 66 "select the diff
13c30 20 6f 6e 20 74 68 65 20 72 69 67 68 74 20 66 6f on the right fo
13c40 72 20 5c 0a 20 20 20 20 20 20 6d 65 72 67 69 6e r \. mergin
13c50 67 22 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c g"}. set_tool
13c60 74 69 70 73 20 24 77 28 6d 65 72 67 65 43 68 6f tips $w(mergeCho
13c70 69 63 65 32 5f 74 78 29 20 7b 22 73 65 6c 65 63 ice2_tx) {"selec
13c80 74 20 74 68 65 20 64 69 66 66 20 6f 6e 20 74 68 t the diff on th
13c90 65 20 72 69 67 68 74 20 66 6f 72 20 5c 0a 20 20 e right for \.
13ca0 20 20 20 20 6d 65 72 67 69 6e 67 22 7d 0a 20 20 merging"}.
13cb0 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 24 set_tooltips $
13cc0 77 28 6d 65 72 67 65 43 68 6f 69 63 65 32 31 5f w(mergeChoice21_
13cd0 69 6d 29 20 7b 22 73 65 6c 65 63 74 20 74 68 65 im) {"select the
13ce0 20 64 69 66 66 20 6f 6e 20 74 68 65 20 72 69 67 diff on the rig
13cf0 68 74 20 74 68 65 6e 20 5c 0a 20 20 20 20 20 20 ht then \.
13d00 6c 65 66 74 20 66 6f 72 20 20 6d 65 72 67 69 6e left for mergin
13d10 67 22 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c g"}. set_tool
13d20 74 69 70 73 20 24 77 28 6d 65 72 67 65 43 68 6f tips $w(mergeCho
13d30 69 63 65 32 31 5f 74 78 29 20 7b 22 73 65 6c 65 ice21_tx) {"sele
13d40 63 74 20 74 68 65 20 64 69 66 66 20 6f 6e 20 74 ct the diff on t
13d50 68 65 20 72 69 67 68 74 20 74 68 65 6e 20 5c 0a he right then \.
13d60 20 20 20 20 20 20 6c 65 66 74 20 66 6f 72 20 20 left for
13d70 6d 65 72 67 69 6e 67 22 7d 0a 20 20 20 20 73 65 merging"}. se
13d80 74 5f 74 6f 6f 6c 74 69 70 73 20 24 77 28 70 72 t_tooltips $w(pr
13d90 65 76 44 69 66 66 5f 69 6d 29 20 7b 22 50 72 65 evDiff_im) {"Pre
13da0 76 69 6f 75 73 20 44 69 66 66 22 7d 0a 20 20 20 vious Diff"}.
13db0 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 24 77 set_tooltips $w
13dc0 28 70 72 65 76 44 69 66 66 5f 74 78 29 20 7b 22 (prevDiff_tx) {"
13dd0 50 72 65 76 69 6f 75 73 20 44 69 66 66 22 7d 0a Previous Diff"}.
13de0 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 set_tooltips
13df0 20 24 77 28 6e 65 78 74 44 69 66 66 5f 69 6d 29 $w(nextDiff_im)
13e00 20 7b 22 4e 65 78 74 20 44 69 66 66 22 7d 0a 20 {"Next Diff"}.
13e10 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 set_tooltips
13e20 24 77 28 6e 65 78 74 44 69 66 66 5f 74 78 29 20 $w(nextDiff_tx)
13e30 7b 22 4e 65 78 74 20 44 69 66 66 22 7d 0a 20 20 {"Next Diff"}.
13e40 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 24 set_tooltips $
13e50 77 28 66 69 72 73 74 44 69 66 66 5f 69 6d 29 20 w(firstDiff_im)
13e60 7b 22 46 69 72 73 74 20 44 69 66 66 22 7d 0a 20 {"First Diff"}.
13e70 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 set_tooltips
13e80 24 77 28 66 69 72 73 74 44 69 66 66 5f 74 78 29 $w(firstDiff_tx)
13e90 20 7b 22 46 69 72 73 74 20 44 69 66 66 22 7d 0a {"First Diff"}.
13ea0 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 set_tooltips
13eb0 20 24 77 28 6c 61 73 74 44 69 66 66 5f 69 6d 29 $w(lastDiff_im)
13ec0 20 7b 22 4c 61 73 74 20 44 69 66 66 22 7d 0a 20 {"Last Diff"}.
13ed0 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 set_tooltips
13ee0 24 77 28 6c 61 73 74 44 69 66 66 5f 74 78 29 20 $w(lastDiff_tx)
13ef0 7b 22 4c 61 73 74 20 44 69 66 66 22 7d 0a 20 20 {"Last Diff"}.
13f00 20 20 73 65 74 5f 74 6f 6f 6c 74 69 70 73 20 24 set_tooltips $
13f10 77 28 6d 61 72 6b 53 65 74 5f 69 6d 29 20 7b 22 w(markSet_im) {"
13f20 4d 61 72 6b 20 63 75 72 72 65 6e 74 20 64 69 66 Mark current dif
13f30 66 22 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c f"}. set_tool
13f40 74 69 70 73 20 24 77 28 6d 61 72 6b 53 65 74 5f tips $w(markSet_
13f50 74 78 29 20 7b 22 4d 61 72 6b 20 63 75 72 72 65 tx) {"Mark curre
13f60 6e 74 20 64 69 66 66 22 7d 0a 20 20 20 20 73 65 nt diff"}. se
13f70 74 5f 74 6f 6f 6c 74 69 70 73 20 24 77 28 6d 61 t_tooltips $w(ma
13f80 72 6b 43 6c 65 61 72 5f 69 6d 29 20 7b 22 43 6c rkClear_im) {"Cl
13f90 65 61 72 20 63 75 72 72 65 6e 74 20 64 69 66 66 ear current diff
13fa0 20 6d 61 72 6b 22 7d 0a 20 20 20 20 73 65 74 5f mark"}. set_
13fb0 74 6f 6f 6c 74 69 70 73 20 24 77 28 6d 61 72 6b tooltips $w(mark
13fc0 43 6c 65 61 72 5f 74 78 29 20 7b 22 43 6c 65 61 Clear_tx) {"Clea
13fd0 72 20 63 75 72 72 65 6e 74 20 64 69 66 66 20 6d r current diff m
13fe0 61 72 6b 22 7d 0a 20 20 20 20 73 65 74 5f 74 6f ark"}. set_to
13ff0 6f 6c 74 69 70 73 20 24 77 28 63 65 6e 74 65 72 oltips $w(center
14000 44 69 66 66 73 5f 69 6d 29 20 7b 22 43 65 6e 74 Diffs_im) {"Cent
14010 65 72 20 43 75 72 72 65 6e 74 20 44 69 66 66 22 er Current Diff"
14020 7d 0a 20 20 20 20 73 65 74 5f 74 6f 6f 6c 74 69 }. set_toolti
14030 70 73 20 24 77 28 63 65 6e 74 65 72 44 69 66 66 ps $w(centerDiff
14040 73 5f 74 78 29 20 7b 22 43 65 6e 74 65 72 20 43 s_tx) {"Center C
14050 75 72 72 65 6e 74 20 44 69 66 66 22 7d 0a 0a 20 urrent Diff"}..
14060 20 20 20 70 61 63 6b 2d 74 6f 6f 6c 62 75 74 74 pack-toolbutt
14070 6f 6e 73 20 24 74 6f 6f 6c 62 61 72 0a 7d 0a 0a ons $toolbar.}..
14080 70 72 6f 63 20 70 61 63 6b 2d 74 6f 6f 6c 62 75 proc pack-toolbu
14090 74 74 6f 6e 73 20 7b 74 6f 6f 6c 62 61 72 7d 20 ttons {toolbar}
140a0 7b 0a 20 20 20 20 23 64 65 62 75 67 2d 69 6e 66 {. #debug-inf
140b0 6f 20 22 70 61 63 6b 2d 74 6f 6f 6c 62 75 74 74 o "pack-toolbutt
140c0 6f 6e 73 20 28 24 74 6f 6f 6c 62 61 72 29 22 0a ons ($toolbar)".
140d0 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a global opts.
140e0 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 73 28 74 . if {$opts(t
140f0 6f 6f 6c 62 61 72 49 63 6f 6e 73 29 7d 20 7b 0a oolbarIcons)} {.
14100 09 73 65 74 20 62 70 20 22 69 6d 22 0a 20 20 20 .set bp "im".
14110 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 62 } else {..set b
14120 70 20 22 74 78 22 0a 20 20 20 20 7d 0a 0a 20 20 p "tx". }..
14130 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 2e pack $toolbar.
14140 63 6f 6d 62 6f 20 2d 73 69 64 65 20 6c 65 66 74 combo -side left
14150 20 2d 70 61 64 78 20 32 0a 20 20 20 20 70 61 63 -padx 2. pac
14160 6b 20 24 74 6f 6f 6c 62 61 72 2e 73 65 70 31 20 k $toolbar.sep1
14170 2d 73 69 64 65 20 6c 65 66 74 20 2d 66 69 6c 6c -side left -fill
14180 20 79 20 2d 70 61 64 79 20 32 20 2d 70 61 64 78 y -pady 2 -padx
14190 20 32 0a 20 20 20 20 70 61 63 6b 20 24 74 6f 6f 2. pack $too
141a0 6c 62 61 72 2e 72 65 64 69 66 66 5f 24 62 70 20 lbar.rediff_$bp
141b0 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 61 64 78 -side left -padx
141c0 20 32 0a 20 20 20 20 70 61 63 6b 20 24 74 6f 6f 2. pack $too
141d0 6c 62 61 72 2e 66 69 6e 64 5f 24 62 70 20 2d 73 lbar.find_$bp -s
141e0 69 64 65 20 6c 65 66 74 20 2d 70 61 64 78 20 32 ide left -padx 2
141f0 0a 20 20 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 . pack $toolb
14200 61 72 2e 73 65 70 32 20 2d 73 69 64 65 20 6c 65 ar.sep2 -side le
14210 66 74 20 2d 66 69 6c 6c 20 79 20 2d 70 61 64 79 ft -fill y -pady
14220 20 32 20 2d 70 61 64 78 20 32 0a 20 20 20 20 70 2 -padx 2. p
14230 61 63 6b 20 24 74 6f 6f 6c 62 61 72 2e 6d 65 72 ack $toolbar.mer
14240 67 65 63 68 6f 69 63 65 6c 62 6c 20 2d 73 69 64 gechoicelbl -sid
14250 65 20 6c 65 66 74 20 2d 70 61 64 78 20 32 0a 20 e left -padx 2.
14260 20 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 pack $toolbar
14270 2e 6d 31 32 5f 24 62 70 20 24 74 6f 6f 6c 62 61 .m12_$bp $toolba
14280 72 2e 6d 31 5f 24 62 70 20 24 74 6f 6f 6c 62 61 r.m1_$bp $toolba
14290 72 2e 6d 32 5f 24 62 70 20 24 74 6f 6f 6c 62 61 r.m2_$bp $toolba
142a0 72 2e 6d 32 31 5f 24 62 70 20 5c 0a 20 20 20 20 r.m21_$bp \.
142b0 20 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 61 -side left -pa
142c0 64 78 20 32 0a 20 20 20 20 70 61 63 6b 20 24 74 dx 2. pack $t
142d0 6f 6f 6c 62 61 72 2e 73 65 70 33 20 2d 73 69 64 oolbar.sep3 -sid
142e0 65 20 6c 65 66 74 20 2d 66 69 6c 6c 20 79 20 2d e left -fill y -
142f0 70 61 64 79 20 32 20 2d 70 61 64 78 20 32 0a 20 pady 2 -padx 2.
14300 20 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 pack $toolbar
14310 2e 64 69 66 66 6e 61 76 6c 62 6c 20 2d 73 69 64 .diffnavlbl -sid
14320 65 20 6c 65 66 74 20 2d 70 61 64 79 20 32 20 2d e left -pady 2 -
14330 70 61 64 78 20 32 0a 20 20 20 20 70 61 63 6b 20 padx 2. pack
14340 24 74 6f 6f 6c 62 61 72 2e 66 69 72 73 74 5f 24 $toolbar.first_$
14350 62 70 20 24 74 6f 6f 6c 62 61 72 2e 6c 61 73 74 bp $toolbar.last
14360 5f 24 62 70 20 24 74 6f 6f 6c 62 61 72 2e 70 72 _$bp $toolbar.pr
14370 65 76 5f 24 62 70 20 5c 0a 20 20 20 20 20 20 24 ev_$bp \. $
14380 74 6f 6f 6c 62 61 72 2e 6e 65 78 74 5f 24 62 70 toolbar.next_$bp
14390 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 61 64 -side left -pad
143a0 79 20 32 20 2d 70 61 64 78 20 32 0a 20 20 20 20 y 2 -padx 2.
143b0 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 2e 73 65 pack $toolbar.se
143c0 70 34 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 66 p4 -side left -f
143d0 69 6c 6c 20 79 20 2d 70 61 64 79 20 32 20 2d 70 ill y -pady 2 -p
143e0 61 64 78 20 32 0a 20 20 20 20 70 61 63 6b 20 24 adx 2. pack $
143f0 74 6f 6f 6c 62 61 72 2e 63 65 6e 74 65 72 5f 24 toolbar.center_$
14400 62 70 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 bp -side left -p
14410 61 64 79 20 32 20 2d 70 61 64 78 20 31 0a 20 20 ady 2 -padx 1.
14420 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 2e pack $toolbar.
14430 73 65 70 35 20 2d 73 69 64 65 20 6c 65 66 74 20 sep5 -side left
14440 2d 66 69 6c 6c 20 79 20 2d 70 61 64 79 20 32 20 -fill y -pady 2
14450 2d 70 61 64 78 20 32 0a 20 20 20 20 70 61 63 6b -padx 2. pack
14460 20 24 74 6f 6f 6c 62 61 72 2e 62 6b 6d 6b 6c 62 $toolbar.bkmklb
14470 6c 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 61 l -side left -pa
14480 64 78 20 32 0a 20 20 20 20 70 61 63 6b 20 24 74 dx 2. pack $t
14490 6f 6f 6c 62 61 72 2e 62 6b 6d 6b 73 65 74 5f 24 oolbar.bkmkset_$
144a0 62 70 20 24 74 6f 6f 6c 62 61 72 2e 62 6b 6d 6b bp $toolbar.bkmk
144b0 63 6c 65 61 72 5f 24 62 70 20 2d 73 69 64 65 20 clear_$bp -side
144c0 6c 65 66 74 20 2d 70 61 64 79 20 32 20 2d 70 61 left -pady 2 -pa
144d0 64 78 20 32 0a 20 20 20 20 70 61 63 6b 20 24 74 dx 2. pack $t
144e0 6f 6f 6c 62 61 72 2e 73 65 70 36 20 2d 73 69 64 oolbar.sep6 -sid
144f0 65 20 6c 65 66 74 20 2d 66 69 6c 6c 20 79 20 2d e left -fill y -
14500 70 61 64 79 20 32 20 2d 70 61 64 78 20 32 0a 0a pady 2 -padx 2..
14510 20 20 20 20 66 6f 72 65 61 63 68 20 62 20 5b 69 foreach b [i
14520 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 24 74 6f nfo commands $to
14530 6f 6c 62 61 72 2e 6d 61 72 6b 2a 5d 20 7b 0a 09 olbar.mark*] {..
14540 70 61 63 6b 20 24 62 20 2d 73 69 64 65 20 6c 65 pack $b -side le
14550 66 74 20 2d 66 69 6c 6c 20 79 20 2d 70 61 64 79 ft -fill y -pady
14560 20 32 20 2d 70 61 64 78 20 32 0a 20 20 20 20 7d 2 -padx 2. }
14570 0a 0a 20 20 20 20 66 6f 72 65 61 63 68 20 62 20 .. foreach b
14580 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 24 [info commands $
14590 74 6f 6f 6c 62 61 72 2e 6d 61 72 6b 2a 5d 20 7b toolbar.mark*] {
145a0 0a 09 24 62 20 63 6f 6e 66 69 67 75 72 65 20 2d ..$b configure -
145b0 72 65 6c 69 65 66 20 24 6f 70 74 73 28 72 65 6c relief $opts(rel
145c0 69 65 66 29 0a 20 20 20 20 7d 0a 20 20 20 20 66 ief). }. f
145d0 6f 72 65 61 63 68 20 62 20 5b 69 6e 66 6f 20 63 oreach b [info c
145e0 6f 6d 6d 61 6e 64 73 20 24 74 6f 6f 6c 62 61 72 ommands $toolbar
145f0 2e 2a 5f 24 62 70 5d 20 7b 0a 09 24 62 20 63 6f .*_$bp] {..$b co
14600 6e 66 69 67 75 72 65 20 2d 72 65 6c 69 65 66 20 nfigure -relief
14610 24 6f 70 74 73 28 72 65 6c 69 65 66 29 0a 20 20 $opts(relief).
14620 20 20 7d 0a 0a 20 20 20 20 23 20 52 61 64 69 6f }.. # Radio
14630 62 75 74 74 6f 6e 73 20 69 67 6e 6f 72 65 20 72 buttons ignore r
14640 65 6c 69 65 66 20 63 6f 6e 66 69 67 75 72 61 74 elief configurat
14650 69 6f 6e 20 69 66 20 74 68 65 79 20 68 61 76 65 ion if they have
14660 20 61 6e 20 69 6d 61 67 65 2c 20 73 6f 20 77 65 an image, so we
14670 0a 20 20 20 20 23 20 73 65 74 20 74 68 65 69 72 . # set their
14680 20 62 6f 72 64 65 72 77 69 64 74 68 20 74 6f 20 borderwidth to
14690 30 20 69 66 20 77 65 20 77 61 6e 74 20 74 68 65 0 if we want the
146a0 6d 20 66 6c 61 74 2e 0a 20 20 20 20 69 66 20 7b m flat.. if {
146b0 24 6f 70 74 73 28 72 65 6c 69 65 66 29 20 3d 3d $opts(relief) ==
146c0 20 22 66 6c 61 74 22 20 26 26 20 24 6f 70 74 73 "flat" && $opts
146d0 28 74 6f 6f 6c 62 61 72 49 63 6f 6e 73 29 7d 20 (toolbarIcons)}
146e0 7b 0a 09 73 65 74 20 62 6f 72 64 20 30 0a 20 20 {..set bord 0.
146f0 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 } else {..set
14700 62 6f 72 64 20 31 0a 20 20 20 20 7d 0a 20 20 20 bord 1. }.
14710 20 66 6f 72 65 61 63 68 20 62 20 5b 69 6e 66 6f foreach b [info
14720 20 63 6f 6d 6d 61 6e 64 73 20 24 74 6f 6f 6c 62 commands $toolb
14730 61 72 2e 6d 31 2a 5d 20 7b 0a 09 24 62 20 63 6f ar.m1*] {..$b co
14740 6e 66 69 67 75 72 65 20 2d 62 64 20 24 62 6f 72 nfigure -bd $bor
14750 64 0a 20 20 20 20 7d 0a 20 20 20 20 66 6f 72 65 d. }. fore
14760 61 63 68 20 62 20 5b 69 6e 66 6f 20 63 6f 6d 6d ach b [info comm
14770 61 6e 64 73 20 24 74 6f 6f 6c 62 61 72 2e 6d 32 ands $toolbar.m2
14780 2a 5d 20 7b 0a 09 24 62 20 63 6f 6e 66 69 67 75 *] {..$b configu
14790 72 65 20 2d 62 64 20 24 62 6f 72 64 0a 20 20 20 re -bd $bord.
147a0 20 7d 0a 7d 0a 0a 70 72 6f 63 20 72 65 63 6f 6e }.}..proc recon
147b0 66 69 67 75 72 65 2d 74 6f 6f 6c 62 61 72 20 7b figure-toolbar {
147c0 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e } {. debug-in
147d0 66 6f 20 22 72 65 63 6f 6e 66 69 67 75 72 65 2d fo "reconfigure-
147e0 74 6f 6f 6c 62 61 72 22 0a 20 20 20 20 67 6c 6f toolbar". glo
147f0 62 61 6c 20 77 0a 0a 20 20 20 20 66 6f 72 65 61 bal w.. forea
14800 63 68 20 62 75 74 74 6f 6e 20 5b 77 69 6e 66 6f ch button [winfo
14810 20 63 68 69 6c 64 72 65 6e 20 24 77 28 74 6f 6f children $w(too
14820 6c 62 61 72 29 5d 20 7b 0a 09 70 61 63 6b 20 66 lbar)] {..pack f
14830 6f 72 67 65 74 20 24 62 75 74 74 6f 6e 0a 20 20 orget $button.
14840 20 20 7d 0a 0a 20 20 20 20 70 61 63 6b 2d 74 6f }.. pack-to
14850 6f 6c 62 75 74 74 6f 6e 73 20 24 77 28 74 6f 6f olbuttons $w(too
14860 6c 62 61 72 29 0a 7d 0a 0a 70 72 6f 63 20 62 75 lbar).}..proc bu
14870 69 6c 64 2d 73 74 61 74 75 73 20 7b 7d 20 7b 0a ild-status {} {.
14880 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 debug-info "
14890 62 75 69 6c 64 2d 73 74 61 74 75 73 22 0a 20 20 build-status".
148a0 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 global w. g
148b0 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 20 66 72 61 lobal g.. fra
148c0 6d 65 20 24 77 28 73 74 61 74 75 73 29 20 2d 62 me $w(status) -b
148d0 64 20 30 0a 0a 20 20 20 20 73 65 74 20 77 28 73 d 0.. set w(s
148e0 74 61 74 75 73 4c 61 62 65 6c 29 20 24 77 28 73 tatusLabel) $w(s
148f0 74 61 74 75 73 29 2e 6c 61 62 65 6c 0a 20 20 20 tatus).label.
14900 20 73 65 74 20 77 28 73 74 61 74 75 73 43 75 72 set w(statusCur
14910 72 65 6e 74 29 20 24 77 28 73 74 61 74 75 73 29 rent) $w(status)
14920 2e 63 75 72 72 65 6e 74 0a 0a 20 20 20 20 23 20 .current.. #
14930 4d 61 63 4f 53 20 68 61 73 20 61 20 72 65 73 69 MacOS has a resi
14940 7a 65 20 68 61 6e 64 6c 65 20 69 6e 20 74 68 65 ze handle in the
14950 20 62 6f 74 74 6f 6d 20 72 69 67 68 74 20 77 68 bottom right wh
14960 69 63 68 20 77 69 6c 6c 20 73 69 74 0a 20 20 20 ich will sit.
14970 20 23 20 6f 6e 20 74 6f 70 20 6f 66 20 77 68 61 # on top of wha
14980 74 65 76 65 72 20 69 73 20 70 6c 61 63 65 64 20 tever is placed
14990 74 68 65 72 65 2e 20 53 6f 2c 20 77 65 27 6c 6c there. So, we'll
149a0 20 61 64 64 20 61 20 6c 69 74 74 6c 65 20 62 69 add a little bi
149b0 74 0a 20 20 20 20 23 20 6f 66 20 77 68 69 74 65 t. # of white
149c0 73 70 61 63 65 20 74 68 65 72 65 2e 20 49 74 27 space there. It'
149d0 73 20 68 61 72 6d 6c 65 73 73 2c 20 73 6f 20 77 s harmless, so w
149e0 65 27 6c 6c 20 64 6f 20 69 74 20 6f 6e 20 61 6c e'll do it on al
149f0 6c 20 6f 66 20 74 68 65 0a 20 20 20 20 23 20 70 l of the. # p
14a00 6c 61 74 66 6f 72 6d 73 2e 0a 20 20 20 20 6c 61 latforms.. la
14a10 62 65 6c 20 24 77 28 73 74 61 74 75 73 29 2e 62 bel $w(status).b
14a20 6c 61 6e 6b 20 2d 69 6d 61 67 65 20 6e 75 6c 6c lank -image null
14a30 49 6d 61 67 65 20 2d 77 69 64 74 68 20 31 36 20 Image -width 16
14a40 2d 62 64 20 31 20 2d 72 65 6c 69 65 66 20 73 75 -bd 1 -relief su
14a50 6e 6b 65 6e 0a 0a 20 20 20 20 6c 61 62 65 6c 20 nken.. label
14a60 24 77 28 73 74 61 74 75 73 43 75 72 72 65 6e 74 $w(statusCurrent
14a70 29 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 ) -textvariable
14a80 67 28 73 74 61 74 75 73 43 75 72 72 65 6e 74 29 g(statusCurrent)
14a90 20 2d 61 6e 63 68 6f 72 20 65 20 5c 0a 20 20 20 -anchor e \.
14aa0 20 20 20 2d 77 69 64 74 68 20 31 34 20 2d 62 6f -width 14 -bo
14ab0 72 64 65 72 77 69 64 74 68 20 31 20 2d 72 65 6c rderwidth 1 -rel
14ac0 69 65 66 20 73 75 6e 6b 65 6e 20 2d 70 61 64 78 ief sunken -padx
14ad0 20 34 20 2d 70 61 64 79 20 32 0a 20 20 20 20 6c 4 -pady 2. l
14ae0 61 62 65 6c 20 24 77 28 73 74 61 74 75 73 4c 61 abel $w(statusLa
14af0 62 65 6c 29 20 2d 74 65 78 74 76 61 72 69 61 62 bel) -textvariab
14b00 6c 65 20 67 28 73 74 61 74 75 73 49 6e 66 6f 29 le g(statusInfo)
14b10 20 2d 61 6e 63 68 6f 72 20 77 20 2d 77 69 64 74 -anchor w -widt
14b20 68 20 31 20 5c 0a 20 20 20 20 20 20 2d 62 6f 72 h 1 \. -bor
14b30 64 65 72 77 69 64 74 68 20 31 20 2d 72 65 6c 69 derwidth 1 -reli
14b40 65 66 20 73 75 6e 6b 65 6e 20 2d 70 61 64 79 20 ef sunken -pady
14b50 32 0a 20 20 20 20 70 61 63 6b 20 24 77 28 73 74 2. pack $w(st
14b60 61 74 75 73 29 2e 62 6c 61 6e 6b 20 2d 73 69 64 atus).blank -sid
14b70 65 20 72 69 67 68 74 20 2d 66 69 6c 6c 20 79 0a e right -fill y.
14b80 0a 20 20 20 20 70 61 63 6b 20 24 77 28 73 74 61 . pack $w(sta
14b90 74 75 73 43 75 72 72 65 6e 74 29 20 2d 73 69 64 tusCurrent) -sid
14ba0 65 20 72 69 67 68 74 20 2d 66 69 6c 6c 20 79 20 e right -fill y
14bb0 2d 65 78 70 61 6e 64 20 6e 0a 20 20 20 20 70 61 -expand n. pa
14bc0 63 6b 20 24 77 28 73 74 61 74 75 73 4c 61 62 65 ck $w(statusLabe
14bd0 6c 29 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 66 l) -side left -f
14be0 69 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 ill both -expand
14bf0 20 79 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 y.}..##########
14c00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c40 23 23 23 23 23 0a 23 20 68 61 6e 64 6c 65 73 20 #####.# handles
14c50 65 76 65 6e 74 73 20 6f 76 65 72 20 74 68 65 20 events over the
14c60 6d 61 70 0a 23 23 23 23 23 23 23 23 23 23 23 23 map.############
14c70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14c90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14ca0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
14cb0 23 23 23 0a 70 72 6f 63 20 68 61 6e 64 6c 65 4d ###.proc handleM
14cc0 61 70 45 76 65 6e 74 20 7b 65 76 65 6e 74 20 79 apEvent {event y
14cd0 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f } {. global o
14ce0 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 pts. global w
14cf0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 . global g.
14d00 20 20 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 68 #debug-info "h
14d10 61 6e 64 6c 65 4d 61 70 45 76 65 6e 74 20 24 65 andleMapEvent $e
14d20 76 65 6e 74 20 24 79 22 0a 0a 20 20 20 20 73 77 vent $y".. sw
14d30 69 74 63 68 20 2d 2d 20 24 65 76 65 6e 74 20 7b itch -- $event {
14d40 0a 20 20 20 20 42 31 2d 50 72 65 73 73 20 7b 0a . B1-Press {.
14d50 09 20 20 20 20 73 65 74 20 74 79 31 20 5b 6c 69 . set ty1 [li
14d60 6e 64 65 78 20 24 67 28 74 68 75 6d 62 42 62 6f ndex $g(thumbBbo
14d70 78 29 20 31 5d 0a 09 20 20 20 20 73 65 74 20 74 x) 1].. set t
14d80 79 32 20 5b 6c 69 6e 64 65 78 20 24 67 28 74 68 y2 [lindex $g(th
14d90 75 6d 62 42 62 6f 78 29 20 33 5d 0a 09 20 20 20 umbBbox) 3]..
14da0 20 69 66 20 7b 24 79 20 3e 3d 20 24 74 79 31 20 if {$y >= $ty1
14db0 26 26 20 24 79 20 3c 3d 20 24 74 79 32 7d 20 7b && $y <= $ty2} {
14dc0 0a 09 09 73 65 74 20 67 28 6d 61 70 53 63 72 6f ...set g(mapScro
14dd0 6c 6c 69 6e 67 29 20 31 0a 0a 09 09 23 20 74 68 lling) 1....# th
14de0 69 73 20 63 61 70 74 75 72 65 73 20 74 68 65 20 is captures the
14df0 6e 65 67 61 74 69 76 65 20 64 65 6c 74 61 20 62 negative delta b
14e00 65 74 77 65 65 6e 20 74 68 65 20 6d 6f 75 73 65 etween the mouse
14e10 20 70 72 65 73 73 20 5c 0a 09 09 20 20 61 6e 64 press \... and
14e20 20 74 68 65 20 74 6f 70 0a 09 09 23 20 6f 66 20 the top...# of
14e30 74 68 65 20 74 68 75 6d 62 62 6f 78 2e 20 49 74 the thumbbox. It
14e40 27 73 20 75 73 65 64 20 73 6f 20 77 68 65 6e 20 's used so when
14e50 77 65 20 73 63 72 6f 6c 6c 20 62 79 20 6d 6f 76 we scroll by mov
14e60 69 6e 67 20 74 68 65 20 0a 09 09 23 20 6d 6f 75 ing the ...# mou
14e70 73 65 2c 20 77 65 20 63 61 6e 20 6b 65 65 70 20 se, we can keep
14e80 74 68 69 73 20 64 69 73 74 61 6e 63 65 20 63 6f this distance co
14e90 6e 73 74 61 6e 74 2e 20 54 68 69 73 20 69 73 20 nstant. This is
14ea0 68 6f 77 20 61 6c 6c 0a 09 09 23 20 73 63 72 6f how all...# scro
14eb0 6c 6c 62 61 72 73 20 77 6f 72 6b 2c 20 61 6e 64 llbars work, and
14ec0 20 69 74 27 73 20 77 68 61 74 20 74 68 65 20 75 it's what the u
14ed0 73 65 72 20 65 78 70 65 63 74 73 2e 0a 09 09 73 ser expects....s
14ee0 65 74 20 67 28 74 68 75 6d 62 44 65 6c 74 61 59 et g(thumbDeltaY
14ef0 29 20 5b 65 78 70 72 20 2d 31 20 2a 20 28 24 79 ) [expr -1 * ($y
14f00 20 2d 20 24 74 79 31 20 2d 20 32 29 5d 0a 0a 09 - $ty1 - 2)]...
14f10 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 42 31 2d }..}. B1-
14f20 4d 6f 74 69 6f 6e 20 7b 0a 09 20 20 20 20 69 66 Motion {.. if
14f30 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 67 {[info exists g
14f40 28 6d 61 70 53 63 72 6f 6c 6c 69 6e 67 29 5d 7d (mapScrolling)]}
14f50 20 7b 0a 09 09 69 6e 63 72 20 79 20 24 67 28 74 {...incr y $g(t
14f60 68 75 6d 62 44 65 6c 74 61 59 29 0a 0a 09 09 6d humbDeltaY)....m
14f70 61 70 2d 73 65 65 6b 20 24 79 0a 09 20 20 20 20 ap-seek $y..
14f80 7d 0a 09 7d 0a 20 20 20 20 42 31 2d 52 65 6c 65 }..}. B1-Rele
14f90 61 73 65 20 7b 0a 09 20 20 20 20 73 68 6f 77 2d ase {.. show-
14fa0 69 6e 66 6f 20 22 22 0a 09 20 20 20 20 73 65 74 info "".. set
14fb0 20 74 79 31 20 5b 6c 69 6e 64 65 78 20 24 67 28 ty1 [lindex $g(
14fc0 74 68 75 6d 62 42 62 6f 78 29 20 31 5d 0a 09 20 thumbBbox) 1]..
14fd0 20 20 20 73 65 74 20 74 79 32 20 5b 6c 69 6e 64 set ty2 [lind
14fe0 65 78 20 24 67 28 74 68 75 6d 62 42 62 6f 78 29 ex $g(thumbBbox)
14ff0 20 33 5d 0a 09 20 20 20 20 23 20 69 66 20 77 65 3].. # if we
15000 20 72 65 6c 65 61 73 65 20 6f 76 65 72 20 74 68 release over th
15010 65 20 74 72 6f 75 67 68 20 28 2a 6e 6f 74 2a 20 e trough (*not*
15020 6f 76 65 72 20 74 68 65 20 74 68 75 6d 62 29 0a over the thumb).
15030 09 20 20 20 20 23 20 6a 75 73 74 20 73 63 72 6f . # just scro
15040 6c 6c 20 62 79 20 74 68 65 20 73 69 7a 65 20 6f ll by the size o
15050 66 20 74 68 65 20 74 68 75 6d 62 0a 09 20 20 20 f the thumb..
15060 20 69 66 20 7b 24 79 20 3c 20 24 74 79 31 20 7c if {$y < $ty1 |
15070 7c 20 24 79 20 3e 20 24 74 79 32 7d 20 7b 0a 09 | $y > $ty2} {..
15080 09 69 66 20 7b 24 79 20 3c 20 24 74 79 31 7d 20 .if {$y < $ty1}
15090 7b 0a 09 09 20 20 20 20 23 20 69 66 20 76 65 72 {... # if ver
150a0 74 69 63 61 6c 20 73 63 72 6f 6c 6c 62 61 72 20 tical scrollbar
150b0 73 79 6e 63 69 6e 67 20 69 73 20 74 75 72 6e 65 syncing is turne
150c0 64 20 6f 6e 2c 0a 09 09 20 20 20 20 23 20 61 6c d on,... # al
150d0 6c 20 74 68 65 20 6f 74 68 65 72 20 77 69 6e 64 l the other wind
150e0 6f 77 73 20 73 68 6f 75 6c 64 20 74 6f 65 20 74 ows should toe t
150f0 68 65 20 6c 69 6e 65 0a 09 09 20 20 20 20 23 20 he line... #
15100 61 70 70 72 6f 70 72 69 61 74 65 6c 79 2e 2e 2e appropriately...
15110 0a 09 09 20 20 20 20 24 77 28 52 69 67 68 74 54 ... $w(RightT
15120 65 78 74 29 20 79 76 69 65 77 20 73 63 72 6f 6c ext) yview scrol
15130 6c 20 2d 31 20 70 61 67 65 73 0a 09 09 7d 20 65 l -1 pages...} e
15140 6c 73 65 20 7b 0a 09 09 20 20 20 20 24 77 28 52 lse {... $w(R
15150 69 67 68 74 54 65 78 74 29 20 79 76 69 65 77 20 ightText) yview
15160 73 63 72 6f 6c 6c 20 31 20 70 61 67 65 73 0a 09 scroll 1 pages..
15170 09 7d 0a 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 .}... } else
15180 7b 0a 09 09 23 20 64 6f 20 6e 6f 74 68 69 6e 67 {...# do nothing
15190 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 63 61 .. }... ca
151a0 74 63 68 20 7b 75 6e 73 65 74 20 67 28 6d 61 70 tch {unset g(map
151b0 53 63 72 6f 6c 6c 69 6e 67 29 7d 0a 09 7d 0a 20 Scrolling)}..}.
151c0 20 20 20 7d 0a 7d 0a 0a 23 20 6d 61 6b 65 73 20 }.}..# makes
151d0 61 20 74 6f 6f 6c 62 61 72 20 22 73 65 70 61 72 a toolbar "separ
151e0 61 74 6f 72 22 0a 70 72 6f 63 20 74 6f 6f 6c 73 ator".proc tools
151f0 65 70 20 7b 77 7d 20 7b 0a 20 20 20 20 6c 61 62 ep {w} {. lab
15200 65 6c 20 24 77 20 2d 69 6d 61 67 65 20 5b 69 6d el $w -image [im
15210 61 67 65 20 63 72 65 61 74 65 20 70 68 6f 74 6f age create photo
15220 5d 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63 ] -highlightthic
15230 6b 6e 65 73 73 20 30 20 2d 62 64 20 31 20 2d 77 kness 0 -bd 1 -w
15240 69 64 74 68 20 30 20 5c 0a 20 20 20 20 20 20 2d idth 0 \. -
15250 72 65 6c 69 65 66 20 67 72 6f 6f 76 65 0a 20 20 relief groove.
15260 20 20 72 65 74 75 72 6e 20 24 77 0a 7d 0a 0a 70 return $w.}..p
15270 72 6f 63 20 74 6f 6f 6c 62 75 74 74 6f 6e 20 7b roc toolbutton {
15280 77 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 67 6c w args} {. gl
15290 6f 62 61 6c 20 74 63 6c 5f 70 6c 61 74 66 6f 72 obal tcl_platfor
152a0 6d 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 m. global opt
152b0 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 0a s. global g..
152c0 20 20 20 20 23 20 63 72 65 61 74 65 20 74 68 65 # create the
152d0 20 62 75 74 74 6f 6e 0a 20 20 20 20 65 76 61 6c button. eval
152e0 20 62 75 74 74 6f 6e 20 24 77 20 24 61 72 67 73 button $w $args
152f0 0a 0a 20 20 20 20 23 20 61 64 64 20 6d 69 6e 69 .. # add mini
15300 6d 61 6c 20 74 6f 6f 6c 74 69 70 2d 6c 69 6b 65 mal tooltip-like
15310 20 73 75 70 70 6f 72 74 0a 20 20 20 20 62 69 6e support. bin
15320 64 20 24 77 20 3c 45 6e 74 65 72 3e 20 5b 6c 69 d $w <Enter> [li
15330 73 74 20 74 6f 6f 6c 62 75 74 74 6f 6e 3a 68 61 st toolbutton:ha
15340 6e 64 6c 65 45 76 65 6e 74 20 3c 45 6e 74 65 72 ndleEvent <Enter
15350 3e 20 25 57 5d 0a 20 20 20 20 62 69 6e 64 20 24 > %W]. bind $
15360 77 20 3c 4c 65 61 76 65 3e 20 5b 6c 69 73 74 20 w <Leave> [list
15370 74 6f 6f 6c 62 75 74 74 6f 6e 3a 68 61 6e 64 6c toolbutton:handl
15380 65 45 76 65 6e 74 20 3c 4c 65 61 76 65 3e 20 25 eEvent <Leave> %
15390 57 5d 0a 20 20 20 20 62 69 6e 64 20 24 77 20 3c W]. bind $w <
153a0 46 6f 63 75 73 49 6e 3e 20 5b 6c 69 73 74 20 74 FocusIn> [list t
153b0 6f 6f 6c 62 75 74 74 6f 6e 3a 68 61 6e 64 6c 65 oolbutton:handle
153c0 45 76 65 6e 74 20 3c 46 6f 63 75 73 49 6e 3e 20 Event <FocusIn>
153d0 25 57 5d 0a 20 20 20 20 62 69 6e 64 20 24 77 20 %W]. bind $w
153e0 3c 46 6f 63 75 73 4f 75 74 3e 20 5b 6c 69 73 74 <FocusOut> [list
153f0 20 74 6f 6f 6c 62 75 74 74 6f 6e 3a 68 61 6e 64 toolbutton:hand
15400 6c 65 45 76 65 6e 74 20 3c 46 6f 63 75 73 4f 75 leEvent <FocusOu
15410 74 3e 20 25 57 5d 0a 0a 20 20 20 20 24 77 20 63 t> %W].. $w c
15420 6f 6e 66 69 67 75 72 65 20 2d 72 65 6c 69 65 66 onfigure -relief
15430 20 24 6f 70 74 73 28 72 65 6c 69 65 66 29 0a 0a $opts(relief)..
15440 20 20 20 20 72 65 74 75 72 6e 20 24 77 0a 7d 0a return $w.}.
15450 0a 23 20 68 61 6e 64 6c 65 20 65 76 65 6e 74 73 .# handle events
15460 20 69 6e 20 6f 75 72 20 66 61 6e 63 79 20 74 6f in our fancy to
15470 6f 6c 62 75 74 74 6f 6e 73 2e 2e 2e 0a 70 72 6f olbuttons....pro
15480 63 20 74 6f 6f 6c 62 75 74 74 6f 6e 3a 68 61 6e c toolbutton:han
15490 64 6c 65 45 76 65 6e 74 20 7b 65 76 65 6e 74 20 dleEvent {event
154a0 77 20 7b 69 73 54 6f 6f 6c 62 75 74 74 6f 6e 20 w {isToolbutton
154b0 31 7d 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 1}} {. global
154c0 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 g. global op
154d0 74 73 0a 0a 20 20 20 20 73 77 69 74 63 68 20 2d ts.. switch -
154e0 2d 20 24 65 76 65 6e 74 20 7b 0a 20 20 20 20 22 - $event {. "
154f0 3c 45 6e 74 65 72 3e 22 20 7b 0a 09 20 20 20 20 <Enter>" {..
15500 73 68 6f 77 54 6f 6f 6c 74 69 70 20 62 75 74 74 showTooltip butt
15510 6f 6e 20 24 77 0a 09 20 20 20 20 69 66 20 7b 24 on $w.. if {$
15520 6f 70 74 73 28 66 61 6e 63 79 42 75 74 74 6f 6e opts(fancyButton
15530 73 29 20 26 26 20 24 69 73 54 6f 6f 6c 62 75 74 s) && $isToolbut
15540 74 6f 6e 20 26 26 20 5b 24 77 20 63 67 65 74 20 ton && [$w cget
15550 2d 73 74 61 74 65 5d 20 3d 3d 20 5c 0a 09 20 20 -state] == \..
15560 20 20 20 20 22 6e 6f 72 6d 61 6c 22 7d 20 7b 0a "normal"} {.
15570 09 09 24 77 20 63 6f 6e 66 69 67 75 72 65 20 2d ..$w configure -
15580 72 65 6c 69 65 66 20 72 61 69 73 65 64 0a 09 20 relief raised..
15590 20 20 20 7d 0a 09 7d 0a 20 20 20 20 22 3c 4c 65 }..}. "<Le
155a0 61 76 65 3e 22 20 7b 0a 09 20 20 20 20 73 65 74 ave>" {.. set
155b0 20 67 28 73 74 61 74 75 73 49 6e 66 6f 29 20 22 g(statusInfo) "
155c0 22 0a 09 20 20 20 20 69 66 20 7b 24 6f 70 74 73 ".. if {$opts
155d0 28 66 61 6e 63 79 42 75 74 74 6f 6e 73 29 20 26 (fancyButtons) &
155e0 26 20 24 69 73 54 6f 6f 6c 62 75 74 74 6f 6e 7d & $isToolbutton}
155f0 20 7b 0a 09 09 24 77 20 63 6f 6e 66 69 67 75 72 {...$w configur
15600 65 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 0a 09 e -relief flat..
15610 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 22 3c 46 }..}. "<F
15620 6f 63 75 73 49 6e 3e 22 20 7b 0a 09 20 20 20 20 ocusIn>" {..
15630 73 68 6f 77 54 6f 6f 6c 74 69 70 20 62 75 74 74 showTooltip butt
15640 6f 6e 20 24 77 0a 09 20 20 20 20 69 66 20 7b 24 on $w.. if {$
15650 6f 70 74 73 28 66 61 6e 63 79 42 75 74 74 6f 6e opts(fancyButton
15660 73 29 20 26 26 20 24 69 73 54 6f 6f 6c 62 75 74 s) && $isToolbut
15670 74 6f 6e 20 26 26 20 5b 24 77 20 63 67 65 74 20 ton && [$w cget
15680 2d 73 74 61 74 65 5d 20 3d 3d 20 5c 0a 09 20 20 -state] == \..
15690 20 20 20 20 22 6e 6f 72 6d 61 6c 22 7d 20 7b 0a "normal"} {.
156a0 09 09 24 77 20 63 6f 6e 66 69 67 75 72 65 20 2d ..$w configure -
156b0 72 65 6c 69 65 66 20 72 61 69 73 65 64 0a 09 20 relief raised..
156c0 20 20 20 7d 0a 09 7d 0a 20 20 20 20 22 3c 46 6f }..}. "<Fo
156d0 63 75 73 4f 75 74 3e 22 20 7b 0a 09 20 20 20 20 cusOut>" {..
156e0 73 65 74 20 67 28 73 74 61 74 75 73 49 6e 66 6f set g(statusInfo
156f0 29 20 22 22 0a 09 20 20 20 20 69 66 20 7b 24 6f ) "".. if {$o
15700 70 74 73 28 66 61 6e 63 79 42 75 74 74 6f 6e 73 pts(fancyButtons
15710 29 20 26 26 20 24 69 73 54 6f 6f 6c 62 75 74 74 ) && $isToolbutt
15720 6f 6e 7d 20 7b 0a 09 09 24 77 20 63 6f 6e 66 69 on} {...$w confi
15730 67 75 72 65 20 2d 72 65 6c 69 65 66 20 66 6c 61 gure -relief fla
15740 74 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 t.. }..}.
15750 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 }.}..###########
15760 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15770 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15780 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15790 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
157a0 23 23 23 23 0a 23 20 6d 6f 76 65 20 74 68 65 20 ####.# move the
157b0 6d 61 70 20 74 68 75 6d 62 20 74 6f 20 63 6f 72 map thumb to cor
157c0 72 65 73 70 6f 6e 64 20 74 6f 20 63 75 72 72 65 respond to curre
157d0 6e 74 20 73 68 6f 77 6e 20 6d 65 72 67 65 2e 2e nt shown merge..
157e0 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
157f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15800 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15810 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15830 23 0a 70 72 6f 63 20 6d 61 70 2d 6d 6f 76 65 2d #.proc map-move-
15840 74 68 75 6d 62 20 7b 79 31 20 79 32 7d 20 7b 0a thumb {y1 y2} {.
15850 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 global g.
15860 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 73 global w.. s
15870 65 74 20 74 68 75 6d 62 68 65 69 67 68 74 20 5b et thumbheight [
15880 65 78 70 72 20 7b 28 24 79 32 20 2d 20 24 79 31 expr {($y2 - $y1
15890 29 20 2a 20 24 67 28 6d 61 70 68 65 69 67 68 74 ) * $g(mapheight
158a0 29 7d 5d 0a 20 20 20 20 69 66 20 7b 24 74 68 75 )}]. if {$thu
158b0 6d 62 68 65 69 67 68 74 20 3c 20 24 67 28 74 68 mbheight < $g(th
158c0 75 6d 62 4d 69 6e 48 65 69 67 68 74 29 7d 20 7b umbMinHeight)} {
158d0 0a 09 73 65 74 20 74 68 75 6d 62 68 65 69 67 68 ..set thumbheigh
158e0 74 20 24 67 28 74 68 75 6d 62 4d 69 6e 48 65 69 t $g(thumbMinHei
158f0 67 68 74 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 ght). }..
15900 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
15910 73 20 67 28 6d 61 70 77 69 64 74 68 29 5d 7d 20 s g(mapwidth)]}
15920 7b 0a 09 73 65 74 20 67 28 6d 61 70 77 69 64 74 {..set g(mapwidt
15930 68 29 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 73 h) 0. }. s
15940 65 74 20 78 31 20 31 0a 20 20 20 20 73 65 74 20 et x1 1. set
15950 78 32 20 5b 65 78 70 72 20 7b 24 67 28 6d 61 70 x2 [expr {$g(map
15960 77 69 64 74 68 29 20 2d 20 33 7d 5d 0a 0a 20 20 width) - 3}]..
15970 20 20 23 20 77 68 79 20 2d 32 3f 20 69 74 27 73 # why -2? it's
15980 20 74 68 65 20 74 68 69 63 6b 6e 65 73 73 20 6f the thickness o
15990 66 20 6f 75 72 20 62 6f 72 64 65 72 2e 2e 2e 0a f our border....
159a0 20 20 20 20 73 65 74 20 79 31 20 5b 65 78 70 72 set y1 [expr
159b0 20 7b 69 6e 74 28 28 24 79 31 20 2a 20 24 67 28 {int(($y1 * $g(
159c0 6d 61 70 68 65 69 67 68 74 29 29 20 2d 20 32 29 mapheight)) - 2)
159d0 7d 5d 0a 20 20 20 20 69 66 20 7b 24 79 31 20 3c }]. if {$y1 <
159e0 20 30 7d 20 7b 0a 09 73 65 74 20 79 31 20 30 0a 0} {..set y1 0.
159f0 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 79 }.. set y
15a00 32 20 5b 65 78 70 72 20 7b 24 79 31 20 2b 20 24 2 [expr {$y1 + $
15a10 74 68 75 6d 62 68 65 69 67 68 74 7d 5d 0a 20 20 thumbheight}].
15a20 20 20 69 66 20 7b 24 79 32 20 3e 20 24 67 28 6d if {$y2 > $g(m
15a30 61 70 68 65 69 67 68 74 29 7d 20 7b 0a 09 73 65 apheight)} {..se
15a40 74 20 79 32 20 24 67 28 6d 61 70 68 65 69 67 68 t y2 $g(mapheigh
15a50 74 29 0a 09 73 65 74 20 79 31 20 5b 65 78 70 72 t)..set y1 [expr
15a60 20 7b 24 79 32 20 2d 20 24 74 68 75 6d 62 68 65 {$y2 - $thumbhe
15a70 69 67 68 74 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 ight}]. }..
15a80 20 20 73 65 74 20 64 78 31 20 5b 65 78 70 72 20 set dx1 [expr
15a90 7b 24 78 31 20 2b 20 31 7d 5d 0a 20 20 20 20 73 {$x1 + 1}]. s
15aa0 65 74 20 64 78 32 20 5b 65 78 70 72 20 7b 24 78 et dx2 [expr {$x
15ab0 32 20 2d 20 31 7d 5d 0a 20 20 20 20 73 65 74 20 2 - 1}]. set
15ac0 64 79 31 20 5b 65 78 70 72 20 7b 24 79 31 20 2b dy1 [expr {$y1 +
15ad0 20 31 7d 5d 0a 20 20 20 20 73 65 74 20 64 79 32 1}]. set dy2
15ae0 20 5b 65 78 70 72 20 7b 24 79 32 20 2d 20 31 7d [expr {$y2 - 1}
15af0 5d 0a 0a 20 20 20 20 24 77 28 6d 61 70 43 61 6e ].. $w(mapCan
15b00 76 61 73 29 20 63 6f 6f 72 64 73 20 74 68 75 6d vas) coords thum
15b10 62 55 4c 20 24 78 31 20 24 79 32 20 24 78 31 20 bUL $x1 $y2 $x1
15b20 24 79 31 20 24 78 32 20 24 79 31 20 24 64 78 32 $y1 $x2 $y1 $dx2
15b30 20 24 64 79 31 20 24 64 78 31 20 24 64 79 31 20 $dy1 $dx1 $dy1
15b40 5c 0a 20 20 20 20 20 20 24 64 78 31 20 24 64 79 \. $dx1 $dy
15b50 32 0a 20 20 20 20 24 77 28 6d 61 70 43 61 6e 76 2. $w(mapCanv
15b60 61 73 29 20 63 6f 6f 72 64 73 20 74 68 75 6d 62 as) coords thumb
15b70 4c 52 20 24 64 78 31 20 24 79 32 20 24 78 32 20 LR $dx1 $y2 $x2
15b80 24 79 32 20 24 78 32 20 24 64 79 31 20 24 64 78 $y2 $x2 $dy1 $dx
15b90 32 20 24 64 79 31 20 24 64 78 32 20 5c 0a 20 20 2 $dy1 $dx2 \.
15ba0 20 20 20 20 24 64 79 32 20 24 64 78 31 20 24 64 $dy2 $dx1 $d
15bb0 79 32 0a 0a 20 20 20 20 73 65 74 20 67 28 74 68 y2.. set g(th
15bc0 75 6d 62 42 62 6f 78 29 20 5b 6c 69 73 74 20 24 umbBbox) [list $
15bd0 78 31 20 24 79 31 20 24 78 32 20 24 79 32 5d 0a x1 $y1 $x2 $y2].
15be0 20 20 20 20 73 65 74 20 67 28 74 68 75 6d 62 48 set g(thumbH
15bf0 65 69 67 68 74 29 20 24 74 68 75 6d 62 68 65 69 eight) $thumbhei
15c00 67 68 74 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 ght.}..#########
15c10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15c20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15c30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15c40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15c50 23 23 23 23 23 23 0a 23 20 42 69 6e 64 20 6b 65 ######.# Bind ke
15c60 79 73 20 66 6f 72 20 4e 65 78 74 2c 20 50 72 65 ys for Next, Pre
15c70 76 2c 20 43 65 6e 74 65 72 2c 20 4d 65 72 67 65 v, Center, Merge
15c80 20 63 68 6f 69 63 65 73 20 31 20 61 6e 64 20 32 choices 1 and 2
15c90 0a 23 0a 23 20 4e 2e 42 2e 20 54 68 69 73 20 69 .#.# N.B. This i
15ca0 73 20 47 52 4f 53 53 21 20 49 74 20 6d 69 67 68 s GROSS! It migh
15cb0 74 20 68 61 76 65 20 62 65 65 6e 20 6e 65 63 65 t have been nece
15cc0 73 73 61 72 79 20 69 6e 20 65 61 72 6c 69 65 72 ssary in earlier
15cd0 20 76 65 72 73 69 6f 6e 73 2c 0a 23 20 62 75 74 versions,.# but
15ce0 20 6e 6f 77 20 49 20 74 68 69 6e 6b 20 69 74 20 now I think it
15cf0 6e 65 65 64 73 20 61 20 73 65 72 69 6f 75 73 20 needs a serious
15d00 72 65 77 72 69 69 74 65 2e 20 57 65 20 61 72 65 rewriite. We are
15d10 20 6e 6f 77 20 6f 76 65 72 72 69 64 69 6e 67 0a now overriding.
15d20 23 20 74 68 65 20 74 65 78 74 20 77 69 64 67 65 # the text widge
15d30 74 2c 20 73 6f 20 77 65 20 63 61 6e 20 70 72 6f t, so we can pro
15d40 62 61 62 6c 79 20 6a 75 73 74 20 64 69 73 61 62 bably just disab
15d50 6c 65 20 74 68 65 20 69 6e 73 65 72 74 20 61 6e le the insert an
15d60 64 20 64 65 6c 65 74 65 0a 23 20 63 6f 6d 6d 61 d delete.# comma
15d70 6e 64 73 2c 20 61 6e 64 20 75 73 65 20 73 6f 6d nds, and use som
15d80 65 74 68 69 6e 67 20 6c 69 6b 65 20 69 6e 73 65 ething like inse
15d90 72 74 5f 20 61 6e 64 20 64 65 6c 65 74 65 5f 20 rt_ and delete_
15da0 69 6e 74 65 72 6e 61 6c 6c 79 2e 0a 23 23 23 23 internally..####
15db0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15dc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15dd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15df0 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
15e00 20 63 6f 6d 6d 6f 6e 2d 6e 61 76 69 67 61 74 69 common-navigati
15e10 6f 6e 20 7b 61 72 67 73 7d 20 7b 0a 20 20 20 20 on {args} {.
15e20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 62 69 global w.. bi
15e30 6e 64 20 2e 20 3c 43 6f 6e 74 72 6f 6c 2d 66 3e nd . <Control-f>
15e40 20 64 6f 2d 66 69 6e 64 0a 0a 20 20 20 20 66 6f do-find.. fo
15e50 72 65 61 63 68 20 77 69 64 67 65 74 20 24 61 72 reach widget $ar
15e60 67 73 20 7b 0a 09 23 20 74 68 69 73 20 65 66 66 gs {..# this eff
15e70 65 63 74 69 76 65 6c 79 20 64 69 73 61 62 6c 65 ectively disable
15e80 73 20 74 68 65 20 77 69 64 67 65 74 2c 20 77 69 s the widget, wi
15e90 74 68 6f 75 74 20 68 61 76 69 6e 67 20 74 6f 0a thout having to.
15ea0 09 23 20 72 65 73 6f 72 74 20 74 6f 20 61 63 74 .# resort to act
15eb0 75 61 6c 6c 79 20 64 69 73 61 62 6c 69 6e 67 20 ually disabling
15ec0 74 68 65 20 77 69 64 67 65 74 20 28 74 68 65 20 the widget (the
15ed0 6c 61 74 74 65 72 20 77 68 69 63 68 0a 09 23 20 latter which..#
15ee0 68 61 73 20 73 6f 6d 65 20 61 6e 6e 6f 79 69 6e has some annoyin
15ef0 67 20 73 69 64 65 20 65 66 66 65 63 74 73 29 2e g side effects).
15f00 20 57 68 61 74 20 77 65 20 72 65 61 6c 6c 79 20 What we really
15f10 77 61 6e 74 20 69 73 20 74 6f 0a 09 23 20 6f 6e want is to..# on
15f20 6c 79 20 64 69 73 61 62 6c 65 20 6b 65 79 73 20 ly disable keys
15f30 74 68 61 74 20 67 65 74 20 69 6e 73 65 72 74 65 that get inserte
15f40 64 2c 20 62 75 74 20 74 68 61 74 27 73 20 64 69 d, but that's di
15f50 66 66 69 63 75 6c 74 0a 09 23 20 74 6f 20 64 6f fficult..# to do
15f60 2c 20 61 6e 64 20 74 68 69 73 20 77 6f 72 6b 73 , and this works
15f70 20 61 6c 6d 6f 73 74 20 61 73 20 77 65 6c 6c 2e almost as well.
15f80 2e 2e 0a 09 62 69 6e 64 20 24 77 69 64 67 65 74 ....bind $widget
15f90 20 3c 4b 65 79 50 72 65 73 73 3e 20 7b 62 72 65 <KeyPress> {bre
15fa0 61 6b 7d 0a 0a 09 62 69 6e 64 20 24 77 69 64 67 ak}...bind $widg
15fb0 65 74 20 3c 41 6c 74 2d 4b 65 79 50 72 65 73 73 et <Alt-KeyPress
15fc0 3e 20 7b 63 6f 6e 74 69 6e 75 65 7d 0a 0a 09 62 > {continue}...b
15fd0 69 6e 64 20 24 77 69 64 67 65 74 20 3c 3c 50 61 ind $widget <<Pa
15fe0 73 74 65 3e 3e 20 7b 62 72 65 61 6b 7d 0a 0a 0a ste>> {break}...
15ff0 09 23 20 2e 2e 2e 20 62 75 74 20 6e 6f 77 20 77 .# ... but now w
16000 65 20 6e 65 65 64 20 74 6f 20 72 65 73 74 6f 72 e need to restor
16010 65 20 73 6f 6d 65 20 6e 61 76 69 67 61 74 69 6f e some navigatio
16020 6e 20 6b 65 79 20 62 69 6e 64 69 6e 67 73 0a 09 n key bindings..
16030 23 20 77 68 69 63 68 20 67 6f 74 20 6c 6f 73 74 # which got lost
16040 20 62 65 63 61 75 73 65 20 77 65 20 64 69 73 61 because we disa
16050 62 6c 65 20 61 6c 6c 20 6b 65 79 73 2e 20 53 69 ble all keys. Si
16060 6e 63 65 20 77 65 20 61 72 65 0a 09 23 20 61 74 nce we are..# at
16070 74 61 63 68 69 6e 67 20 62 69 6e 64 69 6e 67 73 taching bindings
16080 20 74 68 61 74 20 64 75 70 6c 69 63 61 74 65 20 that duplicate
16090 63 6c 61 73 73 20 62 69 6e 64 69 6e 67 73 2c 20 class bindings,
160a0 77 65 20 6e 65 65 64 0a 09 23 20 74 6f 20 62 65 we need..# to be
160b0 20 73 75 72 65 20 61 6e 64 20 69 6e 63 6c 75 64 sure and includ
160c0 65 20 74 68 65 20 62 72 65 61 6b 2c 20 73 6f 20 e the break, so
160d0 74 68 65 20 65 76 65 6e 74 73 20 64 6f 6e 27 74 the events don't
160e0 20 66 69 72 65 0a 09 23 20 74 77 69 63 65 20 28 fire..# twice (
160f0 6f 6e 63 65 20 66 6f 72 20 74 68 65 20 77 69 64 once for the wid
16100 67 65 74 2c 20 6f 6e 63 65 20 66 6f 72 20 74 68 get, once for th
16110 65 20 63 6c 61 73 73 29 2e 20 54 68 65 72 65 20 e class). There
16120 69 73 0a 09 23 20 70 72 6f 62 61 62 6c 79 20 61 is..# probably a
16130 20 6d 75 63 68 20 62 65 74 74 65 72 20 77 61 79 much better way
16140 20 74 6f 20 64 6f 20 61 6c 6c 20 74 68 69 73 2c to do all this,
16150 20 62 75 74 20 49 27 6d 20 74 6f 6f 0a 09 23 20 but I'm too..#
16160 6c 61 7a 79 20 74 6f 20 66 69 67 75 72 65 20 69 lazy to figure i
16170 74 20 6f 75 74 2e 2e 2e 0a 09 66 6f 72 65 61 63 t out.....foreac
16180 68 20 65 76 65 6e 74 20 5b 6c 69 73 74 20 4e 65 h event [list Ne
16190 78 74 20 50 72 69 6f 72 20 55 70 20 44 6f 77 6e xt Prior Up Down
161a0 20 4c 65 66 74 20 52 69 67 68 74 20 48 6f 6d 65 Left Right Home
161b0 20 45 6e 64 5d 20 7b 0a 09 20 20 20 20 66 6f 72 End] {.. for
161c0 65 61 63 68 20 6d 6f 64 69 66 69 65 72 20 5b 6c each modifier [l
161d0 69 73 74 20 7b 7d 20 53 68 69 66 74 20 43 6f 6e ist {} Shift Con
161e0 74 72 6f 6c 20 53 68 69 66 74 2d 43 6f 6e 74 72 trol Shift-Contr
161f0 6f 6c 5d 20 7b 0a 09 09 73 65 74 20 62 69 6e 64 ol] {...set bind
16200 69 6e 67 20 5b 62 69 6e 64 20 54 65 78 74 20 3c ing [bind Text <
16210 24 7b 6d 6f 64 69 66 69 65 72 7d 24 7b 65 76 65 ${modifier}${eve
16220 6e 74 7d 3e 5d 0a 09 09 69 66 20 7b 5b 73 74 72 nt}>]...if {[str
16230 69 6e 67 20 6c 65 6e 67 74 68 20 24 62 69 6e 64 ing length $bind
16240 69 6e 67 5d 20 3e 20 30 7d 20 7b 0a 09 09 20 20 ing] > 0} {...
16250 20 20 62 69 6e 64 20 24 77 69 64 67 65 74 20 22 bind $widget "
16260 3c 24 7b 6d 6f 64 69 66 69 65 72 7d 24 7b 65 76 <${modifier}${ev
16270 65 6e 74 7d 3e 22 20 22 0a 09 09 20 20 20 20 20 ent}>" "...
16280 20 20 20 24 7b 62 69 6e 64 69 6e 67 7d 0a 09 09 ${binding}...
16290 20 20 20 20 20 20 20 20 62 72 65 61 6b 0a 09 09 break...
162a0 20 20 20 20 22 0a 09 09 7d 0a 09 20 20 20 20 7d "...}.. }
162b0 0a 09 7d 0a 0a 09 23 20 74 68 65 73 65 20 62 69 ..}...# these bi
162c0 6e 64 69 6e 67 73 20 61 6c 6c 6f 77 20 63 6f 6e ndings allow con
162d0 74 72 6f 6c 2d 66 2c 20 74 61 62 20 61 6e 64 20 trol-f, tab and
162e0 73 68 69 66 74 2d 74 61 62 20 74 6f 20 77 6f 72 shift-tab to wor
162f0 6b 0a 09 23 20 69 6e 20 73 70 69 74 65 20 6f 66 k..# in spite of
16300 20 74 68 65 20 66 61 63 74 20 77 65 20 62 6f 75 the fact we bou
16310 6e 64 20 41 6e 79 2d 4b 65 79 50 72 65 73 73 20 nd Any-KeyPress
16320 74 6f 20 61 20 6e 75 6c 6c 20 61 63 74 69 6f 6e to a null action
16330 0a 09 62 69 6e 64 20 24 77 69 64 67 65 74 20 3c ..bind $widget <
16340 43 6f 6e 74 72 6f 6c 2d 66 3e 20 63 6f 6e 74 69 Control-f> conti
16350 6e 75 65 0a 0a 09 62 69 6e 64 20 24 77 69 64 67 nue...bind $widg
16360 65 74 20 3c 54 61 62 3e 20 63 6f 6e 74 69 6e 75 et <Tab> continu
16370 65 0a 0a 09 62 69 6e 64 20 24 77 69 64 67 65 74 e...bind $widget
16380 20 3c 53 68 69 66 74 2d 54 61 62 3e 20 63 6f 6e <Shift-Tab> con
16390 74 69 6e 75 65 0a 0a 0a 09 62 69 6e 64 20 24 77 tinue....bind $w
163a0 69 64 67 65 74 20 3c 63 3e 20 22 0a 09 20 20 20 idget <c> "..
163b0 20 63 65 6e 74 65 72 0a 09 20 20 20 20 62 72 65 center.. bre
163c0 61 6b 0a 09 22 0a 09 62 69 6e 64 20 24 77 69 64 ak.."..bind $wid
163d0 67 65 74 20 3c 6e 3e 20 22 0a 09 20 20 20 20 6d get <n> ".. m
163e0 6f 76 65 20 31 0a 09 20 20 20 20 62 72 65 61 6b ove 1.. break
163f0 0a 09 22 0a 09 62 69 6e 64 20 24 77 69 64 67 65 .."..bind $widge
16400 74 20 3c 70 3e 20 22 0a 09 20 20 20 20 6d 6f 76 t <p> ".. mov
16410 65 20 2d 31 0a 09 20 20 20 20 62 72 65 61 6b 0a e -1.. break.
16420 09 22 0a 09 62 69 6e 64 20 24 77 69 64 67 65 74 ."..bind $widget
16430 20 3c 66 3e 20 22 0a 09 20 20 20 20 6d 6f 76 65 <f> ".. move
16440 20 66 69 72 73 74 0a 09 20 20 20 20 62 72 65 61 first.. brea
16450 6b 0a 09 22 0a 09 62 69 6e 64 20 24 77 69 64 67 k.."..bind $widg
16460 65 74 20 3c 6c 3e 20 22 0a 09 20 20 20 20 6d 6f et <l> ".. mo
16470 76 65 20 6c 61 73 74 0a 09 20 20 20 20 62 72 65 ve last.. bre
16480 61 6b 0a 09 22 0a 09 62 69 6e 64 20 24 77 69 64 ak.."..bind $wid
16490 67 65 74 20 3c 71 3e 20 22 0a 09 20 20 20 20 64 get <q> ".. d
164a0 6f 2d 65 78 69 74 0a 09 20 20 20 20 62 72 65 61 o-exit.. brea
164b0 6b 0a 09 22 0a 09 62 69 6e 64 20 24 77 69 64 67 k.."..bind $widg
164c0 65 74 20 3c 72 3e 20 22 0a 09 20 20 20 20 72 65 et <r> ".. re
164d0 63 6f 6d 70 75 74 65 2d 64 69 66 66 0a 09 20 20 compute-diff..
164e0 20 20 62 72 65 61 6b 0a 09 22 0a 09 62 69 6e 64 break.."..bind
164f0 20 24 77 69 64 67 65 74 20 3c 52 65 74 75 72 6e $widget <Return
16500 3e 20 22 0a 09 20 20 20 20 6d 6f 76 65 4e 65 61 > ".. moveNea
16510 72 65 73 74 20 24 77 69 64 67 65 74 20 6d 61 72 rest $widget mar
16520 6b 20 69 6e 73 65 72 74 0a 09 20 20 20 20 62 72 k insert.. br
16530 65 61 6b 0a 09 22 0a 0a 09 23 20 74 68 65 73 65 eak.."...# these
16540 20 62 69 6e 64 69 6e 67 73 20 6b 65 65 70 20 41 bindings keep A
16550 6c 74 2d 20 6d 6f 64 69 66 69 65 64 20 6b 65 79 lt- modified key
16560 73 20 66 72 6f 6d 20 74 72 69 67 67 65 72 69 6e s from triggerin
16570 67 0a 09 23 20 74 68 65 20 61 62 6f 76 65 20 61 g..# the above a
16580 63 74 69 6f 6e 73 2e 20 54 68 69 73 20 77 61 79 ctions. This way
16590 2c 20 61 6e 79 20 41 6c 74 20 63 6f 6d 62 69 6e , any Alt combin
165a0 61 74 69 6f 6e 73 20 74 68 61 74 0a 09 23 20 73 ations that..# s
165b0 68 6f 75 6c 64 20 6f 70 65 6e 20 61 20 6d 65 6e hould open a men
165c0 75 20 77 69 6c 6c 2e 2e 2e 0a 09 66 6f 72 65 61 u will.....forea
165d0 63 68 20 6b 65 79 20 5b 6c 69 73 74 20 63 20 6e ch key [list c n
165e0 20 70 20 66 20 6c 5d 20 7b 0a 09 20 20 20 20 62 p f l] {.. b
165f0 69 6e 64 20 24 77 69 64 67 65 74 20 3c 41 6c 74 ind $widget <Alt
16600 2d 24 6b 65 79 3e 20 7b 63 6f 6e 74 69 6e 75 65 -$key> {continue
16610 7d 0a 09 7d 0a 0a 09 62 69 6e 64 20 24 77 69 64 }..}...bind $wid
16620 67 65 74 20 3c 44 6f 75 62 6c 65 2d 31 3e 20 22 get <Double-1> "
16630 0a 09 20 20 20 20 6d 6f 76 65 4e 65 61 72 65 73 .. moveNeares
16640 74 20 24 77 69 64 67 65 74 20 78 79 20 25 78 20 t $widget xy %x
16650 25 79 0a 09 20 20 20 20 62 72 65 61 6b 0a 09 22 %y.. break.."
16660 0a 0a 09 62 69 6e 64 20 24 77 69 64 67 65 74 20 ...bind $widget
16670 3c 4b 65 79 2d 31 3e 20 22 0a 09 20 20 20 20 64 <Key-1> ".. d
16680 6f 2d 6d 65 72 67 65 2d 63 68 6f 69 63 65 20 31 o-merge-choice 1
16690 0a 09 20 20 20 20 62 72 65 61 6b 0a 09 22 0a 09 .. break.."..
166a0 62 69 6e 64 20 24 77 69 64 67 65 74 20 3c 4b 65 bind $widget <Ke
166b0 79 2d 32 3e 20 22 0a 09 20 20 20 20 64 6f 2d 6d y-2> ".. do-m
166c0 65 72 67 65 2d 63 68 6f 69 63 65 20 32 0a 09 20 erge-choice 2..
166d0 20 20 20 62 72 65 61 6b 0a 09 22 0a 09 62 69 6e break.."..bin
166e0 64 20 24 77 69 64 67 65 74 20 3c 4b 65 79 2d 33 d $widget <Key-3
166f0 3e 20 22 0a 09 20 20 20 20 64 6f 2d 6d 65 72 67 > ".. do-merg
16700 65 2d 63 68 6f 69 63 65 20 31 32 0a 09 20 20 20 e-choice 12..
16710 20 62 72 65 61 6b 0a 09 22 0a 09 62 69 6e 64 20 break.."..bind
16720 24 77 69 64 67 65 74 20 3c 4b 65 79 2d 34 3e 20 $widget <Key-4>
16730 22 0a 09 20 20 20 20 64 6f 2d 6d 65 72 67 65 2d ".. do-merge-
16740 63 68 6f 69 63 65 20 32 31 0a 09 20 20 20 20 62 choice 21.. b
16750 72 65 61 6b 0a 09 22 0a 20 20 20 20 7d 0a 7d 0a reak..". }.}.
16760 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
16770 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16780 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16790 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
167a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
167b0 0a 23 20 73 65 74 20 6f 72 20 63 6c 65 61 72 20 .# set or clear
167c0 61 20 22 64 69 66 66 20 6d 61 72 6b 22 20 2d 2d a "diff mark" --
167d0 20 61 20 68 6f 74 20 62 75 74 74 6f 6e 20 74 6f a hot button to
167e0 20 6d 6f 76 65 20 74 6f 20 61 20 70 61 72 74 69 move to a parti
167f0 63 75 6c 61 72 20 64 69 66 66 0a 23 23 23 23 23 cular diff.#####
16800 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16810 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16830 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16840 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
16850 64 69 66 66 6d 61 72 6b 20 7b 6f 70 74 69 6f 6e diffmark {option
16860 20 7b 64 69 66 66 20 2d 31 7d 7d 20 7b 0a 20 20 {diff -1}} {.
16870 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 64 69 debug-info "di
16880 66 66 6d 61 72 6b 20 28 24 6f 70 74 69 6f 6e 20 ffmark ($option
16890 24 64 69 66 66 29 22 0a 20 20 20 20 67 6c 6f 62 $diff)". glob
168a0 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 al g. global
168b0 77 0a 0a 20 20 20 20 69 66 20 7b 24 64 69 66 66 w.. if {$diff
168c0 20 3d 3d 20 2d 31 7d 20 7b 0a 09 73 65 74 20 64 == -1} {..set d
168d0 69 66 66 20 24 67 28 70 6f 73 29 0a 20 20 20 20 iff $g(pos).
168e0 7d 0a 0a 20 20 20 20 73 65 74 20 77 69 64 67 65 }.. set widge
168f0 74 20 24 77 28 74 6f 6f 6c 62 61 72 29 2e 6d 61 t $w(toolbar).ma
16900 72 6b 24 64 69 66 66 0a 0a 20 20 20 20 73 77 69 rk$diff.. swi
16910 74 63 68 20 2d 2d 20 24 6f 70 74 69 6f 6e 20 7b tch -- $option {
16920 0a 20 20 20 20 61 63 74 69 76 61 74 65 20 7b 0a . activate {.
16930 09 20 20 20 20 6d 6f 76 65 20 24 64 69 66 66 20 . move $diff
16940 30 20 31 0a 09 7d 0a 20 20 20 20 6d 61 72 6b 20 0 1..}. mark
16950 7b 0a 09 20 20 20 20 69 66 20 7b 21 5b 77 69 6e {.. if {![win
16960 66 6f 20 65 78 69 73 74 73 20 24 77 69 64 67 65 fo exists $widge
16970 74 5d 7d 20 7b 0a 09 09 74 6f 6f 6c 62 75 74 74 t]} {...toolbutt
16980 6f 6e 20 24 77 69 64 67 65 74 20 2d 74 65 78 74 on $widget -text
16990 20 22 5c 5b 24 64 69 66 66 5c 5d 22 20 2d 63 6f "\[$diff\]" -co
169a0 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 64 69 66 66 mmand [list diff
169b0 6d 61 72 6b 20 5c 0a 09 09 20 20 61 63 74 69 76 mark \... activ
169c0 61 74 65 20 24 64 69 66 66 5d 20 2d 62 64 20 31 ate $diff] -bd 1
169d0 20 2d 70 61 64 79 20 31 0a 09 09 70 61 63 6b 20 -pady 1...pack
169e0 24 77 69 64 67 65 74 20 2d 73 69 64 65 20 6c 65 $widget -side le
169f0 66 74 20 2d 70 61 64 78 20 32 0a 09 09 73 65 74 ft -padx 2...set
16a00 20 67 28 74 6f 6f 6c 74 69 70 2c 24 77 69 64 67 g(tooltip,$widg
16a10 65 74 29 20 22 44 69 66 66 20 4d 61 72 6b 65 72 et) "Diff Marker
16a20 3a 20 4a 75 6d 70 20 74 6f 20 64 69 66 66 20 72 : Jump to diff r
16a30 65 63 6f 72 64 20 5c 0a 09 09 20 20 6e 75 6d 62 ecord \... numb
16a40 65 72 20 24 64 69 66 66 22 0a 09 20 20 20 20 7d er $diff".. }
16a50 0a 09 20 20 20 20 75 70 64 61 74 65 2d 64 69 73 .. update-dis
16a60 70 6c 61 79 0a 09 7d 0a 20 20 20 20 63 6c 65 61 play..}. clea
16a70 72 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 r {.. if {[wi
16a80 6e 66 6f 20 65 78 69 73 74 73 20 24 77 69 64 67 nfo exists $widg
16a90 65 74 5d 7d 20 7b 0a 09 09 64 65 73 74 72 6f 79 et]} {...destroy
16aa0 20 24 77 69 64 67 65 74 0a 09 09 63 61 74 63 68 $widget...catch
16ab0 20 7b 75 6e 73 65 74 20 67 28 74 6f 6f 6c 74 69 {unset g(toolti
16ac0 70 2c 24 77 69 64 67 65 74 29 7d 0a 09 20 20 20 p,$widget)}..
16ad0 20 7d 0a 09 20 20 20 20 75 70 64 61 74 65 2d 64 }.. update-d
16ae0 69 73 70 6c 61 79 0a 09 7d 0a 20 20 20 20 63 6c isplay..}. cl
16af0 65 61 72 61 6c 6c 20 7b 0a 09 20 20 20 20 73 65 earall {.. se
16b00 74 20 62 6f 6f 6b 6d 61 72 6b 73 20 5b 69 6e 66 t bookmarks [inf
16b10 6f 20 63 6f 6d 6d 61 6e 64 73 20 24 77 28 74 6f o commands $w(to
16b20 6f 6c 62 61 72 29 2e 6d 61 72 6b 2a 5d 0a 09 20 olbar).mark*]..
16b30 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 if {[llength
16b40 24 62 6f 6f 6b 6d 61 72 6b 73 5d 20 3e 20 30 7d $bookmarks] > 0}
16b50 20 7b 0a 09 09 66 6f 72 65 61 63 68 20 77 69 64 {...foreach wid
16b60 67 65 74 20 24 62 6f 6f 6b 6d 61 72 6b 73 20 7b get $bookmarks {
16b70 0a 09 09 20 20 20 20 64 65 73 74 72 6f 79 20 24 ... destroy $
16b80 77 69 64 67 65 74 0a 09 09 20 20 20 20 63 61 74 widget... cat
16b90 63 68 20 7b 75 6e 73 65 74 20 67 28 74 6f 6f 6c ch {unset g(tool
16ba0 74 69 70 2c 24 77 69 64 67 65 74 29 7d 0a 09 09 tip,$widget)}...
16bb0 7d 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 75 70 }.. }.. up
16bc0 64 61 74 65 2d 64 69 73 70 6c 61 79 0a 09 7d 0a date-display..}.
16bd0 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 }.}..#######
16be0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16bf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c20 23 23 23 23 23 23 23 23 0a 23 20 43 75 73 74 6f ########.# Custo
16c30 6d 69 7a 65 20 74 68 65 20 64 69 73 70 6c 61 79 mize the display
16c40 20 28 61 6d 6f 6e 67 20 6f 74 68 65 72 20 74 68 (among other th
16c50 69 6e 67 73 29 2e 0a 23 23 23 23 23 23 23 23 23 ings)..#########
16c60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16c90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
16ca0 23 23 23 23 23 23 0a 70 72 6f 63 20 63 75 73 74 ######.proc cust
16cb0 6f 6d 69 7a 65 20 7b 7d 20 7b 0a 20 20 20 20 64 omize {} {. d
16cc0 65 62 75 67 2d 69 6e 66 6f 20 22 63 75 73 74 6f ebug-info "custo
16cd0 6d 69 7a 65 22 0a 20 20 20 20 67 6c 6f 62 61 6c mize". global
16ce0 20 70 72 65 66 0a 20 20 20 20 67 6c 6f 62 61 6c pref. global
16cf0 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a g. global w.
16d00 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a global opts.
16d10 20 20 20 20 67 6c 6f 62 61 6c 20 74 6d 70 6f 70 global tmpop
16d20 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 74 63 ts. global tc
16d30 6c 5f 70 6c 61 74 66 6f 72 6d 0a 0a 20 20 20 20 l_platform..
16d40 63 61 74 63 68 20 7b 64 65 73 74 72 6f 79 20 24 catch {destroy $
16d50 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 7d 0a w(preferences)}.
16d60 20 20 20 20 74 6f 70 6c 65 76 65 6c 20 24 77 28 toplevel $w(
16d70 70 72 65 66 65 72 65 6e 63 65 73 29 0a 0a 20 20 preferences)..
16d80 20 20 77 6d 20 74 69 74 6c 65 20 24 77 28 70 72 wm title $w(pr
16d90 65 66 65 72 65 6e 63 65 73 29 20 22 24 67 28 6e eferences) "$g(n
16da0 61 6d 65 29 20 50 72 65 66 65 72 65 6e 63 65 73 ame) Preferences
16db0 22 0a 20 20 20 20 77 6d 20 74 72 61 6e 73 69 65 ". wm transie
16dc0 6e 74 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 nt $w(preference
16dd0 73 29 20 2e 0a 20 20 20 20 77 6d 20 67 72 6f 75 s) .. wm grou
16de0 70 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 p $w(preferences
16df0 29 20 2e 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 ) ... if {$g(
16e00 77 69 6e 64 6f 77 69 6e 67 53 79 73 74 65 6d 29 windowingSystem)
16e10 20 3d 3d 20 22 61 71 75 61 22 7d 20 7b 0a 09 73 == "aqua"} {..s
16e20 65 74 41 71 75 61 44 69 61 6c 6f 67 53 74 79 6c etAquaDialogStyl
16e30 65 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 e $w(preferences
16e40 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 77 6d 20 ). }.. wm
16e50 77 69 74 68 64 72 61 77 20 24 77 28 70 72 65 66 withdraw $w(pref
16e60 65 72 65 6e 63 65 73 29 0a 0a 20 20 20 20 23 20 erences).. #
16e70 74 68 65 20 62 75 74 74 6f 6e 20 66 72 61 6d 65 the button frame
16e80 2e 2e 2e 0a 20 20 20 20 66 72 61 6d 65 20 24 77 .... frame $w
16e90 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e 62 75 (preferences).bu
16ea0 74 74 6f 6e 73 20 2d 62 64 20 30 0a 20 20 20 20 ttons -bd 0.
16eb0 62 75 74 74 6f 6e 20 24 77 28 70 72 65 66 65 72 button $w(prefer
16ec0 65 6e 63 65 73 29 2e 62 75 74 74 6f 6e 73 2e 64 ences).buttons.d
16ed0 69 73 6d 69 73 73 20 2d 77 69 64 74 68 20 38 20 ismiss -width 8
16ee0 2d 74 65 78 74 20 22 44 69 73 6d 69 73 73 22 20 -text "Dismiss"
16ef0 5c 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 \. -command
16f00 20 7b 64 65 73 74 72 6f 79 20 24 77 28 70 72 65 {destroy $w(pre
16f10 66 65 72 65 6e 63 65 73 29 7d 0a 20 20 20 20 62 ferences)}. b
16f20 75 74 74 6f 6e 20 24 77 28 70 72 65 66 65 72 65 utton $w(prefere
16f30 6e 63 65 73 29 2e 62 75 74 74 6f 6e 73 2e 61 70 nces).buttons.ap
16f40 70 6c 79 20 2d 77 69 64 74 68 20 38 20 2d 74 65 ply -width 8 -te
16f50 78 74 20 22 41 70 70 6c 79 22 20 5c 0a 20 20 20 xt "Apply" \.
16f60 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 7b 61 70 70 -command {app
16f70 6c 79 20 31 7d 0a 20 20 20 20 62 75 74 74 6f 6e ly 1}. button
16f80 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 $w(preferences)
16f90 2e 62 75 74 74 6f 6e 73 2e 73 61 76 65 20 2d 77 .buttons.save -w
16fa0 69 64 74 68 20 38 20 2d 74 65 78 74 20 22 53 61 idth 8 -text "Sa
16fb0 76 65 22 20 2d 63 6f 6d 6d 61 6e 64 20 73 61 76 ve" -command sav
16fc0 65 0a 0a 20 20 20 20 62 75 74 74 6f 6e 20 24 77 e.. button $w
16fd0 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e 62 75 (preferences).bu
16fe0 74 74 6f 6e 73 2e 68 65 6c 70 20 2d 77 69 64 74 ttons.help -widt
16ff0 68 20 38 20 2d 74 65 78 74 20 22 48 65 6c 70 22 h 8 -text "Help"
17000 20 5c 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e \. -comman
17010 64 20 64 6f 2d 68 65 6c 70 2d 70 72 65 66 65 72 d do-help-prefer
17020 65 6e 63 65 73 0a 0a 20 20 20 20 70 61 63 6b 20 ences.. pack
17030 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e $w(preferences).
17040 62 75 74 74 6f 6e 73 20 2d 73 69 64 65 20 62 6f buttons -side bo
17050 74 74 6f 6d 20 2d 66 69 6c 6c 20 78 0a 20 20 20 ttom -fill x.
17060 20 70 61 63 6b 20 24 77 28 70 72 65 66 65 72 65 pack $w(prefere
17070 6e 63 65 73 29 2e 62 75 74 74 6f 6e 73 2e 64 69 nces).buttons.di
17080 73 6d 69 73 73 20 2d 73 69 64 65 20 72 69 67 68 smiss -side righ
17090 74 20 2d 70 61 64 78 20 31 30 20 2d 70 61 64 79 t -padx 10 -pady
170a0 20 35 0a 20 20 20 20 70 61 63 6b 20 24 77 28 70 5. pack $w(p
170b0 72 65 66 65 72 65 6e 63 65 73 29 2e 62 75 74 74 references).butt
170c0 6f 6e 73 2e 68 65 6c 70 20 2d 73 69 64 65 20 72 ons.help -side r
170d0 69 67 68 74 20 2d 70 61 64 78 20 31 30 20 2d 70 ight -padx 10 -p
170e0 61 64 79 20 35 0a 20 20 20 20 70 61 63 6b 20 24 ady 5. pack $
170f0 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e 62 w(preferences).b
17100 75 74 74 6f 6e 73 2e 73 61 76 65 20 2d 73 69 64 uttons.save -sid
17110 65 20 72 69 67 68 74 20 2d 70 61 64 78 20 31 20 e right -padx 1
17120 2d 70 61 64 79 20 35 0a 20 20 20 20 70 61 63 6b -pady 5. pack
17130 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 $w(preferences)
17140 2e 62 75 74 74 6f 6e 73 2e 61 70 70 6c 79 20 2d .buttons.apply -
17150 73 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 78 side right -padx
17160 20 31 20 2d 70 61 64 79 20 35 0a 0a 20 20 20 20 1 -pady 5..
17170 23 20 61 20 73 65 72 69 65 73 20 6f 66 20 63 68 # a series of ch
17180 65 63 6b 62 75 74 74 6f 6e 73 20 74 6f 20 61 63 eckbuttons to ac
17190 74 20 61 73 20 61 20 70 6f 6f 72 20 6d 61 6e 73 t as a poor mans
171a0 20 6e 6f 74 65 62 6f 6f 6b 20 74 61 62 0a 20 20 notebook tab.
171b0 20 20 66 72 61 6d 65 20 24 77 28 70 72 65 66 65 frame $w(prefe
171c0 72 65 6e 63 65 73 29 2e 6e 6f 74 65 62 6f 6f 6b rences).notebook
171d0 20 2d 62 64 20 30 0a 20 20 20 20 70 61 63 6b 20 -bd 0. pack
171e0 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e $w(preferences).
171f0 6e 6f 74 65 62 6f 6f 6b 20 2d 73 69 64 65 20 74 notebook -side t
17200 6f 70 20 2d 66 69 6c 6c 20 78 20 2d 70 61 64 79 op -fill x -pady
17210 20 34 0a 20 20 20 20 73 65 74 20 70 61 67 65 6c 4. set pagel
17220 69 73 74 20 7b 7d 0a 0a 20 20 20 20 23 20 52 61 ist {}.. # Ra
17230 64 69 6f 62 75 74 74 6f 6e 73 20 77 69 74 68 6f diobuttons witho
17240 75 74 20 69 6e 64 69 63 61 74 6f 72 73 20 6c 6f ut indicators lo
17250 6f 6b 20 72 61 74 68 65 72 20 73 75 63 6b 79 20 ok rather sucky
17260 6f 6e 20 4d 61 63 4f 53 58 2c 20 73 6f 0a 20 20 on MacOSX, so.
17270 20 20 23 20 77 65 27 6c 6c 20 74 77 65 61 6b 20 # we'll tweak
17280 74 68 65 20 73 74 79 6c 65 20 66 6f 72 20 74 68 the style for th
17290 61 74 20 70 6c 61 74 66 6f 72 6d 0a 20 20 20 20 at platform.
172a0 69 66 20 7b 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 if {$::tcl_platf
172b0 6f 72 6d 28 6f 73 29 20 3d 3d 20 22 44 61 72 77 orm(os) == "Darw
172c0 69 6e 22 7d 20 7b 0a 09 73 65 74 20 69 6e 64 69 in"} {..set indi
172d0 63 61 74 6f 72 6f 6e 20 74 72 75 65 0a 20 20 20 catoron true.
172e0 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 69 } else {..set i
172f0 6e 64 69 63 61 74 6f 72 6f 6e 20 66 61 6c 73 65 ndicatoron false
17300 0a 20 20 20 20 7d 0a 0a 20 20 20 20 66 6f 72 65 . }.. fore
17310 61 63 68 20 70 61 67 65 20 5b 6c 69 73 74 20 47 ach page [list G
17320 65 6e 65 72 61 6c 20 44 69 73 70 6c 61 79 20 41 eneral Display A
17330 70 70 65 61 72 61 6e 63 65 5d 20 7b 0a 09 73 65 ppearance] {..se
17340 74 20 66 72 61 6d 65 20 24 77 28 70 72 65 66 65 t frame $w(prefe
17350 72 65 6e 63 65 73 29 2e 66 24 70 61 67 65 0a 09 rences).f$page..
17360 6c 61 70 70 65 6e 64 20 70 61 67 65 6c 69 73 74 lappend pagelist
17370 20 24 66 72 61 6d 65 0a 09 73 65 74 20 72 62 20 $frame..set rb
17380 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e $w(preferences).
17390 6e 6f 74 65 62 6f 6f 6b 2e 66 24 70 61 67 65 0a notebook.f$page.
173a0 09 72 61 64 69 6f 62 75 74 74 6f 6e 20 24 72 62 .radiobutton $rb
173b0 20 2d 63 6f 6d 6d 61 6e 64 20 22 63 75 73 74 6f -command "custo
173c0 6d 69 7a 65 2d 73 65 6c 65 63 74 50 61 67 65 20 mize-selectPage
173d0 24 66 72 61 6d 65 22 20 5c 0a 09 20 20 2d 76 61 $frame" \.. -va
173e0 72 69 61 62 6c 65 20 67 28 70 72 65 66 50 61 67 riable g(prefPag
173f0 65 29 20 2d 76 61 6c 75 65 20 24 66 72 61 6d 65 e) -value $frame
17400 20 2d 68 65 69 67 68 74 20 32 20 2d 74 65 78 74 -height 2 -text
17410 20 24 70 61 67 65 20 5c 0a 09 20 20 2d 69 6e 64 $page \.. -ind
17420 69 63 61 74 6f 72 6f 6e 20 24 69 6e 64 69 63 61 icatoron $indica
17430 74 6f 72 6f 6e 20 2d 77 69 64 74 68 20 31 30 20 toron -width 10
17440 2d 62 6f 72 64 65 72 77 69 64 74 68 20 31 0a 0a -borderwidth 1..
17450 09 70 61 63 6b 20 24 72 62 20 2d 73 69 64 65 20 .pack $rb -side
17460 6c 65 66 74 0a 0a 09 66 72 61 6d 65 20 24 66 72 left...frame $fr
17470 61 6d 65 20 2d 62 64 20 32 20 2d 72 65 6c 69 65 ame -bd 2 -relie
17480 66 20 67 72 6f 6f 76 65 20 2d 77 69 64 74 68 20 f groove -width
17490 34 30 30 20 2d 68 65 69 67 68 74 20 33 30 30 0a 400 -height 300.
174a0 20 20 20 20 7d 0a 20 20 20 20 73 65 74 20 67 28 }. set g(
174b0 70 72 65 66 50 61 67 65 29 20 24 77 28 70 72 65 prefPage) $w(pre
174c0 66 65 72 65 6e 63 65 73 29 2e 66 47 65 6e 65 72 ferences).fGener
174d0 61 6c 0a 0a 20 20 20 20 23 20 6d 61 6b 65 20 73 al.. # make s
174e0 75 72 65 20 6f 75 72 20 6c 61 62 65 6c 73 20 61 ure our labels a
174f0 72 65 20 64 65 66 69 6e 65 64 0a 20 20 20 20 63 re defined. c
17500 75 73 74 6f 6d 69 7a 65 2d 69 6e 69 74 4c 61 62 ustomize-initLab
17510 65 6c 73 0a 0a 20 20 20 20 23 20 74 68 69 73 20 els.. # this
17520 69 73 20 61 6e 20 6f 70 74 69 6f 6e 20 74 68 61 is an option tha
17530 74 20 77 65 20 73 75 70 70 6f 72 74 20 69 6e 74 t we support int
17540 65 72 6e 61 6c 6c 79 2c 20 62 75 74 20 64 6f 6e ernally, but don
17550 27 74 20 67 69 76 65 0a 20 20 20 20 23 20 74 68 't give. # th
17560 65 20 75 73 65 72 20 61 20 77 61 79 20 74 6f 20 e user a way to
17570 64 69 72 65 63 74 6c 79 20 65 64 69 74 20 28 72 directly edit (r
17580 69 67 68 74 20 6e 6f 77 2c 20 61 6e 79 77 61 79 ight now, anyway
17590 29 2e 20 42 75 74 20 77 65 0a 20 20 20 20 23 20 ). But we. #
175a0 6e 65 65 64 20 74 6f 20 6d 61 6b 65 20 73 75 72 need to make sur
175b0 65 20 74 6d 70 6f 70 74 73 20 6b 6e 6f 77 73 20 e tmpopts knows
175c0 61 62 6f 75 74 20 69 74 0a 20 20 20 20 73 65 74 about it. set
175d0 20 74 6d 70 6f 70 74 73 28 63 75 73 74 6f 6d 43 tmpopts(customC
175e0 6f 64 65 29 20 24 6f 70 74 73 28 63 75 73 74 6f ode) $opts(custo
175f0 6d 43 6f 64 65 29 0a 0a 20 20 20 20 23 20 47 65 mCode).. # Ge
17600 6e 65 72 61 6c 0a 20 20 20 20 73 65 74 20 63 6f neral. set co
17610 75 6e 74 20 30 0a 20 20 20 20 73 65 74 20 66 72 unt 0. set fr
17620 61 6d 65 20 24 77 28 70 72 65 66 65 72 65 6e 63 ame $w(preferenc
17630 65 73 29 2e 66 47 65 6e 65 72 61 6c 0a 20 20 20 es).fGeneral.
17640 20 66 6f 72 65 61 63 68 20 6b 65 79 20 7b 64 69 foreach key {di
17650 66 66 63 6d 64 20 69 67 6e 6f 72 65 62 6c 61 6e ffcmd ignoreblan
17660 6b 73 6f 70 74 20 74 6d 70 64 69 72 20 65 64 69 ksopt tmpdir edi
17670 74 6f 72 20 67 65 6f 6d 65 74 72 79 7d 20 7b 0a tor geometry} {.
17680 09 6c 61 62 65 6c 20 24 66 72 61 6d 65 2e 6c 24 .label $frame.l$
17690 63 6f 75 6e 74 20 2d 74 65 78 74 20 22 24 70 72 count -text "$pr
176a0 65 66 28 24 6b 65 79 29 3a 20 22 20 2d 61 6e 63 ef($key): " -anc
176b0 68 6f 72 20 77 0a 09 73 65 74 20 74 6d 70 6f 70 hor w..set tmpop
176c0 74 73 28 24 6b 65 79 29 20 24 6f 70 74 73 28 24 ts($key) $opts($
176d0 6b 65 79 29 0a 09 65 6e 74 72 79 20 24 66 72 61 key)..entry $fra
176e0 6d 65 2e 65 24 63 6f 75 6e 74 20 2d 74 65 78 74 me.e$count -text
176f0 76 61 72 69 61 62 6c 65 20 74 6d 70 6f 70 74 73 variable tmpopts
17700 28 24 6b 65 79 29 20 2d 77 69 64 74 68 20 35 30 ($key) -width 50
17710 20 2d 62 64 20 32 20 5c 0a 09 20 20 2d 72 65 6c -bd 2 \.. -rel
17720 69 65 66 20 73 75 6e 6b 65 6e 0a 0a 09 67 72 69 ief sunken...gri
17730 64 20 24 66 72 61 6d 65 2e 6c 24 63 6f 75 6e 74 d $frame.l$count
17740 20 2d 72 6f 77 20 24 63 6f 75 6e 74 20 2d 63 6f -row $count -co
17750 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 77 lumn 0 -sticky w
17760 20 2d 70 61 64 78 20 35 20 2d 70 61 64 79 20 32 -padx 5 -pady 2
17770 0a 09 67 72 69 64 20 24 66 72 61 6d 65 2e 65 24 ..grid $frame.e$
17780 63 6f 75 6e 74 20 2d 72 6f 77 20 24 63 6f 75 6e count -row $coun
17790 74 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 t -column 1 -sti
177a0 63 6b 79 20 65 77 20 2d 70 61 64 78 20 35 20 2d cky ew -padx 5 -
177b0 70 61 64 79 20 32 0a 0a 09 69 6e 63 72 20 63 6f pady 2...incr co
177c0 75 6e 74 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 unt. }.. #
177d0 20 74 68 69 73 20 69 73 20 6a 75 73 74 20 66 6f this is just fo
177e0 72 20 66 69 6c 6c 65 72 2e 2e 2e 0a 20 20 20 20 r filler....
177f0 6c 61 62 65 6c 20 24 66 72 61 6d 65 2e 66 69 6c label $frame.fil
17800 6c 65 72 20 2d 74 65 78 74 20 7b 7d 0a 20 20 20 ler -text {}.
17810 20 67 72 69 64 20 24 66 72 61 6d 65 2e 66 69 6c grid $frame.fil
17820 6c 65 72 20 2d 72 6f 77 20 24 63 6f 75 6e 74 0a ler -row $count.
17830 20 20 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 0a incr count..
17840 20 20 20 20 66 6f 72 65 61 63 68 20 6b 65 79 20 foreach key
17850 7b 66 61 6e 63 79 42 75 74 74 6f 6e 73 20 74 6f {fancyButtons to
17860 6f 6c 62 61 72 49 63 6f 6e 73 20 61 75 74 6f 63 olbarIcons autoc
17870 65 6e 74 65 72 20 73 79 6e 63 73 63 72 6f 6c 6c enter syncscroll
17880 20 61 75 74 6f 73 65 6c 65 63 74 7d 20 7b 0a 09 autoselect} {..
17890 6c 61 62 65 6c 20 24 66 72 61 6d 65 2e 6c 24 63 label $frame.l$c
178a0 6f 75 6e 74 20 2d 74 65 78 74 20 22 24 70 72 65 ount -text "$pre
178b0 66 28 24 6b 65 79 29 3a 20 22 20 2d 61 6e 63 68 f($key): " -anch
178c0 6f 72 20 77 0a 09 73 65 74 20 74 6d 70 6f 70 74 or w..set tmpopt
178d0 73 28 24 6b 65 79 29 20 24 6f 70 74 73 28 24 6b s($key) $opts($k
178e0 65 79 29 0a 09 63 68 65 63 6b 62 75 74 74 6f 6e ey)..checkbutton
178f0 20 24 66 72 61 6d 65 2e 63 24 63 6f 75 6e 74 20 $frame.c$count
17900 2d 69 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 75 -indicatoron tru
17910 65 20 2d 74 65 78 74 20 22 24 70 72 65 66 28 24 e -text "$pref($
17920 6b 65 79 29 22 20 5c 0a 09 20 20 2d 6a 75 73 74 key)" \.. -just
17930 69 66 79 20 6c 65 66 74 20 2d 6f 6e 76 61 6c 75 ify left -onvalu
17940 65 20 31 20 2d 6f 66 66 76 61 6c 75 65 20 30 20 e 1 -offvalue 0
17950 2d 76 61 72 69 61 62 6c 65 20 74 6d 70 6f 70 74 -variable tmpopt
17960 73 28 24 6b 65 79 29 0a 0a 09 73 65 74 20 74 6d s($key)...set tm
17970 70 6f 70 74 73 28 24 6b 65 79 29 20 24 6f 70 74 popts($key) $opt
17980 73 28 24 6b 65 79 29 0a 0a 09 69 66 20 7b 24 6b s($key)...if {$k
17990 65 79 20 3d 3d 20 22 66 61 6e 63 79 42 75 74 74 ey == "fancyButt
179a0 6f 6e 73 22 20 26 26 20 24 67 28 77 69 6e 64 6f ons" && $g(windo
179b0 77 69 6e 67 53 79 73 74 65 6d 29 20 3d 3d 20 22 wingSystem) == "
179c0 61 71 75 61 22 7d 20 7b 0a 09 20 20 20 20 23 20 aqua"} {.. #
179d0 53 6b 69 70 69 74 20 2d 20 6e 6f 74 68 69 6e 67 Skipit - nothing
179e0 20 74 6f 20 64 6f 0a 09 20 20 20 20 69 6e 63 72 to do.. incr
179f0 20 63 6f 75 6e 74 0a 09 20 20 20 20 63 6f 6e 74 count.. cont
17a00 69 6e 75 65 0a 09 7d 0a 0a 09 67 72 69 64 20 24 inue..}...grid $
17a10 66 72 61 6d 65 2e 63 24 63 6f 75 6e 74 20 2d 72 frame.c$count -r
17a20 6f 77 20 24 63 6f 75 6e 74 20 2d 63 6f 6c 75 6d ow $count -colum
17a30 6e 20 30 20 2d 63 6f 6c 75 6d 6e 73 70 61 6e 20 n 0 -columnspan
17a40 32 20 2d 73 74 69 63 6b 79 20 77 20 5c 0a 09 20 2 -sticky w \..
17a50 20 2d 70 61 64 78 20 35 0a 0a 09 69 6e 63 72 20 -padx 5...incr
17a60 63 6f 75 6e 74 0a 20 20 20 20 7d 0a 0a 20 20 20 count. }..
17a70 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 grid columnconf
17a80 69 67 75 72 65 20 24 66 72 61 6d 65 20 30 20 2d igure $frame 0 -
17a90 77 65 69 67 68 74 20 30 0a 20 20 20 20 67 72 69 weight 0. gri
17aa0 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 d columnconfigur
17ab0 65 20 24 66 72 61 6d 65 20 31 20 2d 77 65 69 67 e $frame 1 -weig
17ac0 68 74 20 31 0a 0a 20 20 20 20 23 20 74 68 69 73 ht 1.. # this
17ad0 2c 20 69 6e 20 65 66 66 65 63 74 2c 20 61 64 64 , in effect, add
17ae0 73 20 61 20 68 69 64 64 65 6e 20 72 6f 77 20 61 s a hidden row a
17af0 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 77 68 69 t the bottom whi
17b00 63 68 20 74 61 6b 65 73 0a 20 20 20 20 23 20 75 ch takes. # u
17b10 70 20 61 6e 79 20 65 78 74 72 61 20 72 6f 6f 6d p any extra room
17b20 0a 0a 20 20 20 20 67 72 69 64 20 72 6f 77 63 6f .. grid rowco
17b30 6e 66 69 67 75 72 65 20 24 66 72 61 6d 65 20 24 nfigure $frame $
17b40 63 6f 75 6e 74 20 2d 77 65 69 67 68 74 20 31 0a count -weight 1.
17b50 0a 20 20 20 20 23 20 70 61 63 6b 20 74 68 69 73 . # pack this
17b60 20 77 69 6e 64 6f 77 20 66 6f 72 20 61 20 62 72 window for a br
17b70 69 65 66 20 6d 6f 6d 65 6e 74 2c 20 61 6e 64 20 ief moment, and
17b80 63 6f 6d 70 75 74 65 20 74 68 65 20 77 69 6e 64 compute the wind
17b90 6f 77 0a 20 20 20 20 23 20 73 69 7a 65 2e 20 57 ow. # size. W
17ba0 65 27 6c 6c 20 64 6f 20 74 68 69 73 20 66 6f 72 e'll do this for
17bb0 20 65 61 63 68 20 22 70 61 67 65 22 20 61 6e 64 each "page" and
17bc0 20 66 69 6e 64 20 74 68 65 20 6c 61 72 67 65 73 find the larges
17bd0 74 0a 20 20 20 20 23 20 73 69 7a 65 20 74 6f 20 t. # size to
17be0 62 65 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 be the size of t
17bf0 68 65 20 64 69 61 6c 6f 67 0a 20 20 20 20 70 61 he dialog. pa
17c00 63 6b 20 24 66 72 61 6d 65 20 2d 73 69 64 65 20 ck $frame -side
17c10 72 69 67 68 74 20 2d 66 69 6c 6c 20 62 6f 74 68 right -fill both
17c20 20 2d 65 78 70 61 6e 64 20 79 0a 20 20 20 20 75 -expand y. u
17c30 70 64 61 74 65 20 69 64 6c 65 74 61 73 6b 73 0a pdate idletasks.
17c40 20 20 20 20 73 65 74 20 6d 61 78 77 69 64 74 68 set maxwidth
17c50 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 64 74 68 [winfo reqwidth
17c60 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 $w(preferences)
17c70 5d 0a 20 20 20 20 73 65 74 20 6d 61 78 68 65 69 ]. set maxhei
17c80 67 68 74 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 ght [winfo reqhe
17c90 69 67 68 74 20 24 77 28 70 72 65 66 65 72 65 6e ight $w(preferen
17ca0 63 65 73 29 5d 0a 20 20 20 20 70 61 63 6b 20 66 ces)]. pack f
17cb0 6f 72 67 65 74 20 24 66 72 61 6d 65 0a 0a 20 20 orget $frame..
17cc0 20 20 23 20 41 70 70 65 61 72 61 6e 63 65 0a 20 # Appearance.
17cd0 20 20 20 73 65 74 20 66 72 61 6d 65 20 24 77 28 set frame $w(
17ce0 70 72 65 66 65 72 65 6e 63 65 73 29 2e 66 41 70 preferences).fAp
17cf0 70 65 61 72 61 6e 63 65 0a 20 20 20 20 73 65 74 pearance. set
17d00 20 63 6f 75 6e 74 20 30 0a 20 20 20 20 66 6f 72 count 0. for
17d10 65 61 63 68 20 6b 65 79 20 7b 74 65 78 74 6f 70 each key {textop
17d20 74 20 64 69 66 66 74 61 67 20 64 65 6c 74 61 67 t difftag deltag
17d30 20 69 6e 73 74 61 67 20 63 68 67 74 61 67 20 63 instag chgtag c
17d40 75 72 72 74 61 67 20 62 79 74 65 74 61 67 20 5c urrtag bytetag \
17d50 0a 20 20 20 20 20 20 69 6e 6c 69 6e 65 74 61 67 . inlinetag
17d60 20 6f 76 65 72 6c 61 70 74 61 67 7d 20 7b 0a 09 overlaptag} {..
17d70 6c 61 62 65 6c 20 24 66 72 61 6d 65 2e 6c 24 63 label $frame.l$c
17d80 6f 75 6e 74 20 2d 74 65 78 74 20 22 24 70 72 65 ount -text "$pre
17d90 66 28 24 6b 65 79 29 3a 20 22 20 2d 61 6e 63 68 f($key): " -anch
17da0 6f 72 20 77 0a 09 73 65 74 20 74 6d 70 6f 70 74 or w..set tmpopt
17db0 73 28 24 6b 65 79 29 20 24 6f 70 74 73 28 24 6b s($key) $opts($k
17dc0 65 79 29 0a 09 65 6e 74 72 79 20 24 66 72 61 6d ey)..entry $fram
17dd0 65 2e 65 24 63 6f 75 6e 74 20 2d 74 65 78 74 76 e.e$count -textv
17de0 61 72 69 61 62 6c 65 20 74 6d 70 6f 70 74 73 28 ariable tmpopts(
17df0 24 6b 65 79 29 20 2d 62 64 20 32 20 2d 72 65 6c $key) -bd 2 -rel
17e00 69 65 66 20 73 75 6e 6b 65 6e 0a 0a 09 67 72 69 ief sunken...gri
17e10 64 20 24 66 72 61 6d 65 2e 6c 24 63 6f 75 6e 74 d $frame.l$count
17e20 20 2d 72 6f 77 20 24 63 6f 75 6e 74 20 2d 63 6f -row $count -co
17e30 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 77 lumn 0 -sticky w
17e40 20 2d 70 61 64 78 20 35 20 2d 70 61 64 79 20 32 -padx 5 -pady 2
17e50 0a 09 67 72 69 64 20 24 66 72 61 6d 65 2e 65 24 ..grid $frame.e$
17e60 63 6f 75 6e 74 20 2d 72 6f 77 20 24 63 6f 75 6e count -row $coun
17e70 74 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 t -column 1 -sti
17e80 63 6b 79 20 65 77 20 2d 70 61 64 78 20 35 20 2d cky ew -padx 5 -
17e90 70 61 64 79 20 32 0a 0a 09 69 6e 63 72 20 63 6f pady 2...incr co
17ea0 75 6e 74 0a 20 20 20 20 7d 0a 20 20 20 20 67 72 unt. }. gr
17eb0 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 id columnconfigu
17ec0 72 65 20 24 66 72 61 6d 65 20 30 20 2d 77 65 69 re $frame 0 -wei
17ed0 67 68 74 20 30 0a 20 20 20 20 67 72 69 64 20 63 ght 0. grid c
17ee0 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 olumnconfigure $
17ef0 66 72 61 6d 65 20 31 20 2d 77 65 69 67 68 74 20 frame 1 -weight
17f00 31 0a 0a 20 20 20 20 23 20 74 61 62 73 74 6f 70 1.. # tabstop
17f10 73 20 61 72 65 20 70 6c 61 63 65 64 20 61 66 74 s are placed aft
17f20 65 72 20 61 20 6c 69 74 74 6c 65 20 65 78 74 72 er a little extr
17f30 61 20 77 68 69 74 65 73 70 61 63 65 2c 20 73 69 a whitespace, si
17f40 6e 63 65 20 69 74 20 69 73 0a 20 20 20 20 23 20 nce it is. #
17f50 73 6c 69 67 68 74 6c 79 20 64 69 66 66 65 72 65 slightly differe
17f60 6e 74 20 74 68 61 6e 20 61 6c 6c 20 6f 66 20 74 nt than all of t
17f70 68 65 20 6f 74 68 65 72 20 6f 70 74 69 6f 6e 73 he other options
17f80 20 28 69 65 3a 20 69 74 27 73 20 6e 6f 74 0a 20 (ie: it's not.
17f90 20 20 20 23 20 61 20 6c 69 73 74 20 6f 66 20 77 # a list of w
17fa0 69 64 67 65 74 20 6f 70 74 69 6f 6e 73 29 0a 20 idget options).
17fb0 20 20 20 66 72 61 6d 65 20 24 66 72 61 6d 65 2e frame $frame.
17fc0 73 65 70 24 63 6f 75 6e 74 20 2d 62 64 20 30 20 sep$count -bd 0
17fd0 2d 68 65 69 67 68 74 20 34 0a 20 20 20 20 67 72 -height 4. gr
17fe0 69 64 20 24 66 72 61 6d 65 2e 73 65 70 24 63 6f id $frame.sep$co
17ff0 75 6e 74 20 2d 72 6f 77 20 24 63 6f 75 6e 74 20 unt -row $count
18000 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 69 63 6b -column 0 -stick
18010 20 65 77 20 2d 63 6f 6c 75 6d 6e 73 70 61 6e 20 ew -columnspan
18020 32 20 5c 0a 20 20 20 20 20 20 2d 70 61 64 78 20 2 \. -padx
18030 35 20 2d 70 61 64 79 20 32 0a 20 20 20 20 69 6e 5 -pady 2. in
18040 63 72 20 63 6f 75 6e 74 0a 0a 20 20 20 20 73 65 cr count.. se
18050 74 20 6b 65 79 20 22 74 61 62 73 74 6f 70 73 22 t key "tabstops"
18060 0a 20 20 20 20 73 65 74 20 74 6d 70 6f 70 74 73 . set tmpopts
18070 28 24 6b 65 79 29 20 24 6f 70 74 73 28 24 6b 65 ($key) $opts($ke
18080 79 29 0a 20 20 20 20 6c 61 62 65 6c 20 24 66 72 y). label $fr
18090 61 6d 65 2e 6c 24 63 6f 75 6e 74 20 2d 74 65 78 ame.l$count -tex
180a0 74 20 22 24 70 72 65 66 28 24 6b 65 79 29 3a 22 t "$pref($key):"
180b0 20 2d 61 6e 63 68 6f 72 20 77 0a 20 20 20 20 73 -anchor w. s
180c0 65 74 20 74 6d 70 6f 70 74 73 28 24 6b 65 79 29 et tmpopts($key)
180d0 20 24 6f 70 74 73 28 24 6b 65 79 29 0a 20 20 20 $opts($key).
180e0 20 65 6e 74 72 79 20 24 66 72 61 6d 65 2e 65 24 entry $frame.e$
180f0 63 6f 75 6e 74 20 2d 74 65 78 74 76 61 72 69 61 count -textvaria
18100 62 6c 65 20 74 6d 70 6f 70 74 73 28 24 6b 65 79 ble tmpopts($key
18110 29 20 2d 62 64 20 32 20 2d 72 65 6c 69 65 66 20 ) -bd 2 -relief
18120 73 75 6e 6b 65 6e 20 5c 0a 20 20 20 20 20 20 2d sunken \. -
18130 77 69 64 74 68 20 33 0a 20 20 20 20 67 72 69 64 width 3. grid
18140 20 24 66 72 61 6d 65 2e 6c 24 63 6f 75 6e 74 20 $frame.l$count
18150 2d 72 6f 77 20 24 63 6f 75 6e 74 20 2d 63 6f 6c -row $count -col
18160 75 6d 6e 20 30 20 2d 73 74 69 63 6b 79 20 77 20 umn 0 -sticky w
18170 2d 70 61 64 78 20 35 20 2d 70 61 64 79 20 32 0a -padx 5 -pady 2.
18180 20 20 20 20 67 72 69 64 20 24 66 72 61 6d 65 2e grid $frame.
18190 65 24 63 6f 75 6e 74 20 2d 72 6f 77 20 24 63 6f e$count -row $co
181a0 75 6e 74 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 unt -column 1 -s
181b0 74 69 63 6b 79 20 77 20 2d 70 61 64 78 20 35 20 ticky w -padx 5
181c0 2d 70 61 64 79 20 32 0a 20 20 20 20 69 6e 63 72 -pady 2. incr
181d0 20 63 6f 75 6e 74 0a 0a 20 20 20 20 23 20 61 64 count.. # ad
181e0 64 20 61 20 74 69 6e 79 20 62 69 74 20 6f 66 20 d a tiny bit of
181f0 76 61 6c 69 64 61 74 69 6f 6e 2c 20 73 6f 20 74 validation, so t
18200 68 65 20 75 73 65 72 20 63 61 6e 20 6f 6e 6c 79 he user can only
18210 20 65 6e 74 65 72 20 6e 75 6d 62 65 72 73 0a 20 enter numbers.
18220 20 20 20 74 72 61 63 65 20 76 61 72 69 61 62 6c trace variabl
18230 65 20 74 6d 70 6f 70 74 73 28 24 6b 65 79 29 20 e tmpopts($key)
18240 77 20 5b 6c 69 73 74 20 76 61 6c 69 64 61 74 65 w [list validate
18250 20 69 6e 74 65 67 65 72 5d 0a 0a 20 20 20 20 23 integer].. #
18260 20 74 68 69 73 2c 20 69 6e 20 65 66 66 65 63 74 this, in effect
18270 2c 20 61 64 64 73 20 61 20 68 69 64 64 65 6e 20 , adds a hidden
18280 72 6f 77 20 61 74 20 74 68 65 20 62 6f 74 74 6f row at the botto
18290 6d 20 77 68 69 63 68 20 74 61 6b 65 73 0a 20 20 m which takes.
182a0 20 20 23 20 75 70 20 61 6e 79 20 65 78 74 72 61 # up any extra
182b0 20 72 6f 6f 6d 0a 0a 20 20 20 20 67 72 69 64 20 room.. grid
182c0 72 6f 77 63 6f 6e 66 69 67 75 72 65 20 24 66 72 rowconfigure $fr
182d0 61 6d 65 20 24 63 6f 75 6e 74 20 2d 77 65 69 67 ame $count -weig
182e0 68 74 20 31 0a 0a 20 20 20 20 70 61 63 6b 20 24 ht 1.. pack $
182f0 66 72 61 6d 65 20 2d 73 69 64 65 20 72 69 67 68 frame -side righ
18300 74 20 2d 66 69 6c 6c 20 62 6f 74 68 20 2d 65 78 t -fill both -ex
18310 70 61 6e 64 20 79 0a 20 20 20 20 75 70 64 61 74 pand y. updat
18320 65 20 69 64 6c 65 74 61 73 6b 73 0a 20 20 20 20 e idletasks.
18330 73 65 74 20 6d 61 78 77 69 64 74 68 20 5b 6d 61 set maxwidth [ma
18340 78 20 24 6d 61 78 77 69 64 74 68 20 5b 77 69 6e x $maxwidth [win
18350 66 6f 20 72 65 71 77 69 64 74 68 20 24 77 28 70 fo reqwidth $w(p
18360 72 65 66 65 72 65 6e 63 65 73 29 5d 5d 0a 20 20 references)]].
18370 20 20 73 65 74 20 6d 61 78 68 65 69 67 68 74 20 set maxheight
18380 5b 6d 61 78 20 24 6d 61 78 68 65 69 67 68 74 20 [max $maxheight
18390 5b 77 69 6e 66 6f 20 72 65 71 68 65 69 67 68 74 [winfo reqheight
183a0 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 $w(preferences)
183b0 5d 5d 0a 20 20 20 20 70 61 63 6b 20 66 6f 72 67 ]]. pack forg
183c0 65 74 20 24 66 72 61 6d 65 0a 0a 20 20 20 20 23 et $frame.. #
183d0 20 44 69 73 70 6c 61 79 0a 20 20 20 20 73 65 74 Display. set
183e0 20 66 72 61 6d 65 20 24 77 28 70 72 65 66 65 72 frame $w(prefer
183f0 65 6e 63 65 73 29 2e 66 44 69 73 70 6c 61 79 0a ences).fDisplay.
18400 20 20 20 20 73 65 74 20 72 6f 77 20 30 0a 0a 20 set row 0..
18410 20 20 20 23 20 4f 70 74 69 6f 6e 20 66 69 65 6c # Option fiel
18420 64 73 0a 20 20 20 20 23 20 4e 6f 74 65 20 74 68 ds. # Note th
18430 61 74 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 at the order of
18440 74 68 65 20 6c 69 73 74 20 69 73 20 75 73 65 64 the list is used
18450 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 0a 20 20 to determine.
18460 20 20 23 20 74 68 65 20 6c 61 79 6f 75 74 2e 20 # the layout.
18470 53 6f 2c 20 69 66 20 79 6f 75 20 61 64 64 20 73 So, if you add s
18480 6f 6d 65 74 68 69 6e 67 20 74 6f 20 74 68 65 20 omething to the
18490 6c 69 73 74 20 70 61 79 0a 20 20 20 20 23 20 61 list pay. # a
184a0 74 74 65 6e 74 69 6f 6e 20 74 6f 20 68 6f 77 20 ttention to how
184b0 69 74 20 61 66 66 65 63 74 73 20 74 68 69 6e 67 it affects thing
184c0 73 2e 0a 20 20 20 20 23 0a 20 20 20 20 23 20 61 s.. #. # a
184d0 6e 20 78 20 6d 65 61 6e 73 20 61 6e 20 65 6d 70 n x means an emp
184e0 74 79 20 63 6f 6c 75 6d 6e 3b 20 61 20 2d 20 6d ty column; a - m
184f0 65 61 6e 73 20 61 6e 20 65 6d 70 74 79 20 72 6f eans an empty ro
18500 77 0a 20 20 20 20 73 65 74 20 63 6f 6c 20 30 0a w. set col 0.
18510 20 20 20 20 66 6f 72 65 61 63 68 20 6b 65 79 20 foreach key
18520 5b 6c 69 73 74 20 73 68 6f 77 6c 6e 20 74 61 67 [list showln tag
18530 6c 6e 20 73 68 6f 77 63 62 73 20 74 61 67 63 62 ln showcbs tagcb
18540 73 20 73 68 6f 77 6d 61 70 20 63 6f 6c 6f 72 63 s showmap colorc
18550 62 73 20 5c 0a 20 20 20 20 20 20 73 68 6f 77 6c bs \. showl
18560 69 6e 65 76 69 65 77 20 74 61 67 74 65 78 74 20 ineview tagtext
18570 69 67 6e 6f 72 65 62 6c 61 6e 6b 73 20 73 68 6f ignoreblanks sho
18580 77 69 6e 6c 69 6e 65 31 20 78 20 73 68 6f 77 69 winline1 x showi
18590 6e 6c 69 6e 65 32 20 78 5d 20 7b 0a 0a 09 69 66 nline2 x] {...if
185a0 20 7b 24 6b 65 79 20 3d 3d 20 22 78 22 7d 20 7b {$key == "x"} {
185b0 0a 09 20 20 20 20 73 65 74 20 63 6f 6c 20 5b 65 .. set col [e
185c0 78 70 72 20 7b 24 63 6f 6c 20 3f 20 30 20 3a 20 xpr {$col ? 0 :
185d0 31 7d 5d 0a 09 20 20 20 20 69 66 20 7b 24 63 6f 1}].. if {$co
185e0 6c 20 3d 3d 20 30 7d 20 7b 0a 09 09 69 6e 63 72 l == 0} {...incr
185f0 20 72 6f 77 0a 09 20 20 20 20 7d 0a 09 20 20 20 row.. }..
18600 20 63 6f 6e 74 69 6e 75 65 0a 09 7d 0a 0a 09 69 continue..}...i
18610 66 20 7b 24 6b 65 79 20 3d 3d 20 22 2d 22 7d 20 f {$key == "-"}
18620 7b 0a 09 20 20 20 20 66 72 61 6d 65 20 24 66 72 {.. frame $fr
18630 61 6d 65 2e 66 24 7b 72 6f 77 7d 20 2d 62 64 20 ame.f${row} -bd
18640 30 20 2d 68 65 69 67 68 74 20 34 0a 09 20 20 20 0 -height 4..
18650 20 67 72 69 64 20 24 66 72 61 6d 65 2e 66 24 7b grid $frame.f${
18660 72 6f 77 7d 20 2d 72 6f 77 20 24 72 6f 77 20 2d row} -row $row -
18670 63 6f 6c 75 6d 6e 20 30 20 2d 63 6f 6c 75 6d 6e column 0 -column
18680 73 70 61 6e 20 32 20 2d 70 61 64 78 20 32 30 20 span 2 -padx 20
18690 5c 0a 09 20 20 20 20 20 20 2d 70 61 64 79 20 34 \.. -pady 4
186a0 20 2d 73 74 69 63 6b 79 20 6e 73 65 77 0a 09 20 -sticky nsew..
186b0 20 20 20 73 65 74 20 63 6f 6c 20 31 20 3b 23 20 set col 1 ;#
186c0 77 69 6c 6c 20 66 6f 72 63 65 20 6e 65 78 74 20 will force next
186d0 63 6f 6c 75 6d 6e 20 74 6f 20 7a 65 72 6f 20 61 column to zero a
186e0 6e 64 20 69 6e 63 72 20 72 6f 77 0a 0a 09 7d 20 nd incr row...}
186f0 65 6c 73 65 20 7b 0a 0a 09 20 20 20 20 63 68 65 else {... che
18700 63 6b 62 75 74 74 6f 6e 20 24 66 72 61 6d 65 2e ckbutton $frame.
18710 63 24 7b 72 6f 77 7d 24 7b 63 6f 6c 7d 20 2d 69 c${row}${col} -i
18720 6e 64 69 63 61 74 6f 72 6f 6e 20 74 72 75 65 20 ndicatoron true
18730 5c 0a 09 20 20 20 20 20 20 2d 74 65 78 74 20 22 \.. -text "
18740 24 70 72 65 66 28 24 6b 65 79 29 22 20 2d 6f 6e $pref($key)" -on
18750 76 61 6c 75 65 20 31 20 2d 6f 66 66 76 61 6c 75 value 1 -offvalu
18760 65 20 30 20 2d 76 61 72 69 61 62 6c 65 20 74 6d e 0 -variable tm
18770 70 6f 70 74 73 28 24 6b 65 79 29 0a 0a 09 20 20 popts($key)...
18780 20 20 73 65 74 20 74 6d 70 6f 70 74 73 28 24 6b set tmpopts($k
18790 65 79 29 20 24 6f 70 74 73 28 24 6b 65 79 29 0a ey) $opts($key).
187a0 0a 09 20 20 20 20 67 72 69 64 20 24 66 72 61 6d .. grid $fram
187b0 65 2e 63 24 7b 72 6f 77 7d 24 63 6f 6c 20 2d 72 e.c${row}$col -r
187c0 6f 77 20 24 72 6f 77 20 2d 63 6f 6c 75 6d 6e 20 ow $row -column
187d0 24 63 6f 6c 20 2d 73 74 69 63 6b 79 20 77 20 2d $col -sticky w -
187e0 70 61 64 78 20 35 0a 09 7d 0a 0a 09 73 65 74 20 padx 5..}...set
187f0 63 6f 6c 20 5b 65 78 70 72 20 7b 24 63 6f 6c 20 col [expr {$col
18800 3f 20 30 20 3a 20 31 7d 5d 0a 09 69 66 20 7b 24 ? 0 : 1}]..if {$
18810 63 6f 6c 20 3d 3d 20 30 7d 20 7b 0a 09 20 20 20 col == 0} {..
18820 20 69 6e 63 72 20 72 6f 77 0a 09 7d 0a 20 20 20 incr row..}.
18830 20 7d 0a 0a 20 20 20 20 67 72 69 64 20 63 6f 6c }.. grid col
18840 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 66 72 umnconfigure $fr
18850 61 6d 65 20 30 20 2d 77 65 69 67 68 74 20 30 0a ame 0 -weight 0.
18860 20 20 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 grid columnc
18870 6f 6e 66 69 67 75 72 65 20 24 66 72 61 6d 65 20 onfigure $frame
18880 31 20 2d 77 65 69 67 68 74 20 30 0a 20 20 20 20 1 -weight 0.
18890 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 grid columnconfi
188a0 67 75 72 65 20 24 66 72 61 6d 65 20 32 20 2d 77 gure $frame 2 -w
188b0 65 69 67 68 74 20 30 0a 20 20 20 20 67 72 69 64 eight 0. grid
188c0 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 columnconfigure
188d0 20 24 66 72 61 6d 65 20 33 20 2d 77 65 69 67 68 $frame 3 -weigh
188e0 74 20 30 0a 20 20 20 20 67 72 69 64 20 63 6f 6c t 0. grid col
188f0 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 66 72 umnconfigure $fr
18900 61 6d 65 20 34 20 2d 77 65 69 67 68 74 20 31 0a ame 4 -weight 1.
18910 0a 20 20 20 20 23 20 61 64 64 20 76 61 6c 69 64 . # add valid
18920 61 74 69 6f 6e 20 74 6f 20 6d 61 6b 65 20 6f 6e ation to make on
18930 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 68 ly one of the sh
18940 6f 77 69 6e 6c 69 6e 65 23 20 6f 70 74 69 6f 6e owinline# option
18950 73 20 61 72 65 20 73 65 74 0a 20 20 20 20 74 72 s are set. tr
18960 61 63 65 20 76 61 72 69 61 62 6c 65 20 74 6d 70 ace variable tmp
18970 6f 70 74 73 28 73 68 6f 77 69 6e 6c 69 6e 65 31 opts(showinline1
18980 29 20 77 20 5b 6c 69 73 74 20 76 61 6c 69 64 61 ) w [list valida
18990 74 65 2d 69 6e 6c 69 6e 65 20 73 68 6f 77 69 6e te-inline showin
189a0 6c 69 6e 65 31 5d 0a 20 20 20 20 74 72 61 63 65 line1]. trace
189b0 20 76 61 72 69 61 62 6c 65 20 74 6d 70 6f 70 74 variable tmpopt
189c0 73 28 73 68 6f 77 69 6e 6c 69 6e 65 32 29 20 77 s(showinline2) w
189d0 20 5b 6c 69 73 74 20 76 61 6c 69 64 61 74 65 2d [list validate-
189e0 69 6e 6c 69 6e 65 20 73 68 6f 77 69 6e 6c 69 6e inline showinlin
189f0 65 32 5d 0a 0a 20 20 20 20 23 20 74 68 69 73 2c e2].. # this,
18a00 20 69 6e 20 65 66 66 65 63 74 2c 20 61 64 64 73 in effect, adds
18a10 20 61 20 68 69 64 64 65 6e 20 72 6f 77 20 61 74 a hidden row at
18a20 20 74 68 65 20 62 6f 74 74 6f 6d 20 77 68 69 63 the bottom whic
18a30 68 20 74 61 6b 65 73 0a 20 20 20 20 23 20 75 70 h takes. # up
18a40 20 61 6e 79 20 65 78 74 72 61 20 72 6f 6f 6d 0a any extra room.
18a50 0a 20 20 20 20 67 72 69 64 20 72 6f 77 63 6f 6e . grid rowcon
18a60 66 69 67 75 72 65 20 24 66 72 61 6d 65 20 24 72 figure $frame $r
18a70 6f 77 20 2d 77 65 69 67 68 74 20 31 0a 0a 20 20 ow -weight 1..
18a80 20 20 70 61 63 6b 20 24 66 72 61 6d 65 20 2d 73 pack $frame -s
18a90 69 64 65 20 72 69 67 68 74 20 2d 66 69 6c 6c 20 ide right -fill
18aa0 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 0a 20 both -expand y.
18ab0 20 20 20 75 70 64 61 74 65 20 69 64 6c 65 74 61 update idleta
18ac0 73 6b 73 0a 20 20 20 20 73 65 74 20 6d 61 78 77 sks. set maxw
18ad0 69 64 74 68 20 5b 6d 61 78 20 24 6d 61 78 77 69 idth [max $maxwi
18ae0 64 74 68 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 dth [winfo reqwi
18af0 64 74 68 20 24 77 28 70 72 65 66 65 72 65 6e 63 dth $w(preferenc
18b00 65 73 29 5d 5d 0a 20 20 20 20 73 65 74 20 6d 61 es)]]. set ma
18b10 78 68 65 69 67 68 74 20 5b 6d 61 78 20 24 6d 61 xheight [max $ma
18b20 78 68 65 69 67 68 74 20 5b 77 69 6e 66 6f 20 72 xheight [winfo r
18b30 65 71 68 65 69 67 68 74 20 24 77 28 70 72 65 66 eqheight $w(pref
18b40 65 72 65 6e 63 65 73 29 5d 5d 0a 20 20 20 20 70 erences)]]. p
18b50 61 63 6b 20 66 6f 72 67 65 74 20 24 66 72 61 6d ack forget $fram
18b60 65 0a 0a 20 20 20 20 63 75 73 74 6f 6d 69 7a 65 e.. customize
18b70 2d 73 65 6c 65 63 74 50 61 67 65 0a 0a 20 20 20 -selectPage..
18b80 20 23 20 63 6f 6d 70 75 74 65 20 61 20 72 65 61 # compute a rea
18b90 73 6f 6e 61 62 6c 65 20 6c 6f 63 61 74 69 6f 6e sonable location
18ba0 20 66 6f 72 20 74 68 65 20 77 69 6e 64 6f 77 2e for the window.
18bb0 2e 2e 0a 20 20 20 20 63 65 6e 74 65 72 57 69 6e ... centerWin
18bc0 64 6f 77 20 24 77 28 70 72 65 66 65 72 65 6e 63 dow $w(preferenc
18bd0 65 73 29 20 5b 6c 69 73 74 20 24 6d 61 78 77 69 es) [list $maxwi
18be0 64 74 68 20 24 6d 61 78 68 65 69 67 68 74 5d 0a dth $maxheight].
18bf0 0a 20 20 20 20 77 6d 20 64 65 69 63 6f 6e 69 66 . wm deiconif
18c00 79 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 73 y $w(preferences
18c10 29 0a 7d 0a 0a 70 72 6f 63 20 76 61 6c 69 64 61 ).}..proc valida
18c20 74 65 20 7b 74 79 70 65 20 6e 61 6d 65 20 69 6e te {type name in
18c30 64 65 78 20 6f 70 7d 20 7b 0a 20 20 20 20 67 6c dex op} {. gl
18c40 6f 62 61 6c 20 74 6d 70 6f 70 74 73 0a 0a 20 20 obal tmpopts..
18c50 20 20 23 20 69 66 20 77 65 20 66 61 69 6c 20 74 # if we fail t
18c60 68 65 20 63 68 65 63 6b 2c 20 61 74 74 65 6d 70 he check, attemp
18c70 74 20 74 6f 20 64 6f 20 73 6f 6d 65 74 68 69 6e t to do somethin
18c80 67 20 63 6c 65 76 65 72 0a 20 20 20 20 69 66 20 g clever. if
18c90 7b 21 5b 73 74 72 69 6e 67 20 69 73 20 24 74 79 {![string is $ty
18ca0 70 65 20 24 74 6d 70 6f 70 74 73 28 24 69 6e 64 pe $tmpopts($ind
18cb0 65 78 29 5d 7d 20 7b 0a 09 62 65 6c 6c 0a 0a 09 ex)]} {..bell...
18cc0 73 77 69 74 63 68 20 2d 2d 20 24 74 79 70 65 20 switch -- $type
18cd0 7b 0a 09 69 6e 74 65 67 65 72 20 7b 0a 09 09 72 {..integer {...r
18ce0 65 67 73 75 62 20 2d 61 6c 6c 20 7b 5b 5e 30 2d egsub -all {[^0-
18cf0 39 5d 7d 20 24 74 6d 70 6f 70 74 73 28 24 69 6e 9]} $tmpopts($in
18d00 64 65 78 29 20 7b 7d 20 74 6d 70 6f 70 74 73 28 dex) {} tmpopts(
18d10 24 69 6e 64 65 78 29 0a 09 20 20 20 20 7d 0a 09 $index).. }..
18d20 64 65 66 61 75 6c 74 20 7b 0a 09 09 23 20 74 68 default {...# th
18d30 69 73 20 73 68 6f 75 6c 64 20 6e 65 76 65 72 20 is should never
18d40 68 61 70 70 65 6e 2e 20 49 66 20 79 6f 75 20 75 happen. If you u
18d50 73 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 2c se this routine,
18d60 0a 09 09 23 20 6d 61 6b 65 20 73 75 72 65 20 79 ...# make sure y
18d70 6f 75 20 61 64 64 20 63 61 73 65 73 20 74 6f 20 ou add cases to
18d80 68 61 6e 64 6c 65 20 61 6c 6c 20 70 6f 73 73 69 handle all possi
18d90 62 6c 65 0a 09 09 23 20 76 61 6c 75 65 73 20 6f ble...# values o
18da0 66 20 24 74 79 70 65 20 75 73 65 64 20 62 79 20 f $type used by
18db0 74 68 69 73 20 70 72 6f 67 72 61 6d 2e 0a 09 09 this program....
18dc0 73 65 74 20 74 6d 70 6f 70 74 73 28 24 69 6e 64 set tmpopts($ind
18dd0 65 78 29 20 22 22 0a 09 20 20 20 20 7d 0a 09 7d ex) "".. }..}
18de0 0a 20 20 20 20 7d 0a 7d 0a 0a 70 72 6f 63 20 76 . }.}..proc v
18df0 61 6c 69 64 61 74 65 2d 69 6e 6c 69 6e 65 20 7b alidate-inline {
18e00 6f 70 74 69 6f 6e 20 6e 61 6d 65 20 69 6e 64 65 option name inde
18e10 78 20 6f 70 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 x op} {. glob
18e20 61 6c 20 74 6d 70 6f 70 74 73 0a 0a 20 20 20 20 al tmpopts..
18e30 69 66 20 7b 24 74 6d 70 6f 70 74 73 28 24 69 6e if {$tmpopts($in
18e40 64 65 78 29 7d 20 7b 0a 09 69 66 20 7b 24 69 6e dex)} {..if {$in
18e50 64 65 78 20 3d 3d 20 22 73 68 6f 77 69 6e 6c 69 dex == "showinli
18e60 6e 65 31 22 7d 20 7b 0a 09 20 20 20 20 73 65 74 ne1"} {.. set
18e70 20 74 6d 70 6f 70 74 73 28 73 68 6f 77 69 6e 6c tmpopts(showinl
18e80 69 6e 65 32 29 20 30 0a 09 7d 20 65 6c 73 65 69 ine2) 0..} elsei
18e90 66 20 7b 24 69 6e 64 65 78 20 3d 3d 20 22 73 68 f {$index == "sh
18ea0 6f 77 69 6e 6c 69 6e 65 32 22 7d 20 7b 0a 09 20 owinline2"} {..
18eb0 20 20 20 73 65 74 20 74 6d 70 6f 70 74 73 28 73 set tmpopts(s
18ec0 68 6f 77 69 6e 6c 69 6e 65 31 29 20 30 0a 09 7d howinline1) 0..}
18ed0 0a 20 20 20 20 7d 0a 7d 0a 0a 70 72 6f 63 20 63 . }.}..proc c
18ee0 75 73 74 6f 6d 69 7a 65 2d 73 65 6c 65 63 74 50 ustomize-selectP
18ef0 61 67 65 20 7b 7b 66 72 61 6d 65 20 7b 7d 7d 7d age {{frame {}}}
18f00 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 20 {. global g
18f10 77 0a 0a 20 20 20 20 69 66 20 7b 24 66 72 61 6d w.. if {$fram
18f20 65 20 3d 3d 20 22 22 7d 20 7b 0a 09 73 65 74 20 e == ""} {..set
18f30 66 72 61 6d 65 20 24 67 28 70 72 65 66 50 61 67 frame $g(prefPag
18f40 65 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 61 e). }.. pa
18f50 63 6b 20 66 6f 72 67 65 74 20 24 77 28 70 72 65 ck forget $w(pre
18f60 66 65 72 65 6e 63 65 73 29 2e 66 47 65 6e 65 72 ferences).fGener
18f70 61 6c 0a 20 20 20 20 70 61 63 6b 20 66 6f 72 67 al. pack forg
18f80 65 74 20 24 77 28 70 72 65 66 65 72 65 6e 63 65 et $w(preference
18f90 73 29 2e 66 41 70 70 65 61 72 61 6e 63 65 0a 20 s).fAppearance.
18fa0 20 20 20 70 61 63 6b 20 66 6f 72 67 65 74 20 24 pack forget $
18fb0 77 28 70 72 65 66 65 72 65 6e 63 65 73 29 2e 66 w(preferences).f
18fc0 44 69 73 70 6c 61 79 0a 20 20 20 20 70 61 63 6b Display. pack
18fd0 20 66 6f 72 67 65 74 20 24 77 28 70 72 65 66 65 forget $w(prefe
18fe0 72 65 6e 63 65 73 29 2e 66 42 65 68 61 76 69 6f rences).fBehavio
18ff0 72 0a 20 20 20 20 70 61 63 6b 20 24 66 72 61 6d r. pack $fram
19000 65 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d 66 e -side right -f
19010 69 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 ill both -expand
19020 20 79 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 y.}..##########
19030 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19040 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19050 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19060 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19070 23 23 23 23 23 0a 23 20 64 65 66 69 6e 65 20 74 #####.# define t
19080 68 65 20 6c 61 62 65 6c 73 20 66 6f 72 20 74 68 he labels for th
19090 65 20 70 72 65 66 65 72 65 6e 63 65 73 2e 20 54 e preferences. T
190a0 68 69 73 20 69 73 20 64 6f 6e 65 20 6f 75 74 73 his is done outs
190b0 69 64 65 20 6f 66 0a 23 20 74 68 65 20 63 75 73 ide of.# the cus
190c0 74 6f 6d 69 7a 65 20 70 72 6f 63 20 73 69 6e 63 tomize proc sinc
190d0 65 20 74 68 65 20 6c 61 62 65 6c 73 20 61 72 65 e the labels are
190e0 20 75 73 65 64 20 69 6e 20 74 68 65 20 68 65 6c used in the hel
190f0 70 20 74 65 78 74 2e 0a 23 23 23 23 23 23 23 23 p text..########
19100 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19110 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19120 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19130 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19140 23 23 23 23 23 23 23 0a 70 72 6f 63 20 63 75 73 #######.proc cus
19150 74 6f 6d 69 7a 65 2d 69 6e 69 74 4c 61 62 65 6c tomize-initLabel
19160 73 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 s {} {. globa
19170 6c 20 70 72 65 66 0a 0a 20 20 20 20 73 65 74 20 l pref.. set
19180 70 72 65 66 28 64 69 66 66 63 6d 64 29 20 7b 64 pref(diffcmd) {d
19190 69 66 66 20 63 6f 6d 6d 61 6e 64 7d 0a 20 20 20 iff command}.
191a0 20 73 65 74 20 70 72 65 66 28 69 67 6e 6f 72 65 set pref(ignore
191b0 62 6c 61 6e 6b 73 6f 70 74 29 20 7b 49 67 6e 6f blanksopt) {Igno
191c0 72 65 20 62 6c 61 6e 6b 73 20 6f 70 74 69 6f 6e re blanks option
191d0 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 69 }. set pref(i
191e0 67 6e 6f 72 65 62 6c 61 6e 6b 73 29 20 7b 49 67 gnoreblanks) {Ig
191f0 6e 6f 72 65 20 62 6c 61 6e 6b 73 20 77 68 65 6e nore blanks when
19200 20 64 69 66 66 69 6e 67 7d 0a 20 20 20 20 73 65 diffing}. se
19210 74 20 70 72 65 66 28 74 65 78 74 6f 70 74 29 20 t pref(textopt)
19220 7b 54 65 78 74 20 77 69 64 67 65 74 20 6f 70 74 {Text widget opt
19230 69 6f 6e 73 7d 0a 20 20 20 20 73 65 74 20 70 72 ions}. set pr
19240 65 66 28 62 79 74 65 74 61 67 29 20 7b 54 61 67 ef(bytetag) {Tag
19250 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 63 68 61 options for cha
19260 72 61 63 74 65 72 73 20 69 6e 20 6c 69 6e 65 20 racters in line
19270 76 69 65 77 7d 0a 20 20 20 20 73 65 74 20 70 72 view}. set pr
19280 65 66 28 64 69 66 66 74 61 67 29 20 7b 54 61 67 ef(difftag) {Tag
19290 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 64 69 66 options for dif
192a0 66 20 72 65 67 69 6f 6e 73 7d 0a 20 20 20 20 73 f regions}. s
192b0 65 74 20 70 72 65 66 28 63 75 72 72 74 61 67 29 et pref(currtag)
192c0 20 7b 54 61 67 20 6f 70 74 69 6f 6e 73 20 66 6f {Tag options fo
192d0 72 20 74 68 65 20 63 75 72 72 65 6e 74 20 64 69 r the current di
192e0 66 66 20 72 65 67 69 6f 6e 7d 0a 20 20 20 20 73 ff region}. s
192f0 65 74 20 70 72 65 66 28 69 6e 6c 69 6e 65 74 61 et pref(inlineta
19300 67 29 20 7b 54 61 67 20 6f 70 74 69 6f 6e 73 20 g) {Tag options
19310 66 6f 72 20 64 69 66 66 20 72 65 67 69 6f 6e 20 for diff region
19320 69 6e 6c 69 6e 65 20 64 69 66 66 65 72 65 6e 63 inline differenc
19330 65 73 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 es}. set pref
19340 28 64 65 6c 74 61 67 29 20 7b 54 61 67 20 6f 70 (deltag) {Tag op
19350 74 69 6f 6e 73 20 66 6f 72 20 64 65 6c 65 74 65 tions for delete
19360 64 20 64 69 66 66 20 72 65 67 69 6f 6e 7d 0a 20 d diff region}.
19370 20 20 20 73 65 74 20 70 72 65 66 28 69 6e 73 74 set pref(inst
19380 61 67 29 20 7b 54 61 67 20 6f 70 74 69 6f 6e 73 ag) {Tag options
19390 20 66 6f 72 20 69 6e 73 65 72 74 65 64 20 64 69 for inserted di
193a0 66 66 20 72 65 67 69 6f 6e 7d 0a 20 20 20 20 73 ff region}. s
193b0 65 74 20 70 72 65 66 28 63 68 67 74 61 67 29 20 et pref(chgtag)
193c0 7b 54 61 67 20 6f 70 74 69 6f 6e 73 20 66 6f 72 {Tag options for
193d0 20 63 68 61 6e 67 65 64 20 64 69 66 66 20 72 65 changed diff re
193e0 67 69 6f 6e 7d 0a 20 20 20 20 73 65 74 20 70 72 gion}. set pr
193f0 65 66 28 6f 76 65 72 6c 61 70 74 61 67 29 20 7b ef(overlaptag) {
19400 54 61 67 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 Tag options for
19410 6f 76 65 72 6c 61 70 20 64 69 66 66 20 72 65 67 overlap diff reg
19420 69 6f 6e 7d 0a 20 20 20 20 73 65 74 20 70 72 65 ion}. set pre
19430 66 28 67 65 6f 6d 65 74 72 79 29 20 7b 54 65 78 f(geometry) {Tex
19440 74 20 77 69 6e 64 6f 77 20 73 69 7a 65 7d 0a 20 t window size}.
19450 20 20 20 73 65 74 20 70 72 65 66 28 74 6d 70 64 set pref(tmpd
19460 69 72 29 20 7b 44 69 72 65 63 74 6f 72 79 20 66 ir) {Directory f
19470 6f 72 20 73 63 72 61 74 63 68 20 66 69 6c 65 73 or scratch files
19480 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 65 }. set pref(e
19490 64 69 74 6f 72 29 20 7b 50 72 6f 67 72 61 6d 20 ditor) {Program
194a0 66 6f 72 20 65 64 69 74 69 6e 67 20 66 69 6c 65 for editing file
194b0 73 7d 0a 0a 20 20 20 20 73 65 74 20 70 72 65 66 s}.. set pref
194c0 28 66 61 6e 63 79 42 75 74 74 6f 6e 73 29 20 7b (fancyButtons) {
194d0 57 69 6e 64 6f 77 73 2d 73 74 79 6c 65 20 74 6f Windows-style to
194e0 6f 6c 62 61 72 20 62 75 74 74 6f 6e 73 7d 0a 20 olbar buttons}.
194f0 20 20 20 73 65 74 20 70 72 65 66 28 73 68 6f 77 set pref(show
19500 6c 69 6e 65 76 69 65 77 29 20 7b 53 68 6f 77 20 lineview) {Show
19510 63 75 72 72 65 6e 74 20 6c 69 6e 65 20 63 6f 6d current line com
19520 70 61 72 69 73 6f 6e 20 77 69 6e 64 6f 77 7d 0a parison window}.
19530 20 20 20 20 73 65 74 20 70 72 65 66 28 73 68 6f set pref(sho
19540 77 69 6e 6c 69 6e 65 31 29 20 7b 53 68 6f 77 20 winline1) {Show
19550 69 6e 6c 69 6e 65 20 64 69 66 66 73 20 28 62 79 inline diffs (by
19560 74 65 20 63 6f 6d 70 61 72 69 73 6f 6e 73 29 7d te comparisons)}
19570 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 73 68 . set pref(sh
19580 6f 77 69 6e 6c 69 6e 65 32 29 20 7b 53 68 6f 77 owinline2) {Show
19590 20 69 6e 6c 69 6e 65 20 64 69 66 66 73 20 28 72 inline diffs (r
195a0 65 63 75 72 73 69 76 65 20 6d 61 74 63 68 69 6e ecursive matchin
195b0 67 20 61 6c 67 6f 72 69 74 68 6d 29 7d 0a 20 20 g algorithm)}.
195c0 20 20 73 65 74 20 70 72 65 66 28 73 68 6f 77 6d set pref(showm
195d0 61 70 29 20 7b 53 68 6f 77 20 67 72 61 70 68 69 ap) {Show graphi
195e0 63 61 6c 20 6d 61 70 20 6f 66 20 64 69 66 66 73 cal map of diffs
195f0 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 73 }. set pref(s
19600 68 6f 77 6c 6e 29 20 7b 53 68 6f 77 20 6c 69 6e howln) {Show lin
19610 65 20 6e 75 6d 62 65 72 73 7d 0a 20 20 20 20 73 e numbers}. s
19620 65 74 20 70 72 65 66 28 73 68 6f 77 63 62 73 29 et pref(showcbs)
19630 20 7b 53 68 6f 77 20 63 68 61 6e 67 65 20 62 61 {Show change ba
19640 72 73 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 rs}. set pref
19650 28 61 75 74 6f 63 65 6e 74 65 72 29 20 7b 41 75 (autocenter) {Au
19660 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 65 6e 74 tomatically cent
19670 65 72 20 63 75 72 72 65 6e 74 20 64 69 66 66 20 er current diff
19680 72 65 67 69 6f 6e 7d 0a 20 20 20 20 73 65 74 20 region}. set
19690 70 72 65 66 28 73 79 6e 63 73 63 72 6f 6c 6c 29 pref(syncscroll)
196a0 20 7b 53 79 6e 63 68 72 6f 6e 69 7a 65 20 73 63 {Synchronize sc
196b0 72 6f 6c 6c 62 61 72 73 7d 0a 20 20 20 20 73 65 rollbars}. se
196c0 74 20 70 72 65 66 28 74 6f 6f 6c 62 61 72 49 63 t pref(toolbarIc
196d0 6f 6e 73 29 20 7b 55 73 65 20 69 63 6f 6e 73 20 ons) {Use icons
196e0 69 6e 73 74 65 61 64 20 6f 66 20 6c 61 62 65 6c instead of label
196f0 73 20 69 6e 20 74 68 65 20 74 6f 6f 6c 62 61 72 s in the toolbar
19700 7d 0a 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 }.. set pref(
19710 63 6f 6c 6f 72 63 62 73 29 20 7b 43 6f 6c 6f 72 colorcbs) {Color
19720 20 63 68 61 6e 67 65 20 62 61 72 73 20 74 6f 20 change bars to
19730 6d 61 74 63 68 20 74 68 65 20 64 69 66 66 20 6d match the diff m
19740 61 70 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 ap}. set pref
19750 28 74 61 67 74 65 78 74 29 20 7b 48 69 67 68 6c (tagtext) {Highl
19760 69 67 68 74 20 66 69 6c 65 20 63 6f 6e 74 65 6e ight file conten
19770 74 73 7d 0a 20 20 20 20 73 65 74 20 70 72 65 66 ts}. set pref
19780 28 74 61 67 63 62 73 29 20 7b 48 69 67 68 6c 69 (tagcbs) {Highli
19790 67 68 74 20 63 68 61 6e 67 65 20 62 61 72 73 7d ght change bars}
197a0 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 74 61 . set pref(ta
197b0 67 6c 6e 29 20 7b 48 69 67 68 6c 69 67 68 74 20 gln) {Highlight
197c0 6c 69 6e 65 20 6e 75 6d 62 65 72 73 7d 0a 20 20 line numbers}.
197d0 20 20 73 65 74 20 70 72 65 66 28 74 61 62 73 74 set pref(tabst
197e0 6f 70 73 29 20 7b 54 61 62 20 73 74 6f 70 73 7d ops) {Tab stops}
197f0 0a 0a 20 20 20 20 73 65 74 20 70 72 65 66 28 61 .. set pref(a
19800 75 74 6f 73 65 6c 65 63 74 29 20 22 41 75 74 6f utoselect) "Auto
19810 6d 61 74 69 63 61 6c 6c 79 20 73 65 6c 65 63 74 matically select
19820 20 74 68 65 20 6e 65 61 72 65 73 74 20 64 69 66 the nearest dif
19830 66 20 72 65 67 69 6f 6e 20 77 68 69 6c 65 20 5c f region while \
19840 0a 20 20 20 20 20 20 73 63 72 6f 6c 6c 69 6e 67 . scrolling
19850 22 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 ".}..###########
19860 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19870 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19880 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19890 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
198a0 23 23 23 23 0a 23 20 41 70 70 6c 79 20 63 75 73 ####.# Apply cus
198b0 74 6f 6d 69 7a 61 74 69 6f 6e 20 63 68 61 6e 67 tomization chang
198c0 65 73 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 es..############
198d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
198e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
198f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19900 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19910 23 23 23 0a 70 72 6f 63 20 61 70 70 6c 79 20 7b ###.proc apply {
19920 7b 72 65 6d 61 72 6b 20 30 7d 7d 20 7b 0a 20 20 {remark 0}} {.
19930 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 61 70 debug-info "ap
19940 70 6c 79 20 28 24 72 65 6d 61 72 6b 29 22 0a 20 ply ($remark)".
19950 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 global opts.
19960 20 20 20 67 6c 6f 62 61 6c 20 74 6d 70 6f 70 74 global tmpopt
19970 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 20 s. global w.
19980 20 20 20 67 6c 6f 62 61 6c 20 70 72 65 66 0a 20 global pref.
19990 20 20 20 67 6c 6f 62 61 6c 20 73 63 72 65 65 6e global screen
199a0 57 69 64 74 68 0a 20 20 20 20 67 6c 6f 62 61 6c Width. global
199b0 20 73 63 72 65 65 6e 48 65 69 67 68 74 0a 20 20 screenHeight.
199c0 20 20 67 6c 6f 62 61 6c 20 74 6b 5f 76 65 72 73 global tk_vers
199d0 69 6f 6e 0a 0a 20 20 20 20 67 72 69 64 20 70 72 ion.. grid pr
199e0 6f 70 61 67 61 74 65 20 24 77 28 63 6c 69 65 6e opagate $w(clien
199f0 74 29 20 74 0a 20 20 20 20 69 66 20 7b 21 20 5b t) t. if {! [
19a00 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 file isdirectory
19a10 20 24 74 6d 70 6f 70 74 73 28 74 6d 70 64 69 72 $tmpopts(tmpdir
19a20 29 5d 7d 20 7b 0a 09 64 6f 2d 65 72 72 6f 72 20 )]} {..do-error
19a30 22 49 6e 76 61 6c 69 64 20 74 65 6d 70 6f 72 61 "Invalid tempora
19a40 72 79 20 64 69 72 65 63 74 6f 72 79 20 24 74 6d ry directory $tm
19a50 70 6f 70 74 73 28 74 6d 70 64 69 72 29 22 0a 20 popts(tmpdir)".
19a60 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 5b 63 }.. if {[c
19a70 61 74 63 68 20 22 0a 09 24 77 28 4c 65 66 74 54 atch "..$w(LeftT
19a80 65 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 24 ext) configure $
19a90 74 6d 70 6f 70 74 73 28 74 65 78 74 6f 70 74 29 tmpopts(textopt)
19aa0 0a 09 24 77 28 52 69 67 68 74 54 65 78 74 29 20 ..$w(RightText)
19ab0 63 6f 6e 66 69 67 75 72 65 20 24 74 6d 70 6f 70 configure $tmpop
19ac0 74 73 28 74 65 78 74 6f 70 74 29 0a 09 24 77 28 ts(textopt)..$w(
19ad0 42 6f 74 74 6f 6d 54 65 78 74 29 20 63 6f 6e 66 BottomText) conf
19ae0 69 67 75 72 65 20 24 74 6d 70 6f 70 74 73 28 74 igure $tmpopts(t
19af0 65 78 74 6f 70 74 29 0a 20 20 20 20 22 5d 7d 20 extopt). "]}
19b00 7b 0a 09 64 6f 2d 65 72 72 6f 72 20 22 49 6e 76 {..do-error "Inv
19b10 61 6c 69 64 20 74 65 78 74 20 77 69 64 67 65 74 alid text widget
19b20 20 73 65 74 74 69 6e 67 3a 20 5c 6e 5c 6e 27 24 setting: \n\n'$
19b30 74 6d 70 6f 70 74 73 28 74 65 78 74 6f 70 74 29 tmpopts(textopt)
19b40 27 22 0a 09 65 76 61 6c 20 22 24 77 28 4c 65 66 '"..eval "$w(Lef
19b50 74 54 65 78 74 29 20 20 20 63 6f 6e 66 69 67 75 tText) configu
19b60 72 65 20 24 6f 70 74 73 28 74 65 78 74 6f 70 74 re $opts(textopt
19b70 29 22 0a 09 65 76 61 6c 20 22 24 77 28 52 69 67 )"..eval "$w(Rig
19b80 68 74 54 65 78 74 29 20 20 63 6f 6e 66 69 67 75 htText) configu
19b90 72 65 20 24 6f 70 74 73 28 74 65 78 74 6f 70 74 re $opts(textopt
19ba0 29 22 0a 09 65 76 61 6c 20 22 24 77 28 42 6f 74 )"..eval "$w(Bot
19bb0 74 6f 6d 54 65 78 74 29 20 63 6f 6e 66 69 67 75 tomText) configu
19bc0 72 65 20 24 6f 70 74 73 28 74 65 78 74 6f 70 74 re $opts(textopt
19bd0 29 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d )"..return. }
19be0 0a 0a 20 20 20 20 23 20 74 68 65 20 74 65 78 74 .. # the text
19bf0 20 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 options must be
19c00 20 6f 6b 2e 20 43 6f 6e 66 69 67 75 72 65 20 74 ok. Configure t
19c10 68 65 20 6f 74 68 65 72 20 74 65 78 74 20 77 69 he other text wi
19c20 64 67 65 74 73 0a 20 20 20 20 23 20 73 69 6d 69 dgets. # simi
19c30 6c 61 72 6c 79 0a 20 20 20 20 65 76 61 6c 20 22 larly. eval "
19c40 24 77 28 4c 65 66 74 43 42 29 20 20 20 20 63 6f $w(LeftCB) co
19c50 6e 66 69 67 75 72 65 20 24 74 6d 70 6f 70 74 73 nfigure $tmpopts
19c60 28 74 65 78 74 6f 70 74 29 22 0a 20 20 20 20 65 (textopt)". e
19c70 76 61 6c 20 22 24 77 28 4c 65 66 74 49 6e 66 6f val "$w(LeftInfo
19c80 29 20 20 63 6f 6e 66 69 67 75 72 65 20 24 74 6d ) configure $tm
19c90 70 6f 70 74 73 28 74 65 78 74 6f 70 74 29 22 0a popts(textopt)".
19ca0 20 20 20 20 65 76 61 6c 20 22 24 77 28 52 69 67 eval "$w(Rig
19cb0 68 74 43 42 29 20 20 20 63 6f 6e 66 69 67 75 72 htCB) configur
19cc0 65 20 24 74 6d 70 6f 70 74 73 28 74 65 78 74 6f e $tmpopts(texto
19cd0 70 74 29 22 0a 20 20 20 20 65 76 61 6c 20 22 24 pt)". eval "$
19ce0 77 28 52 69 67 68 74 49 6e 66 6f 29 20 63 6f 6e w(RightInfo) con
19cf0 66 69 67 75 72 65 20 24 74 6d 70 6f 70 74 73 28 figure $tmpopts(
19d00 74 65 78 74 6f 70 74 29 22 0a 0a 20 20 20 20 73 textopt)".. s
19d10 65 74 20 67 72 69 64 73 69 7a 65 20 5b 77 6d 20 et gridsize [wm
19d20 67 72 69 64 20 2e 5d 0a 20 20 20 20 73 65 74 20 grid .]. set
19d30 67 72 69 64 78 20 5b 6c 69 6e 64 65 78 20 24 67 gridx [lindex $g
19d40 72 69 64 73 69 7a 65 20 32 5d 0a 20 20 20 20 73 ridsize 2]. s
19d50 65 74 20 67 72 69 64 79 20 5b 6c 69 6e 64 65 78 et gridy [lindex
19d60 20 24 67 72 69 64 73 69 7a 65 20 33 5d 0a 20 20 $gridsize 3].
19d70 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 77 debug-info " w
19d80 6d 20 67 72 69 64 20 69 73 20 24 67 72 69 64 78 m grid is $gridx
19d90 20 78 20 24 67 72 69 64 79 22 0a 0a 20 20 20 20 x $gridy"..
19da0 73 65 74 20 6d 61 78 75 6e 69 74 73 78 20 5b 65 set maxunitsx [e
19db0 78 70 72 20 7b 24 73 63 72 65 65 6e 57 69 64 74 xpr {$screenWidt
19dc0 68 20 2f 20 24 67 72 69 64 78 7d 5d 0a 20 20 20 h / $gridx}].
19dd0 20 73 65 74 20 6d 61 78 75 6e 69 74 73 79 20 5b set maxunitsy [
19de0 65 78 70 72 20 7b 24 73 63 72 65 65 6e 48 65 69 expr {$screenHei
19df0 67 68 74 20 2f 20 24 67 72 69 64 79 7d 5d 0a 20 ght / $gridy}].
19e00 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 debug-info "
19e10 20 20 6d 61 78 20 58 20 69 73 20 24 6d 61 78 75 max X is $maxu
19e20 6e 69 74 73 78 20 75 6e 69 74 73 22 0a 20 20 20 nitsx units".
19e30 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 20 debug-info "
19e40 6d 61 78 20 59 20 69 73 20 24 6d 61 78 75 6e 69 max Y is $maxuni
19e50 74 73 79 20 75 6e 69 74 73 22 0a 20 20 20 20 73 tsy units". s
19e60 65 74 20 68 61 6c 66 6d 61 78 20 5b 65 78 70 72 et halfmax [expr
19e70 20 7b 24 6d 61 78 75 6e 69 74 73 78 20 2f 20 32 {$maxunitsx / 2
19e80 7d 5d 0a 0a 20 20 20 20 69 66 20 7b 24 74 6d 70 }].. if {$tmp
19e90 6f 70 74 73 28 67 65 6f 6d 65 74 72 79 29 20 3d opts(geometry) =
19ea0 3d 20 22 22 20 7c 7c 20 5b 63 61 74 63 68 20 7b = "" || [catch {
19eb0 73 63 61 6e 20 24 74 6d 70 6f 70 74 73 28 67 65 scan $tmpopts(ge
19ec0 6f 6d 65 74 72 79 29 20 5c 0a 20 20 20 20 20 20 ometry) \.
19ed0 22 25 64 78 25 64 22 20 77 69 64 74 68 20 68 65 "%dx%d" width he
19ee0 69 67 68 74 7d 20 72 65 73 75 6c 74 5d 7d 20 7b ight} result]} {
19ef0 0a 09 64 6f 2d 65 72 72 6f 72 20 22 69 6e 76 61 ..do-error "inva
19f00 6c 69 64 20 67 65 6f 6d 65 74 72 79 20 73 65 74 lid geometry set
19f10 74 69 6e 67 3a 20 24 74 6d 70 6f 70 74 73 28 67 ting: $tmpopts(g
19f20 65 6f 6d 65 74 72 79 29 22 0a 09 72 65 74 75 72 eometry)"..retur
19f30 6e 0a 20 20 20 20 7d 0a 20 20 20 20 64 65 62 75 n. }. debu
19f40 67 2d 69 6e 66 6f 20 22 20 77 69 64 74 68 20 24 g-info " width $
19f50 77 69 64 74 68 20 20 68 61 6c 66 6d 61 78 20 24 width halfmax $
19f60 68 61 6c 66 6d 61 78 22 0a 20 20 20 20 73 65 74 halfmax". set
19f70 20 6d 61 78 77 20 5b 65 78 70 72 20 7b 24 68 61 maxw [expr {$ha
19f80 6c 66 6d 61 78 20 2d 20 31 38 7d 5d 0a 20 20 20 lfmax - 18}].
19f90 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 6d 61 debug-info " ma
19fa0 78 77 20 24 6d 61 78 77 22 0a 20 20 20 20 69 66 xw $maxw". if
19fb0 20 7b 24 77 69 64 74 68 20 3e 20 24 6d 61 78 77 {$width > $maxw
19fc0 7d 20 7b 0a 09 73 65 74 20 77 69 64 74 68 20 24 } {..set width $
19fd0 6d 61 78 77 0a 20 20 20 20 7d 0a 20 20 20 20 23 maxw. }. #
19fe0 20 72 65 2d 63 65 6e 74 65 72 20 6d 61 70 0a 20 re-center map.
19ff0 20 20 20 69 66 20 7b 24 74 6b 5f 76 65 72 73 69 if {$tk_versi
1a000 6f 6e 20 3c 20 38 2e 34 7d 20 7b 0a 20 20 20 20 on < 8.4} {.
1a010 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e grid columncon
1a020 66 69 67 75 72 65 20 24 77 28 63 6c 69 65 6e 74 figure $w(client
1a030 29 20 30 20 2d 77 65 69 67 68 74 20 31 0a 20 20 ) 0 -weight 1.
1a040 20 20 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 grid columnc
1a050 6f 6e 66 69 67 75 72 65 20 24 77 28 63 6c 69 65 onfigure $w(clie
1a060 6e 74 29 20 32 20 2d 77 65 69 67 68 74 20 31 0a nt) 2 -weight 1.
1a070 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 } else {.
1a080 20 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f grid columnco
1a090 6e 66 69 67 75 72 65 20 24 77 28 63 6c 69 65 6e nfigure $w(clien
1a0a0 74 29 20 30 20 2d 77 65 69 67 68 74 20 31 30 30 t) 0 -weight 100
1a0b0 20 2d 75 6e 69 66 6f 72 6d 20 61 0a 20 20 20 20 -uniform a.
1a0c0 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e grid columncon
1a0d0 66 69 67 75 72 65 20 24 77 28 63 6c 69 65 6e 74 figure $w(client
1a0e0 29 20 32 20 2d 77 65 69 67 68 74 20 31 30 30 20 ) 2 -weight 100
1a0f0 2d 75 6e 69 66 6f 72 6d 20 61 0a 20 20 20 20 7d -uniform a. }
1a100 0a 0a 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 .. if {[catch
1a110 20 7b 24 77 28 4c 65 66 74 54 65 78 74 29 20 63 {$w(LeftText) c
1a120 6f 6e 66 69 67 75 72 65 20 2d 77 69 64 74 68 20 onfigure -width
1a130 24 77 69 64 74 68 20 2d 68 65 69 67 68 74 20 24 $width -height $
1a140 68 65 69 67 68 74 7d 20 72 65 73 75 6c 74 5d 7d height} result]}
1a150 20 7b 0a 09 64 6f 2d 65 72 72 6f 72 20 22 69 6e {..do-error "in
1a160 76 61 6c 69 64 20 67 65 6f 6d 65 74 72 79 20 73 valid geometry s
1a170 65 74 74 69 6e 67 3a 20 24 74 6d 70 6f 70 74 73 etting: $tmpopts
1a180 28 67 65 6f 6d 65 74 72 79 29 22 0a 09 72 65 74 (geometry)"..ret
1a190 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 24 77 urn. }. $w
1a1a0 28 52 69 67 68 74 54 65 78 74 29 20 63 6f 6e 66 (RightText) conf
1a1b0 69 67 75 72 65 20 2d 77 69 64 74 68 20 24 77 69 igure -width $wi
1a1c0 64 74 68 20 2d 68 65 69 67 68 74 20 24 68 65 69 dth -height $hei
1a1d0 67 68 74 0a 0a 20 20 20 20 24 77 28 4c 65 66 74 ght.. $w(Left
1a1e0 4c 61 62 65 6c 29 20 63 6f 6e 66 69 67 75 72 65 Label) configure
1a1f0 20 2d 77 69 64 74 68 20 24 77 69 64 74 68 0a 20 -width $width.
1a200 20 20 20 24 77 28 52 69 67 68 74 4c 61 62 65 6c $w(RightLabel
1a210 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 77 69 64 ) configure -wid
1a220 74 68 20 24 77 69 64 74 68 0a 0a 20 20 20 20 67 th $width.. g
1a230 72 69 64 20 66 6f 72 67 65 74 20 24 77 28 4c 65 rid forget $w(Le
1a240 66 74 4c 61 62 65 6c 29 0a 20 20 20 20 67 72 69 ftLabel). gri
1a250 64 20 66 6f 72 67 65 74 20 24 77 28 52 69 67 68 d forget $w(Righ
1a260 74 4c 61 62 65 6c 29 0a 20 20 20 20 67 72 69 64 tLabel). grid
1a270 20 24 77 28 4c 65 66 74 4c 61 62 65 6c 29 20 2d $w(LeftLabel) -
1a280 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 30 20 row 0 -column 0
1a290 2d 73 74 69 63 6b 79 20 65 77 0a 20 20 20 20 67 -sticky ew. g
1a2a0 72 69 64 20 24 77 28 52 69 67 68 74 4c 61 62 65 rid $w(RightLabe
1a2b0 6c 29 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d l) -row 0 -colum
1a2c0 6e 20 32 20 2d 73 74 69 63 6b 79 20 65 77 0a 0a n 2 -sticky ew..
1a2d0 20 20 20 20 66 6f 72 65 61 63 68 20 74 61 67 20 foreach tag
1a2e0 7b 64 69 66 66 74 61 67 20 63 75 72 72 74 61 67 {difftag currtag
1a2f0 20 69 6e 6c 69 6e 65 74 61 67 20 64 65 6c 74 61 inlinetag delta
1a300 67 20 69 6e 73 74 61 67 20 63 68 67 74 61 67 20 g instag chgtag
1a310 6f 76 65 72 6c 61 70 74 61 67 7d 20 7b 0a 09 66 overlaptag} {..f
1a320 6f 72 65 61 63 68 20 77 69 6e 20 5b 6c 69 73 74 oreach win [list
1a330 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 24 77 $w(LeftText) $w
1a340 28 4c 65 66 74 49 6e 66 6f 29 20 24 77 28 4c 65 (LeftInfo) $w(Le
1a350 66 74 43 42 29 20 24 77 28 52 69 67 68 74 54 65 ftCB) $w(RightTe
1a360 78 74 29 20 5c 0a 09 20 20 24 77 28 52 69 67 68 xt) \.. $w(Righ
1a370 74 49 6e 66 6f 29 20 24 77 28 52 69 67 68 74 43 tInfo) $w(RightC
1a380 42 29 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b B)] {.. if {[
1a390 63 61 74 63 68 20 22 24 77 69 6e 20 74 61 67 20 catch "$win tag
1a3a0 63 6f 6e 66 69 67 75 72 65 20 24 74 61 67 20 24 configure $tag $
1a3b0 74 6d 70 6f 70 74 73 28 24 74 61 67 29 22 5d 7d tmpopts($tag)"]}
1a3c0 20 7b 0a 09 09 64 6f 2d 65 72 72 6f 72 20 22 49 {...do-error "I
1a3d0 6e 76 61 6c 69 64 20 73 65 74 74 69 6e 67 73 20 nvalid settings
1a3e0 66 6f 72 20 5c 22 24 70 72 65 66 28 24 74 61 67 for \"$pref($tag
1a3f0 29 5c 22 3a 20 5c 0a 09 09 5c 6e 5c 6e 27 24 74 )\": \...\n\n'$t
1a400 6d 70 6f 70 74 73 28 24 74 61 67 29 27 20 69 73 mpopts($tag)' is
1a410 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 6f 70 74 not a valid opt
1a420 69 6f 6e 20 73 74 72 69 6e 67 22 0a 09 09 65 76 ion string"...ev
1a430 61 6c 20 22 24 77 69 6e 20 74 61 67 20 63 6f 6e al "$win tag con
1a440 66 69 67 75 72 65 20 24 74 61 67 20 24 6f 70 74 figure $tag $opt
1a450 73 28 24 74 61 67 29 22 0a 09 09 72 65 74 75 72 s($tag)"...retur
1a460 6e 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 n.. }..}.
1a470 7d 0a 0a 20 20 20 20 69 66 20 7b 5b 63 61 74 63 }.. if {[catc
1a480 68 20 22 24 77 28 42 6f 74 74 6f 6d 54 65 78 74 h "$w(BottomText
1a490 29 20 74 61 67 20 63 6f 6e 66 69 67 75 72 65 20 ) tag configure
1a4a0 64 69 66 66 20 24 74 6d 70 6f 70 74 73 28 62 79 diff $tmpopts(by
1a4b0 74 65 74 61 67 29 22 5d 7d 20 7b 0a 09 64 6f 2d tetag)"]} {..do-
1a4c0 65 72 72 6f 72 20 22 49 6e 76 61 6c 69 64 20 73 error "Invalid s
1a4d0 65 74 74 69 6e 67 73 20 66 6f 72 20 5c 22 24 70 ettings for \"$p
1a4e0 72 65 66 28 62 79 74 65 74 61 67 29 5c 22 3a 20 ref(bytetag)\":
1a4f0 5c 0a 09 5c 6e 5c 6e 27 24 74 6d 70 6f 70 74 73 \..\n\n'$tmpopts
1a500 28 62 79 74 65 74 61 67 29 27 20 69 73 20 6e 6f (bytetag)' is no
1a510 74 20 61 20 76 61 6c 69 64 20 6f 70 74 69 6f 6e t a valid option
1a520 20 73 74 72 69 6e 67 22 0a 09 65 76 61 6c 20 22 string"..eval "
1a530 24 77 28 42 6f 74 74 6f 6d 54 65 78 74 29 20 74 $w(BottomText) t
1a540 61 67 20 63 6f 6e 66 69 67 75 72 65 20 64 69 66 ag configure dif
1a550 66 20 24 6f 70 74 73 28 62 79 74 65 74 61 67 29 f $opts(bytetag)
1a560 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a "..return. }.
1a570 0a 20 20 20 20 23 20 74 61 62 73 74 6f 70 73 20 . # tabstops
1a580 72 65 71 75 69 72 65 20 61 20 6c 69 74 74 6c 65 require a little
1a590 20 65 78 74 72 61 20 77 6f 72 6b 2e 20 57 65 20 extra work. We
1a5a0 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f need to figure o
1a5b0 75 74 0a 20 20 20 20 23 20 74 68 65 20 77 69 64 ut. # the wid
1a5c0 74 68 20 6f 66 20 61 6e 20 22 6d 22 20 69 6e 20 th of an "m" in
1a5d0 74 68 65 20 77 69 64 67 65 74 27 73 20 66 6f 6e the widget's fon
1a5e0 74 2c 20 74 68 65 6e 20 6d 75 6c 74 69 70 6c 79 t, then multiply
1a5f0 20 74 68 61 74 0a 20 20 20 20 23 20 62 79 20 74 that. # by t
1a600 68 65 20 74 61 62 20 73 74 6f 70 20 77 69 64 74 he tab stop widt
1a610 68 2e 20 46 6f 72 20 74 68 65 20 62 6f 74 74 6f h. For the botto
1a620 6d 20 74 65 78 74 20 77 69 64 67 65 74 20 74 68 m text widget th
1a630 65 20 66 69 72 73 74 20 74 61 62 73 74 6f 70 0a e first tabstop.
1a640 20 20 20 20 23 20 69 73 20 61 64 6a 75 73 74 65 # is adjuste
1a650 64 20 62 79 20 74 77 6f 20 74 6f 20 74 61 6b 65 d by two to take
1a660 20 69 6e 74 6f 20 63 6f 6e 73 69 64 65 72 61 74 into considerat
1a670 69 6f 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 ion the fact tha
1a680 74 20 77 65 0a 20 20 20 20 23 20 61 64 64 20 74 t we. # add t
1a690 77 6f 20 62 79 74 65 73 20 74 6f 20 65 61 63 68 wo bytes to each
1a6a0 20 6c 69 6e 65 20 28 69 65 3a 20 22 3c 20 22 20 line (ie: "< "
1a6b0 6f 72 20 22 3e 20 22 29 2e 0a 20 20 20 20 73 65 or "> ").. se
1a6c0 74 20 63 77 69 64 74 68 20 5b 66 6f 6e 74 20 6d t cwidth [font m
1a6d0 65 61 73 75 72 65 20 5b 24 77 28 4c 65 66 74 54 easure [$w(LeftT
1a6e0 65 78 74 29 20 63 67 65 74 20 2d 66 6f 6e 74 5d ext) cget -font]
1a6f0 20 22 6d 22 5d 0a 20 20 20 20 73 65 74 20 74 61 "m"]. set ta
1a700 62 73 74 6f 70 73 20 5b 65 78 70 72 20 7b 24 63 bstops [expr {$c
1a710 77 69 64 74 68 20 2a 20 24 74 6d 70 6f 70 74 73 width * $tmpopts
1a720 28 74 61 62 73 74 6f 70 73 29 7d 5d 0a 20 20 20 (tabstops)}].
1a730 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 63 6f $w(LeftText) co
1a740 6e 66 69 67 75 72 65 20 2d 74 61 62 73 20 24 74 nfigure -tabs $t
1a750 61 62 73 74 6f 70 73 0a 20 20 20 20 24 77 28 52 abstops. $w(R
1a760 69 67 68 74 54 65 78 74 29 20 63 6f 6e 66 69 67 ightText) config
1a770 75 72 65 20 2d 74 61 62 73 20 24 74 61 62 73 74 ure -tabs $tabst
1a780 6f 70 73 0a 0a 20 20 20 20 24 77 28 42 6f 74 74 ops.. $w(Bott
1a790 6f 6d 54 65 78 74 29 20 63 6f 6e 66 69 67 75 72 omText) configur
1a7a0 65 20 2d 74 61 62 73 20 5b 6c 69 73 74 20 5b 65 e -tabs [list [e
1a7b0 78 70 72 20 7b 24 74 61 62 73 74 6f 70 73 20 2b xpr {$tabstops +
1a7c0 28 24 63 77 69 64 74 68 20 2a 20 32 29 7d 5d 20 ($cwidth * 2)}]
1a7d0 5c 0a 20 20 20 20 20 20 5b 65 78 70 72 20 7b 32 \. [expr {2
1a7e0 2a 24 74 61 62 73 74 6f 70 73 20 2b 28 24 63 77 *$tabstops +($cw
1a7f0 69 64 74 68 20 2a 20 32 29 7d 5d 5d 0a 0a 20 20 idth * 2)}]]..
1a800 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
1a810 74 73 20 77 28 6d 65 72 67 65 54 65 78 74 29 5d ts w(mergeText)]
1a820 20 26 26 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 && [winfo exist
1a830 73 20 24 77 28 6d 65 72 67 65 54 65 78 74 29 5d s $w(mergeText)]
1a840 7d 20 7b 0a 09 24 77 28 6d 65 72 67 65 54 65 78 } {..$w(mergeTex
1a850 74 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 61 t) configure -ta
1a860 62 73 20 24 74 61 62 73 74 6f 70 73 0a 20 20 20 bs $tabstops.
1a870 20 7d 0a 0a 20 20 20 20 23 20 73 65 74 20 6f 70 }.. # set op
1a880 74 73 20 74 6f 20 74 68 65 20 76 61 6c 75 65 73 ts to the values
1a890 20 66 72 6f 6d 20 74 6d 70 6f 70 74 73 0a 20 20 from tmpopts.
1a8a0 20 20 66 6f 72 65 61 63 68 20 6b 65 79 20 7b 61 foreach key {a
1a8b0 75 74 6f 63 65 6e 74 65 72 20 61 75 74 6f 73 65 utocenter autose
1a8c0 6c 65 63 74 20 63 68 67 74 61 67 20 63 6f 6c 6f lect chgtag colo
1a8d0 72 63 62 73 20 63 75 72 72 74 61 67 20 64 65 6c rcbs currtag del
1a8e0 74 61 67 20 64 69 66 66 63 6d 64 20 5c 0a 20 20 tag diffcmd \.
1a8f0 20 20 20 20 64 69 66 66 74 61 67 20 69 6e 6c 69 difftag inli
1a900 6e 65 74 61 67 20 65 64 69 74 6f 72 20 66 61 6e netag editor fan
1a910 63 79 42 75 74 74 6f 6e 73 20 67 65 6f 6d 65 74 cyButtons geomet
1a920 72 79 20 69 67 6e 6f 72 65 62 6c 61 6e 6b 73 20 ry ignoreblanks
1a930 5c 0a 20 20 20 20 20 20 69 67 6e 6f 72 65 62 6c \. ignorebl
1a940 61 6e 6b 73 6f 70 74 20 69 6e 73 74 61 67 20 6f anksopt instag o
1a950 76 65 72 6c 61 70 74 61 67 20 73 68 6f 77 63 62 verlaptag showcb
1a960 73 20 73 68 6f 77 6c 69 6e 65 76 69 65 77 20 73 s showlineview s
1a970 68 6f 77 6c 6e 20 73 68 6f 77 6d 61 70 20 5c 0a howln showmap \.
1a980 20 20 20 20 20 20 73 79 6e 63 73 63 72 6f 6c 6c syncscroll
1a990 20 74 61 62 73 74 6f 70 73 20 74 61 67 63 62 73 tabstops tagcbs
1a9a0 20 74 61 67 6c 6e 20 74 61 67 74 65 78 74 20 74 tagln tagtext t
1a9b0 65 78 74 6f 70 74 20 74 6d 70 64 69 72 20 74 6f extopt tmpdir to
1a9c0 6f 6c 62 61 72 49 63 6f 6e 73 7d 20 7b 0a 09 73 olbarIcons} {..s
1a9d0 65 74 20 6f 70 74 73 28 24 6b 65 79 29 20 24 74 et opts($key) $t
1a9e0 6d 70 6f 70 74 73 28 24 6b 65 79 29 0a 20 20 20 mpopts($key).
1a9f0 20 7d 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 73 }. if {$opts
1aa00 28 66 61 6e 63 79 42 75 74 74 6f 6e 73 29 7d 20 (fancyButtons)}
1aa10 7b 0a 09 73 65 74 20 6f 70 74 73 28 72 65 6c 69 {..set opts(reli
1aa20 65 66 29 20 66 6c 61 74 0a 20 20 20 20 7d 20 65 ef) flat. } e
1aa30 6c 73 65 20 7b 0a 09 73 65 74 20 6f 70 74 73 28 lse {..set opts(
1aa40 72 65 6c 69 65 66 29 20 72 61 69 73 65 64 0a 20 relief) raised.
1aa50 20 20 20 7d 0a 0a 20 20 20 20 23 20 64 65 74 65 }.. # dete
1aa60 72 6d 69 6e 65 20 69 66 20 77 65 20 6e 65 65 64 rmine if we need
1aa70 20 74 6f 20 72 65 64 6f 20 74 68 65 20 69 6e 6c to redo the inl
1aa80 69 6e 65 20 64 69 66 66 73 20 74 6f 20 61 76 6f ine diffs to avo
1aa90 69 64 20 6e 65 65 64 6c 65 73 73 20 72 65 64 69 id needless redi
1aaa0 66 66 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 73 ff. if {$opts
1aab0 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 20 21 3d (showinline1) !=
1aac0 20 24 74 6d 70 6f 70 74 73 28 73 68 6f 77 69 6e $tmpopts(showin
1aad0 6c 69 6e 65 31 29 20 7c 7c 20 24 6f 70 74 73 28 line1) || $opts(
1aae0 73 68 6f 77 69 6e 6c 69 6e 65 32 29 20 21 3d 20 showinline2) !=
1aaf0 5c 0a 20 20 20 20 20 20 24 74 6d 70 6f 70 74 73 \. $tmpopts
1ab00 28 73 68 6f 77 69 6e 6c 69 6e 65 32 29 7d 20 7b (showinline2)} {
1ab10 0a 09 73 65 74 20 6f 70 74 73 28 73 68 6f 77 69 ..set opts(showi
1ab20 6e 6c 69 6e 65 31 29 20 24 74 6d 70 6f 70 74 73 nline1) $tmpopts
1ab30 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 0a 09 73 (showinline1)..s
1ab40 65 74 20 6f 70 74 73 28 73 68 6f 77 69 6e 6c 69 et opts(showinli
1ab50 6e 65 32 29 20 24 74 6d 70 6f 70 74 73 28 73 68 ne2) $tmpopts(sh
1ab60 6f 77 69 6e 6c 69 6e 65 32 29 0a 09 72 65 63 6f owinline2)..reco
1ab70 6d 70 75 74 65 2d 64 69 66 66 0a 20 20 20 20 7d mpute-diff. }
1ab80 0a 0a 20 20 20 20 23 20 72 65 63 6f 6e 66 69 67 .. # reconfig
1ab90 75 72 65 20 74 68 65 20 74 6f 6f 6c 62 61 72 20 ure the toolbar
1aba0 62 75 74 74 6f 6e 73 0a 20 20 20 20 72 65 63 6f buttons. reco
1abb0 6e 66 69 67 75 72 65 2d 74 6f 6f 6c 62 61 72 0a nfigure-toolbar.
1abc0 0a 20 20 20 20 23 20 72 65 6d 61 72 6b 20 61 6c . # remark al
1abd0 6c 20 74 68 65 20 64 69 66 66 20 72 65 67 69 6f l the diff regio
1abe0 6e 73 2c 20 73 68 6f 77 20 28 6f 72 20 68 69 64 ns, show (or hid
1abf0 65 29 20 74 68 65 20 6c 69 6e 65 20 6e 75 6d 62 e) the line numb
1ac00 65 72 73 2c 0a 20 20 20 20 23 20 63 68 61 6e 67 ers,. # chang
1ac10 65 20 62 61 72 73 20 61 6e 64 20 64 69 66 66 20 e bars and diff
1ac20 6d 61 70 2c 20 61 6e 64 20 77 65 20 61 72 65 20 map, and we are
1ac30 64 6f 6e 65 0a 20 20 20 20 69 66 20 7b 24 72 65 done. if {$re
1ac40 6d 61 72 6b 7d 20 7b 0a 09 72 65 6d 61 72 6b 2d mark} {..remark-
1ac50 64 69 66 66 73 0a 20 20 20 20 7d 0a 0a 20 20 20 diffs. }..
1ac60 20 64 6f 2d 73 68 6f 77 2d 6c 69 6e 65 6e 75 6d do-show-linenum
1ac70 62 65 72 73 0a 20 20 20 20 64 6f 2d 73 68 6f 77 bers. do-show
1ac80 2d 63 68 61 6e 67 65 62 61 72 73 0a 20 20 20 20 -changebars.
1ac90 64 6f 2d 73 68 6f 77 2d 6d 61 70 0a 20 20 20 20 do-show-map.
1aca0 64 6f 2d 73 68 6f 77 2d 6c 69 6e 65 76 69 65 77 do-show-lineview
1acb0 0a 20 20 20 20 64 6f 2d 73 68 6f 77 2d 69 67 6e . do-show-ign
1acc0 6f 72 65 62 6c 61 6e 6b 73 0a 20 20 20 20 67 72 oreblanks. gr
1acd0 69 64 20 70 72 6f 70 61 67 61 74 65 20 24 77 28 id propagate $w(
1ace0 63 6c 69 65 6e 74 29 20 66 0a 7d 0a 0a 23 23 23 client) f.}..###
1acf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad30 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 53 ############.# S
1ad40 61 76 65 20 63 75 73 74 6f 6d 69 7a 61 74 69 6f ave customizatio
1ad50 6e 20 63 68 61 6e 67 65 73 2e 0a 23 23 23 23 23 n changes..#####
1ad60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ad90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ada0 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
1adb0 73 61 76 65 20 7b 7d 20 7b 0a 20 20 20 20 64 65 save {} {. de
1adc0 62 75 67 2d 69 6e 66 6f 20 22 73 61 76 65 22 0a bug-info "save".
1add0 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 global g.
1ade0 20 67 6c 6f 62 61 6c 20 74 6d 70 6f 70 74 73 20 global tmpopts
1adf0 72 63 66 69 6c 65 20 74 63 6c 5f 70 6c 61 74 66 rcfile tcl_platf
1ae00 6f 72 6d 0a 20 20 20 20 67 6c 6f 62 61 6c 20 70 orm. global p
1ae10 72 65 66 0a 0a 20 20 20 20 69 66 20 7b 5b 66 69 ref.. if {[fi
1ae20 6c 65 20 65 78 69 73 74 73 20 24 72 63 66 69 6c le exists $rcfil
1ae30 65 5d 7d 20 7b 0a 09 66 69 6c 65 20 72 65 6e 61 e]} {..file rena
1ae40 6d 65 20 2d 66 6f 72 63 65 20 24 72 63 66 69 6c me -force $rcfil
1ae50 65 20 22 24 72 63 66 69 6c 65 7e 22 0a 20 20 20 e "$rcfile~".
1ae60 20 7d 0a 0a 20 20 20 20 73 65 74 20 66 69 64 20 }.. set fid
1ae70 5b 6f 70 65 6e 20 24 72 63 66 69 6c 65 20 77 5d [open $rcfile w]
1ae80 0a 0a 20 20 20 20 23 20 70 75 74 20 74 68 65 20 .. # put the
1ae90 74 6b 64 69 66 66 20 76 65 72 73 69 6f 6e 20 69 tkdiff version i
1aea0 6e 20 74 68 65 20 66 69 6c 65 2e 20 49 74 20 6d n the file. It m
1aeb0 69 67 68 74 20 62 65 20 68 61 6e 64 79 20 6c 61 ight be handy la
1aec0 74 65 72 0a 20 20 20 20 70 75 74 73 20 24 66 69 ter. puts $fi
1aed0 64 20 22 23 20 54 68 69 73 20 66 69 6c 65 20 77 d "# This file w
1aee0 61 73 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 as generated by
1aef0 24 67 28 6e 61 6d 65 29 20 24 67 28 76 65 72 73 $g(name) $g(vers
1af00 69 6f 6e 29 22 0a 20 20 20 20 70 75 74 73 20 24 ion)". puts $
1af10 66 69 64 20 22 23 20 5b 63 6c 6f 63 6b 20 66 6f fid "# [clock fo
1af20 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f rmat [clock seco
1af30 6e 64 73 5d 5d 5c 6e 22 0a 20 20 20 20 70 75 74 nds]]\n". put
1af40 73 20 24 66 69 64 20 22 73 65 74 20 70 72 65 66 s $fid "set pref
1af50 73 46 69 6c 65 56 65 72 73 69 6f 6e 20 7b 24 67 sFileVersion {$g
1af60 28 76 65 72 73 69 6f 6e 29 7d 5c 6e 22 0a 0a 20 (version)}\n"..
1af70 20 20 20 23 20 6e 6f 77 2c 20 70 75 74 20 61 6c # now, put al
1af80 6c 20 6f 66 20 74 68 65 20 70 72 65 66 65 72 65 l of the prefere
1af90 6e 63 65 73 20 69 6e 20 74 68 65 20 66 69 6c 65 nces in the file
1afa0 0a 20 20 20 20 66 6f 72 65 61 63 68 20 6b 65 79 . foreach key
1afb0 20 5b 6c 73 6f 72 74 20 5b 61 72 72 61 79 20 6e [lsort [array n
1afc0 61 6d 65 73 20 70 72 65 66 5d 5d 20 7b 0a 09 72 ames pref]] {..r
1afd0 65 67 73 75 62 20 22 5c 6e 22 20 24 70 72 65 66 egsub "\n" $pref
1afe0 28 24 6b 65 79 29 20 22 5c 6e 23 20 22 20 63 6f ($key) "\n# " co
1aff0 6d 6d 65 6e 74 0a 09 70 75 74 73 20 24 66 69 64 mment..puts $fid
1b000 20 22 23 20 24 63 6f 6d 6d 65 6e 74 22 0a 09 70 "# $comment"..p
1b010 75 74 73 20 24 66 69 64 20 22 64 65 66 69 6e 65 uts $fid "define
1b020 20 24 6b 65 79 20 7b 24 74 6d 70 6f 70 74 73 28 $key {$tmpopts(
1b030 24 6b 65 79 29 7d 5c 6e 22 0a 20 20 20 20 7d 0a $key)}\n". }.
1b040 0a 20 20 20 20 23 20 2e 2e 2e 20 61 6e 64 20 61 . # ... and a
1b050 6e 79 20 63 75 73 74 6f 6d 20 63 6f 64 65 0a 20 ny custom code.
1b060 20 20 20 70 75 74 73 20 24 66 69 64 20 22 23 20 puts $fid "#
1b070 63 75 73 74 6f 6d 20 63 6f 64 65 22 0a 20 20 20 custom code".
1b080 20 70 75 74 73 20 24 66 69 64 20 22 23 20 70 75 puts $fid "# pu
1b090 74 20 61 6e 79 20 63 75 73 74 6f 6d 20 63 6f 64 t any custom cod
1b0a0 65 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 62 65 e you want to be
1b0b0 20 65 78 65 63 75 74 65 64 20 69 6e 20 74 68 65 executed in the
1b0c0 22 0a 20 20 20 20 70 75 74 73 20 24 66 69 64 20 ". puts $fid
1b0d0 22 23 20 66 6f 6c 6c 6f 77 69 6e 67 20 62 6c 6f "# following blo
1b0e0 63 6b 2e 20 54 68 69 73 20 63 6f 64 65 20 77 69 ck. This code wi
1b0f0 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 61 ll be automatica
1b100 6c 6c 79 20 65 78 65 63 75 74 65 64 22 0a 20 20 lly executed".
1b110 20 20 70 75 74 73 20 24 66 69 64 20 22 23 20 61 puts $fid "# a
1b120 66 74 65 72 20 74 68 65 20 47 55 49 20 68 61 73 fter the GUI has
1b130 20 62 65 65 6e 20 73 65 74 20 75 70 20 62 75 74 been set up but
1b140 20 62 65 66 6f 72 65 20 74 68 65 20 64 69 66 66 before the diff
1b150 20 69 73 20 22 0a 20 20 20 20 70 75 74 73 20 24 is ". puts $
1b160 66 69 64 20 22 23 20 70 65 72 66 6f 72 6d 65 64 fid "# performed
1b170 2e 20 55 73 65 20 74 68 69 73 20 63 6f 64 65 20 . Use this code
1b180 74 6f 20 63 75 73 74 6f 6d 69 7a 65 20 74 68 65 to customize the
1b190 20 69 6e 74 65 72 66 61 63 65 20 69 66 22 0a 20 interface if".
1b1a0 20 20 20 70 75 74 73 20 24 66 69 64 20 22 23 20 puts $fid "#
1b1b0 79 6f 75 20 73 6f 20 64 65 73 69 72 65 2e 22 0a you so desire.".
1b1c0 20 20 20 20 70 75 74 73 20 24 66 69 64 20 22 23 puts $fid "#
1b1d0 20 20 22 0a 20 20 20 20 70 75 74 73 20 24 66 69 ". puts $fi
1b1e0 64 20 22 23 20 45 76 65 6e 20 74 68 6f 75 67 68 d "# Even though
1b1f0 20 79 6f 75 20 63 61 6e 27 74 20 28 61 73 20 6f you can't (as o
1b200 66 20 76 65 72 73 69 6f 6e 20 33 2e 30 39 29 20 f version 3.09)
1b210 65 64 69 74 20 74 68 69 73 20 22 0a 20 20 20 20 edit this ".
1b220 70 75 74 73 20 24 66 69 64 20 22 23 20 63 6f 64 puts $fid "# cod
1b230 65 20 76 69 61 20 74 68 65 20 70 72 65 66 65 72 e via the prefer
1b240 65 6e 63 65 73 20 64 69 61 6c 6f 67 2c 20 69 74 ences dialog, it
1b250 20 77 69 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 will be automat
1b260 69 63 61 6c 6c 79 22 0a 20 20 20 20 70 75 74 73 ically". puts
1b270 20 24 66 69 64 20 22 23 20 73 61 76 65 64 20 61 $fid "# saved a
1b280 6e 64 20 72 65 73 74 6f 72 65 64 20 69 66 20 79 nd restored if y
1b290 6f 75 20 64 6f 20 61 20 53 41 56 45 20 66 72 6f ou do a SAVE fro
1b2a0 6d 20 74 68 61 74 20 64 69 61 6c 6f 67 2e 22 0a m that dialog.".
1b2b0 20 20 20 20 70 75 74 73 20 24 66 69 64 20 22 22 puts $fid ""
1b2c0 0a 20 20 20 20 70 75 74 73 20 24 66 69 64 20 22 . puts $fid "
1b2d0 23 20 55 6e 6c 65 73 73 20 79 6f 75 20 72 65 61 # Unless you rea
1b2e0 6c 6c 79 20 6b 6e 6f 77 20 77 68 61 74 20 79 6f lly know what yo
1b2f0 75 20 61 72 65 20 64 6f 69 6e 67 2c 20 69 74 20 u are doing, it
1b300 69 73 20 70 72 6f 62 61 62 6c 79 22 0a 20 20 20 is probably".
1b310 20 70 75 74 73 20 24 66 69 64 20 22 23 20 77 69 puts $fid "# wi
1b320 73 65 20 74 6f 20 6c 65 61 76 65 20 74 68 69 73 se to leave this
1b330 20 75 6e 6d 6f 64 69 66 69 65 64 2e 22 0a 20 20 unmodified.".
1b340 20 20 70 75 74 73 20 24 66 69 64 20 22 22 0a 20 puts $fid "".
1b350 20 20 20 70 75 74 73 20 24 66 69 64 20 22 64 65 puts $fid "de
1b360 66 69 6e 65 20 63 75 73 74 6f 6d 43 6f 64 65 20 fine customCode
1b370 7b 5c 6e 5b 73 74 72 69 6e 67 20 74 72 69 6d 20 {\n[string trim
1b380 24 74 6d 70 6f 70 74 73 28 63 75 73 74 6f 6d 43 $tmpopts(customC
1b390 6f 64 65 29 20 5c 6e 5d 5c 6e 7d 5c 6e 22 0a 0a ode) \n]\n}\n"..
1b3a0 20 20 20 20 63 6c 6f 73 65 20 24 66 69 64 0a 0a close $fid..
1b3b0 20 20 20 20 69 66 20 7b 24 3a 3a 74 63 6c 5f 70 if {$::tcl_p
1b3c0 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d latform(platform
1b3d0 29 20 3d 3d 20 22 77 69 6e 64 6f 77 73 22 7d 20 ) == "windows"}
1b3e0 7b 0a 09 66 69 6c 65 20 61 74 74 72 69 62 75 74 {..file attribut
1b3f0 65 20 24 72 63 66 69 6c 65 20 2d 68 69 64 64 65 e $rcfile -hidde
1b400 6e 20 31 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 n 1. }.}..###
1b410 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b420 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b430 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b440 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b450 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 54 ############.# T
1b460 65 78 74 20 68 61 73 20 73 63 72 6f 6c 6c 65 64 ext has scrolled
1b470 2c 20 75 70 64 61 74 65 20 73 63 72 6f 6c 6c 62 , update scrollb
1b480 61 72 73 20 61 6e 64 20 73 79 6e 63 68 72 6f 6e ars and synchron
1b490 69 7a 65 20 77 69 6e 64 6f 77 73 0a 23 23 23 23 ize windows.####
1b4a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b4b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b4c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b4d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b4e0 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
1b4f0 20 68 73 63 72 6f 6c 6c 2d 73 79 6e 63 20 7b 69 hscroll-sync {i
1b500 64 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 67 6c d args} {. gl
1b510 6f 62 61 6c 20 67 20 6f 70 74 73 0a 20 20 20 20 obal g opts.
1b520 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 23 20 global w.. #
1b530 49 66 20 69 67 6e 6f 72 65 5f 65 76 65 6e 74 20 If ignore_event
1b540 69 73 20 74 72 75 65 2c 20 77 65 27 76 65 20 61 is true, we've a
1b550 6c 72 65 61 64 79 20 74 61 6b 65 6e 20 63 61 72 lready taken car
1b560 65 20 6f 66 20 73 63 72 6f 6c 6c 69 6e 67 2e 0a e of scrolling..
1b570 20 20 20 20 23 20 57 65 27 72 65 20 6f 6e 6c 79 # We're only
1b580 20 69 6e 74 65 72 65 73 74 65 64 20 69 6e 20 74 interested in t
1b590 68 65 20 66 69 72 73 74 20 65 76 65 6e 74 2e 0a he first event..
1b5a0 20 20 20 20 69 66 20 7b 24 67 28 69 67 6e 6f 72 if {$g(ignor
1b5b0 65 5f 68 65 76 65 6e 74 2c 24 69 64 29 7d 20 7b e_hevent,$id)} {
1b5c0 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
1b5d0 20 20 20 20 23 20 53 63 72 6f 6c 6c 62 61 72 20 # Scrollbar
1b5e0 73 69 7a 65 73 0a 20 20 20 20 73 65 74 20 73 69 sizes. set si
1b5f0 7a 65 31 20 5b 65 78 70 72 20 7b 5b 6c 69 6e 64 ze1 [expr {[lind
1b600 65 78 20 5b 24 77 28 4c 65 66 74 54 65 78 74 29 ex [$w(LeftText)
1b610 20 78 76 69 65 77 5d 20 31 5d 20 2d 20 5b 6c 69 xview] 1] - [li
1b620 6e 64 65 78 20 5c 0a 20 20 20 20 20 20 5b 24 77 ndex \. [$w
1b630 28 4c 65 66 74 54 65 78 74 29 20 78 76 69 65 77 (LeftText) xview
1b640 5d 20 30 5d 7d 5d 0a 20 20 20 20 73 65 74 20 73 ] 0]}]. set s
1b650 69 7a 65 32 20 5b 65 78 70 72 20 7b 5b 6c 69 6e ize2 [expr {[lin
1b660 64 65 78 20 5b 24 77 28 52 69 67 68 74 54 65 78 dex [$w(RightTex
1b670 74 29 20 78 76 69 65 77 5d 20 31 5d 20 2d 20 5b t) xview] 1] - [
1b680 6c 69 6e 64 65 78 20 5c 0a 20 20 20 20 20 20 5b lindex \. [
1b690 24 77 28 52 69 67 68 74 54 65 78 74 29 20 78 76 $w(RightText) xv
1b6a0 69 65 77 5d 20 30 5d 7d 5d 0a 0a 20 20 20 20 69 iew] 0]}].. i
1b6b0 66 20 7b 24 6f 70 74 73 28 73 79 6e 63 73 63 72 f {$opts(syncscr
1b6c0 6f 6c 6c 29 20 7c 7c 20 24 69 64 20 3d 3d 20 31 oll) || $id == 1
1b6d0 7d 20 7b 0a 09 73 65 74 20 73 74 61 72 74 20 5b } {..set start [
1b6e0 6c 69 6e 64 65 78 20 24 61 72 67 73 20 30 5d 0a lindex $args 0].
1b6f0 0a 09 69 66 20 7b 24 69 64 20 21 3d 20 31 7d 20 ..if {$id != 1}
1b700 7b 0a 09 20 20 20 20 73 65 74 20 73 74 61 72 74 {.. set start
1b710 20 5b 65 78 70 72 20 7b 24 73 74 61 72 74 20 2a [expr {$start *
1b720 20 24 73 69 7a 65 32 20 2f 20 24 73 69 7a 65 31 $size2 / $size1
1b730 7d 5d 0a 09 7d 0a 09 24 77 28 4c 65 66 74 48 53 }]..}..$w(LeftHS
1b740 42 29 20 73 65 74 20 24 73 74 61 72 74 20 5b 65 B) set $start [e
1b750 78 70 72 20 7b 24 73 74 61 72 74 20 2b 20 24 73 xpr {$start + $s
1b760 69 7a 65 31 7d 5d 0a 09 24 77 28 4c 65 66 74 54 ize1}]..$w(LeftT
1b770 65 78 74 29 20 78 76 69 65 77 20 6d 6f 76 65 74 ext) xview movet
1b780 6f 20 24 73 74 61 72 74 0a 09 73 65 74 20 67 28 o $start..set g(
1b790 69 67 6e 6f 72 65 5f 68 65 76 65 6e 74 2c 31 29 ignore_hevent,1)
1b7a0 20 31 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 1. }. if
1b7b0 7b 24 6f 70 74 73 28 73 79 6e 63 73 63 72 6f 6c {$opts(syncscrol
1b7c0 6c 29 20 7c 7c 20 24 69 64 20 3d 3d 20 32 7d 20 l) || $id == 2}
1b7d0 7b 0a 09 73 65 74 20 73 74 61 72 74 20 5b 6c 69 {..set start [li
1b7e0 6e 64 65 78 20 24 61 72 67 73 20 30 5d 0a 09 69 ndex $args 0]..i
1b7f0 66 20 7b 24 69 64 20 21 3d 20 32 7d 20 7b 0a 09 f {$id != 2} {..
1b800 20 20 20 20 73 65 74 20 73 74 61 72 74 20 5b 65 set start [e
1b810 78 70 72 20 7b 24 73 74 61 72 74 20 2a 20 24 73 xpr {$start * $s
1b820 69 7a 65 31 20 2f 20 24 73 69 7a 65 32 7d 5d 0a ize1 / $size2}].
1b830 09 7d 0a 09 24 77 28 52 69 67 68 74 48 53 42 29 .}..$w(RightHSB)
1b840 20 73 65 74 20 24 73 74 61 72 74 20 5b 65 78 70 set $start [exp
1b850 72 20 7b 24 73 74 61 72 74 20 2b 20 24 73 69 7a r {$start + $siz
1b860 65 32 7d 5d 0a 09 24 77 28 52 69 67 68 74 54 65 e2}]..$w(RightTe
1b870 78 74 29 20 78 76 69 65 77 20 6d 6f 76 65 74 6f xt) xview moveto
1b880 20 24 73 74 61 72 74 0a 09 73 65 74 20 67 28 69 $start..set g(i
1b890 67 6e 6f 72 65 5f 68 65 76 65 6e 74 2c 32 29 20 gnore_hevent,2)
1b8a0 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 54 1. }.. # T
1b8b0 68 69 73 20 66 6f 72 63 65 73 20 61 6c 6c 20 74 his forces all t
1b8c0 68 65 20 65 76 65 6e 74 20 68 61 6e 64 6c 65 72 he event handler
1b8d0 73 20 66 6f 72 20 74 68 65 20 76 69 65 77 20 61 s for the view a
1b8e0 6c 74 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 23 lterations. #
1b8f0 20 61 62 6f 76 65 20 74 6f 20 74 72 69 67 67 65 above to trigge
1b900 72 2c 20 61 6e 64 20 77 65 20 6c 6f 63 6b 20 6f r, and we lock o
1b910 75 74 20 74 68 65 20 72 65 63 75 72 73 69 76 65 ut the recursive
1b920 20 28 72 65 64 75 6e 64 61 6e 74 29 0a 20 20 20 (redundant).
1b930 20 23 20 65 76 65 6e 74 73 20 75 73 69 6e 67 20 # events using
1b940 69 67 6e 6f 72 65 5f 65 76 65 6e 74 2e 0a 20 20 ignore_event..
1b950 20 20 75 70 64 61 74 65 20 69 64 6c 65 74 61 73 update idletas
1b960 6b 73 0a 0a 20 20 20 20 23 20 52 65 73 74 6f 72 ks.. # Restor
1b970 65 20 74 6f 20 6e 6f 72 6d 61 6c 0a 20 20 20 20 e to normal.
1b980 73 65 74 20 67 28 69 67 6e 6f 72 65 5f 68 65 76 set g(ignore_hev
1b990 65 6e 74 2c 31 29 20 30 0a 20 20 20 20 73 65 74 ent,1) 0. set
1b9a0 20 67 28 69 67 6e 6f 72 65 5f 68 65 76 65 6e 74 g(ignore_hevent
1b9b0 2c 32 29 20 30 0a 7d 0a 0a 23 23 23 23 23 23 23 ,2) 0.}..#######
1b9c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b9d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b9e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b9f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ba00 23 23 23 23 23 23 23 23 0a 23 20 54 65 78 74 20 ########.# Text
1ba10 68 61 73 20 73 63 72 6f 6c 6c 65 64 2c 20 75 70 has scrolled, up
1ba20 64 61 74 65 20 73 63 72 6f 6c 6c 62 61 72 73 20 date scrollbars
1ba30 61 6e 64 20 73 79 6e 63 68 72 6f 6e 69 7a 65 20 and synchronize
1ba40 77 69 6e 64 6f 77 73 0a 23 23 23 23 23 23 23 23 windows.########
1ba50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ba60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ba70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ba80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ba90 23 23 23 23 23 23 23 0a 70 72 6f 63 20 76 73 63 #######.proc vsc
1baa0 72 6f 6c 6c 2d 73 79 6e 63 20 7b 77 69 6e 64 6f roll-sync {windo
1bab0 77 6c 69 73 74 20 69 64 20 79 30 20 79 31 7d 20 wlist id y0 y1}
1bac0 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 20 6f {. global g o
1bad0 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 pts. global w
1bae0 0a 0a 20 20 20 20 69 66 20 7b 24 69 64 20 3d 3d .. if {$id ==
1baf0 20 31 7d 20 7b 0a 09 24 77 28 4c 65 66 74 56 53 1} {..$w(LeftVS
1bb00 42 29 20 73 65 74 20 24 79 30 20 24 79 31 0a 20 B) set $y0 $y1.
1bb10 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 24 77 28 } else {..$w(
1bb20 52 69 67 68 74 56 53 42 29 20 73 65 74 20 24 79 RightVSB) set $y
1bb30 30 20 24 79 31 0a 20 20 20 20 7d 0a 0a 20 20 20 0 $y1. }..
1bb40 20 23 20 69 66 20 73 79 6e 63 69 6e 67 20 69 73 # if syncing is
1bb50 20 64 69 73 61 62 6c 65 64 2c 20 77 65 27 72 65 disabled, we're
1bb60 20 64 6f 6e 65 2e 20 54 68 69 73 20 70 72 65 76 done. This prev
1bb70 65 6e 74 73 20 61 20 6e 61 73 74 79 0a 20 20 20 ents a nasty.
1bb80 20 23 20 73 65 74 20 6f 66 20 72 65 63 75 72 73 # set of recurs
1bb90 69 76 65 20 63 61 6c 6c 73 0a 20 20 20 20 69 66 ive calls. if
1bba0 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 67 {[info exists g
1bbb0 28 64 69 73 61 62 6c 65 53 79 6e 63 69 6e 67 29 (disableSyncing)
1bbc0 5d 7d 20 7b 0a 09 72 65 74 75 72 6e 0a 20 20 20 ]} {..return.
1bbd0 20 7d 0a 0a 20 20 20 20 23 20 73 65 74 20 74 68 }.. # set th
1bbe0 65 20 66 6c 61 67 3b 20 74 68 69 73 20 6d 61 6b e flag; this mak
1bbf0 65 73 20 73 75 72 65 20 77 65 20 6f 6e 6c 79 20 es sure we only
1bc00 67 65 74 20 63 61 6c 6c 65 64 20 6f 6e 63 65 0a get called once.
1bc10 20 20 20 20 73 65 74 20 67 28 64 69 73 61 62 6c set g(disabl
1bc20 65 53 79 6e 63 69 6e 67 29 20 31 0a 0a 20 20 20 eSyncing) 1..
1bc30 20 23 20 73 63 72 6f 6c 6c 20 74 68 65 20 6f 74 # scroll the ot
1bc40 68 65 72 20 77 69 6e 64 6f 77 73 20 6f 6e 20 74 her windows on t
1bc50 68 65 20 73 61 6d 65 20 73 69 64 65 20 61 73 20 he same side as
1bc60 74 68 69 73 20 77 69 6e 64 6f 77 0a 20 20 20 20 this window.
1bc70 66 6f 72 65 61 63 68 20 77 69 6e 64 6f 77 20 24 foreach window $
1bc80 77 69 6e 64 6f 77 6c 69 73 74 20 7b 0a 09 24 77 windowlist {..$w
1bc90 69 6e 64 6f 77 20 79 76 69 65 77 20 6d 6f 76 65 indow yview move
1bca0 74 6f 20 24 79 30 0a 20 20 20 20 7d 0a 0a 20 20 to $y0. }..
1bcb0 20 20 65 76 61 6c 20 6d 61 70 2d 6d 6f 76 65 2d eval map-move-
1bcc0 74 68 75 6d 62 20 24 79 30 20 24 79 31 0a 0a 20 thumb $y0 $y1..
1bcd0 20 20 20 23 20 53 65 6c 65 63 74 20 6e 65 61 72 # Select near
1bce0 65 73 74 20 76 69 73 69 62 6c 65 20 64 69 66 66 est visible diff
1bcf0 20 72 65 67 69 6f 6e 2c 20 69 66 20 74 68 65 20 region, if the
1bd00 61 70 70 72 6f 70 72 69 61 74 65 0a 20 20 20 20 appropriate.
1bd10 23 20 6f 70 74 69 6f 6e 73 20 61 72 65 20 73 65 # options are se
1bd20 74 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 73 28 t. if {$opts(
1bd30 73 79 6e 63 73 63 72 6f 6c 6c 29 20 26 26 20 24 syncscroll) && $
1bd40 6f 70 74 73 28 61 75 74 6f 73 65 6c 65 63 74 29 opts(autoselect)
1bd50 20 26 26 20 24 67 28 63 6f 75 6e 74 29 20 3e 20 && $g(count) >
1bd60 30 7d 20 7b 0a 09 73 65 74 20 77 69 6e 68 61 6c 0} {..set winhal
1bd70 66 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 6f 20 f [expr {[winfo
1bd80 68 65 69 67 68 74 20 24 77 28 52 69 67 68 74 54 height $w(RightT
1bd90 65 78 74 29 5d 20 2f 20 32 7d 5d 0a 09 73 65 74 ext)] / 2}]..set
1bda0 20 72 65 73 75 6c 74 20 5b 66 69 6e 64 2d 64 69 result [find-di
1bdb0 66 66 20 5b 65 78 70 72 20 7b 69 6e 74 28 5b 24 ff [expr {int([$
1bdc0 77 28 52 69 67 68 74 54 65 78 74 29 20 69 6e 64 w(RightText) ind
1bdd0 65 78 20 40 31 2c 24 77 69 6e 68 61 6c 66 5d 29 ex @1,$winhalf])
1bde0 7d 5d 5d 0a 09 73 65 74 20 69 20 5b 6c 69 6e 64 }]]..set i [lind
1bdf0 65 78 20 24 72 65 73 75 6c 74 20 30 5d 0a 0a 09 ex $result 0]...
1be00 23 20 68 61 76 65 20 77 65 20 66 6f 75 6e 64 20 # have we found
1be10 61 20 64 69 66 66 20 6f 74 68 65 72 20 74 68 61 a diff other tha
1be20 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 64 69 n the current di
1be30 66 66 3f 0a 09 69 66 20 7b 24 69 20 21 3d 20 24 ff?..if {$i != $
1be40 67 28 70 6f 73 29 7d 20 7b 0a 09 20 20 20 20 23 g(pos)} {.. #
1be50 20 41 6c 73 6f 2c 20 6d 61 6b 65 20 73 75 72 65 Also, make sure
1be60 20 74 68 65 20 64 69 66 66 20 69 73 20 76 69 73 the diff is vis
1be70 69 62 6c 65 2e 20 49 66 20 6e 6f 74 2c 20 77 65 ible. If not, we
1be80 20 77 6f 6e 27 74 0a 09 20 20 20 20 23 20 63 68 won't.. # ch
1be90 61 6e 67 65 20 74 68 65 20 63 75 72 72 65 6e 74 ange the current
1bea0 20 64 69 66 66 20 72 65 67 69 6f 6e 2e 2e 2e 0a diff region....
1beb0 09 20 20 20 20 73 65 74 20 74 6f 70 6c 69 6e 65 . set topline
1bec0 20 5b 24 77 28 52 69 67 68 74 54 65 78 74 29 20 [$w(RightText)
1bed0 69 6e 64 65 78 20 40 30 2c 30 5d 0a 09 20 20 20 index @0,0]..
1bee0 20 73 65 74 20 62 6f 74 74 6f 6d 6c 69 6e 65 20 set bottomline
1bef0 5b 24 77 28 52 69 67 68 74 54 65 78 74 29 20 69 [$w(RightText) i
1bf00 6e 64 65 78 20 40 30 2c 31 30 30 30 30 5d 0a 09 ndex @0,10000]..
1bf10 20 20 20 20 66 6f 72 65 61 63 68 20 7b 6c 69 6e foreach {lin
1bf20 65 20 73 31 20 65 31 20 73 32 20 65 32 20 74 79 e s1 e1 s2 e2 ty
1bf30 70 65 7d 20 24 67 28 73 63 72 64 69 66 66 2c 24 pe} $g(scrdiff,$
1bf40 69 29 20 7b 20 7d 0a 09 20 20 20 20 69 66 20 7b i) { }.. if {
1bf50 24 73 31 20 3e 3d 20 24 74 6f 70 6c 69 6e 65 20 $s1 >= $topline
1bf60 26 26 20 24 73 31 20 3c 3d 20 24 62 6f 74 74 6f && $s1 <= $botto
1bf70 6d 6c 69 6e 65 7d 20 7b 0a 09 09 6d 6f 76 65 20 mline} {...move
1bf80 24 69 20 30 20 31 0a 09 20 20 20 20 7d 0a 09 7d $i 0 1.. }..}
1bf90 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 69 66 . }.. # if
1bfa0 20 73 79 6e 63 69 6e 67 20 69 73 20 74 75 72 6e syncing is turn
1bfb0 65 64 20 6f 6e 2c 20 73 63 72 6f 6c 6c 20 6f 74 ed on, scroll ot
1bfc0 68 65 72 20 77 69 6e 64 6f 77 73 2e 0a 20 20 20 her windows..
1bfd0 20 23 20 41 6e 6e 6f 79 69 6e 67 6c 79 2c 20 73 # Annoyingly, s
1bfe0 6f 6d 65 74 69 6d 65 73 20 74 68 65 20 2a 54 65 ometimes the *Te
1bff0 78 74 20 77 69 6e 64 6f 77 73 20 77 6f 6e 27 74 xt windows won't
1c000 20 73 63 72 6f 6c 6c 20 70 72 6f 70 65 72 6c 79 scroll properly
1c010 2c 0a 20 20 20 20 23 20 61 74 20 6c 65 61 73 74 ,. # at least
1c020 20 75 6e 64 65 72 20 77 69 6e 64 6f 77 73 2e 20 under windows.
1c030 41 6e 64 20 49 20 63 61 6e 27 74 20 66 6f 72 20 And I can't for
1c040 74 68 65 20 6c 69 66 65 20 6f 66 20 6d 65 20 66 the life of me f
1c050 69 67 75 72 65 0a 20 20 20 20 23 20 6f 75 74 20 igure. # out
1c060 77 68 79 2e 20 4d 61 79 62 65 20 61 20 62 75 67 why. Maybe a bug
1c070 20 69 6e 20 74 6b 3f 0a 20 20 20 20 69 66 20 7b in tk?. if {
1c080 24 6f 70 74 73 28 73 79 6e 63 73 63 72 6f 6c 6c $opts(syncscroll
1c090 29 7d 20 7b 0a 09 69 66 20 7b 24 69 64 20 3d 3d )} {..if {$id ==
1c0a0 20 31 7d 20 7b 0a 0a 09 20 20 20 20 24 77 28 52 1} {... $w(R
1c0b0 69 67 68 74 54 65 78 74 29 20 79 76 69 65 77 20 ightText) yview
1c0c0 6d 6f 76 65 74 6f 20 24 79 30 0a 09 20 20 20 20 moveto $y0..
1c0d0 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 79 76 $w(RightInfo) yv
1c0e0 69 65 77 20 6d 6f 76 65 74 6f 20 24 79 30 0a 09 iew moveto $y0..
1c0f0 20 20 20 20 24 77 28 52 69 67 68 74 43 42 29 20 $w(RightCB)
1c100 79 76 69 65 77 20 6d 6f 76 65 74 6f 20 24 79 30 yview moveto $y0
1c110 0a 09 20 20 20 20 24 77 28 52 69 67 68 74 56 53 .. $w(RightVS
1c120 42 29 20 73 65 74 20 24 79 30 20 24 79 31 0a 0a B) set $y0 $y1..
1c130 09 7d 20 65 6c 73 65 20 7b 0a 0a 09 20 20 20 20 .} else {...
1c140 24 77 28 4c 65 66 74 54 65 78 74 29 20 79 76 69 $w(LeftText) yvi
1c150 65 77 20 6d 6f 76 65 74 6f 20 24 79 30 0a 09 20 ew moveto $y0..
1c160 20 20 20 24 77 28 4c 65 66 74 49 6e 66 6f 29 20 $w(LeftInfo)
1c170 79 76 69 65 77 20 6d 6f 76 65 74 6f 20 24 79 30 yview moveto $y0
1c180 0a 09 20 20 20 20 24 77 28 4c 65 66 74 43 42 29 .. $w(LeftCB)
1c190 20 79 76 69 65 77 20 6d 6f 76 65 74 6f 20 24 79 yview moveto $y
1c1a0 30 0a 09 20 20 20 20 24 77 28 4c 65 66 74 56 53 0.. $w(LeftVS
1c1b0 42 29 20 73 65 74 20 24 79 30 20 24 79 31 0a 09 B) set $y0 $y1..
1c1c0 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 77 }. }.. # w
1c1d0 65 20 61 70 70 61 72 65 6e 74 6c 79 20 61 75 74 e apparently aut
1c1e0 6f 6d 61 74 69 63 61 6c 6c 79 20 70 72 6f 63 65 omatically proce
1c1f0 73 73 20 69 64 6c 65 20 65 76 65 6e 74 73 20 61 ss idle events a
1c200 66 74 65 72 20 74 68 69 73 0a 20 20 20 20 23 20 fter this. #
1c210 70 72 6f 63 20 69 73 20 63 61 6c 6c 65 64 2e 20 proc is called.
1c220 4f 6e 63 65 20 74 68 61 74 20 69 73 20 64 6f 6e Once that is don
1c230 65 20 77 65 27 6c 6c 20 75 6e 73 65 74 20 6f 75 e we'll unset ou
1c240 72 20 66 6c 61 67 0a 20 20 20 20 61 66 74 65 72 r flag. after
1c250 20 69 64 6c 65 20 7b 63 61 74 63 68 20 7b 75 6e idle {catch {un
1c260 73 65 74 20 67 28 64 69 73 61 62 6c 65 53 79 6e set g(disableSyn
1c270 63 69 6e 67 29 7d 7d 0a 7d 0a 0a 23 23 23 23 23 cing)}}.}..#####
1c280 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c290 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c2a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c2b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c2c0 23 23 23 23 23 23 23 23 23 23 0a 23 20 4d 61 6b ##########.# Mak
1c2d0 65 20 61 20 6d 69 6e 69 61 74 75 72 65 20 6d 61 e a miniature ma
1c2e0 70 20 6f 66 20 74 68 65 20 64 69 66 66 20 72 65 p of the diff re
1c2f0 67 69 6f 6e 73 0a 23 23 23 23 23 23 23 23 23 23 gions.##########
1c300 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c310 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c320 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c330 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c340 23 23 23 23 23 0a 70 72 6f 63 20 63 72 65 61 74 #####.proc creat
1c350 65 2d 6d 61 70 20 7b 6e 61 6d 65 20 6d 61 70 77 e-map {name mapw
1c360 69 64 74 68 20 6d 61 70 68 65 69 67 68 74 7d 20 idth mapheight}
1c370 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 {. global g.
1c380 20 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 global w.
1c390 67 6c 6f 62 61 6c 20 6d 61 70 0a 20 20 20 20 67 global map. g
1c3a0 6c 6f 62 61 6c 20 6f 70 74 73 0a 0a 20 20 20 20 lobal opts..
1c3b0 73 65 74 20 6d 61 70 20 24 6e 61 6d 65 0a 0a 20 set map $name..
1c3c0 20 20 20 23 20 54 65 78 74 20 77 69 64 67 65 74 # Text widget
1c3d0 20 61 6c 77 61 79 73 20 63 6f 6e 74 61 69 6e 73 always contains
1c3e0 20 62 6c 61 6e 6b 20 6c 69 6e 65 20 61 74 20 74 blank line at t
1c3f0 68 65 20 65 6e 64 0a 20 20 20 20 73 65 74 20 6c he end. set l
1c400 69 6e 65 73 20 5b 65 78 70 72 20 7b 64 6f 75 62 ines [expr {doub
1c410 6c 65 28 5b 24 77 28 4c 65 66 74 54 65 78 74 29 le([$w(LeftText)
1c420 20 69 6e 64 65 78 20 65 6e 64 5d 29 20 2d 20 32 index end]) - 2
1c430 7d 5d 0a 20 20 20 20 73 65 74 20 66 61 63 74 6f }]. set facto
1c440 72 20 5b 65 78 70 72 20 7b 24 6d 61 70 68 65 69 r [expr {$maphei
1c450 67 68 74 20 2f 20 24 6c 69 6e 65 73 7d 5d 0a 0a ght / $lines}]..
1c460 20 20 20 20 23 20 57 65 20 61 64 64 20 73 6f 6d # We add som
1c470 65 20 74 72 61 6e 73 70 61 72 65 6e 74 20 73 74 e transparent st
1c480 75 66 66 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 uff to make the
1c490 6d 61 70 20 66 69 6c 6c 20 74 68 65 20 63 61 6e map fill the can
1c4a0 76 61 73 0a 20 20 20 20 23 20 69 6e 20 6f 72 64 vas. # in ord
1c4b0 65 72 20 74 6f 20 72 65 63 65 69 76 65 20 6d 6f er to receive mo
1c4c0 75 73 65 20 65 76 65 6e 74 73 20 61 74 20 74 68 use events at th
1c4d0 65 20 76 65 72 79 20 62 6f 74 74 6f 6d 2e 0a 20 e very bottom..
1c4e0 20 20 20 24 6d 61 70 20 62 6c 61 6e 6b 0a 20 20 $map blank.
1c4f0 20 20 24 6d 61 70 20 70 75 74 20 5c 23 30 30 30 $map put \#000
1c500 20 2d 74 6f 20 30 20 24 6d 61 70 68 65 69 67 68 -to 0 $mapheigh
1c510 74 20 24 6d 61 70 77 69 64 74 68 20 24 6d 61 70 t $mapwidth $map
1c520 68 65 69 67 68 74 0a 0a 20 20 20 20 23 20 4c 69 height.. # Li
1c530 6e 65 20 6e 75 6d 62 65 72 73 20 73 74 61 72 74 ne numbers start
1c540 20 61 74 20 31 2c 20 6e 6f 74 20 61 74 20 30 2e at 1, not at 0.
1c550 0a 20 20 20 20 66 6f 72 20 7b 73 65 74 20 69 20 . for {set i
1c560 31 7d 20 7b 24 69 20 3c 3d 20 24 67 28 63 6f 75 1} {$i <= $g(cou
1c570 6e 74 29 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a nt)} {incr i} {.
1c580 09 23 20 20 20 20 20 20 20 20 20 73 63 61 6e 20 .# scan
1c590 24 67 28 73 63 72 64 69 66 66 2c 24 69 29 20 22 $g(scrdiff,$i) "
1c5a0 25 73 20 25 64 20 25 64 20 25 64 20 25 64 20 25 %s %d %d %d %d %
1c5b0 73 22 20 6c 69 6e 65 20 73 31 20 65 31 20 73 32 s" line s1 e1 s2
1c5c0 20 65 32 20 74 79 70 65 0a 09 66 6f 72 65 61 63 e2 type..foreac
1c5d0 68 20 7b 6c 69 6e 65 20 73 31 20 65 31 20 73 32 h {line s1 e1 s2
1c5e0 20 65 32 20 74 79 70 65 7d 20 24 67 28 73 63 72 e2 type} $g(scr
1c5f0 64 69 66 66 2c 24 69 29 20 7b 20 7d 0a 0a 09 73 diff,$i) { }...s
1c600 65 74 20 79 20 5b 65 78 70 72 20 7b 69 6e 74 28 et y [expr {int(
1c610 28 24 73 32 20 2d 20 31 29 20 2a 20 24 66 61 63 ($s2 - 1) * $fac
1c620 74 6f 72 29 20 2b 20 24 67 28 6d 61 70 62 6f 72 tor) + $g(mapbor
1c630 64 65 72 29 7d 5d 0a 09 73 65 74 20 73 69 7a 65 der)}]..set size
1c640 20 5b 65 78 70 72 20 7b 72 6f 75 6e 64 28 28 24 [expr {round(($
1c650 65 32 20 2d 20 24 73 32 20 2b 20 31 29 20 2a 20 e2 - $s2 + 1) *
1c660 24 66 61 63 74 6f 72 29 7d 5d 0a 09 69 66 20 7b $factor)}]..if {
1c670 24 73 69 7a 65 20 3c 20 31 7d 20 7b 0a 09 20 20 $size < 1} {..
1c680 20 20 73 65 74 20 73 69 7a 65 20 31 0a 09 7d 0a set size 1..}.
1c690 09 73 77 69 74 63 68 20 2d 2d 20 24 74 79 70 65 .switch -- $type
1c6a0 20 7b 0a 09 22 64 22 20 7b 0a 09 09 73 65 74 20 {.."d" {...set
1c6b0 63 6f 6c 6f 72 20 24 6f 70 74 73 28 6d 61 70 64 color $opts(mapd
1c6c0 65 6c 29 0a 09 20 20 20 20 7d 0a 09 22 61 22 20 el).. }.."a"
1c6d0 7b 0a 09 09 73 65 74 20 63 6f 6c 6f 72 20 24 6f {...set color $o
1c6e0 70 74 73 28 6d 61 70 69 6e 73 29 0a 09 20 20 20 pts(mapins)..
1c6f0 20 7d 0a 09 22 63 22 20 7b 0a 09 09 73 65 74 20 }.."c" {...set
1c700 63 6f 6c 6f 72 20 24 6f 70 74 73 28 6d 61 70 63 color $opts(mapc
1c710 68 67 29 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 69 hg).. }..}..i
1c720 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
1c730 67 28 6f 76 65 72 6c 61 70 24 69 29 5d 7d 20 7b g(overlap$i)]} {
1c740 0a 09 20 20 20 20 73 65 74 20 63 6f 6c 6f 72 20 .. set color
1c750 79 65 6c 6c 6f 77 0a 09 7d 0a 0a 09 24 6d 61 70 yellow..}...$map
1c760 20 70 75 74 20 24 63 6f 6c 6f 72 20 2d 74 6f 20 put $color -to
1c770 30 20 24 79 20 24 6d 61 70 77 69 64 74 68 20 5b 0 $y $mapwidth [
1c780 65 78 70 72 20 7b 24 79 20 2b 20 24 73 69 7a 65 expr {$y + $size
1c790 7d 5d 0a 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 }].. }.. #
1c7a0 20 6c 65 74 27 73 20 64 72 61 77 20 61 20 72 65 let's draw a re
1c7b0 63 74 61 6e 67 6c 65 20 74 6f 20 73 69 6d 75 6c ctangle to simul
1c7c0 61 74 65 20 61 20 73 63 72 6f 6c 6c 62 61 72 20 ate a scrollbar
1c7d0 74 68 75 6d 62 2e 20 54 68 65 20 73 69 7a 65 0a thumb. The size.
1c7e0 20 20 20 20 23 20 69 73 6e 27 74 20 69 6d 70 6f # isn't impo
1c7f0 72 74 61 6e 74 20 73 69 6e 63 65 20 69 74 20 77 rtant since it w
1c800 69 6c 6c 20 67 65 74 20 72 65 73 69 7a 65 64 20 ill get resized
1c810 77 68 65 6e 20 6d 61 70 2d 6d 6f 76 65 2d 74 68 when map-move-th
1c820 75 6d 62 0a 20 20 20 20 23 20 69 73 20 63 61 6c umb. # is cal
1c830 6c 65 64 2e 2e 2e 0a 20 20 20 20 24 77 28 6d 61 led.... $w(ma
1c840 70 43 61 6e 76 61 73 29 20 63 72 65 61 74 65 20 pCanvas) create
1c850 6c 69 6e 65 20 30 20 30 20 30 20 30 20 2d 77 69 line 0 0 0 0 -wi
1c860 64 74 68 20 31 20 2d 74 61 67 73 20 74 68 75 6d dth 1 -tags thum
1c870 62 55 4c 20 2d 66 69 6c 6c 20 77 68 69 74 65 0a bUL -fill white.
1c880 20 20 20 20 24 77 28 6d 61 70 43 61 6e 76 61 73 $w(mapCanvas
1c890 29 20 63 72 65 61 74 65 20 6c 69 6e 65 20 31 20 ) create line 1
1c8a0 31 20 31 20 31 20 2d 77 69 64 74 68 20 31 20 2d 1 1 1 -width 1 -
1c8b0 74 61 67 73 20 74 68 75 6d 62 4c 52 20 2d 66 69 tags thumbLR -fi
1c8c0 6c 6c 20 62 6c 61 63 6b 0a 20 20 20 20 24 77 28 ll black. $w(
1c8d0 6d 61 70 43 61 6e 76 61 73 29 20 72 61 69 73 65 mapCanvas) raise
1c8e0 20 74 68 75 6d 62 0a 0a 20 20 20 20 23 20 6e 6f thumb.. # no
1c8f0 77 2c 20 6d 6f 76 65 20 74 68 65 20 74 68 75 6d w, move the thum
1c900 62 0a 20 20 20 20 65 76 61 6c 20 6d 61 70 2d 6d b. eval map-m
1c910 6f 76 65 2d 74 68 75 6d 62 20 5b 24 77 28 4c 65 ove-thumb [$w(Le
1c920 66 74 54 65 78 74 29 20 79 76 69 65 77 5d 0a 0a ftText) yview]..
1c930 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 }..#############
1c940 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c950 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c960 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c970 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c980 23 23 0a 23 20 52 65 73 69 7a 65 20 6d 61 70 20 ##.# Resize map
1c990 74 6f 20 66 69 74 20 77 69 6e 64 6f 77 20 73 69 to fit window si
1c9a0 7a 65 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 ze.#############
1c9b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c9c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c9d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c9e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1c9f0 23 23 0a 70 72 6f 63 20 6d 61 70 2d 72 65 73 69 ##.proc map-resi
1ca00 7a 65 20 7b 61 72 67 73 7d 20 7b 0a 20 20 20 20 ze {args} {.
1ca10 67 6c 6f 62 61 6c 20 67 20 6f 70 74 73 0a 20 20 global g opts.
1ca20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 global w..
1ca30 73 65 74 20 6d 61 70 77 69 64 74 68 20 5b 77 69 set mapwidth [wi
1ca40 6e 66 6f 20 77 69 64 74 68 20 24 77 28 6d 61 70 nfo width $w(map
1ca50 29 5d 0a 20 20 20 20 73 65 74 20 67 28 6d 61 70 )]. set g(map
1ca60 62 6f 72 64 65 72 29 20 5b 65 78 70 72 20 7b 5b border) [expr {[
1ca70 24 77 28 6d 61 70 29 20 63 67 65 74 20 2d 62 6f $w(map) cget -bo
1ca80 72 64 65 72 77 69 64 74 68 5d 20 2b 20 5b 24 77 rderwidth] + [$w
1ca90 28 6d 61 70 29 20 63 67 65 74 20 5c 0a 20 20 20 (map) cget \.
1caa0 20 20 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 -highlightthi
1cab0 63 6b 6e 65 73 73 5d 7d 5d 0a 20 20 20 20 73 65 ckness]}]. se
1cac0 74 20 6d 61 70 68 65 69 67 68 74 20 5b 65 78 70 t mapheight [exp
1cad0 72 20 7b 5b 77 69 6e 66 6f 20 68 65 69 67 68 74 r {[winfo height
1cae0 20 24 77 28 6d 61 70 29 5d 20 2d 20 24 67 28 6d $w(map)] - $g(m
1caf0 61 70 62 6f 72 64 65 72 29 20 2a 20 32 7d 5d 0a apborder) * 2}].
1cb00 0a 20 20 20 20 23 20 57 65 27 6c 6c 20 67 65 74 . # We'll get
1cb10 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 22 72 65 a couple of "re
1cb20 73 69 7a 65 22 20 65 76 65 6e 74 73 2c 20 73 6f size" events, so
1cb30 20 64 6f 6e 27 74 20 64 72 61 77 20 61 20 6d 61 don't draw a ma
1cb40 70 0a 20 20 20 20 23 20 75 6e 6c 65 73 73 20 77 p. # unless w
1cb50 65 27 76 65 20 67 6f 74 20 74 68 65 20 64 69 66 e've got the dif
1cb60 66 73 20 61 6e 64 20 74 68 65 20 6d 61 70 20 73 fs and the map s
1cb70 69 7a 65 20 68 61 73 20 63 68 61 6e 67 65 64 0a ize has changed.
1cb80 20 20 20 20 69 66 20 7b 24 67 28 63 6f 75 6e 74 if {$g(count
1cb90 29 20 3d 3d 20 30 20 7c 7c 20 24 6d 61 70 68 65 ) == 0 || $maphe
1cba0 69 67 68 74 20 3d 3d 20 24 67 28 6d 61 70 68 65 ight == $g(maphe
1cbb0 69 67 68 74 29 7d 20 7b 0a 09 72 65 74 75 72 6e ight)} {..return
1cbc0 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 49 66 . }.. # If
1cbd0 20 77 65 20 64 6f 6e 27 74 20 68 61 76 65 20 61 we don't have a
1cbe0 20 6d 61 70 20 61 6e 64 20 64 6f 6e 27 74 20 77 map and don't w
1cbf0 61 6e 74 20 6f 6e 65 2c 20 64 6f 6e 27 74 20 6d ant one, don't m
1cc00 61 6b 65 20 6f 6e 65 0a 20 20 20 20 69 66 20 7b ake one. if {
1cc10 24 67 28 6d 61 70 68 65 69 67 68 74 29 20 3d 3d $g(mapheight) ==
1cc20 20 30 20 26 26 20 24 6f 70 74 73 28 73 68 6f 77 0 && $opts(show
1cc30 6d 61 70 29 20 3d 3d 20 30 7d 20 7b 0a 09 72 65 map) == 0} {..re
1cc40 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
1cc50 23 20 54 68 69 73 20 73 65 65 6d 73 20 74 6f 20 # This seems to
1cc60 68 61 70 70 65 6e 20 6f 6e 20 57 69 6e 64 6f 77 happen on Window
1cc70 73 21 3f 20 5f 41 66 74 65 72 5f 20 74 68 65 20 s!? _After_ the
1cc80 6d 61 70 20 69 73 20 64 72 61 77 6e 20 74 68 65 map is drawn the
1cc90 20 66 69 72 73 74 20 74 69 6d 65 0a 20 20 20 20 first time.
1cca0 23 20 61 6e 6f 74 68 65 72 20 65 76 65 6e 74 20 # another event
1ccb0 74 72 69 67 67 65 72 73 20 61 6e 64 20 5b 77 69 triggers and [wi
1ccc0 6e 66 6f 20 68 65 69 67 68 74 20 24 77 28 6d 61 nfo height $w(ma
1ccd0 70 29 5d 20 69 73 20 74 68 65 6e 20 30 2e 2e 2e p)] is then 0...
1cce0 0a 20 20 20 20 69 66 20 7b 24 6d 61 70 68 65 69 . if {$maphei
1ccf0 67 68 74 20 3c 20 31 7d 20 7b 0a 09 72 65 74 75 ght < 1} {..retu
1cd00 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 rn. }.. se
1cd10 74 20 67 28 6d 61 70 68 65 69 67 68 74 29 20 24 t g(mapheight) $
1cd20 6d 61 70 68 65 69 67 68 74 0a 20 20 20 20 73 65 mapheight. se
1cd30 74 20 67 28 6d 61 70 77 69 64 74 68 29 20 24 6d t g(mapwidth) $m
1cd40 61 70 77 69 64 74 68 0a 20 20 20 20 63 72 65 61 apwidth. crea
1cd50 74 65 2d 6d 61 70 20 6d 61 70 20 24 6d 61 70 77 te-map map $mapw
1cd60 69 64 74 68 20 24 6d 61 70 68 65 69 67 68 74 0a idth $mapheight.
1cd70 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 }..#############
1cd80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1cd90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1cda0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1cdb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1cdc0 23 23 0a 23 20 73 63 72 6f 6c 6c 20 74 6f 20 64 ##.# scroll to d
1cdd0 69 66 66 20 72 65 67 69 6f 6e 20 6e 65 61 72 65 iff region neare
1cde0 73 74 20 74 6f 20 79 0a 23 23 23 23 23 23 23 23 st to y.########
1cdf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ce00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ce10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ce20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ce30 23 23 23 23 23 23 23 0a 70 72 6f 63 20 6d 61 70 #######.proc map
1ce40 2d 73 63 72 6f 6c 6c 20 7b 79 7d 20 7b 0a 20 20 -scroll {y} {.
1ce50 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 67 global g. g
1ce60 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c 6f 62 lobal w. glob
1ce70 61 6c 20 6f 70 74 73 0a 0a 20 20 20 20 73 65 74 al opts.. set
1ce80 20 79 76 69 65 77 20 5b 65 78 70 72 20 7b 64 6f yview [expr {do
1ce90 75 62 6c 65 28 24 79 29 20 2f 20 64 6f 75 62 6c uble($y) / doubl
1cea0 65 28 24 67 28 6d 61 70 68 65 69 67 68 74 29 29 e($g(mapheight))
1ceb0 7d 5d 0a 20 20 20 20 23 20 53 68 6f 77 20 74 65 }]. # Show te
1cec0 78 74 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 xt corresponding
1ced0 20 74 6f 20 6d 61 70 0a 20 20 20 20 63 61 74 63 to map. catc
1cee0 68 20 7b 24 77 28 52 69 67 68 74 54 65 78 74 29 h {$w(RightText)
1cef0 20 79 76 69 65 77 20 6d 6f 76 65 74 6f 20 24 79 yview moveto $y
1cf00 76 69 65 77 7d 20 72 65 73 75 6c 74 0a 20 20 20 view} result.
1cf10 20 75 70 64 61 74 65 20 69 64 6c 65 74 61 73 6b update idletask
1cf20 73 0a 0a 20 20 20 20 23 20 53 65 6c 65 63 74 20 s.. # Select
1cf30 74 68 65 20 64 69 66 66 20 72 65 67 69 6f 6e 20 the diff region
1cf40 63 6c 6f 73 65 73 74 20 74 6f 20 74 68 65 20 6d closest to the m
1cf50 69 64 64 6c 65 20 6f 66 20 74 68 65 20 73 63 72 iddle of the scr
1cf60 65 65 6e 0a 20 20 20 20 73 65 74 20 77 69 6e 68 een. set winh
1cf70 61 6c 66 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 alf [expr {[winf
1cf80 6f 20 68 65 69 67 68 74 20 24 77 28 52 69 67 68 o height $w(Righ
1cf90 74 54 65 78 74 29 5d 20 2f 20 32 7d 5d 0a 20 20 tText)] / 2}].
1cfa0 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 66 69 set result [fi
1cfb0 6e 64 2d 64 69 66 66 20 5b 65 78 70 72 20 7b 69 nd-diff [expr {i
1cfc0 6e 74 28 5b 24 77 28 52 69 67 68 74 54 65 78 74 nt([$w(RightText
1cfd0 29 20 69 6e 64 65 78 20 40 31 2c 24 77 69 6e 68 ) index @1,$winh
1cfe0 61 6c 66 5d 29 7d 5d 5d 0a 20 20 20 20 6d 6f 76 alf])}]]. mov
1cff0 65 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 75 6c e [lindex $resul
1d000 74 20 30 5d 20 30 20 30 0a 0a 20 20 20 20 69 66 t 0] 0 0.. if
1d010 20 7b 24 6f 70 74 73 28 61 75 74 6f 63 65 6e 74 {$opts(autocent
1d020 65 72 29 7d 20 7b 0a 09 63 65 6e 74 65 72 0a 20 er)} {..center.
1d030 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 24 67 }.. if {$g
1d040 28 73 68 6f 77 6d 65 72 67 65 29 7d 20 7b 0a 09 (showmerge)} {..
1d050 6d 65 72 67 65 2d 63 65 6e 74 65 72 0a 20 20 20 merge-center.
1d060 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 }.}..##########
1d070 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d080 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d090 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d0a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d0b0 23 23 23 23 23 0a 23 20 54 6f 67 67 6c 65 20 73 #####.# Toggle s
1d0c0 68 6f 77 69 6e 67 20 74 68 65 20 6c 69 6e 65 20 howing the line
1d0d0 63 6f 6d 70 61 72 69 73 6f 6e 20 77 69 6e 64 6f comparison windo
1d0e0 77 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 w.##############
1d0f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d100 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d110 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d120 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d130 23 0a 70 72 6f 63 20 64 6f 2d 73 68 6f 77 2d 6c #.proc do-show-l
1d140 69 6e 65 76 69 65 77 20 7b 7b 73 68 6f 77 4c 69 ineview {{showLi
1d150 6e 65 76 69 65 77 20 7b 7d 7d 7d 20 7b 0a 20 20 neview {}}} {.
1d160 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 global opts.
1d170 20 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 global w..
1d180 69 66 20 7b 24 73 68 6f 77 4c 69 6e 65 76 69 65 if {$showLinevie
1d190 77 20 21 3d 20 7b 7d 7d 20 7b 0a 09 73 65 74 20 w != {}} {..set
1d1a0 6f 70 74 73 28 73 68 6f 77 6c 69 6e 65 76 69 65 opts(showlinevie
1d1b0 77 29 20 24 73 68 6f 77 4c 69 6e 65 76 69 65 77 w) $showLineview
1d1c0 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b . }.. if {
1d1d0 24 6f 70 74 73 28 73 68 6f 77 6c 69 6e 65 76 69 $opts(showlinevi
1d1e0 65 77 29 7d 20 7b 0a 09 67 72 69 64 20 24 77 28 ew)} {..grid $w(
1d1f0 42 6f 74 74 6f 6d 54 65 78 74 29 20 2d 72 6f 77 BottomText) -row
1d200 20 33 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 3 -column 0 -st
1d210 69 63 6b 79 20 65 77 20 2d 63 6f 6c 75 6d 6e 73 icky ew -columns
1d220 70 61 6e 20 34 0a 20 20 20 20 7d 20 65 6c 73 65 pan 4. } else
1d230 20 7b 0a 09 67 72 69 64 20 66 6f 72 67 65 74 20 {..grid forget
1d240 24 77 28 42 6f 74 74 6f 6d 54 65 78 74 29 0a 20 $w(BottomText).
1d250 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 }.}..########
1d260 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d270 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d280 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d290 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d2a0 23 23 23 23 23 23 23 0a 23 20 54 6f 67 67 6c 65 #######.# Toggle
1d2b0 20 73 68 6f 77 69 6e 67 20 69 6e 6c 69 6e 65 20 showing inline
1d2c0 63 6f 6d 70 61 72 69 73 6f 6e 0a 23 23 23 23 23 comparison.#####
1d2d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d2e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d2f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d300 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d310 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
1d320 64 6f 2d 73 68 6f 77 2d 69 6e 6c 69 6e 65 31 20 do-show-inline1
1d330 7b 7b 73 68 6f 77 49 6e 6c 69 6e 65 31 20 7b 7d {{showInline1 {}
1d340 7d 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 }} {. global
1d350 6f 70 74 73 0a 0a 20 20 20 20 69 66 20 7b 24 73 opts.. if {$s
1d360 68 6f 77 49 6e 6c 69 6e 65 31 20 21 3d 20 7b 7d howInline1 != {}
1d370 7d 20 7b 0a 09 70 75 74 73 20 22 70 61 73 73 65 } {..puts "passe
1d380 64 20 69 6e 20 76 61 6c 75 65 3d 24 73 68 6f 77 d in value=$show
1d390 49 6e 6c 69 6e 65 31 22 0a 09 73 65 74 20 6f 70 Inline1"..set op
1d3a0 74 73 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 20 ts(showinline1)
1d3b0 24 73 68 6f 77 49 6e 6c 69 6e 65 31 0a 20 20 20 $showInline1.
1d3c0 20 7d 0a 0a 20 20 20 20 23 20 6d 75 74 75 61 6c }.. # mutual
1d3d0 6c 79 20 64 69 73 6a 6f 69 6e 74 20 6f 70 74 69 ly disjoint opti
1d3e0 6f 6e 73 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 ons. if {$opt
1d3f0 73 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 7d 20 s(showinline1)}
1d400 7b 0a 09 73 65 74 20 6f 70 74 73 28 73 68 6f 77 {..set opts(show
1d410 69 6e 6c 69 6e 65 32 29 20 30 0a 20 20 20 20 7d inline2) 0. }
1d420 0a 20 20 20 20 72 65 63 6f 6d 70 75 74 65 2d 64 . recompute-d
1d430 69 66 66 0a 7d 0a 0a 70 72 6f 63 20 64 6f 2d 73 iff.}..proc do-s
1d440 68 6f 77 2d 69 6e 6c 69 6e 65 32 20 7b 7b 73 68 how-inline2 {{sh
1d450 6f 77 49 6e 6c 69 6e 65 32 20 7b 7d 7d 7d 20 7b owInline2 {}}} {
1d460 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 . global opts
1d470 0a 0a 20 20 20 20 69 66 20 7b 24 73 68 6f 77 49 .. if {$showI
1d480 6e 6c 69 6e 65 32 20 21 3d 20 7b 7d 7d 20 7b 0a nline2 != {}} {.
1d490 09 73 65 74 20 6f 70 74 73 28 73 68 6f 77 69 6e .set opts(showin
1d4a0 6c 69 6e 65 32 29 20 24 73 68 6f 77 49 6e 6c 69 line2) $showInli
1d4b0 6e 65 32 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 ne2. }.. #
1d4c0 20 6d 75 74 75 61 6c 6c 79 20 64 69 73 6a 6f 69 mutually disjoi
1d4d0 6e 74 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 69 nt options. i
1d4e0 66 20 7b 24 6f 70 74 73 28 73 68 6f 77 69 6e 6c f {$opts(showinl
1d4f0 69 6e 65 32 29 7d 20 7b 0a 09 73 65 74 20 6f 70 ine2)} {..set op
1d500 74 73 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 20 ts(showinline1)
1d510 30 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 63 6f 0. }. reco
1d520 6d 70 75 74 65 2d 64 69 66 66 0a 7d 0a 0a 23 23 mpute-diff.}..##
1d530 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d540 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d550 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d560 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d570 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 #############.#
1d580 54 6f 67 67 6c 65 20 73 68 6f 77 69 6e 67 20 6d Toggle showing m
1d590 61 70 20 6f 72 20 6e 6f 74 0a 23 23 23 23 23 23 ap or not.######
1d5a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d5b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d5c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d5d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d5e0 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 64 #########.proc d
1d5f0 6f 2d 73 68 6f 77 2d 6d 61 70 20 7b 7b 73 68 6f o-show-map {{sho
1d600 77 4d 61 70 20 7b 7d 7d 7d 20 7b 0a 20 20 20 20 wMap {}}} {.
1d610 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 20 global opts.
1d620 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 69 66 global w.. if
1d630 20 7b 24 73 68 6f 77 4d 61 70 20 21 3d 20 7b 7d {$showMap != {}
1d640 7d 20 7b 0a 09 73 65 74 20 6f 70 74 73 28 73 68 } {..set opts(sh
1d650 6f 77 6d 61 70 29 20 24 73 68 6f 77 4d 61 70 0a owmap) $showMap.
1d660 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 24 }.. if {$
1d670 6f 70 74 73 28 73 68 6f 77 6d 61 70 29 7d 20 7b opts(showmap)} {
1d680 0a 09 67 72 69 64 20 24 77 28 6d 61 70 29 20 2d ..grid $w(map) -
1d690 72 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 31 20 row 1 -column 1
1d6a0 2d 73 74 69 63 6b 20 6e 73 0a 20 20 20 20 7d 20 -stick ns. }
1d6b0 65 6c 73 65 20 7b 0a 09 67 72 69 64 20 66 6f 72 else {..grid for
1d6c0 67 65 74 20 24 77 28 6d 61 70 29 0a 20 20 20 20 get $w(map).
1d6d0 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 }.}..###########
1d6e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d6f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d700 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d710 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d720 23 23 23 23 0a 23 20 46 69 6e 64 20 74 68 65 20 ####.# Find the
1d730 64 69 66 66 20 6e 65 61 72 65 73 74 20 74 6f 20 diff nearest to
1d740 24 6c 69 6e 65 2e 0a 23 20 52 65 74 75 72 6e 73 $line..# Returns
1d750 20 22 24 69 20 24 6e 65 77 74 6f 70 22 20 77 68 "$i $newtop" wh
1d760 65 72 65 20 24 69 20 69 73 20 74 68 65 20 69 6e ere $i is the in
1d770 64 65 78 20 6f 66 20 74 68 65 20 64 69 66 66 20 dex of the diff
1d780 72 65 67 69 6f 6e 0a 23 20 61 6e 64 20 24 6e 65 region.# and $ne
1d790 77 74 6f 70 20 69 73 20 74 68 65 20 6e 65 77 20 wtop is the new
1d7a0 74 6f 70 20 6c 69 6e 65 20 69 6e 20 74 68 65 20 top line in the
1d7b0 77 69 6e 64 6f 77 20 74 6f 20 74 68 65 20 72 69 window to the ri
1d7c0 67 68 74 2e 0a 23 23 23 23 23 23 23 23 23 23 23 ght..###########
1d7d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d7e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d7f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d800 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1d810 23 23 23 23 0a 70 72 6f 63 20 66 69 6e 64 2d 64 ####.proc find-d
1d820 69 66 66 20 7b 6c 69 6e 65 7d 20 7b 0a 20 20 20 iff {line} {.
1d830 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 67 6c global g. gl
1d840 6f 62 61 6c 20 77 0a 0a 20 20 20 20 73 65 74 20 obal w.. set
1d850 74 6f 70 20 24 6c 69 6e 65 0a 20 20 20 20 73 65 top $line. se
1d860 74 20 6e 65 77 74 6f 70 20 5b 65 78 70 72 20 7b t newtop [expr {
1d870 24 74 6f 70 20 2d 20 69 6e 74 28 5b 24 77 28 4c $top - int([$w(L
1d880 65 66 74 54 65 78 74 29 20 69 6e 64 65 78 20 65 eftText) index e
1d890 6e 64 5d 29 20 2b 20 5c 0a 20 20 20 20 20 20 69 nd]) + \. i
1d8a0 6e 74 28 5b 24 77 28 52 69 67 68 74 54 65 78 74 nt([$w(RightText
1d8b0 29 20 69 6e 64 65 78 20 65 6e 64 5d 29 7d 5d 0a ) index end])}].
1d8c0 0a 20 20 20 20 66 6f 72 20 7b 73 65 74 20 6c 6f . for {set lo
1d8d0 77 20 31 3b 20 73 65 74 20 68 69 67 68 20 24 67 w 1; set high $g
1d8e0 28 63 6f 75 6e 74 29 3b 20 73 65 74 20 69 20 5b (count); set i [
1d8f0 65 78 70 72 20 7b 28 24 6c 6f 77 20 2b 20 24 68 expr {($low + $h
1d900 69 67 68 29 20 2f 20 32 7d 5d 7d 20 5c 0a 20 20 igh) / 2}]} \.
1d910 20 20 20 20 7b 24 69 20 3e 3d 20 24 6c 6f 77 7d {$i >= $low}
1d920 20 7b 73 65 74 20 69 20 5b 65 78 70 72 20 7b 28 {set i [expr {(
1d930 24 6c 6f 77 20 2b 20 24 68 69 67 68 29 20 2f 20 $low + $high) /
1d940 32 7d 5d 7d 20 7b 0a 0a 09 66 6f 72 65 61 63 68 2}]} {...foreach
1d950 20 7b 6c 69 6e 65 20 73 31 20 65 31 20 73 32 20 {line s1 e1 s2
1d960 65 32 20 74 79 70 65 7d 20 24 67 28 73 63 72 64 e2 type} $g(scrd
1d970 69 66 66 2c 24 69 29 20 7b 20 7d 0a 0a 09 69 66 iff,$i) { }...if
1d980 20 7b 24 73 31 20 3e 20 24 74 6f 70 7d 20 7b 0a {$s1 > $top} {.
1d990 09 20 20 20 20 73 65 74 20 6e 65 77 74 6f 70 20 . set newtop
1d9a0 5b 65 78 70 72 20 7b 24 74 6f 70 20 2d 20 24 73 [expr {$top - $s
1d9b0 31 20 2b 20 24 73 32 7d 5d 0a 09 20 20 20 20 73 1 + $s2}].. s
1d9c0 65 74 20 68 69 67 68 20 5b 65 78 70 72 20 7b 24 et high [expr {$
1d9d0 69 2d 31 7d 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a i-1}]..} else {.
1d9e0 09 20 20 20 20 73 65 74 20 6c 6f 77 20 5b 65 78 . set low [ex
1d9f0 70 72 20 7b 24 69 2b 31 7d 5d 0a 09 7d 0a 20 20 pr {$i+1}]..}.
1da00 20 20 7d 0a 0a 20 20 20 20 23 20 64 6f 20 73 6f }.. # do so
1da10 6d 65 20 72 61 6e 67 65 20 63 68 65 63 6b 69 6e me range checkin
1da20 67 2e 2e 2e 0a 20 20 20 20 73 65 74 20 69 20 5b g.... set i [
1da30 6d 61 78 20 31 20 5b 6d 69 6e 20 24 69 20 24 67 max 1 [min $i $g
1da40 28 63 6f 75 6e 74 29 5d 5d 0a 0a 20 20 20 20 23 (count)]].. #
1da50 20 49 66 20 6e 65 78 74 20 64 69 66 66 20 69 73 If next diff is
1da60 20 63 6c 6f 73 65 72 20 74 68 61 6e 20 74 68 65 closer than the
1da70 20 6f 6e 65 20 66 6f 75 6e 64 2c 20 75 73 65 20 one found, use
1da80 69 74 20 69 6e 73 74 65 61 64 0a 20 20 20 20 69 it instead. i
1da90 66 20 7b 24 69 20 3e 20 30 20 26 26 20 24 69 20 f {$i > 0 && $i
1daa0 3c 20 24 67 28 63 6f 75 6e 74 29 7d 20 7b 0a 09 < $g(count)} {..
1dab0 73 65 74 20 6e 65 78 74 73 31 20 5b 6c 69 6e 64 set nexts1 [lind
1dac0 65 78 20 24 67 28 73 63 72 64 69 66 66 2c 5b 65 ex $g(scrdiff,[e
1dad0 78 70 72 20 7b 24 69 20 2b 20 31 7d 5d 29 20 31 xpr {$i + 1}]) 1
1dae0 5d 0a 09 73 65 74 20 65 31 20 5b 6c 69 6e 64 65 ]..set e1 [linde
1daf0 78 20 24 67 28 73 63 72 64 69 66 66 2c 24 69 29 x $g(scrdiff,$i)
1db00 20 32 5d 0a 09 69 66 20 7b 24 6e 65 78 74 73 31 2]..if {$nexts1
1db10 20 2d 20 24 74 6f 70 20 3c 20 24 74 6f 70 20 2d - $top < $top -
1db20 20 24 65 31 7d 20 7b 0a 09 20 20 20 20 69 6e 63 $e1} {.. inc
1db30 72 20 69 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 r i..}. }..
1db40 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 return [list $
1db50 69 20 24 6e 65 77 74 6f 70 5d 0a 7d 0a 0a 23 23 i $newtop].}..##
1db60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1db70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1db80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1db90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dba0 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 #############.#
1dbb0 43 61 6c 63 75 6c 61 74 65 20 6e 75 6d 62 65 72 Calculate number
1dbc0 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 64 69 66 of lines in dif
1dbd0 66 20 72 65 67 69 6f 6e 0a 23 20 70 6f 73 20 20 f region.# pos
1dbe0 20 20 20 20 20 20 20 20 20 20 44 69 66 66 20 6e Diff n
1dbf0 75 6d 62 65 72 0a 23 20 76 65 72 73 69 6f 6e 20 umber.# version
1dc00 20 20 31 20 6f 72 20 32 2c 20 6c 65 66 74 20 6f 1 or 2, left o
1dc10 72 20 72 69 67 68 74 20 77 69 6e 64 6f 77 20 76 r right window v
1dc20 65 72 73 69 6f 6e 0a 23 20 73 63 72 65 65 6e 20 ersion.# screen
1dc30 20 20 20 31 20 66 6f 72 20 73 63 72 65 65 6e 20 1 for screen
1dc40 73 69 7a 65 2c 20 30 20 66 6f 72 20 6f 72 69 67 size, 0 for orig
1dc50 69 6e 61 6c 20 64 69 66 66 20 73 69 7a 65 0a 23 inal diff size.#
1dc60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dc70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dc80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dc90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dca0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
1dcb0 72 6f 63 20 64 69 66 66 2d 73 69 7a 65 20 7b 70 roc diff-size {p
1dcc0 6f 73 20 76 65 72 73 69 6f 6e 20 7b 73 63 72 65 os version {scre
1dcd0 65 6e 20 30 7d 7d 20 7b 0a 20 20 20 20 67 6c 6f en 0}} {. glo
1dce0 62 61 6c 20 67 0a 0a 20 20 20 20 69 66 20 7b 24 bal g.. if {$
1dcf0 73 63 72 65 65 6e 7d 20 7b 0a 09 73 65 74 20 64 screen} {..set d
1dd00 69 66 66 20 73 63 72 64 69 66 66 0a 20 20 20 20 iff scrdiff.
1dd10 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 64 69 } else {..set di
1dd20 66 66 20 70 64 69 66 66 0a 20 20 20 20 7d 0a 0a ff pdiff. }..
1dd30 20 20 20 20 66 6f 72 65 61 63 68 20 7b 74 68 69 foreach {thi
1dd40 73 64 69 66 66 20 73 28 31 29 20 65 28 31 29 20 sdiff s(1) e(1)
1dd50 73 28 32 29 20 65 28 32 29 20 74 79 70 65 7d 20 s(2) e(2) type}
1dd60 24 67 28 24 64 69 66 66 2c 24 70 6f 73 29 20 7b $g($diff,$pos) {
1dd70 20 7d 0a 0a 20 20 20 20 73 77 69 74 63 68 20 2d }.. switch -
1dd80 2d 20 24 76 65 72 73 69 6f 6e 20 7b 0a 20 20 20 - $version {.
1dd90 20 31 20 7b 0a 09 20 20 20 20 73 65 74 20 6c 69 1 {.. set li
1dda0 6e 65 73 20 5b 65 78 70 72 20 7b 24 65 28 31 29 nes [expr {$e(1)
1ddb0 20 2d 20 24 73 28 31 29 20 2b 20 31 7d 5d 0a 09 - $s(1) + 1}]..
1ddc0 20 20 20 20 69 66 20 7b 24 74 79 70 65 20 3d 3d if {$type ==
1ddd0 20 22 61 22 7d 20 7b 0a 09 09 69 6e 63 72 20 6c "a"} {...incr l
1dde0 69 6e 65 73 20 2d 31 0a 09 20 20 20 20 7d 0a 09 ines -1.. }..
1ddf0 7d 0a 20 20 20 20 32 20 7b 0a 09 20 20 20 20 73 }. 2 {.. s
1de00 65 74 20 6c 69 6e 65 73 20 5b 65 78 70 72 20 7b et lines [expr {
1de10 24 65 28 32 29 20 2d 20 24 73 28 32 29 20 2b 20 $e(2) - $s(2) +
1de20 31 7d 5d 0a 09 20 20 20 20 69 66 20 7b 24 74 79 1}].. if {$ty
1de30 70 65 20 3d 3d 20 22 64 22 7d 20 7b 0a 09 09 69 pe == "d"} {...i
1de40 6e 63 72 20 6c 69 6e 65 73 20 2d 31 0a 09 20 20 ncr lines -1..
1de50 20 20 7d 0a 09 7d 0a 20 20 20 20 31 32 20 2d 0a }..}. 12 -.
1de60 20 20 20 20 32 31 20 7b 0a 09 20 20 20 20 73 65 21 {.. se
1de70 74 20 6c 69 6e 65 73 20 5b 65 78 70 72 20 7b 24 t lines [expr {$
1de80 65 28 31 29 20 2d 20 24 73 28 31 29 20 2b 20 24 e(1) - $s(1) + $
1de90 65 28 32 29 20 2d 20 24 73 28 32 29 20 2b 20 31 e(2) - $s(2) + 1
1dea0 7d 5d 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 20 20 }]..}. }.
1deb0 72 65 74 75 72 6e 20 24 6c 69 6e 65 73 0a 7d 0a return $lines.}.
1dec0 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
1ded0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dee0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1def0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df10 0a 23 20 54 6f 67 67 6c 65 20 73 68 6f 77 69 6e .# Toggle showin
1df20 67 20 6d 65 72 67 65 20 70 72 65 76 69 65 77 20 g merge preview
1df30 6f 72 20 6e 6f 74 0a 23 23 23 23 23 23 23 23 23 or not.#########
1df40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1df80 23 23 23 23 23 23 0a 70 72 6f 63 20 64 6f 2d 73 ######.proc do-s
1df90 68 6f 77 2d 6d 65 72 67 65 20 7b 7b 73 68 6f 77 how-merge {{show
1dfa0 4d 65 72 67 65 20 22 22 7d 7d 20 7b 0a 20 20 20 Merge ""}} {.
1dfb0 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 64 6f 2d debug-info "do-
1dfc0 73 68 6f 77 2d 6d 65 72 67 65 20 28 24 73 68 6f show-merge ($sho
1dfd0 77 4d 65 72 67 65 29 22 0a 20 20 20 20 67 6c 6f wMerge)". glo
1dfe0 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c bal g. global
1dff0 20 77 0a 0a 20 20 20 20 69 66 20 7b 24 73 68 6f w.. if {$sho
1e000 77 4d 65 72 67 65 20 21 3d 20 22 22 7d 20 7b 0a wMerge != ""} {.
1e010 09 73 65 74 20 67 28 73 68 6f 77 6d 65 72 67 65 .set g(showmerge
1e020 29 20 24 73 68 6f 77 4d 65 72 67 65 0a 20 20 20 ) $showMerge.
1e030 20 7d 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 73 }.. if {$g(s
1e040 68 6f 77 6d 65 72 67 65 29 7d 20 7b 0a 09 77 61 howmerge)} {..wa
1e050 74 63 68 2d 63 75 72 73 6f 72 0a 09 69 66 20 7b tch-cursor..if {
1e060 21 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 77 ! [info exists w
1e070 28 6d 65 72 67 65 54 65 78 74 5d 7d 20 7b 0a 09 (mergeText]} {..
1e080 20 20 20 20 6d 65 72 67 65 2d 72 65 61 64 2d 66 merge-read-f
1e090 69 6c 65 0a 09 20 20 20 20 6d 65 72 67 65 2d 61 ile.. merge-a
1e0a0 64 64 2d 6d 61 72 6b 73 0a 09 7d 0a 09 77 6d 20 dd-marks..}..wm
1e0b0 64 65 69 63 6f 6e 69 66 79 20 2e 6d 65 72 67 65 deiconify .merge
1e0c0 0a 09 24 77 28 6d 65 72 67 65 54 65 78 74 29 20 ..$w(mergeText)
1e0d0 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
1e0e0 20 64 69 73 61 62 6c 65 64 0a 09 66 6f 63 75 73 disabled..focus
1e0f0 20 2d 66 6f 72 63 65 20 24 77 28 6d 65 72 67 65 -force $w(merge
1e100 54 65 78 74 29 0a 09 6d 65 72 67 65 2d 63 65 6e Text)..merge-cen
1e110 74 65 72 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b ter. } else {
1e120 0a 09 77 6d 20 77 69 74 68 64 72 61 77 20 24 77 ..wm withdraw $w
1e130 28 6d 65 72 67 65 29 0a 20 20 20 20 7d 0a 20 20 (merge). }.
1e140 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 debug-info "
1e150 2e 2e 2e 72 65 73 74 6f 72 65 2d 63 75 72 73 6f ...restore-curso
1e160 72 20 66 72 6f 6d 20 64 6f 2d 73 68 6f 77 2d 6d r from do-show-m
1e170 65 72 67 65 22 0a 20 20 20 20 72 65 73 74 6f 72 erge". restor
1e180 65 2d 63 75 72 73 6f 72 0a 7d 0a 0a 23 23 23 23 e-cursor.}..####
1e190 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e1a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e1b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e1c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e1d0 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 43 72 ###########.# Cr
1e1e0 65 61 74 65 20 4d 65 72 67 65 20 70 72 65 76 69 eate Merge previ
1e1f0 65 77 20 77 69 6e 64 6f 77 0a 23 23 23 23 23 23 ew window.######
1e200 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e210 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e220 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e230 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1e240 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 6d #########.proc m
1e250 65 72 67 65 2d 63 72 65 61 74 65 2d 77 69 6e 64 erge-create-wind
1e260 6f 77 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 ow {} {. debu
1e270 67 2d 69 6e 66 6f 20 22 6d 65 72 67 65 2d 63 72 g-info "merge-cr
1e280 65 61 74 65 2d 77 69 6e 64 6f 77 22 0a 20 20 20 eate-window".
1e290 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 global opts.
1e2a0 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c global w. gl
1e2b0 6f 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 20 obal g.. set
1e2c0 74 6f 70 20 2e 6d 65 72 67 65 0a 20 20 20 20 73 top .merge. s
1e2d0 65 74 20 77 28 6d 65 72 67 65 29 20 24 74 6f 70 et w(merge) $top
1e2e0 0a 0a 20 20 20 20 63 61 74 63 68 20 7b 64 65 73 .. catch {des
1e2f0 74 72 6f 79 20 24 74 6f 70 7d 0a 0a 20 20 20 20 troy $top}..
1e300 74 6f 70 6c 65 76 65 6c 20 24 74 6f 70 0a 20 20 toplevel $top.
1e310 20 20 73 65 74 20 72 78 20 5b 77 69 6e 66 6f 20 set rx [winfo
1e320 72 6f 6f 74 78 20 2e 5d 0a 20 20 20 20 73 65 74 rootx .]. set
1e330 20 72 79 20 5b 77 69 6e 66 6f 20 72 6f 6f 74 79 ry [winfo rooty
1e340 20 2e 5d 0a 20 20 20 20 73 65 74 20 70 78 20 5b .]. set px [
1e350 77 69 6e 66 6f 20 77 69 64 74 68 20 2e 5d 0a 20 winfo width .].
1e360 20 20 20 73 65 74 20 70 79 20 5b 77 69 6e 66 6f set py [winfo
1e370 20 68 65 69 67 68 74 20 2e 5d 0a 20 20 20 20 23 height .]. #
1e380 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 72 78 debug-info " rx
1e390 20 24 72 78 20 20 72 79 20 24 72 79 20 20 70 78 $rx ry $ry px
1e3a0 20 24 70 78 20 20 70 79 20 24 70 79 22 0a 20 20 $px py $py".
1e3b0 20 20 73 65 74 20 78 20 5b 65 78 70 72 20 7b 24 set x [expr {$
1e3c0 72 78 20 2b 20 24 70 78 20 2f 20 34 7d 5d 0a 20 rx + $px / 4}].
1e3d0 20 20 20 73 65 74 20 79 20 5b 65 78 70 72 20 7b set y [expr {
1e3e0 24 72 79 20 2b 20 24 70 79 20 2f 20 32 7d 5d 0a $ry + $py / 2}].
1e3f0 20 20 20 20 77 6d 20 67 65 6f 6d 65 74 72 79 20 wm geometry
1e400 24 74 6f 70 20 22 2b 24 7b 78 7d 2b 24 79 22 0a $top "+${x}+$y".
1e410 0a 20 20 20 20 77 6d 20 67 72 6f 75 70 20 24 74 . wm group $t
1e420 6f 70 20 2e 0a 20 20 20 20 77 6d 20 74 69 74 6c op .. wm titl
1e430 65 20 24 74 6f 70 20 22 24 67 28 6e 61 6d 65 29 e $top "$g(name)
1e440 20 4d 65 72 67 65 20 50 72 65 76 69 65 77 22 0a Merge Preview".
1e450 0a 20 20 20 20 66 72 61 6d 65 20 24 74 6f 70 2e . frame $top.
1e460 66 72 61 6d 65 20 2d 62 64 20 31 20 2d 72 65 6c frame -bd 1 -rel
1e470 69 65 66 20 73 75 6e 6b 65 6e 0a 20 20 20 20 70 ief sunken. p
1e480 61 63 6b 20 24 74 6f 70 2e 66 72 61 6d 65 20 2d ack $top.frame -
1e490 73 69 64 65 20 74 6f 70 20 2d 66 69 6c 6c 20 62 side top -fill b
1e4a0 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 20 2d 70 oth -expand y -p
1e4b0 61 64 78 20 31 30 20 2d 70 61 64 79 20 31 30 0a adx 10 -pady 10.
1e4c0 0a 20 20 20 20 73 65 74 20 77 28 6d 65 72 67 65 . set w(merge
1e4d0 54 65 78 74 29 20 24 74 6f 70 2e 66 72 61 6d 65 Text) $top.frame
1e4e0 2e 74 65 78 74 0a 20 20 20 20 73 65 74 20 77 28 .text. set w(
1e4f0 6d 65 72 67 65 56 53 42 29 20 24 74 6f 70 2e 66 mergeVSB) $top.f
1e500 72 61 6d 65 2e 76 73 62 0a 20 20 20 20 73 65 74 rame.vsb. set
1e510 20 77 28 6d 65 72 67 65 48 53 42 29 20 24 74 6f w(mergeHSB) $to
1e520 70 2e 66 72 61 6d 65 2e 68 73 62 0a 20 20 20 20 p.frame.hsb.
1e530 73 65 74 20 77 28 6d 65 72 67 65 44 69 73 6d 69 set w(mergeDismi
1e540 73 73 29 20 24 74 6f 70 2e 64 69 73 6d 69 73 73 ss) $top.dismiss
1e550 0a 20 20 20 20 73 65 74 20 77 28 6d 65 72 67 65 . set w(merge
1e560 57 72 69 74 65 29 20 24 74 6f 70 2e 6d 65 72 67 Write) $top.merg
1e570 65 57 72 69 74 65 0a 20 20 20 20 73 65 74 20 77 eWrite. set w
1e580 28 6d 65 72 67 65 57 72 69 74 65 41 6e 64 45 78 (mergeWriteAndEx
1e590 69 74 29 20 24 74 6f 70 2e 6d 65 72 67 65 57 72 it) $top.mergeWr
1e5a0 69 74 65 41 6e 64 45 78 69 74 0a 20 20 20 20 73 iteAndExit. s
1e5b0 65 74 20 77 28 6d 65 72 67 65 45 78 69 74 29 20 et w(mergeExit)
1e5c0 24 74 6f 70 2e 6d 65 72 67 65 45 78 69 74 0a 20 $top.mergeExit.
1e5d0 20 20 20 73 65 74 20 77 28 6d 65 72 67 65 52 65 set w(mergeRe
1e5e0 63 65 6e 74 65 72 29 20 24 74 6f 70 2e 6d 65 72 center) $top.mer
1e5f0 67 65 52 65 63 65 6e 74 65 72 0a 0a 20 20 20 20 geRecenter..
1e600 23 20 57 69 6e 64 6f 77 20 61 6e 64 20 73 63 72 # Window and scr
1e610 6f 6c 6c 62 61 72 73 0a 20 20 20 20 73 63 72 6f ollbars. scro
1e620 6c 6c 62 61 72 20 24 77 28 6d 65 72 67 65 48 53 llbar $w(mergeHS
1e630 42 29 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a B) -orient horiz
1e640 6f 6e 74 61 6c 20 2d 63 6f 6d 6d 61 6e 64 20 5b ontal -command [
1e650 6c 69 73 74 20 24 77 28 6d 65 72 67 65 54 65 78 list $w(mergeTex
1e660 74 29 20 5c 0a 20 20 20 20 20 20 78 76 69 65 77 t) \. xview
1e670 5d 0a 20 20 20 20 73 63 72 6f 6c 6c 62 61 72 20 ]. scrollbar
1e680 24 77 28 6d 65 72 67 65 56 53 42 29 20 2d 6f 72 $w(mergeVSB) -or
1e690 69 65 6e 74 20 76 65 72 74 69 63 61 6c 20 2d 63 ient vertical -c
1e6a0 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 24 77 28 ommand [list $w(
1e6b0 6d 65 72 67 65 54 65 78 74 29 20 79 76 69 65 77 mergeText) yview
1e6c0 5d 0a 0a 20 20 20 20 74 65 78 74 20 24 77 28 6d ].. text $w(m
1e6d0 65 72 67 65 54 65 78 74 29 20 2d 62 64 20 30 20 ergeText) -bd 0
1e6e0 2d 74 61 6b 65 66 6f 63 75 73 20 31 20 2d 79 73 -takefocus 1 -ys
1e6f0 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 5b 6c 69 crollcommand [li
1e700 73 74 20 24 77 28 6d 65 72 67 65 56 53 42 29 20 st $w(mergeVSB)
1e710 5c 0a 20 20 20 20 20 20 73 65 74 5d 20 2d 78 73 \. set] -xs
1e720 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 5b 6c 69 crollcommand [li
1e730 73 74 20 24 77 28 6d 65 72 67 65 48 53 42 29 20 st $w(mergeHSB)
1e740 73 65 74 5d 0a 0a 20 20 20 20 67 72 69 64 20 24 set].. grid $
1e750 77 28 6d 65 72 67 65 54 65 78 74 29 20 2d 72 6f w(mergeText) -ro
1e760 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 w 0 -column 0 -s
1e770 74 69 63 6b 79 20 6e 73 65 77 0a 20 20 20 20 67 ticky nsew. g
1e780 72 69 64 20 24 77 28 6d 65 72 67 65 56 53 42 29 rid $w(mergeVSB)
1e790 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 -row 0 -column
1e7a0 31 20 2d 73 74 69 63 6b 79 20 6e 73 0a 20 20 20 1 -sticky ns.
1e7b0 20 67 72 69 64 20 24 77 28 6d 65 72 67 65 48 53 grid $w(mergeHS
1e7c0 42 29 20 2d 72 6f 77 20 31 20 2d 63 6f 6c 75 6d B) -row 1 -colum
1e7d0 6e 20 30 20 2d 73 74 69 63 6b 79 20 65 77 0a 0a n 0 -sticky ew..
1e7e0 20 20 20 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 grid rowconf
1e7f0 69 67 75 72 65 20 24 74 6f 70 2e 66 72 61 6d 65 igure $top.frame
1e800 20 30 20 2d 77 65 69 67 68 74 20 31 0a 20 20 20 0 -weight 1.
1e810 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 grid rowconfigu
1e820 72 65 20 24 74 6f 70 2e 66 72 61 6d 65 20 31 20 re $top.frame 1
1e830 2d 77 65 69 67 68 74 20 30 0a 0a 20 20 20 20 67 -weight 0.. g
1e840 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
1e850 75 72 65 20 24 74 6f 70 2e 66 72 61 6d 65 20 30 ure $top.frame 0
1e860 20 2d 77 65 69 67 68 74 20 31 0a 20 20 20 20 67 -weight 1. g
1e870 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 rid columnconfig
1e880 75 72 65 20 24 74 6f 70 2e 66 72 61 6d 65 20 31 ure $top.frame 1
1e890 20 2d 77 65 69 67 68 74 20 30 0a 0a 20 20 20 20 -weight 0..
1e8a0 23 20 62 75 74 74 6f 6e 73 0a 20 20 20 20 62 75 # buttons. bu
1e8b0 74 74 6f 6e 20 24 77 28 6d 65 72 67 65 52 65 63 tton $w(mergeRec
1e8c0 65 6e 74 65 72 29 20 2d 77 69 64 74 68 20 38 20 enter) -width 8
1e8d0 2d 74 65 78 74 20 22 52 65 43 65 6e 74 65 72 22 -text "ReCenter"
1e8e0 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 5c 0a -underline 0 \.
1e8f0 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 6d -command m
1e900 65 72 67 65 2d 63 65 6e 74 65 72 0a 0a 20 20 20 erge-center..
1e910 20 62 75 74 74 6f 6e 20 24 77 28 6d 65 72 67 65 button $w(merge
1e920 44 69 73 6d 69 73 73 29 20 2d 77 69 64 74 68 20 Dismiss) -width
1e930 38 20 2d 74 65 78 74 20 22 44 69 73 6d 69 73 73 8 -text "Dismiss
1e940 22 20 2d 75 6e 64 65 72 6c 69 6e 65 20 30 20 5c " -underline 0 \
1e950 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 . -command
1e960 22 64 6f 2d 73 68 6f 77 2d 6d 65 72 67 65 20 30 "do-show-merge 0
1e970 22 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 6d 65 ".. if {$g(me
1e980 72 67 65 66 69 6c 65 73 65 74 29 7d 20 7b 0a 09 rgefileset)} {..
1e990 62 75 74 74 6f 6e 20 24 77 28 6d 65 72 67 65 57 button $w(mergeW
1e9a0 72 69 74 65 29 20 2d 77 69 64 74 68 20 38 20 2d rite) -width 8 -
1e9b0 74 65 78 74 20 22 53 61 76 65 22 20 2d 75 6e 64 text "Save" -und
1e9c0 65 72 6c 69 6e 65 20 30 20 5c 0a 09 20 20 2d 63 erline 0 \.. -c
1e9d0 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 70 6f 70 ommand [list pop
1e9e0 75 70 2d 6d 65 72 67 65 20 6d 65 72 67 65 2d 77 up-merge merge-w
1e9f0 72 69 74 65 2d 66 69 6c 65 5d 0a 09 62 75 74 74 rite-file]..butt
1ea00 6f 6e 20 24 77 28 6d 65 72 67 65 57 72 69 74 65 on $w(mergeWrite
1ea10 41 6e 64 45 78 69 74 29 20 2d 77 69 64 74 68 20 AndExit) -width
1ea20 38 20 2d 74 65 78 74 20 22 53 61 76 65 20 26 20 8 -text "Save &
1ea30 45 78 69 74 22 20 5c 0a 09 20 20 2d 75 6e 64 65 Exit" \.. -unde
1ea40 72 6c 69 6e 65 20 38 20 2d 63 6f 6d 6d 61 6e 64 rline 8 -command
1ea50 20 7b 0a 09 20 20 20 20 70 6f 70 75 70 2d 6d 65 {.. popup-me
1ea60 72 67 65 20 6d 65 72 67 65 2d 77 72 69 74 65 2d rge merge-write-
1ea70 66 69 6c 65 0a 09 20 20 20 20 65 78 69 74 0a 09 file.. exit..
1ea80 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 }. } else {..
1ea90 62 75 74 74 6f 6e 20 24 77 28 6d 65 72 67 65 57 button $w(mergeW
1eaa0 72 69 74 65 29 20 2d 77 69 64 74 68 20 38 20 2d rite) -width 8 -
1eab0 74 65 78 74 20 22 53 61 76 65 2e 2e 2e 22 20 2d text "Save..." -
1eac0 75 6e 64 65 72 6c 69 6e 65 20 30 20 5c 0a 09 20 underline 0 \..
1ead0 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
1eae0 70 6f 70 75 70 2d 6d 65 72 67 65 20 6d 65 72 67 popup-merge merg
1eaf0 65 2d 77 72 69 74 65 2d 66 69 6c 65 5d 0a 09 62 e-write-file]..b
1eb00 75 74 74 6f 6e 20 24 77 28 6d 65 72 67 65 57 72 utton $w(mergeWr
1eb10 69 74 65 41 6e 64 45 78 69 74 29 20 2d 77 69 64 iteAndExit) -wid
1eb20 74 68 20 31 30 20 2d 74 65 78 74 20 22 53 61 76 th 10 -text "Sav
1eb30 65 20 26 20 45 78 69 74 2e 2e 2e 22 20 5c 0a 09 e & Exit..." \..
1eb40 20 20 2d 75 6e 64 65 72 6c 69 6e 65 20 38 20 2d -underline 8 -
1eb50 63 6f 6d 6d 61 6e 64 20 7b 0a 09 20 20 20 20 70 command {.. p
1eb60 6f 70 75 70 2d 6d 65 72 67 65 20 6d 65 72 67 65 opup-merge merge
1eb70 2d 77 72 69 74 65 2d 66 69 6c 65 0a 09 20 20 20 -write-file..
1eb80 20 65 78 69 74 0a 09 7d 0a 20 20 20 20 7d 0a 20 exit..}. }.
1eb90 20 20 20 62 75 74 74 6f 6e 20 24 77 28 6d 65 72 button $w(mer
1eba0 67 65 45 78 69 74 29 20 2d 77 69 64 74 68 20 38 geExit) -width 8
1ebb0 20 2d 74 65 78 74 20 22 45 78 69 74 20 24 67 28 -text "Exit $g(
1ebc0 6e 61 6d 65 29 22 20 2d 75 6e 64 65 72 6c 69 6e name)" -underlin
1ebd0 65 20 30 20 5c 0a 20 20 20 20 20 20 2d 63 6f 6d e 0 \. -com
1ebe0 6d 61 6e 64 20 7b 65 78 69 74 7d 0a 0a 20 20 20 mand {exit}..
1ebf0 20 70 61 63 6b 20 24 77 28 6d 65 72 67 65 44 69 pack $w(mergeDi
1ec00 73 6d 69 73 73 29 20 2d 73 69 64 65 20 72 69 67 smiss) -side rig
1ec10 68 74 20 2d 70 61 64 79 20 35 20 2d 70 61 64 78 ht -pady 5 -padx
1ec20 20 31 30 0a 20 20 20 20 70 61 63 6b 20 24 77 28 10. pack $w(
1ec30 6d 65 72 67 65 52 65 63 65 6e 74 65 72 29 20 2d mergeRecenter) -
1ec40 73 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 79 side right -pady
1ec50 20 35 20 2d 70 61 64 78 20 31 0a 20 20 20 20 70 5 -padx 1. p
1ec60 61 63 6b 20 24 77 28 6d 65 72 67 65 57 72 69 74 ack $w(mergeWrit
1ec70 65 29 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d e) -side right -
1ec80 70 61 64 79 20 35 20 2d 70 61 64 78 20 31 0a 20 pady 5 -padx 1.
1ec90 20 20 20 70 61 63 6b 20 24 77 28 6d 65 72 67 65 pack $w(merge
1eca0 57 72 69 74 65 41 6e 64 45 78 69 74 29 20 2d 73 WriteAndExit) -s
1ecb0 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 79 20 ide right -pady
1ecc0 35 20 2d 70 61 64 78 20 31 0a 20 20 20 20 70 61 5 -padx 1. pa
1ecd0 63 6b 20 24 77 28 6d 65 72 67 65 45 78 69 74 29 ck $w(mergeExit)
1ece0 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d 70 61 -side right -pa
1ecf0 64 79 20 35 20 2d 70 61 64 78 20 31 0a 0a 20 20 dy 5 -padx 1..
1ed00 20 20 65 76 61 6c 20 24 77 28 6d 65 72 67 65 54 eval $w(mergeT
1ed10 65 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 24 ext) configure $
1ed20 6f 70 74 73 28 74 65 78 74 6f 70 74 29 0a 20 20 opts(textopt).
1ed30 20 20 66 6f 72 65 61 63 68 20 74 61 67 20 7b 64 foreach tag {d
1ed40 69 66 66 74 61 67 20 63 75 72 72 74 61 67 7d 20 ifftag currtag}
1ed50 7b 0a 09 65 76 61 6c 20 24 77 28 6d 65 72 67 65 {..eval $w(merge
1ed60 54 65 78 74 29 20 74 61 67 20 63 6f 6e 66 69 67 Text) tag config
1ed70 75 72 65 20 24 74 61 67 20 24 6f 70 74 73 28 24 ure $tag $opts($
1ed80 74 61 67 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 tag). }..
1ed90 23 20 61 64 6a 75 73 74 20 74 68 65 20 74 61 62 # adjust the tab
1eda0 73 74 6f 70 73 0a 20 20 20 20 73 65 74 20 63 77 stops. set cw
1edb0 69 64 74 68 20 5b 66 6f 6e 74 20 6d 65 61 73 75 idth [font measu
1edc0 72 65 20 5b 24 77 28 6d 65 72 67 65 54 65 78 74 re [$w(mergeText
1edd0 29 20 63 67 65 74 20 2d 66 6f 6e 74 5d 20 22 6d ) cget -font] "m
1ede0 22 5d 0a 20 20 20 20 73 65 74 20 74 61 62 73 74 "]. set tabst
1edf0 6f 70 73 20 5b 65 78 70 72 20 7b 24 63 77 69 64 ops [expr {$cwid
1ee00 74 68 20 2a 20 24 6f 70 74 73 28 74 61 62 73 74 th * $opts(tabst
1ee10 6f 70 73 29 7d 5d 0a 20 20 20 20 24 77 28 6d 65 ops)}]. $w(me
1ee20 72 67 65 54 65 78 74 29 20 63 6f 6e 66 69 67 75 rgeText) configu
1ee30 72 65 20 2d 74 61 62 73 20 24 74 61 62 73 74 6f re -tabs $tabsto
1ee40 70 73 0a 0a 20 20 20 20 77 6d 20 70 72 6f 74 6f ps.. wm proto
1ee50 63 6f 6c 20 24 77 28 6d 65 72 67 65 29 20 57 4d col $w(merge) WM
1ee60 5f 44 45 4c 45 54 45 5f 57 49 4e 44 4f 57 20 7b _DELETE_WINDOW {
1ee70 64 6f 2d 73 68 6f 77 2d 6d 65 72 67 65 20 30 7d do-show-merge 0}
1ee80 0a 0a 20 20 20 20 23 20 61 64 6a 75 73 74 20 74 .. # adjust t
1ee90 68 65 20 74 61 67 20 70 72 69 6f 72 69 74 69 65 he tag prioritie
1eea0 73 20 61 20 62 69 74 2e 2e 2e 0a 20 20 20 20 24 s a bit.... $
1eeb0 77 28 6d 65 72 67 65 54 65 78 74 29 20 74 61 67 w(mergeText) tag
1eec0 20 72 61 69 73 65 20 73 65 6c 0a 20 20 20 20 24 raise sel. $
1eed0 77 28 6d 65 72 67 65 54 65 78 74 29 20 74 61 67 w(mergeText) tag
1eee0 20 72 61 69 73 65 20 63 75 72 72 74 61 67 20 64 raise currtag d
1eef0 69 66 66 74 61 67 0a 0a 20 20 20 20 63 6f 6d 6d ifftag.. comm
1ef00 6f 6e 2d 6e 61 76 69 67 61 74 69 6f 6e 20 24 77 on-navigation $w
1ef10 28 6d 65 72 67 65 54 65 78 74 29 0a 0a 20 20 20 (mergeText)..
1ef20 20 69 66 20 7b 21 20 24 67 28 73 68 6f 77 6d 65 if {! $g(showme
1ef30 72 67 65 29 7d 20 7b 0a 09 77 6d 20 77 69 74 68 rge)} {..wm with
1ef40 64 72 61 77 20 24 77 28 6d 65 72 67 65 29 0a 20 draw $w(merge).
1ef50 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 }.}..########
1ef60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ef70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ef80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ef90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1efa0 23 23 23 23 23 23 23 0a 23 20 52 65 61 64 20 6f #######.# Read o
1efb0 72 69 67 69 6e 61 6c 20 66 69 6c 65 20 28 4c 65 riginal file (Le
1efc0 66 74 20 77 69 6e 64 6f 77 20 66 69 6c 65 29 20 ft window file)
1efd0 69 6e 74 6f 20 6d 65 72 67 65 20 70 72 65 76 69 into merge previ
1efe0 65 77 20 77 69 6e 64 6f 77 2e 0a 23 20 4e 6f 74 ew window..# Not
1eff0 20 73 6f 20 67 6f 6f 64 20 69 66 20 69 74 20 68 so good if it h
1f000 61 73 20 63 68 61 6e 67 65 64 2e 0a 23 23 23 23 as changed..####
1f010 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f020 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f030 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f040 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f050 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
1f060 20 6d 65 72 67 65 2d 72 65 61 64 2d 66 69 6c 65 merge-read-file
1f070 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d {} {. debug-
1f080 69 6e 66 6f 20 22 6d 65 72 67 65 2d 72 65 61 64 info "merge-read
1f090 2d 66 69 6c 65 22 0a 20 20 20 20 67 6c 6f 62 61 -file". globa
1f0a0 6c 20 66 69 6e 66 6f 0a 20 20 20 20 67 6c 6f 62 l finfo. glob
1f0b0 61 6c 20 77 0a 0a 20 20 20 20 23 20 68 61 63 6b al w.. # hack
1f0c0 3b 20 6e 65 65 64 20 74 6f 20 66 69 6e 64 20 61 ; need to find a
1f0d0 20 63 6c 65 61 6e 65 72 20 77 61 79 2e 2e 2e 0a cleaner way....
1f0e0 20 20 20 20 63 61 74 63 68 20 7b 64 65 73 74 72 catch {destr
1f0f0 6f 79 20 2e 6d 65 72 67 65 7d 0a 20 20 20 20 6d oy .merge}. m
1f100 65 72 67 65 2d 63 72 65 61 74 65 2d 77 69 6e 64 erge-create-wind
1f110 6f 77 0a 0a 20 20 20 20 73 65 74 20 68 6e 64 6c ow.. set hndl
1f120 20 5b 6f 70 65 6e 20 22 24 66 69 6e 66 6f 28 70 [open "$finfo(p
1f130 74 68 2c 31 29 22 20 72 5d 0a 20 20 20 20 24 77 th,1)" r]. $w
1f140 28 6d 65 72 67 65 54 65 78 74 29 20 63 6f 6e 66 (mergeText) conf
1f150 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 igure -state nor
1f160 6d 61 6c 0a 20 20 20 20 24 77 28 6d 65 72 67 65 mal. $w(merge
1f170 54 65 78 74 29 20 64 65 6c 65 74 65 20 31 2e 30 Text) delete 1.0
1f180 20 65 6e 64 0a 20 20 20 20 24 77 28 6d 65 72 67 end. $w(merg
1f190 65 54 65 78 74 29 20 69 6e 73 65 72 74 20 31 2e eText) insert 1.
1f1a0 30 20 5b 72 65 61 64 20 24 68 6e 64 6c 5d 0a 20 0 [read $hndl].
1f1b0 20 20 20 63 6c 6f 73 65 20 24 68 6e 64 6c 0a 0a close $hndl..
1f1c0 20 20 20 20 23 20 49 66 20 6c 61 73 74 20 6c 69 # If last li
1f1d0 6e 65 20 64 6f 65 73 6e 27 74 20 65 6e 64 20 77 ne doesn't end w
1f1e0 69 74 68 20 61 20 6e 65 77 6c 69 6e 65 2c 20 61 ith a newline, a
1f1f0 64 64 20 6f 6e 65 2e 20 49 6d 70 6f 72 74 61 6e dd one. Importan
1f200 74 20 77 68 65 6e 0a 20 20 20 20 23 20 77 72 69 t when. # wri
1f210 74 69 6e 67 20 6f 75 74 20 74 68 65 20 6d 65 72 ting out the mer
1f220 67 65 20 70 72 65 76 69 65 77 2e 0a 20 20 20 20 ge preview..
1f230 69 66 20 7b 21 5b 72 65 67 65 78 70 20 7b 5c 2e if {![regexp {\.
1f240 30 24 7d 20 5b 24 77 28 6d 65 72 67 65 54 65 78 0$} [$w(mergeTex
1f250 74 29 20 69 6e 64 65 78 20 22 65 6e 64 2d 31 6c t) index "end-1l
1f260 69 6e 65 73 20 6c 69 6e 65 65 6e 64 22 5d 5d 7d ines lineend"]]}
1f270 20 7b 0a 09 24 77 28 6d 65 72 67 65 54 65 78 74 {..$w(mergeText
1f280 29 20 69 6e 73 65 72 74 20 65 6e 64 20 22 5c 6e ) insert end "\n
1f290 22 0a 20 20 20 20 7d 0a 20 20 20 20 24 77 28 6d ". }. $w(m
1f2a0 65 72 67 65 54 65 78 74 29 20 63 6f 6e 66 69 67 ergeText) config
1f2b0 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 61 62 ure -state disab
1f2c0 6c 65 64 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 led.}..#########
1f2d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f2e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f2f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f300 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f310 23 23 23 23 23 23 0a 23 20 57 72 69 74 65 20 6d ######.# Write m
1f320 65 72 67 65 20 70 72 65 76 69 65 77 20 74 6f 20 erge preview to
1f330 66 69 6c 65 0a 23 23 23 23 23 23 23 23 23 23 23 file.###########
1f340 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f350 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f360 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f370 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f380 23 23 23 23 0a 70 72 6f 63 20 6d 65 72 67 65 2d ####.proc merge-
1f390 77 72 69 74 65 2d 66 69 6c 65 20 7b 7d 20 7b 0a write-file {} {.
1f3a0 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 global g.
1f3b0 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 73 global w.. s
1f3c0 65 74 20 68 6e 64 6c 20 5b 6f 70 65 6e 20 22 24 et hndl [open "$
1f3d0 67 28 6d 65 72 67 65 66 69 6c 65 29 22 20 77 5d g(mergefile)" w]
1f3e0 0a 20 20 20 20 73 65 74 20 74 65 78 74 20 5b 24 . set text [$
1f3f0 77 28 6d 65 72 67 65 54 65 78 74 29 20 67 65 74 w(mergeText) get
1f400 20 31 2e 30 20 65 6e 64 2d 31 6c 69 6e 65 73 5d 1.0 end-1lines]
1f410 0a 20 20 20 20 70 75 74 73 20 2d 6e 6f 6e 65 77 . puts -nonew
1f420 6c 69 6e 65 20 24 68 6e 64 6c 20 24 74 65 78 74 line $hndl $text
1f430 0a 20 20 20 20 63 6c 6f 73 65 20 24 68 6e 64 6c . close $hndl
1f440 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 .}..############
1f450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f460 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f470 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f480 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f490 23 23 23 0a 23 20 41 64 64 20 61 20 6d 61 72 6b ###.# Add a mark
1f4a0 20 77 68 65 72 65 20 65 61 63 68 20 64 69 66 66 where each diff
1f4b0 20 62 65 67 69 6e 73 20 61 6e 64 20 74 61 67 20 begins and tag
1f4c0 64 69 66 66 20 72 65 67 69 6f 6e 73 20 73 6f 20 diff regions so
1f4d0 74 68 65 79 20 61 72 65 20 76 69 73 69 62 6c 65 they are visible
1f4e0 2e 0a 23 20 41 73 73 75 6d 65 73 20 74 65 78 74 ..# Assumes text
1f4f0 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 74 68 is initially th
1f500 65 20 62 61 72 65 20 6f 72 69 67 69 6e 61 6c 20 e bare original
1f510 28 4c 65 66 74 29 20 76 65 72 73 69 6f 6e 2e 0a (Left) version..
1f520 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f530 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f540 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f550 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f560 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
1f570 70 72 6f 63 20 6d 65 72 67 65 2d 61 64 64 2d 6d proc merge-add-m
1f580 61 72 6b 73 20 7b 7d 20 7b 0a 20 20 20 20 67 6c arks {} {. gl
1f590 6f 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 obal g. globa
1f5a0 6c 20 77 0a 0a 20 20 20 20 23 20 6d 61 72 6b 20 l w.. # mark
1f5b0 61 6c 6c 20 6c 69 6e 65 73 20 66 69 72 73 74 2c all lines first,
1f5c0 20 73 6f 20 73 65 6c 65 63 74 69 6f 6e 20 77 6f so selection wo
1f5d0 6e 27 74 20 6d 65 73 73 20 75 70 20 6c 69 6e 65 n't mess up line
1f5e0 20 6e 75 6d 62 65 72 73 0a 20 20 20 20 66 6f 72 numbers. for
1f5f0 20 7b 73 65 74 20 69 20 31 7d 20 7b 24 69 20 3c {set i 1} {$i <
1f600 3d 20 24 67 28 63 6f 75 6e 74 29 7d 20 7b 69 6e = $g(count)} {in
1f610 63 72 20 69 7d 20 7b 0a 09 66 6f 72 65 61 63 68 cr i} {..foreach
1f620 20 5b 6c 69 73 74 20 74 68 69 73 64 69 66 66 20 [list thisdiff
1f630 73 31 20 65 31 20 73 32 20 65 32 20 74 79 70 65 s1 e1 s2 e2 type
1f640 5d 20 24 67 28 70 64 69 66 66 2c 24 69 29 20 7b ] $g(pdiff,$i) {
1f650 20 7d 0a 09 23 20 20 20 20 20 20 20 20 73 65 74 }..# set
1f660 20 64 65 6c 74 61 20 5b 65 78 70 72 20 7b 24 74 delta [expr {$t
1f670 79 70 65 20 3d 3d 20 22 61 22 20 3f 20 31 20 3a ype == "a" ? 1 :
1f680 20 30 7d 5d 0a 09 23 20 20 20 20 20 20 20 20 24 0}]..# $
1f690 77 28 6d 65 72 67 65 54 65 78 74 29 20 6d 61 72 w(mergeText) mar
1f6a0 6b 20 73 65 74 20 6d 61 72 6b 24 69 20 24 73 31 k set mark$i $s1
1f6b0 2e 30 2b 24 7b 64 65 6c 74 61 7d 6c 69 6e 65 73 .0+${delta}lines
1f6c0 0a 09 69 66 20 7b 24 74 79 70 65 20 3d 3d 20 22 ..if {$type == "
1f6d0 61 22 7d 20 7b 0a 09 20 20 20 20 69 6e 63 72 20 a"} {.. incr
1f6e0 73 31 0a 09 7d 0a 09 24 77 28 6d 65 72 67 65 54 s1..}..$w(mergeT
1f6f0 65 78 74 29 20 6d 61 72 6b 20 73 65 74 20 6d 61 ext) mark set ma
1f700 72 6b 24 69 20 24 73 31 2e 30 0a 09 24 77 28 6d rk$i $s1.0..$w(m
1f710 65 72 67 65 54 65 78 74 29 20 6d 61 72 6b 20 67 ergeText) mark g
1f720 72 61 76 69 74 79 20 6d 61 72 6b 24 69 20 6c 65 ravity mark$i le
1f730 66 74 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 ft. }.. #
1f740 69 66 20 61 20 33 2d 77 61 79 20 6d 65 72 67 65 if a 3-way merge
1f750 2c 20 73 65 6c 65 63 74 20 72 69 67 68 74 20 77 , select right w
1f760 69 6e 64 6f 77 20 61 73 20 6e 65 65 64 65 64 0a indow as needed.
1f770 20 20 20 20 69 66 20 7b 24 67 28 61 6e 63 66 69 if {$g(ancfi
1f780 6c 65 73 65 74 29 20 26 26 20 24 67 28 63 6f 75 leset) && $g(cou
1f790 6e 74 29 20 3e 20 30 7d 20 7b 0a 09 23 0a 09 23 nt) > 0} {..#..#
1f7a0 20 49 66 20 74 68 65 72 65 20 77 61 73 20 73 6f If there was so
1f7b0 6d 65 74 68 69 6e 67 20 64 69 66 66 65 72 65 6e mething differen
1f7c0 74 20 62 65 74 77 65 65 6e 20 66 69 6c 65 31 0a t between file1.
1f7d0 09 23 20 61 6e 64 20 74 68 65 20 61 6e 63 65 73 .# and the ances
1f7e0 74 6f 72 2c 20 70 69 63 6b 20 74 68 65 20 6c 65 tor, pick the le
1f7f0 66 74 20 77 69 6e 64 6f 77 2c 20 62 75 74 2e 2e ft window, but..
1f800 2e 0a 09 23 0a 09 66 6f 72 20 7b 73 65 74 20 69 ...#..for {set i
1f810 20 31 7d 20 7b 24 69 20 3c 3d 20 24 67 28 63 6f 1} {$i <= $g(co
1f820 75 6e 74 29 7d 20 7b 69 6e 63 72 20 69 7d 20 7b unt)} {incr i} {
1f830 0a 09 20 20 20 20 73 65 74 20 73 31 20 5b 6c 69 .. set s1 [li
1f840 6e 64 65 78 20 24 67 28 70 64 69 66 66 2c 24 69 ndex $g(pdiff,$i
1f850 29 20 31 5d 0a 09 20 20 20 20 73 65 74 20 73 32 ) 1].. set s2
1f860 20 5b 6c 69 6e 64 65 78 20 24 67 28 70 64 69 66 [lindex $g(pdif
1f870 66 2c 24 69 29 20 32 5d 0a 09 20 20 20 20 66 6f f,$i) 2].. fo
1f880 72 20 7b 73 65 74 20 70 20 24 73 31 7d 20 7b 24 r {set p $s1} {$
1f890 70 20 3c 3d 20 24 73 32 7d 20 7b 69 6e 63 72 20 p <= $s2} {incr
1f8a0 70 7d 20 7b 0a 09 09 69 66 20 7b 5b 69 6e 66 6f p} {...if {[info
1f8b0 20 65 78 69 73 74 73 20 67 28 64 69 66 66 33 6c exists g(diff3l
1f8c0 24 70 29 5d 7d 20 7b 0a 09 09 20 20 20 20 73 65 $p)]} {... se
1f8d0 74 20 67 28 6d 65 72 67 65 24 69 29 20 31 0a 09 t g(merge$i) 1..
1f8e0 09 20 20 20 20 62 72 65 61 6b 0a 09 09 7d 0a 09 . break...}..
1f8f0 20 20 20 20 7d 0a 09 7d 0a 0a 09 23 0a 09 23 20 }..}...#..#
1f900 2e 2e 2e 20 69 66 20 74 68 65 72 65 20 77 61 73 ... if there was
1f910 20 61 20 64 69 66 66 20 62 65 74 77 65 65 6e 20 a diff between
1f920 66 69 6c 65 32 20 61 6e 64 20 74 68 65 20 61 6e file2 and the an
1f930 63 65 73 74 6f 72 2c 0a 09 23 20 74 68 65 6e 20 cestor,..# then
1f940 66 69 6c 65 32 20 74 61 6b 65 73 20 70 72 65 63 file2 takes prec
1f950 65 64 65 6e 63 65 0a 09 23 0a 09 66 6f 72 20 7b edence..#..for {
1f960 73 65 74 20 69 20 31 7d 20 7b 24 69 20 3c 3d 20 set i 1} {$i <=
1f970 24 67 28 63 6f 75 6e 74 29 7d 20 7b 69 6e 63 72 $g(count)} {incr
1f980 20 69 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 73 i} {.. set s
1f990 31 20 5b 6c 69 6e 64 65 78 20 24 67 28 70 64 69 1 [lindex $g(pdi
1f9a0 66 66 2c 24 69 29 20 33 5d 0a 09 20 20 20 20 73 ff,$i) 3].. s
1f9b0 65 74 20 73 32 20 5b 6c 69 6e 64 65 78 20 24 67 et s2 [lindex $g
1f9c0 28 70 64 69 66 66 2c 24 69 29 20 34 5d 0a 09 20 (pdiff,$i) 4]..
1f9d0 20 20 20 66 6f 72 20 7b 73 65 74 20 70 20 24 73 for {set p $s
1f9e0 31 7d 20 7b 24 70 20 3c 3d 20 24 73 32 7d 20 7b 1} {$p <= $s2} {
1f9f0 69 6e 63 72 20 70 7d 20 7b 0a 09 09 69 66 20 7b incr p} {...if {
1fa00 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 67 28 64 [info exists g(d
1fa10 69 66 66 33 72 24 70 29 5d 7d 20 7b 0a 09 09 20 iff3r$p)]} {...
1fa20 20 20 20 73 65 74 20 67 28 6d 65 72 67 65 24 69 set g(merge$i
1fa30 29 20 32 0a 09 09 20 20 20 20 62 72 65 61 6b 0a ) 2... break.
1fa40 09 09 7d 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 ..}.. }..}.
1fa50 20 20 7d 0a 0a 20 20 20 20 23 20 73 65 6c 65 63 }.. # selec
1fa60 74 20 6d 65 72 67 65 64 20 6c 69 6e 65 73 0a 20 t merged lines.
1fa70 20 20 20 66 6f 72 20 7b 73 65 74 20 69 20 31 7d for {set i 1}
1fa80 20 7b 24 69 20 3c 3d 20 24 67 28 63 6f 75 6e 74 {$i <= $g(count
1fa90 29 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 66 )} {incr i} {..f
1faa0 6f 72 65 61 63 68 20 5b 6c 69 73 74 20 74 68 69 oreach [list thi
1fab0 73 64 69 66 66 20 73 31 20 65 31 20 73 32 20 65 sdiff s1 e1 s2 e
1fac0 32 20 74 79 70 65 5d 20 24 67 28 70 64 69 66 66 2 type] $g(pdiff
1fad0 2c 24 69 29 20 7b 20 7d 0a 0a 09 69 66 20 7b 24 ,$i) { }...if {$
1fae0 67 28 6d 65 72 67 65 24 69 29 20 3d 3d 20 31 7d g(merge$i) == 1}
1faf0 20 7b 0a 09 20 20 20 20 23 20 28 49 66 20 69 74 {.. # (If it
1fb00 27 73 20 61 6e 20 69 6e 73 65 72 74 20 69 74 27 's an insert it'
1fb10 73 20 6e 6f 74 20 76 69 73 69 62 6c 65 29 0a 09 s not visible)..
1fb20 20 20 20 20 69 66 20 7b 24 74 79 70 65 20 21 3d if {$type !=
1fb30 20 22 61 22 7d 20 7b 0a 09 09 73 65 74 20 6c 69 "a"} {...set li
1fb40 6e 65 73 20 5b 65 78 70 72 20 7b 24 65 31 20 2d nes [expr {$e1 -
1fb50 20 24 73 31 20 2b 20 31 7d 5d 0a 09 09 24 77 28 $s1 + 1}]...$w(
1fb60 6d 65 72 67 65 54 65 78 74 29 20 74 61 67 20 61 mergeText) tag a
1fb70 64 64 20 64 69 66 66 74 61 67 20 6d 61 72 6b 24 dd difftag mark$
1fb80 69 20 6d 61 72 6b 24 69 2b 24 7b 6c 69 6e 65 73 i mark$i+${lines
1fb90 7d 6c 69 6e 65 73 0a 09 20 20 20 20 7d 0a 09 7d }lines.. }..}
1fba0 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 23 20 49 else {.. # I
1fbb0 6e 73 65 72 74 20 72 69 67 68 74 20 77 69 6e 64 nsert right wind
1fbc0 6f 77 20 76 65 72 73 69 6f 6e 0a 09 20 20 20 20 ow version..
1fbd0 6d 65 72 67 65 2d 73 65 6c 65 63 74 2d 76 65 72 merge-select-ver
1fbe0 73 69 6f 6e 20 24 69 20 31 20 32 0a 09 7d 0a 20 sion $i 1 2..}.
1fbf0 20 20 20 7d 0a 0a 20 20 20 20 23 20 54 61 67 20 }.. # Tag
1fc00 63 75 72 72 65 6e 74 0a 20 20 20 20 69 66 20 7b current. if {
1fc10 24 67 28 63 6f 75 6e 74 29 20 3e 20 30 7d 20 7b $g(count) > 0} {
1fc20 0a 09 73 65 74 20 70 6f 73 20 24 67 28 70 6f 73 ..set pos $g(pos
1fc30 29 0a 09 73 65 74 20 6c 69 6e 65 73 20 5b 64 69 )..set lines [di
1fc40 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 24 67 28 ff-size $pos $g(
1fc50 6d 65 72 67 65 24 70 6f 73 29 5d 0a 09 24 77 28 merge$pos)]..$w(
1fc60 6d 65 72 67 65 54 65 78 74 29 20 74 61 67 20 61 mergeText) tag a
1fc70 64 64 20 63 75 72 72 74 61 67 20 6d 61 72 6b 24 dd currtag mark$
1fc80 70 6f 73 20 22 6d 61 72 6b 24 70 6f 73 2b 24 7b pos "mark$pos+${
1fc90 6c 69 6e 65 73 7d 6c 69 6e 65 73 22 0a 20 20 20 lines}lines".
1fca0 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 }.}..##########
1fcb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fcc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fcd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fce0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fcf0 23 23 23 23 23 0a 23 20 41 64 64 20 61 20 6d 61 #####.# Add a ma
1fd00 72 6b 20 77 68 65 72 65 20 65 61 63 68 20 64 69 rk where each di
1fd10 66 66 20 62 65 67 69 6e 73 0a 23 20 70 6f 73 20 ff begins.# pos
1fd20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 di
1fd30 66 66 20 69 6e 64 65 78 0a 23 20 6f 6c 64 76 65 ff index.# oldve
1fd40 72 73 69 6f 6e 20 20 20 31 20 6f 72 20 32 2c 20 rsion 1 or 2,
1fd50 70 72 65 76 69 6f 75 73 20 6d 65 72 67 65 20 63 previous merge c
1fd60 68 6f 69 63 65 0a 23 20 6e 65 77 76 65 72 73 69 hoice.# newversi
1fd70 6f 6e 20 20 20 31 20 6f 72 20 32 2c 20 6e 65 77 on 1 or 2, new
1fd80 20 6d 65 72 67 65 20 63 68 6f 69 63 65 0a 23 23 merge choice.##
1fd90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fda0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fdb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fdc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1fdd0 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
1fde0 6f 63 20 6d 65 72 67 65 2d 73 65 6c 65 63 74 2d oc merge-select-
1fdf0 76 65 72 73 69 6f 6e 20 7b 70 6f 73 20 6f 6c 64 version {pos old
1fe00 76 65 72 73 69 6f 6e 20 6e 65 77 76 65 72 73 69 version newversi
1fe10 6f 6e 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c on} {. global
1fe20 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a g. global w.
1fe30 0a 20 20 20 20 63 61 74 63 68 20 7b 0a 09 73 77 . catch {..sw
1fe40 69 74 63 68 20 2d 2d 20 24 6f 6c 64 76 65 72 73 itch -- $oldvers
1fe50 69 6f 6e 20 7b 0a 09 31 20 2d 0a 09 32 20 7b 73 ion {..1 -..2 {s
1fe60 65 74 20 6f 6c 64 6c 69 6e 65 73 20 5b 64 69 66 et oldlines [dif
1fe70 66 2d 73 69 7a 65 20 24 70 6f 73 20 24 6f 6c 64 f-size $pos $old
1fe80 76 65 72 73 69 6f 6e 5d 7d 0a 09 31 32 20 2d 0a version]}..12 -.
1fe90 09 32 31 20 7b 73 65 74 20 6f 6c 64 6c 69 6e 65 .21 {set oldline
1fea0 73 20 5b 65 78 70 72 20 7b 5b 64 69 66 66 2d 73 s [expr {[diff-s
1feb0 69 7a 65 20 24 70 6f 73 20 31 5d 20 2b 20 5b 64 ize $pos 1] + [d
1fec0 69 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 32 5d iff-size $pos 2]
1fed0 7d 5d 7d 0a 09 7d 0a 09 24 77 28 6d 65 72 67 65 }]}..}..$w(merge
1fee0 54 65 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 Text) configure
1fef0 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 -state normal..$
1ff00 77 28 6d 65 72 67 65 54 65 78 74 29 20 64 65 6c w(mergeText) del
1ff10 65 74 65 20 6d 61 72 6b 24 70 6f 73 20 22 6d 61 ete mark$pos "ma
1ff20 72 6b 24 7b 70 6f 73 7d 2b 24 7b 6f 6c 64 6c 69 rk${pos}+${oldli
1ff30 6e 65 73 7d 6c 69 6e 65 73 22 0a 09 24 77 28 6d nes}lines"..$w(m
1ff40 65 72 67 65 54 65 78 74 29 20 63 6f 6e 66 69 67 ergeText) config
1ff50 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 61 62 ure -state disab
1ff60 6c 65 64 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 led. }.. #
1ff70 20 53 63 72 65 65 6e 20 63 6f 6f 72 64 69 6e 61 Screen coordina
1ff80 74 65 73 0a 20 20 20 20 66 6f 72 65 61 63 68 20 tes. foreach
1ff90 7b 74 68 69 73 64 69 66 66 20 73 28 31 29 20 65 {thisdiff s(1) e
1ffa0 28 31 29 20 73 28 32 29 20 65 28 32 29 20 74 79 (1) s(2) e(2) ty
1ffb0 70 65 7d 20 24 67 28 73 63 72 64 69 66 66 2c 24 pe} $g(scrdiff,$
1ffc0 70 6f 73 29 20 7b 20 7d 0a 0a 20 20 20 20 23 20 pos) { }.. #
1ffd0 47 65 74 20 74 68 65 20 74 65 78 74 20 64 69 72 Get the text dir
1ffe0 65 63 74 6c 79 20 66 72 6f 6d 20 77 69 6e 64 6f ectly from windo
1fff0 77 0a 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 w. switch --
20000 24 6e 65 77 76 65 72 73 69 6f 6e 20 7b 0a 20 20 $newversion {.
20010 20 20 31 20 7b 0a 09 20 20 20 20 73 65 74 20 6e 1 {.. set n
20020 65 77 6c 69 6e 65 73 20 5b 64 69 66 66 2d 73 69 ewlines [diff-si
20030 7a 65 20 24 70 6f 73 20 31 5d 0a 09 20 20 20 20 ze $pos 1]..
20040 73 65 74 20 6e 65 77 74 65 78 74 20 5b 24 77 28 set newtext [$w(
20050 4c 65 66 74 54 65 78 74 29 20 67 65 74 20 24 73 LeftText) get $s
20060 28 31 29 2e 30 20 24 73 28 31 29 2e 30 2b 24 7b (1).0 $s(1).0+${
20070 6e 65 77 6c 69 6e 65 73 7d 6c 69 6e 65 73 5d 0a newlines}lines].
20080 09 7d 0a 20 20 20 20 32 20 7b 0a 09 20 20 20 20 .}. 2 {..
20090 73 65 74 20 6e 65 77 6c 69 6e 65 73 20 5b 64 69 set newlines [di
200a0 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 32 5d 0a ff-size $pos 2].
200b0 09 20 20 20 20 73 65 74 20 6e 65 77 74 65 78 74 . set newtext
200c0 20 5b 24 77 28 52 69 67 68 74 54 65 78 74 29 20 [$w(RightText)
200d0 67 65 74 20 24 73 28 32 29 2e 30 20 24 73 28 32 get $s(2).0 $s(2
200e0 29 2e 30 2b 24 7b 6e 65 77 6c 69 6e 65 73 7d 6c ).0+${newlines}l
200f0 69 6e 65 73 5d 0a 09 7d 0a 20 20 20 20 31 32 20 ines]..}. 12
20100 7b 0a 09 20 20 20 20 73 65 74 20 6e 65 77 6c 69 {.. set newli
20110 6e 65 73 20 5b 64 69 66 66 2d 73 69 7a 65 20 24 nes [diff-size $
20120 70 6f 73 20 31 5d 0a 09 20 20 20 20 73 65 74 20 pos 1].. set
20130 6e 65 77 74 65 78 74 20 5b 24 77 28 4c 65 66 74 newtext [$w(Left
20140 54 65 78 74 29 20 67 65 74 20 24 73 28 31 29 2e Text) get $s(1).
20150 30 20 24 73 28 31 29 2e 30 2b 24 7b 6e 65 77 6c 0 $s(1).0+${newl
20160 69 6e 65 73 7d 6c 69 6e 65 73 5d 0a 09 20 20 20 ines}lines]..
20170 20 73 65 74 20 6e 65 77 6c 69 6e 65 73 20 5b 64 set newlines [d
20180 69 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 32 5d iff-size $pos 2]
20190 0a 09 20 20 20 20 61 70 70 65 6e 64 20 6e 65 77 .. append new
201a0 74 65 78 74 20 5b 24 77 28 52 69 67 68 74 54 65 text [$w(RightTe
201b0 78 74 29 20 67 65 74 20 24 73 28 32 29 2e 30 20 xt) get $s(2).0
201c0 24 73 28 32 29 2e 30 2b 24 7b 6e 65 77 6c 69 6e $s(2).0+${newlin
201d0 65 73 7d 6c 69 6e 65 73 5d 0a 09 20 20 20 20 69 es}lines].. i
201e0 6e 63 72 20 6e 65 77 6c 69 6e 65 73 20 5b 64 69 ncr newlines [di
201f0 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 31 5d 0a ff-size $pos 1].
20200 09 7d 0a 20 20 20 20 32 31 20 7b 0a 09 20 20 20 .}. 21 {..
20210 20 73 65 74 20 6e 65 77 6c 69 6e 65 73 20 5b 64 set newlines [d
20220 69 66 66 2d 73 69 7a 65 20 24 70 6f 73 20 32 5d iff-size $pos 2]
20230 0a 09 20 20 20 20 73 65 74 20 6e 65 77 74 65 78 .. set newtex
20240 74 20 5b 24 77 28 52 69 67 68 74 54 65 78 74 29 t [$w(RightText)
20250 20 67 65 74 20 24 73 28 32 29 2e 30 20 24 73 28 get $s(2).0 $s(
20260 32 29 2e 30 2b 24 7b 6e 65 77 6c 69 6e 65 73 7d 2).0+${newlines}
20270 6c 69 6e 65 73 5d 0a 09 20 20 20 20 73 65 74 20 lines].. set
20280 6e 65 77 6c 69 6e 65 73 20 5b 64 69 66 66 2d 73 newlines [diff-s
20290 69 7a 65 20 24 70 6f 73 20 31 5d 0a 09 20 20 20 ize $pos 1]..
202a0 20 61 70 70 65 6e 64 20 6e 65 77 74 65 78 74 20 append newtext
202b0 5b 24 77 28 4c 65 66 74 54 65 78 74 29 20 67 65 [$w(LeftText) ge
202c0 74 20 24 73 28 31 29 2e 30 20 24 73 28 31 29 2e t $s(1).0 $s(1).
202d0 30 2b 24 7b 6e 65 77 6c 69 6e 65 73 7d 6c 69 6e 0+${newlines}lin
202e0 65 73 5d 0a 09 20 20 20 20 69 6e 63 72 20 6e 65 es].. incr ne
202f0 77 6c 69 6e 65 73 20 5b 64 69 66 66 2d 73 69 7a wlines [diff-siz
20300 65 20 24 70 6f 73 20 32 5d 0a 09 7d 0a 20 20 20 e $pos 2]..}.
20310 20 7d 0a 0a 20 20 20 20 23 20 49 6e 73 65 72 74 }.. # Insert
20320 20 69 74 0a 20 20 20 20 24 77 28 6d 65 72 67 65 it. $w(merge
20330 54 65 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 Text) configure
20340 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 -state normal.
20350 20 20 24 77 28 6d 65 72 67 65 54 65 78 74 29 20 $w(mergeText)
20360 69 6e 73 65 72 74 20 6d 61 72 6b 24 70 6f 73 20 insert mark$pos
20370 24 6e 65 77 74 65 78 74 20 64 69 66 66 0a 20 20 $newtext diff.
20380 20 20 24 77 28 6d 65 72 67 65 54 65 78 74 29 20 $w(mergeText)
20390 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
203a0 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20 69 66 disabled. if
203b0 20 7b 24 70 6f 73 20 3d 3d 20 24 67 28 70 6f 73 {$pos == $g(pos
203c0 29 7d 20 7b 0a 09 24 77 28 6d 65 72 67 65 54 65 )} {..$w(mergeTe
203d0 78 74 29 20 74 61 67 20 61 64 64 20 63 75 72 72 xt) tag add curr
203e0 74 61 67 20 6d 61 72 6b 24 70 6f 73 20 22 6d 61 tag mark$pos "ma
203f0 72 6b 24 7b 70 6f 73 7d 2b 24 7b 6e 65 77 6c 69 rk${pos}+${newli
20400 6e 65 73 7d 6c 69 6e 65 73 22 0a 20 20 20 20 7d nes}lines". }
20410 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 .}..############
20420 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20430 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20440 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20460 23 23 23 0a 23 20 43 65 6e 74 65 72 20 74 68 65 ###.# Center the
20470 20 6d 65 72 67 65 20 72 65 67 69 6f 6e 20 69 6e merge region in
20480 20 74 68 65 20 6d 65 72 67 65 20 77 69 6e 64 6f the merge windo
20490 77 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 w.##############
204a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204e0 23 0a 70 72 6f 63 20 6d 65 72 67 65 2d 63 65 6e #.proc merge-cen
204f0 74 65 72 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f ter {} {. glo
20500 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c bal g. global
20510 20 77 0a 0a 20 20 20 20 23 20 62 61 69 6c 20 69 w.. # bail i
20520 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 64 f there are no d
20530 69 66 66 73 0a 20 20 20 20 69 66 20 7b 24 67 28 iffs. if {$g(
20540 63 6f 75 6e 74 29 20 3d 3d 20 30 7d 20 7b 0a 09 count) == 0} {..
20550 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 return. }.
20560 20 23 20 53 69 7a 65 20 6f 66 20 64 69 66 66 20 # Size of diff
20570 69 6e 20 6c 69 6e 65 73 20 6f 66 20 74 65 78 74 in lines of text
20580 0a 20 20 20 20 73 65 74 20 64 69 66 66 6c 69 6e . set difflin
20590 65 73 20 5b 64 69 66 66 2d 73 69 7a 65 20 24 67 es [diff-size $g
205a0 28 70 6f 73 29 20 24 67 28 6d 65 72 67 65 24 67 (pos) $g(merge$g
205b0 28 70 6f 73 29 29 5d 0a 20 20 20 20 73 65 74 20 (pos))]. set
205c0 79 76 69 65 77 20 5b 24 77 28 6d 65 72 67 65 54 yview [$w(mergeT
205d0 65 78 74 29 20 79 76 69 65 77 5d 0a 20 20 20 20 ext) yview].
205e0 23 20 57 69 6e 64 6f 77 20 68 65 69 67 68 74 20 # Window height
205f0 69 6e 20 70 65 72 63 65 6e 74 0a 20 20 20 20 73 in percent. s
20600 65 74 20 79 77 69 6e 64 6f 77 20 5b 65 78 70 72 et ywindow [expr
20610 20 7b 5b 6c 69 6e 64 65 78 20 24 79 76 69 65 77 {[lindex $yview
20620 20 31 5d 20 2d 20 5b 6c 69 6e 64 65 78 20 24 79 1] - [lindex $y
20630 76 69 65 77 20 30 5d 7d 5d 0a 20 20 20 20 23 20 view 0]}]. #
20640 46 69 72 73 74 20 6c 69 6e 65 20 6f 66 20 64 69 First line of di
20650 66 66 0a 20 20 20 20 73 65 74 20 66 69 72 73 74 ff. set first
20660 6c 69 6e 65 20 5b 24 77 28 6d 65 72 67 65 54 65 line [$w(mergeTe
20670 78 74 29 20 69 6e 64 65 78 20 6d 61 72 6b 24 67 xt) index mark$g
20680 28 70 6f 73 29 5d 0a 20 20 20 20 23 20 54 6f 74 (pos)]. # Tot
20690 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e al number of lin
206a0 65 73 20 69 6e 20 77 69 6e 64 6f 77 0a 20 20 20 es in window.
206b0 20 73 65 74 20 74 6f 74 61 6c 6c 69 6e 65 73 20 set totallines
206c0 5b 24 77 28 6d 65 72 67 65 54 65 78 74 29 20 69 [$w(mergeText) i
206d0 6e 64 65 78 20 65 6e 64 5d 0a 0a 20 20 20 20 69 ndex end].. i
206e0 66 20 7b 24 64 69 66 66 6c 69 6e 65 73 20 2f 20 f {$difflines /
206f0 24 74 6f 74 61 6c 6c 69 6e 65 73 20 3c 20 24 79 $totallines < $y
20700 77 69 6e 64 6f 77 7d 20 7b 0a 09 23 20 44 69 66 window} {..# Dif
20710 66 20 66 69 74 73 20 69 6e 20 77 69 6e 64 6f 77 f fits in window
20720 2c 20 63 65 6e 74 65 72 20 69 74 0a 09 24 77 28 , center it..$w(
20730 6d 65 72 67 65 54 65 78 74 29 20 79 76 69 65 77 mergeText) yview
20740 20 6d 6f 76 65 74 6f 20 5b 65 78 70 72 20 7b 28 moveto [expr {(
20750 24 66 69 72 73 74 6c 69 6e 65 20 2b 20 24 64 69 $firstline + $di
20760 66 66 6c 69 6e 65 73 20 2f 20 32 29 20 2f 20 5c fflines / 2) / \
20770 0a 09 20 20 24 74 6f 74 61 6c 6c 69 6e 65 73 20 .. $totallines
20780 2d 20 24 79 77 69 6e 64 6f 77 20 2f 20 32 7d 5d - $ywindow / 2}]
20790 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 23 . } else {..#
207a0 20 44 69 66 66 20 74 6f 6f 20 62 69 67 2c 20 73 Diff too big, s
207b0 68 6f 77 20 74 6f 70 20 70 61 72 74 0a 09 24 77 how top part..$w
207c0 28 6d 65 72 67 65 54 65 78 74 29 20 79 76 69 65 (mergeText) yvie
207d0 77 20 6d 6f 76 65 74 6f 20 5b 65 78 70 72 20 7b w moveto [expr {
207e0 28 24 66 69 72 73 74 6c 69 6e 65 20 2d 20 31 29 ($firstline - 1)
207f0 20 2f 20 24 74 6f 74 61 6c 6c 69 6e 65 73 7d 5d / $totallines}]
20800 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
20810 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20830 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20840 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20850 23 23 23 23 23 23 23 23 23 0a 23 20 55 70 64 61 #########.# Upda
20860 74 65 20 74 68 65 20 6d 65 72 67 65 20 70 72 65 te the merge pre
20870 76 69 65 77 20 77 69 6e 64 6f 77 20 77 69 74 68 view window with
20880 20 74 68 65 20 63 75 72 72 65 6e 74 20 6d 65 72 the current mer
20890 67 65 20 63 68 6f 69 63 65 0a 23 20 6e 65 77 76 ge choice.# newv
208a0 65 72 73 69 6f 6e 20 20 20 31 20 6f 72 20 32 2c ersion 1 or 2,
208b0 20 6e 65 77 20 6d 65 72 67 65 20 63 68 6f 69 63 new merge choic
208c0 65 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 e.##############
208d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
208e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
208f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20900 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20910 23 0a 70 72 6f 63 20 64 6f 2d 6d 65 72 67 65 2d #.proc do-merge-
20920 63 68 6f 69 63 65 20 7b 6e 65 77 76 65 72 73 69 choice {newversi
20930 6f 6e 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d on} {. debug-
20940 69 6e 66 6f 20 22 64 6f 2d 6d 65 72 67 65 2d 63 info "do-merge-c
20950 68 6f 69 63 65 20 28 24 6e 65 77 76 65 72 73 69 hoice ($newversi
20960 6f 6e 29 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 on)". global
20970 67 20 6f 70 74 73 0a 20 20 20 20 67 6c 6f 62 61 g opts. globa
20980 6c 20 77 0a 0a 20 20 20 20 69 66 20 7b 21 20 5b l w.. if {! [
20990 69 6e 66 6f 20 65 78 69 73 74 73 20 77 28 6d 65 info exists w(me
209a0 72 67 65 54 65 78 74 29 5d 20 7c 7c 20 21 20 5b rgeText)] || ! [
209b0 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24 77 28 winfo exists $w(
209c0 6d 65 72 67 65 54 65 78 74 29 5d 7d 20 7b 0a 20 mergeText)]} {.
209d0 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 return.
209e0 20 7d 0a 20 20 20 20 24 77 28 6d 65 72 67 65 54 }. $w(mergeT
209f0 65 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 2d ext) configure -
20a00 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 20 state normal.
20a10 20 6d 65 72 67 65 2d 73 65 6c 65 63 74 2d 76 65 merge-select-ve
20a20 72 73 69 6f 6e 20 24 67 28 70 6f 73 29 20 24 67 rsion $g(pos) $g
20a30 28 6d 65 72 67 65 24 67 28 70 6f 73 29 29 20 24 (merge$g(pos)) $
20a40 6e 65 77 76 65 72 73 69 6f 6e 0a 20 20 20 20 24 newversion. $
20a50 77 28 6d 65 72 67 65 54 65 78 74 29 20 63 6f 6e w(mergeText) con
20a60 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 64 69 figure -state di
20a70 73 61 62 6c 65 64 0a 0a 20 20 20 20 73 65 74 20 sabled.. set
20a80 67 28 6d 65 72 67 65 24 67 28 70 6f 73 29 29 20 g(merge$g(pos))
20a90 24 6e 65 77 76 65 72 73 69 6f 6e 0a 20 20 20 20 $newversion.
20aa0 69 66 20 7b 24 67 28 73 68 6f 77 6d 65 72 67 65 if {$g(showmerge
20ab0 29 20 26 26 20 24 6f 70 74 73 28 61 75 74 6f 63 ) && $opts(autoc
20ac0 65 6e 74 65 72 29 7d 20 7b 0a 09 6d 65 72 67 65 enter)} {..merge
20ad0 2d 63 65 6e 74 65 72 0a 20 20 20 20 7d 0a 20 20 -center. }.
20ae0 20 20 73 65 74 20 67 28 74 6f 67 67 6c 65 29 20 set g(toggle)
20af0 24 6e 65 77 76 65 72 73 69 6f 6e 0a 7d 0a 0a 23 $newversion.}..#
20b00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20b10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20b20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20b30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20b40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
20b50 20 45 78 74 72 61 63 74 20 74 68 65 20 73 74 61 Extract the sta
20b60 72 74 20 61 6e 64 20 65 6e 64 20 6c 69 6e 65 73 rt and end lines
20b70 20 66 6f 72 20 66 69 6c 65 31 20 61 6e 64 20 66 for file1 and f
20b80 69 6c 65 32 20 66 72 6f 6d 20 74 68 65 20 64 69 ile2 from the di
20b90 66 66 0a 23 20 73 74 6f 72 65 64 20 69 6e 20 22 ff.# stored in "
20ba0 6c 69 6e 65 22 2e 0a 23 23 23 23 23 23 23 23 23 line"..#########
20bb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20bc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20bd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20be0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20bf0 23 23 23 23 23 23 0a 70 72 6f 63 20 65 78 74 72 ######.proc extr
20c00 61 63 74 20 7b 6c 69 6e 65 7d 20 7b 0a 20 20 20 act {line} {.
20c10 20 23 20 74 68 65 20 6c 69 6e 65 20 64 61 72 6e # the line darn
20c20 20 77 65 6c 6c 20 62 65 74 74 65 72 20 62 65 20 well better be
20c30 6f 66 20 74 68 65 20 66 6f 72 6d 20 3c 72 61 6e of the form <ran
20c40 67 65 3e 3c 6f 70 3e 3c 72 61 6e 67 65 3e 2c 0a ge><op><range>,.
20c50 20 20 20 20 23 20 77 68 65 72 65 20 6f 70 20 69 # where op i
20c60 73 20 6f 6e 65 20 6f 66 20 22 61 22 2c 22 63 22 s one of "a","c"
20c70 20 6f 72 20 22 64 22 2e 20 72 61 6e 67 65 20 77 or "d". range w
20c80 69 6c 6c 20 65 69 74 68 65 72 20 62 65 20 61 0a ill either be a.
20c90 20 20 20 20 23 20 73 69 6e 67 6c 65 20 6e 75 6d # single num
20ca0 62 65 72 20 6f 72 20 74 77 6f 20 6e 75 6d 62 65 ber or two numbe
20cb0 72 73 20 73 65 70 61 72 61 74 65 64 20 62 79 20 rs separated by
20cc0 61 20 63 6f 6d 6d 61 2e 0a 0a 20 20 20 20 23 20 a comma... #
20cd0 69 73 20 74 68 69 73 20 61 20 63 6f 6f 6c 20 72 is this a cool r
20ce0 65 67 75 6c 61 72 20 65 78 70 72 65 73 73 69 6f egular expressio
20cf0 6e 2c 20 6f 72 20 77 68 61 74 3f 20 3a 2d 29 0a n, or what? :-).
20d00 20 20 20 20 72 65 67 65 78 70 20 7b 28 5b 30 2d regexp {([0-
20d10 39 5d 2a 29 28 2c 28 5b 30 2d 39 5d 2a 29 29 3f 9]*)(,([0-9]*))?
20d20 28 5b 61 2d 7a 5d 29 28 5b 30 2d 39 5d 2a 29 28 ([a-z])([0-9]*)(
20d30 2c 28 5b 30 2d 39 5d 2a 29 29 3f 7d 20 24 6c 69 ,([0-9]*))?} $li
20d40 6e 65 20 6d 61 74 63 68 76 61 72 20 5c 0a 20 20 ne matchvar \.
20d50 20 20 20 20 73 31 20 78 20 65 31 20 6f 70 20 73 s1 x e1 op s
20d60 32 20 78 20 65 32 0a 20 20 20 20 69 66 20 7b 5b 2 x e2. if {[
20d70 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 string length $e
20d80 31 5d 20 3d 3d 20 30 7d 20 7b 0a 09 73 65 74 20 1] == 0} {..set
20d90 65 31 20 24 73 31 0a 20 20 20 20 7d 0a 20 20 20 e1 $s1. }.
20da0 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
20db0 67 74 68 20 24 65 32 5d 20 3d 3d 20 30 7d 20 7b gth $e2] == 0} {
20dc0 0a 09 73 65 74 20 65 32 20 24 73 32 0a 20 20 20 ..set e2 $s2.
20dd0 20 7d 0a 0a 20 20 20 20 69 66 20 7b 5b 69 6e 66 }.. if {[inf
20de0 6f 20 65 78 69 73 74 73 20 73 31 5d 20 26 26 20 o exists s1] &&
20df0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 73 32 5d [info exists s2]
20e00 7d 20 7b 0a 09 23 20 20 20 20 20 20 20 20 20 72 } {..# r
20e10 65 74 75 72 6e 20 22 24 6c 69 6e 65 20 24 73 31 eturn "$line $s1
20e20 20 24 65 31 20 24 73 32 20 24 65 32 20 24 6f 70 $e1 $s2 $e2 $op
20e30 22 0a 09 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 "..return [list
20e40 24 6c 69 6e 65 20 24 73 31 20 24 65 31 20 24 73 $line $s1 $e1 $s
20e50 32 20 24 65 32 20 24 6f 70 5d 0a 20 20 20 20 7d 2 $e2 $op]. }
20e60 20 65 6c 73 65 20 7b 0a 09 66 61 74 61 6c 2d 65 else {..fatal-e
20e70 72 72 6f 72 20 22 43 61 6e 6e 6f 74 20 70 61 72 rror "Cannot par
20e80 73 65 20 6f 75 74 70 75 74 20 66 72 6f 6d 20 64 se output from d
20e90 69 66 66 3a 5c 6e 24 6c 69 6e 65 22 0a 20 20 20 iff:\n$line".
20ea0 20 7d 0a 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 }..}..#########
20eb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20ec0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20ed0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20ee0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20ef0 23 23 23 23 23 23 0a 23 20 49 6e 73 65 72 74 20 ######.# Insert
20f00 62 6c 61 6e 6b 20 6c 69 6e 65 73 20 74 6f 20 6d blank lines to m
20f10 61 74 63 68 20 61 64 64 65 64 2f 64 65 6c 65 74 atch added/delet
20f20 65 64 20 6c 69 6e 65 73 20 69 6e 20 6f 74 68 65 ed lines in othe
20f30 72 20 66 69 6c 65 0a 23 23 23 23 23 23 23 23 23 r file.#########
20f40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20f50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20f60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20f70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20f80 23 23 23 23 23 23 0a 70 72 6f 63 20 61 64 64 2d ######.proc add-
20f90 6c 69 6e 65 73 20 7b 70 6f 73 7d 20 7b 0a 20 20 lines {pos} {.
20fa0 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 67 global g. g
20fb0 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c 6f 62 lobal w. glob
20fc0 61 6c 20 6f 70 74 73 0a 0a 20 20 20 20 23 20 46 al opts.. # F
20fd0 69 67 75 72 65 20 6f 75 74 20 77 68 69 63 68 20 igure out which
20fe0 6c 69 6e 65 73 20 77 65 20 6e 65 65 64 20 74 6f lines we need to
20ff0 20 61 64 64 72 65 73 73 2e 2e 2e 0a 20 20 20 20 address....
21000 66 6f 72 65 61 63 68 20 5b 6c 69 73 74 20 74 68 foreach [list th
21010 69 73 64 69 66 66 20 73 31 20 65 31 20 73 32 20 isdiff s1 e1 s2
21020 65 32 20 74 79 70 65 5d 20 24 67 28 70 64 69 66 e2 type] $g(pdif
21030 66 2c 24 70 6f 73 29 20 7b 20 7d 0a 0a 20 20 20 f,$pos) { }..
21040 20 73 65 74 20 73 69 7a 65 28 31 29 20 5b 65 78 set size(1) [ex
21050 70 72 20 7b 24 65 31 20 2d 20 24 73 31 7d 5d 0a pr {$e1 - $s1}].
21060 20 20 20 20 73 65 74 20 73 69 7a 65 28 32 29 20 set size(2)
21070 5b 65 78 70 72 20 7b 24 65 32 20 2d 20 24 73 32 [expr {$e2 - $s2
21080 7d 5d 0a 0a 20 20 20 20 69 6e 63 72 20 73 31 20 }].. incr s1
21090 24 67 28 64 65 6c 74 61 2c 31 29 0a 20 20 20 20 $g(delta,1).
210a0 69 6e 63 72 20 73 32 20 24 67 28 64 65 6c 74 61 incr s2 $g(delta
210b0 2c 32 29 0a 0a 20 20 20 20 23 20 46 69 67 75 72 ,2).. # Figur
210c0 65 20 6f 75 74 20 77 68 61 74 20 6b 69 6e 64 20 e out what kind
210d0 6f 66 20 64 69 66 66 20 77 65 27 72 65 20 64 65 of diff we're de
210e0 61 6c 69 6e 67 20 77 69 74 68 0a 20 20 20 20 73 aling with. s
210f0 77 69 74 63 68 20 2d 2d 20 24 74 79 70 65 20 7b witch -- $type {
21100 0a 20 20 20 20 22 61 22 20 7b 0a 09 20 20 20 20 . "a" {..
21110 73 65 74 20 6c 65 66 74 74 65 78 74 20 22 20 22 set lefttext " "
21120 20 3b 23 20 69 6e 73 65 72 74 0a 09 20 20 20 20 ;# insert..
21130 73 65 74 20 72 69 67 68 74 74 65 78 74 20 22 2b set righttext "+
21140 22 0a 09 20 20 20 20 73 65 74 20 69 64 78 20 31 ".. set idx 1
21150 0a 09 20 20 20 20 73 65 74 20 63 6f 75 6e 74 20 .. set count
21160 5b 65 78 70 72 20 7b 24 73 69 7a 65 28 32 29 20 [expr {$size(2)
21170 2b 20 31 7d 5d 0a 0a 09 20 20 20 20 69 6e 63 72 + 1}]... incr
21180 20 73 31 0a 09 20 20 20 20 69 6e 63 72 20 73 69 s1.. incr si
21190 7a 65 28 32 29 0a 09 7d 0a 20 20 20 20 22 64 22 ze(2)..}. "d"
211a0 20 7b 0a 09 20 20 20 20 73 65 74 20 6c 65 66 74 {.. set left
211b0 74 65 78 74 20 22 2d 22 20 3b 23 20 64 65 6c 65 text "-" ;# dele
211c0 74 65 0a 09 20 20 20 20 73 65 74 20 72 69 67 68 te.. set righ
211d0 74 74 65 78 74 20 22 20 22 0a 09 20 20 20 20 73 ttext " ".. s
211e0 65 74 20 69 64 78 20 32 0a 09 20 20 20 20 73 65 et idx 2.. se
211f0 74 20 63 6f 75 6e 74 20 5b 65 78 70 72 20 7b 24 t count [expr {$
21200 73 69 7a 65 28 31 29 20 2b 20 31 7d 5d 0a 0a 09 size(1) + 1}]...
21210 20 20 20 20 69 6e 63 72 20 73 32 0a 09 20 20 20 incr s2..
21220 20 69 6e 63 72 20 73 69 7a 65 28 31 29 0a 09 7d incr size(1)..}
21230 0a 20 20 20 20 22 63 22 20 7b 0a 09 20 20 20 20 . "c" {..
21240 73 65 74 20 6c 65 66 74 74 65 78 74 20 22 21 22 set lefttext "!"
21250 20 3b 23 20 63 68 61 6e 67 65 0a 09 20 20 20 20 ;# change..
21260 73 65 74 20 72 69 67 68 74 74 65 78 74 20 22 21 set righttext "!
21270 22 20 3b 23 20 63 68 61 6e 67 65 0a 09 20 20 20 " ;# change..
21280 20 69 66 20 7b 24 67 28 61 6e 63 66 69 6c 65 73 if {$g(ancfiles
21290 65 74 29 7d 20 7b 0a 09 09 73 65 74 20 63 68 61 et)} {...set cha
212a0 6e 67 65 20 24 67 28 70 64 69 66 66 2c 24 67 28 nge $g(pdiff,$g(
212b0 63 6f 75 6e 74 29 29 0a 09 09 73 65 74 20 6c 65 count))...set le
212c0 66 74 42 65 67 69 6e 20 5b 6c 69 6e 64 65 78 20 ftBegin [lindex
212d0 24 63 68 61 6e 67 65 20 31 5d 0a 09 09 73 65 74 $change 1]...set
212e0 20 6c 65 66 74 45 6e 64 20 5b 6c 69 6e 64 65 78 leftEnd [lindex
212f0 20 24 63 68 61 6e 67 65 20 32 5d 0a 09 09 73 65 $change 2]...se
21300 74 20 72 69 67 68 74 42 65 67 69 6e 20 5b 6c 69 t rightBegin [li
21310 6e 64 65 78 20 24 63 68 61 6e 67 65 20 33 5d 0a ndex $change 3].
21320 09 09 73 65 74 20 72 69 67 68 74 45 6e 64 20 5b ..set rightEnd [
21330 6c 69 6e 64 65 78 20 24 63 68 61 6e 67 65 20 34 lindex $change 4
21340 5d 0a 0a 09 09 73 65 74 20 63 68 61 6e 67 65 4c ]....set changeL
21350 65 66 74 20 30 0a 09 09 73 65 74 20 63 68 61 6e eft 0...set chan
21360 67 65 52 69 67 68 74 20 30 0a 09 09 66 6f 72 20 geRight 0...for
21370 7b 73 65 74 20 69 20 24 6c 65 66 74 42 65 67 69 {set i $leftBegi
21380 6e 7d 20 7b 24 69 20 3c 3d 20 24 6c 65 66 74 45 n} {$i <= $leftE
21390 6e 64 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 nd} {incr i} {..
213a0 09 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 . if {[info e
213b0 78 69 73 74 73 20 67 28 64 69 66 66 33 6c 24 69 xists g(diff3l$i
213c0 29 5d 7d 20 7b 0a 09 09 20 20 20 20 20 20 20 20 )]} {...
213d0 73 65 74 20 63 68 61 6e 67 65 4c 65 66 74 20 31 set changeLeft 1
213e0 0a 09 09 20 20 20 20 20 20 20 20 62 72 65 61 6b ... break
213f0 0a 09 09 20 20 20 20 7d 0a 09 09 7d 0a 09 09 69 ... }...}...i
21400 66 20 7b 24 63 68 61 6e 67 65 4c 65 66 74 7d 20 f {$changeLeft}
21410 7b 0a 09 09 20 20 20 20 66 6f 72 20 7b 73 65 74 {... for {set
21420 20 69 20 24 72 69 67 68 74 42 65 67 69 6e 7d 20 i $rightBegin}
21430 7b 24 69 20 3c 3d 20 24 72 69 67 68 74 45 6e 64 {$i <= $rightEnd
21440 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 09 20 } {incr i} {...
21450 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
21460 20 65 78 69 73 74 73 20 67 28 64 69 66 66 33 72 exists g(diff3r
21470 24 69 29 5d 7d 20 7b 0a 09 09 20 20 20 20 20 20 $i)]} {...
21480 20 20 20 20 20 20 73 65 74 20 63 68 61 6e 67 65 set change
21490 52 69 67 68 74 20 31 0a 09 09 20 20 20 20 20 20 Right 1...
214a0 20 20 20 20 20 20 62 72 65 61 6b 0a 09 09 20 20 break...
214b0 20 20 20 20 20 20 7d 0a 09 09 20 20 20 20 7d 0a }... }.
214c0 09 09 7d 0a 09 09 69 66 20 7b 24 63 68 61 6e 67 ..}...if {$chang
214d0 65 4c 65 66 74 20 26 26 20 24 63 68 61 6e 67 65 eLeft && $change
214e0 52 69 67 68 74 7d 20 7b 0a 09 09 20 20 20 20 73 Right} {... s
214f0 65 74 20 6c 65 66 74 74 65 78 74 20 22 3f 22 20 et lefttext "?"
21500 3b 23 20 6f 76 65 72 6c 61 70 0a 09 09 20 20 20 ;# overlap...
21510 20 73 65 74 20 72 69 67 68 74 74 65 78 74 20 22 set righttext "
21520 3f 22 20 3b 23 20 6f 76 65 72 6c 61 70 0a 09 09 ?" ;# overlap...
21530 20 20 20 20 73 65 74 20 67 28 6f 76 65 72 6c 61 set g(overla
21540 70 24 70 6f 73 29 20 31 0a 09 09 7d 0a 09 20 20 p$pos) 1...}..
21550 20 20 7d 0a 09 20 20 20 20 73 65 74 20 69 64 78 }.. set idx
21560 20 5b 65 78 70 72 20 7b 24 73 69 7a 65 28 31 29 [expr {$size(1)
21570 20 3c 20 24 73 69 7a 65 28 32 29 20 3f 20 31 20 < $size(2) ? 1
21580 3a 20 32 7d 5d 0a 09 20 20 20 20 73 65 74 20 63 : 2}].. set c
21590 6f 75 6e 74 20 5b 65 78 70 72 20 7b 61 62 73 28 ount [expr {abs(
215a0 24 73 69 7a 65 28 31 29 20 2d 20 24 73 69 7a 65 $size(1) - $size
215b0 28 32 29 29 7d 5d 0a 0a 09 20 20 20 20 69 6e 63 (2))}]... inc
215c0 72 20 73 69 7a 65 28 31 29 0a 09 20 20 20 20 69 r size(1).. i
215d0 6e 63 72 20 73 69 7a 65 28 32 29 0a 09 7d 0a 20 ncr size(2)..}.
215e0 20 20 20 7d 0a 0a 20 20 20 20 23 20 50 75 74 20 }.. # Put
215f0 70 6c 75 73 20 73 69 67 6e 73 20 69 6e 20 6c 65 plus signs in le
21600 66 74 20 69 6e 66 6f 20 63 6f 6c 75 6d 6e 0a 20 ft info column.
21610 20 20 20 69 66 20 7b 24 69 64 78 20 3d 3d 20 31 if {$idx == 1
21620 7d 20 7b 0a 09 73 65 74 20 74 65 78 74 57 69 64 } {..set textWid
21630 67 65 74 20 24 77 28 4c 65 66 74 54 65 78 74 29 get $w(LeftText)
21640 0a 09 73 65 74 20 69 6e 66 6f 57 69 64 67 65 74 ..set infoWidget
21650 20 24 77 28 4c 65 66 74 49 6e 66 6f 29 0a 09 73 $w(LeftInfo)..s
21660 65 74 20 63 62 57 69 64 67 65 74 20 24 77 28 4c et cbWidget $w(L
21670 65 66 74 43 42 29 0a 09 23 20 20 20 20 20 20 20 eftCB)..#
21680 20 73 65 74 20 62 6c 61 6e 6b 20 22 2b 2b 2b 2b set blank "++++
21690 2b 2b 5c 6e 22 0a 09 73 65 74 20 62 6c 61 6e 6b ++\n"..set blank
216a0 20 22 20 20 20 20 20 20 5c 6e 22 0a 20 20 20 20 " \n".
216b0 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 74 65 } else {..set te
216c0 78 74 57 69 64 67 65 74 20 24 77 28 52 69 67 68 xtWidget $w(Righ
216d0 74 54 65 78 74 29 0a 09 73 65 74 20 69 6e 66 6f tText)..set info
216e0 57 69 64 67 65 74 20 24 77 28 52 69 67 68 74 49 Widget $w(RightI
216f0 6e 66 6f 29 0a 09 73 65 74 20 63 62 57 69 64 67 nfo)..set cbWidg
21700 65 74 20 24 77 28 52 69 67 68 74 43 42 29 0a 09 et $w(RightCB)..
21710 73 65 74 20 62 6c 61 6e 6b 20 22 20 20 20 20 20 set blank "
21720 20 5c 6e 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 \n". }..
21730 23 20 49 6e 73 65 72 74 20 62 6c 61 6e 6b 20 6c # Insert blank l
21740 69 6e 65 73 20 74 6f 20 6d 61 74 63 68 20 6f 74 ines to match ot
21750 68 65 72 20 77 69 6e 64 6f 77 0a 20 20 20 20 73 her window. s
21760 65 74 20 6c 69 6e 65 20 5b 65 78 70 72 20 7b 24 et line [expr {$
21770 73 31 20 2b 20 24 73 69 7a 65 28 24 69 64 78 29 s1 + $size($idx)
21780 7d 5d 0a 20 20 20 20 66 6f 72 20 7b 73 65 74 20 }]. for {set
21790 69 20 30 7d 20 7b 24 69 20 3c 20 24 63 6f 75 6e i 0} {$i < $coun
217a0 74 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 24 t} {incr i} {..$
217b0 74 65 78 74 57 69 64 67 65 74 20 69 6e 73 65 72 textWidget inser
217c0 74 20 24 6c 69 6e 65 2e 30 20 22 5c 6e 22 0a 09 t $line.0 "\n"..
217d0 24 69 6e 66 6f 57 69 64 67 65 74 20 69 6e 73 65 $infoWidget inse
217e0 72 74 20 24 6c 69 6e 65 2e 30 20 24 62 6c 61 6e rt $line.0 $blan
217f0 6b 0a 09 24 63 62 57 69 64 67 65 74 20 69 6e 73 k..$cbWidget ins
21800 65 72 74 20 24 6c 69 6e 65 2e 30 20 22 5c 6e 22 ert $line.0 "\n"
21810 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 6e 63 72 . }.. incr
21820 20 73 69 7a 65 28 24 69 64 78 29 20 24 63 6f 75 size($idx) $cou
21830 6e 74 0a 20 20 20 20 73 65 74 20 65 31 20 5b 65 nt. set e1 [e
21840 78 70 72 20 7b 24 73 31 20 2b 20 24 73 69 7a 65 xpr {$s1 + $size
21850 28 31 29 20 2d 20 31 7d 5d 0a 20 20 20 20 73 65 (1) - 1}]. se
21860 74 20 65 32 20 5b 65 78 70 72 20 7b 24 73 32 20 t e2 [expr {$s2
21870 2b 20 24 73 69 7a 65 28 32 29 20 2d 20 31 7d 5d + $size(2) - 1}]
21880 0a 20 20 20 20 69 6e 63 72 20 67 28 64 65 6c 74 . incr g(delt
21890 61 2c 24 69 64 78 29 20 24 63 6f 75 6e 74 0a 0a a,$idx) $count..
218a0 20 20 20 20 23 20 49 6e 73 65 72 74 20 63 68 61 # Insert cha
218b0 6e 67 65 20 62 61 72 73 20 6f 72 20 74 65 78 74 nge bars or text
218c0 20 74 6f 20 73 68 6f 77 20 77 68 61 74 20 68 61 to show what ha
218d0 73 20 63 68 61 6e 67 65 64 2e 0a 20 20 20 20 24 s changed.. $
218e0 77 28 52 69 67 68 74 43 42 29 20 63 6f 6e 66 69 w(RightCB) confi
218f0 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d gure -state norm
21900 61 6c 0a 20 20 20 20 24 77 28 4c 65 66 74 43 42 al. $w(LeftCB
21910 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
21920 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 20 20 66 6f te normal. fo
21930 72 20 7b 73 65 74 20 69 20 24 73 31 7d 20 7b 24 r {set i $s1} {$
21940 69 20 3c 3d 20 24 65 31 7d 20 7b 69 6e 63 72 20 i <= $e1} {incr
21950 69 7d 20 7b 0a 09 24 77 28 4c 65 66 74 43 42 29 i} {..$w(LeftCB)
21960 20 69 6e 73 65 72 74 20 24 69 2e 30 20 24 6c 65 insert $i.0 $le
21970 66 74 74 65 78 74 0a 09 24 77 28 52 69 67 68 74 fttext..$w(Right
21980 43 42 29 20 69 6e 73 65 72 74 20 24 69 2e 30 20 CB) insert $i.0
21990 24 72 69 67 68 74 74 65 78 74 0a 20 20 20 20 7d $righttext. }
219a0 0a 0a 20 20 20 20 23 20 53 61 76 65 20 74 68 65 .. # Save the
219b0 20 64 69 66 66 20 62 6c 6f 63 6b 20 69 6e 20 77 diff block in w
219c0 69 6e 64 6f 77 20 63 6f 6f 72 64 69 6e 61 74 65 indow coordinate
219d0 73 0a 20 20 20 20 73 65 74 20 67 28 73 63 72 64 s. set g(scrd
219e0 69 66 66 2c 24 67 28 63 6f 75 6e 74 29 29 20 5b iff,$g(count)) [
219f0 6c 69 73 74 20 24 74 68 69 73 64 69 66 66 20 24 list $thisdiff $
21a00 73 31 20 24 65 31 20 24 73 32 20 24 65 32 20 24 s1 $e1 $s2 $e2 $
21a10 74 79 70 65 5d 0a 0a 20 20 20 20 73 65 74 20 67 type].. set g
21a20 28 73 63 72 69 6e 6c 69 6e 65 2c 24 70 6f 73 29 (scrinline,$pos)
21a30 20 30 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 73 0. if {$opts
21a40 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 20 7c 7c (showinline1) ||
21a50 20 24 6f 70 74 73 28 73 68 6f 77 69 6e 6c 69 6e $opts(showinlin
21a60 65 32 29 7d 20 7b 0a 09 69 66 20 7b 24 74 79 70 e2)} {..if {$typ
21a70 65 20 3d 3d 20 22 63 22 7d 20 7b 0a 09 20 20 20 e == "c"} {..
21a80 20 73 65 74 20 6e 75 6d 6c 69 6e 65 73 20 5b 6d set numlines [m
21a90 61 78 20 5b 65 78 70 72 20 7b 24 65 31 2d 24 73 ax [expr {$e1-$s
21aa0 31 2b 31 7d 5d 20 5b 65 78 70 72 20 7b 24 65 32 1+1}] [expr {$e2
21ab0 2d 24 73 32 2b 31 7d 5d 5d 0a 09 20 20 20 20 66 -$s2+1}]].. f
21ac0 6f 72 20 7b 73 65 74 20 69 20 30 7d 20 7b 24 69 or {set i 0} {$i
21ad0 20 3c 20 24 6e 75 6d 6c 69 6e 65 73 7d 20 7b 69 < $numlines} {i
21ae0 6e 63 72 20 69 7d 20 7b 0a 09 09 73 65 74 20 6c ncr i} {...set l
21af0 31 20 5b 65 78 70 72 20 24 73 31 2b 24 69 5d 0a 1 [expr $s1+$i].
21b00 09 09 73 65 74 20 6c 32 20 5b 65 78 70 72 20 24 ..set l2 [expr $
21b10 73 32 2b 24 69 5d 0a 09 09 69 66 20 7b 24 6f 70 s2+$i]...if {$op
21b20 74 73 28 73 68 6f 77 69 6e 6c 69 6e 65 31 29 7d ts(showinline1)}
21b30 20 7b 0a 09 09 20 20 20 20 66 69 6e 64 2d 69 6e {... find-in
21b40 6c 69 6e 65 2d 64 69 66 66 2d 62 79 74 65 20 24 line-diff-byte $
21b50 70 6f 73 20 24 6c 31 20 24 6c 32 20 5b 24 77 28 pos $l1 $l2 [$w(
21b60 4c 65 66 74 54 65 78 74 29 20 67 65 74 20 5c 0a LeftText) get \.
21b70 09 09 20 20 20 20 20 20 24 6c 31 2e 30 20 24 6c .. $l1.0 $l
21b80 31 2e 65 6e 64 5d 20 5b 24 77 28 52 69 67 68 74 1.end] [$w(Right
21b90 54 65 78 74 29 20 67 65 74 20 24 6c 32 2e 30 20 Text) get $l2.0
21ba0 24 6c 32 2e 65 6e 64 5d 0a 09 09 7d 20 65 6c 73 $l2.end]...} els
21bb0 65 20 7b 0a 09 09 20 20 20 20 66 69 6e 64 2d 69 e {... find-i
21bc0 6e 6c 69 6e 65 2d 64 69 66 66 2d 72 61 74 63 6c nline-diff-ratcl
21bd0 69 66 66 20 24 70 6f 73 20 24 6c 31 20 24 6c 32 iff $pos $l1 $l2
21be0 20 5b 24 77 28 4c 65 66 74 54 65 78 74 29 20 67 [$w(LeftText) g
21bf0 65 74 20 5c 0a 09 09 20 20 20 20 20 20 24 6c 31 et \... $l1
21c00 2e 30 20 24 6c 31 2e 65 6e 64 5d 20 5b 24 77 28 .0 $l1.end] [$w(
21c10 52 69 67 68 74 54 65 78 74 29 20 67 65 74 20 24 RightText) get $
21c20 6c 32 2e 30 20 24 6c 32 2e 65 6e 64 5d 0a 09 09 l2.0 $l2.end]...
21c30 7d 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 }.. }..}.
21c40 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 }.}..###########
21c50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21c60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21c70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21c80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21c90 23 23 23 23 0a 23 20 41 64 64 20 61 20 74 61 67 ####.# Add a tag
21ca0 20 74 6f 20 61 20 72 65 67 69 6f 6e 2e 0a 23 23 to a region..##
21cb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21cc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21cd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21ce0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21cf0 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
21d00 6f 63 20 61 64 64 2d 74 61 67 20 7b 77 67 74 20 oc add-tag {wgt
21d10 74 61 67 20 73 74 61 72 74 20 65 6e 64 20 74 79 tag start end ty
21d20 70 65 20 6e 65 77 20 7b 65 78 61 63 74 20 30 7d pe new {exact 0}
21d30 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 } {. global g
21d40 0a 0a 20 20 20 20 24 77 67 74 20 74 61 67 20 61 .. $wgt tag a
21d50 64 64 20 24 74 61 67 20 24 73 74 61 72 74 2e 30 dd $tag $start.0
21d60 20 5b 65 78 70 72 20 7b 24 65 6e 64 20 2b 20 31 [expr {$end + 1
21d70 7d 5d 2e 30 0a 0a 7d 0a 0a 70 72 6f 63 20 61 64 }].0..}..proc ad
21d80 64 2d 69 6e 6c 69 6e 65 2d 74 61 67 20 7b 77 67 d-inline-tag {wg
21d90 74 20 74 61 67 20 6c 69 6e 65 20 73 74 61 72 74 t tag line start
21da0 63 6f 6c 20 65 6e 64 63 6f 6c 7d 20 7b 0a 20 20 col endcol} {.
21db0 20 20 24 77 67 74 20 74 61 67 20 61 64 64 20 24 $wgt tag add $
21dc0 74 61 67 20 24 6c 69 6e 65 2e 24 73 74 61 72 74 tag $line.$start
21dd0 63 6f 6c 20 24 6c 69 6e 65 2e 24 65 6e 64 63 6f col $line.$endco
21de0 6c 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 l.}..###########
21df0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21e00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21e10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21e20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21e30 23 23 23 23 0a 23 20 43 68 61 6e 67 65 20 74 68 ####.# Change th
21e40 65 20 74 61 67 20 66 6f 72 20 61 20 64 69 66 66 e tag for a diff
21e50 20 72 65 67 69 6f 6e 2e 0a 23 20 27 70 6f 73 27 region..# 'pos'
21e60 20 69 73 20 74 68 65 20 69 6e 64 65 78 20 69 6e is the index in
21e70 20 74 68 65 20 64 69 66 66 20 61 72 72 61 79 0a the diff array.
21e80 23 20 49 66 20 27 6f 6c 64 74 61 67 27 20 69 73 # If 'oldtag' is
21e90 20 70 72 65 73 65 6e 74 2c 20 66 69 72 73 74 20 present, first
21ea0 72 65 6d 6f 76 65 20 69 74 20 66 72 6f 6d 20 74 remove it from t
21eb0 68 65 20 72 65 67 69 6f 6e 0a 23 20 49 66 20 27 he region.# If '
21ec0 73 65 74 70 6f 73 27 20 69 73 20 6e 6f 6e 2d 7a setpos' is non-z
21ed0 65 72 6f 2c 20 6d 61 6b 65 20 73 75 72 65 20 74 ero, make sure t
21ee0 68 65 20 72 65 67 69 6f 6e 20 69 73 20 76 69 73 he region is vis
21ef0 69 62 6c 65 2e 0a 23 20 52 65 74 75 72 6e 73 20 ible..# Returns
21f00 74 68 65 20 64 69 66 66 20 65 78 70 72 65 73 73 the diff express
21f10 69 6f 6e 2e 0a 23 23 23 23 23 23 23 23 23 23 23 ion..###########
21f20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21f30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21f40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21f50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21f60 23 23 23 23 0a 70 72 6f 63 20 73 65 74 2d 74 61 ####.proc set-ta
21f70 67 20 7b 70 6f 73 20 6e 65 77 74 61 67 20 7b 6f g {pos newtag {o
21f80 6c 64 74 61 67 20 22 22 7d 20 7b 73 65 74 70 6f ldtag ""} {setpo
21f90 73 20 30 7d 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 s 0}} {. glob
21fa0 61 6c 20 67 20 6f 70 74 73 0a 20 20 20 20 67 6c al g opts. gl
21fb0 6f 62 61 6c 20 77 0a 0a 20 20 20 20 23 20 46 69 obal w.. # Fi
21fc0 67 75 72 65 20 6f 75 74 20 77 68 69 63 68 20 6c gure out which l
21fd0 69 6e 65 73 20 77 65 20 6e 65 65 64 20 74 6f 20 ines we need to
21fe0 61 64 64 72 65 73 73 2e 2e 2e 0a 20 20 20 20 69 address.... i
21ff0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
22000 20 67 28 73 63 72 64 69 66 66 2c 24 70 6f 73 29 g(scrdiff,$pos)
22010 5d 7d 20 7b 0a 09 72 65 74 75 72 6e 0a 20 20 20 ]} {..return.
22020 20 7d 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b }. foreach {
22030 74 68 69 73 64 69 66 66 20 73 31 20 65 31 20 73 thisdiff s1 e1 s
22040 32 20 65 32 20 64 74 7d 20 24 67 28 73 63 72 64 2 e2 dt} $g(scrd
22050 69 66 66 2c 24 70 6f 73 29 20 7b 20 7d 0a 0a 20 iff,$pos) { }..
22060 20 20 20 23 20 52 65 6d 6f 76 65 20 6f 6c 64 20 # Remove old
22070 74 61 67 0a 20 20 20 20 69 66 20 7b 22 24 6f 6c tag. if {"$ol
22080 64 74 61 67 22 20 21 3d 20 22 22 7d 20 7b 0a 09 dtag" != ""} {..
22090 73 65 74 20 65 31 6e 65 78 74 20 22 5b 65 78 70 set e1next "[exp
220a0 72 20 7b 24 65 31 20 2b 20 31 7d 5d 2e 30 22 0a r {$e1 + 1}].0".
220b0 09 73 65 74 20 65 32 6e 65 78 74 20 22 5b 65 78 .set e2next "[ex
220c0 70 72 20 7b 24 65 32 20 2b 20 31 7d 5d 2e 30 22 pr {$e2 + 1}].0"
220d0 0a 09 24 77 28 4c 65 66 74 54 65 78 74 29 20 74 ..$w(LeftText) t
220e0 61 67 20 72 65 6d 6f 76 65 20 24 6f 6c 64 74 61 ag remove $oldta
220f0 67 20 24 73 31 2e 30 20 24 65 31 6e 65 78 74 0a g $s1.0 $e1next.
22100 09 24 77 28 4c 65 66 74 49 6e 66 6f 29 20 74 61 .$w(LeftInfo) ta
22110 67 20 72 65 6d 6f 76 65 20 24 6f 6c 64 74 61 67 g remove $oldtag
22120 20 24 73 31 2e 30 20 24 65 31 6e 65 78 74 0a 09 $s1.0 $e1next..
22130 24 77 28 52 69 67 68 74 54 65 78 74 29 20 74 61 $w(RightText) ta
22140 67 20 72 65 6d 6f 76 65 20 24 6f 6c 64 74 61 67 g remove $oldtag
22150 20 24 73 32 2e 30 20 24 65 32 6e 65 78 74 0a 09 $s2.0 $e2next..
22160 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 74 61 $w(RightInfo) ta
22170 67 20 72 65 6d 6f 76 65 20 24 6f 6c 64 74 61 67 g remove $oldtag
22180 20 24 73 32 2e 30 20 24 65 32 6e 65 78 74 0a 09 $s2.0 $e2next..
22190 24 77 28 4c 65 66 74 43 42 29 20 74 61 67 20 72 $w(LeftCB) tag r
221a0 65 6d 6f 76 65 20 24 6f 6c 64 74 61 67 20 24 73 emove $oldtag $s
221b0 31 2e 30 20 24 65 31 6e 65 78 74 0a 09 24 77 28 1.0 $e1next..$w(
221c0 52 69 67 68 74 43 42 29 20 74 61 67 20 72 65 6d RightCB) tag rem
221d0 6f 76 65 20 24 6f 6c 64 74 61 67 20 24 73 32 2e ove $oldtag $s2.
221e0 30 20 24 65 32 6e 65 78 74 0a 09 63 61 74 63 68 0 $e2next..catch
221f0 20 7b 0a 09 20 20 20 20 73 65 74 20 6c 69 6e 65 {.. set line
22200 73 20 5b 64 69 66 66 2d 73 69 7a 65 20 24 70 6f s [diff-size $po
22210 73 20 24 67 28 6d 65 72 67 65 24 70 6f 73 29 5d s $g(merge$pos)]
22220 0a 09 20 20 20 20 24 77 28 6d 65 72 67 65 54 65 .. $w(mergeTe
22230 78 74 29 20 74 61 67 20 72 65 6d 6f 76 65 20 24 xt) tag remove $
22240 6f 6c 64 74 61 67 20 6d 61 72 6b 24 70 6f 73 20 oldtag mark$pos
22250 22 6d 61 72 6b 24 7b 70 6f 73 7d 2b 24 7b 6c 69 "mark${pos}+${li
22260 6e 65 73 7d 6c 69 6e 65 73 22 0a 09 7d 0a 20 20 nes}lines"..}.
22270 20 20 7d 0a 0a 20 20 20 20 73 77 69 74 63 68 20 }.. switch
22280 2d 2d 20 24 64 74 20 7b 0a 20 20 20 20 22 64 22 -- $dt {. "d"
22290 20 7b 0a 09 20 20 20 20 73 65 74 20 63 6f 6c 74 {.. set colt
222a0 61 67 20 64 65 6c 74 61 67 0a 09 20 20 20 20 73 ag deltag.. s
222b0 65 74 20 72 63 62 74 61 67 20 22 20 22 0a 09 20 et rcbtag " "..
222c0 20 20 20 73 65 74 20 6c 63 62 74 61 67 20 22 2d set lcbtag "-
222d0 22 0a 09 7d 0a 20 20 20 20 22 61 22 20 7b 0a 09 "..}. "a" {..
222e0 20 20 20 20 73 65 74 20 63 6f 6c 74 61 67 20 69 set coltag i
222f0 6e 73 74 61 67 0a 09 20 20 20 20 73 65 74 20 72 nstag.. set r
22300 63 62 74 61 67 20 22 2b 22 0a 09 20 20 20 20 73 cbtag "+".. s
22310 65 74 20 6c 63 62 74 61 67 20 22 20 22 0a 09 7d et lcbtag " "..}
22320 0a 20 20 20 20 22 63 22 20 7b 0a 09 20 20 20 20 . "c" {..
22330 73 65 74 20 63 6f 6c 74 61 67 20 63 68 67 74 61 set coltag chgta
22340 67 0a 09 20 20 20 20 73 65 74 20 72 63 62 74 61 g.. set rcbta
22350 67 20 22 21 22 0a 09 20 20 20 20 73 65 74 20 6c g "!".. set l
22360 63 62 74 61 67 20 22 21 22 0a 09 7d 0a 20 20 20 cbtag "!"..}.
22370 20 7d 0a 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f }. if {[info
22380 20 65 78 69 73 74 73 20 67 28 6f 76 65 72 6c 61 exists g(overla
22390 70 24 70 6f 73 29 5d 7d 20 7b 0a 09 73 65 74 20 p$pos)]} {..set
223a0 63 6f 6c 74 61 67 20 6f 76 65 72 6c 61 70 74 61 coltag overlapta
223b0 67 0a 09 73 65 74 20 72 63 62 74 61 67 20 22 3f g..set rcbtag "?
223c0 22 0a 09 73 65 74 20 6c 63 62 74 61 67 20 22 3f "..set lcbtag "?
223d0 22 0a 20 20 20 20 7d 0a 20 20 20 20 23 20 41 64 ". }. # Ad
223e0 64 20 6e 65 77 20 74 61 67 0a 20 20 20 20 69 66 d new tag. if
223f0 20 7b 24 6f 70 74 73 28 74 61 67 74 65 78 74 29 {$opts(tagtext)
22400 7d 20 7b 0a 09 61 64 64 2d 74 61 67 20 24 77 28 } {..add-tag $w(
22410 4c 65 66 74 54 65 78 74 29 20 24 6e 65 77 74 61 LeftText) $newta
22420 67 20 24 73 31 20 24 65 31 20 24 64 74 20 31 0a g $s1 $e1 $dt 1.
22430 09 61 64 64 2d 74 61 67 20 24 77 28 52 69 67 68 .add-tag $w(Righ
22440 74 54 65 78 74 29 20 24 6e 65 77 74 61 67 20 24 tText) $newtag $
22450 73 32 20 24 65 32 20 24 64 74 20 31 0a 09 61 64 s2 $e2 $dt 1..ad
22460 64 2d 74 61 67 20 24 77 28 52 69 67 68 74 54 65 d-tag $w(RightTe
22470 78 74 29 20 24 63 6f 6c 74 61 67 20 24 73 32 20 xt) $coltag $s2
22480 24 65 32 20 24 64 74 20 31 0a 20 20 20 20 7d 0a $e2 $dt 1. }.
22490 20 20 20 20 69 66 20 7b 24 6f 70 74 73 28 74 61 if {$opts(ta
224a0 67 63 62 73 29 7d 20 7b 0a 09 69 66 20 7b 24 6f gcbs)} {..if {$o
224b0 70 74 73 28 63 6f 6c 6f 72 63 62 73 29 7d 20 7b pts(colorcbs)} {
224c0 0a 09 20 20 20 20 61 64 64 2d 74 61 67 20 24 77 .. add-tag $w
224d0 28 4c 65 66 74 43 42 29 20 24 6c 63 62 74 61 67 (LeftCB) $lcbtag
224e0 20 24 73 31 20 24 65 31 20 24 64 74 20 31 0a 09 $s1 $e1 $dt 1..
224f0 20 20 20 20 61 64 64 2d 74 61 67 20 24 77 28 52 add-tag $w(R
22500 69 67 68 74 43 42 29 20 24 72 63 62 74 61 67 20 ightCB) $rcbtag
22510 24 73 32 20 24 65 32 20 24 64 74 20 31 0a 09 7d $s2 $e2 $dt 1..}
22520 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 61 64 64 else {.. add
22530 2d 74 61 67 20 24 77 28 4c 65 66 74 43 42 29 20 -tag $w(LeftCB)
22540 24 6e 65 77 74 61 67 20 24 73 31 20 24 65 31 20 $newtag $s1 $e1
22550 24 64 74 20 31 0a 09 20 20 20 20 61 64 64 2d 74 $dt 1.. add-t
22560 61 67 20 24 77 28 52 69 67 68 74 43 42 29 20 24 ag $w(RightCB) $
22570 6e 65 77 74 61 67 20 24 73 32 20 24 65 32 20 24 newtag $s2 $e2 $
22580 64 74 20 31 0a 09 20 20 20 20 61 64 64 2d 74 61 dt 1.. add-ta
22590 67 20 24 77 28 52 69 67 68 74 43 42 29 20 24 63 g $w(RightCB) $c
225a0 6f 6c 74 61 67 20 24 73 32 20 24 65 32 20 24 64 oltag $s2 $e2 $d
225b0 74 20 31 0a 09 7d 0a 0a 20 20 20 20 7d 0a 20 20 t 1..}.. }.
225c0 20 20 69 66 20 7b 24 6f 70 74 73 28 74 61 67 6c if {$opts(tagl
225d0 6e 29 7d 20 7b 0a 09 61 64 64 2d 74 61 67 20 24 n)} {..add-tag $
225e0 77 28 4c 65 66 74 49 6e 66 6f 29 20 24 6e 65 77 w(LeftInfo) $new
225f0 74 61 67 20 24 73 31 20 24 65 31 20 24 64 74 20 tag $s1 $e1 $dt
22600 31 0a 09 61 64 64 2d 74 61 67 20 24 77 28 52 69 1..add-tag $w(Ri
22610 67 68 74 49 6e 66 6f 29 20 24 6e 65 77 74 61 67 ghtInfo) $newtag
22620 20 24 73 32 20 24 65 32 20 24 64 74 20 31 0a 09 $s2 $e2 $dt 1..
22630 61 64 64 2d 74 61 67 20 24 77 28 52 69 67 68 74 add-tag $w(Right
22640 49 6e 66 6f 29 20 24 63 6f 6c 74 61 67 20 24 73 Info) $coltag $s
22650 32 20 24 65 32 20 24 64 74 20 31 0a 20 20 20 20 2 $e2 $dt 1.
22660 7d 0a 0a 20 20 20 20 63 61 74 63 68 20 7b 0a 09 }.. catch {..
22670 73 65 74 20 6c 69 6e 65 73 20 5b 64 69 66 66 2d set lines [diff-
22680 73 69 7a 65 20 24 70 6f 73 20 24 67 28 6d 65 72 size $pos $g(mer
22690 67 65 24 70 6f 73 29 5d 0a 09 24 77 28 6d 65 72 ge$pos)]..$w(mer
226a0 67 65 54 65 78 74 29 20 74 61 67 20 61 64 64 20 geText) tag add
226b0 24 6e 65 77 74 61 67 20 6d 61 72 6b 24 70 6f 73 $newtag mark$pos
226c0 20 22 6d 61 72 6b 24 7b 70 6f 73 7d 2b 24 7b 6c "mark${pos}+${l
226d0 69 6e 65 73 7d 6c 69 6e 65 73 22 0a 20 20 20 20 ines}lines".
226e0 7d 0a 0a 20 20 20 20 23 20 4d 6f 76 65 20 74 68 }.. # Move th
226f0 65 20 76 69 65 77 20 6f 6e 20 62 6f 74 68 20 74 e view on both t
22700 65 78 74 20 77 69 64 67 65 74 73 20 73 6f 20 74 ext widgets so t
22710 68 61 74 20 74 68 65 20 6e 65 77 20 72 65 67 69 hat the new regi
22720 6f 6e 20 69 73 0a 20 20 20 20 23 20 76 69 73 69 on is. # visi
22730 62 6c 65 2e 0a 20 20 20 20 69 66 20 7b 24 73 65 ble.. if {$se
22740 74 70 6f 73 7d 20 7b 0a 09 69 66 20 7b 24 6f 70 tpos} {..if {$op
22750 74 73 28 61 75 74 6f 63 65 6e 74 65 72 29 7d 20 ts(autocenter)}
22760 7b 0a 09 20 20 20 20 63 65 6e 74 65 72 0a 09 7d {.. center..}
22770 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 24 77 28 else {.. $w(
22780 4c 65 66 74 54 65 78 74 29 20 73 65 65 20 24 73 LeftText) see $s
22790 31 2e 30 0a 09 20 20 20 20 24 77 28 52 69 67 68 1.0.. $w(Righ
227a0 74 54 65 78 74 29 20 73 65 65 20 24 73 32 2e 30 tText) see $s2.0
227b0 0a 09 20 20 20 20 24 77 28 4c 65 66 74 54 65 78 .. $w(LeftTex
227c0 74 29 20 6d 61 72 6b 20 73 65 74 20 69 6e 73 65 t) mark set inse
227d0 72 74 20 24 73 31 2e 30 0a 09 20 20 20 20 24 77 rt $s1.0.. $w
227e0 28 52 69 67 68 74 54 65 78 74 29 20 6d 61 72 6b (RightText) mark
227f0 20 73 65 74 20 69 6e 73 65 72 74 20 24 73 32 2e set insert $s2.
22800 30 0a 0a 09 20 20 20 20 69 66 20 7b 24 67 28 73 0... if {$g(s
22810 68 6f 77 6d 65 72 67 65 29 7d 20 7b 0a 09 09 24 howmerge)} {...$
22820 77 28 6d 65 72 67 65 54 65 78 74 29 20 73 65 65 w(mergeText) see
22830 20 6d 61 72 6b 24 70 6f 73 0a 09 20 20 20 20 7d mark$pos.. }
22840 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 ..}. }.. #
22850 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 20 73 make sure the s
22860 65 6c 20 74 61 67 20 68 61 73 20 74 68 65 20 68 el tag has the h
22870 69 67 68 65 73 74 20 70 72 69 6f 72 69 74 79 0a ighest priority.
22880 20 20 20 20 66 6f 72 65 61 63 68 20 77 69 6e 64 foreach wind
22890 6f 77 20 5b 6c 69 73 74 20 4c 65 66 74 54 65 78 ow [list LeftTex
228a0 74 20 52 69 67 68 74 54 65 78 74 20 4c 65 66 74 t RightText Left
228b0 43 42 20 52 69 67 68 74 43 42 20 4c 65 66 74 49 CB RightCB LeftI
228c0 6e 66 6f 20 52 69 67 68 74 49 6e 66 6f 5d 20 7b nfo RightInfo] {
228d0 0a 09 24 77 28 24 77 69 6e 64 6f 77 29 20 74 61 ..$w($window) ta
228e0 67 20 72 61 69 73 65 20 73 65 6c 0a 09 24 77 28 g raise sel..$w(
228f0 24 77 69 6e 64 6f 77 29 20 74 61 67 20 72 61 69 $window) tag rai
22900 73 65 20 69 6e 6c 69 6e 65 74 61 67 0a 20 20 20 se inlinetag.
22910 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 24 }.. return $
22920 74 68 69 73 64 69 66 66 0a 7d 0a 0a 23 23 23 23 thisdiff.}..####
22930 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22940 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22950 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22960 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22970 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 6d 6f ###########.# mo
22980 76 65 73 20 74 6f 20 74 68 65 20 64 69 66 66 20 ves to the diff
22990 6e 65 61 72 65 73 74 20 74 68 65 20 69 6e 73 65 nearest the inse
229a0 72 74 69 6f 6e 20 63 75 72 73 6f 72 20 6f 72 20 rtion cursor or
229b0 74 68 65 20 6d 6f 75 73 65 20 63 6c 69 63 6b 2c the mouse click,
229c0 0a 23 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 .# depending on
229d0 24 6d 6f 64 65 20 28 77 68 69 63 68 20 73 68 6f $mode (which sho
229e0 75 6c 64 20 62 65 20 65 69 74 68 65 72 20 22 78 uld be either "x
229f0 79 22 20 6f 72 20 22 6d 61 72 6b 22 29 0a 23 23 y" or "mark").##
22a00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22a10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22a20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22a30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22a40 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
22a50 6f 63 20 6d 6f 76 65 4e 65 61 72 65 73 74 20 7b oc moveNearest {
22a60 77 69 6e 64 6f 77 20 6d 6f 64 65 20 61 72 67 73 window mode args
22a70 7d 20 7b 0a 20 20 20 20 73 77 69 74 63 68 20 2d } {. switch -
22a80 2d 20 24 6d 6f 64 65 20 7b 0a 20 20 20 20 22 78 - $mode {. "x
22a90 79 22 20 7b 0a 09 20 20 20 20 73 65 74 20 78 20 y" {.. set x
22aa0 5b 6c 69 6e 64 65 78 20 24 61 72 67 73 20 30 5d [lindex $args 0]
22ab0 0a 09 20 20 20 20 73 65 74 20 79 20 5b 6c 69 6e .. set y [lin
22ac0 64 65 78 20 24 61 72 67 73 20 31 5d 0a 09 20 20 dex $args 1]..
22ad0 20 20 73 65 74 20 69 6e 64 65 78 20 5b 24 77 69 set index [$wi
22ae0 6e 64 6f 77 20 69 6e 64 65 78 20 40 24 78 2c 24 ndow index @$x,$
22af0 79 5d 0a 0a 09 20 20 20 20 73 65 74 20 6c 69 6e y]... set lin
22b00 65 20 5b 65 78 70 72 20 7b 69 6e 74 28 24 69 6e e [expr {int($in
22b10 64 65 78 29 7d 5d 0a 09 20 20 20 20 73 65 74 20 dex)}].. set
22b20 64 69 66 66 20 5b 66 69 6e 64 2d 64 69 66 66 20 diff [find-diff
22b30 24 6c 69 6e 65 5d 0a 09 7d 0a 20 20 20 20 22 6d $line]..}. "m
22b40 61 72 6b 22 20 7b 0a 09 20 20 20 20 73 65 74 20 ark" {.. set
22b50 69 6e 64 65 78 20 5b 24 77 69 6e 64 6f 77 20 69 index [$window i
22b60 6e 64 65 78 20 5b 6c 69 6e 64 65 78 20 24 61 72 ndex [lindex $ar
22b70 67 73 20 30 5d 5d 0a 09 20 20 20 20 73 65 74 20 gs 0]].. set
22b80 6c 69 6e 65 20 5b 65 78 70 72 20 7b 69 6e 74 28 line [expr {int(
22b90 24 69 6e 64 65 78 29 7d 5d 0a 09 20 20 20 20 73 $index)}].. s
22ba0 65 74 20 64 69 66 66 20 5b 66 69 6e 64 2d 64 69 et diff [find-di
22bb0 66 66 20 24 6c 69 6e 65 5d 0a 09 7d 0a 20 20 20 ff $line]..}.
22bc0 20 7d 0a 0a 20 20 20 20 23 20 6f 6b 2c 20 77 65 }.. # ok, we
22bd0 20 68 61 76 65 20 61 6e 20 69 6e 64 65 78 0a 20 have an index.
22be0 20 20 20 6d 6f 76 65 20 5b 6c 69 6e 64 65 78 20 move [lindex
22bf0 24 64 69 66 66 20 30 5d 20 30 20 31 0a 7d 0a 0a $diff 0] 0 1.}..
22c00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
22c50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
22ca0 70 72 6f 63 20 6d 6f 76 65 54 6f 20 7b 77 69 6e proc moveTo {win
22cb0 64 6f 77 20 76 61 6c 75 65 7d 20 7b 0a 20 20 20 dow value} {.
22cc0 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 6c global w. gl
22cd0 6f 62 61 6c 20 67 0a 20 20 20 20 23 20 77 65 20 obal g. # we
22ce0 6b 6e 6f 77 20 74 68 61 74 20 74 68 65 20 76 61 know that the va
22cf0 6c 75 65 20 69 73 20 70 72 65 66 69 78 65 64 20 lue is prefixed
22d00 62 79 20 74 68 65 20 6e 75 6e 62 65 72 2f 69 6e by the nunber/in
22d10 64 65 78 20 6f 66 0a 20 20 20 20 23 20 74 68 65 dex of. # the
22d20 20 64 69 66 66 20 74 68 65 20 75 73 65 72 20 77 diff the user w
22d30 61 6e 74 73 2e 20 53 6f 2c 20 6a 75 73 74 20 67 ants. So, just g
22d40 72 61 62 20 74 68 61 74 20 6f 75 74 20 6f 66 20 rab that out of
22d50 74 68 65 20 73 74 72 69 6e 67 0a 20 20 20 20 72 the string. r
22d60 65 67 65 78 70 20 7b 28 5b 30 2d 39 5d 2b 29 20 egexp {([0-9]+)
22d70 2a 3a 7d 20 24 76 61 6c 75 65 20 6d 61 74 63 68 *:} $value match
22d80 56 61 72 20 69 6e 64 65 78 0a 20 20 20 20 6d 6f Var index. mo
22d90 76 65 20 24 69 6e 64 65 78 20 30 20 31 0a 7d 0a ve $index 0 1.}.
22da0 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
22db0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22dc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22dd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22df0 0a 23 20 74 68 69 73 20 69 73 20 63 61 6c 6c 65 .# this is calle
22e00 64 20 77 68 65 6e 20 74 68 65 20 75 73 65 72 20 d when the user
22e10 73 63 72 6f 6c 6c 73 20 74 68 65 20 6d 61 70 20 scrolls the map
22e20 74 68 75 6d 62 20 69 6e 74 65 72 61 63 74 69 76 thumb interactiv
22e30 65 6c 79 2e 0a 23 23 23 23 23 23 23 23 23 23 23 ely..###########
22e40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22e50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22e60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22e70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22e80 23 23 23 23 0a 70 72 6f 63 20 6d 61 70 2d 73 65 ####.proc map-se
22e90 65 6b 20 7b 79 7d 20 7b 0a 20 20 20 20 67 6c 6f ek {y} {. glo
22ea0 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c bal g. global
22eb0 20 77 0a 0a 20 20 20 20 73 65 74 20 79 76 69 65 w.. set yvie
22ec0 77 20 5b 65 78 70 72 20 7b 28 64 6f 75 62 6c 65 w [expr {(double
22ed0 28 24 79 29 20 2f 20 64 6f 75 62 6c 65 28 24 67 ($y) / double($g
22ee0 28 6d 61 70 68 65 69 67 68 74 29 29 29 7d 5d 0a (mapheight)))}].
22ef0 0a 20 20 20 20 23 20 53 68 6f 77 20 74 65 78 74 . # Show text
22f00 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
22f10 6f 20 6d 61 70 3b 0a 20 20 20 20 24 77 28 52 69 o map;. $w(Ri
22f20 67 68 74 54 65 78 74 29 20 79 76 69 65 77 20 6d ghtText) yview m
22f30 6f 76 65 74 6f 20 24 79 76 69 65 77 0a 7d 0a 0a oveto $yview.}..
22f40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22f50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22f60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22f70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22f80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
22f90 23 20 4d 6f 76 65 20 74 68 65 20 22 63 75 72 72 # Move the "curr
22fa0 65 6e 74 22 20 64 69 66 66 20 69 6e 64 69 63 61 ent" diff indica
22fb0 74 6f 72 20 28 69 2e 65 2e 20 67 6f 20 74 6f 20 tor (i.e. go to
22fc0 74 68 65 20 6e 65 78 74 20 6f 72 20 70 72 65 76 the next or prev
22fd0 69 6f 75 73 20 64 69 66 66 0a 23 20 72 65 67 69 ious diff.# regi
22fe0 6f 6e 20 69 66 20 22 72 65 6c 61 74 69 76 65 22 on if "relative"
22ff0 20 69 73 20 31 3b 20 67 6f 20 74 6f 20 61 6e 20 is 1; go to an
23000 61 62 73 6f 6c 75 74 65 20 64 69 66 66 20 6e 75 absolute diff nu
23010 6d 62 65 72 20 69 66 20 22 72 65 6c 61 74 69 76 mber if "relativ
23020 65 22 0a 23 20 69 73 20 30 29 2e 0a 23 23 23 23 e".# is 0)..####
23030 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
23040 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
23050 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
23060 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
23070 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
23080 20 6d 6f 76 65 20 7b 76 61 6c 75 65 20 7b 72 65 move {value {re
23090 6c 61 74 69 76 65 20 31 7d 20 7b 73 65 74 70 6f lative 1} {setpo
230a0 73 20 31 7d 7d 20 7b 0a 20 20 20 20 23 64 65 62 s 1}} {. #deb
230b0 75 67 2d 69 6e 66 6f 20 22 6d 6f 76 65 20 24 76 ug-info "move $v
230c0 61 6c 75 65 20 24 72 65 6c 61 74 69 76 65 20 24 alue $relative $
230d0 73 65 74 70 6f 73 22 0a 20 20 20 20 67 6c 6f 62 setpos". glob
230e0 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 al g. global
230f0 77 0a 0a 20 20 20 20 69 66 20 7b 24 76 61 6c 75 w.. if {$valu
23100 65 20 3d 3d 20 22 66 69 72 73 74 22 7d 20 7b 0a e == "first"} {.
23110 09 73 65 74 20 76 61 6c 75 65 20 31 0a 09 73 65 .set value 1..se
23120 74 20 72 65 6c 61 74 69 76 65 20 30 0a 20 20 20 t relative 0.
23130 20 7d 0a 20 20 20 20 69 66 20 7b 24 76 61 6c 75 }. if {$valu
23140 65 20 3d 3d 20 22 6c 61 73 74 22 7d 20 7b 0a 09 e == "last"} {..
23150 73 65 74 20 76 61 6c 75 65 20 24 67 28 63 6f 75 set value $g(cou
23160 6e 74 29 0a 09 73 65 74 20 72 65 6c 61 74 69 76 nt)..set relativ
23170 65 20 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 e 0. }.. #
23180 20 52 65 6d 6f 76 65 20 6f 6c 64 20 27 63 75 72 Remove old 'cur
23190 72 27 20 74 61 67 0a 20 20 20 20 73 65 74 2d 74 r' tag. set-t
231a0 61 67 20 24 67 28 70 6f 73 29 20 64 69 66 66 74 ag $g(pos) difft
231b0 61 67 20 63 75 72 72 74 61 67 0a 0a 20 20 20 20 ag currtag..
231c0 23 20 42 75 6d 70 20 27 70 6f 73 27 20 28 6f 6e # Bump 'pos' (on
231d0 65 20 77 61 79 20 6f 72 20 74 68 65 20 6f 74 68 e way or the oth
231e0 65 72 29 2e 0a 20 20 20 20 69 66 20 7b 24 72 65 er).. if {$re
231f0 6c 61 74 69 76 65 7d 20 7b 0a 09 73 65 74 20 67 lative} {..set g
23200 28 70 6f 73 29 20 5b 65 78 70 72 20 7b 24 67 28 (pos) [expr {$g(
23210 70 6f 73 29 20 2b 20 24 76 61 6c 75 65 7d 5d 0a pos) + $value}].
23220 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 } else {..se
23230 74 20 67 28 70 6f 73 29 20 24 76 61 6c 75 65 0a t g(pos) $value.
23240 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 52 61 6e }.. # Ran
23250 67 65 20 63 68 65 63 6b 20 27 70 6f 73 27 2e 0a ge check 'pos'..
23260 20 20 20 20 73 65 74 20 67 28 70 6f 73 29 20 5b set g(pos) [
23270 6d 61 78 20 24 67 28 70 6f 73 29 20 31 5d 0a 20 max $g(pos) 1].
23280 20 20 20 73 65 74 20 67 28 70 6f 73 29 20 5b 6d set g(pos) [m
23290 69 6e 20 24 67 28 70 6f 73 29 20 24 67 28 63 6f in $g(pos) $g(co
232a0 75 6e 74 29 5d 0a 0a 20 20 20 20 23 20 53 65 74 unt)].. # Set
232b0 20 6e 65 77 20 27 63 75 72 72 27 20 74 61 67 0a new 'curr' tag.
232c0 20 20 20 20 73 65 74 20 67 28 63 75 72 72 64 69 set g(currdi
232d0 66 66 29 20 5b 73 65 74 2d 74 61 67 20 24 67 28 ff) [set-tag $g(
232e0 70 6f 73 29 20 63 75 72 72 74 61 67 20 22 22 20 pos) currtag ""
232f0 24 73 65 74 70 6f 73 5d 0a 0a 20 20 20 20 23 20 $setpos].. #
23300 75 70 64 61 74 65 20 74 68 65 20 62 75 74 74 6f update the butto
23310 6e 73 2e 2e 0a 20 20 20 20 23 64 65 62 75 67 2d ns... #debug-
23320 69 6e 66 6f 20 22 20 20 20 2e 2e 2e 75 70 64 61 info " ...upda
23330 74 65 2d 64 69 73 70 6c 61 79 20 66 72 6f 6d 20 te-display from
23340 6d 6f 76 65 22 0a 20 20 20 20 75 70 64 61 74 65 move". update
23350 2d 64 69 73 70 6c 61 79 0a 0a 7d 0a 0a 70 72 6f -display..}..pro
23360 63 20 75 70 64 61 74 65 2d 64 69 73 70 6c 61 79 c update-display
23370 20 7b 7d 20 7b 0a 20 20 20 20 23 64 65 62 75 67 {} {. #debug
23380 2d 69 6e 66 6f 20 22 75 70 64 61 74 65 2d 64 69 -info "update-di
23390 73 70 6c 61 79 22 0a 20 20 20 20 67 6c 6f 62 61 splay". globa
233a0 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 l g. global w
233b0 0a 0a 20 20 20 20 23 64 65 62 75 67 2d 69 6e 66 .. #debug-inf
233c0 6f 20 22 20 20 69 6e 69 74 5f 4f 4b 20 24 67 28 o " init_OK $g(
233d0 69 6e 69 74 4f 4b 29 22 0a 20 20 20 20 23 64 65 initOK)". #de
233e0 62 75 67 2d 69 6e 66 6f 20 22 20 20 73 74 61 72 bug-info " star
233f0 74 65 64 20 24 67 28 73 74 61 72 74 65 64 29 22 ted $g(started)"
23400 0a 20 20 20 20 23 69 66 20 7b 21 24 67 28 73 74 . #if {!$g(st
23410 61 72 74 65 64 29 7d 20 72 65 74 75 72 6e 0a 20 arted)} return.
23420 20 20 20 69 66 20 7b 21 24 67 28 69 6e 69 74 4f if {!$g(initO
23430 4b 29 7d 20 7b 0a 09 23 20 64 69 73 61 62 6c 65 K)} {..# disable
23440 20 64 61 72 6e 20 6e 65 61 72 20 65 76 65 72 79 darn near every
23450 74 68 69 6e 67 0a 0a 09 66 6f 72 65 61 63 68 20 thing...foreach
23460 62 20 5b 6c 69 73 74 20 72 65 64 69 66 66 20 66 b [list rediff f
23470 69 6e 64 20 70 72 65 76 44 69 66 66 20 66 69 72 ind prevDiff fir
23480 73 74 44 69 66 66 20 6e 65 78 74 44 69 66 66 20 stDiff nextDiff
23490 6c 61 73 74 44 69 66 66 20 5c 0a 09 20 20 63 65 lastDiff \.. ce
234a0 6e 74 65 72 44 69 66 66 73 20 6d 65 72 67 65 43 nterDiffs mergeC
234b0 68 6f 69 63 65 31 20 6d 65 72 67 65 43 68 6f 69 hoice1 mergeChoi
234c0 63 65 32 20 6d 65 72 67 65 43 68 6f 69 63 65 31 ce2 mergeChoice1
234d0 32 20 6d 65 72 67 65 43 68 6f 69 63 65 32 31 5d 2 mergeChoice21]
234e0 20 7b 0a 09 20 20 20 20 24 77 28 24 7b 62 7d 5f {.. $w(${b}_
234f0 69 6d 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 im) configure -s
23500 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 20 tate disabled..
23510 20 20 20 24 77 28 24 7b 62 7d 5f 74 78 29 20 63 $w(${b}_tx) c
23520 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 onfigure -state
23530 64 69 73 61 62 6c 65 64 0a 09 7d 0a 09 66 6f 72 disabled..}..for
23540 65 61 63 68 20 6d 65 6e 75 20 5b 6c 69 73 74 20 each menu [list
23550 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 24 77 $w(popupMenu) $w
23560 28 76 69 65 77 4d 65 6e 75 29 5d 20 7b 0a 09 20 (viewMenu)] {..
23570 20 20 20 24 6d 65 6e 75 20 65 6e 74 72 79 63 6f $menu entryco
23580 6e 66 69 67 75 72 65 20 22 50 72 65 76 69 6f 75 nfigure "Previou
23590 73 2a 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 s*" -state disab
235a0 6c 65 64 0a 09 20 20 20 20 24 6d 65 6e 75 20 65 led.. $menu e
235b0 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 46 ntryconfigure "F
235c0 69 72 73 74 2a 22 20 2d 73 74 61 74 65 20 64 69 irst*" -state di
235d0 73 61 62 6c 65 64 0a 09 20 20 20 20 24 6d 65 6e sabled.. $men
235e0 75 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 u entryconfigure
235f0 20 22 4e 65 78 74 2a 22 20 2d 73 74 61 74 65 20 "Next*" -state
23600 64 69 73 61 62 6c 65 64 0a 09 20 20 20 20 24 6d disabled.. $m
23610 65 6e 75 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 enu entryconfigu
23620 72 65 20 22 4c 61 73 74 2a 22 20 2d 73 74 61 74 re "Last*" -stat
23630 65 20 64 69 73 61 62 6c 65 64 0a 09 20 20 20 20 e disabled..
23640 24 6d 65 6e 75 20 65 6e 74 72 79 63 6f 6e 66 69 $menu entryconfi
23650 67 75 72 65 20 22 43 65 6e 74 65 72 2a 22 20 2d gure "Center*" -
23660 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
23670 7d 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 }..$w(popupMenu)
23680 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 entryconfigure
23690 22 46 69 6e 64 2e 2e 2e 22 20 2d 73 74 61 74 65 "Find..." -state
236a0 20 64 69 73 61 62 6c 65 64 0a 09 24 77 28 70 6f disabled..$w(po
236b0 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f pupMenu) entryco
236c0 6e 66 69 67 75 72 65 20 22 46 69 6e 64 20 4e 65 nfigure "Find Ne
236d0 61 72 65 73 74 2a 22 20 2d 73 74 61 74 65 20 64 arest*" -state d
236e0 69 73 61 62 6c 65 64 0a 09 24 77 28 70 6f 70 75 isabled..$w(popu
236f0 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 pMenu) entryconf
23700 69 67 75 72 65 20 22 45 64 69 74 2a 22 20 2d 73 igure "Edit*" -s
23710 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 0a 09 tate disabled...
23720 24 77 28 65 64 69 74 4d 65 6e 75 29 20 65 6e 74 $w(editMenu) ent
23730 72 79 63 6f 6e 66 69 67 75 72 65 20 22 46 69 6e ryconfigure "Fin
23740 64 2a 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 d*" -state disab
23750 6c 65 64 0a 09 24 77 28 65 64 69 74 4d 65 6e 75 led..$w(editMenu
23760 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
23770 20 22 45 64 69 74 20 46 69 6c 65 20 31 22 20 2d "Edit File 1" -
23780 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
23790 24 77 28 65 64 69 74 4d 65 6e 75 29 20 65 6e 74 $w(editMenu) ent
237a0 72 79 63 6f 6e 66 69 67 75 72 65 20 22 45 64 69 ryconfigure "Edi
237b0 74 20 46 69 6c 65 20 32 22 20 2d 73 74 61 74 65 t File 2" -state
237c0 20 64 69 73 61 62 6c 65 64 0a 0a 09 24 77 28 66 disabled...$w(f
237d0 69 6c 65 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f ileMenu) entryco
237e0 6e 66 69 67 75 72 65 20 22 57 72 69 74 65 2a 22 nfigure "Write*"
237f0 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 -state disabled
23800 0a 09 24 77 28 66 69 6c 65 4d 65 6e 75 29 20 65 ..$w(fileMenu) e
23810 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 52 ntryconfigure "R
23820 65 63 6f 6d 70 75 74 65 2a 22 20 2d 73 74 61 74 ecompute*" -stat
23830 65 20 64 69 73 61 62 6c 65 64 0a 0a 09 24 77 28 e disabled...$w(
23840 6d 65 72 67 65 4d 65 6e 75 29 20 65 6e 74 72 79 mergeMenu) entry
23850 63 6f 6e 66 69 67 75 72 65 20 22 53 68 6f 77 2a configure "Show*
23860 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 " -state disable
23870 64 0a 09 24 77 28 6d 65 72 67 65 4d 65 6e 75 29 d..$w(mergeMenu)
23880 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 entryconfigure
23890 22 57 72 69 74 65 2a 22 20 2d 73 74 61 74 65 20 "Write*" -state
238a0 64 69 73 61 62 6c 65 64 0a 0a 09 24 77 28 6d 61 disabled...$w(ma
238b0 72 6b 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e rkMenu) entrycon
238c0 66 69 67 75 72 65 20 22 4d 61 72 6b 2a 22 20 2d figure "Mark*" -
238d0 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
238e0 24 77 28 6d 61 72 6b 4d 65 6e 75 29 20 65 6e 74 $w(markMenu) ent
238f0 72 79 63 6f 6e 66 69 67 75 72 65 20 22 43 6c 65 ryconfigure "Cle
23900 61 72 2a 22 20 2d 73 74 61 74 65 20 64 69 73 61 ar*" -state disa
23910 62 6c 65 64 0a 0a 20 20 20 20 7d 20 65 6c 73 65 bled.. } else
23920 20 7b 0a 09 23 20 74 68 65 73 65 20 61 72 65 20 {..# these are
23930 61 6c 77 61 79 73 20 65 6e 61 62 6c 65 64 2c 20 always enabled,
23940 61 73 73 75 6d 69 6e 67 20 77 65 20 68 61 76 65 assuming we have
23950 20 70 72 6f 70 65 72 6c 79 0a 09 23 20 64 69 66 properly..# dif
23960 66 65 64 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 fed a couple of
23970 66 69 6c 65 73 0a 09 24 77 28 70 6f 70 75 70 4d files..$w(popupM
23980 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 enu) entryconfig
23990 75 72 65 20 22 46 69 6e 64 2e 2e 2e 22 20 2d 73 ure "Find..." -s
239a0 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 tate normal..$w(
239b0 70 6f 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 popupMenu) entry
239c0 63 6f 6e 66 69 67 75 72 65 20 22 46 69 6e 64 20 configure "Find
239d0 4e 65 61 72 65 73 74 2a 22 20 2d 73 74 61 74 65 Nearest*" -state
239e0 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 70 6f 70 75 normal..$w(popu
239f0 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 pMenu) entryconf
23a00 69 67 75 72 65 20 22 45 64 69 74 2a 22 20 2d 73 igure "Edit*" -s
23a10 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a 09 66 6f tate normal...fo
23a20 72 65 61 63 68 20 62 20 5b 6c 69 73 74 20 72 65 reach b [list re
23a30 64 69 66 66 20 66 69 6e 64 20 70 72 65 76 44 69 diff find prevDi
23a40 66 66 20 66 69 72 73 74 44 69 66 66 20 6e 65 78 ff firstDiff nex
23a50 74 44 69 66 66 20 6c 61 73 74 44 69 66 66 20 5c tDiff lastDiff \
23a60 0a 09 20 20 63 65 6e 74 65 72 44 69 66 66 73 5d .. centerDiffs]
23a70 20 7b 0a 09 20 20 20 20 24 77 28 24 7b 62 7d 5f {.. $w(${b}_
23a80 69 6d 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 im) configure -s
23a90 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20 tate normal..
23aa0 20 24 77 28 24 7b 62 7d 5f 74 78 29 20 63 6f 6e $w(${b}_tx) con
23ab0 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f figure -state no
23ac0 72 6d 61 6c 0a 09 7d 0a 09 66 6f 72 65 61 63 68 rmal..}..foreach
23ad0 20 62 20 5b 6c 69 73 74 20 6d 65 72 67 65 43 68 b [list mergeCh
23ae0 6f 69 63 65 31 20 6d 65 72 67 65 43 68 6f 69 63 oice1 mergeChoic
23af0 65 32 20 6d 65 72 67 65 43 68 6f 69 63 65 31 32 e2 mergeChoice12
23b00 20 6d 65 72 67 65 43 68 6f 69 63 65 32 31 5d 20 mergeChoice21]
23b10 7b 0a 09 20 20 20 20 24 77 28 24 7b 62 7d 5f 69 {.. $w(${b}_i
23b20 6d 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 m) configure -st
23b30 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20 20 ate normal..
23b40 24 77 28 24 7b 62 7d 5f 74 78 29 20 63 6f 6e 66 $w(${b}_tx) conf
23b50 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 igure -state nor
23b60 6d 61 6c 0a 09 7d 0a 0a 09 24 77 28 65 64 69 74 mal..}...$w(edit
23b70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 Menu) entryconfi
23b80 67 75 72 65 20 22 46 69 6e 64 2a 22 20 2d 73 74 gure "Find*" -st
23b90 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 65 ate normal..$w(e
23ba0 64 69 74 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f ditMenu) entryco
23bb0 6e 66 69 67 75 72 65 20 22 45 64 69 74 20 46 69 nfigure "Edit Fi
23bc0 6c 65 20 31 22 20 2d 73 74 61 74 65 20 6e 6f 72 le 1" -state nor
23bd0 6d 61 6c 0a 09 24 77 28 65 64 69 74 4d 65 6e 75 mal..$w(editMenu
23be0 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
23bf0 20 22 45 64 69 74 20 46 69 6c 65 20 32 22 20 2d "Edit File 2" -
23c00 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a 09 24 state normal...$
23c10 77 28 66 69 6c 65 4d 65 6e 75 29 20 65 6e 74 72 w(fileMenu) entr
23c20 79 63 6f 6e 66 69 67 75 72 65 20 22 57 72 69 74 yconfigure "Writ
23c30 65 2a 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 e*" -state norma
23c40 6c 0a 09 24 77 28 66 69 6c 65 4d 65 6e 75 29 20 l..$w(fileMenu)
23c50 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 entryconfigure "
23c60 52 65 63 6f 6d 70 75 74 65 2a 22 20 2d 73 74 61 Recompute*" -sta
23c70 74 65 20 6e 6f 72 6d 61 6c 0a 0a 09 24 77 28 6d te normal...$w(m
23c80 65 72 67 65 4d 65 6e 75 29 20 65 6e 74 72 79 63 ergeMenu) entryc
23c90 6f 6e 66 69 67 75 72 65 20 22 53 68 6f 77 2a 22 onfigure "Show*"
23ca0 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 -state normal..
23cb0 24 77 28 6d 65 72 67 65 4d 65 6e 75 29 20 65 6e $w(mergeMenu) en
23cc0 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 57 72 tryconfigure "Wr
23cd0 69 74 65 2a 22 20 2d 73 74 61 74 65 20 6e 6f 72 ite*" -state nor
23ce0 6d 61 6c 0a 0a 09 24 77 28 66 69 6e 64 5f 69 6d mal...$w(find_im
23cf0 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
23d00 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 66 69 te normal..$w(fi
23d10 6e 64 5f 74 78 29 20 63 6f 6e 66 69 67 75 72 65 nd_tx) configure
23d20 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a -state normal..
23d30 09 23 20 48 6d 6d 6d 2e 2e 2e 2e 20 6f 6e 20 6d .# Hmmm.... on m
23d40 79 20 4d 61 63 20 74 68 65 20 63 6f 6d 62 6f 62 y Mac the combob
23d50 6f 78 20 66 6c 61 73 68 65 73 20 69 66 20 77 65 ox flashes if we
23d60 20 64 6f 6e 27 74 20 61 64 64 20 74 68 69 73 0a don't add this.
23d70 09 23 20 63 68 65 63 6b 2e 20 49 73 20 74 68 69 .# check. Is thi
23d80 73 20 61 20 62 75 67 20 69 6e 20 41 71 75 61 54 s a bug in AquaT
23d90 6b 2c 20 6f 72 20 69 6e 20 6d 79 20 63 6f 6d 62 k, or in my comb
23da0 6f 62 6f 78 2e 2e 2e 20 3a 2d 7c 0a 09 69 66 20 obox... :-|..if
23db0 7b 5b 24 77 28 63 6f 6d 62 6f 29 20 63 67 65 74 {[$w(combo) cget
23dc0 20 2d 73 74 61 74 65 5d 20 21 3d 20 22 6e 6f 72 -state] != "nor
23dd0 6d 61 6c 22 7d 20 7b 0a 09 20 20 20 20 24 77 28 mal"} {.. $w(
23de0 63 6f 6d 62 6f 29 20 63 6f 6e 66 69 67 75 72 65 combo) configure
23df0 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 -state normal..
23e00 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 55 }. }.. # U
23e10 70 64 61 74 65 20 74 68 65 20 74 6f 67 67 6c 65 pdate the toggle
23e20 73 2e 0a 20 20 20 20 69 66 20 7b 24 67 28 63 6f s.. if {$g(co
23e30 75 6e 74 29 7d 20 7b 0a 09 73 65 74 20 67 28 74 unt)} {..set g(t
23e40 6f 67 67 6c 65 29 20 24 67 28 6d 65 72 67 65 24 oggle) $g(merge$
23e50 67 28 70 6f 73 29 29 0a 20 20 20 20 7d 0a 0a 20 g(pos)). }..
23e60 20 20 20 23 20 75 70 64 61 74 65 20 74 68 65 20 # update the
23e70 73 74 61 74 75 73 20 6c 69 6e 65 0a 20 20 20 20 status line.
23e80 73 65 74 20 67 28 73 74 61 74 75 73 43 75 72 72 set g(statusCurr
23e90 65 6e 74 29 20 22 24 67 28 70 6f 73 29 20 6f 66 ent) "$g(pos) of
23ea0 20 24 67 28 63 6f 75 6e 74 29 22 0a 20 20 20 20 $g(count)".
23eb0 73 68 6f 77 2d 69 6e 66 6f 20 24 67 28 73 74 61 show-info $g(sta
23ec0 74 75 73 43 75 72 72 65 6e 74 29 0a 0a 20 20 20 tusCurrent)..
23ed0 20 23 20 75 70 64 61 74 65 20 74 68 65 20 63 6f # update the co
23ee0 6d 62 6f 62 6f 78 2e 20 57 65 20 64 6f 6e 27 74 mbobox. We don't
23ef0 20 77 61 6e 74 20 69 74 73 20 63 6f 6d 6d 61 6e want its comman
23f00 64 20 74 6f 20 66 69 72 65 2c 20 73 6f 0a 20 20 d to fire, so.
23f10 20 20 23 20 77 65 27 6c 6c 20 64 69 73 61 62 6c # we'll disabl
23f20 65 20 69 74 20 74 65 6d 70 6f 72 61 72 69 6c 79 e it temporarily
23f30 0a 20 20 20 20 24 77 28 63 6f 6d 62 6f 29 20 63 . $w(combo) c
23f40 6f 6e 66 69 67 75 72 65 20 2d 63 6f 6d 6d 61 6e onfigure -comman
23f50 64 73 74 61 74 65 20 22 64 69 73 61 62 6c 65 64 dstate "disabled
23f60 22 0a 20 20 20 20 73 65 74 20 69 20 5b 65 78 70 ". set i [exp
23f70 72 20 7b 24 67 28 70 6f 73 29 20 2d 20 31 7d 5d r {$g(pos) - 1}]
23f80 0a 20 20 20 20 24 77 28 63 6f 6d 62 6f 29 20 63 . $w(combo) c
23f90 6f 6e 66 69 67 75 72 65 20 2d 76 61 6c 75 65 20 onfigure -value
23fa0 5b 6c 69 6e 64 65 78 20 5b 24 77 28 63 6f 6d 62 [lindex [$w(comb
23fb0 6f 29 20 6c 69 73 74 20 67 65 74 20 30 20 65 6e o) list get 0 en
23fc0 64 5d 20 24 69 5d 0a 20 20 20 20 24 77 28 63 6f d] $i]. $w(co
23fd0 6d 62 6f 29 20 73 65 6c 65 63 74 69 6f 6e 20 63 mbo) selection c
23fe0 6c 65 61 72 0a 20 20 20 20 24 77 28 63 6f 6d 62 lear. $w(comb
23ff0 6f 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 63 6f o) configure -co
24000 6d 6d 61 6e 64 73 74 61 74 65 20 22 6e 6f 72 6d mmandstate "norm
24010 61 6c 22 0a 0a 20 20 20 20 23 20 75 70 64 61 74 al".. # updat
24020 65 20 74 68 65 20 77 69 64 67 65 74 73 0a 20 20 e the widgets.
24030 20 20 69 66 20 7b 24 67 28 70 6f 73 29 20 3c 3d if {$g(pos) <=
24040 20 31 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20 62 1} {..foreach b
24050 75 74 74 6f 6e 70 72 65 66 20 7b 69 6d 20 74 78 uttonpref {im tx
24060 7d 20 7b 0a 09 20 20 20 20 24 77 28 70 72 65 76 } {.. $w(prev
24070 44 69 66 66 5f 24 62 75 74 74 6f 6e 70 72 65 66 Diff_$buttonpref
24080 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
24090 74 65 20 64 69 73 61 62 6c 65 64 0a 09 20 20 20 te disabled..
240a0 20 24 77 28 66 69 72 73 74 44 69 66 66 5f 24 62 $w(firstDiff_$b
240b0 75 74 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 uttonpref) confi
240c0 67 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 61 gure -state disa
240d0 62 6c 65 64 0a 09 7d 0a 09 24 77 28 70 6f 70 75 bled..}..$w(popu
240e0 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 pMenu) entryconf
240f0 69 67 75 72 65 20 22 50 72 65 76 69 6f 75 73 2a igure "Previous*
24100 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 " -state disable
24110 64 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 d..$w(popupMenu)
24120 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 entryconfigure
24130 22 46 69 72 73 74 2a 22 20 2d 73 74 61 74 65 20 "First*" -state
24140 64 69 73 61 62 6c 65 64 0a 09 24 77 28 76 69 65 disabled..$w(vie
24150 77 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 wMenu) entryconf
24160 69 67 75 72 65 20 22 50 72 65 76 69 6f 75 73 2a igure "Previous*
24170 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 " -state disable
24180 64 0a 09 24 77 28 76 69 65 77 4d 65 6e 75 29 20 d..$w(viewMenu)
24190 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 entryconfigure "
241a0 46 69 72 73 74 2a 22 20 2d 73 74 61 74 65 20 64 First*" -state d
241b0 69 73 61 62 6c 65 64 0a 20 20 20 20 7d 20 65 6c isabled. } el
241c0 73 65 20 7b 0a 09 66 6f 72 65 61 63 68 20 62 75 se {..foreach bu
241d0 74 74 6f 6e 70 72 65 66 20 7b 69 6d 20 74 78 7d ttonpref {im tx}
241e0 20 7b 0a 09 20 20 20 20 24 77 28 70 72 65 76 44 {.. $w(prevD
241f0 69 66 66 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 iff_$buttonpref)
24200 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 configure -stat
24210 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20 20 24 77 e normal.. $w
24220 28 66 69 72 73 74 44 69 66 66 5f 24 62 75 74 74 (firstDiff_$butt
24230 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 onpref) configur
24240 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a e -state normal.
24250 09 7d 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 .}..$w(popupMenu
24260 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
24270 20 22 50 72 65 76 69 6f 75 73 2a 22 20 2d 73 74 "Previous*" -st
24280 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 70 ate normal..$w(p
24290 6f 70 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 opupMenu) entryc
242a0 6f 6e 66 69 67 75 72 65 20 22 46 69 72 73 74 2a onfigure "First*
242b0 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a " -state normal.
242c0 09 24 77 28 76 69 65 77 4d 65 6e 75 29 20 65 6e .$w(viewMenu) en
242d0 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 50 72 tryconfigure "Pr
242e0 65 76 69 6f 75 73 2a 22 20 2d 73 74 61 74 65 20 evious*" -state
242f0 6e 6f 72 6d 61 6c 0a 09 24 77 28 76 69 65 77 4d normal..$w(viewM
24300 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 enu) entryconfig
24310 75 72 65 20 22 46 69 72 73 74 2a 22 20 2d 73 74 ure "First*" -st
24320 61 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 20 20 7d ate normal. }
24330 0a 0a 20 20 20 20 69 66 20 7b 24 67 28 70 6f 73 .. if {$g(pos
24340 29 20 3e 3d 20 24 67 28 63 6f 75 6e 74 29 7d 20 ) >= $g(count)}
24350 7b 0a 09 66 6f 72 65 61 63 68 20 62 75 74 74 6f {..foreach butto
24360 6e 70 72 65 66 20 7b 69 6d 20 74 78 7d 20 7b 0a npref {im tx} {.
24370 09 20 20 20 20 24 77 28 6e 65 78 74 44 69 66 66 . $w(nextDiff
24380 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 6f _$buttonpref) co
24390 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 64 nfigure -state d
243a0 69 73 61 62 6c 65 64 0a 09 20 20 20 20 24 77 28 isabled.. $w(
243b0 6c 61 73 74 44 69 66 66 5f 24 62 75 74 74 6f 6e lastDiff_$button
243c0 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 65 20 pref) configure
243d0 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a -state disabled.
243e0 09 7d 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 .}..$w(popupMenu
243f0 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
24400 20 22 4e 65 78 74 2a 22 20 2d 73 74 61 74 65 20 "Next*" -state
24410 64 69 73 61 62 6c 65 64 0a 09 24 77 28 70 6f 70 disabled..$w(pop
24420 75 70 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e upMenu) entrycon
24430 66 69 67 75 72 65 20 22 4c 61 73 74 2a 22 20 2d figure "Last*" -
24440 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
24450 24 77 28 76 69 65 77 4d 65 6e 75 29 20 65 6e 74 $w(viewMenu) ent
24460 72 79 63 6f 6e 66 69 67 75 72 65 20 22 4e 65 78 ryconfigure "Nex
24470 74 2a 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 t*" -state disab
24480 6c 65 64 0a 09 24 77 28 76 69 65 77 4d 65 6e 75 led..$w(viewMenu
24490 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
244a0 20 22 4c 61 73 74 2a 22 20 2d 73 74 61 74 65 20 "Last*" -state
244b0 64 69 73 61 62 6c 65 64 0a 20 20 20 20 7d 20 65 disabled. } e
244c0 6c 73 65 20 7b 0a 09 66 6f 72 65 61 63 68 20 62 lse {..foreach b
244d0 75 74 74 6f 6e 70 72 65 66 20 7b 69 6d 20 74 78 uttonpref {im tx
244e0 7d 20 7b 0a 09 20 20 20 20 24 77 28 6e 65 78 74 } {.. $w(next
244f0 44 69 66 66 5f 24 62 75 74 74 6f 6e 70 72 65 66 Diff_$buttonpref
24500 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
24510 74 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20 20 24 te normal.. $
24520 77 28 6c 61 73 74 44 69 66 66 5f 24 62 75 74 74 w(lastDiff_$butt
24530 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 onpref) configur
24540 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a e -state normal.
24550 09 7d 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 .}..$w(popupMenu
24560 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
24570 20 22 4e 65 78 74 2a 22 20 2d 73 74 61 74 65 20 "Next*" -state
24580 6e 6f 72 6d 61 6c 0a 09 24 77 28 70 6f 70 75 70 normal..$w(popup
24590 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 Menu) entryconfi
245a0 67 75 72 65 20 22 4c 61 73 74 2a 22 20 2d 73 74 gure "Last*" -st
245b0 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 76 ate normal..$w(v
245c0 69 65 77 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f iewMenu) entryco
245d0 6e 66 69 67 75 72 65 20 22 4e 65 78 74 2a 22 20 nfigure "Next*"
245e0 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 -state normal..$
245f0 77 28 76 69 65 77 4d 65 6e 75 29 20 65 6e 74 72 w(viewMenu) entr
24600 79 63 6f 6e 66 69 67 75 72 65 20 22 4c 61 73 74 yconfigure "Last
24610 2a 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c *" -state normal
24620 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b . }.. if {
24630 24 67 28 63 6f 75 6e 74 29 20 3e 20 30 7d 20 7b $g(count) > 0} {
24640 0a 09 24 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 ..$w(popupMenu)
24650 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20 22 entryconfigure "
24660 43 65 6e 74 65 72 2a 22 20 2d 73 74 61 74 65 20 Center*" -state
24670 6e 6f 72 6d 61 6c 0a 09 24 77 28 76 69 65 77 4d normal..$w(viewM
24680 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 enu) entryconfig
24690 75 72 65 20 22 43 65 6e 74 65 72 2a 22 20 2d 73 ure "Center*" -s
246a0 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 tate normal..$w(
246b0 6d 61 72 6b 4d 65 6e 75 29 20 65 6e 74 72 79 63 markMenu) entryc
246c0 6f 6e 66 69 67 75 72 65 20 22 4d 61 72 6b 2a 22 onfigure "Mark*"
246d0 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a -state normal..
246e0 09 66 6f 72 65 61 63 68 20 62 75 74 74 6f 6e 70 .foreach buttonp
246f0 72 65 66 20 7b 69 6d 20 74 78 7d 20 7b 0a 09 20 ref {im tx} {..
24700 20 20 20 24 77 28 63 65 6e 74 65 72 44 69 66 66 $w(centerDiff
24710 73 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 s_$buttonpref) c
24720 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 onfigure -state
24730 6e 6f 72 6d 61 6c 0a 09 20 20 20 20 24 77 28 6d normal.. $w(m
24740 65 72 67 65 43 68 6f 69 63 65 31 5f 24 62 75 74 ergeChoice1_$but
24750 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 tonpref) configu
24760 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c re -state normal
24770 0a 09 20 20 20 20 24 77 28 6d 65 72 67 65 43 68 .. $w(mergeCh
24780 6f 69 63 65 32 5f 24 62 75 74 74 6f 6e 70 72 65 oice2_$buttonpre
24790 66 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 f) configure -st
247a0 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20 20 ate normal..
247b0 24 77 28 6d 65 72 67 65 43 68 6f 69 63 65 31 32 $w(mergeChoice12
247c0 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 6f _$buttonpref) co
247d0 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e nfigure -state n
247e0 6f 72 6d 61 6c 0a 09 20 20 20 20 24 77 28 6d 65 ormal.. $w(me
247f0 72 67 65 43 68 6f 69 63 65 32 31 5f 24 62 75 74 rgeChoice21_$but
24800 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 tonpref) configu
24810 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c re -state normal
24820 0a 09 7d 0a 09 24 77 28 6d 65 72 67 65 43 68 6f ..}..$w(mergeCho
24830 69 63 65 4c 61 62 65 6c 29 20 63 6f 6e 66 69 67 iceLabel) config
24840 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 ure -state norma
24850 6c 0a 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a l.. } else {.
24860 09 66 6f 72 65 61 63 68 20 62 75 74 74 6f 6e 70 .foreach buttonp
24870 72 65 66 20 7b 69 6d 20 74 78 7d 20 7b 0a 09 20 ref {im tx} {..
24880 20 20 20 24 77 28 63 65 6e 74 65 72 44 69 66 66 $w(centerDiff
24890 73 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 s_$buttonpref) c
248a0 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 onfigure -state
248b0 64 69 73 61 62 6c 65 64 0a 09 20 20 20 20 24 77 disabled.. $w
248c0 28 6d 65 72 67 65 43 68 6f 69 63 65 31 5f 24 62 (mergeChoice1_$b
248d0 75 74 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 uttonpref) confi
248e0 67 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 61 gure -state disa
248f0 62 6c 65 64 0a 09 20 20 20 20 24 77 28 6d 65 72 bled.. $w(mer
24900 67 65 43 68 6f 69 63 65 32 5f 24 62 75 74 74 6f geChoice2_$butto
24910 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 65 npref) configure
24920 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 -state disabled
24930 0a 09 20 20 20 20 24 77 28 6d 65 72 67 65 43 68 .. $w(mergeCh
24940 6f 69 63 65 31 32 5f 24 62 75 74 74 6f 6e 70 72 oice12_$buttonpr
24950 65 66 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 ef) configure -s
24960 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 20 tate disabled..
24970 20 20 20 24 77 28 6d 65 72 67 65 43 68 6f 69 63 $w(mergeChoic
24980 65 32 31 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 e21_$buttonpref)
24990 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 configure -stat
249a0 65 20 64 69 73 61 62 6c 65 64 0a 09 7d 0a 09 24 e disabled..}..$
249b0 77 28 6d 65 72 67 65 43 68 6f 69 63 65 4c 61 62 w(mergeChoiceLab
249c0 65 6c 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 el) configure -s
249d0 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 24 tate disabled..$
249e0 77 28 70 6f 70 75 70 4d 65 6e 75 29 20 65 6e 74 w(popupMenu) ent
249f0 72 79 63 6f 6e 66 69 67 75 72 65 20 22 43 65 6e ryconfigure "Cen
24a00 74 65 72 2a 22 20 2d 73 74 61 74 65 20 64 69 73 ter*" -state dis
24a10 61 62 6c 65 64 0a 09 24 77 28 76 69 65 77 4d 65 abled..$w(viewMe
24a20 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 nu) entryconfigu
24a30 72 65 20 22 43 65 6e 74 65 72 2a 22 20 2d 73 74 re "Center*" -st
24a40 61 74 65 20 64 69 73 61 62 6c 65 64 0a 0a 09 24 ate disabled...$
24a50 77 28 6d 61 72 6b 4d 65 6e 75 29 20 65 6e 74 72 w(markMenu) entr
24a60 79 63 6f 6e 66 69 67 75 72 65 20 22 4d 61 72 6b yconfigure "Mark
24a70 2a 22 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c *" -state disabl
24a80 65 64 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 ed. }.. #
24a90 74 68 65 20 6d 61 72 6b 20 63 6c 65 61 72 20 62 the mark clear b
24aa0 75 74 74 6f 6e 20 73 68 6f 75 6c 64 20 6f 6e 6c utton should onl
24ab0 79 20 62 65 20 65 6e 61 62 6c 65 64 20 69 66 20 y be enabled if
24ac0 74 68 65 72 65 20 69 73 0a 20 20 20 20 23 20 70 there is. # p
24ad0 72 65 73 65 6e 74 6c 79 20 61 20 6d 61 72 6b 20 resently a mark
24ae0 61 74 20 74 68 65 20 63 75 72 72 65 6e 74 20 64 at the current d
24af0 69 66 66 20 72 65 63 6f 72 64 0a 20 20 20 20 73 iff record. s
24b00 65 74 20 77 69 64 67 65 74 20 24 77 28 74 6f 6f et widget $w(too
24b10 6c 62 61 72 29 2e 6d 61 72 6b 24 67 28 70 6f 73 lbar).mark$g(pos
24b20 29 0a 20 20 20 20 69 66 20 7b 5b 77 69 6e 66 6f ). if {[winfo
24b30 20 65 78 69 73 74 73 20 24 77 69 64 67 65 74 5d exists $widget]
24b40 7d 20 7b 0a 09 24 77 28 6d 61 72 6b 4d 65 6e 75 } {..$w(markMenu
24b50 29 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 ) entryconfigure
24b60 20 22 43 6c 65 61 72 2a 22 20 2d 73 74 61 74 65 "Clear*" -state
24b70 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 6d 61 72 6b normal..$w(mark
24b80 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 69 Menu) entryconfi
24b90 67 75 72 65 20 22 4d 61 72 6b 2a 22 20 2d 73 74 gure "Mark*" -st
24ba0 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 66 6f ate disabled..fo
24bb0 72 65 61 63 68 20 62 75 74 74 6f 6e 70 72 65 66 reach buttonpref
24bc0 20 7b 69 6d 20 74 78 7d 20 7b 0a 09 20 20 20 20 {im tx} {..
24bd0 24 77 28 6d 61 72 6b 43 6c 65 61 72 5f 24 62 75 $w(markClear_$bu
24be0 74 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 ttonpref) config
24bf0 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 ure -state norma
24c00 6c 0a 09 20 20 20 20 24 77 28 6d 61 72 6b 53 65 l.. $w(markSe
24c10 74 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 t_$buttonpref) c
24c20 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 onfigure -state
24c30 64 69 73 61 62 6c 65 64 0a 09 7d 0a 20 20 20 20 disabled..}.
24c40 7d 20 65 6c 73 65 20 7b 0a 09 24 77 28 6d 61 72 } else {..$w(mar
24c50 6b 4d 65 6e 75 29 20 65 6e 74 72 79 63 6f 6e 66 kMenu) entryconf
24c60 69 67 75 72 65 20 22 43 6c 65 61 72 2a 22 20 2d igure "Clear*" -
24c70 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
24c80 24 77 28 6d 61 72 6b 4d 65 6e 75 29 20 65 6e 74 $w(markMenu) ent
24c90 72 79 63 6f 6e 66 69 67 75 72 65 20 22 4d 61 72 ryconfigure "Mar
24ca0 6b 2a 22 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 k*" -state norma
24cb0 6c 0a 09 66 6f 72 65 61 63 68 20 62 75 74 74 6f l..foreach butto
24cc0 6e 70 72 65 66 20 7b 69 6d 20 74 78 7d 20 7b 0a npref {im tx} {.
24cd0 09 20 20 20 20 24 77 28 6d 61 72 6b 43 6c 65 61 . $w(markClea
24ce0 72 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 63 r_$buttonpref) c
24cf0 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 onfigure -state
24d00 64 69 73 61 62 6c 65 64 0a 09 20 20 20 20 24 77 disabled.. $w
24d10 28 6d 61 72 6b 53 65 74 5f 24 62 75 74 74 6f 6e (markSet_$button
24d20 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 65 20 pref) configure
24d30 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 7d -state normal..}
24d40 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
24d50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24d60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24d70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24d80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24d90 23 23 23 23 23 23 23 23 23 0a 23 20 43 65 6e 74 #########.# Cent
24da0 65 72 20 74 68 65 20 74 6f 70 20 6c 69 6e 65 20 er the top line
24db0 6f 66 20 74 68 65 20 43 44 52 20 69 6e 20 65 61 of the CDR in ea
24dc0 63 68 20 77 69 6e 64 6f 77 2e 0a 23 23 23 23 23 ch window..#####
24dd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24df0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24e00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24e10 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
24e20 63 65 6e 74 65 72 20 7b 7d 20 7b 0a 20 20 20 20 center {} {.
24e30 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 67 6c 6f global g. glo
24e40 62 61 6c 20 77 0a 0a 20 20 20 20 69 66 20 7b 21 bal w.. if {!
24e50 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 67 28 [info exists g(
24e60 73 63 72 64 69 66 66 2c 24 67 28 70 6f 73 29 29 scrdiff,$g(pos))
24e70 5d 7d 20 7b 72 65 74 75 72 6e 7d 0a 20 20 20 20 ]} {return}.
24e80 23 73 63 61 6e 20 24 67 28 73 63 72 64 69 66 66 #scan $g(scrdiff
24e90 2c 24 67 28 70 6f 73 29 29 20 22 25 73 20 25 64 ,$g(pos)) "%s %d
24ea0 20 25 64 20 25 64 20 25 64 20 25 73 22 20 64 75 %d %d %d %s" du
24eb0 6d 6d 79 20 73 31 20 65 31 20 73 32 20 65 32 20 mmy s1 e1 s2 e2
24ec0 64 74 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b dt. foreach {
24ed0 64 75 6d 6d 79 20 73 31 20 65 31 20 73 32 20 65 dummy s1 e1 s2 e
24ee0 32 20 64 74 7d 20 24 67 28 73 63 72 64 69 66 66 2 dt} $g(scrdiff
24ef0 2c 24 67 28 70 6f 73 29 29 20 7b 20 7d 0a 0a 20 ,$g(pos)) { }..
24f00 20 20 20 23 20 57 69 6e 64 6f 77 20 72 65 71 75 # Window requ
24f10 65 73 74 65 64 20 68 65 69 67 68 74 20 69 6e 20 ested height in
24f20 70 69 78 65 6c 73 0a 20 20 20 20 73 65 74 20 6f pixels. set o
24f30 70 69 78 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 pix [winfo reqhe
24f40 69 67 68 74 20 24 77 28 4c 65 66 74 54 65 78 74 ight $w(LeftText
24f50 29 5d 0a 20 20 20 20 23 20 57 69 6e 64 6f 77 20 )]. # Window
24f60 72 65 71 75 65 73 74 65 64 20 6c 69 6e 65 73 0a requested lines.
24f70 20 20 20 20 73 65 74 20 6f 6c 69 6e 20 5b 24 77 set olin [$w
24f80 28 4c 65 66 74 54 65 78 74 29 20 63 67 65 74 20 (LeftText) cget
24f90 2d 68 65 69 67 68 74 5d 0a 20 20 20 20 23 20 43 -height]. # C
24fa0 75 72 72 65 6e 74 20 77 69 6e 64 6f 77 20 68 65 urrent window he
24fb0 69 67 68 74 20 69 6e 20 70 69 78 65 6c 73 0a 20 ight in pixels.
24fc0 20 20 20 73 65 74 20 6e 70 69 78 20 5b 77 69 6e set npix [win
24fd0 66 6f 20 68 65 69 67 68 74 20 24 77 28 4c 65 66 fo height $w(Lef
24fe0 74 54 65 78 74 29 5d 0a 0a 20 20 20 20 23 20 56 tText)].. # V
24ff0 69 73 69 62 6c 65 20 6c 69 6e 65 73 0a 20 20 20 isible lines.
25000 20 73 65 74 20 77 69 6e 6c 69 6e 65 73 20 5b 65 set winlines [e
25010 78 70 72 20 7b 24 6e 70 69 78 20 2a 20 24 6f 6c xpr {$npix * $ol
25020 69 6e 20 2f 20 24 6f 70 69 78 7d 5d 0a 20 20 20 in / $opix}].
25030 20 23 20 4c 69 6e 65 73 20 69 6e 20 64 69 66 66 # Lines in diff
25040 0a 20 20 20 20 73 65 74 20 64 69 66 66 73 69 7a . set diffsiz
25050 65 20 5b 6d 61 78 20 5b 65 78 70 72 20 7b 24 65 e [max [expr {$e
25060 31 20 2d 20 24 73 31 20 2b 20 31 7d 5d 20 5b 65 1 - $s1 + 1}] [e
25070 78 70 72 20 7b 24 65 32 20 2d 20 24 73 32 20 2b xpr {$e2 - $s2 +
25080 20 31 7d 5d 5d 0a 0a 20 20 20 20 69 66 20 7b 24 1}]].. if {$
25090 64 69 66 66 73 69 7a 65 20 3c 20 24 77 69 6e 6c diffsize < $winl
250a0 69 6e 65 73 7d 20 7b 0a 09 73 65 74 20 68 20 5b ines} {..set h [
250b0 65 78 70 72 20 7b 28 24 77 69 6e 6c 69 6e 65 73 expr {($winlines
250c0 20 2d 20 24 64 69 66 66 73 69 7a 65 29 20 2f 20 - $diffsize) /
250d0 32 7d 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 2}]. } else {
250e0 0a 09 73 65 74 20 68 20 32 0a 20 20 20 20 7d 0a ..set h 2. }.
250f0 0a 20 20 20 20 73 65 74 20 6f 20 5b 65 78 70 72 . set o [expr
25100 20 7b 24 73 31 20 2d 20 24 68 7d 5d 0a 20 20 20 {$s1 - $h}].
25110 20 69 66 20 7b 24 6f 20 3c 20 30 7d 20 7b 0a 09 if {$o < 0} {..
25120 73 65 74 20 6f 20 30 0a 20 20 20 20 7d 0a 20 20 set o 0. }.
25130 20 20 73 65 74 20 6e 20 5b 65 78 70 72 20 7b 24 set n [expr {$
25140 73 32 20 2d 20 24 68 7d 5d 0a 20 20 20 20 69 66 s2 - $h}]. if
25150 20 7b 24 6e 20 3c 20 30 7d 20 7b 0a 09 73 65 74 {$n < 0} {..set
25160 20 6e 20 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20 n 0. }..
25170 24 77 28 4c 65 66 74 54 65 78 74 29 20 6d 61 72 $w(LeftText) mar
25180 6b 20 73 65 74 20 69 6e 73 65 72 74 20 24 73 31 k set insert $s1
25190 2e 30 0a 20 20 20 20 24 77 28 52 69 67 68 74 54 .0. $w(RightT
251a0 65 78 74 29 20 6d 61 72 6b 20 73 65 74 20 69 6e ext) mark set in
251b0 73 65 72 74 20 24 73 32 2e 30 0a 20 20 20 20 24 sert $s2.0. $
251c0 77 28 4c 65 66 74 54 65 78 74 29 20 79 76 69 65 w(LeftText) yvie
251d0 77 20 24 6f 0a 20 20 20 20 24 77 28 52 69 67 68 w $o. $w(Righ
251e0 74 54 65 78 74 29 20 79 76 69 65 77 20 24 6e 0a tText) yview $n.
251f0 0a 20 20 20 20 69 66 20 7b 24 67 28 73 68 6f 77 . if {$g(show
25200 6d 65 72 67 65 29 7d 20 7b 0a 09 6d 65 72 67 65 merge)} {..merge
25210 2d 63 65 6e 74 65 72 0a 20 20 20 20 7d 0a 7d 0a -center. }.}.
25220 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
25230 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25240 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25250 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25260 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25270 0a 23 20 43 68 61 6e 67 65 20 74 68 65 20 73 74 .# Change the st
25280 61 74 65 20 6f 6e 20 61 6c 6c 20 6f 66 20 74 68 ate on all of th
25290 65 20 64 69 66 66 2d 73 65 6e 73 69 74 69 76 65 e diff-sensitive
252a0 20 62 75 74 74 6f 6e 73 2e 0a 23 23 23 23 23 23 buttons..######
252b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
252c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
252d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
252e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
252f0 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 62 #########.proc b
25300 75 74 74 6f 6e 73 20 7b 7b 6e 65 77 73 74 61 74 uttons {{newstat
25310 65 20 22 6e 6f 72 6d 61 6c 22 7d 7d 20 7b 0a 20 e "normal"}} {.
25320 20 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 global w.
25330 24 77 28 63 6f 6d 62 6f 29 20 63 6f 6e 66 69 67 $w(combo) config
25340 75 72 65 20 2d 73 74 61 74 65 20 24 6e 65 77 73 ure -state $news
25350 74 61 74 65 0a 20 20 20 20 66 6f 72 65 61 63 68 tate. foreach
25360 20 62 75 74 74 6f 6e 70 72 65 66 20 7b 69 6d 20 buttonpref {im
25370 74 78 7d 20 7b 0a 09 24 77 28 70 72 65 76 44 69 tx} {..$w(prevDi
25380 66 66 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 ff_$buttonpref)
25390 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
253a0 20 24 6e 65 77 73 74 61 74 65 0a 09 24 77 28 6e $newstate..$w(n
253b0 65 78 74 44 69 66 66 5f 24 62 75 74 74 6f 6e 70 extDiff_$buttonp
253c0 72 65 66 29 20 63 6f 6e 66 69 67 75 72 65 20 2d ref) configure -
253d0 73 74 61 74 65 20 24 6e 65 77 73 74 61 74 65 0a state $newstate.
253e0 09 24 77 28 66 69 72 73 74 44 69 66 66 5f 24 62 .$w(firstDiff_$b
253f0 75 74 74 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 uttonpref) confi
25400 67 75 72 65 20 2d 73 74 61 74 65 20 24 6e 65 77 gure -state $new
25410 73 74 61 74 65 0a 09 24 77 28 6c 61 73 74 44 69 state..$w(lastDi
25420 66 66 5f 24 62 75 74 74 6f 6e 70 72 65 66 29 20 ff_$buttonpref)
25430 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
25440 20 24 6e 65 77 73 74 61 74 65 0a 09 24 77 28 63 $newstate..$w(c
25450 65 6e 74 65 72 44 69 66 66 73 5f 24 62 75 74 74 enterDiffs_$butt
25460 6f 6e 70 72 65 66 29 20 63 6f 6e 66 69 67 75 72 onpref) configur
25470 65 20 2d 73 74 61 74 65 20 24 6e 65 77 73 74 61 e -state $newsta
25480 74 65 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 te. }.}..####
25490 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
254a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
254b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
254c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
254d0 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 57 69 ###########.# Wi
254e0 70 65 20 74 68 65 20 73 6c 61 74 65 20 63 6c 65 pe the slate cle
254f0 61 6e 2e 2e 2e 0a 23 23 23 23 23 23 23 23 23 23 an....##########
25500 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25510 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25520 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25530 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25540 23 23 23 23 23 0a 70 72 6f 63 20 77 69 70 65 20 #####.proc wipe
25550 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 {} {. debug-i
25560 6e 66 6f 20 22 77 69 70 65 22 0a 20 20 20 20 67 nfo "wipe". g
25570 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 lobal g.. set
25580 20 67 28 70 6f 73 29 20 30 0a 20 20 20 20 73 65 g(pos) 0. se
25590 74 20 67 28 63 6f 75 6e 74 29 20 30 0a 20 20 20 t g(count) 0.
255a0 20 73 65 74 20 67 28 64 69 66 66 29 20 22 22 0a set g(diff) "".
255b0 20 20 20 20 73 65 74 20 67 28 63 75 72 72 64 69 set g(currdi
255c0 66 66 29 20 22 22 0a 0a 20 20 20 20 73 65 74 20 ff) "".. set
255d0 67 28 64 65 6c 74 61 2c 31 29 20 30 0a 20 20 20 g(delta,1) 0.
255e0 20 73 65 74 20 67 28 64 65 6c 74 61 2c 32 29 20 set g(delta,2)
255f0 30 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 0.}..###########
25600 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25610 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25620 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25630 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25640 23 23 23 23 0a 23 20 57 69 70 65 20 61 6c 6c 20 ####.# Wipe all
25650 64 61 74 61 20 61 6e 64 20 61 6c 6c 20 77 69 6e data and all win
25660 64 6f 77 73 0a 23 23 23 23 23 23 23 23 23 23 23 dows.###########
25670 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25680 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25690 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
256a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
256b0 23 23 23 23 0a 70 72 6f 63 20 77 69 70 65 2d 77 ####.proc wipe-w
256c0 69 6e 64 6f 77 20 7b 7d 20 7b 0a 20 20 20 20 64 indow {} {. d
256d0 65 62 75 67 2d 69 6e 66 6f 20 22 77 69 70 65 2d ebug-info "wipe-
256e0 77 69 6e 64 6f 77 22 0a 20 20 20 20 67 6c 6f 62 window". glob
256f0 61 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 al g. global
25700 77 0a 0a 20 20 20 20 77 69 70 65 0a 0a 20 20 20 w.. wipe..
25710 20 66 6f 72 65 61 63 68 20 6d 6f 64 20 7b 4c 65 foreach mod {Le
25720 66 74 20 52 69 67 68 74 7d 20 7b 0a 09 24 77 28 ft Right} {..$w(
25730 24 7b 6d 6f 64 7d 54 65 78 74 29 20 63 6f 6e 66 ${mod}Text) conf
25740 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 igure -state nor
25750 6d 61 6c 0a 09 24 77 28 24 7b 6d 6f 64 7d 54 65 mal..$w(${mod}Te
25760 78 74 29 20 74 61 67 20 72 65 6d 6f 76 65 20 64 xt) tag remove d
25770 69 66 66 74 61 67 20 31 2e 30 20 65 6e 64 0a 09 ifftag 1.0 end..
25780 24 77 28 24 7b 6d 6f 64 7d 54 65 78 74 29 20 74 $w(${mod}Text) t
25790 61 67 20 72 65 6d 6f 76 65 20 63 75 72 72 74 61 ag remove currta
257a0 67 20 31 2e 30 20 65 6e 64 0a 09 24 77 28 24 7b g 1.0 end..$w(${
257b0 6d 6f 64 7d 54 65 78 74 29 20 74 61 67 20 72 65 mod}Text) tag re
257c0 6d 6f 76 65 20 69 6e 6c 69 6e 65 74 61 67 20 31 move inlinetag 1
257d0 2e 30 20 65 6e 64 0a 09 24 77 28 24 7b 6d 6f 64 .0 end..$w(${mod
257e0 7d 54 65 78 74 29 20 64 65 6c 65 74 65 20 31 2e }Text) delete 1.
257f0 30 20 65 6e 64 0a 0a 09 24 77 28 24 7b 6d 6f 64 0 end...$w(${mod
25800 7d 49 6e 66 6f 29 20 63 6f 6e 66 69 67 75 72 65 }Info) configure
25810 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 -state normal..
25820 24 77 28 24 7b 6d 6f 64 7d 49 6e 66 6f 29 20 64 $w(${mod}Info) d
25830 65 6c 65 74 65 20 31 2e 30 20 65 6e 64 0a 09 24 elete 1.0 end..$
25840 77 28 24 7b 6d 6f 64 7d 43 42 29 20 63 6f 6e 66 w(${mod}CB) conf
25850 69 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 igure -state nor
25860 6d 61 6c 0a 09 24 77 28 24 7b 6d 6f 64 7d 43 42 mal..$w(${mod}CB
25870 29 20 64 65 6c 65 74 65 20 31 2e 30 20 65 6e 64 ) delete 1.0 end
25880 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 61 74 63 . }.. catc
25890 68 20 7b 0a 09 24 77 28 6d 65 72 67 65 54 65 78 h {..$w(mergeTex
258a0 74 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 t) configure -st
258b0 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 28 6d ate normal..$w(m
258c0 65 72 67 65 54 65 78 74 29 20 64 65 6c 65 74 65 ergeText) delete
258d0 20 31 2e 30 20 65 6e 64 0a 09 65 76 61 6c 20 24 1.0 end..eval $
258e0 77 28 6d 65 72 67 65 54 65 78 74 29 20 74 61 67 w(mergeText) tag
258f0 20 64 65 6c 65 74 65 20 5b 24 77 28 6d 65 72 67 delete [$w(merg
25900 65 54 65 78 74 29 20 74 61 67 20 6e 61 6d 65 73 eText) tag names
25910 5d 0a 09 24 77 28 6d 65 72 67 65 54 65 78 74 29 ]..$w(mergeText)
25920 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 configure -stat
25930 65 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20 7d e disabled. }
25940 0a 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e .. if {[strin
25950 67 20 6c 65 6e 67 74 68 20 24 67 28 64 65 73 74 g length $g(dest
25960 72 6f 79 29 5d 20 3e 20 30 7d 20 7b 0a 09 65 76 roy)] > 0} {..ev
25970 61 6c 20 24 67 28 64 65 73 74 72 6f 79 29 0a 09 al $g(destroy)..
25980 73 65 74 20 67 28 64 65 73 74 72 6f 79 29 20 22 set g(destroy) "
25990 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 24 77 28 ". }.. $w(
259a0 63 6f 6d 62 6f 29 20 6c 69 73 74 20 64 65 6c 65 combo) list dele
259b0 74 65 20 30 20 65 6e 64 0a 20 20 20 20 62 75 74 te 0 end. but
259c0 74 6f 6e 73 20 64 69 73 61 62 6c 65 64 0a 0a 20 tons disabled..
259d0 20 20 20 64 69 66 66 6d 61 72 6b 20 63 6c 65 61 diffmark clea
259e0 72 61 6c 6c 0a 7d 0a 0a 23 23 23 23 23 23 23 23 rall.}..########
259f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a30 23 23 23 23 23 23 23 0a 23 20 4d 61 72 6b 20 64 #######.# Mark d
25a40 69 66 66 65 72 65 6e 63 65 20 72 65 67 69 6f 6e ifference region
25a50 73 20 61 6e 64 20 62 75 69 6c 64 20 75 70 20 74 s and build up t
25a60 68 65 20 63 6f 6d 62 6f 62 6f 78 0a 23 23 23 23 he combobox.####
25a70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25a90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25aa0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25ab0 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
25ac0 20 6d 61 72 6b 2d 64 69 66 66 73 20 7b 7d 20 7b mark-diffs {} {
25ad0 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 . debug-info
25ae0 22 6d 61 72 6b 2d 64 69 66 66 73 22 0a 20 20 20 "mark-diffs".
25af0 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 67 6c global g. gl
25b00 6f 62 61 6c 20 77 0a 0a 20 20 20 20 73 65 74 20 obal w.. set
25b10 6e 75 6d 64 69 66 66 20 5b 6c 6c 65 6e 67 74 68 numdiff [llength
25b20 20 22 24 67 28 64 69 66 66 29 22 5d 0a 0a 20 20 "$g(diff)"]..
25b30 20 20 73 65 74 20 67 28 63 6f 75 6e 74 29 20 30 set g(count) 0
25b40 0a 0a 0a 20 20 20 20 23 20 61 69 6e 27 74 20 74 ... # ain't t
25b50 68 69 73 20 63 6c 65 76 65 72 3f 20 57 65 20 77 his clever? We w
25b60 61 6e 74 20 74 6f 20 75 70 64 61 74 65 20 74 68 ant to update th
25b70 65 20 64 69 73 70 6c 61 79 20 61 73 20 73 6f 6f e display as soo
25b80 6e 20 61 73 0a 20 20 20 20 23 20 77 65 27 76 65 n as. # we've
25b90 20 6d 61 72 6b 65 64 20 65 6e 6f 75 67 68 20 64 marked enough d
25ba0 69 66 66 73 20 74 6f 20 66 69 6c 6c 20 74 68 65 iffs to fill the
25bb0 20 64 69 73 70 6c 61 79 20 73 6f 20 74 68 65 20 display so the
25bc0 75 73 65 72 20 77 69 6c 6c 0a 20 20 20 20 23 20 user will. #
25bd0 68 61 76 65 20 74 68 65 20 69 6d 70 72 65 73 73 have the impress
25be0 69 6f 6e 20 77 65 27 72 65 20 66 61 73 74 2e 20 ion we're fast.
25bf0 42 75 74 2c 20 77 65 20 64 6f 6e 27 74 20 77 61 But, we don't wa
25c00 6e 74 20 74 68 69 73 0a 20 20 20 20 23 20 77 61 nt this. # wa
25c10 6e 74 20 74 68 69 73 20 63 6f 64 65 20 74 6f 20 nt this code to
25c20 73 6c 6f 77 20 75 73 20 64 6f 77 6e 20 74 6f 6f slow us down too
25c30 20 6d 75 63 68 2c 20 73 6f 20 77 65 27 6c 6c 20 much, so we'll
25c40 70 75 74 20 74 68 65 0a 20 20 20 20 23 20 63 6f put the. # co
25c50 64 65 20 69 6e 20 61 20 76 61 72 69 61 62 6c 65 de in a variable
25c60 20 61 6e 64 20 64 65 6c 65 74 65 20 69 74 20 77 and delete it w
25c70 68 65 6e 20 69 74 73 20 6e 6f 20 6c 6f 6e 67 65 hen its no longe
25c80 72 20 6e 65 65 64 65 64 2e 0a 20 20 20 20 73 65 r needed.. se
25c90 74 20 68 61 63 6b 20 7b 0a 09 23 20 66 6f 72 20 t hack {..# for
25ca0 6e 6f 77 2c 20 6a 75 73 74 20 70 69 63 6b 20 61 now, just pick a
25cb0 20 6e 75 6d 62 65 72 20 6f 75 74 20 6f 66 20 74 number out of t
25cc0 68 69 6e 20 61 69 72 2e 20 49 64 65 61 6c 6c 79 hin air. Ideally
25cd0 0a 09 23 20 77 65 27 64 20 63 6f 6d 70 75 74 65 ..# we'd compute
25ce0 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6c the number of l
25cf0 69 6e 65 73 20 74 68 61 74 20 61 72 65 20 76 69 ines that are vi
25d00 73 69 62 6c 65 20 61 6e 64 0a 09 23 20 75 73 65 sible and..# use
25d10 20 74 68 61 74 2c 20 62 75 74 20 49 27 6d 20 74 that, but I'm t
25d20 6f 6f 20 6c 61 7a 79 20 74 6f 64 61 79 2e 2e 2e oo lazy today...
25d30 0a 09 69 66 20 7b 24 67 28 63 6f 75 6e 74 29 20 ..if {$g(count)
25d40 3e 20 32 35 7d 20 7b 0a 09 20 20 20 20 75 70 64 > 25} {.. upd
25d50 61 74 65 20 69 64 6c 65 74 61 73 6b 73 0a 09 20 ate idletasks..
25d60 20 20 20 73 65 74 20 68 61 63 6b 20 7b 7d 0a 09 set hack {}..
25d70 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 66 6f 72 }. }.. for
25d80 65 61 63 68 20 64 20 24 67 28 64 69 66 66 29 20 each d $g(diff)
25d90 7b 0a 09 73 65 74 20 72 65 73 75 6c 74 20 5b 65 {..set result [e
25da0 78 74 72 61 63 74 20 24 64 5d 0a 09 69 66 20 7b xtract $d]..if {
25db0 24 72 65 73 75 6c 74 20 21 3d 20 22 22 7d 20 7b $result != ""} {
25dc0 0a 09 20 20 20 20 69 6e 63 72 20 67 28 63 6f 75 .. incr g(cou
25dd0 6e 74 29 0a 09 20 20 20 20 73 65 74 20 67 28 6d nt).. set g(m
25de0 65 72 67 65 24 67 28 63 6f 75 6e 74 29 29 20 31 erge$g(count)) 1
25df0 0a 0a 09 20 20 20 20 73 65 74 20 67 28 70 64 69 ... set g(pdi
25e00 66 66 2c 24 67 28 63 6f 75 6e 74 29 29 20 22 24 ff,$g(count)) "$
25e10 72 65 73 75 6c 74 22 0a 09 20 20 20 20 61 64 64 result".. add
25e20 2d 6c 69 6e 65 73 20 24 67 28 63 6f 75 6e 74 29 -lines $g(count)
25e30 0a 0a 09 20 20 20 20 24 77 28 63 6f 6d 62 6f 29 ... $w(combo)
25e40 20 6c 69 73 74 20 69 6e 73 65 72 74 20 65 6e 64 list insert end
25e50 20 5b 66 6f 72 6d 61 74 20 22 25 2d 36 64 3a 20 [format "%-6d:
25e60 25 73 22 20 24 67 28 63 6f 75 6e 74 29 20 24 64 %s" $g(count) $d
25e70 5d 0a 0a 09 20 20 20 20 65 76 61 6c 20 24 68 61 ]... eval $ha
25e80 63 6b 0a 09 7d 0a 0a 20 20 20 20 7d 0a 0a 20 20 ck..}.. }..
25e90 20 20 72 65 6d 61 72 6b 2d 64 69 66 66 73 0a 20 remark-diffs.
25ea0 20 20 20 72 65 74 75 72 6e 20 24 67 28 63 6f 75 return $g(cou
25eb0 6e 74 29 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 nt).}..#########
25ec0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25ed0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25ee0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25ef0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25f00 23 23 23 23 23 23 0a 23 20 73 74 61 72 74 20 61 ######.# start a
25f10 20 6e 65 77 20 64 69 66 66 20 66 72 6f 6d 20 74 new diff from t
25f20 68 65 20 70 6f 70 75 70 20 64 69 61 6c 6f 67 0a he popup dialog.
25f30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25f40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25f50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25f60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25f70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
25f80 70 72 6f 63 20 64 6f 2d 6e 65 77 2d 64 69 66 66 proc do-new-diff
25f90 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c {} {. global
25fa0 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 g. global fi
25fb0 6e 66 6f 0a 0a 20 20 20 20 64 65 62 75 67 2d 69 nfo.. debug-i
25fc0 6e 66 6f 20 22 64 6f 2d 6e 65 77 2d 64 69 66 66 nfo "do-new-diff
25fd0 22 0a 0a 20 20 20 20 73 65 74 20 67 28 6d 65 72 ".. set g(mer
25fe0 67 65 66 69 6c 65 73 65 74 29 20 30 0a 20 20 20 gefileset) 0.
25ff0 20 73 65 74 20 67 28 6d 65 72 67 65 66 69 6c 65 set g(mergefile
26000 29 20 22 22 0a 20 20 20 20 73 65 74 20 66 69 6e ) "". set fin
26010 66 6f 28 70 74 68 2c 31 29 20 22 22 0a 20 20 20 fo(pth,1) "".
26020 20 73 65 74 20 66 69 6e 66 6f 28 70 74 68 2c 32 set finfo(pth,2
26030 29 20 22 22 0a 20 20 20 20 73 65 74 20 66 69 6e ) "". set fin
26040 66 6f 28 74 6d 70 2c 31 29 20 30 0a 20 20 20 20 fo(tmp,1) 0.
26050 73 65 74 20 66 69 6e 66 6f 28 74 6d 70 2c 32 29 set finfo(tmp,2)
26060 20 30 0a 0a 20 20 20 20 23 66 6f 72 65 61 63 68 0.. #foreach
26070 20 69 6e 66 20 5b 6c 73 6f 72 74 20 5b 61 72 72 inf [lsort [arr
26080 61 79 20 6e 61 6d 65 73 20 66 69 6e 66 6f 5d 5d ay names finfo]]
26090 20 7b 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 { debug-info "
260a0 20 20 20 24 69 6e 66 3a 20 5c 0a 20 20 20 20 20 $inf: \.
260b0 20 24 66 69 6e 66 6f 28 24 69 6e 66 29 22 20 7d $finfo($inf)" }
260c0 0a 20 20 20 20 23 20 50 6f 70 20 75 70 20 74 68 . # Pop up th
260d0 65 20 64 69 61 6c 6f 67 20 74 6f 20 63 6f 6c 6c e dialog to coll
260e0 65 63 74 20 74 68 65 20 61 72 67 73 0a 20 20 20 ect the args.
260f0 20 6e 65 77 44 69 66 66 44 69 61 6c 6f 67 0a 0a newDiffDialog..
26100 20 20 20 20 23 20 50 75 74 20 74 68 65 6d 20 74 # Put them t
26110 6f 67 65 74 68 65 72 20 69 6e 74 6f 20 61 20 63 ogether into a c
26120 6f 6d 6d 61 6e 64 0a 20 20 20 20 69 66 20 7b 5b ommand. if {[
26130 61 73 73 65 6d 62 6c 65 2d 61 72 67 73 5d 20 21 assemble-args] !
26140 3d 20 30 7d 20 72 65 74 75 72 6e 0a 0a 20 20 20 = 0} return..
26150 20 66 6f 72 65 61 63 68 20 69 6e 66 20 5b 6c 73 foreach inf [ls
26160 6f 72 74 20 5b 61 72 72 61 79 20 6e 61 6d 65 73 ort [array names
26170 20 66 69 6e 66 6f 5d 5d 20 7b 0a 09 64 65 62 75 finfo]] {..debu
26180 67 2d 69 6e 66 6f 20 22 20 20 20 20 24 69 6e 66 g-info " $inf
26190 3a 20 24 66 69 6e 66 6f 28 24 69 6e 66 29 22 0a : $finfo($inf)".
261a0 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 67 }.. set g
261b0 28 64 69 73 61 62 6c 65 53 79 6e 63 69 6e 67 29 (disableSyncing)
261c0 20 31 20 3b 23 20 74 75 72 6e 20 6f 66 66 20 73 1 ;# turn off s
261d0 79 6e 63 69 6e 67 20 75 6e 74 69 6c 20 74 68 69 yncing until thi
261e0 6e 67 73 20 73 65 74 74 6c 65 20 64 6f 77 6e 0a ngs settle down.
261f0 0a 20 20 20 20 23 20 72 65 6d 6f 76 65 20 61 6c . # remove al
26200 6c 20 65 76 69 64 65 6e 63 65 20 6f 66 20 70 72 l evidence of pr
26210 65 76 69 6f 75 73 20 64 69 66 66 0a 20 20 20 20 evious diff.
26220 23 77 69 70 65 2d 77 69 6e 64 6f 77 0a 20 20 20 #wipe-window.
26230 20 23 75 70 64 61 74 65 20 69 64 6c 65 74 61 73 #update idletas
26240 6b 73 0a 0a 20 20 20 20 77 61 74 63 68 2d 63 75 ks.. watch-cu
26250 72 73 6f 72 0a 20 20 20 20 23 20 64 6f 20 74 68 rsor. # do th
26260 65 20 64 69 66 66 0a 20 20 20 20 64 6f 2d 64 69 e diff. do-di
26270 66 66 0a 0a 20 20 20 20 64 65 62 75 67 2d 69 6e ff.. debug-in
26280 66 6f 20 22 20 20 20 6d 6f 76 65 20 66 69 72 73 fo " move firs
26290 74 20 31 20 31 20 20 66 72 6f 6d 20 64 6f 2d 6e t 1 1 from do-n
262a0 65 77 2d 64 69 66 66 22 0a 20 20 20 20 6d 6f 76 ew-diff". mov
262b0 65 20 66 69 72 73 74 20 31 20 31 0a 0a 20 20 20 e first 1 1..
262c0 20 23 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 #debug-info "
262d0 20 20 2e 2e 2e 72 65 73 74 6f 72 65 2d 63 75 72 ...restore-cur
262e0 73 6f 72 20 66 72 6f 6d 20 64 6f 2d 6e 65 77 2d sor from do-new-
262f0 64 69 66 66 22 0a 20 20 20 20 72 65 73 74 6f 72 diff". restor
26300 65 2d 63 75 72 73 6f 72 0a 0a 20 20 20 20 23 64 e-cursor.. #d
26310 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 20 20 2e ebug-info " .
26320 2e 2e 75 70 64 61 74 65 2d 64 69 73 70 6c 61 79 ..update-display
26330 20 66 72 6f 6d 20 64 6f 2d 6e 65 77 2d 64 69 66 from do-new-dif
26340 66 22 0a 20 20 20 20 75 70 64 61 74 65 2d 64 69 f". update-di
26350 73 70 6c 61 79 0a 20 20 20 20 63 61 74 63 68 20 splay. catch
26360 7b 75 6e 73 65 74 20 67 28 64 69 73 61 62 6c 65 {unset g(disable
26370 53 79 6e 63 69 6e 67 29 7d 0a 7d 0a 0a 23 23 23 Syncing)}.}..###
26380 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26390 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
263a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
263b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
263c0 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 52 ############.# R
263d0 65 6d 61 72 6b 20 64 69 66 66 65 72 65 6e 63 65 emark difference
263e0 20 72 65 67 69 6f 6e 73 2e 2e 2e 0a 23 23 23 23 regions....####
263f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26400 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26410 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26420 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26430 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
26440 20 72 65 6d 61 72 6b 2d 64 69 66 66 73 20 7b 7d remark-diffs {}
26450 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 {. debug-inf
26460 6f 20 22 72 65 6d 61 72 6b 2d 64 69 66 66 73 22 o "remark-diffs"
26470 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 . global g.
26480 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 global w. g
26490 6c 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 20 67 lobal opts. g
264a0 6c 6f 62 61 6c 20 70 72 65 66 0a 0a 20 20 20 20 lobal pref..
264b0 23 20 64 65 6c 65 74 65 20 61 6c 6c 20 6b 6e 6f # delete all kno
264c0 77 6e 20 74 61 67 73 2e 0a 20 20 20 20 66 6f 72 wn tags.. for
264d0 65 61 63 68 20 77 69 6e 64 6f 77 20 5b 6c 69 73 each window [lis
264e0 74 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 24 t $w(LeftText) $
264f0 77 28 4c 65 66 74 49 6e 66 6f 29 20 24 77 28 4c w(LeftInfo) $w(L
26500 65 66 74 43 42 29 20 24 77 28 52 69 67 68 74 54 eftCB) $w(RightT
26510 65 78 74 29 20 5c 0a 20 20 20 20 20 20 24 77 28 ext) \. $w(
26520 52 69 67 68 74 49 6e 66 6f 29 20 24 77 28 52 69 RightInfo) $w(Ri
26530 67 68 74 43 42 29 5d 20 7b 0a 09 65 76 61 6c 20 ghtCB)] {..eval
26540 24 77 69 6e 64 6f 77 20 74 61 67 20 64 65 6c 65 $window tag dele
26550 74 65 20 5b 24 77 69 6e 64 6f 77 20 74 61 67 20 te [$window tag
26560 6e 61 6d 65 73 5d 0a 20 20 20 20 7d 0a 20 20 20 names]. }.
26570 20 69 66 20 7b 5b 77 69 6e 66 6f 20 65 78 69 73 if {[winfo exis
26580 74 73 20 2e 6d 65 72 67 65 5d 7d 20 7b 0a 09 65 ts .merge]} {..e
26590 76 61 6c 20 24 77 69 6e 64 6f 77 20 74 61 67 20 val $window tag
265a0 64 65 6c 65 74 65 20 5b 24 77 28 6d 65 72 67 65 delete [$w(merge
265b0 54 65 78 74 29 20 74 61 67 20 6e 61 6d 65 73 5d Text) tag names]
265c0 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 . }.. # re
265d0 63 6f 6e 66 69 67 75 72 65 20 61 6c 6c 20 74 68 configure all th
265e0 65 20 74 61 67 73 20 62 61 73 65 64 20 6f 6e 20 e tags based on
265f0 74 68 65 20 63 75 72 72 65 6e 74 20 6f 70 74 69 the current opti
26600 6f 6e 73 0a 20 20 20 20 23 20 66 69 72 73 74 2c ons. # first,
26610 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 74 61 67 73 the common tags
26620 3a 0a 20 20 20 20 66 6f 72 65 61 63 68 20 74 61 :. foreach ta
26630 67 20 7b 64 69 66 66 74 61 67 20 63 75 72 72 74 g {difftag currt
26640 61 67 20 69 6e 6c 69 6e 65 74 61 67 20 64 65 6c ag inlinetag del
26650 74 61 67 20 69 6e 73 74 61 67 20 63 68 67 74 61 tag instag chgta
26660 67 20 6f 76 65 72 6c 61 70 74 61 67 7d 20 7b 0a g overlaptag} {.
26670 09 66 6f 72 65 61 63 68 20 77 69 6e 20 5b 6c 69 .foreach win [li
26680 73 74 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 st $w(LeftText)
26690 24 77 28 4c 65 66 74 49 6e 66 6f 29 20 24 77 28 $w(LeftInfo) $w(
266a0 4c 65 66 74 43 42 29 20 24 77 28 52 69 67 68 74 LeftCB) $w(Right
266b0 54 65 78 74 29 20 5c 0a 09 20 20 24 77 28 52 69 Text) \.. $w(Ri
266c0 67 68 74 49 6e 66 6f 29 20 24 77 28 52 69 67 68 ghtInfo) $w(Righ
266d0 74 43 42 29 5d 20 7b 0a 09 20 20 20 20 69 66 20 tCB)] {.. if
266e0 7b 5b 63 61 74 63 68 20 22 24 77 69 6e 20 74 61 {[catch "$win ta
266f0 67 20 63 6f 6e 66 69 67 75 72 65 20 24 74 61 67 g configure $tag
26700 20 24 6f 70 74 73 28 24 74 61 67 29 22 5d 7d 20 $opts($tag)"]}
26710 7b 0a 09 09 64 6f 2d 65 72 72 6f 72 20 22 49 6e {...do-error "In
26720 76 61 6c 69 64 20 73 65 74 74 69 6e 67 73 20 66 valid settings f
26730 6f 72 20 5c 22 24 70 72 65 66 28 24 74 61 67 29 or \"$pref($tag)
26740 5c 22 3a 20 5c 0a 09 09 5c 6e 5c 6e 27 24 6f 70 \": \...\n\n'$op
26750 74 73 28 24 74 61 67 29 27 20 69 73 20 6e 6f 74 ts($tag)' is not
26760 20 61 20 76 61 6c 69 64 20 6f 70 74 69 6f 6e 20 a valid option
26770 73 74 72 69 6e 67 2e 22 0a 09 09 65 76 61 6c 20 string."...eval
26780 22 24 77 69 6e 20 74 61 67 20 63 6f 6e 66 69 67 "$win tag config
26790 75 72 65 20 24 74 61 67 20 24 6f 70 74 73 28 24 ure $tag $opts($
267a0 74 61 67 29 22 0a 09 09 72 65 74 75 72 6e 0a 09 tag)"...return..
267b0 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 7d 0a 0a }..}. }..
267c0 20 20 20 20 23 20 6e 65 78 74 2c 20 63 68 61 6e # next, chan
267d0 67 65 62 61 72 2d 73 70 65 63 69 66 69 63 20 74 gebar-specific t
267e0 61 67 73 0a 20 20 20 20 66 6f 72 65 61 63 68 20 ags. foreach
267f0 77 69 64 67 65 74 20 5b 6c 69 73 74 20 24 77 28 widget [list $w(
26800 4c 65 66 74 43 42 29 20 24 77 28 52 69 67 68 74 LeftCB) $w(Right
26810 43 42 29 5d 20 7b 0a 09 65 76 61 6c 20 24 77 69 CB)] {..eval $wi
26820 64 67 65 74 20 74 61 67 20 63 6f 6e 66 69 67 75 dget tag configu
26830 72 65 20 2b 20 24 6f 70 74 73 28 2b 29 0a 09 65 re + $opts(+)..e
26840 76 61 6c 20 24 77 69 64 67 65 74 20 74 61 67 20 val $widget tag
26850 63 6f 6e 66 69 67 75 72 65 20 2d 20 24 6f 70 74 configure - $opt
26860 73 28 2d 29 0a 09 65 76 61 6c 20 24 77 69 64 67 s(-)..eval $widg
26870 65 74 20 74 61 67 20 63 6f 6e 66 69 67 75 72 65 et tag configure
26880 20 21 20 24 6f 70 74 73 28 21 29 0a 09 65 76 61 ! $opts(!)..eva
26890 6c 20 24 77 69 64 67 65 74 20 74 61 67 20 63 6f l $widget tag co
268a0 6e 66 69 67 75 72 65 20 3f 20 24 6f 70 74 73 28 nfigure ? $opts(
268b0 3f 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 ?). }.. #
268c0 2e 2e 2e 20 61 6e 64 20 74 68 65 20 6d 65 72 67 ... and the merg
268d0 65 20 74 65 78 74 20 77 69 6e 64 6f 77 0a 20 20 e text window.
268e0 20 20 69 66 20 7b 5b 77 69 6e 66 6f 20 65 78 69 if {[winfo exi
268f0 73 74 73 20 2e 6d 65 72 67 65 5d 7d 20 7b 0a 09 sts .merge]} {..
26900 66 6f 72 65 61 63 68 20 74 61 67 20 7b 64 69 66 foreach tag {dif
26910 66 74 61 67 20 63 75 72 72 74 61 67 7d 20 7b 0a ftag currtag} {.
26920 09 20 20 20 20 65 76 61 6c 20 24 77 28 6d 65 72 . eval $w(mer
26930 67 65 54 65 78 74 29 20 74 61 67 20 63 6f 6e 66 geText) tag conf
26940 69 67 75 72 65 20 24 74 61 67 20 24 6f 70 74 73 igure $tag $opts
26950 28 24 74 61 67 29 0a 09 7d 0a 20 20 20 20 7d 0a ($tag)..}. }.
26960 0a 20 20 20 20 23 20 6e 6f 77 2c 20 72 65 61 70 . # now, reap
26970 70 6c 79 20 74 68 65 20 74 61 67 73 20 74 6f 20 ply the tags to
26980 61 6c 6c 20 74 68 65 20 64 69 66 66 20 72 65 67 all the diff reg
26990 69 6f 6e 73 0a 20 20 20 20 66 6f 72 20 7b 73 65 ions. for {se
269a0 74 20 69 20 31 7d 20 7b 24 69 20 3c 3d 20 24 67 t i 1} {$i <= $g
269b0 28 63 6f 75 6e 74 29 7d 20 7b 69 6e 63 72 20 69 (count)} {incr i
269c0 7d 20 7b 0a 09 73 65 74 2d 74 61 67 20 24 69 20 } {..set-tag $i
269d0 64 69 66 66 74 61 67 0a 09 23 20 61 64 64 20 74 difftag..# add t
269e0 68 65 20 69 6e 6c 69 6e 65 20 61 6e 6e 6f 74 61 he inline annota
269f0 74 69 6f 6e 0a 09 66 6f 72 20 7b 73 65 74 20 6a tion..for {set j
26a00 20 30 7d 20 7b 24 6a 20 3c 20 24 67 28 73 63 72 0} {$j < $g(scr
26a10 69 6e 6c 69 6e 65 2c 24 69 29 7d 20 7b 69 6e 63 inline,$i)} {inc
26a20 72 20 6a 7d 20 7b 0a 09 20 20 20 20 66 6f 72 65 r j} {.. fore
26a30 61 63 68 20 7b 73 69 64 65 20 6c 69 6e 65 20 73 ach {side line s
26a40 74 61 72 74 63 6f 6c 20 65 6e 64 63 6f 6c 7d 20 tartcol endcol}
26a50 24 67 28 73 63 72 69 6e 6c 69 6e 65 2c 24 69 2c $g(scrinline,$i,
26a60 24 6a 29 20 7b 20 7d 0a 09 20 20 20 20 69 66 20 $j) { }.. if
26a70 7b 24 73 69 64 65 20 3d 3d 20 22 6c 22 7d 20 7b {$side == "l"} {
26a80 0a 09 09 61 64 64 2d 69 6e 6c 69 6e 65 2d 74 61 ...add-inline-ta
26a90 67 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 69 g $w(LeftText) i
26aa0 6e 6c 69 6e 65 74 61 67 20 24 6c 69 6e 65 20 24 nlinetag $line $
26ab0 73 74 61 72 74 63 6f 6c 20 24 65 6e 64 63 6f 6c startcol $endcol
26ac0 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 .. } else {..
26ad0 09 61 64 64 2d 69 6e 6c 69 6e 65 2d 74 61 67 20 .add-inline-tag
26ae0 24 77 28 52 69 67 68 74 54 65 78 74 29 20 69 6e $w(RightText) in
26af0 6c 69 6e 65 74 61 67 20 24 6c 69 6e 65 20 24 73 linetag $line $s
26b00 74 61 72 74 63 6f 6c 20 24 65 6e 64 63 6f 6c 0a tartcol $endcol.
26b10 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 7d 0a . }..}. }.
26b20 0a 20 20 20 20 23 20 66 69 6e 61 6c 6c 79 2c 20 . # finally,
26b30 72 65 73 65 74 20 74 68 65 20 63 75 72 72 65 6e reset the curren
26b40 74 20 64 69 66 66 0a 20 20 20 20 73 65 74 2d 74 t diff. set-t
26b50 61 67 20 24 67 28 70 6f 73 29 20 63 75 72 72 74 ag $g(pos) currt
26b60 61 67 20 22 22 20 30 0a 7d 0a 0a 0a 23 23 23 23 ag "" 0.}...####
26b70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26b80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26b90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26ba0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26bb0 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 50 75 ###########.# Pu
26bc0 74 20 75 70 20 73 6f 6d 65 20 69 6e 66 6f 72 6d t up some inform
26bd0 61 74 69 6f 6e 61 6c 20 74 65 78 74 2e 0a 23 23 ational text..##
26be0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26bf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26c00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26c10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26c20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
26c30 6f 63 20 73 68 6f 77 2d 69 6e 66 6f 20 7b 6d 65 oc show-info {me
26c40 73 73 61 67 65 7d 20 7b 0a 20 20 20 20 67 6c 6f ssage} {. glo
26c50 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 20 67 bal g.. set g
26c60 28 73 74 61 74 75 73 49 6e 66 6f 29 20 24 6d 65 (statusInfo) $me
26c70 73 73 61 67 65 0a 20 20 20 20 64 65 62 75 67 2d ssage. debug-
26c80 69 6e 66 6f 20 22 73 68 6f 77 2d 69 6e 66 6f 3a info "show-info:
26c90 20 24 6d 65 73 73 61 67 65 22 0a 20 20 20 20 75 $message". u
26ca0 70 64 61 74 65 20 69 64 6c 65 74 61 73 6b 73 0a pdate idletasks.
26cb0 7d 0a 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 }...############
26cc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26cd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26ce0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26cf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26d00 23 23 23 0a 23 20 54 72 61 63 65 20 6f 75 74 70 ###.# Trace outp
26d10 75 74 2c 20 65 6e 61 62 6c 65 64 20 62 79 20 61 ut, enabled by a
26d20 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 62 6c 65 global variable
26d30 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
26d40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26d50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26d60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26d70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26d80 0a 70 72 6f 63 20 64 65 62 75 67 2d 69 6e 66 6f .proc debug-info
26d90 20 7b 6d 65 73 73 61 67 65 7d 20 7b 0a 20 20 20 {message} {.
26da0 20 67 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 20 69 global g.. i
26db0 66 20 7b 24 67 28 64 65 62 75 67 29 7d 20 7b 0a f {$g(debug)} {.
26dc0 09 70 75 74 73 20 22 24 6d 65 73 73 61 67 65 22 .puts "$message"
26dd0 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
26de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26df0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e20 23 23 23 23 23 23 23 23 23 0a 23 20 43 6f 6d 70 #########.# Comp
26e30 75 74 65 20 64 69 66 66 65 72 65 6e 63 65 73 20 ute differences
26e40 28 73 74 61 72 74 20 6f 76 65 72 2c 20 62 61 73 (start over, bas
26e50 69 63 61 6c 6c 79 29 2e 0a 23 23 23 23 23 23 23 ically)..#######
26e60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26e90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
26ea0 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 72 65 ########.proc re
26eb0 64 69 66 66 20 7b 7d 20 7b 0a 20 20 20 20 64 65 diff {} {. de
26ec0 62 75 67 2d 69 6e 66 6f 20 22 5c 6e 72 65 64 69 bug-info "\nredi
26ed0 66 66 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 ff". global g
26ee0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 . global opts
26ef0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 6e 66 . global finf
26f00 6f 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a o. global w..
26f10 20 20 20 20 62 75 74 74 6f 6e 73 20 64 69 73 61 buttons disa
26f20 62 6c 65 64 0a 0a 20 20 20 20 23 20 52 65 61 64 bled.. # Read
26f30 20 74 68 65 20 66 69 6c 65 73 20 69 6e 74 6f 20 the files into
26f40 74 68 65 69 72 20 72 65 73 70 65 63 74 69 76 65 their respective
26f50 20 77 69 64 67 65 74 73 20 26 20 61 64 64 20 6c widgets & add l
26f60 69 6e 65 20 6e 75 6d 62 65 72 73 2e 0a 20 20 20 ine numbers..
26f70 20 66 6f 72 65 61 63 68 20 6d 6f 64 20 7b 31 20 foreach mod {1
26f80 32 7d 20 7b 0a 09 69 66 20 7b 24 6d 6f 64 20 3d 2} {..if {$mod =
26f90 3d 20 31 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 = 1} {.. set
26fa0 74 65 78 74 20 24 77 28 4c 65 66 74 54 65 78 74 text $w(LeftText
26fb0 29 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 )..} else {..
26fc0 20 73 65 74 20 74 65 78 74 20 24 77 28 52 69 67 set text $w(Rig
26fd0 68 74 54 65 78 74 29 0a 09 7d 0a 09 73 68 6f 77 htText)..}..show
26fe0 2d 69 6e 66 6f 20 22 72 65 61 64 69 6e 67 20 24 -info "reading $
26ff0 66 69 6e 66 6f 28 70 74 68 2c 24 6d 6f 64 29 2e finfo(pth,$mod).
27000 2e 2e 22 0a 09 69 66 20 7b 5b 63 61 74 63 68 20 .."..if {[catch
27010 7b 73 65 74 20 68 6e 64 6c 20 5b 6f 70 65 6e 20 {set hndl [open
27020 22 24 66 69 6e 66 6f 28 70 74 68 2c 24 6d 6f 64 "$finfo(pth,$mod
27030 29 22 20 72 5d 7d 5d 7d 20 7b 0a 09 20 20 20 20 )" r]}]} {..
27040 66 61 74 61 6c 2d 65 72 72 6f 72 20 22 46 61 69 fatal-error "Fai
27050 6c 65 64 20 74 6f 20 6f 70 65 6e 20 66 69 6c 65 led to open file
27060 3a 20 24 66 69 6e 66 6f 28 70 74 68 2c 24 6d 6f : $finfo(pth,$mo
27070 64 29 22 0a 09 7d 0a 09 24 74 65 78 74 20 69 6e d)"..}..$text in
27080 73 65 72 74 20 31 2e 30 20 5b 72 65 61 64 20 24 sert 1.0 [read $
27090 68 6e 64 6c 5d 0a 09 63 6c 6f 73 65 20 24 68 6e hndl]..close $hn
270a0 64 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 dl. }.. #
270b0 44 69 66 66 20 74 68 65 20 74 77 6f 20 66 69 6c Diff the two fil
270c0 65 73 20 61 6e 64 20 73 74 6f 72 65 20 74 68 65 es and store the
270d0 20 73 75 6d 6d 61 72 79 20 6c 69 6e 65 73 20 69 summary lines i
270e0 6e 74 6f 20 27 67 28 64 69 66 66 29 27 2e 0a 20 nto 'g(diff)'..
270f0 20 20 20 69 66 20 7b 24 6f 70 74 73 28 69 67 6e if {$opts(ign
27100 6f 72 65 62 6c 61 6e 6b 73 29 20 3d 3d 20 31 7d oreblanks) == 1}
27110 20 7b 0a 09 73 65 74 20 64 69 66 66 63 6d 64 20 {..set diffcmd
27120 22 24 6f 70 74 73 28 64 69 66 66 63 6d 64 29 20 "$opts(diffcmd)
27130 24 6f 70 74 73 28 69 67 6e 6f 72 65 62 6c 61 6e $opts(ignoreblan
27140 6b 73 6f 70 74 29 20 20 7b 24 66 69 6e 66 6f 28 ksopt) {$finfo(
27150 70 74 68 2c 31 29 7d 20 5c 0a 09 20 20 7b 24 66 pth,1)} \.. {$f
27160 69 6e 66 6f 28 70 74 68 2c 32 29 7d 22 0a 20 20 info(pth,2)}".
27170 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 } else {..set
27180 64 69 66 66 63 6d 64 20 22 24 6f 70 74 73 28 64 diffcmd "$opts(d
27190 69 66 66 63 6d 64 29 20 7b 24 66 69 6e 66 6f 28 iffcmd) {$finfo(
271a0 70 74 68 2c 31 29 7d 20 7b 24 66 69 6e 66 6f 28 pth,1)} {$finfo(
271b0 70 74 68 2c 32 29 7d 22 0a 20 20 20 20 7d 0a 20 pth,2)}". }.
271c0 20 20 20 73 68 6f 77 2d 69 6e 66 6f 20 22 45 78 show-info "Ex
271d0 65 63 75 74 69 6e 67 20 5c 22 24 64 69 66 66 63 ecuting \"$diffc
271e0 6d 64 5c 22 22 0a 0a 20 20 20 20 73 65 74 20 72 md\"".. set r
271f0 65 73 75 6c 74 20 5b 72 75 6e 2d 63 6f 6d 6d 61 esult [run-comma
27200 6e 64 20 22 65 78 65 63 20 24 64 69 66 66 63 6d nd "exec $diffcm
27210 64 22 5d 0a 20 20 20 20 73 65 74 20 73 74 64 6f d"]. set stdo
27220 75 74 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 75 ut [lindex $resu
27230 6c 74 20 30 5d 0a 20 20 20 20 73 65 74 20 73 74 lt 0]. set st
27240 64 65 72 72 20 5b 6c 69 6e 64 65 78 20 24 72 65 derr [lindex $re
27250 73 75 6c 74 20 31 5d 0a 20 20 20 20 73 65 74 20 sult 1]. set
27260 65 78 69 74 63 6f 64 65 20 5b 6c 69 6e 64 65 78 exitcode [lindex
27270 20 24 72 65 73 75 6c 74 20 32 5d 0a 20 20 20 20 $result 2].
27280 73 65 74 20 67 28 72 65 74 75 72 6e 56 61 6c 75 set g(returnValu
27290 65 29 20 24 65 78 69 74 63 6f 64 65 0a 0a 20 20 e) $exitcode..
272a0 20 20 23 20 54 68 65 20 65 78 69 74 20 63 6f 64 # The exit cod
272b0 65 20 69 73 20 30 20 69 66 20 74 68 65 72 65 20 e is 0 if there
272c0 61 72 65 20 6e 6f 20 64 69 66 66 65 72 65 6e 63 are no differenc
272d0 65 73 20 61 6e 64 20 31 20 69 66 20 74 68 65 72 es and 1 if ther
272e0 65 0a 20 20 20 20 23 20 61 72 65 20 64 69 66 66 e. # are diff
272f0 65 72 65 6e 63 65 73 2e 20 41 6e 79 20 6f 74 68 erences. Any oth
27300 65 72 20 65 78 69 74 20 63 6f 64 65 20 6d 65 61 er exit code mea
27310 6e 73 20 74 72 6f 75 62 6c 65 0a 20 20 20 20 69 ns trouble. i
27320 66 20 7b 24 65 78 69 74 63 6f 64 65 20 3c 20 30 f {$exitcode < 0
27330 20 7c 7c 20 24 65 78 69 74 63 6f 64 65 20 3e 20 || $exitcode >
27340 31 20 7c 7c 20 24 73 74 64 65 72 72 20 21 3d 20 1 || $stderr !=
27350 22 22 7d 20 7b 0a 09 64 6f 2d 65 72 72 6f 72 20 ""} {..do-error
27360 22 64 69 66 66 20 66 61 69 6c 65 64 3a 5c 6e 24 "diff failed:\n$
27370 73 74 64 65 72 72 22 0a 20 20 20 20 7d 0a 0a 20 stderr". }..
27380 20 20 20 73 65 74 20 67 28 64 69 66 66 29 20 7b set g(diff) {
27390 7d 0a 20 20 20 20 73 65 74 20 6c 69 6e 65 73 20 }. set lines
273a0 5b 73 70 6c 69 74 20 24 73 74 64 6f 75 74 20 22 [split $stdout "
273b0 5c 6e 22 5d 0a 0a 20 20 20 20 23 20 49 66 20 74 \n"].. # If t
273c0 68 65 72 65 20 69 73 20 6e 6f 20 6f 75 74 70 75 here is no outpu
273d0 74 20 61 6e 64 20 77 65 20 67 6f 74 20 74 68 69 t and we got thi
273e0 73 20 66 61 72 20 74 68 65 20 66 69 6c 65 73 20 s far the files
273f0 61 72 65 20 65 71 75 61 6c 2c 0a 20 20 20 20 23 are equal,. #
27400 20 6f 74 68 65 72 77 69 73 65 20 63 68 65 63 6b otherwise check
27410 20 69 66 20 74 68 65 20 66 69 72 73 74 20 6c 69 if the first li
27420 6e 65 20 62 65 67 69 6e 73 20 77 69 74 68 20 61 ne begins with a
27430 20 6c 69 6e 65 20 6e 75 6d 62 65 72 2e 20 49 66 line number. If
27440 0a 20 20 20 20 23 20 6e 6f 74 20 74 68 65 72 65 . # not there
27450 20 77 61 73 20 74 72 6f 75 62 6c 65 20 61 6e 64 was trouble and
27460 20 77 65 20 61 62 6f 72 74 2e 20 46 6f 72 20 69 we abort. For i
27470 6e 73 74 61 6e 63 65 2c 20 75 73 69 6e 67 20 61 nstance, using a
27480 20 62 69 6e 61 72 79 0a 20 20 20 20 23 20 66 69 binary. # fi
27490 6c 65 20 72 65 73 75 6c 74 73 20 69 6e 20 74 68 le results in th
274a0 65 20 6d 65 73 73 61 67 65 20 22 42 69 6e 61 72 e message "Binar
274b0 79 20 66 69 6c 65 73 20 2e 2e 2e 22 20 65 74 63 y files ..." etc
274c0 20 6f 6e 20 73 74 64 6f 75 74 2c 0a 20 20 20 20 on stdout,.
274d0 23 20 65 78 69 74 20 63 6f 64 65 20 31 2e 20 54 # exit code 1. T
274e0 68 65 20 6d 65 73 73 61 67 65 20 6d 61 79 20 77 he message may w
274f0 61 72 79 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e ary depending on
27500 20 6c 6f 63 61 6c 65 2e 0a 20 20 20 20 69 66 20 locale.. if
27510 7b 24 6c 69 6e 65 73 20 21 3d 20 22 22 20 26 26 {$lines != "" &&
27520 20 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 20 7b [string match {
27530 5b 30 2d 39 5d 2a 7d 20 24 6c 69 6e 65 73 5d 20 [0-9]*} $lines]
27540 21 3d 20 31 7d 20 7b 0a 09 66 61 74 61 6c 2d 65 != 1} {..fatal-e
27550 72 72 6f 72 20 22 64 69 66 66 20 66 61 69 6c 65 rror "diff faile
27560 64 3a 5c 6e 24 73 74 64 6f 75 74 22 0a 20 20 20 d:\n$stdout".
27570 20 7d 0a 0a 20 20 20 20 23 20 43 6f 6c 6c 65 63 }.. # Collec
27580 74 20 61 6c 6c 20 6c 69 6e 65 73 20 63 6f 6e 74 t all lines cont
27590 61 69 6e 69 6e 67 20 6c 69 6e 65 20 6e 75 6d 62 aining line numb
275a0 65 72 73 0a 20 20 20 20 66 6f 72 65 61 63 68 20 ers. foreach
275b0 6c 69 6e 65 20 24 6c 69 6e 65 73 20 7b 0a 09 69 line $lines {..i
275c0 66 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 f {[string match
275d0 20 7b 5b 30 2d 39 5d 2a 7d 20 24 6c 69 6e 65 5d {[0-9]*} $line]
275e0 7d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 } {.. lappend
275f0 20 67 28 64 69 66 66 29 20 24 6c 69 6e 65 0a 09 g(diff) $line..
27600 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 }. }.. if
27610 7b 24 67 28 61 6e 63 66 69 6c 65 73 65 74 29 7d {$g(ancfileset)}
27620 20 7b 0a 0a 09 23 20 33 2d 77 61 79 20 6d 65 72 {...# 3-way mer
27630 67 65 20 2d 20 63 6f 6d 70 61 72 65 20 31 73 74 ge - compare 1st
27640 20 66 69 6c 65 20 28 6c 65 66 74 3a 20 64 69 66 file (left: dif
27650 66 33 6c 29 20 77 69 74 68 20 61 6e 63 65 73 74 f3l) with ancest
27660 6f 72 0a 09 69 66 20 7b 24 6f 70 74 73 28 69 67 or..if {$opts(ig
27670 6e 6f 72 65 62 6c 61 6e 6b 73 29 20 3d 3d 20 31 noreblanks) == 1
27680 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 64 69 66 } {.. set dif
27690 66 63 6d 64 20 22 24 6f 70 74 73 28 64 69 66 66 fcmd "$opts(diff
276a0 63 6d 64 29 20 24 6f 70 74 73 28 69 67 6e 6f 72 cmd) $opts(ignor
276b0 65 62 6c 61 6e 6b 73 6f 70 74 29 20 5c 0a 09 20 eblanksopt) \..
276c0 20 20 20 20 20 7b 24 66 69 6e 66 6f 28 70 74 68 {$finfo(pth
276d0 2c 31 29 7d 20 7b 24 67 28 61 6e 63 66 69 6c 65 ,1)} {$g(ancfile
276e0 29 7d 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 )}"..} else {..
276f0 20 20 20 73 65 74 20 64 69 66 66 63 6d 64 20 22 set diffcmd "
27700 24 6f 70 74 73 28 64 69 66 66 63 6d 64 29 20 7b $opts(diffcmd) {
27710 24 66 69 6e 66 6f 28 70 74 68 2c 31 29 7d 20 7b $finfo(pth,1)} {
27720 24 67 28 61 6e 63 66 69 6c 65 29 7d 22 0a 09 7d $g(ancfile)}"..}
27730 0a 09 73 68 6f 77 2d 69 6e 66 6f 20 22 45 78 65 ..show-info "Exe
27740 63 75 74 69 6e 67 20 5c 22 24 64 69 66 66 63 6d cuting \"$diffcm
27750 64 5c 22 22 0a 09 73 65 74 20 72 65 73 75 6c 74 d\""..set result
27760 20 5b 72 75 6e 2d 63 6f 6d 6d 61 6e 64 20 22 65 [run-command "e
27770 78 65 63 20 24 64 69 66 66 63 6d 64 22 5d 0a 09 xec $diffcmd"]..
27780 73 65 74 20 73 74 64 6f 75 74 20 5b 6c 69 6e 64 set stdout [lind
27790 65 78 20 24 72 65 73 75 6c 74 20 30 5d 0a 09 73 ex $result 0]..s
277a0 65 74 20 73 74 64 65 72 72 20 5b 6c 69 6e 64 65 et stderr [linde
277b0 78 20 24 72 65 73 75 6c 74 20 31 5d 0a 09 73 65 x $result 1]..se
277c0 74 20 65 78 69 74 63 6f 64 65 20 5b 6c 69 6e 64 t exitcode [lind
277d0 65 78 20 24 72 65 73 75 6c 74 20 32 5d 0a 09 69 ex $result 2]..i
277e0 66 20 7b 24 65 78 69 74 63 6f 64 65 20 3c 20 30 f {$exitcode < 0
277f0 20 7c 7c 20 24 65 78 69 74 63 6f 64 65 20 3e 20 || $exitcode >
27800 31 20 7c 7c 20 24 73 74 64 65 72 72 20 21 3d 20 1 || $stderr !=
27810 22 22 7d 20 7b 0a 09 20 20 20 20 66 61 74 61 6c ""} {.. fatal
27820 2d 65 72 72 6f 72 20 22 64 69 66 66 33 20 66 61 -error "diff3 fa
27830 69 6c 65 64 3a 5c 6e 24 73 74 64 65 72 72 22 0a iled:\n$stderr".
27840 09 7d 0a 09 73 65 74 20 6c 69 6e 65 73 20 5b 73 .}..set lines [s
27850 70 6c 69 74 20 24 73 74 64 6f 75 74 20 22 5c 6e plit $stdout "\n
27860 22 5d 0a 09 73 65 74 20 67 28 64 69 66 66 33 6c "]..set g(diff3l
27870 29 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 6c 69 ) {}..foreach li
27880 6e 65 20 24 6c 69 6e 65 73 20 7b 0a 09 20 20 20 ne $lines {..
27890 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 if {[string mat
278a0 63 68 20 7b 5b 30 2d 39 5d 2a 7d 20 24 6c 69 6e ch {[0-9]*} $lin
278b0 65 5d 7d 20 7b 0a 09 09 69 66 20 7b 5b 72 65 67 e]} {...if {[reg
278c0 65 78 70 20 7b 5e 5b 30 2d 39 5d 2a 2c 7d 20 24 exp {^[0-9]*,} $
278d0 6c 69 6e 65 20 6d 61 74 63 68 5d 7d 20 7b 0a 09 line match]} {..
278e0 09 20 20 20 20 72 65 67 65 78 70 20 7b 28 5b 30 . regexp {([0
278f0 2d 39 5d 2a 29 2c 28 5b 30 2d 39 5d 2a 29 2e 2a -9]*),([0-9]*).*
27900 7d 20 24 6c 69 6e 65 20 6d 61 74 63 68 76 61 72 } $line matchvar
27910 20 73 31 20 73 32 0a 09 09 7d 20 65 6c 73 65 20 s1 s2...} else
27920 7b 0a 09 09 20 20 20 20 72 65 67 65 78 70 20 7b {... regexp {
27930 28 5b 30 2d 39 5d 2a 29 2e 2a 7d 20 24 6c 69 6e ([0-9]*).*} $lin
27940 65 20 6d 61 74 63 68 76 61 72 20 73 31 0a 09 09 e matchvar s1...
27950 20 20 20 20 73 65 74 20 73 32 20 24 73 31 0a 09 set s2 $s1..
27960 09 7d 0a 0a 09 09 6c 61 70 70 65 6e 64 20 67 28 .}....lappend g(
27970 64 69 66 66 33 6c 29 20 24 73 31 0a 09 09 66 6f diff3l) $s1...fo
27980 72 20 7b 73 65 74 20 69 20 24 73 31 7d 20 7b 24 r {set i $s1} {$
27990 69 20 3c 3d 20 24 73 32 7d 20 7b 69 6e 63 72 20 i <= $s2} {incr
279a0 69 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 20 67 i} {... set g
279b0 28 64 69 66 66 33 6c 24 69 29 20 31 0a 09 09 7d (diff3l$i) 1...}
279c0 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 23 20 33 .. }..}...# 3
279d0 2d 77 61 79 20 6d 65 72 67 65 20 2d 20 63 6f 6d -way merge - com
279e0 70 61 72 65 20 32 6e 64 20 66 69 6c 65 20 28 72 pare 2nd file (r
279f0 69 67 68 74 3a 20 64 69 66 66 33 72 29 20 77 69 ight: diff3r) wi
27a00 74 68 20 61 6e 63 65 73 74 6f 72 0a 09 69 66 20 th ancestor..if
27a10 7b 24 6f 70 74 73 28 69 67 6e 6f 72 65 62 6c 61 {$opts(ignorebla
27a20 6e 6b 73 29 20 3d 3d 20 31 7d 20 7b 0a 09 20 20 nks) == 1} {..
27a30 20 20 73 65 74 20 64 69 66 66 63 6d 64 20 22 24 set diffcmd "$
27a40 6f 70 74 73 28 64 69 66 66 63 6d 64 29 20 24 6f opts(diffcmd) $o
27a50 70 74 73 28 69 67 6e 6f 72 65 62 6c 61 6e 6b 73 pts(ignoreblanks
27a60 6f 70 74 29 20 5c 0a 09 20 20 20 20 20 20 7b 24 opt) \.. {$
27a70 66 69 6e 66 6f 28 70 74 68 2c 32 29 7d 20 7b 24 finfo(pth,2)} {$
27a80 67 28 61 6e 63 66 69 6c 65 29 7d 22 0a 09 7d 20 g(ancfile)}"..}
27a90 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 else {.. set
27aa0 64 69 66 66 63 6d 64 20 22 24 6f 70 74 73 28 64 diffcmd "$opts(d
27ab0 69 66 66 63 6d 64 29 20 7b 24 66 69 6e 66 6f 28 iffcmd) {$finfo(
27ac0 70 74 68 2c 32 29 7d 20 7b 24 67 28 61 6e 63 66 pth,2)} {$g(ancf
27ad0 69 6c 65 29 7d 22 0a 09 7d 0a 09 73 68 6f 77 2d ile)}"..}..show-
27ae0 69 6e 66 6f 20 22 45 78 65 63 75 74 69 6e 67 20 info "Executing
27af0 5c 22 24 64 69 66 66 63 6d 64 5c 22 22 0a 09 73 \"$diffcmd\""..s
27b00 65 74 20 72 65 73 75 6c 74 20 5b 72 75 6e 2d 63 et result [run-c
27b10 6f 6d 6d 61 6e 64 20 22 65 78 65 63 20 24 64 69 ommand "exec $di
27b20 66 66 63 6d 64 22 5d 0a 09 73 65 74 20 73 74 64 ffcmd"]..set std
27b30 6f 75 74 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 out [lindex $res
27b40 75 6c 74 20 30 5d 0a 09 73 65 74 20 73 74 64 65 ult 0]..set stde
27b50 72 72 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 75 rr [lindex $resu
27b60 6c 74 20 31 5d 0a 09 73 65 74 20 65 78 69 74 63 lt 1]..set exitc
27b70 6f 64 65 20 5b 6c 69 6e 64 65 78 20 24 72 65 73 ode [lindex $res
27b80 75 6c 74 20 32 5d 0a 09 69 66 20 7b 24 65 78 69 ult 2]..if {$exi
27b90 74 63 6f 64 65 20 3c 20 30 20 7c 7c 20 24 65 78 tcode < 0 || $ex
27ba0 69 74 63 6f 64 65 20 3e 20 31 20 7c 7c 20 24 73 itcode > 1 || $s
27bb0 74 64 65 72 72 20 21 3d 20 22 22 7d 20 7b 0a 09 tderr != ""} {..
27bc0 20 20 20 20 66 61 74 61 6c 2d 65 72 72 6f 72 20 fatal-error
27bd0 22 64 69 66 66 33 20 66 61 69 6c 65 64 3a 5c 6e "diff3 failed:\n
27be0 24 73 74 64 65 72 72 22 0a 09 7d 0a 09 73 65 74 $stderr"..}..set
27bf0 20 6c 69 6e 65 73 20 5b 73 70 6c 69 74 20 24 73 lines [split $s
27c00 74 64 6f 75 74 20 22 5c 6e 22 5d 0a 09 73 65 74 tdout "\n"]..set
27c10 20 67 28 64 69 66 66 33 72 29 20 7b 7d 0a 09 66 g(diff3r) {}..f
27c20 6f 72 65 61 63 68 20 6c 69 6e 65 20 24 6c 69 6e oreach line $lin
27c30 65 73 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 73 es {.. if {[s
27c40 74 72 69 6e 67 20 6d 61 74 63 68 20 7b 5b 30 2d tring match {[0-
27c50 39 5d 2a 7d 20 24 6c 69 6e 65 5d 7d 20 7b 0a 09 9]*} $line]} {..
27c60 09 69 66 20 7b 5b 72 65 67 65 78 70 20 7b 5e 5b .if {[regexp {^[
27c70 30 2d 39 5d 2a 2c 7d 20 24 6c 69 6e 65 20 6d 61 0-9]*,} $line ma
27c80 74 63 68 5d 7d 20 7b 0a 09 09 20 20 20 20 72 65 tch]} {... re
27c90 67 65 78 70 20 7b 28 5b 30 2d 39 5d 2a 29 2c 28 gexp {([0-9]*),(
27ca0 5b 30 2d 39 5d 2a 29 2e 2a 7d 20 24 6c 69 6e 65 [0-9]*).*} $line
27cb0 20 6d 61 74 63 68 76 61 72 20 73 31 20 73 32 0a matchvar s1 s2.
27cc0 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 ..} else {...
27cd0 20 72 65 67 65 78 70 20 7b 28 5b 30 2d 39 5d 2a regexp {([0-9]*
27ce0 29 2e 2a 7d 20 24 6c 69 6e 65 20 6d 61 74 63 68 ).*} $line match
27cf0 76 61 72 20 73 31 0a 09 09 20 20 20 20 73 65 74 var s1... set
27d00 20 73 32 20 24 73 31 0a 09 09 7d 0a 0a 09 09 6c s2 $s1...}....l
27d10 61 70 70 65 6e 64 20 67 28 64 69 66 66 33 72 29 append g(diff3r)
27d20 20 24 73 31 0a 09 09 66 6f 72 20 7b 73 65 74 20 $s1...for {set
27d30 69 20 24 73 31 7d 20 7b 24 69 20 3c 3d 20 24 73 i $s1} {$i <= $s
27d40 32 7d 20 7b 69 6e 63 72 20 69 7d 20 7b 0a 09 09 2} {incr i} {...
27d50 20 20 20 20 73 65 74 20 67 28 64 69 66 66 33 72 set g(diff3r
27d60 24 69 29 20 31 0a 09 09 7d 0a 09 20 20 20 20 7d $i) 1...}.. }
27d70 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 ..}. }.. #
27d80 20 4d 61 72 6b 20 75 70 20 74 68 65 20 74 77 6f Mark up the two
27d90 20 74 65 78 74 20 77 69 64 67 65 74 73 20 61 6e text widgets an
27da0 64 20 67 6f 20 74 6f 20 74 68 65 20 66 69 72 73 d go to the firs
27db0 74 20 64 69 66 66 20 28 69 66 20 74 68 65 72 65 t diff (if there
27dc0 20 69 73 20 6f 6e 65 29 2e 0a 20 20 20 20 64 72 is one).. dr
27dd0 61 77 2d 6c 69 6e 65 2d 6e 75 6d 62 65 72 73 0a aw-line-numbers.
27de0 0a 20 20 20 20 73 68 6f 77 2d 69 6e 66 6f 20 22 . show-info "
27df0 4d 61 72 6b 69 6e 67 20 64 69 66 66 65 72 65 6e Marking differen
27e00 63 65 73 2e 2e 2e 22 0a 0a 20 20 20 20 24 77 28 ces...".. $w(
27e10 4c 65 66 74 49 6e 66 6f 29 20 63 6f 6e 66 69 67 LeftInfo) config
27e20 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d 61 ure -state norma
27e30 6c 0a 20 20 20 20 24 77 28 52 69 67 68 74 49 6e l. $w(RightIn
27e40 66 6f 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 fo) configure -s
27e50 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 20 20 20 20 tate normal.
27e60 24 77 28 4c 65 66 74 43 42 29 20 63 6f 6e 66 69 $w(LeftCB) confi
27e70 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d gure -state norm
27e80 61 6c 0a 20 20 20 20 24 77 28 52 69 67 68 74 43 al. $w(RightC
27e90 42 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 B) configure -st
27ea0 61 74 65 20 6e 6f 72 6d 61 6c 0a 0a 20 20 20 20 ate normal..
27eb0 69 66 20 7b 5b 6d 61 72 6b 2d 64 69 66 66 73 5d if {[mark-diffs]
27ec0 7d 20 7b 0a 09 73 65 74 20 67 28 70 6f 73 29 20 } {..set g(pos)
27ed0 31 0a 09 6d 6f 76 65 20 31 20 30 20 31 0a 09 62 1..move 1 0 1..b
27ee0 75 74 74 6f 6e 73 20 6e 6f 72 6d 61 6c 0a 20 20 uttons normal.
27ef0 20 20 7d 20 65 6c 73 65 20 7b 0a 09 61 66 74 65 } else {..afte
27f00 72 20 69 64 6c 65 20 7b 73 68 6f 77 2d 69 6e 66 r idle {show-inf
27f10 6f 20 22 46 69 6c 65 73 20 61 72 65 20 69 64 65 o "Files are ide
27f20 6e 74 69 63 61 6c 22 7d 0a 09 62 75 74 74 6f 6e ntical"}..button
27f30 73 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20 7d s disabled. }
27f40 0a 0a 20 20 20 20 23 20 50 72 65 76 65 6e 74 20 .. # Prevent
27f50 74 61 6d 70 65 72 69 6e 67 20 69 6e 20 74 68 65 tampering in the
27f60 20 6c 69 6e 65 20 6e 75 6d 62 65 72 20 77 69 64 line number wid
27f70 67 65 74 73 2e 20 54 68 65 20 74 65 78 74 0a 20 gets. The text.
27f80 20 20 20 23 20 77 69 64 67 65 74 73 20 61 72 65 # widgets are
27f90 20 61 6c 72 65 61 64 79 20 74 61 6b 65 6e 20 63 already taken c
27fa0 61 72 65 20 6f 66 0a 20 20 20 20 24 77 28 4c 65 are of. $w(Le
27fb0 66 74 49 6e 66 6f 29 20 63 6f 6e 66 69 67 75 72 ftInfo) configur
27fc0 65 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 e -state disable
27fd0 64 0a 20 20 20 20 24 77 28 52 69 67 68 74 49 6e d. $w(RightIn
27fe0 66 6f 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 fo) configure -s
27ff0 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 20 20 tate disabled.
28000 20 20 24 77 28 4c 65 66 74 43 42 29 20 63 6f 6e $w(LeftCB) con
28010 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 64 69 figure -state di
28020 73 61 62 6c 65 64 0a 20 20 20 20 24 77 28 52 69 sabled. $w(Ri
28030 67 68 74 43 42 29 20 63 6f 6e 66 69 67 75 72 65 ghtCB) configure
28040 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 -state disabled
28050 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 .}..############
28060 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28070 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28080 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28090 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
280a0 23 23 23 0a 23 20 53 65 74 20 74 68 65 20 58 20 ###.# Set the X
280b0 63 75 72 73 6f 72 20 74 6f 20 22 77 61 74 63 68 cursor to "watch
280c0 22 20 66 6f 72 20 61 20 77 69 6e 64 6f 77 20 61 " for a window a
280d0 6e 64 20 61 6c 6c 20 6f 66 20 69 74 73 20 64 65 nd all of its de
280e0 73 63 65 6e 64 61 6e 74 73 2e 0a 23 23 23 23 23 scendants..#####
280f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28100 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28110 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28120 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28130 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
28140 77 61 74 63 68 2d 63 75 72 73 6f 72 20 7b 61 72 watch-cursor {ar
28150 67 73 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d gs} {. debug-
28160 69 6e 66 6f 20 22 2d 3e 20 77 61 74 63 68 2d 63 info "-> watch-c
28170 75 72 73 6f 72 20 28 24 61 72 67 73 29 22 0a 20 ursor ($args)".
28180 20 20 20 67 6c 6f 62 61 6c 20 63 75 72 72 65 6e global curren
28190 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a t. global w..
281a0 20 20 20 20 2e 20 63 6f 6e 66 69 67 75 72 65 20 . configure
281b0 2d 63 75 72 73 6f 72 20 77 61 74 63 68 0a 20 20 -cursor watch.
281c0 20 20 24 77 28 4c 65 66 74 54 65 78 74 29 20 63 $w(LeftText) c
281d0 6f 6e 66 69 67 75 72 65 20 2d 63 75 72 73 6f 72 onfigure -cursor
281e0 20 77 61 74 63 68 0a 20 20 20 20 24 77 28 52 69 watch. $w(Ri
281f0 67 68 74 54 65 78 74 29 20 63 6f 6e 66 69 67 75 ghtText) configu
28200 72 65 20 2d 63 75 72 73 6f 72 20 77 61 74 63 68 re -cursor watch
28210 0a 20 20 20 20 24 77 28 63 6f 6d 62 6f 29 20 63 . $w(combo) c
28220 6f 6e 66 69 67 75 72 65 20 2d 63 75 72 73 6f 72 onfigure -cursor
28230 20 77 61 74 63 68 0a 20 20 20 20 75 70 64 61 74 watch. updat
28240 65 20 69 64 6c 65 74 61 73 6b 73 0a 7d 0a 0a 23 e idletasks.}..#
28250 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28260 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28270 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28280 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28290 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
282a0 20 52 65 73 74 6f 72 65 20 74 68 65 20 58 20 63 Restore the X c
282b0 75 72 73 6f 72 20 66 6f 72 20 61 20 77 69 6e 64 ursor for a wind
282c0 6f 77 20 61 6e 64 20 61 6c 6c 20 6f 66 20 69 74 ow and all of it
282d0 73 20 64 65 73 63 65 6e 64 61 6e 74 73 2e 0a 23 s descendants..#
282e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
282f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28300 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28310 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28320 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
28330 72 6f 63 20 72 65 73 74 6f 72 65 2d 63 75 72 73 roc restore-curs
28340 6f 72 20 7b 61 72 67 73 7d 20 7b 0a 20 20 20 20 or {args} {.
28350 64 65 62 75 67 2d 69 6e 66 6f 20 22 2d 3e 20 72 debug-info "-> r
28360 65 73 74 6f 72 65 2d 63 75 72 73 6f 72 20 28 24 estore-cursor ($
28370 61 72 67 73 29 22 0a 20 20 20 20 67 6c 6f 62 61 args)". globa
28380 6c 20 63 75 72 72 65 6e 74 0a 20 20 20 20 67 6c l current. gl
28390 6f 62 61 6c 20 77 0a 0a 20 20 20 20 2e 20 63 6f obal w.. . co
283a0 6e 66 69 67 75 72 65 20 2d 63 75 72 73 6f 72 20 nfigure -cursor
283b0 7b 7d 0a 20 20 20 20 24 77 28 4c 65 66 74 54 65 {}. $w(LeftTe
283c0 78 74 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 63 xt) configure -c
283d0 75 72 73 6f 72 20 7b 7d 0a 20 20 20 20 24 77 28 ursor {}. $w(
283e0 52 69 67 68 74 54 65 78 74 29 20 63 6f 6e 66 69 RightText) confi
283f0 67 75 72 65 20 2d 63 75 72 73 6f 72 20 7b 7d 0a gure -cursor {}.
28400 20 20 20 20 24 77 28 63 6f 6d 62 6f 29 20 63 6f $w(combo) co
28410 6e 66 69 67 75 72 65 20 2d 63 75 72 73 6f 72 20 nfigure -cursor
28420 7b 7d 0a 20 20 20 20 73 68 6f 77 2d 69 6e 66 6f {}. show-info
28430 20 22 22 0a 20 20 20 20 75 70 64 61 74 65 20 69 "". update i
28440 64 6c 65 74 61 73 6b 73 0a 7d 0a 0a 23 23 23 23 dletasks.}..####
28450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28460 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28470 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28480 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28490 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 43 68 ###########.# Ch
284a0 65 63 6b 20 69 66 20 65 72 72 6f 72 20 77 61 73 eck if error was
284b0 20 74 68 72 6f 77 6e 20 62 79 20 75 73 20 6f 72 thrown by us or
284c0 20 75 6e 65 78 70 65 63 74 65 64 0a 23 23 23 23 unexpected.####
284d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
284e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
284f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28500 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28510 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
28520 20 63 68 65 63 6b 2d 65 72 72 6f 72 20 7b 72 65 check-error {re
28530 73 75 6c 74 20 6f 75 74 70 75 74 7d 20 7b 0a 20 sult output} {.
28540 20 20 20 67 6c 6f 62 61 6c 20 67 20 65 72 72 6f global g erro
28550 72 49 6e 66 6f 0a 0a 20 20 20 20 69 66 20 7b 24 rInfo.. if {$
28560 72 65 73 75 6c 74 20 26 26 20 24 6f 75 74 70 75 result && $outpu
28570 74 20 21 3d 20 22 46 61 74 61 6c 22 7d 20 7b 0a t != "Fatal"} {.
28580 09 65 72 72 6f 72 20 24 72 65 73 75 6c 74 20 24 .error $result $
28590 65 72 72 6f 72 49 6e 66 6f 0a 20 20 20 20 7d 0a errorInfo. }.
285a0 7d 0a 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 }...############
285b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
285c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
285d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
285e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
285f0 23 23 23 0a 23 20 72 65 64 6f 20 74 68 65 20 63 ###.# redo the c
28600 75 72 72 65 6e 74 20 64 69 66 66 2e 20 41 74 74 urrent diff. Att
28610 65 6d 70 74 20 74 6f 20 72 65 74 75 72 6e 20 74 empt to return t
28620 6f 20 74 68 65 20 73 61 6d 65 20 64 69 66 66 20 o the same diff
28630 72 65 67 69 6f 6e 2c 0a 23 20 6e 75 6d 65 72 69 region,.# numeri
28640 63 61 6c 6c 79 20 73 70 65 61 6b 69 6e 67 2e 0a cally speaking..
28650 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28660 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28670 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28680 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28690 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
286a0 70 72 6f 63 20 72 65 63 6f 6d 70 75 74 65 2d 64 proc recompute-d
286b0 69 66 66 20 7b 7d 20 7b 0a 0a 20 20 20 20 64 65 iff {} {.. de
286c0 62 75 67 2d 69 6e 66 6f 20 22 72 65 63 6f 6d 70 bug-info "recomp
286d0 75 74 65 2d 64 69 66 66 22 0a 20 20 20 20 67 6c ute-diff". gl
286e0 6f 62 61 6c 20 67 0a 20 20 20 20 73 65 74 20 63 obal g. set c
286f0 75 72 72 65 6e 74 20 24 67 28 70 6f 73 29 0a 20 urrent $g(pos).
28700 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 63 debug-info "c
28710 75 72 72 65 6e 74 20 70 6f 73 69 74 69 6f 6e 20 urrent position
28720 24 67 28 70 6f 73 29 22 0a 0a 20 20 20 20 64 6f $g(pos)".. do
28730 2d 64 69 66 66 0a 20 20 20 20 6d 6f 76 65 20 24 -diff. move $
28740 63 75 72 72 65 6e 74 20 30 20 31 0a 20 20 20 20 current 0 1.
28750 63 65 6e 74 65 72 0a 7d 0a 0a 0a 23 23 23 23 23 center.}...#####
28760 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28770 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28780 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28790 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
287a0 23 23 23 23 23 23 23 23 23 23 0a 23 20 46 6c 61 ##########.# Fla
287b0 73 68 20 74 68 65 20 22 72 65 64 69 66 66 22 20 sh the "rediff"
287c0 62 75 74 74 6f 6e 20 61 6e 64 20 74 68 65 6e 20 button and then
287d0 6b 69 63 6b 20 6f 66 66 20 61 20 72 65 64 69 66 kick off a redif
287e0 66 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 f..#############
287f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28800 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28810 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28830 23 23 0a 70 72 6f 63 20 64 6f 2d 64 69 66 66 20 ##.proc do-diff
28840 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 {} {. debug-i
28850 6e 66 6f 20 22 64 6f 2d 64 69 66 66 22 0a 20 20 nfo "do-diff".
28860 20 20 67 6c 6f 62 61 6c 20 67 20 66 69 6e 66 6f global g finfo
28870 20 6d 61 70 20 65 72 72 6f 72 49 6e 66 6f 0a 20 map errorInfo.
28880 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a 0a global opts..
28890 20 20 20 20 77 69 70 65 2d 77 69 6e 64 6f 77 0a wipe-window.
288a0 20 20 20 20 75 70 64 61 74 65 20 69 64 6c 65 74 update idlet
288b0 61 73 6b 73 0a 20 20 20 20 73 65 74 20 72 65 73 asks. set res
288c0 75 6c 74 20 5b 63 61 74 63 68 20 7b 0a 09 69 66 ult [catch {..if
288d0 20 7b 24 67 28 6d 61 70 68 65 69 67 68 74 29 7d {$g(mapheight)}
288e0 20 7b 0a 09 20 20 20 20 23 23 20 46 49 58 4d 45 {.. ## FIXME
288f0 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 74 74 this could bett
28900 65 72 20 61 20 63 61 74 63 68 0a 09 20 20 20 20 er a catch..
28910 63 61 74 63 68 20 7b 24 6d 61 70 20 62 6c 61 6e catch {$map blan
28920 6b 7d 0a 09 7d 0a 0a 09 23 61 73 73 65 6d 62 6c k}..}...#assembl
28930 65 2d 61 72 67 73 0a 09 72 65 64 69 66 66 0a 09 e-args..rediff..
28940 6d 65 72 67 65 2d 72 65 61 64 2d 66 69 6c 65 0a merge-read-file.
28950 09 6d 65 72 67 65 2d 61 64 64 2d 6d 61 72 6b 73 .merge-add-marks
28960 0a 0a 09 23 20 49 66 20 61 20 6d 61 70 20 65 78 ...# If a map ex
28970 69 73 74 73 2c 20 72 65 63 72 65 61 74 65 20 69 ists, recreate i
28980 74 0a 09 69 66 20 7b 24 6f 70 74 73 28 73 68 6f t..if {$opts(sho
28990 77 6d 61 70 29 7d 20 7b 0a 09 20 20 20 20 73 65 wmap)} {.. se
289a0 74 20 67 28 6d 61 70 68 65 69 67 68 74 29 20 2d t g(mapheight) -
289b0 31 0a 09 20 20 20 20 6d 61 70 2d 72 65 73 69 7a 1.. map-resiz
289c0 65 0a 09 7d 0a 0a 20 20 20 20 7d 20 6f 75 74 70 e..}.. } outp
289d0 75 74 5d 0a 0a 20 20 20 20 23 64 65 62 75 67 2d ut].. #debug-
289e0 69 6e 66 6f 20 22 20 20 72 65 73 75 6c 74 3a 20 info " result:
289f0 24 72 65 73 75 6c 74 20 20 20 6f 75 74 70 74 75 $result outptu
28a00 74 3a 20 24 6f 75 74 70 75 74 22 0a 20 20 20 20 t: $output".
28a10 63 68 65 63 6b 2d 65 72 72 6f 72 20 24 72 65 73 check-error $res
28a20 75 6c 74 20 24 6f 75 74 70 75 74 0a 0a 20 20 20 ult $output..
28a30 20 69 66 20 7b 24 67 28 6d 65 72 67 65 66 69 6c if {$g(mergefil
28a40 65 73 65 74 29 7d 20 7b 0a 09 64 6f 2d 73 68 6f eset)} {..do-sho
28a50 77 2d 6d 65 72 67 65 20 31 0a 20 20 20 20 7d 0a w-merge 1. }.
28a60 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 }..#############
28a70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28a80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28a90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28aa0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28ab0 23 23 0a 23 20 47 65 74 20 74 68 69 6e 67 73 20 ##.# Get things
28ac0 67 6f 69 6e 67 2e 2e 2e 0a 23 23 23 23 23 23 23 going....#######
28ad0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28ae0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28af0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28b00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28b10 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 6d 61 ########.proc ma
28b20 69 6e 20 7b 7d 20 7b 0a 20 20 20 20 64 65 62 75 in {} {. debu
28b30 67 2d 69 6e 66 6f 20 22 6d 61 69 6e 22 0a 20 20 g-info "main".
28b40 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 20 20 67 global w. g
28b50 6c 6f 62 61 6c 20 67 20 65 72 72 6f 72 49 6e 66 lobal g errorInf
28b60 6f 0a 20 20 20 20 67 6c 6f 62 61 6c 20 73 74 61 o. global sta
28b70 72 74 75 70 45 72 72 6f 72 0a 20 20 20 20 67 6c rtupError. gl
28b80 6f 62 61 6c 20 6f 70 74 73 0a 20 20 20 20 67 6c obal opts. gl
28b90 6f 62 61 6c 20 77 61 69 74 76 61 72 0a 0a 20 20 obal waitvar..
28ba0 20 20 73 65 74 20 63 6d 64 5f 65 6d 70 74 79 20 set cmd_empty
28bb0 5b 63 6f 6d 6d 61 6e 64 6c 69 6e 65 5d 0a 20 20 [commandline].
28bc0 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 20 20 debug-info "
28bd0 6d 61 69 6e 3a 20 63 6f 6d 6d 61 6e 64 6c 69 6e main: commandlin
28be0 65 20 72 65 74 75 72 6e 65 64 20 24 63 6d 64 5f e returned $cmd_
28bf0 65 6d 70 74 79 22 0a 20 20 20 20 69 66 20 7b 21 empty". if {!
28c00 20 24 63 6d 64 5f 65 6d 70 74 79 7d 20 7b 0a 09 $cmd_empty} {..
28c10 61 73 73 65 6d 62 6c 65 2d 61 72 67 73 0a 20 20 assemble-args.
28c20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 6e 65 77 44 } else {..newD
28c30 69 66 66 44 69 61 6c 6f 67 0a 09 23 20 49 66 20 iffDialog..# If
28c40 74 68 65 79 20 63 61 6e 63 65 6c 20 74 68 65 20 they cancel the
28c50 64 69 61 6c 6f 67 20 62 65 66 6f 72 65 20 64 6f dialog before do
28c60 69 6e 67 20 61 6e 79 20 64 69 66 66 73 2c 20 65 ing any diffs, e
28c70 78 69 74 0a 09 69 66 20 7b 5b 61 73 73 65 6d 62 xit..if {[assemb
28c80 6c 65 2d 61 72 67 73 5d 20 21 3d 20 30 7d 20 7b le-args] != 0} {
28c90 0a 09 20 20 69 66 20 7b 21 20 5b 77 69 6e 66 6f .. if {! [winfo
28ca0 20 65 78 69 73 74 73 20 2e 63 6c 69 65 6e 74 5d exists .client]
28cb0 7d 20 7b 0a 09 20 20 20 20 20 64 6f 2d 65 78 69 } {.. do-exi
28cc0 74 0a 09 20 20 7d 0a 09 20 20 23 20 49 66 20 74 t.. }.. # If t
28cd0 68 65 20 66 75 6c 6c 20 55 49 20 69 73 20 64 72 he full UI is dr
28ce0 61 77 6e 2c 20 64 6f 6e 27 74 20 65 78 69 74 0a awn, don't exit.
28cf0 09 20 20 72 65 74 75 72 6e 0a 09 7d 0a 09 73 65 . return..}..se
28d00 74 20 63 6d 64 5f 65 6d 70 74 79 20 30 0a 20 20 t cmd_empty 0.
28d10 20 20 7d 0a 0a 20 20 20 20 77 6d 20 77 69 74 68 }.. wm with
28d20 64 72 61 77 20 2e 0a 20 20 20 20 77 6d 20 70 72 draw .. wm pr
28d30 6f 74 6f 63 6f 6c 20 2e 20 57 4d 5f 44 45 4c 45 otocol . WM_DELE
28d40 54 45 5f 57 49 4e 44 4f 57 20 64 6f 2d 65 78 69 TE_WINDOW do-exi
28d50 74 0a 20 20 20 20 77 6d 20 74 69 74 6c 65 20 2e t. wm title .
28d60 20 22 24 67 28 6e 61 6d 65 29 20 24 67 28 76 65 "$g(name) $g(ve
28d70 72 73 69 6f 6e 29 22 0a 0a 20 20 20 20 69 66 20 rsion)".. if
28d80 7b 21 5b 63 61 74 63 68 20 7b 73 65 74 20 77 69 {![catch {set wi
28d90 6e 64 6f 77 69 6e 67 73 79 73 74 65 6d 20 5b 74 ndowingsystem [t
28da0 6b 20 77 69 6e 64 6f 77 69 6e 67 73 79 73 74 65 k windowingsyste
28db0 6d 5d 7d 5d 7d 20 7b 0a 09 69 66 20 7b 24 77 69 m]}]} {..if {$wi
28dc0 6e 64 6f 77 69 6e 67 73 79 73 74 65 6d 20 3d 3d ndowingsystem ==
28dd0 20 22 78 31 31 22 7d 20 7b 0a 09 20 20 20 20 23 "x11"} {.. #
28de0 20 41 6c 6c 20 74 68 69 73 20 6e 6f 6e 73 65 6e All this nonsen
28df0 73 65 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 se is necessary
28e00 74 6f 20 75 73 65 20 61 6e 20 69 63 6f 6e 20 62 to use an icon b
28e10 69 74 6d 61 70 20 74 68 61 74 27 73 0a 09 20 20 itmap that's..
28e20 20 20 23 20 6e 6f 74 20 69 6e 20 61 20 73 65 70 # not in a sep
28e30 61 72 61 74 65 20 66 69 6c 65 2e 0a 09 20 20 20 arate file...
28e40 20 74 6f 70 6c 65 76 65 6c 20 2e 69 63 77 0a 09 toplevel .icw..
28e50 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
28e60 66 69 72 73 74 20 22 63 6f 6c 6f 72 22 20 5b 77 first "color" [w
28e70 69 6e 66 6f 20 76 69 73 75 61 6c 20 2e 5d 5d 20 info visual .]]
28e80 3e 3d 20 30 7d 20 7b 0a 09 09 6c 61 62 65 6c 20 >= 0} {...label
28e90 2e 69 63 77 2e 6c 20 2d 69 6d 61 67 65 20 64 65 .icw.l -image de
28ea0 6c 74 61 47 69 66 0a 09 20 20 20 20 7d 20 65 6c ltaGif.. } el
28eb0 73 65 20 7b 0a 09 09 6c 61 62 65 6c 20 2e 69 63 se {...label .ic
28ec0 77 2e 6c 20 2d 69 6d 61 67 65 20 64 65 6c 74 61 w.l -image delta
28ed0 34 38 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 48.. }...
28ee0 70 61 63 6b 20 2e 69 63 77 2e 6c 0a 09 20 20 20 pack .icw.l..
28ef0 20 62 69 6e 64 20 2e 69 63 77 20 3c 42 75 74 74 bind .icw <Butt
28f00 6f 6e 2d 31 3e 20 22 77 6d 20 64 65 69 63 6f 6e on-1> "wm deicon
28f10 69 66 79 20 2e 22 0a 09 20 20 20 20 77 6d 20 69 ify .".. wm i
28f20 63 6f 6e 77 69 6e 64 6f 77 20 2e 20 2e 69 63 77 conwindow . .icw
28f30 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 ..}. }.. s
28f40 65 74 20 67 28 73 74 61 72 74 65 64 29 20 31 0a et g(started) 1.
28f50 20 20 20 20 77 69 70 65 0a 0a 20 20 20 20 69 66 wipe.. if
28f60 20 7b 24 67 28 77 69 6e 64 6f 77 69 6e 67 53 79 {$g(windowingSy
28f70 73 74 65 6d 29 20 3d 3d 20 22 78 31 31 22 7d 20 stem) == "x11"}
28f80 7b 0a 09 67 65 74 5f 63 64 65 5f 70 61 72 61 6d {..get_cde_param
28f90 73 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b s. }. if {
28fa0 24 67 28 77 69 6e 64 6f 77 69 6e 67 53 79 73 74 $g(windowingSyst
28fb0 65 6d 29 20 3d 3d 20 22 61 71 75 61 22 7d 20 7b em) == "aqua"} {
28fc0 0a 09 67 65 74 5f 61 71 75 61 5f 70 61 72 61 6d ..get_aqua_param
28fd0 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 72 65 s. }.. cre
28fe0 61 74 65 2d 64 69 73 70 6c 61 79 0a 0a 20 20 20 ate-display..
28ff0 20 75 70 64 61 74 65 0a 0a 20 20 20 20 64 6f 2d update.. do-
29000 73 68 6f 77 2d 6c 69 6e 65 6e 75 6d 62 65 72 73 show-linenumbers
29010 0a 20 20 20 20 64 6f 2d 73 68 6f 77 2d 6d 61 70 . do-show-map
29020 0a 0a 20 20 20 20 23 20 65 76 61 6c 75 61 74 65 .. # evaluate
29030 20 61 6e 79 20 63 75 73 74 6f 6d 20 63 6f 64 65 any custom code
29040 20 74 68 65 20 75 73 65 72 20 68 61 73 0a 20 20 the user has.
29050 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
29060 74 73 20 6f 70 74 73 28 63 75 73 74 6f 6d 43 6f ts opts(customCo
29070 64 65 29 5d 7d 20 7b 0a 09 69 66 20 7b 5b 63 61 de)]} {..if {[ca
29080 74 63 68 20 5b 6c 69 73 74 20 75 70 6c 65 76 65 tch [list upleve
29090 6c 20 5c 23 30 20 24 6f 70 74 73 28 63 75 73 74 l \#0 $opts(cust
290a0 6f 6d 43 6f 64 65 29 5d 20 65 72 72 6f 72 5d 7d omCode)] error]}
290b0 20 7b 0a 09 20 20 20 20 73 65 74 20 73 74 61 72 {.. set star
290c0 74 75 70 45 72 72 6f 72 20 22 45 72 72 6f 72 20 tupError "Error
290d0 69 6e 20 63 75 73 74 6f 6d 20 63 6f 64 65 3a 20 in custom code:
290e0 5c 6e 5c 6e 24 65 72 72 6f 72 22 0a 09 7d 20 65 \n\n$error"..} e
290f0 6c 73 65 20 7b 0a 09 20 20 20 20 75 70 64 61 74 lse {.. updat
29100 65 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 e..}. }..
29110 69 66 20 7b 24 63 6d 64 5f 65 6d 70 74 79 7d 20 if {$cmd_empty}
29120 7b 0a 09 64 6f 2d 6e 65 77 2d 64 69 66 66 0a 20 {..do-new-diff.
29130 20 20 20 7d 0a 20 20 20 20 6d 6f 76 65 20 66 69 }. move fi
29140 72 73 74 20 31 20 31 0a 0a 20 20 20 20 23 20 74 rst 1 1.. # t
29150 68 69 73 20 66 6f 72 63 65 73 20 61 6c 6c 20 6f his forces all o
29160 66 20 74 68 65 20 76 61 72 69 6f 75 73 20 73 63 f the various sc
29170 72 6f 6c 6c 69 6e 67 20 77 69 6e 64 6f 77 73 20 rolling windows
29180 28 6c 69 6e 65 20 6e 75 6d 62 65 72 73 2c 0a 20 (line numbers,.
29190 20 20 20 23 20 63 68 61 6e 67 65 20 62 61 72 73 # change bars
291a0 2c 20 65 74 63 29 20 74 6f 20 67 65 74 20 69 6e , etc) to get in
291b0 20 73 79 6e 63 2e 0a 20 20 20 20 73 65 74 20 79 sync.. set y
291c0 76 69 65 77 20 5b 24 77 28 52 69 67 68 74 54 65 view [$w(RightTe
291d0 78 74 29 20 79 76 69 65 77 5d 0a 20 20 20 20 76 xt) yview]. v
291e0 73 63 72 6f 6c 6c 2d 73 79 6e 63 20 5b 6c 69 73 scroll-sync [lis
291f0 74 20 24 77 28 52 69 67 68 74 49 6e 66 6f 29 20 t $w(RightInfo)
29200 24 77 28 4c 65 66 74 49 6e 66 6f 29 5d 20 32 20 $w(LeftInfo)] 2
29210 5b 6c 69 6e 64 65 78 20 24 79 76 69 65 77 20 30 [lindex $yview 0
29220 5d 20 5c 0a 20 20 20 20 20 20 5b 6c 69 6e 64 65 ] \. [linde
29230 78 20 24 79 76 69 65 77 20 31 5d 0a 0a 20 20 20 x $yview 1]..
29240 20 77 6d 20 64 65 69 63 6f 6e 69 66 79 20 2e 0a wm deiconify ..
29250 20 20 20 20 75 70 64 61 74 65 20 69 64 6c 65 74 update idlet
29260 61 73 6b 73 0a 0a 20 20 20 20 69 66 20 7b 5b 69 asks.. if {[i
29270 6e 66 6f 20 65 78 69 73 74 73 20 73 74 61 72 74 nfo exists start
29280 75 70 45 72 72 6f 72 5d 7d 20 7b 0a 09 74 6b 5f upError]} {..tk_
29290 6d 65 73 73 61 67 65 42 6f 78 20 2d 69 63 6f 6e messageBox -icon
292a0 20 77 61 72 6e 69 6e 67 20 2d 74 79 70 65 20 6f warning -type o
292b0 6b 20 2d 74 69 74 6c 65 20 22 24 67 28 6e 61 6d k -title "$g(nam
292c0 65 29 20 2d 20 45 72 72 6f 72 20 69 6e 20 5c 0a e) - Error in \.
292d0 09 20 20 53 74 61 72 74 75 70 20 46 69 6c 65 22 . Startup File"
292e0 20 2d 6d 65 73 73 61 67 65 20 24 73 74 61 72 74 -message $start
292f0 75 70 45 72 72 6f 72 0a 20 20 20 20 7d 0a 7d 0a upError. }.}.
29300 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
29310 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29320 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29330 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29340 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29350 0a 23 20 45 72 61 73 65 20 74 6d 70 20 66 69 6c .# Erase tmp fil
29360 65 73 20 28 69 66 20 6e 65 63 65 73 73 61 72 79 es (if necessary
29370 29 20 61 6e 64 20 64 65 73 74 72 6f 79 20 74 68 ) and destroy th
29380 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 23 e application..#
29390 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
293a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
293b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
293c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
293d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
293e0 72 6f 63 20 64 65 6c 2d 74 6d 70 20 7b 7d 20 7b roc del-tmp {} {
293f0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 20 66 69 . global g fi
29400 6e 66 6f 0a 0a 20 20 20 20 69 66 20 7b 24 66 69 nfo.. if {$fi
29410 6e 66 6f 28 74 6d 70 2c 31 29 7d 20 7b 0a 09 66 nfo(tmp,1)} {..f
29420 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6e 66 ile delete $finf
29430 6f 28 70 74 68 2c 31 29 0a 20 20 20 20 7d 0a 20 o(pth,1). }.
29440 20 20 20 69 66 20 7b 24 66 69 6e 66 6f 28 74 6d if {$finfo(tm
29450 70 2c 32 29 7d 20 7b 0a 09 66 69 6c 65 20 64 65 p,2)} {..file de
29460 6c 65 74 65 20 24 66 69 6e 66 6f 28 70 74 68 2c lete $finfo(pth,
29470 32 29 0a 20 20 20 20 7d 0a 20 20 20 20 66 6f 72 2). }. for
29480 65 61 63 68 20 66 20 24 67 28 74 65 6d 70 66 69 each f $g(tempfi
29490 6c 65 73 29 20 7b 0a 09 66 69 6c 65 20 64 65 6c les) {..file del
294a0 65 74 65 20 24 66 0a 20 20 20 20 7d 0a 7d 0a 0a ete $f. }.}..
294b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
294c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
294d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
294e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
294f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
29500 23 20 50 75 74 20 75 70 20 61 20 77 69 6e 64 6f # Put up a windo
29510 77 20 77 69 74 68 20 66 6f 72 6d 61 74 74 65 64 w with formatted
29520 20 74 65 78 74 0a 23 23 23 23 23 23 23 23 23 23 text.##########
29530 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29540 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29550 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29560 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29570 23 23 23 23 23 0a 70 72 6f 63 20 64 6f 2d 74 65 #####.proc do-te
29580 78 74 2d 69 6e 66 6f 20 7b 77 20 74 69 74 6c 65 xt-info {w title
29590 20 74 65 78 74 7d 20 7b 0a 20 20 20 20 67 6c 6f text} {. glo
295a0 62 61 6c 20 67 0a 0a 20 20 20 20 63 61 74 63 68 bal g.. catch
295b0 20 22 64 65 73 74 72 6f 79 20 24 77 22 0a 20 20 "destroy $w".
295c0 20 20 74 6f 70 6c 65 76 65 6c 20 24 77 0a 0a 20 toplevel $w..
295d0 20 20 20 77 6d 20 67 72 6f 75 70 20 24 77 20 2e wm group $w .
295e0 0a 20 20 20 20 77 6d 20 74 72 61 6e 73 69 65 6e . wm transien
295f0 74 20 24 77 20 2e 0a 20 20 20 20 77 6d 20 74 69 t $w .. wm ti
29600 74 6c 65 20 24 77 20 22 24 67 28 6e 61 6d 65 29 tle $w "$g(name)
29610 20 48 65 6c 70 20 2d 20 24 74 69 74 6c 65 22 0a Help - $title".
29620 0a 20 20 20 20 69 66 20 7b 24 67 28 77 69 6e 64 . if {$g(wind
29630 6f 77 69 6e 67 53 79 73 74 65 6d 29 20 3d 3d 20 owingSystem) ==
29640 22 61 71 75 61 22 7d 20 7b 0a 09 73 65 74 41 71 "aqua"} {..setAq
29650 75 61 44 69 61 6c 6f 67 53 74 79 6c 65 20 24 77 uaDialogStyle $w
29660 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 . }.. set
29670 77 69 64 74 68 20 36 34 0a 20 20 20 20 73 65 74 width 64. set
29680 20 68 65 69 67 68 74 20 33 32 0a 0a 20 20 20 20 height 32..
29690 66 72 61 6d 65 20 24 77 2e 66 20 2d 62 64 20 32 frame $w.f -bd 2
296a0 20 2d 72 65 6c 69 65 66 20 73 75 6e 6b 65 6e 0a -relief sunken.
296b0 20 20 20 20 70 61 63 6b 20 24 77 2e 66 20 2d 73 pack $w.f -s
296c0 69 64 65 20 74 6f 70 20 2d 66 69 6c 6c 20 62 6f ide top -fill bo
296d0 74 68 20 2d 65 78 70 61 6e 64 20 79 0a 0a 20 20 th -expand y..
296e0 20 20 74 65 78 74 20 24 77 2e 66 2e 74 69 74 6c text $w.f.titl
296f0 65 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63 e -highlightthic
29700 6b 6e 65 73 73 20 30 20 2d 62 64 20 30 20 2d 68 kness 0 -bd 0 -h
29710 65 69 67 68 74 20 32 20 2d 77 72 61 70 20 77 6f eight 2 -wrap wo
29720 72 64 20 5c 0a 20 20 20 20 20 20 2d 77 69 64 74 rd \. -widt
29730 68 20 35 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 h 50 -background
29740 20 77 68 69 74 65 20 2d 66 6f 72 65 67 72 6f 75 white -foregrou
29750 6e 64 20 62 6c 61 63 6b 0a 0a 20 20 20 20 74 65 nd black.. te
29760 78 74 20 24 77 2e 66 2e 74 65 78 74 20 2d 77 72 xt $w.f.text -wr
29770 61 70 20 77 6f 72 64 20 2d 73 65 74 67 72 69 64 ap word -setgrid
29780 20 74 72 75 65 20 2d 70 61 64 78 20 32 30 20 2d true -padx 20 -
29790 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 highlightthickne
297a0 73 73 20 30 20 5c 0a 20 20 20 20 20 20 2d 62 64 ss 0 \. -bd
297b0 20 30 20 2d 77 69 64 74 68 20 24 77 69 64 74 68 0 -width $width
297c0 20 2d 68 65 69 67 68 74 20 24 68 65 69 67 68 74 -height $height
297d0 20 2d 79 73 63 72 6f 6c 6c 20 5b 6c 69 73 74 20 -yscroll [list
297e0 24 77 2e 66 2e 76 73 62 20 73 65 74 5d 20 5c 0a $w.f.vsb set] \.
297f0 20 20 20 20 20 20 2d 62 61 63 6b 67 72 6f 75 6e -backgroun
29800 64 20 77 68 69 74 65 20 2d 66 6f 72 65 67 72 6f d white -foregro
29810 75 6e 64 20 62 6c 61 63 6b 0a 20 20 20 20 73 63 und black. sc
29820 72 6f 6c 6c 62 61 72 20 24 77 2e 66 2e 76 73 62 rollbar $w.f.vsb
29830 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 -borderwidth 1
29840 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 24 -command [list $
29850 77 2e 66 2e 74 65 78 74 20 79 76 69 65 77 5d 20 w.f.text yview]
29860 5c 0a 20 20 20 20 20 20 2d 6f 72 69 65 6e 74 20 \. -orient
29870 76 65 72 74 69 63 61 6c 0a 0a 20 20 20 20 70 61 vertical.. pa
29880 63 6b 20 24 77 2e 66 2e 76 73 62 20 2d 73 69 64 ck $w.f.vsb -sid
29890 65 20 72 69 67 68 74 20 2d 66 69 6c 6c 20 79 20 e right -fill y
298a0 2d 65 78 70 61 6e 64 20 6e 0a 20 20 20 20 70 61 -expand n. pa
298b0 63 6b 20 24 77 2e 66 2e 74 69 74 6c 65 20 2d 73 ck $w.f.title -s
298c0 69 64 65 20 74 6f 70 20 2d 66 69 6c 6c 20 78 20 ide top -fill x
298d0 2d 65 78 70 61 6e 64 20 6e 0a 20 20 20 20 70 61 -expand n. pa
298e0 63 6b 20 24 77 2e 66 2e 74 65 78 74 20 2d 73 69 ck $w.f.text -si
298f0 64 65 20 6c 65 66 74 20 2d 66 69 6c 6c 20 62 6f de left -fill bo
29900 74 68 20 2d 65 78 70 61 6e 64 20 79 0a 0a 20 20 th -expand y..
29910 20 20 66 6f 63 75 73 20 24 77 2e 66 2e 74 65 78 focus $w.f.tex
29920 74 0a 0a 20 20 20 20 62 75 74 74 6f 6e 20 24 77 t.. button $w
29930 2e 64 6f 6e 65 20 2d 74 65 78 74 20 44 69 73 6d .done -text Dism
29940 69 73 73 20 2d 63 6f 6d 6d 61 6e 64 20 22 64 65 iss -command "de
29950 73 74 72 6f 79 20 24 77 22 0a 20 20 20 20 70 61 stroy $w". pa
29960 63 6b 20 24 77 2e 64 6f 6e 65 20 2d 73 69 64 65 ck $w.done -side
29970 20 72 69 67 68 74 20 2d 66 69 6c 6c 20 6e 6f 6e right -fill non
29980 65 20 2d 70 61 64 79 20 35 20 2d 70 61 64 78 20 e -pady 5 -padx
29990 35 0a 0a 20 20 20 20 70 75 74 2d 74 65 78 74 20 5.. put-text
299a0 24 77 2e 66 2e 74 69 74 6c 65 20 22 3c 74 74 6c $w.f.title "<ttl
299b0 3e 24 74 69 74 6c 65 3c 2f 74 74 6c 3e 22 0a 20 >$title</ttl>".
299c0 20 20 20 70 75 74 2d 74 65 78 74 20 24 77 2e 66 put-text $w.f
299d0 2e 74 65 78 74 20 24 74 65 78 74 0a 20 20 20 20 .text $text.
299e0 24 77 2e 66 2e 74 65 78 74 20 63 6f 6e 66 69 67 $w.f.text config
299f0 75 72 65 20 2d 73 74 61 74 65 20 64 69 73 61 62 ure -state disab
29a00 6c 65 64 0a 0a 20 20 20 20 77 6d 20 67 65 6f 6d led.. wm geom
29a10 65 74 72 79 20 24 77 20 24 7b 77 69 64 74 68 7d etry $w ${width}
29a20 78 24 7b 68 65 69 67 68 74 7d 0a 20 20 20 20 75 x${height}. u
29a30 70 64 61 74 65 20 69 64 6c 65 74 61 73 6b 73 0a pdate idletasks.
29a40 20 20 20 20 72 61 69 73 65 20 24 77 0a 7d 0a 0a raise $w.}..
29a50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29a60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29a70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29a80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29a90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
29aa0 23 20 63 65 6e 74 65 72 73 20 77 69 6e 64 6f 77 # centers window
29ab0 20 77 20 6f 76 65 72 20 70 61 72 65 6e 74 0a 23 w over parent.#
29ac0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29ad0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29ae0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29af0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29b00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 ##############.p
29b10 72 6f 63 20 63 65 6e 74 65 72 57 69 6e 64 6f 77 roc centerWindow
29b20 20 7b 77 20 7b 73 69 7a 65 20 7b 7d 7d 7d 20 7b {w {size {}}} {
29b30 0a 20 20 20 20 75 70 64 61 74 65 0a 20 20 20 20 . update.
29b40 73 65 74 20 70 61 72 65 6e 74 20 2e 0a 0a 20 20 set parent ...
29b50 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 if {[llength $
29b60 73 69 7a 65 5d 20 3e 20 30 7d 20 7b 0a 09 73 65 size] > 0} {..se
29b70 74 20 77 57 69 64 74 68 20 5b 6c 69 6e 64 65 78 t wWidth [lindex
29b80 20 24 73 69 7a 65 20 30 5d 0a 09 73 65 74 20 77 $size 0]..set w
29b90 48 65 69 67 68 74 20 5b 6c 69 6e 64 65 78 20 24 Height [lindex $
29ba0 73 69 7a 65 20 31 5d 0a 20 20 20 20 7d 20 65 6c size 1]. } el
29bb0 73 65 20 7b 0a 09 73 65 74 20 77 57 69 64 74 68 se {..set wWidth
29bc0 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 64 74 68 [winfo reqwidth
29bd0 20 24 77 5d 0a 09 73 65 74 20 77 48 65 69 67 68 $w]..set wHeigh
29be0 74 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 69 67 t [winfo reqheig
29bf0 68 74 20 24 77 5d 0a 20 20 20 20 7d 0a 0a 20 20 ht $w]. }..
29c00 20 20 73 65 74 20 70 57 69 64 74 68 20 5b 77 69 set pWidth [wi
29c10 6e 66 6f 20 72 65 71 77 69 64 74 68 20 24 70 61 nfo reqwidth $pa
29c20 72 65 6e 74 5d 0a 20 20 20 20 73 65 74 20 70 48 rent]. set pH
29c30 65 69 67 68 74 20 5b 77 69 6e 66 6f 20 72 65 71 eight [winfo req
29c40 68 65 69 67 68 74 20 24 70 61 72 65 6e 74 5d 0a height $parent].
29c50 20 20 20 20 73 65 74 20 70 58 20 5b 77 69 6e 66 set pX [winf
29c60 6f 20 72 6f 6f 74 78 20 24 70 61 72 65 6e 74 5d o rootx $parent]
29c70 0a 20 20 20 20 73 65 74 20 70 59 20 5b 77 69 6e . set pY [win
29c80 66 6f 20 72 6f 6f 74 79 20 24 70 61 72 65 6e 74 fo rooty $parent
29c90 5d 0a 0a 20 20 20 20 73 65 74 20 63 65 6e 74 65 ].. set cente
29ca0 72 58 20 5b 65 78 70 72 20 7b 24 70 58 20 2b 28 rX [expr {$pX +(
29cb0 24 70 57 69 64 74 68 20 2f 20 32 29 7d 5d 0a 20 $pWidth / 2)}].
29cc0 20 20 20 73 65 74 20 63 65 6e 74 65 72 59 20 5b set centerY [
29cd0 65 78 70 72 20 7b 24 70 59 20 2b 28 24 70 48 65 expr {$pY +($pHe
29ce0 69 67 68 74 20 2f 20 32 29 7d 5d 0a 0a 20 20 20 ight / 2)}]..
29cf0 20 73 65 74 20 78 20 5b 65 78 70 72 20 7b 24 63 set x [expr {$c
29d00 65 6e 74 65 72 58 20 2d 28 24 77 57 69 64 74 68 enterX -($wWidth
29d10 20 2f 20 32 29 7d 5d 0a 20 20 20 20 73 65 74 20 / 2)}]. set
29d20 79 20 5b 65 78 70 72 20 7b 24 63 65 6e 74 65 72 y [expr {$center
29d30 59 20 2d 28 24 77 48 65 69 67 68 74 20 2f 20 32 Y -($wHeight / 2
29d40 29 7d 5d 0a 0a 20 20 20 20 69 66 20 7b 5b 6c 6c )}].. if {[ll
29d50 65 6e 67 74 68 20 24 73 69 7a 65 5d 20 3e 20 30 ength $size] > 0
29d60 7d 20 7b 0a 09 77 6d 20 67 65 6f 6d 65 74 72 79 } {..wm geometry
29d70 20 24 77 20 22 3d 24 7b 77 57 69 64 74 68 7d 78 $w "=${wWidth}x
29d80 24 7b 77 48 65 69 67 68 74 7d 2b 24 7b 78 7d 2b ${wHeight}+${x}+
29d90 24 7b 79 7d 22 0a 20 20 20 20 7d 20 65 6c 73 65 ${y}". } else
29da0 20 7b 0a 09 77 6d 20 67 65 6f 6d 65 74 72 79 20 {..wm geometry
29db0 24 77 20 22 3d 2b 24 7b 78 7d 2b 24 7b 79 7d 22 $w "=+${x}+${y}"
29dc0 0a 20 20 20 20 7d 0a 20 20 20 20 75 70 64 61 74 . }. updat
29dd0 65 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 23 e.}..###########
29de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29df0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29e00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29e10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29e20 23 23 23 23 0a 23 20 54 68 65 20 22 4e 65 77 20 ####.# The "New
29e30 44 69 66 66 22 20 64 69 61 6c 6f 67 0a 23 20 49 Diff" dialog.# I
29e40 6e 20 6f 72 64 65 72 20 74 6f 20 62 65 20 61 62 n order to be ab
29e50 6c 65 20 74 6f 20 65 6e 74 65 72 20 6f 6e 6c 79 le to enter only
29e60 20 6f 6e 65 20 66 69 6c 65 6e 61 6d 65 20 69 66 one filename if
29e70 20 69 74 27 73 20 61 20 72 65 76 69 73 69 6f 6e it's a revision
29e80 2d 63 6f 6e 74 72 6f 6c 6c 65 64 0a 23 20 66 69 -controlled.# fi
29e90 6c 65 2c 20 74 68 65 20 64 69 61 6c 6f 67 20 6e le, the dialog n
29ea0 6f 77 20 63 6f 6c 6c 65 63 74 73 20 74 68 65 20 ow collects the
29eb0 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 73 65 arguments and se
29ec0 6e 64 73 20 74 68 65 6d 20 74 68 72 6f 75 67 68 nds them through
29ed0 20 74 68 65 0a 23 20 63 6f 6d 6d 61 6e 64 20 6c the.# command l
29ee0 69 6e 65 20 70 61 72 73 65 72 2e 0a 23 23 23 23 ine parser..####
29ef0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29f00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29f10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29f20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
29f30 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
29f40 20 6e 65 77 44 69 66 66 44 69 61 6c 6f 67 20 7b newDiffDialog {
29f50 7d 20 7b 0a 20 20 20 20 64 65 62 75 67 2d 69 6e } {. debug-in
29f60 66 6f 20 22 6e 65 77 44 69 66 66 44 69 61 6c 6f fo "newDiffDialo
29f70 67 22 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 20 g". global g
29f80 77 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 6e w. global fin
29f90 66 6f 0a 0a 20 20 20 20 73 65 74 20 67 28 6d 65 fo.. set g(me
29fa0 72 67 65 66 69 6c 65 29 20 22 22 0a 20 20 20 20 rgefile) "".
29fb0 73 65 74 20 67 28 6d 65 72 67 65 66 69 6c 65 73 set g(mergefiles
29fc0 65 74 29 20 30 0a 0a 20 20 20 20 73 65 74 20 77 et) 0.. set w
29fd0 61 69 74 76 61 72 20 7b 7d 0a 20 20 20 20 73 65 aitvar {}. se
29fe0 74 20 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 t w(newDiffPopup
29ff0 29 20 2e 6e 65 77 44 69 66 66 50 6f 70 75 70 0a ) .newDiffPopup.
2a000 0a 20 20 20 20 69 66 20 7b 5b 77 69 6e 66 6f 20 . if {[winfo
2a010 65 78 69 73 74 73 20 24 77 28 6e 65 77 44 69 66 exists $w(newDif
2a020 66 50 6f 70 75 70 29 5d 7d 20 7b 0a 09 64 65 62 fPopup)]} {..deb
2a030 75 67 2d 69 6e 66 6f 20 22 20 24 77 28 6e 65 77 ug-info " $w(new
2a040 44 69 66 66 50 6f 70 75 70 29 20 61 6c 72 65 61 DiffPopup) alrea
2a050 64 79 20 65 78 69 73 74 73 2c 20 6a 75 73 74 20 dy exists, just
2a060 63 65 6e 74 65 72 69 6e 67 22 0a 20 20 20 20 7d centering". }
2a070 20 65 6c 73 65 20 7b 0a 09 64 65 62 75 67 2d 69 else {..debug-i
2a080 6e 66 6f 20 22 20 63 72 65 61 74 69 6e 67 20 24 nfo " creating $
2a090 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 22 w(newDiffPopup)"
2a0a0 0a 09 74 6f 70 6c 65 76 65 6c 20 24 77 28 6e 65 ..toplevel $w(ne
2a0b0 77 44 69 66 66 50 6f 70 75 70 29 0a 0a 09 77 6d wDiffPopup)...wm
2a0c0 20 67 72 6f 75 70 20 24 77 28 6e 65 77 44 69 66 group $w(newDif
2a0d0 66 50 6f 70 75 70 29 20 2e 0a 09 23 20 57 6f 6e fPopup) ...# Won
2a0e0 27 74 20 73 74 61 72 74 20 61 73 20 74 68 65 20 't start as the
2a0f0 66 69 72 73 74 20 77 69 6e 64 6f 77 20 6f 6e 20 first window on
2a100 57 69 6e 64 6f 77 73 20 69 66 20 69 74 27 73 20 Windows if it's
2a110 74 72 61 6e 73 69 65 6e 74 0a 09 69 66 20 7b 5b transient..if {[
2a120 77 69 6e 66 6f 20 65 78 69 73 74 73 20 2e 63 6c winfo exists .cl
2a130 69 65 6e 74 5d 7d 20 7b 0a 09 20 20 20 20 77 6d ient]} {.. wm
2a140 20 74 72 61 6e 73 69 65 6e 74 20 24 77 28 6e 65 transient $w(ne
2a150 77 44 69 66 66 50 6f 70 75 70 29 20 2e 0a 09 7d wDiffPopup) ...}
2a160 0a 09 77 6d 20 74 69 74 6c 65 20 24 77 28 6e 65 ..wm title $w(ne
2a170 77 44 69 66 66 50 6f 70 75 70 29 20 22 4e 65 77 wDiffPopup) "New
2a180 20 44 69 66 66 22 0a 0a 09 69 66 20 7b 24 67 28 Diff"...if {$g(
2a190 77 69 6e 64 6f 77 69 6e 67 53 79 73 74 65 6d 29 windowingSystem)
2a1a0 20 3d 3d 20 22 61 71 75 61 22 7d 20 7b 0a 09 20 == "aqua"} {..
2a1b0 20 20 20 73 65 74 41 71 75 61 44 69 61 6c 6f 67 setAquaDialog
2a1c0 53 74 79 6c 65 20 24 77 28 6e 65 77 44 69 66 66 Style $w(newDiff
2a1d0 50 6f 70 75 70 29 0a 09 7d 0a 0a 09 77 6d 20 70 Popup)..}...wm p
2a1e0 72 6f 74 6f 63 6f 6c 20 24 77 28 6e 65 77 44 69 rotocol $w(newDi
2a1f0 66 66 50 6f 70 75 70 29 20 57 4d 5f 44 45 4c 45 ffPopup) WM_DELE
2a200 54 45 5f 57 49 4e 44 4f 57 20 7b 77 6d 20 77 69 TE_WINDOW {wm wi
2a210 74 68 64 72 61 77 20 5c 0a 09 20 20 20 20 24 77 thdraw \.. $w
2a220 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 7d 0a (newDiffPopup)}.
2a230 09 77 6d 20 77 69 74 68 64 72 61 77 20 24 77 28 .wm withdraw $w(
2a240 6e 65 77 44 69 66 66 50 6f 70 75 70 29 0a 0a 09 newDiffPopup)...
2a250 73 65 74 20 73 69 6d 70 6c 65 20 5b 66 72 61 6d set simple [fram
2a260 65 20 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 e $w(newDiffPopu
2a270 70 29 2e 73 69 6d 70 6c 65 20 2d 62 6f 72 64 65 p).simple -borde
2a280 72 77 69 64 74 68 20 32 20 2d 72 65 6c 69 65 66 rwidth 2 -relief
2a290 20 67 72 6f 6f 76 65 5d 0a 0a 09 6c 61 62 65 6c groove]...label
2a2a0 20 24 73 69 6d 70 6c 65 2e 6c 31 20 2d 74 65 78 $simple.l1 -tex
2a2b0 74 20 22 46 69 6c 65 20 31 3a 22 0a 09 6c 61 62 t "File 1:"..lab
2a2c0 65 6c 20 24 73 69 6d 70 6c 65 2e 6c 32 20 2d 74 el $simple.l2 -t
2a2d0 65 78 74 20 22 46 69 6c 65 20 32 3a 22 0a 09 65 ext "File 2:"..e
2a2e0 6e 74 72 79 20 24 73 69 6d 70 6c 65 2e 65 31 20 ntry $simple.e1
2a2f0 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 66 69 -textvariable fi
2a300 6e 66 6f 28 66 2c 31 29 0a 09 65 6e 74 72 79 20 nfo(f,1)..entry
2a310 24 73 69 6d 70 6c 65 2e 65 32 20 2d 74 65 78 74 $simple.e2 -text
2a320 76 61 72 69 61 62 6c 65 20 66 69 6e 66 6f 28 66 variable finfo(f
2a330 2c 32 29 0a 0a 09 6c 61 62 65 6c 20 24 73 69 6d ,2)...label $sim
2a340 70 6c 65 2e 6c 72 31 20 2d 74 65 78 74 20 22 2d ple.lr1 -text "-
2a350 72 22 0a 09 6c 61 62 65 6c 20 24 73 69 6d 70 6c r"..label $simpl
2a360 65 2e 6c 72 32 20 2d 74 65 78 74 20 22 2d 72 22 e.lr2 -text "-r"
2a370 0a 09 65 6e 74 72 79 20 24 73 69 6d 70 6c 65 2e ..entry $simple.
2a380 65 72 31 20 2d 74 65 78 74 76 61 72 69 61 62 6c er1 -textvariabl
2a390 65 20 66 69 6e 66 6f 28 72 65 76 73 2c 31 29 0a e finfo(revs,1).
2a3a0 09 65 6e 74 72 79 20 24 73 69 6d 70 6c 65 2e 65 .entry $simple.e
2a3b0 72 32 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 r2 -textvariable
2a3c0 20 66 69 6e 66 6f 28 72 65 76 73 2c 32 29 0a 0a finfo(revs,2)..
2a3d0 09 73 65 74 20 77 28 6e 65 77 44 69 66 66 50 6f .set w(newDiffPo
2a3e0 70 75 70 2c 65 6e 74 72 79 31 29 20 24 73 69 6d pup,entry1) $sim
2a3f0 70 6c 65 2e 65 31 0a 09 73 65 74 20 77 28 6e 65 ple.e1..set w(ne
2a400 77 44 69 66 66 50 6f 70 75 70 2c 65 6e 74 72 79 wDiffPopup,entry
2a410 32 29 20 24 73 69 6d 70 6c 65 2e 65 32 0a 0a 09 2) $simple.e2...
2a420 23 20 77 65 20 77 61 6e 74 20 74 68 65 73 65 20 # we want these
2a430 62 75 74 74 6f 6e 73 20 74 6f 20 62 65 20 74 68 buttons to be th
2a440 65 20 73 61 6d 65 20 68 65 69 67 68 74 20 61 73 e same height as
2a450 0a 09 23 20 74 68 65 20 65 6e 74 72 79 2c 20 73 ..# the entry, s
2a460 6f 20 77 65 27 6c 6c 20 74 72 79 20 74 6f 20 66 o we'll try to f
2a470 6f 72 63 65 20 74 68 65 20 69 73 73 75 65 2e 2e orce the issue..
2a480 2e 0a 09 62 75 74 74 6f 6e 20 24 73 69 6d 70 6c ...button $simpl
2a490 65 2e 62 31 20 2d 62 6f 72 64 65 72 77 69 64 74 e.b1 -borderwidt
2a4a0 68 20 31 20 2d 68 69 67 68 6c 69 67 68 74 74 68 h 1 -highlightth
2a4b0 69 63 6b 6e 65 73 73 20 30 20 5c 0a 09 20 20 2d ickness 0 \.. -
2a4c0 74 65 78 74 20 22 42 72 6f 77 73 65 2e 2e 2e 22 text "Browse..."
2a4d0 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
2a4e0 6e 65 77 44 69 66 66 42 72 6f 77 73 65 20 22 46 newDiffBrowse "F
2a4f0 69 6c 65 20 31 22 20 24 73 69 6d 70 6c 65 2e 65 ile 1" $simple.e
2a500 31 5d 0a 09 62 75 74 74 6f 6e 20 24 73 69 6d 70 1]..button $simp
2a510 6c 65 2e 62 32 20 2d 62 6f 72 64 65 72 77 69 64 le.b2 -borderwid
2a520 74 68 20 31 20 2d 68 69 67 68 6c 69 67 68 74 74 th 1 -highlightt
2a530 68 69 63 6b 6e 65 73 73 20 30 20 5c 0a 09 20 20 hickness 0 \..
2a540 2d 74 65 78 74 20 22 42 72 6f 77 73 65 2e 2e 2e -text "Browse...
2a550 22 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 " -command [list
2a560 20 6e 65 77 44 69 66 66 42 72 6f 77 73 65 20 22 newDiffBrowse "
2a570 46 69 6c 65 20 32 22 20 24 73 69 6d 70 6c 65 2e File 2" $simple.
2a580 65 32 5d 0a 0a 0a 09 23 20 77 65 27 6c 6c 20 75 e2]....# we'll u
2a590 73 65 20 74 68 65 20 67 72 69 64 20 67 65 6f 6d se the grid geom
2a5a0 65 74 72 79 20 6d 61 6e 61 67 65 72 20 74 6f 20 etry manager to
2a5b0 67 65 74 20 74 68 69 6e 67 73 20 6c 69 6e 65 64 get things lined
2a5c0 20 75 70 20 72 69 67 68 74 2e 2e 2e 0a 09 67 72 up right.....gr
2a5d0 69 64 20 24 73 69 6d 70 6c 65 2e 6c 31 20 2d 72 id $simple.l1 -r
2a5e0 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d ow 0 -column 0 -
2a5f0 73 74 69 63 6b 79 20 65 0a 09 67 72 69 64 20 24 sticky e..grid $
2a600 73 69 6d 70 6c 65 2e 65 31 20 2d 72 6f 77 20 30 simple.e1 -row 0
2a610 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 63 6f 6c 75 -column 1 -colu
2a620 6d 6e 73 70 61 6e 20 34 20 2d 73 74 69 63 6b 79 mnspan 4 -sticky
2a630 20 6e 73 65 77 20 2d 70 61 64 79 20 34 0a 09 67 nsew -pady 4..g
2a640 72 69 64 20 24 73 69 6d 70 6c 65 2e 62 31 20 2d rid $simple.b1 -
2a650 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 35 20 row 0 -column 5
2a660 2d 73 74 69 63 6b 79 20 6e 73 65 77 20 2d 70 61 -sticky nsew -pa
2a670 64 78 20 34 20 2d 70 61 64 79 20 34 0a 0a 09 67 dx 4 -pady 4...g
2a680 72 69 64 20 24 73 69 6d 70 6c 65 2e 6c 72 31 20 rid $simple.lr1
2a690 2d 72 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 31 -row 1 -column 1
2a6a0 0a 09 67 72 69 64 20 24 73 69 6d 70 6c 65 2e 65 ..grid $simple.e
2a6b0 72 31 20 2d 72 6f 77 20 31 20 2d 63 6f 6c 75 6d r1 -row 1 -colum
2a6c0 6e 20 32 0a 09 67 72 69 64 20 24 73 69 6d 70 6c n 2..grid $simpl
2a6d0 65 2e 6c 72 32 20 2d 72 6f 77 20 31 20 2d 63 6f e.lr2 -row 1 -co
2a6e0 6c 75 6d 6e 20 33 0a 09 67 72 69 64 20 24 73 69 lumn 3..grid $si
2a6f0 6d 70 6c 65 2e 65 72 32 20 2d 72 6f 77 20 31 20 mple.er2 -row 1
2a700 2d 63 6f 6c 75 6d 6e 20 34 0a 0a 09 67 72 69 64 -column 4...grid
2a710 20 24 73 69 6d 70 6c 65 2e 6c 32 20 2d 72 6f 77 $simple.l2 -row
2a720 20 32 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 73 74 2 -column 0 -st
2a730 69 63 6b 79 20 65 0a 09 67 72 69 64 20 24 73 69 icky e..grid $si
2a740 6d 70 6c 65 2e 65 32 20 2d 72 6f 77 20 32 20 2d mple.e2 -row 2 -
2a750 63 6f 6c 75 6d 6e 20 31 20 2d 63 6f 6c 75 6d 6e column 1 -column
2a760 73 70 61 6e 20 34 20 2d 73 74 69 63 6b 79 20 6e span 4 -sticky n
2a770 73 65 77 20 2d 70 61 64 79 20 34 0a 09 67 72 69 sew -pady 4..gri
2a780 64 20 24 73 69 6d 70 6c 65 2e 62 32 20 2d 72 6f d $simple.b2 -ro
2a790 77 20 32 20 2d 63 6f 6c 75 6d 6e 20 35 20 2d 73 w 2 -column 5 -s
2a7a0 74 69 63 6b 79 20 6e 73 65 77 20 2d 70 61 64 78 ticky nsew -padx
2a7b0 20 34 20 2d 70 61 64 79 20 34 0a 0a 09 67 72 69 4 -pady 4...gri
2a7c0 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 d columnconfigur
2a7d0 65 20 24 73 69 6d 70 6c 65 20 30 20 2d 77 65 69 e $simple 0 -wei
2a7e0 67 68 74 20 30 0a 0a 09 73 65 74 20 6f 70 74 69 ght 0...set opti
2a7f0 6f 6e 73 20 5b 66 72 61 6d 65 20 24 77 28 6e 65 ons [frame $w(ne
2a800 77 44 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 wDiffPopup).opti
2a810 6f 6e 73 20 2d 62 6f 72 64 65 72 77 69 64 74 68 ons -borderwidth
2a820 20 32 20 5c 0a 09 20 20 2d 72 65 6c 69 65 66 20 2 \.. -relief
2a830 67 72 6f 6f 76 65 5d 0a 0a 09 62 75 74 74 6f 6e groove]...button
2a840 20 24 6f 70 74 69 6f 6e 73 2e 6d 6f 72 65 20 2d $options.more -
2a850 74 65 78 74 20 22 4d 6f 72 65 22 20 2d 63 6f 6d text "More" -com
2a860 6d 61 6e 64 20 6f 70 65 6e 2d 6d 6f 72 65 2d 6f mand open-more-o
2a870 70 74 69 6f 6e 73 0a 0a 09 6c 61 62 65 6c 20 24 ptions...label $
2a880 6f 70 74 69 6f 6e 73 2e 6d 6c 20 2d 74 65 78 74 options.ml -text
2a890 20 22 4d 65 72 67 65 20 4f 75 74 70 75 74 22 0a "Merge Output".
2a8a0 09 65 6e 74 72 79 20 24 6f 70 74 69 6f 6e 73 2e .entry $options.
2a8b0 6d 65 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 me -textvariable
2a8c0 20 67 28 6d 65 72 67 65 66 69 6c 65 29 0a 09 6c g(mergefile)..l
2a8d0 61 62 65 6c 20 24 6f 70 74 69 6f 6e 73 2e 61 6c abel $options.al
2a8e0 20 2d 74 65 78 74 20 22 41 6e 63 65 73 74 6f 72 -text "Ancestor
2a8f0 22 0a 09 65 6e 74 72 79 20 24 6f 70 74 69 6f 6e "..entry $option
2a900 73 2e 61 65 20 2d 74 65 78 74 76 61 72 69 61 62 s.ae -textvariab
2a910 6c 65 20 67 28 61 6e 63 66 69 6c 65 29 0a 09 6c le g(ancfile)..l
2a920 61 62 65 6c 20 24 6f 70 74 69 6f 6e 73 2e 6c 31 abel $options.l1
2a930 6c 20 2d 74 65 78 74 20 22 4c 61 62 65 6c 20 66 l -text "Label f
2a940 6f 72 20 46 69 6c 65 20 31 22 0a 09 65 6e 74 72 or File 1"..entr
2a950 79 20 24 6f 70 74 69 6f 6e 73 2e 6c 31 65 20 2d y $options.l1e -
2a960 74 65 78 74 76 61 72 69 61 62 6c 65 20 66 69 6e textvariable fin
2a970 66 6f 28 75 73 65 72 6c 62 6c 2c 31 29 0a 09 6c fo(userlbl,1)..l
2a980 61 62 65 6c 20 24 6f 70 74 69 6f 6e 73 2e 6c 32 abel $options.l2
2a990 6c 20 2d 74 65 78 74 20 22 4c 61 62 65 6c 20 66 l -text "Label f
2a9a0 6f 72 20 46 69 6c 65 20 32 22 0a 09 65 6e 74 72 or File 2"..entr
2a9b0 79 20 24 6f 70 74 69 6f 6e 73 2e 6c 32 65 20 2d y $options.l2e -
2a9c0 74 65 78 74 76 61 72 69 61 62 6c 65 20 66 69 6e textvariable fin
2a9d0 66 6f 28 75 73 65 72 6c 62 6c 2c 32 29 0a 0a 09 fo(userlbl,2)...
2a9e0 67 72 69 64 20 24 6f 70 74 69 6f 6e 73 2e 6d 6f grid $options.mo
2a9f0 72 65 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 72 6f re -column 0 -ro
2aa00 77 20 30 20 2d 73 74 69 63 6b 79 20 6e 77 0a 09 w 0 -sticky nw..
2aa10 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 grid columnconfi
2aa20 67 75 72 65 20 24 6f 70 74 69 6f 6e 73 20 2d 30 gure $options -0
2aa30 20 2d 77 65 69 67 68 74 20 30 0a 0a 09 23 20 68 -weight 0...# h
2aa40 65 72 65 20 61 72 65 20 74 68 65 20 62 75 74 74 ere are the butt
2aa50 6f 6e 73 20 66 6f 72 20 74 68 69 73 20 64 69 61 ons for this dia
2aa60 6c 6f 67 2e 2e 2e 0a 09 73 65 74 20 63 6f 6d 6d log.....set comm
2aa70 61 6e 64 73 20 5b 66 72 61 6d 65 20 24 77 28 6e ands [frame $w(n
2aa80 65 77 44 69 66 66 50 6f 70 75 70 29 2e 62 75 74 ewDiffPopup).but
2aa90 74 6f 6e 73 5d 0a 0a 09 62 75 74 74 6f 6e 20 24 tons]...button $
2aaa0 63 6f 6d 6d 61 6e 64 73 2e 6f 6b 20 2d 74 65 78 commands.ok -tex
2aab0 74 20 22 4f 6b 22 20 2d 77 69 64 74 68 20 35 20 t "Ok" -width 5
2aac0 2d 64 65 66 61 75 6c 74 20 61 63 74 69 76 65 20 -default active
2aad0 2d 63 6f 6d 6d 61 6e 64 20 7b 0a 09 20 20 20 20 -command {..
2aae0 69 66 20 7b 24 67 28 6d 65 72 67 65 66 69 6c 65 if {$g(mergefile
2aaf0 29 20 3d 3d 20 22 22 7d 20 7b 0a 09 09 73 65 74 ) == ""} {...set
2ab00 20 67 28 6d 65 72 67 65 66 69 6c 65 73 65 74 29 g(mergefileset)
2ab10 20 30 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0.. } else {
2ab20 0a 09 09 73 65 74 20 67 28 6d 65 72 67 65 66 69 ...set g(mergefi
2ab30 6c 65 73 65 74 29 20 31 0a 09 20 20 20 20 7d 0a leset) 1.. }.
2ab40 09 20 20 20 20 69 66 20 7b 24 67 28 61 6e 63 66 . if {$g(ancf
2ab50 69 6c 65 29 20 3d 3d 20 22 22 7d 20 7b 0a 09 09 ile) == ""} {...
2ab60 73 65 74 20 67 28 61 6e 63 66 69 6c 65 73 65 74 set g(ancfileset
2ab70 29 20 30 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 ) 0.. } else
2ab80 7b 0a 09 09 73 65 74 20 67 28 61 6e 63 66 69 6c {...set g(ancfil
2ab90 65 73 65 74 29 20 31 0a 09 20 20 20 20 7d 0a 09 eset) 1.. }..
2aba0 20 20 20 20 73 65 74 20 77 61 69 74 76 61 72 20 set waitvar
2abb0 31 0a 09 7d 0a 09 62 75 74 74 6f 6e 20 24 63 6f 1..}..button $co
2abc0 6d 6d 61 6e 64 73 2e 63 61 6e 63 65 6c 20 2d 74 mmands.cancel -t
2abd0 65 78 74 20 22 43 61 6e 63 65 6c 22 20 2d 77 69 ext "Cancel" -wi
2abe0 64 74 68 20 35 20 2d 64 65 66 61 75 6c 74 20 6e dth 5 -default n
2abf0 6f 72 6d 61 6c 20 5c 0a 09 20 20 2d 63 6f 6d 6d ormal \.. -comm
2ac00 61 6e 64 20 7b 0a 09 20 20 20 20 77 6d 20 77 69 and {.. wm wi
2ac10 74 68 64 72 61 77 20 24 77 28 6e 65 77 44 69 66 thdraw $w(newDif
2ac20 66 50 6f 70 75 70 29 3b 20 73 65 74 20 77 61 69 fPopup); set wai
2ac30 74 76 61 72 20 30 0a 09 7d 0a 0a 09 70 61 63 6b tvar 0..}...pack
2ac40 20 24 63 6f 6d 6d 61 6e 64 73 2e 6f 6b 20 24 63 $commands.ok $c
2ac50 6f 6d 6d 61 6e 64 73 2e 63 61 6e 63 65 6c 20 2d ommands.cancel -
2ac60 73 69 64 65 20 6c 65 66 74 20 2d 66 69 6c 6c 20 side left -fill
2ac70 6e 6f 6e 65 20 2d 65 78 70 61 6e 64 20 79 20 5c none -expand y \
2ac80 0a 09 20 20 2d 70 61 64 79 20 34 0a 0a 09 63 61 .. -pady 4...ca
2ac90 74 63 68 20 7b 24 63 6f 6d 6d 61 6e 64 73 2e 6f tch {$commands.o
2aca0 6b 20 2d 64 65 66 61 75 6c 74 20 31 7d 0a 0a 09 k -default 1}...
2acb0 23 20 70 61 63 6b 20 74 68 69 73 20 63 72 75 64 # pack this crud
2acc0 20 69 6e 2e 2e 2e 0a 09 70 61 63 6b 20 24 63 6f in.....pack $co
2acd0 6d 6d 61 6e 64 73 20 2d 73 69 64 65 20 62 6f 74 mmands -side bot
2ace0 74 6f 6d 20 2d 66 69 6c 6c 20 78 20 2d 65 78 70 tom -fill x -exp
2acf0 61 6e 64 20 6e 0a 09 70 61 63 6b 20 24 73 69 6d and n..pack $sim
2ad00 70 6c 65 20 2d 73 69 64 65 20 74 6f 70 20 2d 66 ple -side top -f
2ad10 69 6c 6c 20 62 6f 74 68 20 2d 69 70 61 64 79 20 ill both -ipady
2ad20 32 30 20 2d 69 70 61 64 78 20 32 30 20 2d 70 61 20 -ipadx 20 -pa
2ad30 64 78 20 35 20 2d 70 61 64 79 20 35 0a 0a 09 70 dx 5 -pady 5...p
2ad40 61 63 6b 20 24 6f 70 74 69 6f 6e 73 20 2d 73 69 ack $options -si
2ad50 64 65 20 74 6f 70 20 2d 66 69 6c 6c 20 62 6f 74 de top -fill bot
2ad60 68 20 2d 69 70 61 64 79 20 35 20 2d 69 70 61 64 h -ipady 5 -ipad
2ad70 78 20 35 20 2d 70 61 64 78 20 35 20 2d 70 61 64 x 5 -padx 5 -pad
2ad80 79 20 35 0a 0a 09 62 69 6e 64 20 24 77 28 6e 65 y 5...bind $w(ne
2ad90 77 44 69 66 66 50 6f 70 75 70 29 20 3c 52 65 74 wDiffPopup) <Ret
2ada0 75 72 6e 3e 20 5b 6c 69 73 74 20 24 63 6f 6d 6d urn> [list $comm
2adb0 61 6e 64 73 2e 6f 6b 20 69 6e 76 6f 6b 65 5d 0a ands.ok invoke].
2adc0 09 62 69 6e 64 20 24 77 28 6e 65 77 44 69 66 66 .bind $w(newDiff
2add0 50 6f 70 75 70 29 20 3c 45 73 63 61 70 65 3e 20 Popup) <Escape>
2ade0 5b 6c 69 73 74 20 24 63 6f 6d 6d 61 6e 64 73 2e [list $commands.
2adf0 63 61 6e 63 65 6c 20 69 6e 76 6f 6b 65 5d 0a 0a cancel invoke]..
2ae00 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 5b 77 }. if {[w
2ae10 69 6e 66 6f 20 65 78 69 73 74 73 20 2e 63 6c 69 info exists .cli
2ae20 65 6e 74 5d 7d 20 7b 0a 20 20 20 20 20 20 63 65 ent]} {. ce
2ae30 6e 74 65 72 57 69 6e 64 6f 77 20 24 77 28 6e 65 nterWindow $w(ne
2ae40 77 44 69 66 66 50 6f 70 75 70 29 0a 20 20 20 20 wDiffPopup).
2ae50 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 75 } else {. u
2ae60 70 64 61 74 65 0a 20 20 20 20 7d 0a 20 20 20 20 pdate. }.
2ae70 77 6d 20 64 65 69 63 6f 6e 69 66 79 20 24 77 28 wm deiconify $w(
2ae80 6e 65 77 44 69 66 66 50 6f 70 75 70 29 0a 20 20 newDiffPopup).
2ae90 20 20 72 61 69 73 65 20 24 77 28 6e 65 77 44 69 raise $w(newDi
2aea0 66 66 50 6f 70 75 70 29 0a 20 20 20 20 66 6f 63 ffPopup). foc
2aeb0 75 73 20 24 77 28 6e 65 77 44 69 66 66 50 6f 70 us $w(newDiffPop
2aec0 75 70 2c 65 6e 74 72 79 31 29 0a 20 20 20 20 74 up,entry1). t
2aed0 6b 77 61 69 74 20 76 61 72 69 61 62 6c 65 20 77 kwait variable w
2aee0 61 69 74 76 61 72 0a 20 20 20 20 77 6d 20 77 69 aitvar. wm wi
2aef0 74 68 64 72 61 77 20 24 77 28 6e 65 77 44 69 66 thdraw $w(newDif
2af00 66 50 6f 70 75 70 29 0a 7d 0a 0a 70 72 6f 63 20 fPopup).}..proc
2af10 6f 70 65 6e 2d 6d 6f 72 65 2d 6f 70 74 69 6f 6e open-more-option
2af20 73 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 s {} {. globa
2af30 6c 20 77 0a 0a 20 20 20 20 67 72 69 64 20 24 77 l w.. grid $w
2af40 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 2e 6f (newDiffPopup).o
2af50 70 74 69 6f 6e 73 2e 6d 6c 20 2d 72 6f 77 20 30 ptions.ml -row 0
2af60 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d 73 74 69 63 -column 1 -stic
2af70 6b 79 20 65 0a 20 20 20 20 67 72 69 64 20 24 77 ky e. grid $w
2af80 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 2e 6f (newDiffPopup).o
2af90 70 74 69 6f 6e 73 2e 6d 65 20 2d 72 6f 77 20 30 ptions.me -row 0
2afa0 20 2d 63 6f 6c 75 6d 6e 20 32 20 2d 73 74 69 63 -column 2 -stic
2afb0 6b 79 20 6e 73 65 77 20 2d 70 61 64 79 20 34 0a ky nsew -pady 4.
2afc0 20 20 20 20 67 72 69 64 20 24 77 28 6e 65 77 44 grid $w(newD
2afd0 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f 6e iffPopup).option
2afe0 73 2e 61 6c 20 2d 72 6f 77 20 31 20 2d 63 6f 6c s.al -row 1 -col
2aff0 75 6d 6e 20 31 20 2d 73 74 69 63 6b 79 20 65 0a umn 1 -sticky e.
2b000 20 20 20 20 67 72 69 64 20 24 77 28 6e 65 77 44 grid $w(newD
2b010 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f 6e iffPopup).option
2b020 73 2e 61 65 20 2d 72 6f 77 20 31 20 2d 63 6f 6c s.ae -row 1 -col
2b030 75 6d 6e 20 32 20 2d 73 74 69 63 6b 79 20 6e 73 umn 2 -sticky ns
2b040 65 77 20 2d 70 61 64 79 20 34 0a 20 20 20 20 67 ew -pady 4. g
2b050 72 69 64 20 24 77 28 6e 65 77 44 69 66 66 50 6f rid $w(newDiffPo
2b060 70 75 70 29 2e 6f 70 74 69 6f 6e 73 2e 6c 31 6c pup).options.l1l
2b070 20 2d 72 6f 77 20 32 20 2d 63 6f 6c 75 6d 6e 20 -row 2 -column
2b080 31 20 2d 73 74 69 63 6b 79 20 65 0a 20 20 20 20 1 -sticky e.
2b090 67 72 69 64 20 24 77 28 6e 65 77 44 69 66 66 50 grid $w(newDiffP
2b0a0 6f 70 75 70 29 2e 6f 70 74 69 6f 6e 73 2e 6c 31 opup).options.l1
2b0b0 65 20 2d 72 6f 77 20 32 20 2d 63 6f 6c 75 6d 6e e -row 2 -column
2b0c0 20 32 20 2d 73 74 69 63 6b 79 20 6e 73 65 77 20 2 -sticky nsew
2b0d0 2d 70 61 64 79 20 34 0a 20 20 20 20 67 72 69 64 -pady 4. grid
2b0e0 20 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 $w(newDiffPopup
2b0f0 29 2e 6f 70 74 69 6f 6e 73 2e 6c 32 6c 20 2d 72 ).options.l2l -r
2b100 6f 77 20 33 20 2d 63 6f 6c 75 6d 6e 20 31 20 2d ow 3 -column 1 -
2b110 73 74 69 63 6b 79 20 65 0a 20 20 20 20 67 72 69 sticky e. gri
2b120 64 20 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 d $w(newDiffPopu
2b130 70 29 2e 6f 70 74 69 6f 6e 73 2e 6c 32 65 20 2d p).options.l2e -
2b140 72 6f 77 20 33 20 2d 63 6f 6c 75 6d 6e 20 32 20 row 3 -column 2
2b150 2d 73 74 69 63 6b 79 20 6e 73 65 77 20 2d 70 61 -sticky nsew -pa
2b160 64 79 20 34 0a 0a 20 20 20 20 24 77 28 6e 65 77 dy 4.. $w(new
2b170 44 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f DiffPopup).optio
2b180 6e 73 2e 6d 6f 72 65 20 63 6f 6e 66 69 67 75 72 ns.more configur
2b190 65 20 2d 74 65 78 74 20 22 4c 65 73 73 22 20 5c e -text "Less" \
2b1a0 0a 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 . -command
2b1b0 63 6c 6f 73 65 2d 6d 6f 72 65 2d 6f 70 74 69 6f close-more-optio
2b1c0 6e 73 0a 20 20 20 20 73 65 74 20 78 20 5b 77 69 ns. set x [wi
2b1d0 6e 66 6f 20 77 69 64 74 68 20 24 77 28 6e 65 77 nfo width $w(new
2b1e0 44 69 66 66 50 6f 70 75 70 29 5d 0a 20 20 20 20 DiffPopup)].
2b1f0 73 65 74 20 79 20 5b 77 69 6e 66 6f 20 68 65 69 set y [winfo hei
2b200 67 68 74 20 24 77 28 6e 65 77 44 69 66 66 50 6f ght $w(newDiffPo
2b210 70 75 70 29 5d 0a 20 20 20 20 73 65 74 20 79 69 pup)]. set yi
2b220 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 69 67 68 [winfo reqheigh
2b230 74 20 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 t $w(newDiffPopu
2b240 70 29 2e 6f 70 74 69 6f 6e 73 5d 0a 20 20 20 20 p).options].
2b250 73 65 74 20 6e 65 77 79 20 5b 65 78 70 72 20 24 set newy [expr $
2b260 79 20 2b 20 24 79 69 5d 0a 20 20 20 20 69 66 20 y + $yi]. if
2b270 7b 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20 2e {[winfo exists .
2b280 63 6c 69 65 6e 74 5d 7d 20 7b 0a 20 20 20 20 20 client]} {.
2b290 20 20 63 65 6e 74 65 72 57 69 6e 64 6f 77 20 24 centerWindow $
2b2a0 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 0a w(newDiffPopup).
2b2b0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 } else {.
2b2c0 20 20 20 20 75 70 64 61 74 65 0a 20 20 20 20 7d update. }
2b2d0 0a 7d 0a 0a 70 72 6f 63 20 63 6c 6f 73 65 2d 6d .}..proc close-m
2b2e0 6f 72 65 2d 6f 70 74 69 6f 6e 73 20 7b 7d 20 7b ore-options {} {
2b2f0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 20 20 . global w.
2b300 20 20 67 6c 6f 62 61 6c 20 66 69 6e 66 6f 0a 0a global finfo..
2b310 20 20 20 20 67 72 69 64 20 72 65 6d 6f 76 65 20 grid remove
2b320 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 $w(newDiffPopup)
2b330 2e 6f 70 74 69 6f 6e 73 2e 6d 6c 0a 20 20 20 20 .options.ml.
2b340 67 72 69 64 20 72 65 6d 6f 76 65 20 24 77 28 6e grid remove $w(n
2b350 65 77 44 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 ewDiffPopup).opt
2b360 69 6f 6e 73 2e 6d 65 0a 20 20 20 20 67 72 69 64 ions.me. grid
2b370 20 72 65 6d 6f 76 65 20 24 77 28 6e 65 77 44 69 remove $w(newDi
2b380 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f 6e 73 ffPopup).options
2b390 2e 61 6c 0a 20 20 20 20 67 72 69 64 20 72 65 6d .al. grid rem
2b3a0 6f 76 65 20 24 77 28 6e 65 77 44 69 66 66 50 6f ove $w(newDiffPo
2b3b0 70 75 70 29 2e 6f 70 74 69 6f 6e 73 2e 61 65 0a pup).options.ae.
2b3c0 20 20 20 20 67 72 69 64 20 72 65 6d 6f 76 65 20 grid remove
2b3d0 24 77 28 6e 65 77 44 69 66 66 50 6f 70 75 70 29 $w(newDiffPopup)
2b3e0 2e 6f 70 74 69 6f 6e 73 2e 6c 31 6c 0a 20 20 20 .options.l1l.
2b3f0 20 67 72 69 64 20 72 65 6d 6f 76 65 20 24 77 28 grid remove $w(
2b400 6e 65 77 44 69 66 66 50 6f 70 75 70 29 2e 6f 70 newDiffPopup).op
2b410 74 69 6f 6e 73 2e 6c 31 65 0a 20 20 20 20 67 72 tions.l1e. gr
2b420 69 64 20 72 65 6d 6f 76 65 20 24 77 28 6e 65 77 id remove $w(new
2b430 44 69 66 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f DiffPopup).optio
2b440 6e 73 2e 6c 32 6c 0a 20 20 20 20 67 72 69 64 20 ns.l2l. grid
2b450 72 65 6d 6f 76 65 20 24 77 28 6e 65 77 44 69 66 remove $w(newDif
2b460 66 50 6f 70 75 70 29 2e 6f 70 74 69 6f 6e 73 2e fPopup).options.
2b470 6c 32 65 0a 0a 20 20 20 20 73 65 74 20 67 28 6d l2e.. set g(m
2b480 65 72 67 65 66 69 6c 65 73 65 74 29 20 22 22 0a ergefileset) "".
2b490 20 20 20 20 73 65 74 20 67 28 63 6f 6e 66 6c 69 set g(confli
2b4a0 63 74 73 65 74 29 20 22 22 0a 20 20 20 20 73 65 ctset) "". se
2b4b0 74 20 67 28 61 6e 63 66 69 6c 65 73 65 74 29 20 t g(ancfileset)
2b4c0 22 22 0a 20 20 20 20 73 65 74 20 67 28 61 6e 63 "". set g(anc
2b4d0 66 69 6c 65 29 20 22 22 0a 20 20 20 20 73 65 74 file) "". set
2b4e0 20 66 69 6e 66 6f 28 75 73 65 72 6c 62 6c 2c 31 finfo(userlbl,1
2b4f0 29 20 22 22 0a 20 20 20 20 73 65 74 20 66 69 6e ) "". set fin
2b500 66 6f 28 75 73 65 72 6c 62 6c 2c 32 29 20 22 22 fo(userlbl,2) ""
2b510 0a 0a 20 20 20 20 24 77 28 6e 65 77 44 69 66 66 .. $w(newDiff
2b520 50 6f 70 75 70 29 2e 6f 70 74 69 6f 6e 73 2e 6d Popup).options.m
2b530 6f 72 65 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 ore configure -t
2b540 65 78 74 20 22 4d 6f 72 65 22 20 5c 0a 20 20 20 ext "More" \.
2b550 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 6f 70 65 6e -command open
2b560 2d 6d 6f 72 65 2d 6f 70 74 69 6f 6e 73 0a 7d 0a -more-options.}.
2b570 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
2b580 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b590 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b5a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b5b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b5c0 0a 23 20 46 69 6c 65 20 62 72 6f 77 73 65 72 20 .# File browser
2b5d0 66 6f 72 20 74 68 65 20 22 4e 65 77 20 44 69 66 for the "New Dif
2b5e0 66 22 20 64 69 61 6c 6f 67 0a 23 23 23 23 23 23 f" dialog.######
2b5f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b600 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b610 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b620 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b630 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 6e #########.proc n
2b640 65 77 44 69 66 66 42 72 6f 77 73 65 20 7b 74 69 ewDiffBrowse {ti
2b650 74 6c 65 20 77 69 64 67 65 74 7d 20 7b 0a 20 20 tle widget} {.
2b660 20 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 20 20 20 global w..
2b670 73 65 74 20 66 6f 6f 20 5b 24 77 69 64 67 65 74 set foo [$widget
2b680 20 67 65 74 5d 0a 20 20 20 20 73 65 74 20 69 6e get]. set in
2b690 69 74 69 61 6c 64 69 72 20 5b 66 69 6c 65 20 64 itialdir [file d
2b6a0 69 72 6e 61 6d 65 20 24 66 6f 6f 5d 0a 20 20 20 irname $foo].
2b6b0 20 73 65 74 20 69 6e 69 74 69 61 6c 66 69 6c 65 set initialfile
2b6c0 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 6f 6f [file tail $foo
2b6d0 5d 0a 20 20 20 20 73 65 74 20 66 69 6c 65 6e 61 ]. set filena
2b6e0 6d 65 20 5b 74 6b 5f 67 65 74 4f 70 65 6e 46 69 me [tk_getOpenFi
2b6f0 6c 65 20 2d 74 69 74 6c 65 20 24 74 69 74 6c 65 le -title $title
2b700 20 2d 69 6e 69 74 69 61 6c 66 69 6c 65 20 24 69 -initialfile $i
2b710 6e 69 74 69 61 6c 66 69 6c 65 20 5c 0a 20 20 20 nitialfile \.
2b720 20 20 20 2d 69 6e 69 74 69 61 6c 64 69 72 20 24 -initialdir $
2b730 69 6e 69 74 69 61 6c 64 69 72 5d 0a 20 20 20 20 initialdir].
2b740 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
2b750 74 68 20 24 66 69 6c 65 6e 61 6d 65 5d 20 3e 20 th $filename] >
2b760 30 7d 20 7b 0a 09 24 77 69 64 67 65 74 20 64 65 0} {..$widget de
2b770 6c 65 74 65 20 30 20 65 6e 64 0a 09 24 77 69 64 lete 0 end..$wid
2b780 67 65 74 20 69 6e 73 65 72 74 20 30 20 24 66 69 get insert 0 $fi
2b790 6c 65 6e 61 6d 65 0a 09 24 77 69 64 67 65 74 20 lename..$widget
2b7a0 73 65 6c 65 63 74 69 6f 6e 20 72 61 6e 67 65 20 selection range
2b7b0 30 20 65 6e 64 0a 09 24 77 69 64 67 65 74 20 78 0 end..$widget x
2b7c0 76 69 65 77 20 65 6e 64 0a 09 66 6f 63 75 73 20 view end..focus
2b7d0 24 77 69 64 67 65 74 0a 09 72 65 74 75 72 6e 20 $widget..return
2b7e0 24 66 69 6c 65 6e 61 6d 65 0a 20 20 20 20 7d 20 $filename. }
2b7f0 65 6c 73 65 20 7b 0a 09 61 66 74 65 72 20 69 64 else {..after id
2b800 6c 65 20 7b 72 61 69 73 65 20 24 77 28 6e 65 77 le {raise $w(new
2b810 44 69 66 66 50 6f 70 75 70 29 7d 0a 09 72 65 74 DiffPopup)}..ret
2b820 75 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a 7d 0a 0a urn {}. }.}..
2b830 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b840 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b850 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b860 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b870 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
2b880 23 20 61 6c 6c 20 74 68 65 20 63 6f 64 65 20 74 # all the code t
2b890 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 72 65 70 o handle the rep
2b8a0 6f 72 74 20 77 72 69 74 69 6e 67 20 64 69 61 6c ort writing dial
2b8b0 6f 67 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 og..############
2b8c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b8d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b8e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b8f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2b900 23 23 23 0a 70 72 6f 63 20 77 72 69 74 65 2d 72 ###.proc write-r
2b910 65 70 6f 72 74 20 7b 63 6f 6d 6d 61 6e 64 20 61 eport {command a
2b920 72 67 73 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 rgs} {. globa
2b930 6c 20 67 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 l g. global w
2b940 0a 20 20 20 20 67 6c 6f 62 61 6c 20 72 65 70 6f . global repo
2b950 72 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 rt. global fi
2b960 6e 66 6f 0a 0a 20 20 20 20 73 65 74 20 77 28 72 nfo.. set w(r
2b970 65 70 6f 72 74 50 6f 70 75 70 29 20 2e 72 65 70 eportPopup) .rep
2b980 6f 72 74 50 6f 70 75 70 0a 20 20 20 20 73 77 69 ortPopup. swi
2b990 74 63 68 20 2d 2d 20 24 63 6f 6d 6d 61 6e 64 20 tch -- $command
2b9a0 7b 0a 20 20 20 20 70 6f 70 75 70 20 7b 0a 09 20 {. popup {..
2b9b0 20 20 20 69 66 20 7b 21 5b 77 69 6e 66 6f 20 65 if {![winfo e
2b9c0 78 69 73 74 73 20 24 77 28 72 65 70 6f 72 74 50 xists $w(reportP
2b9d0 6f 70 75 70 29 5d 7d 20 7b 0a 09 09 77 72 69 74 opup)]} {...writ
2b9e0 65 2d 72 65 70 6f 72 74 20 62 75 69 6c 64 0a 09 e-report build..
2b9f0 20 20 20 20 7d 0a 09 20 20 20 20 73 65 74 20 72 }.. set r
2ba00 65 70 6f 72 74 28 66 69 6c 65 6e 61 6d 65 29 20 eport(filename)
2ba10 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 70 77 64 5d [file join [pwd]
2ba20 20 24 72 65 70 6f 72 74 28 66 69 6c 65 6e 61 6d $report(filenam
2ba30 65 29 5d 0a 09 20 20 20 20 77 72 69 74 65 2d 72 e)].. write-r
2ba40 65 70 6f 72 74 20 75 70 64 61 74 65 0a 0a 09 20 eport update...
2ba50 20 20 20 63 65 6e 74 65 72 57 69 6e 64 6f 77 20 centerWindow
2ba60 24 77 28 72 65 70 6f 72 74 50 6f 70 75 70 29 0a $w(reportPopup).
2ba70 09 20 20 20 20 77 6d 20 64 65 69 63 6f 6e 69 66 . wm deiconif
2ba80 79 20 24 77 28 72 65 70 6f 72 74 50 6f 70 75 70 y $w(reportPopup
2ba90 29 0a 09 20 20 20 20 72 61 69 73 65 20 24 77 28 ).. raise $w(
2baa0 72 65 70 6f 72 74 50 6f 70 75 70 29 0a 09 7d 0a reportPopup)..}.
2bab0 20 20 20 20 63 61 6e 63 65 6c 20 7b 0a 09 20 20 cancel {..
2bac0 20 20 77 6d 20 77 69 74 68 64 72 61 77 20 24 77 wm withdraw $w
2bad0 28 72 65 70 6f 72 74 50 6f 70 75 70 29 0a 09 7d (reportPopup)..}
2bae0 0a 20 20 20 20 75 70 64 61 74 65 20 7b 0a 0a 09 . update {...
2baf0 20 20 20 20 73 65 74 20 73 74 61 74 65 4c 65 66 set stateLef
2bb00 74 20 22 64 69 73 61 62 6c 65 64 22 0a 09 20 20 t "disabled"..
2bb10 20 20 73 65 74 20 73 74 61 74 65 52 69 67 68 74 set stateRight
2bb20 20 22 64 69 73 61 62 6c 65 64 22 0a 09 20 20 20 "disabled"..
2bb30 20 69 66 20 7b 24 72 65 70 6f 72 74 28 64 6f 53 if {$report(doS
2bb40 69 64 65 4c 65 66 74 29 7d 20 7b 0a 09 09 73 65 ideLeft)} {...se
2bb50 74 20 73 74 61 74 65 4c 65 66 74 20 22 6e 6f 72 t stateLeft "nor
2bb60 6d 61 6c 22 0a 09 20 20 20 20 7d 0a 09 20 20 20 mal".. }..
2bb70 20 69 66 20 7b 24 72 65 70 6f 72 74 28 64 6f 53 if {$report(doS
2bb80 69 64 65 52 69 67 68 74 29 7d 20 7b 0a 09 09 73 ideRight)} {...s
2bb90 65 74 20 73 74 61 74 65 52 69 67 68 74 20 22 6e et stateRight "n
2bba0 6f 72 6d 61 6c 22 0a 09 20 20 20 20 7d 0a 0a 09 ormal".. }...
2bbb0 20 20 20 20 24 77 28 72 65 70 6f 72 74 4c 69 6e $w(reportLin
2bbc0 65 6e 75 6d 4c 65 66 74 29 20 63 6f 6e 66 69 67 enumLeft) config
2bbd0 75 72 65 20 2d 73 74 61 74 65 20 24 73 74 61 74 ure -state $stat
2bbe0 65 4c 65 66 74 0a 09 20 20 20 20 24 77 28 72 65 eLeft.. $w(re
2bbf0 70 6f 72 74 43 4d 4c 65 66 74 29 20 63 6f 6e 66 portCMLeft) conf
2bc00 69 67 75 72 65 20 2d 73 74 61 74 65 20 24 73 74 igure -state $st
2bc10 61 74 65 4c 65 66 74 0a 09 20 20 20 20 24 77 28 ateLeft.. $w(
2bc20 72 65 70 6f 72 74 54 65 78 74 4c 65 66 74 29 20 reportTextLeft)
2bc30 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
2bc40 20 24 73 74 61 74 65 4c 65 66 74 0a 0a 09 20 20 $stateLeft...
2bc50 20 20 24 77 28 72 65 70 6f 72 74 4c 69 6e 65 6e $w(reportLinen
2bc60 75 6d 52 69 67 68 74 29 20 63 6f 6e 66 69 67 75 umRight) configu
2bc70 72 65 20 2d 73 74 61 74 65 20 24 73 74 61 74 65 re -state $state
2bc80 52 69 67 68 74 0a 09 20 20 20 20 24 77 28 72 65 Right.. $w(re
2bc90 70 6f 72 74 43 4d 52 69 67 68 74 29 20 63 6f 6e portCMRight) con
2bca0 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 24 73 figure -state $s
2bcb0 74 61 74 65 52 69 67 68 74 0a 09 20 20 20 20 24 tateRight.. $
2bcc0 77 28 72 65 70 6f 72 74 54 65 78 74 52 69 67 68 w(reportTextRigh
2bcd0 74 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 t) configure -st
2bce0 61 74 65 20 24 73 74 61 74 65 52 69 67 68 74 0a ate $stateRight.
2bcf0 0a 09 7d 0a 20 20 20 20 73 61 76 65 20 7b 0a 09 ..}. save {..
2bd00 20 20 20 20 73 65 74 20 6c 65 66 74 4c 69 6e 65 set leftLine
2bd10 73 20 5b 6c 69 6e 64 65 78 20 5b 73 70 6c 69 74 s [lindex [split
2bd20 20 5b 24 77 28 4c 65 66 74 54 65 78 74 29 20 69 [$w(LeftText) i
2bd30 6e 64 65 78 20 65 6e 64 2d 31 6c 69 6e 65 73 5d ndex end-1lines]
2bd40 20 2e 5d 20 30 5d 0a 09 20 20 20 20 73 65 74 20 .] 0].. set
2bd50 72 69 67 68 74 4c 69 6e 65 73 20 5b 6c 69 6e 64 rightLines [lind
2bd60 65 78 20 5b 73 70 6c 69 74 20 5b 24 77 28 52 69 ex [split [$w(Ri
2bd70 67 68 74 54 65 78 74 29 20 69 6e 64 65 78 20 65 ghtText) index e
2bd80 6e 64 2d 31 6c 69 6e 65 73 5d 20 2e 5d 20 30 5d nd-1lines] .] 0]
2bd90 0a 0a 09 20 20 20 20 23 20 6e 75 6d 62 65 72 20 ... # number
2bda0 6f 66 20 6c 69 6e 65 73 20 6f 66 20 74 68 65 20 of lines of the
2bdb0 6c 61 72 67 65 73 74 20 77 69 6e 64 6f 77 2e 2e largest window..
2bdc0 2e 0a 09 20 20 20 20 73 65 74 20 6d 61 78 6c 69 ... set maxli
2bdd0 6e 65 73 20 5b 6d 61 78 20 24 6c 65 66 74 4c 69 nes [max $leftLi
2bde0 6e 65 73 20 24 72 69 67 68 74 4c 69 6e 65 73 5d nes $rightLines]
2bdf0 0a 0a 09 20 20 20 20 23 20 70 72 6f 62 61 62 6c ... # probabl
2be00 79 20 6f 75 67 68 74 20 74 6f 20 63 61 74 63 68 y ought to catch
2be10 20 74 68 69 73 2c 20 69 6e 20 63 61 73 65 20 69 this, in case i
2be20 74 20 66 61 69 6c 73 2e 20 4d 61 79 62 65 20 6c t fails. Maybe l
2be30 61 74 65 72 2e 2e 2e 0a 09 20 20 20 20 73 65 74 ater..... set
2be40 20 68 61 6e 64 6c 65 20 5b 6f 70 65 6e 20 24 72 handle [open $r
2be50 65 70 6f 72 74 28 66 69 6c 65 6e 61 6d 65 29 20 eport(filename)
2be60 77 5d 0a 0a 09 20 20 20 20 70 75 74 73 20 24 68 w]... puts $h
2be70 61 6e 64 6c 65 20 22 24 67 28 6e 61 6d 65 29 20 andle "$g(name)
2be80 24 67 28 76 65 72 73 69 6f 6e 29 20 72 65 70 6f $g(version) repo
2be90 72 74 22 0a 0a 09 20 20 20 20 23 20 77 72 69 74 rt"... # writ
2bea0 65 20 74 68 65 20 66 69 6c 65 20 6e 61 6d 65 73 e the file names
2beb0 0a 09 20 20 20 20 69 66 20 7b 24 72 65 70 6f 72 .. if {$repor
2bec0 74 28 64 6f 53 69 64 65 4c 65 66 74 29 20 3d 3d t(doSideLeft) ==
2bed0 20 31 20 26 26 20 24 72 65 70 6f 72 74 28 64 6f 1 && $report(do
2bee0 53 69 64 65 52 69 67 68 74 29 20 3d 3d 20 31 7d SideRight) == 1}
2bef0 20 7b 0a 09 09 70 75 74 73 20 24 68 61 6e 64 6c {...puts $handl
2bf00 65 20 22 5c 6e 46 69 6c 65 20 41 3a 20 24 66 69 e "\nFile A: $fi
2bf10 6e 66 6f 28 6c 62 6c 2c 31 29 5c 6e 46 69 6c 65 nfo(lbl,1)\nFile
2bf20 20 42 3a 20 20 24 66 69 6e 66 6f 28 6c 62 6c 2c B: $finfo(lbl,
2bf30 32 29 5c 6e 22 0a 09 20 20 20 20 7d 20 65 6c 73 2)\n".. } els
2bf40 65 69 66 20 7b 24 72 65 70 6f 72 74 28 64 6f 53 eif {$report(doS
2bf50 69 64 65 4c 65 66 74 29 20 3d 3d 20 31 7d 20 7b ideLeft) == 1} {
2bf60 0a 09 09 70 75 74 73 20 24 68 61 6e 64 6c 65 20 ...puts $handle
2bf70 22 5c 6e 46 69 6c 65 3a 20 24 66 69 6e 66 6f 28 "\nFile: $finfo(
2bf80 6c 62 6c 2c 31 29 22 0a 09 20 20 20 20 7d 20 65 lbl,1)".. } e
2bf90 6c 73 65 20 7b 0a 09 09 70 75 74 73 20 24 68 61 lse {...puts $ha
2bfa0 6e 64 6c 65 20 22 5c 6e 46 69 6c 65 3a 20 24 66 ndle "\nFile: $f
2bfb0 69 6e 66 6f 28 6c 62 6c 2c 32 29 22 0a 09 20 20 info(lbl,2)"..
2bfc0 20 20 7d 0a 0a 09 20 20 20 20 70 75 74 73 20 24 }... puts $
2bfd0 68 61 6e 64 6c 65 20 22 6e 75 6d 62 65 72 20 6f handle "number o
2bfe0 66 20 64 69 66 66 73 3a 20 24 67 28 63 6f 75 6e f diffs: $g(coun
2bff0 74 29 22 0a 0a 09 20 20 20 20 73 65 74 20 61 63 t)"... set ac
2c000 6f 75 6e 74 20 5b 73 65 74 20 63 63 6f 75 6e 74 ount [set ccount
2c010 20 5b 73 65 74 20 64 63 6f 75 6e 74 20 30 5d 5d [set dcount 0]]
2c020 0a 09 20 20 20 20 66 6f 72 20 7b 73 65 74 20 69 .. for {set i
2c030 20 31 7d 20 7b 24 69 20 3c 3d 20 24 67 28 63 6f 1} {$i <= $g(co
2c040 75 6e 74 29 7d 20 7b 69 6e 63 72 20 69 7d 20 7b unt)} {incr i} {
2c050 0a 09 09 66 6f 72 65 61 63 68 20 7b 6c 69 6e 65 ...foreach {line
2c060 20 73 31 20 65 31 20 73 32 20 65 32 20 74 79 70 s1 e1 s2 e2 typ
2c070 65 7d 20 24 67 28 73 63 72 64 69 66 66 2c 24 69 e} $g(scrdiff,$i
2c080 29 20 7b 20 7d 0a 09 09 73 77 69 74 63 68 20 2d ) { }...switch -
2c090 2d 20 24 74 79 70 65 20 7b 0a 09 09 22 64 22 20 - $type {..."d"
2c0a0 7b 0a 09 09 20 20 20 20 20 20 20 20 69 6e 63 72 {... incr
2c0b0 20 64 63 6f 75 6e 74 0a 09 09 20 20 20 20 7d 0a dcount... }.
2c0c0 09 09 22 61 22 20 7b 0a 09 09 20 20 20 20 20 20 .."a" {...
2c0d0 20 20 69 6e 63 72 20 61 63 6f 75 6e 74 0a 09 09 incr acount...
2c0e0 20 20 20 20 7d 0a 09 09 22 63 22 20 7b 0a 09 09 }..."c" {...
2c0f0 20 20 20 20 20 20 20 20 69 6e 63 72 20 63 63 6f incr cco
2c100 75 6e 74 0a 09 09 20 20 20 20 7d 0a 09 09 7d 0a unt... }...}.
2c110 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 70 75 74 . }... put
2c120 73 20 24 68 61 6e 64 6c 65 20 5b 66 6f 72 6d 61 s $handle [forma
2c130 74 20 22 20 20 20 20 25 36 64 20 72 65 67 69 6f t " %6d regio
2c140 6e 73 20 77 65 72 65 20 64 65 6c 65 74 65 64 22 ns were deleted"
2c150 20 24 64 63 6f 75 6e 74 5d 0a 09 20 20 20 20 70 $dcount].. p
2c160 75 74 73 20 24 68 61 6e 64 6c 65 20 5b 66 6f 72 uts $handle [for
2c170 6d 61 74 20 22 20 20 20 20 25 36 64 20 72 65 67 mat " %6d reg
2c180 69 6f 6e 73 20 77 65 72 65 20 61 64 64 65 64 22 ions were added"
2c190 20 24 61 63 6f 75 6e 74 5d 0a 09 20 20 20 20 70 $acount].. p
2c1a0 75 74 73 20 24 68 61 6e 64 6c 65 20 5b 66 6f 72 uts $handle [for
2c1b0 6d 61 74 20 22 20 20 20 20 25 36 64 20 72 65 67 mat " %6d reg
2c1c0 69 6f 6e 73 20 77 65 72 65 20 63 68 61 6e 67 65 ions were change
2c1d0 64 22 20 24 63 63 6f 75 6e 74 5d 0a 0a 09 20 20 d" $ccount]...
2c1e0 20 20 70 75 74 73 20 24 68 61 6e 64 6c 65 20 22 puts $handle "
2c1f0 5c 6e 22 0a 09 20 20 20 20 66 6f 72 20 7b 73 65 \n".. for {se
2c200 74 20 69 20 31 7d 20 7b 24 69 20 3c 3d 20 24 6d t i 1} {$i <= $m
2c210 61 78 6c 69 6e 65 73 7d 20 7b 69 6e 63 72 20 69 axlines} {incr i
2c220 7d 20 7b 0a 09 09 73 65 74 20 6f 75 74 28 4c 65 } {...set out(Le
2c230 66 74 29 20 5b 73 65 74 20 6f 75 74 28 52 69 67 ft) [set out(Rig
2c240 68 74 29 20 22 22 5d 0a 09 09 66 6f 72 65 61 63 ht) ""]...foreac
2c250 68 20 73 69 64 65 20 7b 4c 65 66 74 20 52 69 67 h side {Left Rig
2c260 68 74 7d 20 7b 0a 0a 09 09 20 20 20 20 69 66 20 ht} {.... if
2c270 7b 24 73 69 64 65 20 3d 3d 20 22 4c 65 66 74 22 {$side == "Left"
2c280 20 26 26 20 24 69 20 3e 20 24 6c 65 66 74 4c 69 && $i > $leftLi
2c290 6e 65 73 7d 20 62 72 65 61 6b 0a 0a 09 09 20 20 nes} break....
2c2a0 20 20 69 66 20 7b 24 73 69 64 65 20 3d 3d 20 22 if {$side == "
2c2b0 52 69 67 68 74 22 20 26 26 20 24 69 20 3e 20 24 Right" && $i > $
2c2c0 72 69 67 68 74 4c 69 6e 65 73 7d 20 62 72 65 61 rightLines} brea
2c2d0 6b 0a 0a 0a 09 09 20 20 20 20 69 66 20 7b 24 72 k..... if {$r
2c2e0 65 70 6f 72 74 28 64 6f 4c 69 6e 65 4e 75 6d 62 eport(doLineNumb
2c2f0 65 72 73 24 73 69 64 65 29 7d 20 7b 0a 09 09 20 ers$side)} {...
2c300 20 20 20 20 20 20 20 73 65 74 20 77 69 64 67 65 set widge
2c310 74 20 24 77 28 24 7b 73 69 64 65 7d 49 6e 66 6f t $w(${side}Info
2c320 29 0a 09 09 20 20 20 20 20 20 20 20 73 65 74 20 )... set
2c330 6e 75 6d 62 65 72 20 5b 73 74 72 69 6e 67 20 74 number [string t
2c340 72 69 6d 72 69 67 68 74 20 5b 24 77 69 64 67 65 rimright [$widge
2c350 74 20 67 65 74 20 22 24 69 2e 30 22 20 5c 0a 09 t get "$i.0" \..
2c360 09 20 20 20 20 20 20 20 20 20 20 22 24 69 2e 30 . "$i.0
2c370 20 6c 69 6e 65 65 6e 64 22 5d 5d 0a 0a 09 09 20 lineend"]]....
2c380 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 6f 75 append ou
2c390 74 28 24 73 69 64 65 29 20 5b 66 6f 72 6d 61 74 t($side) [format
2c3a0 20 22 25 36 73 20 22 20 24 6e 75 6d 62 65 72 5d "%6s " $number]
2c3b0 0a 09 09 20 20 20 20 7d 0a 0a 09 09 20 20 20 20 ... }....
2c3c0 69 66 20 7b 24 72 65 70 6f 72 74 28 64 6f 43 68 if {$report(doCh
2c3d0 61 6e 67 65 4d 61 72 6b 65 72 73 24 73 69 64 65 angeMarkers$side
2c3e0 29 7d 20 7b 0a 09 09 20 20 20 20 20 20 20 20 73 )} {... s
2c3f0 65 74 20 77 69 64 67 65 74 20 24 77 28 24 7b 73 et widget $w(${s
2c400 69 64 65 7d 43 42 29 0a 09 09 20 20 20 20 20 20 ide}CB)...
2c410 20 20 73 65 74 20 64 61 74 61 20 5b 24 77 69 64 set data [$wid
2c420 67 65 74 20 67 65 74 20 22 24 69 2e 30 22 20 22 get get "$i.0" "
2c430 24 69 2e 31 22 5d 0a 09 09 20 20 20 20 20 20 20 $i.1"]...
2c440 20 61 70 70 65 6e 64 20 6f 75 74 28 24 73 69 64 append out($sid
2c450 65 29 20 22 24 64 61 74 61 20 22 0a 09 09 20 20 e) "$data "...
2c460 20 20 7d 0a 0a 09 09 20 20 20 20 69 66 20 7b 24 }.... if {$
2c470 72 65 70 6f 72 74 28 64 6f 54 65 78 74 24 73 69 report(doText$si
2c480 64 65 29 7d 20 7b 0a 09 09 20 20 20 20 20 20 20 de)} {...
2c490 20 73 65 74 20 77 69 64 67 65 74 20 24 77 28 24 set widget $w($
2c4a0 7b 73 69 64 65 7d 54 65 78 74 29 0a 09 09 20 20 {side}Text)...
2c4b0 20 20 20 20 20 20 61 70 70 65 6e 64 20 6f 75 74 append out
2c4c0 28 24 73 69 64 65 29 20 5b 73 74 72 69 6e 67 20 ($side) [string
2c4d0 74 72 69 6d 72 69 67 68 74 20 5b 24 77 69 64 67 trimright [$widg
2c4e0 65 74 20 67 65 74 20 5c 0a 09 09 20 20 20 20 20 et get \...
2c4f0 20 20 20 20 20 22 24 69 2e 30 22 20 22 24 69 2e "$i.0" "$i.
2c500 30 20 6c 69 6e 65 65 6e 64 22 5d 5d 0a 09 09 20 0 lineend"]]...
2c510 20 20 20 7d 0a 09 09 7d 0a 0a 09 09 69 66 20 7b }...}....if {
2c520 24 72 65 70 6f 72 74 28 64 6f 53 69 64 65 4c 65 $report(doSideLe
2c530 66 74 29 20 3d 3d 20 31 20 26 26 20 24 72 65 70 ft) == 1 && $rep
2c540 6f 72 74 28 64 6f 53 69 64 65 52 69 67 68 74 29 ort(doSideRight)
2c550 20 3d 3d 20 31 7d 20 7b 0a 09 09 20 20 20 20 73 == 1} {... s
2c560 65 74 20 6f 75 74 70 75 74 20 5b 66 6f 72 6d 61 et output [forma
2c570 74 20 22 25 2d 39 30 73 25 2d 39 30 73 22 20 24 t "%-90s%-90s" $
2c580 6f 75 74 28 4c 65 66 74 29 20 24 6f 75 74 28 52 out(Left) $out(R
2c590 69 67 68 74 29 5d 0a 0a 09 09 7d 20 65 6c 73 65 ight)]....} else
2c5a0 69 66 20 7b 24 72 65 70 6f 72 74 28 64 6f 53 69 if {$report(doSi
2c5b0 64 65 52 69 67 68 74 29 20 3d 3d 20 31 7d 20 7b deRight) == 1} {
2c5c0 0a 09 09 20 20 20 20 73 65 74 20 6f 75 74 70 75 ... set outpu
2c5d0 74 20 24 6f 75 74 28 52 69 67 68 74 29 0a 0a 09 t $out(Right)...
2c5e0 09 7d 20 65 6c 73 65 69 66 20 7b 24 72 65 70 6f .} elseif {$repo
2c5f0 72 74 28 64 6f 53 69 64 65 4c 65 66 74 29 20 3d rt(doSideLeft) =
2c600 3d 20 31 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 = 1} {... set
2c610 20 6f 75 74 70 75 74 20 24 6f 75 74 28 4c 65 66 output $out(Lef
2c620 74 29 0a 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 t)....} else {..
2c630 09 20 20 20 20 23 20 77 68 61 74 20 61 20 77 61 . # what a wa
2c640 73 74 65 64 20 65 66 66 6f 72 74 21 0a 09 09 20 sted effort!...
2c650 20 20 20 73 65 74 20 6f 75 74 70 75 74 20 22 22 set output ""
2c660 0a 09 09 7d 0a 09 09 70 75 74 73 20 24 68 61 6e ...}...puts $han
2c670 64 6c 65 20 5b 73 74 72 69 6e 67 20 74 72 69 6d dle [string trim
2c680 72 69 67 68 74 20 24 6f 75 74 70 75 74 5d 0a 09 right $output]..
2c690 20 20 20 20 7d 0a 09 20 20 20 20 63 6c 6f 73 65 }.. close
2c6a0 20 24 68 61 6e 64 6c 65 0a 0a 09 20 20 20 20 77 $handle... w
2c6b0 6d 20 77 69 74 68 64 72 61 77 20 24 77 28 72 65 m withdraw $w(re
2c6c0 70 6f 72 74 50 6f 70 75 70 29 0a 09 7d 0a 20 20 portPopup)..}.
2c6d0 20 20 62 72 6f 77 73 65 20 7b 0a 09 20 20 20 20 browse {..
2c6e0 73 65 74 20 74 79 70 65 73 20 7b 0a 09 09 7b 7b set types {...{{
2c6f0 41 6c 6c 20 46 69 6c 65 73 7d 20 20 20 20 20 20 All Files}
2c700 20 20 20 7b 2a 7d 7d 0a 09 20 20 20 20 7d 0a 0a {*}}.. }..
2c710 09 20 20 20 20 73 65 74 20 70 61 74 68 20 5b 74 . set path [t
2c720 6b 5f 67 65 74 53 61 76 65 46 69 6c 65 20 2d 64 k_getSaveFile -d
2c730 65 66 61 75 6c 74 65 78 74 65 6e 73 69 6f 6e 20 efaultextension
2c740 22 22 20 2d 66 69 6c 65 74 79 70 65 73 20 24 74 "" -filetypes $t
2c750 79 70 65 73 20 5c 0a 09 20 20 20 20 20 20 2d 69 ypes \.. -i
2c760 6e 69 74 69 61 6c 66 69 6c 65 20 24 72 65 70 6f nitialfile $repo
2c770 72 74 28 66 69 6c 65 6e 61 6d 65 29 5d 0a 0a 09 rt(filename)]...
2c780 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
2c790 6c 65 6e 67 74 68 20 24 70 61 74 68 5d 20 3e 20 length $path] >
2c7a0 30 7d 20 7b 0a 09 09 73 65 74 20 72 65 70 6f 72 0} {...set repor
2c7b0 74 28 66 69 6c 65 6e 61 6d 65 29 20 24 70 61 74 t(filename) $pat
2c7c0 68 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 h.. }..}.
2c7d0 62 75 69 6c 64 20 7b 0a 09 20 20 20 20 63 61 74 build {.. cat
2c7e0 63 68 20 7b 64 65 73 74 72 6f 79 20 24 77 28 72 ch {destroy $w(r
2c7f0 65 70 6f 72 74 50 6f 70 75 70 29 7d 0a 09 20 20 eportPopup)}..
2c800 20 20 74 6f 70 6c 65 76 65 6c 20 24 77 28 72 65 toplevel $w(re
2c810 70 6f 72 74 50 6f 70 75 70 29 0a 09 20 20 20 20 portPopup)..
2c820 77 6d 20 67 72 6f 75 70 20 24 77 28 72 65 70 6f wm group $w(repo
2c830 72 74 50 6f 70 75 70 29 20 2e 0a 09 20 20 20 20 rtPopup) ...
2c840 77 6d 20 74 72 61 6e 73 69 65 6e 74 20 24 77 28 wm transient $w(
2c850 72 65 70 6f 72 74 50 6f 70 75 70 29 20 2e 0a 09 reportPopup) ...
2c860 20 20 20 20 77 6d 20 74 69 74 6c 65 20 24 77 28 wm title $w(
2c870 72 65 70 6f 72 74 50 6f 70 75 70 29 20 22 24 67 reportPopup) "$g
2c880 28 6e 61 6d 65 29 20 2d 20 47 65 6e 65 72 61 74 (name) - Generat
2c890 65 20 52 65 70 6f 72 74 22 0a 09 20 20 20 20 77 e Report".. w
2c8a0 6d 20 70 72 6f 74 6f 63 6f 6c 20 24 77 28 72 65 m protocol $w(re
2c8b0 70 6f 72 74 50 6f 70 75 70 29 20 57 4d 5f 44 45 portPopup) WM_DE
2c8c0 4c 45 54 45 5f 57 49 4e 44 4f 57 20 5b 6c 69 73 LETE_WINDOW [lis
2c8d0 74 20 77 72 69 74 65 2d 72 65 70 6f 72 74 20 5c t write-report \
2c8e0 0a 09 20 20 20 20 20 20 63 61 6e 63 65 6c 5d 0a .. cancel].
2c8f0 09 20 20 20 20 77 6d 20 77 69 74 68 64 72 61 77 . wm withdraw
2c900 20 24 77 28 72 65 70 6f 72 74 50 6f 70 75 70 29 $w(reportPopup)
2c910 0a 0a 09 20 20 20 20 69 66 20 7b 24 67 28 77 69 ... if {$g(wi
2c920 6e 64 6f 77 69 6e 67 53 79 73 74 65 6d 29 20 3d ndowingSystem) =
2c930 3d 20 22 61 71 75 61 22 7d 20 7b 0a 09 09 73 65 = "aqua"} {...se
2c940 74 41 71 75 61 44 69 61 6c 6f 67 53 74 79 6c 65 tAquaDialogStyle
2c950 20 24 77 28 72 65 70 6f 72 74 50 6f 70 75 70 29 $w(reportPopup)
2c960 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 73 65 .. }... se
2c970 74 20 63 66 20 5b 66 72 61 6d 65 20 24 77 28 72 t cf [frame $w(r
2c980 65 70 6f 72 74 50 6f 70 75 70 29 2e 63 6c 69 65 eportPopup).clie
2c990 6e 74 46 72 61 6d 65 20 2d 62 64 20 32 20 2d 72 ntFrame -bd 2 -r
2c9a0 65 6c 69 65 66 20 67 72 6f 6f 76 65 5d 0a 09 20 elief groove]..
2c9b0 20 20 20 73 65 74 20 62 66 20 5b 66 72 61 6d 65 set bf [frame
2c9c0 20 24 77 28 72 65 70 6f 72 74 50 6f 70 75 70 29 $w(reportPopup)
2c9d0 2e 62 75 74 74 6f 6e 46 72 61 6d 65 20 2d 62 64 .buttonFrame -bd
2c9e0 20 30 5d 0a 09 20 20 20 20 70 61 63 6b 20 24 63 0].. pack $c
2c9f0 66 20 2d 73 69 64 65 20 74 6f 70 20 2d 66 69 6c f -side top -fil
2ca00 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 l both -expand y
2ca10 20 2d 70 61 64 78 20 35 20 2d 70 61 64 79 20 35 -padx 5 -pady 5
2ca20 0a 09 20 20 20 20 70 61 63 6b 20 24 62 66 20 2d .. pack $bf -
2ca30 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d 66 69 6c side bottom -fil
2ca40 6c 20 78 20 2d 65 78 70 61 6e 64 20 6e 0a 0a 09 l x -expand n...
2ca50 20 20 20 20 23 20 62 75 74 74 6f 6e 73 2e 2e 2e # buttons...
2ca60 0a 09 20 20 20 20 73 65 74 20 77 28 72 65 70 6f .. set w(repo
2ca70 72 74 53 61 76 65 29 20 24 62 66 2e 73 61 76 65 rtSave) $bf.save
2ca80 0a 09 20 20 20 20 73 65 74 20 77 28 72 65 70 6f .. set w(repo
2ca90 72 74 43 61 6e 63 65 6c 29 20 24 62 66 2e 63 61 rtCancel) $bf.ca
2caa0 6e 63 65 6c 0a 0a 09 20 20 20 20 62 75 74 74 6f ncel... butto
2cab0 6e 20 24 77 28 72 65 70 6f 72 74 53 61 76 65 29 n $w(reportSave)
2cac0 20 2d 74 65 78 74 20 22 53 61 76 65 22 20 2d 75 -text "Save" -u
2cad0 6e 64 65 72 6c 69 6e 65 20 30 20 2d 63 6f 6d 6d nderline 0 -comm
2cae0 61 6e 64 20 5c 0a 09 20 20 20 20 20 20 5b 6c 69 and \.. [li
2caf0 73 74 20 77 72 69 74 65 2d 72 65 70 6f 72 74 20 st write-report
2cb00 73 61 76 65 5d 20 2d 77 69 64 74 68 20 36 0a 09 save] -width 6..
2cb10 20 20 20 20 62 75 74 74 6f 6e 20 24 77 28 72 65 button $w(re
2cb20 70 6f 72 74 43 61 6e 63 65 6c 29 20 2d 74 65 78 portCancel) -tex
2cb30 74 20 22 43 61 6e 63 65 6c 22 20 2d 75 6e 64 65 t "Cancel" -unde
2cb40 72 6c 69 6e 65 20 30 20 5c 0a 09 20 20 20 20 20 rline 0 \..
2cb50 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
2cb60 77 72 69 74 65 2d 72 65 70 6f 72 74 20 63 61 6e write-report can
2cb70 63 65 6c 5d 20 2d 77 69 64 74 68 20 36 0a 0a 09 cel] -width 6...
2cb80 20 20 20 20 70 61 63 6b 20 24 77 28 72 65 70 6f pack $w(repo
2cb90 72 74 43 61 6e 63 65 6c 29 20 2d 73 69 64 65 20 rtCancel) -side
2cba0 72 69 67 68 74 20 2d 70 61 64 79 20 35 20 2d 70 right -pady 5 -p
2cbb0 61 64 78 20 35 0a 09 20 20 20 20 70 61 63 6b 20 adx 5.. pack
2cbc0 24 77 28 72 65 70 6f 72 74 53 61 76 65 29 20 2d $w(reportSave) -
2cbd0 73 69 64 65 20 72 69 67 68 74 20 2d 70 61 64 79 side right -pady
2cbe0 20 35 0a 0a 09 20 20 20 20 23 20 63 6c 69 65 6e 5... # clien
2cbf0 74 20 61 72 65 61 2e 0a 09 20 20 20 20 73 65 74 t area... set
2cc00 20 63 6f 6c 28 4c 65 66 74 29 20 30 0a 09 20 20 col(Left) 0..
2cc10 20 20 73 65 74 20 63 6f 6c 28 52 69 67 68 74 29 set col(Right)
2cc20 20 31 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 1.. foreach
2cc30 73 69 64 65 20 5b 6c 69 73 74 20 4c 65 66 74 20 side [list Left
2cc40 52 69 67 68 74 5d 20 7b 0a 09 09 73 65 74 20 63 Right] {...set c
2cc50 68 6f 6f 73 65 20 5b 63 68 65 63 6b 62 75 74 74 hoose [checkbutt
2cc60 6f 6e 20 24 63 66 2e 63 68 6f 6f 73 65 24 73 69 on $cf.choose$si
2cc70 64 65 5d 0a 09 09 73 65 74 20 6c 69 6e 65 6e 75 de]...set linenu
2cc80 6d 20 5b 63 68 65 63 6b 62 75 74 74 6f 6e 20 24 m [checkbutton $
2cc90 63 66 2e 6c 69 6e 65 6e 75 6d 24 73 69 64 65 5d cf.linenum$side]
2cca0 0a 09 09 73 65 74 20 63 6d 20 5b 63 68 65 63 6b ...set cm [check
2ccb0 62 75 74 74 6f 6e 20 24 63 66 2e 63 68 61 6e 67 button $cf.chang
2ccc0 65 6d 61 72 6b 65 72 73 24 73 69 64 65 5d 0a 09 emarkers$side]..
2ccd0 09 73 65 74 20 74 65 78 74 20 5b 63 68 65 63 6b .set text [check
2cce0 62 75 74 74 6f 6e 20 24 63 66 2e 74 65 78 74 24 button $cf.text$
2ccf0 73 69 64 65 5d 0a 0a 09 09 24 63 68 6f 6f 73 65 side]....$choose
2cd00 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 65 78 74 configure -text
2cd10 20 22 24 73 69 64 65 20 53 69 64 65 22 20 5c 0a "$side Side" \.
2cd20 09 09 20 20 2d 76 61 72 69 61 62 6c 65 20 72 65 .. -variable re
2cd30 70 6f 72 74 28 64 6f 53 69 64 65 24 73 69 64 65 port(doSide$side
2cd40 29 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 ) -command [list
2cd50 20 77 72 69 74 65 2d 72 65 70 6f 72 74 20 5c 0a write-report \.
2cd60 09 09 20 20 75 70 64 61 74 65 5d 0a 0a 09 09 24 .. update]....$
2cd70 6c 69 6e 65 6e 75 6d 20 63 6f 6e 66 69 67 75 72 linenum configur
2cd80 65 20 2d 74 65 78 74 20 22 4c 69 6e 65 20 4e 75 e -text "Line Nu
2cd90 6d 62 65 72 73 22 20 5c 0a 09 09 20 20 2d 76 61 mbers" \... -va
2cda0 72 69 61 62 6c 65 20 72 65 70 6f 72 74 28 64 6f riable report(do
2cdb0 4c 69 6e 65 4e 75 6d 62 65 72 73 24 73 69 64 65 LineNumbers$side
2cdc0 29 0a 09 09 24 63 6d 20 63 6f 6e 66 69 67 75 72 )...$cm configur
2cdd0 65 20 2d 74 65 78 74 20 22 43 68 61 6e 67 65 20 e -text "Change
2cde0 4d 61 72 6b 65 72 73 22 20 5c 0a 09 09 20 20 2d Markers" \... -
2cdf0 76 61 72 69 61 62 6c 65 20 72 65 70 6f 72 74 28 variable report(
2ce00 64 6f 43 68 61 6e 67 65 4d 61 72 6b 65 72 73 24 doChangeMarkers$
2ce10 73 69 64 65 29 0a 09 09 24 74 65 78 74 20 63 6f side)...$text co
2ce20 6e 66 69 67 75 72 65 20 2d 74 65 78 74 20 22 54 nfigure -text "T
2ce30 65 78 74 22 20 2d 76 61 72 69 61 62 6c 65 20 72 ext" -variable r
2ce40 65 70 6f 72 74 28 64 6f 54 65 78 74 24 73 69 64 eport(doText$sid
2ce50 65 29 0a 0a 09 09 67 72 69 64 20 24 63 68 6f 6f e)....grid $choo
2ce60 73 65 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d se -row 0 -colum
2ce70 6e 20 24 63 6f 6c 28 24 73 69 64 65 29 20 2d 73 n $col($side) -s
2ce80 74 69 63 6b 79 20 77 0a 09 09 67 72 69 64 20 24 ticky w...grid $
2ce90 6c 69 6e 65 6e 75 6d 20 2d 72 6f 77 20 31 20 2d linenum -row 1 -
2cea0 63 6f 6c 75 6d 6e 20 24 63 6f 6c 28 24 73 69 64 column $col($sid
2ceb0 65 29 20 2d 73 74 69 63 6b 79 20 77 20 2d 70 61 e) -sticky w -pa
2cec0 64 78 20 31 30 0a 09 09 67 72 69 64 20 24 63 6d dx 10...grid $cm
2ced0 20 2d 72 6f 77 20 32 20 2d 63 6f 6c 75 6d 6e 20 -row 2 -column
2cee0 24 63 6f 6c 28 24 73 69 64 65 29 20 2d 73 74 69 $col($side) -sti
2cef0 63 6b 79 20 77 20 2d 70 61 64 78 20 31 30 0a 09 cky w -padx 10..
2cf00 09 67 72 69 64 20 24 74 65 78 74 20 2d 72 6f 77 .grid $text -row
2cf10 20 33 20 2d 63 6f 6c 75 6d 6e 20 24 63 6f 6c 28 3 -column $col(
2cf20 24 73 69 64 65 29 20 2d 73 74 69 63 6b 79 20 77 $side) -sticky w
2cf30 20 2d 70 61 64 78 20 31 30 0a 0a 09 09 23 20 73 -padx 10....# s
2cf40 61 76 65 20 74 68 65 20 77 69 64 67 65 74 20 70 ave the widget p
2cf50 61 74 68 73 20 66 6f 72 20 6c 61 74 65 72 20 75 aths for later u
2cf60 73 65 2e 2e 2e 0a 09 09 73 65 74 20 77 28 72 65 se......set w(re
2cf70 70 6f 72 74 43 68 6f 6f 73 65 24 73 69 64 65 29 portChoose$side)
2cf80 20 24 63 68 6f 6f 73 65 0a 09 09 73 65 74 20 77 $choose...set w
2cf90 28 72 65 70 6f 72 74 4c 69 6e 65 6e 75 6d 24 73 (reportLinenum$s
2cfa0 69 64 65 29 20 24 6c 69 6e 65 6e 75 6d 0a 09 09 ide) $linenum...
2cfb0 73 65 74 20 77 28 72 65 70 6f 72 74 43 4d 24 73 set w(reportCM$s
2cfc0 69 64 65 29 20 24 63 6d 0a 09 09 73 65 74 20 77 ide) $cm...set w
2cfd0 28 72 65 70 6f 72 74 54 65 78 74 24 73 69 64 65 (reportText$side
2cfe0 29 20 24 74 65 78 74 0a 09 20 20 20 20 7d 0a 0a ) $text.. }..
2cff0 09 20 20 20 20 23 20 74 68 65 20 65 6e 74 72 79 . # the entry
2d000 2c 20 6c 61 62 65 6c 20 61 6e 64 20 62 75 74 74 , label and butt
2d010 6f 6e 20 66 6f 72 20 74 68 65 20 66 69 6c 65 6e on for the filen
2d020 61 6d 65 20 77 69 6c 6c 20 67 65 74 0a 09 20 20 ame will get..
2d030 20 20 23 20 73 74 75 66 66 65 64 20 69 6e 74 6f # stuffed into
2d040 20 61 20 66 72 61 6d 65 20 66 6f 72 20 63 6f 6e a frame for con
2d050 76 65 6e 69 65 6e 63 65 2e 2e 2e 0a 09 20 20 20 venience.....
2d060 20 66 72 61 6d 65 20 24 63 66 2e 66 69 6c 65 46 frame $cf.fileF
2d070 72 61 6d 65 20 2d 62 64 20 30 0a 09 20 20 20 20 rame -bd 0..
2d080 67 72 69 64 20 24 63 66 2e 66 69 6c 65 46 72 61 grid $cf.fileFra
2d090 6d 65 20 2d 72 6f 77 20 34 20 2d 63 6f 6c 75 6d me -row 4 -colum
2d0a0 6e 73 70 61 6e 20 32 20 2d 73 74 69 63 6b 79 20 nspan 2 -sticky
2d0b0 65 77 20 2d 70 61 64 78 20 35 0a 0a 09 20 20 20 ew -padx 5...
2d0c0 20 6c 61 62 65 6c 20 24 63 66 2e 66 69 6c 65 46 label $cf.fileF
2d0d0 72 61 6d 65 2e 6c 20 2d 74 65 78 74 20 22 46 69 rame.l -text "Fi
2d0e0 6c 65 3a 22 0a 09 20 20 20 20 65 6e 74 72 79 20 le:".. entry
2d0f0 24 63 66 2e 66 69 6c 65 46 72 61 6d 65 2e 65 20 $cf.fileFrame.e
2d100 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 72 65 -textvariable re
2d110 70 6f 72 74 28 66 69 6c 65 6e 61 6d 65 29 20 2d port(filename) -
2d120 77 69 64 74 68 20 33 30 0a 09 20 20 20 20 62 75 width 30.. bu
2d130 74 74 6f 6e 20 24 63 66 2e 66 69 6c 65 46 72 61 tton $cf.fileFra
2d140 6d 65 2e 62 20 2d 74 65 78 74 20 22 42 72 6f 77 me.b -text "Brow
2d150 73 65 2e 2e 2e 22 20 2d 70 61 64 79 20 30 20 5c se..." -pady 0 \
2d160 0a 09 20 20 20 20 20 20 2d 68 69 67 68 6c 69 67 .. -highlig
2d170 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 htthickness 0 -b
2d180 6f 72 64 65 72 77 69 64 74 68 20 31 20 2d 63 6f orderwidth 1 -co
2d190 6d 6d 61 6e 64 20 5c 0a 09 20 20 20 20 20 20 5b mmand \.. [
2d1a0 6c 69 73 74 20 77 72 69 74 65 2d 72 65 70 6f 72 list write-repor
2d1b0 74 20 62 72 6f 77 73 65 5d 0a 0a 09 20 20 20 20 t browse]...
2d1c0 70 61 63 6b 20 24 63 66 2e 66 69 6c 65 46 72 61 pack $cf.fileFra
2d1d0 6d 65 2e 6c 20 2d 73 69 64 65 20 6c 65 66 74 20 me.l -side left
2d1e0 2d 70 61 64 79 20 34 0a 09 20 20 20 20 70 61 63 -pady 4.. pac
2d1f0 6b 20 24 63 66 2e 66 69 6c 65 46 72 61 6d 65 2e k $cf.fileFrame.
2d200 62 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d 70 b -side right -p
2d210 61 64 79 20 34 20 2d 70 61 64 78 20 32 0a 09 20 ady 4 -padx 2..
2d220 20 20 20 70 61 63 6b 20 24 63 66 2e 66 69 6c 65 pack $cf.file
2d230 46 72 61 6d 65 2e 65 20 2d 73 69 64 65 20 6c 65 Frame.e -side le
2d240 66 74 20 2d 66 69 6c 6c 20 78 20 2d 65 78 70 61 ft -fill x -expa
2d250 6e 64 20 79 20 2d 70 61 64 79 20 34 0a 0a 09 20 nd y -pady 4...
2d260 20 20 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 grid rowconfi
2d270 67 75 72 65 20 24 63 66 20 30 20 2d 77 65 69 67 gure $cf 0 -weig
2d280 68 74 20 30 0a 09 20 20 20 20 67 72 69 64 20 72 ht 0.. grid r
2d290 6f 77 63 6f 6e 66 69 67 75 72 65 20 24 63 66 20 owconfigure $cf
2d2a0 31 20 2d 77 65 69 67 68 74 20 30 0a 09 20 20 20 1 -weight 0..
2d2b0 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 67 75 grid rowconfigu
2d2c0 72 65 20 24 63 66 20 32 20 2d 77 65 69 67 68 74 re $cf 2 -weight
2d2d0 20 30 0a 09 20 20 20 20 67 72 69 64 20 72 6f 77 0.. grid row
2d2e0 63 6f 6e 66 69 67 75 72 65 20 24 63 66 20 33 20 configure $cf 3
2d2f0 2d 77 65 69 67 68 74 20 30 0a 0a 09 20 20 20 20 -weight 0...
2d300 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 grid columnconfi
2d310 67 75 72 65 20 24 63 66 20 30 20 2d 77 65 69 67 gure $cf 0 -weig
2d320 68 74 20 31 0a 09 20 20 20 20 67 72 69 64 20 63 ht 1.. grid c
2d330 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 olumnconfigure $
2d340 63 66 20 31 20 2d 77 65 69 67 68 74 20 31 0a 0a cf 1 -weight 1..
2d350 09 20 20 20 20 23 20 6d 61 6b 65 20 73 75 72 65 . # make sure
2d360 20 74 68 65 20 77 69 64 67 65 74 73 20 61 72 65 the widgets are
2d370 20 69 6e 20 74 68 65 20 70 72 6f 70 65 72 20 73 in the proper s
2d380 74 61 74 65 0a 09 20 20 20 20 77 72 69 74 65 2d tate.. write-
2d390 72 65 70 6f 72 74 20 75 70 64 61 74 65 0a 09 7d report update..}
2d3a0 0a 20 20 20 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 . }.}..######
2d3b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d3c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d3d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d3e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d3f0 23 23 23 23 23 23 23 23 23 0a 23 20 54 68 72 6f #########.# Thro
2d400 77 20 75 70 20 61 6e 20 22 61 62 6f 75 74 22 20 w up an "about"
2d410 77 69 6e 64 6f 77 2e 0a 23 23 23 23 23 23 23 23 window..########
2d420 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d430 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d440 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d460 23 23 23 23 23 23 23 0a 70 72 6f 63 20 64 6f 2d #######.proc do-
2d470 61 62 6f 75 74 20 7b 7d 20 7b 0a 20 20 20 20 67 about {} {. g
2d480 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 20 73 65 74 lobal g.. set
2d490 20 74 69 74 6c 65 20 22 41 62 6f 75 74 20 24 67 title "About $g
2d4a0 28 6e 61 6d 65 29 22 0a 20 20 20 20 73 65 74 20 (name)". set
2d4b0 74 65 78 74 20 7b 0a 3c 68 64 72 3e 24 67 28 6e text {.<hdr>$g(n
2d4c0 61 6d 65 29 20 24 67 28 76 65 72 73 69 6f 6e 29 ame) $g(version)
2d4d0 3c 2f 68 64 72 3e 0a 0a 3c 69 74 6c 3e 24 67 28 </hdr>..<itl>$g(
2d4e0 6e 61 6d 65 29 3c 2f 69 74 6c 3e 20 69 73 20 61 name)</itl> is a
2d4f0 20 54 63 6c 2f 54 6b 20 66 72 6f 6e 74 2d 65 6e Tcl/Tk front-en
2d500 64 20 74 6f 20 3c 69 74 6c 3e 64 69 66 66 3c 2f d to <itl>diff</
2d510 69 74 6c 3e 20 66 6f 72 20 55 6e 69 78 20 61 6e itl> for Unix an
2d520 64 20 5c 0a 20 20 20 20 20 20 57 69 6e 64 6f 77 d \. Window
2d530 73 2c 20 61 6e 64 20 69 73 20 43 6f 70 79 72 69 s, and is Copyri
2d540 67 68 74 20 28 43 29 20 31 39 39 34 2d 32 30 30 ght (C) 1994-200
2d550 35 20 62 79 20 4a 6f 68 6e 20 4d 2e 20 4b 6c 61 5 by John M. Kla
2d560 73 73 61 2e 0a 0a 4d 61 6e 79 20 6f 66 20 74 68 ssa...Many of th
2d570 65 20 74 6f 6f 6c 62 61 72 20 69 63 6f 6e 73 20 e toolbar icons
2d580 77 65 72 65 20 63 72 65 61 74 65 64 20 62 79 20 were created by
2d590 44 65 61 6e 20 53 2e 20 4a 6f 6e 65 73 20 61 6e Dean S. Jones an
2d5a0 64 20 75 73 65 64 20 77 69 74 68 20 68 69 73 20 d used with his
2d5b0 5c 0a 20 20 20 20 20 20 70 65 72 6d 69 73 73 69 \. permissi
2d5c0 6f 6e 2e 20 54 68 65 20 69 63 6f 6e 73 20 68 61 on. The icons ha
2d5d0 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 ve the following
2d5e0 20 63 6f 70 79 72 69 67 68 74 3a 0a 0a 43 6f 70 copyright:..Cop
2d5f0 79 72 69 67 68 74 28 43 29 20 31 39 39 38 20 62 yright(C) 1998 b
2d600 79 20 44 65 61 6e 20 53 2e 20 4a 6f 6e 65 73 0a y Dean S. Jones.
2d610 64 65 61 6e 40 67 61 6c 6c 61 6e 74 2e 63 6f 6d dean@gallant.com
2d620 0a 68 74 74 70 3a 2f 2f 77 77 77 2e 67 61 6c 6c .http://www.gall
2d630 61 6e 74 2e 63 6f 6d 2f 69 63 6f 6e 73 2e 68 74 ant.com/icons.ht
2d640 6d 0a 68 74 74 70 3a 2f 2f 77 77 77 2e 6a 61 76 m.http://www.jav
2d650 61 6c 6f 62 62 79 2e 6f 72 67 2f 6a 66 61 2f 70 alobby.org/jfa/p
2d660 72 6f 6a 65 63 74 73 2f 69 63 6f 6e 73 2f 0a 0a rojects/icons/..
2d670 3c 62 6c 64 3e 54 68 69 73 20 70 72 6f 67 72 61 <bld>This progra
2d680 6d 20 69 73 20 66 72 65 65 20 73 6f 66 74 77 61 m is free softwa
2d690 72 65 3b 20 79 6f 75 20 63 61 6e 20 72 65 64 69 re; you can redi
2d6a0 73 74 72 69 62 75 74 65 20 69 74 20 61 6e 64 2f stribute it and/
2d6b0 6f 72 20 6d 6f 64 69 66 79 20 69 74 20 5c 0a 20 or modify it \.
2d6c0 20 20 20 20 20 75 6e 64 65 72 20 74 68 65 20 74 under the t
2d6d0 65 72 6d 73 20 6f 66 20 74 68 65 20 47 4e 55 20 erms of the GNU
2d6e0 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c General Public L
2d6f0 69 63 65 6e 73 65 20 61 73 20 70 75 62 6c 69 73 icense as publis
2d700 68 65 64 20 62 79 20 74 68 65 20 5c 0a 20 20 20 hed by the \.
2d710 20 20 20 46 72 65 65 20 53 6f 66 74 77 61 72 65 Free Software
2d720 20 46 6f 75 6e 64 61 74 69 6f 6e 3b 20 65 69 74 Foundation; eit
2d730 68 65 72 20 76 65 72 73 69 6f 6e 20 32 20 6f 66 her version 2 of
2d740 20 74 68 65 20 4c 69 63 65 6e 73 65 2c 20 6f 72 the License, or
2d750 20 28 61 74 20 79 6f 75 72 20 5c 0a 20 20 20 20 (at your \.
2d760 20 20 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c 61 option) any la
2d770 74 65 72 20 76 65 72 73 69 6f 6e 2e 0a 0a 54 68 ter version...Th
2d780 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 is program is di
2d790 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 stributed in the
2d7a0 20 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 hope that it wi
2d7b0 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 20 62 75 ll be useful, bu
2d7c0 74 20 57 49 54 48 4f 55 54 20 5c 0a 20 20 20 20 t WITHOUT \.
2d7d0 20 20 41 4e 59 20 57 41 52 52 41 4e 54 59 3b 20 ANY WARRANTY;
2d7e0 77 69 74 68 6f 75 74 20 65 76 65 6e 20 74 68 65 without even the
2d7f0 20 69 6d 70 6c 69 65 64 20 77 61 72 72 61 6e 74 implied warrant
2d800 79 20 6f 66 20 4d 45 52 43 48 41 4e 54 41 42 49 y of MERCHANTABI
2d810 4c 49 54 59 20 6f 72 20 5c 0a 20 20 20 20 20 20 LITY or \.
2d820 46 49 54 4e 45 53 53 20 46 4f 52 20 41 20 50 41 FITNESS FOR A PA
2d830 52 54 49 43 55 4c 41 52 20 50 55 52 50 4f 53 45 RTICULAR PURPOSE
2d840 2e 20 20 53 65 65 20 74 68 65 20 47 4e 55 20 47 . See the GNU G
2d850 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 eneral Public Li
2d860 63 65 6e 73 65 20 5c 0a 20 20 20 20 20 20 66 6f cense \. fo
2d870 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a r more details..
2d880 0a 59 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 .You should have
2d890 20 72 65 63 65 69 76 65 64 20 61 20 63 6f 70 79 received a copy
2d8a0 20 6f 66 20 74 68 65 20 47 4e 55 20 47 65 6e 65 of the GNU Gene
2d8b0 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e ral Public Licen
2d8c0 73 65 20 61 6c 6f 6e 67 20 77 69 74 68 20 5c 0a se along with \.
2d8d0 20 20 20 20 20 20 74 68 69 73 20 70 72 6f 67 72 this progr
2d8e0 61 6d 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69 74 am; if not, writ
2d8f0 65 20 74 6f 20 74 68 65 20 46 72 65 65 20 53 6f e to the Free So
2d900 66 74 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f ftware Foundatio
2d910 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 5c 0a 20 20 n, Inc., 59 \.
2d920 20 20 20 20 54 65 6d 70 6c 65 20 50 6c 61 63 65 Temple Place
2d930 2c 20 53 75 69 74 65 20 33 33 30 2c 20 42 6f 73 , Suite 330, Bos
2d940 74 6f 6e 2c 20 4d 41 20 30 32 31 31 31 2d 31 33 ton, MA 02111-13
2d950 30 37 20 55 53 41 3c 2f 62 6c 64 3e 0a 20 20 20 07 USA</bld>.
2d960 20 7d 0a 0a 20 20 20 20 73 65 74 20 74 65 78 74 }.. set text
2d970 20 5b 73 75 62 73 74 20 2d 6e 6f 62 61 63 6b 73 [subst -nobacks
2d980 6c 61 73 68 65 73 20 2d 6e 6f 63 6f 6d 6d 61 6e lashes -nocomman
2d990 64 73 20 24 74 65 78 74 5d 0a 20 20 20 20 64 6f ds $text]. do
2d9a0 2d 74 65 78 74 2d 69 6e 66 6f 20 2e 61 62 6f 75 -text-info .abou
2d9b0 74 20 24 74 69 74 6c 65 20 24 74 65 78 74 0a 7d t $title $text.}
2d9c0 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
2d9d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d9e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2d9f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da10 23 0a 23 20 54 68 72 6f 77 20 75 70 20 61 20 22 #.# Throw up a "
2da20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 75 73 61 command line usa
2da30 67 65 22 20 77 69 6e 64 6f 77 2e 0a 23 23 23 23 ge" window..####
2da40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2da80 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
2da90 20 64 6f 2d 75 73 61 67 65 20 7b 6d 6f 64 65 7d do-usage {mode}
2daa0 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a {. global g.
2dab0 0a 20 20 20 20 64 65 62 75 67 2d 69 6e 66 6f 20 . debug-info
2dac0 22 64 6f 2d 75 73 61 67 65 20 28 24 6d 6f 64 65 "do-usage ($mode
2dad0 29 22 0a 20 20 20 20 73 65 74 20 75 73 61 67 65 )". set usage
2dae0 20 7b 0a 20 20 20 20 24 67 28 6e 61 6d 65 29 20 {. $g(name)
2daf0 6d 61 79 20 62 65 20 73 74 61 72 74 65 64 20 69 may be started i
2db00 6e 20 61 6e 79 20 6f 66 20 74 68 65 20 66 6f 6c n any of the fol
2db10 6c 6f 77 69 6e 67 20 77 61 79 73 3a 0a 0a 20 20 lowing ways:..
2db20 20 20 49 6e 74 65 72 61 63 74 69 76 65 20 73 65 Interactive se
2db30 6c 65 63 74 69 6f 6e 20 6f 66 20 66 69 6c 65 73 lection of files
2db40 20 74 6f 20 63 6f 6d 70 61 72 65 3a 0a 09 20 20 to compare:..
2db50 20 20 20 74 6b 64 69 66 66 0a 0a 20 20 20 20 50 tkdiff.. P
2db60 6c 61 69 6e 20 66 69 6c 65 73 3a 0a 09 20 20 20 lain files:..
2db70 20 20 74 6b 64 69 66 66 20 46 49 4c 45 31 20 46 tkdiff FILE1 F
2db80 49 4c 45 32 0a 0a 20 20 20 20 50 6c 61 69 6e 20 ILE2.. Plain
2db90 66 69 6c 65 20 77 69 74 68 20 63 6f 6e 66 6c 69 file with confli
2dba0 63 74 20 6d 61 72 6b 65 72 73 3a 0a 09 20 20 20 ct markers:..
2dbb0 20 20 74 6b 64 69 66 66 20 2d 63 6f 6e 66 6c 69 tkdiff -confli
2dbc0 63 74 20 46 49 4c 45 0a 0a 20 20 20 20 53 6f 75 ct FILE.. Sou
2dbd0 72 63 65 20 63 6f 6e 74 72 6f 6c 20 28 41 63 63 rce control (Acc
2dbe0 75 52 65 76 2c 20 42 69 74 4b 65 65 70 65 72 2c uRev, BitKeeper,
2dbf0 20 43 56 53 2c 20 53 75 62 76 65 72 73 69 6f 6e CVS, Subversion
2dc00 2c 20 50 65 72 66 6f 72 63 65 2c 20 50 56 43 53 , Perforce, PVCS
2dc10 2c 0a 20 20 20 20 20 20 52 43 53 2c 20 53 43 43 ,. RCS, SCC
2dc20 53 2c 20 43 6c 65 61 72 43 61 73 65 29 0a 09 20 S, ClearCase)..
2dc30 20 20 20 20 74 6b 64 69 66 66 20 46 49 4c 45 0a tkdiff FILE.
2dc40 09 74 6b 64 69 66 66 20 2d 72 52 45 56 20 46 49 .tkdiff -rREV FI
2dc50 4c 45 0a 09 74 6b 64 69 66 66 20 2d 72 52 45 56 LE..tkdiff -rREV
2dc60 31 20 2d 72 52 45 56 32 20 46 49 4c 45 0a 0a 20 1 -rREV2 FILE..
2dc70 20 20 20 41 64 64 69 74 69 6f 6e 61 6c 20 6f 70 Additional op
2dc80 74 69 6f 6e 61 6c 20 70 61 72 61 6d 65 74 65 72 tional parameter
2dc90 73 3a 0a 09 2d 61 20 41 4e 43 45 53 54 4f 52 46 s:..-a ANCESTORF
2dca0 49 4c 45 20 0a 09 2d 6f 20 4d 45 52 47 45 4f 55 ILE ..-o MERGEOU
2dcb0 54 50 55 54 46 49 4c 45 20 0a 09 2d 4c 20 4c 45 TPUTFILE ..-L LE
2dcc0 46 54 5f 46 49 4c 45 5f 4c 41 42 45 4c 20 5b 2d FT_FILE_LABEL [-
2dcd0 4c 20 52 49 47 48 54 5f 46 49 4c 45 5f 4c 41 42 L RIGHT_FILE_LAB
2dce0 45 4c 5d 0a 7d 0a 0a 20 20 20 20 73 65 74 20 75 EL].}.. set u
2dcf0 73 61 67 65 20 5b 73 75 62 73 74 20 2d 6e 6f 62 sage [subst -nob
2dd00 61 63 6b 73 6c 61 73 68 65 73 20 2d 6e 6f 63 6f ackslashes -noco
2dd10 6d 6d 61 6e 64 73 20 24 75 73 61 67 65 5d 0a 0a mmands $usage]..
2dd20 20 20 20 20 73 65 74 20 74 65 78 74 20 7b 0a 24 set text {.$
2dd30 67 28 6e 61 6d 65 29 20 64 65 74 65 63 74 73 20 g(name) detects
2dd40 61 6e 64 20 73 75 70 70 6f 72 74 73 20 52 43 53 and supports RCS
2dd50 2c 20 43 56 53 2c 20 53 75 62 76 65 72 73 69 6f , CVS, Subversio
2dd60 6e 20 61 6e 64 20 53 43 43 53 20 62 79 20 6c 6f n and SCCS by lo
2dd70 6f 6b 69 6e 67 20 66 6f 72 20 61 20 5c 0a 20 20 oking for a \.
2dd80 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 77 69 directory wi
2dd90 74 68 20 74 68 65 20 73 61 6d 65 20 6e 61 6d 65 th the same name
2dda0 2e 20 49 74 20 64 65 74 65 63 74 73 20 61 6e 64 . It detects and
2ddb0 20 73 75 70 70 6f 72 74 73 20 50 56 43 53 20 62 supports PVCS b
2ddc0 79 20 6c 6f 6f 6b 69 6e 67 20 5c 0a 20 20 20 20 y looking \.
2ddd0 20 20 66 6f 72 20 61 20 76 63 73 2e 63 66 67 20 for a vcs.cfg
2dde0 66 69 6c 65 2e 20 49 74 20 64 65 74 65 63 74 73 file. It detects
2ddf0 20 61 6e 64 20 73 75 70 70 6f 72 74 73 20 41 63 and supports Ac
2de00 63 75 52 65 76 2c 20 50 65 72 66 6f 72 63 65 20 cuRev, Perforce
2de10 61 6e 64 20 5c 0a 20 20 20 20 20 20 43 6c 65 61 and \. Clea
2de20 72 43 61 73 65 20 62 79 20 6c 6f 6f 6b 69 6e 67 rCase by looking
2de30 20 66 6f 72 20 74 68 65 20 65 6e 76 69 72 6f 6e for the environ
2de40 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 6e ment variables n
2de50 61 6d 65 64 20 41 43 43 55 52 45 56 5f 42 49 4e amed ACCUREV_BIN
2de60 2c 20 5c 0a 20 20 20 20 20 20 50 34 43 4c 49 45 , \. P4CLIE
2de70 4e 54 2c 20 61 6e 64 20 43 4c 45 41 52 43 41 53 NT, and CLEARCAS
2de80 45 5f 52 4f 4f 54 20 72 65 73 70 65 63 74 69 76 E_ROOT respectiv
2de90 65 6c 79 2e 0a 0a 49 6e 20 74 68 65 20 66 69 72 ely...In the fir
2dea0 73 74 20 66 6f 72 6d 2c 20 74 6b 64 69 66 66 20 st form, tkdiff
2deb0 77 69 6c 6c 20 70 72 65 73 65 6e 74 20 61 20 64 will present a d
2dec0 69 61 6c 6f 67 20 74 6f 20 61 6c 6c 6f 77 20 79 ialog to allow y
2ded0 6f 75 20 74 6f 20 63 68 6f 6f 73 65 20 74 68 65 ou to choose the
2dee0 20 5c 0a 20 20 20 20 20 20 66 69 6c 65 73 20 74 \. files t
2def0 6f 20 64 69 66 66 20 69 6e 74 65 72 61 63 74 69 o diff interacti
2df00 76 65 6c 79 2e 20 41 74 20 70 72 65 73 65 6e 74 vely. At present
2df10 20 74 68 69 73 20 64 69 61 6c 6f 67 20 6f 6e 6c this dialog onl
2df20 79 20 73 75 70 70 6f 72 74 73 20 61 20 5c 0a 20 y supports a \.
2df30 20 20 20 20 20 64 69 66 66 20 62 65 74 77 65 65 diff betwee
2df40 6e 20 74 77 6f 20 66 69 6c 65 73 20 74 68 61 74 n two files that
2df50 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 2e 20 already exist.
2df60 54 68 65 72 65 20 69 73 20 6e 6f 20 77 61 79 20 There is no way
2df70 74 6f 20 64 6f 20 61 20 64 69 66 66 20 5c 0a 20 to do a diff \.
2df80 20 20 20 20 20 61 67 61 69 6e 73 74 20 61 20 66 against a f
2df90 69 6c 65 20 75 6e 64 65 72 20 73 6f 75 63 65 20 ile under souce
2dfa0 63 6f 64 65 20 63 6f 6e 74 72 6f 6c 20 28 75 6e code control (un
2dfb0 6c 65 73 73 20 74 68 65 20 70 72 65 76 69 6f 75 less the previou
2dfc0 73 20 76 65 72 73 69 6f 6e 73 20 5c 0a 20 20 20 s versions \.
2dfd0 20 20 20 63 61 6e 20 62 65 20 66 6f 75 6e 64 20 can be found
2dfe0 6f 6e 20 64 69 73 6b 20 76 69 61 20 61 20 73 74 on disk via a st
2dff0 61 6e 64 61 72 64 20 66 69 6c 65 20 73 65 6c 65 andard file sele
2e000 63 74 69 6f 6e 20 64 69 61 6c 6f 67 29 2e 0a 0a ction dialog)...
2e010 49 6e 20 74 68 65 20 73 65 63 6f 6e 64 20 66 6f In the second fo
2e020 72 6d 2c 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 rm, at least one
2e030 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 of the argument
2e040 73 20 6d 75 73 74 20 62 65 20 74 68 65 20 6e 61 s must be the na
2e050 6d 65 20 6f 66 20 61 20 70 6c 61 69 6e 20 5c 0a me of a plain \.
2e060 20 20 20 20 20 20 74 65 78 74 20 66 69 6c 65 2e text file.
2e070 20 20 53 79 6d 62 6f 6c 69 63 20 6c 69 6e 6b 73 Symbolic links
2e080 20 61 72 65 20 61 63 63 65 70 74 61 62 6c 65 2c are acceptable,
2e090 20 62 75 74 20 61 74 20 6c 65 61 73 74 20 6f 6e but at least on
2e0a0 65 20 6f 66 20 74 68 65 20 5c 0a 20 20 20 20 20 e of the \.
2e0b0 20 66 69 6c 65 6e 61 6d 65 20 61 72 67 75 6d 65 filename argume
2e0c0 6e 74 73 20 6d 75 73 74 20 70 6f 69 6e 74 20 74 nts must point t
2e0d0 6f 20 61 20 72 65 61 6c 20 66 69 6c 65 20 72 61 o a real file ra
2e0e0 74 68 65 72 20 74 68 61 6e 20 74 6f 20 61 20 64 ther than to a d
2e0f0 69 72 65 63 74 6f 72 79 2e 0a 0a 49 6e 20 74 68 irectory...In th
2e100 65 20 72 65 6d 61 69 6e 69 6e 67 20 66 6f 72 6d e remaining form
2e110 73 2c 20 3c 63 6d 70 3e 52 45 56 3c 2f 63 6d 70 s, <cmp>REV</cmp
2e120 3e 20 28 6f 72 20 3c 63 6d 70 3e 52 45 56 31 3c > (or <cmp>REV1<
2e130 2f 63 6d 70 3e 20 61 6e 64 20 5c 0a 20 20 20 20 /cmp> and \.
2e140 20 20 3c 63 6d 70 3e 52 45 56 32 3c 2f 63 6d 70 <cmp>REV2</cmp
2e150 3e 29 20 6d 75 73 74 20 62 65 20 61 20 76 61 6c >) must be a val
2e160 69 64 20 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 id revision numb
2e170 65 72 20 66 6f 72 20 3c 63 6d 70 3e 46 49 4c 45 er for <cmp>FILE
2e180 3c 2f 63 6d 70 3e 2e 20 5c 0a 20 20 20 20 20 20 </cmp>. \.
2e190 57 68 65 72 65 20 41 63 63 75 52 65 76 2c 20 52 Where AccuRev, R
2e1a0 43 53 2c 20 43 56 53 2c 20 53 75 62 76 65 72 73 CS, CVS, Subvers
2e1b0 69 6f 6e 2c 20 53 43 43 53 2c 20 50 56 43 53 20 ion, SCCS, PVCS
2e1c0 6f 72 20 50 65 72 66 6f 72 63 65 20 69 73 20 69 or Perforce is i
2e1d0 6d 70 6c 69 65 64 20 5c 0a 20 20 20 20 20 20 62 mplied \. b
2e1e0 75 74 20 6e 6f 20 72 65 76 69 73 69 6f 6e 20 6e ut no revision n
2e1f0 75 6d 62 65 72 20 69 73 20 73 70 65 63 69 66 69 umber is specifi
2e200 65 64 2c 20 3c 63 6d 70 3e 46 49 4c 45 3c 2f 63 ed, <cmp>FILE</c
2e210 6d 70 3e 20 69 73 20 63 6f 6d 70 61 72 65 64 20 mp> is compared
2e220 77 69 74 68 20 5c 0a 20 20 20 20 20 20 74 68 65 with \. the
2e230 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 6d 6f the revision mo
2e240 73 74 20 72 65 63 65 6e 74 6c 79 20 63 68 65 63 st recently chec
2e250 6b 65 64 20 69 6e 2e 0a 0a 54 6f 20 6d 65 72 67 ked in...To merg
2e260 65 20 61 20 66 69 6c 65 20 77 69 74 68 20 63 6f e a file with co
2e270 6e 66 6c 69 63 74 20 6d 61 72 6b 65 72 73 20 67 nflict markers g
2e280 65 6e 65 72 61 74 65 64 20 62 79 20 22 3c 63 6d enerated by "<cm
2e290 70 3e 6d 65 72 67 65 3c 2f 63 6d 70 3e 22 2c 20 p>merge</cmp>",
2e2a0 5c 0a 20 20 20 20 20 20 22 3c 63 6d 70 3e 63 76 \. "<cmp>cv
2e2b0 73 3c 2f 63 6d 70 3e 22 2c 20 6f 72 20 22 3c 63 s</cmp>", or "<c
2e2c0 6d 70 3e 76 6d 72 67 3c 2f 63 6d 70 3e 22 2c 20 mp>vmrg</cmp>",
2e2d0 75 73 65 20 5c 0a 20 20 20 20 20 20 22 3c 63 6d use \. "<cm
2e2e0 70 3e 74 6b 64 69 66 66 20 2d 63 6f 6e 66 6c 69 p>tkdiff -confli
2e2f0 63 74 20 46 49 4c 45 3c 2f 63 6d 70 3e 22 2e 20 ct FILE</cmp>".
2e300 54 68 65 20 66 69 6c 65 20 69 73 20 73 70 6c 69 The file is spli
2e310 74 20 69 6e 74 6f 20 74 77 6f 20 74 65 6d 70 6f t into two tempo
2e320 72 61 72 79 20 5c 0a 20 20 20 20 20 20 66 69 6c rary \. fil
2e330 65 73 20 77 68 69 63 68 20 79 6f 75 20 63 61 6e es which you can
2e340 20 6d 65 72 67 65 20 61 73 20 75 73 75 61 6c 20 merge as usual
2e350 28 73 65 65 20 62 65 6c 6f 77 29 2e 0a 0a 46 6f (see below)...Fo
2e360 72 20 22 3c 63 6d 70 3e 74 6b 64 69 66 66 20 46 r "<cmp>tkdiff F
2e370 49 4c 45 3c 2f 63 6d 70 3e 22 20 54 68 65 20 43 ILE</cmp>" The C
2e380 56 53 20 76 65 72 73 69 6f 6e 20 68 61 73 20 70 VS version has p
2e390 72 69 6f 72 69 74 79 2c 20 66 6f 6c 6c 6f 77 65 riority, followe
2e3a0 64 20 62 79 20 74 68 65 20 5c 0a 20 20 20 20 20 d by the \.
2e3b0 20 53 75 62 76 65 72 73 69 6f 6e 20 76 65 72 73 Subversion vers
2e3c0 69 6f 6e 2c 20 66 6f 6c 6c 6f 77 65 64 20 62 79 ion, followed by
2e3d0 20 74 68 65 20 53 43 43 53 20 76 65 72 73 69 6f the SCCS versio
2e3e0 6e 20 2d 2d 20 69 2e 65 2e 20 69 66 20 61 20 43 n -- i.e. if a C
2e3f0 56 53 20 5c 0a 20 20 20 20 20 20 64 69 72 65 63 VS \. direc
2e400 74 6f 72 79 20 69 73 20 70 72 65 73 65 6e 74 2c tory is present,
2e410 20 43 56 53 3b 20 69 66 20 6e 6f 74 20 61 6e 64 CVS; if not and
2e420 20 61 20 53 75 62 76 65 72 73 69 6f 6e 20 64 69 a Subversion di
2e430 72 65 63 74 6f 72 79 20 69 73 20 5c 0a 20 20 20 rectory is \.
2e440 20 20 20 70 72 65 73 65 6e 74 2c 20 53 75 62 76 present, Subv
2e450 65 72 73 69 6f 6e 3b 20 69 66 20 6e 6f 74 20 61 ersion; if not a
2e460 6e 64 20 61 6e 20 53 43 43 53 20 64 69 72 65 63 nd an SCCS direc
2e470 74 6f 72 79 20 69 73 20 70 72 65 73 65 6e 74 2c tory is present,
2e480 20 53 43 43 53 20 69 73 20 5c 0a 20 20 20 20 20 SCCS is \.
2e490 20 61 73 73 75 6d 65 64 3b 20 6f 74 68 65 72 77 assumed; otherw
2e4a0 69 73 65 2c 20 69 66 20 61 20 43 56 53 2e 43 46 ise, if a CVS.CF
2e4b0 47 20 66 69 6c 65 20 69 73 20 66 6f 75 6e 64 2c G file is found,
2e4c0 20 50 56 43 53 20 69 73 20 61 73 73 75 6d 65 64 PVCS is assumed
2e4d0 3b 20 5c 0a 20 20 20 20 20 20 6f 74 68 65 72 77 ; \. otherw
2e4e0 69 73 65 20 52 43 53 20 69 73 20 61 73 73 75 6d ise RCS is assum
2e4f0 65 64 2e 20 49 66 20 6e 6f 6e 65 20 6f 66 20 74 ed. If none of t
2e500 68 65 20 61 62 6f 76 65 20 61 70 70 6c 79 20 61 he above apply a
2e510 6e 64 20 74 68 65 20 41 63 63 75 52 65 76 20 5c nd the AccuRev \
2e520 0a 20 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 . environme
2e530 6e 74 20 76 61 72 69 61 62 6c 65 20 41 43 43 55 nt variable ACCU
2e540 52 45 56 5f 42 49 4e 20 69 73 20 66 6f 75 6e 64 REV_BIN is found
2e550 2c 20 41 63 63 75 52 65 76 20 69 73 20 75 73 65 , AccuRev is use
2e560 64 2e 20 49 66 20 50 34 43 4c 49 45 4e 54 20 5c d. If P4CLIENT \
2e570 0a 20 20 20 20 20 20 69 73 20 66 6f 75 6e 64 2c . is found,
2e580 20 50 65 72 66 6f 72 63 65 20 69 73 20 75 73 65 Perforce is use
2e590 64 2e 20 49 66 20 43 4c 45 41 52 43 41 53 45 5f d. If CLEARCASE_
2e5a0 52 4f 4f 54 20 69 73 20 66 6f 75 6e 64 2c 20 43 ROOT is found, C
2e5b0 6c 65 61 72 43 61 73 65 20 69 73 20 75 73 65 64 learCase is used
2e5c0 2e 0a 0a 49 66 20 74 68 65 20 6d 65 72 67 65 20 ...If the merge
2e5d0 6f 75 74 70 75 74 20 66 69 6c 65 6e 61 6d 65 20 output filename
2e5e0 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 is not specified
2e5f0 2c 20 74 6b 64 69 66 66 20 77 69 6c 6c 20 70 72 , tkdiff will pr
2e600 65 73 65 6e 74 20 61 20 64 69 61 6c 6f 67 20 5c esent a dialog \
2e610 0a 20 20 20 20 20 20 74 6f 20 61 6c 6c 6f 77 20 . to allow
2e620 79 6f 75 20 74 6f 20 63 68 6f 6f 73 65 20 74 68 you to choose th
2e630 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 6d 65 e name of the me
2e640 72 67 65 20 6f 75 74 70 75 74 20 66 69 6c 65 2e rge output file.
2e650 0a 0a 4e 6f 74 65 20 66 75 72 74 68 65 72 20 74 ..Note further t
2e660 68 61 74 20 61 6e 79 74 68 69 6e 67 20 77 69 74 hat anything wit
2e670 68 20 61 20 6c 65 61 64 69 6e 67 20 64 61 73 68 h a leading dash
2e680 20 74 68 61 74 20 69 73 6e 5c 27 74 20 72 65 63 that isn\'t rec
2e690 6f 67 6e 69 7a 65 64 20 61 73 20 61 20 5c 0a 20 ognized as a \.
2e6a0 20 20 20 20 20 24 67 28 6e 61 6d 65 29 20 6f 70 $g(name) op
2e6b0 74 69 6f 6e 20 69 73 20 70 61 73 73 65 64 20 74 tion is passed t
2e6c0 68 72 6f 75 67 68 20 74 6f 20 64 69 66 66 2e 20 hrough to diff.
2e6d0 20 54 68 69 73 20 70 65 72 6d 69 74 73 20 79 6f This permits yo
2e6e0 75 20 74 6f 20 5c 0a 20 20 20 20 20 20 74 65 6d u to \. tem
2e6f0 70 6f 72 61 72 69 6c 79 20 61 6c 74 65 72 20 74 porarily alter t
2e700 68 65 20 77 61 79 20 64 69 66 66 20 69 73 20 63 he way diff is c
2e710 61 6c 6c 65 64 2c 20 77 69 74 68 6f 75 74 20 72 alled, without r
2e720 65 73 6f 72 74 69 6e 67 20 74 6f 20 61 20 63 68 esorting to a ch
2e730 61 6e 67 65 20 5c 0a 20 20 20 20 20 20 69 6e 20 ange \. in
2e740 79 6f 75 72 20 70 72 65 66 65 72 65 6e 63 65 73 your preferences
2e750 20 66 69 6c 65 2e 0a 7d 0a 0a 20 20 20 20 69 66 file..}.. if
2e760 20 7b 24 6d 6f 64 65 20 3d 3d 20 22 63 6c 69 6e {$mode == "clin
2e770 65 22 7d 20 7b 0a 09 70 75 74 73 20 24 75 73 61 e"} {..puts $usa
2e780 67 65 0a 09 65 78 69 74 20 30 0a 20 20 20 20 7d ge..exit 0. }
2e790 0a 20 20 20 20 73 65 74 20 74 65 78 74 20 5b 73 . set text [s
2e7a0 75 62 73 74 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 ubst -nobackslas
2e7b0 68 65 73 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 hes -nocommands
2e7c0 24 74 65 78 74 5d 0a 20 20 20 20 61 70 70 65 6e $text]. appen
2e7d0 64 20 75 73 61 67 65 20 24 74 65 78 74 0a 20 20 d usage $text.
2e7e0 20 20 64 6f 2d 74 65 78 74 2d 69 6e 66 6f 20 2e do-text-info .
2e7f0 75 73 61 67 65 20 22 24 67 28 6e 61 6d 65 29 20 usage "$g(name)
2e800 55 73 61 67 65 22 20 24 75 73 61 67 65 0a 7d 0a Usage" $usage.}.
2e810 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
2e820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e830 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e840 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e850 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e860 0a 23 20 54 68 72 6f 77 20 75 70 20 61 20 68 65 .# Throw up a he
2e870 6c 70 20 77 69 6e 64 6f 77 2e 0a 23 23 23 23 23 lp window..#####
2e880 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e890 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e8a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e8b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e8c0 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 20 ##########.proc
2e8d0 64 6f 2d 68 65 6c 70 20 7b 7d 20 7b 0a 20 20 20 do-help {} {.
2e8e0 20 67 6c 6f 62 61 6c 20 67 0a 0a 20 20 20 20 73 global g.. s
2e8f0 65 74 20 74 69 74 6c 65 20 22 48 6f 77 20 74 6f et title "How to
2e900 20 75 73 65 20 74 68 65 20 24 67 28 6e 61 6d 65 use the $g(name
2e910 29 20 47 55 49 22 0a 20 20 20 20 73 65 74 20 74 ) GUI". set t
2e920 65 78 74 20 7b 0a 3c 68 64 72 3e 4c 61 79 6f 75 ext {.<hdr>Layou
2e930 74 3c 2f 68 64 72 3e 0a 0a 54 68 65 20 74 6f 70 t</hdr>..The top
2e940 20 72 6f 77 20 63 6f 6e 74 61 69 6e 73 20 74 68 row contains th
2e950 65 20 46 69 6c 65 2c 20 45 64 69 74 2c 20 56 69 e File, Edit, Vi
2e960 65 77 2c 20 4d 61 72 6b 2c 20 4d 65 72 67 65 20 ew, Mark, Merge
2e970 61 6e 64 20 48 65 6c 70 20 6d 65 6e 75 73 2e 20 and Help menus.
2e980 54 68 65 20 5c 0a 20 20 20 20 20 20 73 65 63 6f The \. seco
2e990 6e 64 20 72 6f 77 20 63 6f 6e 74 61 69 6e 73 20 nd row contains
2e9a0 74 68 65 20 6c 61 62 65 6c 73 20 77 68 69 63 68 the labels which
2e9b0 20 69 64 65 6e 74 69 66 79 20 74 68 65 20 63 6f identify the co
2e9c0 6e 74 65 6e 74 73 20 6f 66 20 65 61 63 68 20 74 ntents of each t
2e9d0 65 78 74 20 5c 0a 20 20 20 20 20 20 77 69 6e 64 ext \. wind
2e9e0 6f 77 2e 20 42 65 6c 6f 77 20 74 68 61 74 20 69 ow. Below that i
2e9f0 73 20 61 20 74 6f 6f 6c 62 61 72 20 77 68 69 63 s a toolbar whic
2ea00 68 20 63 6f 6e 74 61 69 6e 73 5c 0a 20 20 20 20 h contains\.
2ea10 20 20 6e 61 76 69 67 61 74 69 6f 6e 20 61 6e 64 navigation and
2ea20 20 6d 65 72 67 65 20 73 65 6c 65 63 74 69 6f 6e merge selection
2ea30 20 74 6f 6f 6c 73 2e 0a 0a 54 68 65 20 6c 65 66 tools...The lef
2ea40 74 2d 6d 6f 73 74 20 74 65 78 74 20 77 69 64 67 t-most text widg
2ea50 65 74 20 64 69 73 70 6c 61 79 73 20 74 68 65 20 et displays the
2ea60 63 6f 6e 74 65 6e 74 73 20 6f 66 20 3c 63 6d 70 contents of <cmp
2ea70 3e 46 49 4c 45 31 3c 2f 63 6d 70 3e 2c 20 74 68 >FILE1</cmp>, th
2ea80 65 20 6d 6f 73 74 20 5c 0a 20 20 20 20 20 20 72 e most \. r
2ea90 65 63 65 6e 74 6c 79 20 63 68 65 63 6b 65 64 2d ecently checked-
2eaa0 69 6e 20 72 65 76 69 73 69 6f 6e 2c 20 3c 63 6d in revision, <cm
2eab0 70 3e 52 45 56 3c 2f 63 6d 70 3e 20 6f 72 20 3c p>REV</cmp> or <
2eac0 63 6d 70 3e 52 45 56 31 3c 2f 63 6d 70 3e 2c 20 cmp>REV1</cmp>,
2ead0 5c 0a 20 20 20 20 20 20 72 65 73 70 65 63 74 69 \. respecti
2eae0 76 65 6c 79 20 28 61 73 20 70 65 72 20 74 68 65 vely (as per the
2eaf0 20 73 74 61 72 74 75 70 20 6f 70 74 69 6f 6e 73 startup options
2eb00 20 64 65 73 63 72 69 62 65 64 20 69 6e 5c 0a 20 described in\.
2eb10 20 20 20 20 20 74 68 65 20 22 4f 6e 20 43 6f 6d the "On Com
2eb20 6d 61 6e 64 20 4c 69 6e 65 22 20 68 65 6c 70 29 mand Line" help)
2eb30 2e 20 54 68 65 20 72 69 67 68 74 2d 6d 6f 73 74 . The right-most
2eb40 20 77 69 64 67 65 74 20 64 69 73 70 6c 61 79 73 widget displays
2eb50 20 74 68 65 20 5c 0a 20 20 20 20 20 20 63 6f 6e the \. con
2eb60 74 65 6e 74 73 20 6f 66 20 3c 63 6d 70 3e 46 49 tents of <cmp>FI
2eb70 4c 45 32 3c 2f 63 6d 70 3e 2c 20 3c 63 6d 70 3e LE2</cmp>, <cmp>
2eb80 46 49 4c 45 3c 2f 63 6d 70 3e 20 6f 72 20 3c 63 FILE</cmp> or <c
2eb90 6d 70 3e 52 45 56 32 3c 2f 63 6d 70 3e 2c 20 5c mp>REV2</cmp>, \
2eba0 0a 20 20 20 20 20 20 72 65 73 70 65 63 74 69 76 . respectiv
2ebb0 65 6c 79 2e 20 43 6c 69 63 6b 69 6e 67 20 74 68 ely. Clicking th
2ebc0 65 20 72 69 67 68 74 20 6d 6f 75 73 65 20 62 75 e right mouse bu
2ebd0 74 74 6f 6e 20 6f 76 65 72 20 65 69 74 68 65 72 tton over either
2ebe0 20 6f 66 5c 0a 20 20 20 20 20 20 74 68 65 73 65 of\. these
2ebf0 20 77 69 6e 64 6f 77 73 20 77 69 6c 6c 20 67 69 windows will gi
2ec00 76 65 20 79 6f 75 20 61 20 63 6f 6e 74 65 78 74 ve you a context
2ec10 20 73 65 6e 73 69 74 69 76 65 20 6d 65 6e 75 20 sensitive menu
2ec20 77 69 74 68 20 61 63 74 69 6f 6e 73 20 74 68 61 with actions tha
2ec30 74 20 5c 0a 20 20 20 20 20 20 77 69 6c 6c 20 61 t \. will a
2ec40 63 74 20 6f 6e 20 74 68 65 20 77 69 6e 64 6f 77 ct on the window
2ec50 20 79 6f 75 20 63 6c 69 63 6b 65 64 20 6f 76 65 you clicked ove
2ec60 72 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 r. For example,
2ec70 69 66 20 79 6f 75 20 63 6c 69 63 6b 20 5c 0a 20 if you click \.
2ec80 20 20 20 20 20 72 69 67 68 74 20 6f 76 65 72 20 right over
2ec90 74 68 65 20 72 69 67 68 74 20 68 61 6e 64 20 77 the right hand w
2eca0 69 6e 64 6f 77 20 61 6e 64 20 73 65 6c 65 63 74 indow and select
2ecb0 5c 0a 20 20 20 20 20 20 22 45 64 69 74 22 2c 20 \. "Edit",
2ecc0 74 68 65 20 66 69 6c 65 20 64 69 73 70 6c 61 79 the file display
2ecd0 65 64 20 6f 6e 20 74 68 65 20 72 69 67 68 74 20 ed on the right
2ece0 68 61 6e 64 20 73 69 64 65 20 77 69 6c 6c 20 62 hand side will b
2ecf0 65 20 6c 6f 61 64 65 64 20 69 6e 74 6f 20 61 20 e loaded into a
2ed00 5c 0a 20 20 20 20 20 20 74 65 78 74 20 65 64 69 \. text edi
2ed10 74 6f 72 2e 0a 0a 41 74 20 74 68 65 20 62 6f 74 tor...At the bot
2ed20 74 6f 6d 20 6f 66 20 74 68 65 20 64 69 73 70 6c tom of the displ
2ed30 61 79 20 69 73 20 61 20 74 77 6f 20 6c 69 6e 65 ay is a two line
2ed40 20 77 69 6e 64 6f 77 20 63 61 6c 6c 65 64 20 74 window called t
2ed50 68 65 20 5c 0a 20 20 20 20 20 20 22 4c 69 6e 65 he \. "Line
2ed60 20 43 6f 6d 70 61 72 69 73 6f 6e 22 20 77 69 6e Comparison" win
2ed70 64 6f 77 2e 20 54 68 69 73 20 77 69 6c 6c 20 73 dow. This will s
2ed80 68 6f 77 20 74 68 65 20 22 63 75 72 72 65 6e 74 how the "current
2ed90 20 6c 69 6e 65 22 20 66 72 6f 6d 20 74 68 65 20 line" from the
2eda0 5c 0a 20 20 20 20 20 20 6c 65 66 74 20 61 6e 64 \. left and
2edb0 20 72 69 67 68 74 20 77 69 6e 64 6f 77 73 2c 20 right windows,
2edc0 6f 6e 65 20 6f 6e 20 74 6f 70 20 6f 66 20 74 68 one on top of th
2edd0 65 20 6f 74 68 65 72 2e 20 54 68 65 20 22 63 75 e other. The "cu
2ede0 72 72 65 6e 74 20 6c 69 6e 65 22 5c 0a 20 20 20 rrent line"\.
2edf0 20 20 20 69 73 20 64 65 66 69 6e 65 64 20 62 79 is defined by
2ee00 20 74 68 65 20 6c 69 6e 65 20 74 68 61 74 20 68 the line that h
2ee10 61 73 20 74 68 65 20 62 6c 69 6e 6b 69 6e 67 20 as the blinking
2ee20 69 6e 73 65 72 74 69 6f 6e 20 63 75 72 73 6f 72 insertion cursor
2ee30 2c 20 77 68 69 63 68 20 5c 0a 20 20 20 20 20 20 , which \.
2ee40 63 61 6e 20 62 65 20 73 65 74 20 62 79 20 6d 65 can be set by me
2ee50 72 65 6c 79 20 63 6c 69 63 6b 69 6e 67 20 6f 6e rely clicking on
2ee60 20 61 6e 79 20 6c 69 6e 65 20 69 6e 20 74 68 65 any line in the
2ee70 20 64 69 73 70 6c 61 79 2e 20 54 68 69 73 20 77 display. This w
2ee80 69 6e 64 6f 77 20 5c 0a 20 20 20 20 20 20 6d 61 indow \. ma
2ee90 79 20 62 65 20 68 69 64 64 65 6e 20 69 66 20 74 y be hidden if t
2eea0 68 65 20 3c 62 74 6e 3e 56 69 65 77 3c 2f 62 74 he <btn>View</bt
2eeb0 6e 3e 20 6d 65 6e 75 20 69 74 65 6d 5c 0a 20 20 n> menu item\.
2eec0 20 20 20 20 3c 62 74 6e 3e 53 68 6f 77 20 4c 69 <btn>Show Li
2eed0 6e 65 20 43 6f 6d 70 61 72 69 73 6f 6e 3c 2f 62 ne Comparison</b
2eee0 74 6e 3e 20 69 73 20 64 65 73 65 6c 65 63 74 65 tn> is deselecte
2eef0 64 2e 0a 41 6c 6c 20 64 69 66 66 65 72 65 6e 63 d..All differenc
2ef00 65 20 72 65 67 69 6f 6e 73 20 28 44 52 73 29 20 e regions (DRs)
2ef10 61 72 65 20 68 69 67 68 6c 69 67 68 74 65 64 20 are highlighted
2ef20 74 6f 20 73 65 74 20 74 68 65 6d 20 61 70 61 72 to set them apar
2ef30 74 20 66 72 6f 6d 20 74 68 65 20 5c 0a 20 20 20 t from the \.
2ef40 20 20 20 73 75 72 72 6f 75 6e 64 69 6e 67 20 74 surrounding t
2ef50 65 78 74 2e 20 54 68 65 20 3c 69 74 6c 3e 63 75 ext. The <itl>cu
2ef60 72 72 65 6e 74 20 64 69 66 66 65 72 65 6e 63 65 rrent difference
2ef70 20 72 65 67 69 6f 6e 3c 2f 69 74 6c 3e 2c 20 6f region</itl>, o
2ef80 72 20 5c 0a 20 20 20 20 20 20 3c 62 6c 64 3e 43 r \. <bld>C
2ef90 44 52 3c 2f 62 6c 64 3e 2c 20 69 73 20 66 75 72 DR</bld>, is fur
2efa0 74 68 65 72 20 73 65 74 20 61 70 61 72 74 20 73 ther set apart s
2efb0 6f 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 o that it can be
2efc0 5c 0a 20 20 20 20 20 20 63 6f 72 72 65 6c 61 74 \. correlat
2efd0 65 64 20 74 6f 20 69 74 73 20 70 61 72 74 6e 65 ed to its partne
2efe0 72 20 69 6e 20 74 68 65 20 6f 74 68 65 72 20 74 r in the other t
2eff0 65 78 74 20 77 69 64 67 65 74 20 28 74 68 61 74 ext widget (that
2f000 20 69 73 2c 20 74 68 65 20 43 44 52 20 6f 6e 20 is, the CDR on
2f010 5c 0a 20 20 20 20 20 20 74 68 65 20 6c 65 66 74 \. the left
2f020 20 6d 61 74 63 68 65 73 20 74 68 65 20 43 44 52 matches the CDR
2f030 20 6f 6e 20 74 68 65 20 72 69 67 68 74 29 2e 0a on the right)..
2f040 0a 3c 68 64 72 3e 43 68 61 6e 67 69 6e 67 20 74 .<hdr>Changing t
2f050 68 65 20 43 44 52 3c 2f 68 64 72 3e 0a 0a 54 68 he CDR</hdr>..Th
2f060 65 20 43 44 52 20 63 61 6e 20 62 65 20 63 68 61 e CDR can be cha
2f070 6e 67 65 64 20 69 6e 20 61 20 73 65 71 75 65 6e nged in a sequen
2f080 74 69 61 6c 20 6d 61 6e 6e 65 72 20 62 79 20 6d tial manner by m
2f090 65 61 6e 73 20 6f 66 20 74 68 65 20 3c 62 74 6e eans of the <btn
2f0a0 3e 4e 65 78 74 3c 2f 62 74 6e 3e 20 5c 0a 20 20 >Next</btn> \.
2f0b0 20 20 20 20 61 6e 64 20 3c 62 74 6e 3e 50 72 65 and <btn>Pre
2f0c0 76 69 6f 75 73 3c 2f 62 74 6e 3e 20 62 75 74 74 vious</btn> butt
2f0d0 6f 6e 73 2e 20 54 68 65 20 3c 62 74 6e 3e 46 69 ons. The <btn>Fi
2f0e0 72 73 74 3c 2f 62 74 6e 3e 20 61 6e 64 20 5c 0a rst</btn> and \.
2f0f0 20 20 20 20 20 20 3c 62 74 6e 3e 4c 61 73 74 3c <btn>Last<
2f100 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 73 20 61 6c /btn> buttons al
2f110 6c 6f 77 20 79 6f 75 20 74 6f 20 71 75 69 63 6b low you to quick
2f120 6c 79 20 6e 61 76 69 67 61 74 65 20 74 6f 20 74 ly navigate to t
2f130 68 65 5c 0a 20 20 20 20 20 20 66 69 72 73 74 20 he\. first
2f140 6f 72 20 6c 61 73 74 20 43 44 52 2c 20 72 65 73 or last CDR, res
2f150 70 65 63 74 69 76 65 6c 79 2e 20 46 6f 72 20 72 pectively. For r
2f160 61 6e 64 6f 6d 20 61 63 63 65 73 73 20 74 6f 20 andom access to
2f170 74 68 65 20 44 52 73 2c 20 75 73 65 20 74 68 65 the DRs, use the
2f180 20 5c 0a 20 20 20 20 20 20 64 72 6f 70 64 6f 77 \. dropdow
2f190 6e 20 6c 69 73 74 62 6f 78 20 69 6e 20 74 68 65 n listbox in the
2f1a0 20 74 6f 6f 6c 62 61 72 20 6f 72 20 74 68 65 20 toolbar or the
2f1b0 64 69 66 66 20 6d 61 70 2c 20 64 65 73 63 72 69 diff map, descri
2f1c0 62 65 64 20 62 65 6c 6f 77 2e 0a 0a 42 79 20 63 bed below...By c
2f1d0 6c 69 63 6b 69 6e 67 20 72 69 67 68 74 20 6f 76 licking right ov
2f1e0 65 72 20 61 20 77 69 6e 64 6f 77 20 61 6e 64 20 er a window and
2f1f0 75 73 69 6e 67 20 74 68 65 20 70 6f 70 75 70 20 using the popup
2f200 6d 65 6e 75 20 79 6f 75 20 63 61 6e 20 73 65 6c menu you can sel
2f210 65 63 74 20 5c 0a 20 20 20 20 20 20 3c 62 74 6e ect \. <btn
2f220 3e 46 69 6e 64 20 4e 65 61 72 65 73 74 20 44 69 >Find Nearest Di
2f230 66 66 3c 2f 62 74 6e 3e 20 74 6f 20 66 69 6e 64 ff</btn> to find
2f240 20 74 68 65 20 64 69 66 66 20 72 65 63 6f 72 64 the diff record
2f250 20 6e 65 61 72 65 73 74 20 74 68 65 20 70 6f 69 nearest the poi
2f260 6e 74 20 5c 0a 20 20 20 20 20 20 77 68 65 72 65 nt \. where
2f270 20 79 6f 75 20 63 6c 69 63 6b 65 64 2e 0a 0a 59 you clicked...Y
2f280 6f 75 20 6d 61 79 20 61 6c 73 6f 20 73 65 6c 65 ou may also sele
2f290 63 74 20 61 6e 79 20 68 69 67 68 6c 69 67 68 74 ct any highlight
2f2a0 65 64 20 64 69 66 66 20 72 65 67 69 6f 6e 20 61 ed diff region a
2f2b0 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 64 69 s the current di
2f2c0 66 66 20 72 65 67 69 6f 6e 20 62 79 20 5c 0a 20 ff region by \.
2f2d0 20 20 20 20 20 64 6f 75 62 6c 65 2d 63 6c 69 63 double-clic
2f2e0 6b 69 6e 67 20 6f 6e 20 69 74 2e 0a 0a 3c 68 64 king on it...<hd
2f2f0 72 3e 4f 70 65 72 61 74 69 6f 6e 73 3c 2f 68 64 r>Operations</hd
2f300 72 3e 0a 0a 31 2e 20 46 72 6f 6d 20 74 68 65 20 r>..1. From the
2f310 3c 62 74 6e 3e 46 69 6c 65 3c 2f 62 74 6e 3e 20 <btn>File</btn>
2f320 6d 65 6e 75 3a 0a 0a 54 68 65 20 3c 62 74 6e 3e menu:..The <btn>
2f330 4e 65 77 2e 2e 2e 3c 2f 62 74 6e 3e 20 62 75 74 New...</btn> but
2f340 74 6f 6e 20 64 69 73 70 6c 61 79 73 20 61 20 64 ton displays a d
2f350 69 61 6c 6f 67 20 77 68 65 72 65 20 79 6f 75 20 ialog where you
2f360 6d 61 79 20 63 68 6f 6f 73 65 20 74 77 6f 20 66 may choose two f
2f370 69 6c 65 73 20 5c 0a 20 20 20 20 20 20 74 6f 20 iles \. to
2f380 63 6f 6d 70 61 72 65 2e 20 53 65 6c 65 63 74 69 compare. Selecti
2f390 6e 67 20 22 4f 6b 22 20 66 72 6f 6d 20 74 68 65 ng "Ok" from the
2f3a0 20 64 69 61 6c 6f 67 20 77 69 6c 6c 20 64 69 66 dialog will dif
2f3b0 66 20 74 68 65 20 74 77 6f 20 66 69 6c 65 73 2e f the two files.
2f3c0 20 54 68 65 20 5c 0a 20 20 20 20 20 20 3c 62 74 The \. <bt
2f3d0 6e 3e 52 65 63 6f 6d 70 75 74 65 20 44 69 66 66 n>Recompute Diff
2f3e0 73 3c 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 20 72 s</btn> button r
2f3f0 65 63 6f 6d 70 75 74 65 73 20 74 68 65 5c 0a 20 ecomputes the\.
2f400 20 20 20 20 20 64 69 66 66 65 72 65 6e 63 65 73 differences
2f410 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f between the two
2f420 20 66 69 6c 65 73 20 77 68 6f 73 65 20 6e 61 6d files whose nam
2f430 65 73 20 61 70 70 65 61 72 20 61 74 20 74 68 65 es appear at the
2f440 20 74 6f 70 20 6f 66 20 74 68 65 20 5c 0a 20 20 top of the \.
2f450 20 20 20 20 3c 69 74 6c 3e 24 67 28 6e 61 6d 65 <itl>$g(name
2f460 29 3c 2f 69 74 6c 3e 20 77 69 6e 64 6f 77 2e 20 )</itl> window.
2f470 54 68 65 20 3c 62 74 6e 3e 57 72 69 74 65 20 52 The <btn>Write R
2f480 65 70 6f 72 74 2e 2e 2e 3c 2f 62 74 6e 3e 20 6c eport...</btn> l
2f490 65 74 73 20 79 6f 75 20 5c 0a 20 20 20 20 20 20 ets you \.
2f4a0 63 72 65 61 74 65 20 61 20 72 65 70 6f 72 74 20 create a report
2f4b0 66 69 6c 65 20 74 68 61 74 20 63 6f 6e 74 61 69 file that contai
2f4c0 6e 73 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 ns the informati
2f4d0 6f 6e 5c 0a 20 20 20 20 20 20 76 69 73 69 62 6c on\. visibl
2f4e0 65 20 69 6e 20 74 68 65 20 77 69 6e 64 6f 77 73 e in the windows
2f4f0 2e 20 4c 61 73 74 6c 79 2c 20 74 68 65 20 3c 62 . Lastly, the <b
2f500 74 6e 3e 45 78 69 74 3c 2f 62 74 6e 3e 20 62 75 tn>Exit</btn> bu
2f510 74 74 6f 6e 20 74 65 72 6d 69 6e 61 74 65 73 20 tton terminates
2f520 5c 0a 20 20 20 20 20 20 3c 69 74 6c 3e 24 67 28 \. <itl>$g(
2f530 6e 61 6d 65 29 3c 2f 69 74 6c 3e 2e 0a 0a 32 2e name)</itl>...2.
2f540 20 46 72 6f 6d 20 74 68 65 20 3c 62 74 6e 3e 45 From the <btn>E
2f550 64 69 74 3c 2f 62 74 6e 3e 20 6d 65 6e 75 3a 0a dit</btn> menu:.
2f560 0a 3c 62 74 6e 3e 43 6f 70 79 3c 2f 62 74 6e 3e .<btn>Copy</btn>
2f570 20 63 6f 70 69 65 73 20 74 68 65 20 63 75 72 72 copies the curr
2f580 65 6e 74 6c 79 20 73 65 6c 65 63 74 65 64 20 74 ently selected t
2f590 65 78 74 20 74 6f 20 74 68 65 20 73 79 73 74 65 ext to the syste
2f5a0 6d 20 63 6c 69 70 62 6f 61 72 64 2e 20 5c 0a 20 m clipboard. \.
2f5b0 20 20 20 20 20 3c 62 74 6e 3e 46 69 6e 64 3c 2f <btn>Find</
2f5c0 62 74 6e 3e 20 70 6f 70 73 20 75 70 20 61 20 64 btn> pops up a d
2f5d0 69 61 6c 6f 67 20 74 6f 20 6c 65 74 20 79 6f 75 ialog to let you
2f5e0 20 73 65 61 72 63 68 20 65 69 74 68 65 72 20 74 search either t
2f5f0 65 78 74 20 77 69 6e 64 6f 77 20 5c 0a 20 20 20 ext window \.
2f600 20 20 20 66 6f 72 20 61 20 73 70 65 63 69 66 69 for a specifi
2f610 65 64 20 74 65 78 74 20 73 74 72 69 6e 67 2e 20 ed text string.
2f620 3c 62 74 6e 3e 45 64 69 74 20 46 69 6c 65 20 31 <btn>Edit File 1
2f630 3c 2f 62 74 6e 3e 20 61 6e 64 20 3c 62 74 6e 3e </btn> and <btn>
2f640 45 64 69 74 20 46 69 6c 65 20 5c 0a 20 20 20 20 Edit File \.
2f650 20 20 32 3c 2f 62 74 6e 3e 20 6c 61 75 6e 63 68 2</btn> launch
2f660 20 61 6e 20 65 64 69 74 6f 72 20 6f 6e 20 74 68 an editor on th
2f670 65 20 66 69 6c 65 73 20 64 69 73 70 6c 61 79 65 e files displaye
2f680 64 20 69 6e 20 74 68 65 20 6c 65 66 74 2d 20 61 d in the left- a
2f690 6e 64 20 5c 0a 20 20 20 20 20 20 72 69 67 68 74 nd \. right
2f6a0 2d 68 61 6e 64 20 70 61 6e 65 73 2e 20 20 3c 62 -hand panes. <b
2f6b0 74 6e 3e 50 72 65 66 65 72 65 6e 63 65 73 3c 2f tn>Preferences</
2f6c0 62 74 6e 3e 20 70 6f 70 73 20 75 70 20 61 20 64 btn> pops up a d
2f6d0 69 61 6c 6f 67 20 62 6f 78 20 66 72 6f 6d 20 5c ialog box from \
2f6e0 0a 20 20 20 20 20 20 77 68 69 63 68 20 64 69 73 . which dis
2f6f0 70 6c 61 79 20 28 61 6e 64 20 6f 74 68 65 72 29 play (and other)
2f700 20 6f 70 74 69 6f 6e 73 20 63 61 6e 20 62 65 0a options can be.
2f710 63 68 61 6e 67 65 64 20 61 6e 64 20 73 61 76 65 changed and save
2f720 64 2e 0a 0a 33 2e 20 46 72 6f 6d 20 74 68 65 20 d...3. From the
2f730 3c 62 74 6e 3e 56 69 65 77 3c 2f 62 74 6e 3e 20 <btn>View</btn>
2f740 6d 65 6e 75 3a 0a 0a 3c 62 74 6e 3e 53 68 6f 77 menu:..<btn>Show
2f750 20 4c 69 6e 65 20 4e 75 6d 62 65 72 73 3c 2f 62 Line Numbers</b
2f760 74 6e 3e 20 74 6f 67 67 6c 65 73 20 74 68 65 20 tn> toggles the
2f770 64 69 73 70 6c 61 79 20 6f 66 20 6c 69 6e 65 20 display of line
2f780 6e 75 6d 62 65 72 73 20 69 6e 20 74 68 65 20 74 numbers in the t
2f790 65 78 74 20 5c 0a 20 20 20 20 20 20 77 69 64 67 ext \. widg
2f7a0 65 74 73 2e 20 49 66 20 3c 62 74 6e 3e 53 79 6e ets. If <btn>Syn
2f7b0 63 68 72 6f 6e 69 7a 65 20 53 63 72 6f 6c 6c 62 chronize Scrollb
2f7c0 61 72 73 3c 2f 62 74 6e 3e 20 69 73 20 6f 6e 2c ars</btn> is on,
2f7d0 20 74 68 65 20 6c 65 66 74 20 61 6e 64 20 72 69 the left and ri
2f7e0 67 68 74 20 5c 0a 20 20 20 20 20 20 74 65 78 74 ght \. text
2f7f0 20 77 69 64 67 65 74 73 20 61 72 65 20 73 79 6e widgets are syn
2f800 63 68 72 6f 6e 69 7a 65 64 20 69 2e 65 2e 20 73 chronized i.e. s
2f810 63 72 6f 6c 6c 69 6e 67 20 6f 6e 65 5c 0a 20 20 crolling one\.
2f820 20 20 20 20 6f 66 20 74 68 65 20 77 69 6e 64 6f of the windo
2f830 77 73 20 73 63 72 6f 6c 6c 73 20 74 68 65 20 6f ws scrolls the o
2f840 74 68 65 72 2e 20 49 66 20 3c 62 74 6e 3e 41 75 ther. If <btn>Au
2f850 74 6f 20 43 65 6e 74 65 72 3c 2f 62 74 6e 3e 20 to Center</btn>
2f860 69 73 20 6f 6e 2c 20 5c 0a 20 20 20 20 20 20 70 is on, \. p
2f870 72 65 73 73 69 6e 67 20 74 68 65 20 4e 65 78 74 ressing the Next
2f880 20 6f 72 20 50 72 65 76 20 62 75 74 74 6f 6e 73 or Prev buttons
2f890 20 63 65 6e 74 65 72 73 20 74 68 65 20 6e 65 77 centers the new
2f8a0 20 43 44 52 20 61 75 74 6f 6d 61 74 69 63 61 6c CDR automatical
2f8b0 6c 79 2e 20 5c 0a 20 20 20 20 20 20 3c 62 74 6e ly. \. <btn
2f8c0 3e 53 68 6f 77 20 44 69 66 66 20 4d 61 70 3c 2f >Show Diff Map</
2f8d0 62 74 6e 3e 20 74 6f 67 67 6c 65 73 20 74 68 65 btn> toggles the
2f8e0 20 64 69 73 70 6c 61 79 20 6f 66 20 74 68 65 20 display of the
2f8f0 64 69 66 66 5c 0a 20 20 20 20 20 20 6d 61 70 20 diff\. map
2f900 28 73 65 65 20 62 65 6c 6f 77 29 20 6f 6e 20 6f (see below) on o
2f910 72 20 6f 66 66 2e 20 3c 62 74 6e 3e 53 68 6f 77 r off. <btn>Show
2f920 20 4d 65 72 67 65 20 50 72 65 76 69 65 77 3c 2f Merge Preview</
2f930 62 74 6e 3e 20 73 68 6f 77 73 20 6f 72 20 68 69 btn> shows or hi
2f940 64 65 73 20 5c 0a 20 20 20 20 20 20 74 68 65 20 des \. the
2f950 6d 65 72 67 65 20 70 72 65 76 69 65 77 20 28 73 merge preview (s
2f960 65 65 20 62 65 6c 6f 77 29 2e 20 3c 62 74 6e 3e ee below). <btn>
2f970 53 68 6f 77 20 4c 69 6e 65 20 43 6f 6d 70 61 72 Show Line Compar
2f980 69 73 6f 6e 3c 2f 62 74 6e 3e 20 74 6f 67 67 6c ison</btn> toggl
2f990 65 73 20 5c 0a 20 20 20 20 20 20 74 68 65 20 64 es \. the d
2f9a0 69 73 70 6c 61 79 20 6f 66 20 74 68 65 20 22 6c isplay of the "l
2f9b0 69 6e 65 20 63 6f 6d 70 61 72 69 73 6f 6e 22 20 ine comparison"
2f9c0 77 69 6e 64 6f 77 20 61 74 5c 0a 20 20 20 20 20 window at\.
2f9d0 20 74 68 65 20 62 6f 74 74 6f 6d 20 6f 66 20 74 the bottom of t
2f9e0 68 65 20 64 69 73 70 6c 61 79 2e 0a 0a 34 2e 20 he display...4.
2f9f0 46 72 6f 6d 20 74 68 65 20 3c 62 74 6e 3e 4d 61 From the <btn>Ma
2fa00 72 6b 3c 2f 62 74 6e 3e 20 6d 65 6e 75 3a 0a 0a rk</btn> menu:..
2fa10 54 68 65 20 3c 62 74 6e 3e 4d 61 72 6b 20 43 75 The <btn>Mark Cu
2fa20 72 72 65 6e 74 20 44 69 66 66 3c 2f 62 74 6e 3e rrent Diff</btn>
2fa30 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 20 74 creates a new t
2fa40 6f 6f 6c 62 61 72 20 62 75 74 74 6f 6e 20 74 68 oolbar button th
2fa50 61 74 20 77 69 6c 6c 20 6a 75 6d 70 20 5c 0a 20 at will jump \.
2fa60 20 20 20 20 20 74 6f 20 74 68 65 20 63 75 72 72 to the curr
2fa70 65 6e 74 20 64 69 66 66 20 72 65 67 69 6f 6e 2e ent diff region.
2fa80 20 54 68 65 20 3c 62 74 6e 3e 43 6c 65 61 72 20 The <btn>Clear
2fa90 43 75 72 72 65 6e 74 20 44 69 66 66 20 4d 61 72 Current Diff Mar
2faa0 6b 3c 2f 62 74 6e 3e 20 77 69 6c 6c 20 5c 0a 20 k</btn> will \.
2fab0 20 20 20 20 20 72 65 6d 6f 76 65 20 74 68 65 20 remove the
2fac0 74 6f 6f 6c 62 61 72 20 6d 61 72 6b 20 62 75 74 toolbar mark but
2fad0 74 6f 6e 20 61 73 73 6f 63 69 61 74 65 64 20 77 ton associated w
2fae0 69 74 68 5c 0a 20 20 20 20 20 20 74 68 65 20 63 ith\. the c
2faf0 75 72 72 65 6e 74 20 64 69 66 66 20 72 65 67 69 urrent diff regi
2fb00 6f 6e 2c 20 69 66 20 6f 6e 65 20 65 78 69 73 74 on, if one exist
2fb10 73 2e 0a 0a 35 2e 20 46 72 6f 6d 20 74 68 65 20 s...5. From the
2fb20 3c 62 74 6e 3e 4d 65 72 67 65 3c 2f 62 74 6e 3e <btn>Merge</btn>
2fb30 20 6d 65 6e 75 3a 0a 0a 54 68 65 20 3c 62 74 6e menu:..The <btn
2fb40 3e 53 68 6f 77 20 4d 65 72 67 65 20 57 69 6e 64 >Show Merge Wind
2fb50 6f 77 3c 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 20 ow</btn> button
2fb60 70 6f 70 73 20 75 70 20 61 20 77 69 6e 64 6f 77 pops up a window
2fb70 20 77 69 74 68 20 74 68 65 20 63 75 72 72 65 6e with the curren
2fb80 74 20 5c 0a 20 20 20 20 20 20 6d 65 72 67 65 64 t \. merged
2fb90 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 version of the
2fba0 74 77 6f 20 66 69 6c 65 73 2e 20 54 68 65 20 3c two files. The <
2fbb0 62 74 6e 3e 57 72 69 74 65 20 4d 65 72 67 65 20 btn>Write Merge
2fbc0 46 69 6c 65 3c 2f 62 74 6e 3e 20 62 75 74 74 6f File</btn> butto
2fbd0 6e 20 5c 0a 20 20 20 20 20 20 77 69 6c 6c 20 61 n \. will a
2fbe0 6c 6c 6f 77 20 79 6f 75 20 74 6f 20 73 61 76 65 llow you to save
2fbf0 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 the contents of
2fc00 20 74 68 61 74 20 77 69 6e 64 6f 77 5c 0a 20 20 that window\.
2fc10 20 20 20 20 74 6f 20 61 20 66 69 6c 65 2e 0a 0a to a file...
2fc20 36 2e 20 46 72 6f 6d 20 74 68 65 20 3c 62 74 6e 6. From the <btn
2fc30 3e 48 65 6c 70 3c 2f 62 74 6e 3e 20 6d 65 6e 75 >Help</btn> menu
2fc40 3a 0a 0a 54 68 65 20 3c 62 74 6e 3e 41 62 6f 75 :..The <btn>Abou
2fc50 74 20 24 67 28 6e 61 6d 65 29 3c 2f 62 74 6e 3e t $g(name)</btn>
2fc60 20 62 75 74 74 6f 6e 20 64 69 73 70 6c 61 79 73 button displays
2fc70 20 63 6f 70 79 72 69 67 68 74 20 61 6e 64 20 61 copyright and a
2fc80 75 74 68 6f 72 20 5c 0a 20 20 20 20 20 20 69 6e uthor \. in
2fc90 66 6f 72 6d 61 74 69 6f 6e 2e 20 54 68 65 20 3c formation. The <
2fca0 62 74 6e 3e 4f 6e 20 47 55 49 3c 2f 62 74 6e 3e btn>On GUI</btn>
2fcb0 20 62 75 74 74 6f 6e 20 67 65 6e 65 72 61 74 65 button generate
2fcc0 73 20 74 68 69 73 20 77 69 6e 64 6f 77 2e 20 54 s this window. T
2fcd0 68 65 20 5c 0a 20 20 20 20 20 20 3c 62 74 6e 3e he \. <btn>
2fce0 4f 6e 20 43 6f 6d 6d 61 6e 64 20 4c 69 6e 65 3c On Command Line<
2fcf0 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 20 64 69 73 /btn> button dis
2fd00 70 6c 61 79 73 20 68 65 6c 70 20 6f 6e 20 74 68 plays help on th
2fd10 65 5c 0a 20 20 20 20 20 20 24 67 28 6e 61 6d 65 e\. $g(name
2fd20 29 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f ) command line o
2fd30 70 74 69 6f 6e 73 2e 20 54 68 65 20 3c 62 74 6e ptions. The <btn
2fd40 3e 4f 6e 20 50 72 65 66 65 72 65 6e 63 65 73 3c >On Preferences<
2fd50 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 20 5c 0a 20 /btn> button \.
2fd60 20 20 20 20 20 64 69 73 70 6c 61 79 73 20 68 65 displays he
2fd70 6c 70 20 6f 6e 20 74 68 65 20 75 73 65 72 2d 73 lp on the user-s
2fd80 65 74 74 61 62 6c 65 20 70 72 65 66 65 72 65 6e ettable preferen
2fd90 63 65 73 2e 0a 0a 37 2e 20 46 72 6f 6d 20 74 68 ces...7. From th
2fda0 65 20 74 6f 6f 6c 62 61 72 3a 0a 0a 54 68 65 20 e toolbar:..The
2fdb0 66 69 72 73 74 20 74 6f 6f 6c 20 69 73 20 61 20 first tool is a
2fdc0 64 72 6f 70 64 6f 77 6e 20 6c 69 73 74 20 6f 66 dropdown list of
2fdd0 20 61 6c 6c 20 6f 66 20 74 68 65 20 64 69 66 66 all of the diff
2fde0 65 72 65 6e 63 65 73 20 69 6e 20 61 20 73 74 61 erences in a sta
2fdf0 6e 64 61 72 64 20 5c 0a 20 20 20 20 20 20 64 69 ndard \. di
2fe00 66 66 2d 74 79 70 65 20 66 6f 72 6d 61 74 2e 20 ff-type format.
2fe10 59 6f 75 20 6d 61 79 20 75 73 65 20 74 68 69 73 You may use this
2fe20 20 6c 69 73 74 20 74 6f 20 67 6f 20 64 69 72 65 list to go dire
2fe30 63 74 6c 79 20 74 6f 20 61 6e 79 20 64 69 66 66 ctly to any diff
2fe40 20 5c 0a 20 20 20 20 20 20 72 65 63 6f 72 64 2e \. record.
2fe50 20 54 68 65 20 3c 62 74 6e 3e 4e 65 78 74 3c 2f The <btn>Next</
2fe60 62 74 6e 3e 20 61 6e 64 20 3c 62 74 6e 3e 50 72 btn> and <btn>Pr
2fe70 65 76 69 6f 75 73 3c 2f 62 74 6e 3e 5c 0a 20 20 evious</btn>\.
2fe80 20 20 20 20 62 75 74 74 6f 6e 73 20 74 61 6b 65 buttons take
2fe90 20 79 6f 75 20 74 6f 20 74 68 65 20 22 6e 65 78 you to the "nex
2fea0 74 22 20 61 6e 64 20 22 70 72 65 76 69 6f 75 73 t" and "previous
2feb0 22 20 44 52 2c 20 72 65 73 70 65 63 74 69 76 65 " DR, respective
2fec0 6c 79 2e 20 54 68 65 20 5c 0a 20 20 20 20 20 20 ly. The \.
2fed0 3c 62 74 6e 3e 46 69 72 73 74 3c 2f 62 74 6e 3e <btn>First</btn>
2fee0 20 61 6e 64 20 3c 62 74 6e 3e 4c 61 73 74 3c 2f and <btn>Last</
2fef0 62 74 6e 3e 20 62 75 74 74 6f 6e 73 20 74 61 6b btn> buttons tak
2ff00 65 20 79 6f 75 20 74 6f 20 74 68 65 20 5c 0a 20 e you to the \.
2ff10 20 20 20 20 20 22 66 69 72 73 74 22 20 61 6e 64 "first" and
2ff20 20 22 6c 61 73 74 22 20 44 52 2e 20 54 68 65 20 "last" DR. The
2ff30 3c 62 74 6e 3e 43 65 6e 74 65 72 3c 2f 62 74 6e <btn>Center</btn
2ff40 3e 20 62 75 74 74 6f 6e 20 63 65 6e 74 65 72 73 > button centers
2ff50 20 74 68 65 5c 0a 20 20 20 20 20 20 43 44 52 73 the\. CDRs
2ff60 20 69 6e 20 74 68 65 69 72 20 72 65 73 70 65 63 in their respec
2ff70 74 69 76 65 20 74 65 78 74 20 77 69 6e 64 6f 77 tive text window
2ff80 73 2e 20 59 6f 75 20 63 61 6e 20 73 65 74 20 3c s. You can set <
2ff90 62 74 6e 3e 41 75 74 6f 20 5c 0a 20 20 20 20 20 btn>Auto \.
2ffa0 20 43 65 6e 74 65 72 3c 2f 62 74 6e 3e 20 69 6e Center</btn> in
2ffb0 20 3c 62 74 6e 3e 50 72 65 66 65 72 65 6e 63 65 <btn>Preference
2ffc0 73 3c 2f 62 74 6e 3e 20 74 6f 20 64 6f 20 74 68 s</btn> to do th
2ffd0 69 73 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 is automatically
2ffe0 20 66 6f 72 20 79 6f 75 20 5c 0a 20 20 20 20 20 for you \.
2fff0 20 61 73 20 79 6f 75 20 6e 61 76 69 67 61 74 65 as you navigate
30000 20 74 68 72 6f 75 67 68 20 74 68 65 20 64 69 66 through the dif
30010 66 20 72 65 63 6f 72 64 73 2e 0a 0a 3c 68 64 72 f records...<hdr
30020 3e 4b 65 79 62 6f 61 72 64 20 4e 61 76 69 67 61 >Keyboard Naviga
30030 74 69 6f 6e 3c 2f 68 64 72 3e 0a 0a 57 68 65 6e tion</hdr>..When
30040 20 61 20 74 65 78 74 20 77 69 64 67 65 74 20 68 a text widget h
30050 61 73 20 74 68 65 20 66 6f 63 75 73 2c 20 79 6f as the focus, yo
30060 75 20 6d 61 79 20 75 73 65 20 74 68 65 20 66 6f u may use the fo
30070 6c 6c 6f 77 69 6e 67 20 73 68 6f 72 74 63 75 74 llowing shortcut
30080 20 6b 65 79 73 3a 0a 3c 63 6d 70 3e 0a 09 66 20 keys:.<cmp>..f
30090 20 20 20 20 20 20 20 46 69 72 73 74 20 64 69 66 First dif
300a0 66 0a 09 63 20 20 20 20 20 20 20 20 43 65 6e 74 f..c Cent
300b0 65 72 20 63 75 72 72 65 6e 74 20 64 69 66 66 0a er current diff.
300c0 09 6c 20 20 20 20 20 20 20 20 4c 61 73 74 20 64 .l Last d
300d0 69 66 66 0a 09 6e 20 20 20 20 20 20 20 20 4e 65 iff..n Ne
300e0 78 74 20 64 69 66 66 0a 09 70 20 20 20 20 20 20 xt diff..p
300f0 20 20 50 72 65 76 69 6f 75 73 20 64 69 66 66 0a Previous diff.
30100 09 31 20 20 20 20 20 20 20 20 4d 65 72 67 65 20 .1 Merge
30110 43 68 6f 69 63 65 20 31 0a 09 32 20 20 20 20 20 Choice 1..2
30120 20 20 20 4d 65 72 67 65 20 43 68 6f 69 63 65 20 Merge Choice
30130 32 0a 3c 2f 63 6d 70 3e 0a 54 68 65 20 63 75 72 2.</cmp>.The cur
30140 73 6f 72 2c 20 48 6f 6d 65 2c 20 45 6e 64 2c 20 sor, Home, End,
30150 50 61 67 65 55 70 20 61 6e 64 20 50 61 67 65 44 PageUp and PageD
30160 6f 77 6e 20 6b 65 79 73 20 77 6f 72 6b 20 61 73 own keys work as
30170 20 65 78 70 65 63 74 65 64 2c 20 61 64 6a 75 73 expected, adjus
30180 74 69 6e 67 20 5c 0a 20 20 20 20 20 20 74 68 65 ting \. the
30190 20 76 69 65 77 20 69 6e 20 77 68 69 63 68 65 76 view in whichev
301a0 65 72 20 74 65 78 74 20 77 69 6e 64 6f 77 20 68 er text window h
301b0 61 73 20 74 68 65 20 66 6f 63 75 73 2e 20 4e 6f as the focus. No
301c0 74 65 20 74 68 61 74 20 69 66 20 5c 0a 20 20 20 te that if \.
301d0 20 20 20 3c 62 74 6e 3e 53 79 6e 63 68 72 6f 6e <btn>Synchron
301e0 69 7a 65 20 53 63 72 6f 6c 6c 62 61 72 73 3c 2f ize Scrollbars</
301f0 62 74 6e 3e 20 69 73 20 73 65 74 20 69 6e 5c 0a btn> is set in\.
30200 20 20 20 20 20 20 3c 62 74 6e 3e 50 72 65 66 65 <btn>Prefe
30210 72 65 6e 63 65 73 3c 2f 62 74 6e 3e 2c 20 62 6f rences</btn>, bo
30220 74 68 20 77 69 6e 64 6f 77 73 20 77 69 6c 6c 20 th windows will
30230 73 63 72 6f 6c 6c 20 61 74 20 74 68 65 20 73 61 scroll at the sa
30240 6d 65 20 74 69 6d 65 2e 0a 0a 3c 68 64 72 3e 53 me time...<hdr>S
30250 63 72 6f 6c 6c 69 6e 67 3c 2f 68 64 72 3e 0a 0a crolling</hdr>..
30260 54 6f 20 73 63 72 6f 6c 6c 20 74 68 65 20 74 65 To scroll the te
30270 78 74 20 77 69 64 67 65 74 73 20 69 6e 64 65 70 xt widgets indep
30280 65 6e 64 65 6e 74 6c 79 2c 20 6d 61 6b 65 20 73 endently, make s
30290 75 72 65 20 3c 62 74 6e 3e 53 79 6e 63 68 72 6f ure <btn>Synchro
302a0 6e 69 7a 65 20 5c 0a 20 20 20 20 20 20 53 63 72 nize \. Scr
302b0 6f 6c 6c 62 61 72 73 3c 2f 62 74 6e 3e 20 69 6e ollbars</btn> in
302c0 20 3c 62 74 6e 3e 50 72 65 66 65 72 65 6e 63 65 <btn>Preference
302d0 73 3c 2f 62 74 6e 3e 20 69 73 20 6f 66 66 2e 20 s</btn> is off.
302e0 49 66 20 69 74 20 69 73 20 6f 6e 2c 20 5c 0a 20 If it is on, \.
302f0 20 20 20 20 20 73 63 72 6f 6c 6c 69 6e 67 20 61 scrolling a
30300 6e 79 20 74 65 78 74 20 77 69 64 67 65 74 20 73 ny text widget s
30310 63 72 6f 6c 6c 73 20 61 6c 6c 20 6f 74 68 65 72 crolls all other
30320 73 2e 20 53 63 72 6f 6c 6c 69 6e 67 20 64 6f 65 s. Scrolling doe
30330 73 20 6e 6f 74 5c 0a 20 20 20 20 20 20 63 68 61 s not\. cha
30340 6e 67 65 20 74 68 65 20 63 75 72 72 65 6e 74 20 nge the current
30350 64 69 66 66 20 72 65 63 6f 72 64 20 28 43 44 52 diff record (CDR
30360 29 2e 0a 0a 3c 68 64 72 3e 44 69 66 66 20 4d 61 )...<hdr>Diff Ma
30370 72 6b 73 3c 2f 68 64 72 3e 0a 0a 59 6f 75 20 63 rks</hdr>..You c
30380 61 6e 20 73 65 74 20 22 6d 61 72 6b 65 72 73 22 an set "markers"
30390 20 61 74 20 73 70 65 63 69 66 69 63 20 64 69 66 at specific dif
303a0 66 20 72 65 67 69 6f 6e 73 20 66 6f 72 20 65 61 f regions for ea
303b0 73 69 65 72 20 6e 61 76 69 67 61 74 69 6f 6e 2e sier navigation.
303c0 20 54 6f 20 64 6f 20 5c 0a 20 20 20 20 20 20 74 To do \. t
303d0 68 69 73 2c 20 63 6c 69 63 6b 20 6f 6e 20 74 68 his, click on th
303e0 65 20 3c 62 74 6e 3e 53 65 74 20 4d 61 72 6b 3c e <btn>Set Mark<
303f0 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 2e 20 49 74 /btn> button. It
30400 20 77 69 6c 6c 20 63 72 65 61 74 65 20 61 20 6e will create a n
30410 65 77 20 5c 0a 20 20 20 20 20 20 74 6f 6f 6c 62 ew \. toolb
30420 61 72 20 62 75 74 74 6f 6e 20 74 68 61 74 20 77 ar button that w
30430 69 6c 6c 20 6a 75 6d 70 20 62 61 63 6b 20 74 6f ill jump back to
30440 20 74 68 69 73 20 64 69 66 66 5c 0a 20 20 20 20 this diff\.
30450 20 20 72 65 67 69 6f 6e 2e 20 54 6f 20 63 6c 65 region. To cle
30460 61 72 20 61 20 64 69 66 66 20 6d 61 72 6b 2c 20 ar a diff mark,
30470 67 6f 20 74 6f 20 74 68 61 74 20 64 69 66 66 20 go to that diff
30480 72 65 63 6f 72 64 20 61 6e 64 20 63 6c 69 63 6b record and click
30490 20 6f 6e 20 74 68 65 20 5c 0a 20 20 20 20 20 20 on the \.
304a0 3c 62 74 6e 3e 43 6c 65 61 72 20 4d 61 72 6b 3c <btn>Clear Mark<
304b0 2f 62 74 6e 3e 20 62 75 74 74 6f 6e 2e 0a 0a 3c /btn> button...<
304c0 68 64 72 3e 44 69 66 66 20 4d 61 70 3c 2f 68 64 hdr>Diff Map</hd
304d0 72 3e 0a 0a 54 68 65 20 64 69 66 66 20 6d 61 70 r>..The diff map
304e0 20 69 73 20 61 20 6d 61 70 20 6f 66 20 61 6c 6c is a map of all
304f0 20 74 68 65 20 64 69 66 66 20 72 65 67 69 6f 6e the diff region
30500 73 2e 20 49 74 20 69 73 20 73 68 6f 77 6e 20 69 s. It is shown i
30510 6e 20 74 68 65 20 6d 69 64 64 6c 65 20 6f 66 20 n the middle of
30520 5c 0a 20 20 20 20 20 20 74 68 65 20 6d 61 69 6e \. the main
30530 20 77 69 6e 64 6f 77 20 69 66 20 22 44 69 66 66 window if "Diff
30540 20 4d 61 70 22 20 6f 6e 20 74 68 65 20 56 69 65 Map" on the Vie
30550 77 20 6d 65 6e 75 20 69 73 20 6f 6e 2e 20 54 68 w menu is on. Th
30560 65 20 6d 61 70 20 69 73 20 61 20 5c 0a 20 20 20 e map is a \.
30570 20 20 20 6d 69 6e 69 61 74 75 72 65 20 6f 66 20 miniature of
30580 74 68 65 20 66 69 6c 65 27 73 20 64 69 66 66 20 the file's diff
30590 72 65 67 69 6f 6e 73 20 66 72 6f 6d 20 74 6f 70 regions from top
305a0 20 74 6f 5c 0a 20 20 20 20 20 20 62 6f 74 74 6f to\. botto
305b0 6d 2e 20 45 61 63 68 20 64 69 66 66 20 72 65 67 m. Each diff reg
305c0 69 6f 6e 20 69 73 20 72 65 6e 64 65 72 65 64 20 ion is rendered
305d0 61 73 20 61 20 70 61 74 63 68 20 6f 66 20 63 6f as a patch of co
305e0 6c 6f 72 2c 20 44 65 6c 65 74 65 20 61 73 20 5c lor, Delete as \
305f0 0a 20 20 20 20 20 20 72 65 64 2c 20 49 6e 73 65 . red, Inse
30600 72 74 20 61 73 20 67 72 65 65 6e 20 61 6e 64 20 rt as green and
30610 43 68 61 6e 67 65 20 61 73 20 62 6c 75 65 2e 20 Change as blue.
30620 49 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 61 In the case of a
30630 20 33 2d 77 61 79 20 6d 65 72 67 65 2c 20 5c 0a 3-way merge, \.
30640 20 20 20 20 20 20 6f 76 65 72 6c 61 70 20 72 65 overlap re
30650 67 69 6f 6e 73 20 61 72 65 20 6d 61 72 6b 65 64 gions are marked
30660 20 69 6e 20 79 65 6c 6c 6f 77 2e 20 54 68 65 20 in yellow. The
30670 68 65 69 67 68 74 20 6f 66 20 65 61 63 68 20 70 height of each p
30680 61 74 63 68 20 5c 0a 20 20 20 20 20 20 63 6f 72 atch \. cor
30690 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 responds to the
306a0 72 65 6c 61 74 69 76 65 20 73 69 7a 65 20 6f 66 relative size of
306b0 20 74 68 65 20 64 69 66 66 20 72 65 67 69 6f 6e the diff region
306c0 2e 20 41 5c 0a 20 20 20 20 20 20 74 68 75 6d 62 . A\. thumb
306d0 20 6c 65 74 73 20 79 6f 75 20 69 6e 74 65 72 61 lets you intera
306e0 63 74 20 77 69 74 68 20 74 68 65 20 6d 61 70 20 ct with the map
306f0 61 73 20 69 66 20 69 74 20 77 65 72 65 20 61 20 as if it were a
30700 73 63 72 6f 6c 6c 62 61 72 2e 0a 41 6c 6c 20 64 scrollbar..All d
30710 69 66 66 20 72 65 67 69 6f 6e 73 20 61 72 65 20 iff regions are
30720 64 72 61 77 6e 20 6f 6e 20 74 68 65 20 6d 61 70 drawn on the map
30730 20 65 76 65 6e 20 69 66 20 74 6f 6f 20 73 6d 61 even if too sma
30740 6c 6c 20 74 6f 20 62 65 20 76 69 73 69 62 6c 65 ll to be visible
30750 2e 20 46 6f 72 20 5c 0a 20 20 20 20 20 20 6c 61 . For \. la
30760 72 67 65 20 66 69 6c 65 73 20 77 69 74 68 20 73 rge files with s
30770 6d 61 6c 6c 20 64 69 66 66 20 72 65 67 69 6f 6e mall diff region
30780 73 2c 20 74 68 69 73 20 6d 61 79 20 72 65 73 75 s, this may resu
30790 6c 74 20 69 6e 20 70 61 74 63 68 65 73 20 5c 0a lt in patches \.
307a0 20 20 20 20 20 20 6f 76 65 72 77 72 69 74 69 6e overwritin
307b0 67 20 65 61 63 68 20 6f 74 68 65 72 2e 0a 0a 3c g each other...<
307c0 68 64 72 3e 4d 65 72 67 69 6e 67 3c 2f 68 64 72 hdr>Merging</hdr
307d0 3e 0a 0a 54 6f 20 6d 65 72 67 65 20 74 68 65 20 >..To merge the
307e0 74 77 6f 20 66 69 6c 65 73 2c 20 67 6f 20 74 68 two files, go th
307f0 72 6f 75 67 68 20 74 68 65 20 64 69 66 66 65 72 rough the differ
30800 65 6e 63 65 20 72 65 67 69 6f 6e 73 20 28 76 69 ence regions (vi
30810 61 20 22 4e 65 78 74 22 2c 20 5c 0a 20 20 20 20 a "Next", \.
30820 20 20 22 50 72 65 76 22 20 6f 72 20 77 68 61 74 "Prev" or what
30830 65 76 65 72 20 6f 74 68 65 72 20 6d 65 61 6e 73 ever other means
30840 20 79 6f 75 20 70 72 65 66 65 72 29 20 61 6e 64 you prefer) and
30850 20 73 65 6c 65 63 74 20 22 4c 65 66 74 22 20 6f select "Left" o
30860 72 20 5c 0a 20 20 20 20 20 20 22 52 69 67 68 74 r \. "Right
30870 22 20 28 6e 65 78 74 20 74 6f 20 74 68 65 20 22 " (next to the "
30880 4d 65 72 67 65 20 43 68 6f 69 63 65 3a 22 20 6c Merge Choice:" l
30890 61 62 65 6c 29 20 66 6f 72 20 65 61 63 68 2e 20 abel) for each.
308a0 53 65 6c 65 63 74 69 6e 67 5c 0a 20 20 20 20 20 Selecting\.
308b0 20 22 4c 65 66 74 22 20 6d 65 61 6e 73 20 74 68 "Left" means th
308c0 61 74 20 74 68 65 20 74 68 65 20 6c 65 66 74 2d at the the left-
308d0 6d 6f 73 74 20 66 69 6c 65 27 73 20 76 65 72 73 most file's vers
308e0 69 6f 6e 20 6f 66 20 74 68 65 20 64 69 66 66 65 ion of the diffe
308f0 72 65 6e 63 65 20 5c 0a 20 20 20 20 20 20 77 69 rence \. wi
30900 6c 6c 20 62 65 20 75 73 65 64 20 69 6e 20 63 72 ll be used in cr
30910 65 61 74 69 6e 67 20 74 68 65 20 66 69 6e 61 6c eating the final
30920 20 72 65 73 75 6c 74 3b 20 63 68 6f 6f 73 69 6e result; choosin
30930 67 20 22 52 69 67 68 74 22 20 6d 65 61 6e 73 20 g "Right" means
30940 74 68 61 74 20 5c 0a 20 20 20 20 20 20 74 68 65 that \. the
30950 20 72 69 67 68 74 2d 6d 6f 73 74 20 66 69 6c 65 right-most file
30960 27 73 20 64 69 66 66 65 72 65 6e 63 65 20 77 69 's difference wi
30970 6c 6c 20 62 65 20 75 73 65 64 2e 20 45 61 63 68 ll be used. Each
30980 5c 0a 20 20 20 20 20 20 63 68 6f 69 63 65 20 69 \. choice i
30990 73 20 72 65 63 6f 72 64 65 64 2c 20 61 6e 64 20 s recorded, and
309a0 63 61 6e 20 62 65 20 63 68 61 6e 67 65 64 20 61 can be changed a
309b0 72 62 69 74 72 61 72 69 6c 79 20 6d 61 6e 79 20 rbitrarily many
309c0 74 69 6d 65 73 2e 20 54 6f 20 5c 0a 20 20 20 20 times. To \.
309d0 20 20 63 6f 6d 6d 69 74 20 74 68 65 20 66 69 6e commit the fin
309e0 61 6c 2c 20 6d 65 72 67 65 64 20 72 65 73 75 6c al, merged resul
309f0 74 20 74 6f 20 64 69 73 6b 2c 20 63 68 6f 6f 73 t to disk, choos
30a00 65 20 22 57 72 69 74 65 20 4d 65 72 67 65 20 46 e "Write Merge F
30a10 69 6c 65 2e 2e 2e 22 20 5c 0a 20 20 20 20 20 20 ile..." \.
30a20 66 72 6f 6d 20 74 68 65 20 3c 62 74 6e 3e 4d 65 from the <btn>Me
30a30 72 67 65 3c 2f 62 74 6e 3e 20 6d 65 6e 75 2e 0a rge</btn> menu..
30a40 0a 3c 68 64 72 3e 4d 65 72 67 65 20 50 72 65 76 .<hdr>Merge Prev
30a50 69 65 77 3c 2f 68 64 72 3e 0a 0a 54 6f 20 73 65 iew</hdr>..To se
30a60 65 20 61 20 70 72 65 76 69 65 77 20 6f 66 20 74 e a preview of t
30a70 68 65 20 66 69 6c 65 20 74 68 61 74 20 77 6f 75 he file that wou
30a80 6c 64 20 62 65 20 77 72 69 74 74 65 6e 20 62 79 ld be written by
30a90 20 22 57 72 69 74 65 20 4d 65 72 67 65 20 46 69 "Write Merge Fi
30aa0 6c 65 2e 2e 2e 22 2c 20 5c 0a 20 20 20 20 20 20 le...", \.
30ab0 73 65 6c 65 63 74 20 22 53 68 6f 77 20 4d 65 72 select "Show Mer
30ac0 67 65 20 57 69 6e 64 6f 77 22 20 69 6e 20 74 68 ge Window" in th
30ad0 65 20 56 69 65 77 20 6d 65 6e 75 2e 20 41 20 73 e View menu. A s
30ae0 65 70 61 72 61 74 65 20 77 69 6e 64 6f 77 20 69 eparate window i
30af0 73 20 73 68 6f 77 6e 20 5c 0a 20 20 20 20 20 20 s shown \.
30b00 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 70 containing the p
30b10 72 65 76 69 65 77 2e 20 49 74 20 69 73 20 75 70 review. It is up
30b20 64 61 74 65 64 20 61 73 20 79 6f 75 5c 0a 20 20 dated as you\.
30b30 20 20 20 20 63 68 61 6e 67 65 20 6d 65 72 67 65 change merge
30b40 20 63 68 6f 69 63 65 73 2e 20 49 74 20 69 73 20 choices. It is
30b50 73 79 6e 63 68 72 6f 6e 69 7a 65 64 20 77 69 74 synchronized wit
30b60 68 20 74 68 65 20 6f 74 68 65 72 20 74 65 78 74 h the other text
30b70 20 77 69 64 67 65 74 73 20 69 66 20 5c 0a 20 20 widgets if \.
30b80 20 20 20 20 22 53 79 6e 63 68 72 6f 6e 69 7a 65 "Synchronize
30b90 20 53 63 72 6f 6c 6c 62 61 72 73 22 20 69 73 20 Scrollbars" is
30ba0 6f 6e 2e 0a 0a 3c 68 64 72 3e 41 75 74 68 6f 72 on...<hdr>Author
30bb0 3c 2f 68 64 72 3e 0a 4a 6f 68 6e 20 4d 2e 20 4b </hdr>.John M. K
30bc0 6c 61 73 73 61 0a 0a 3c 68 64 72 3e 43 6f 6d 6d lassa..<hdr>Comm
30bd0 65 6e 74 73 3c 2f 68 64 72 3e 0a 51 75 65 73 74 ents</hdr>.Quest
30be0 69 6f 6e 73 20 61 6e 64 20 63 6f 6d 6d 65 6e 74 ions and comment
30bf0 73 20 73 68 6f 75 6c 64 20 62 65 20 73 65 6e 74 s should be sent
30c00 20 74 6f 20 74 68 65 20 54 6b 44 69 66 66 20 6d to the TkDiff m
30c10 61 69 6c 69 6e 67 20 6c 69 73 74 20 61 74 20 5c ailing list at \
30c20 0a 20 20 20 20 20 20 74 6b 64 69 66 66 2d 64 69 . tkdiff-di
30c30 73 63 75 73 73 40 6c 69 73 74 73 2e 73 6f 75 72 scuss@lists.sour
30c40 63 65 66 6f 72 67 65 2e 6e 65 74 2e 0a 20 20 20 ceforge.net..
30c50 20 7d 0a 0a 20 20 20 20 73 65 74 20 74 65 78 74 }.. set text
30c60 20 5b 73 75 62 73 74 20 2d 6e 6f 62 61 63 6b 73 [subst -nobacks
30c70 6c 61 73 68 65 73 20 2d 6e 6f 63 6f 6d 6d 61 6e lashes -nocomman
30c80 64 73 20 24 74 65 78 74 5d 0a 20 20 20 20 64 6f ds $text]. do
30c90 2d 74 65 78 74 2d 69 6e 66 6f 20 2e 68 65 6c 70 -text-info .help
30ca0 20 24 74 69 74 6c 65 20 24 74 65 78 74 0a 7d 0a $title $text.}.
30cb0 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 .###############
30cc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30cd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30ce0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30cf0 23 23 23 23 23 23 23 0a 23 20 64 69 73 70 6c 61 #######.# displa
30d00 79 20 68 65 6c 70 20 6f 6e 20 74 68 65 20 70 72 y help on the pr
30d10 65 66 65 72 65 6e 63 65 73 0a 23 23 23 23 23 23 eferences.######
30d20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30d30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30d40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30d50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
30d60 0a 70 72 6f 63 20 64 6f 2d 68 65 6c 70 2d 70 72 .proc do-help-pr
30d70 65 66 65 72 65 6e 63 65 73 20 7b 7d 20 7b 0a 20 eferences {} {.
30d80 20 20 20 67 6c 6f 62 61 6c 20 67 0a 20 20 20 20 global g.
30d90 67 6c 6f 62 61 6c 20 70 72 65 66 0a 0a 20 20 20 global pref..
30da0 20 63 75 73 74 6f 6d 69 7a 65 2d 69 6e 69 74 4c customize-initL
30db0 61 62 65 6c 73 0a 0a 20 20 20 20 73 65 74 20 74 abels.. set t
30dc0 69 74 6c 65 20 22 24 67 28 6e 61 6d 65 29 20 50 itle "$g(name) P
30dd0 72 65 66 65 72 65 6e 63 65 73 22 0a 20 20 20 20 references".
30de0 73 65 74 20 74 65 78 74 20 7b 0a 3c 68 64 72 3e set text {.<hdr>
30df0 4f 76 65 72 76 69 65 77 3c 2f 68 64 72 3e 0a 0a Overview</hdr>..
30e00 50 72 65 66 65 72 65 6e 63 65 73 20 61 72 65 20 Preferences are
30e10 73 74 6f 72 65 64 20 69 6e 20 61 20 66 69 6c 65 stored in a file
30e20 20 69 6e 20 79 6f 75 72 20 68 6f 6d 65 20 64 69 in your home di
30e30 72 65 63 74 6f 72 79 20 28 69 64 65 6e 74 69 66 rectory (identif
30e40 69 65 64 20 62 79 20 74 68 65 20 5c 0a 20 20 20 ied by the \.
30e50 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 environment v
30e60 61 72 69 61 62 6c 65 20 3c 63 6d 70 3e 48 4f 4d ariable <cmp>HOM
30e70 45 3c 2f 63 6d 70 3e 2e 29 20 49 66 20 74 68 65 E</cmp>.) If the
30e80 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 environment var
30e90 69 61 62 6c 65 20 5c 0a 20 20 20 20 20 20 3c 63 iable \. <c
30ea0 6d 70 3e 48 4f 4d 45 3c 2f 63 6d 70 3e 20 69 73 mp>HOME</cmp> is
30eb0 20 6e 6f 74 20 73 65 74 20 74 68 65 20 70 6c 61 not set the pla
30ec0 74 66 6f 72 6d 2d 73 70 65 63 69 66 69 63 20 76 tform-specific v
30ed0 61 72 69 61 6e 74 5c 0a 20 20 20 20 20 20 6f 66 ariant\. of
30ee0 20 22 2f 22 20 77 69 6c 6c 20 62 65 20 75 73 65 "/" will be use
30ef0 64 2e 20 49 66 20 79 6f 75 20 61 72 65 20 6f 6e d. If you are on
30f00 20 61 20 57 69 6e 64 6f 77 73 20 70 6c 61 74 66 a Windows platf
30f10 6f 72 6d 20 74 68 65 20 66 69 6c 65 20 77 69 6c orm the file wil
30f20 6c 20 62 65 20 5c 0a 20 20 20 20 20 20 6e 61 6d l be \. nam
30f30 65 64 20 3c 63 6d 70 3e 5f 74 6b 64 69 66 66 2e ed <cmp>_tkdiff.
30f40 72 63 3c 2f 63 6d 70 3e 20 61 6e 64 20 77 69 6c rc</cmp> and wil
30f50 6c 20 68 61 76 65 20 74 68 65 20 61 74 74 72 69 l have the attri
30f60 62 75 74 65 20 22 68 69 64 64 65 6e 22 2e 20 46 bute "hidden". F
30f70 6f 72 20 5c 0a 20 20 20 20 20 20 61 6c 6c 20 6f or \. all o
30f80 74 68 65 72 20 70 6c 61 74 66 6f 72 6d 73 20 74 ther platforms t
30f90 68 65 20 66 69 6c 65 20 77 69 6c 6c 20 62 65 20 he file will be
30fa0 6e 61 6d 65 64 5c 0a 20 20 20 20 20 20 22 2e 74 named\. ".t
30fb0 6b 64 69 66 66 72 63 22 2e 20 59 6f 75 20 6d 61 kdiffrc". You ma
30fc0 79 20 6f 76 65 72 72 69 64 65 20 74 68 65 20 6e y override the n
30fd0 61 6d 65 20 61 6e 64 20 6c 6f 63 61 74 69 6f 6e ame and location
30fe0 20 6f 66 20 74 68 69 73 20 66 69 6c 65 20 62 79 of this file by
30ff0 20 5c 0a 20 20 20 20 20 20 73 65 74 74 69 6e 67 \. setting
31000 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 the environment
31010 20 76 61 72 69 61 62 6c 65 20 3c 63 6d 70 3e 54 variable <cmp>T
31020 4b 44 49 46 46 52 43 3c 2f 63 6d 70 3e 20 74 6f KDIFFRC</cmp> to
31030 20 77 68 61 74 65 76 65 72 20 5c 0a 20 20 20 20 whatever \.
31040 20 20 66 69 6c 65 6e 61 6d 65 20 79 6f 75 20 77 filename you w
31050 69 73 68 2e 0a 0a 50 72 65 66 65 72 65 6e 63 65 ish...Preference
31060 73 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20 s are organized
31070 69 6e 74 6f 20 74 68 72 65 65 20 63 61 74 65 67 into three categ
31080 6f 72 69 65 73 3a 20 47 65 6e 65 72 61 6c 2c 20 ories: General,
31090 44 69 73 70 6c 61 79 20 61 6e 64 20 5c 0a 20 20 Display and \.
310a0 20 20 20 20 41 70 70 65 61 72 61 6e 63 65 2e 0a Appearance..
310b0 0a 3c 68 64 72 3e 47 65 6e 65 72 61 6c 3c 2f 68 .<hdr>General</h
310c0 64 72 3e 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 dr>..<bld>$pref(
310d0 64 69 66 66 63 6d 64 29 3c 2f 62 6c 64 3e 0a 0a diffcmd)</bld>..
310e0 54 68 69 73 20 69 73 20 74 68 65 20 63 6f 6d 6d This is the comm
310f0 61 6e 64 20 74 6f 20 72 75 6e 20 74 6f 20 67 65 and to run to ge
31100 6e 65 72 61 74 65 20 61 20 64 69 66 66 20 6f 66 nerate a diff of
31110 20 74 68 65 20 74 77 6f 20 66 69 6c 65 73 2e 20 the two files.
31120 54 79 70 69 63 61 6c 6c 79 20 5c 0a 20 20 20 20 Typically \.
31130 20 20 74 68 69 73 20 77 69 6c 6c 20 62 65 20 22 this will be "
31140 64 69 66 66 22 2e 20 20 57 68 65 6e 20 74 68 69 diff". When thi
31150 73 20 63 6f 6d 6d 61 6e 64 20 69 73 20 72 75 6e s command is run
31160 2c 20 74 68 65 20 69 67 6e 6f 72 65 2d 62 6c 61 , the ignore-bla
31170 6e 6b 73 20 5c 0a 20 20 20 20 20 20 6f 70 74 69 nks \. opti
31180 6f 6e 73 20 61 6e 64 20 74 68 65 20 6e 61 6d 65 ons and the name
31190 73 20 6f 66 20 74 77 6f 20 66 69 6c 65 73 20 74 s of two files t
311a0 6f 20 62 65 20 64 69 66 66 65 64 20 77 69 6c 6c o be diffed will
311b0 20 62 65 20 61 64 64 65 64 20 61 73 20 74 68 65 be added as the
311c0 20 5c 0a 20 20 20 20 20 20 6c 61 73 74 20 74 6f \. last to
311d0 20 61 72 67 75 6d 65 6e 74 73 20 6f 6e 20 74 68 arguments on th
311e0 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 2e 0a e command line..
311f0 0a 3c 62 6c 64 3e 24 70 72 65 66 28 69 67 6e 6f .<bld>$pref(igno
31200 72 65 62 6c 61 6e 6b 73 6f 70 74 29 3c 2f 62 6c reblanksopt)</bl
31210 64 3e 0a 0a 41 72 67 75 6d 65 6e 74 73 20 74 6f d>..Arguments to
31220 20 73 65 6e 64 20 77 69 74 68 20 74 68 65 20 64 send with the d
31230 69 66 66 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 74 iff command to t
31240 65 6c 6c 20 69 74 20 68 6f 77 20 74 6f 20 69 67 ell it how to ig
31250 6e 6f 72 65 20 77 68 69 74 65 73 70 61 63 65 2e nore whitespace.
31260 20 5c 0a 20 20 20 20 20 20 49 66 20 79 6f 75 20 \. If you
31270 61 72 65 20 75 73 69 6e 67 20 67 6e 75 20 64 69 are using gnu di
31280 66 66 2c 20 22 2d 62 22 20 6f 72 20 22 2d 2d 69 ff, "-b" or "--i
31290 67 6e 6f 72 65 2d 73 70 61 63 65 2d 63 68 61 6e gnore-space-chan
312a0 67 65 22 20 69 67 6e 6f 72 65 73 20 5c 0a 20 20 ge" ignores \.
312b0 20 20 20 20 63 68 61 6e 67 65 73 20 69 6e 20 74 changes in t
312c0 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 77 68 69 he amount of whi
312d0 74 65 73 70 61 63 65 2c 20 77 68 69 6c 65 20 22 tespace, while "
312e0 2d 77 22 20 6f 72 20 5c 0a 20 20 20 20 20 20 22 -w" or \. "
312f0 2d 2d 69 67 6e 6f 72 65 2d 61 6c 6c 2d 73 70 61 --ignore-all-spa
31300 63 65 22 20 69 67 6e 6f 72 65 73 20 61 6c 6c 20 ce" ignores all
31310 77 68 69 74 65 20 73 70 61 63 65 2e 0a 0a 3c 62 white space...<b
31320 6c 64 3e 24 70 72 65 66 28 74 6d 70 64 69 72 29 ld>$pref(tmpdir)
31330 3c 2f 62 6c 64 3e 0a 0a 54 68 65 20 6e 61 6d 65 </bld>..The name
31340 20 6f 66 20 61 20 64 69 72 65 63 74 6f 72 79 20 of a directory
31350 66 6f 72 20 66 69 6c 65 73 20 74 68 61 74 20 61 for files that a
31360 72 65 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 63 re temporarily c
31370 72 65 61 74 65 64 20 77 68 69 6c 65 20 24 67 28 reated while $g(
31380 6e 61 6d 65 29 20 5c 0a 20 20 20 20 20 20 69 73 name) \. is
31390 20 72 75 6e 6e 69 6e 67 2e 0a 0a 3c 62 6c 64 3e running...<bld>
313a0 24 70 72 65 66 28 65 64 69 74 6f 72 29 3c 2f 62 $pref(editor)</b
313b0 6c 64 3e 0a 0a 54 68 65 20 6e 61 6d 65 20 6f 66 ld>..The name of
313c0 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 65 64 69 an external edi
313d0 74 6f 72 20 70 72 6f 67 72 61 6d 20 74 6f 20 75 tor program to u
313e0 73 65 20 77 68 65 6e 20 65 64 69 74 69 6e 67 20 se when editing
313f0 61 20 66 69 6c 65 20 28 69 65 3a 20 77 68 65 6e a file (ie: when
31400 20 5c 0a 20 20 20 20 20 20 79 6f 75 20 73 65 6c \. you sel
31410 65 63 74 20 22 45 64 69 74 22 20 66 72 6f 6d 20 ect "Edit" from
31420 74 68 65 20 70 6f 70 75 70 20 6d 65 6e 75 29 2e the popup menu).
31430 20 49 66 20 74 68 69 73 20 76 61 6c 75 65 20 69 If this value i
31440 73 20 62 6c 61 6e 6b 2c 20 61 20 5c 0a 20 20 20 s blank, a \.
31450 20 20 20 73 69 6d 70 6c 65 20 65 64 69 74 6f 72 simple editor
31460 20 62 75 69 6c 74 20 69 6e 20 74 6f 20 24 67 28 built in to $g(
31470 6e 61 6d 65 29 20 77 69 6c 6c 20 62 65 20 75 73 name) will be us
31480 65 64 2e 20 46 6f 72 5c 0a 20 20 20 20 20 20 77 ed. For\. w
31490 69 6e 64 6f 77 73 20 75 73 65 72 73 20 79 6f 75 indows users you
314a0 20 6d 69 67 68 74 20 77 61 6e 74 20 74 6f 20 73 might want to s
314b0 65 74 20 74 68 69 73 20 74 6f 20 22 6e 6f 74 65 et this to "note
314c0 70 61 64 22 2e 20 55 6e 69 78 20 75 73 65 72 73 pad". Unix users
314d0 20 6d 61 79 20 5c 0a 20 20 20 20 20 20 77 61 6e may \. wan
314e0 74 20 74 6f 20 73 65 74 20 74 68 69 73 20 74 6f t to set this to
314f0 20 22 78 74 65 72 6d 20 2d 65 20 76 69 22 20 6f "xterm -e vi" o
31500 72 20 70 65 72 68 61 70 73 20 22 67 6e 75 63 6c r perhaps "gnucl
31510 69 65 6e 74 22 2e 20 57 68 65 6e 20 72 75 6e 2c ient". When run,
31520 20 74 68 65 20 5c 0a 20 20 20 20 20 20 6e 61 6d the \. nam
31530 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 6f e of the file to
31540 20 65 64 69 74 20 77 69 6c 6c 20 62 65 20 61 70 edit will be ap
31550 70 65 6e 65 64 20 61 73 20 74 68 65 5c 0a 20 20 pened as the\.
31560 20 20 20 20 6c 61 73 74 20 61 72 67 75 6d 65 6e last argumen
31570 74 20 6f 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 t on the command
31580 20 6c 69 6e 65 2e 0a 49 66 20 74 68 65 20 73 75 line..If the su
31590 70 70 6c 69 65 64 20 73 74 72 69 6e 67 20 63 6f pplied string co
315a0 6e 74 61 69 6e 73 20 74 68 65 20 73 74 72 69 6e ntains the strin
315b0 67 20 22 5c 24 66 69 6c 65 22 2c 20 69 74 5c 27 g "\$file", it\'
315c0 73 20 74 72 65 61 74 65 64 20 61 73 20 61 20 77 s treated as a w
315d0 68 6f 6c 65 20 5c 0a 20 20 20 20 20 20 63 6f 6d hole \. com
315e0 6d 61 6e 64 20 6c 69 6e 65 2c 20 77 68 65 72 65 mand line, where
315f0 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 the following p
31600 61 72 61 6d 65 74 65 72 73 20 63 61 6e 20 62 65 arameters can be
31610 20 75 73 65 64 3a 0a 20 5c 24 66 69 6c 65 3a 20 used:. \$file:
31620 74 68 65 20 66 69 6c 65 20 6f 66 20 79 6f 75 72 the file of your
31630 20 63 68 6f 69 63 65 0a 20 5c 24 6c 69 6e 65 3a choice. \$line:
31640 20 74 68 65 20 73 74 61 72 74 69 6e 67 20 6c 69 the starting li
31650 6e 65 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e ne of the curren
31660 74 20 64 69 66 66 0a 46 6f 72 20 65 78 61 6d 70 t diff.For examp
31670 6c 65 2c 20 69 6e 20 74 68 65 20 63 61 73 65 20 le, in the case
31680 6f 66 20 4e 45 64 69 74 20 6f 72 20 45 6d 61 63 of NEdit or Emac
31690 73 20 79 6f 75 20 63 61 6e 20 75 73 65 20 22 6e s you can use "n
316a0 63 20 2d 6c 69 6e 65 20 5c 24 6c 69 6e 65 20 5c c -line \$line \
316b0 0a 20 20 20 20 20 5c 24 66 69 6c 65 22 20 61 6e . \$file" an
316c0 64 20 22 65 6d 61 63 73 20 2b 5c 24 6c 69 6e 65 d "emacs +\$line
316d0 20 5c 24 66 69 6c 65 22 20 72 65 73 70 65 63 74 \$file" respect
316e0 69 76 65 6c 79 2e 0a 0a 3c 62 6c 64 3e 24 70 72 ively...<bld>$pr
316f0 65 66 28 67 65 6f 6d 65 74 72 79 29 3c 2f 62 6c ef(geometry)</bl
31700 64 3e 0a 0a 54 68 69 73 20 64 65 66 69 6e 65 73 d>..This defines
31710 20 74 68 65 20 64 65 66 61 75 6c 74 20 73 69 7a the default siz
31720 65 2c 20 69 6e 20 63 68 61 72 61 63 74 65 72 73 e, in characters
31730 20 6f 66 20 74 68 65 20 74 77 6f 20 74 65 78 74 of the two text
31740 20 77 69 6e 64 6f 77 73 2e 20 54 68 65 20 5c 0a windows. The \.
31750 20 20 20 20 20 20 66 6f 72 6d 61 74 20 73 68 6f format sho
31760 75 6c 64 20 62 65 20 3c 63 6d 70 3e 57 49 44 54 uld be <cmp>WIDT
31770 48 78 48 45 49 47 48 54 3c 2f 63 6d 70 3e 2e 20 HxHEIGHT</cmp>.
31780 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 22 38 30 For example, "80
31790 78 34 30 22 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 x40"...<bld>$pre
317a0 66 28 66 61 6e 63 79 42 75 74 74 6f 6e 73 29 3c f(fancyButtons)<
317b0 2f 62 6c 64 3e 0a 0a 49 66 20 73 65 74 2c 20 74 /bld>..If set, t
317c0 6f 6f 6c 62 61 72 20 62 75 74 74 6f 6e 73 20 77 oolbar buttons w
317d0 69 6c 6c 20 6d 69 6d 69 63 20 74 68 65 20 76 69 ill mimic the vi
317e0 73 75 61 6c 20 62 65 68 61 76 69 6f 72 20 6f 66 sual behavior of
317f0 20 74 79 70 69 63 61 6c 20 4d 69 63 72 6f 73 6f typical Microso
31800 66 74 20 5c 0a 20 20 20 20 20 20 57 69 6e 64 6f ft \. Windo
31810 77 73 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 2e ws applications.
31820 20 42 75 74 74 6f 6e 73 20 77 69 6c 6c 20 69 6e Buttons will in
31830 69 74 69 61 6c 6c 79 20 62 65 20 66 6c 61 74 20 itially be flat
31840 75 6e 74 69 6c 20 74 68 65 20 63 75 72 73 6f 72 until the cursor
31850 20 5c 0a 20 20 20 20 20 20 6d 6f 76 65 73 20 6f \. moves o
31860 76 65 72 20 74 68 65 6d 2c 20 61 74 20 77 68 69 ver them, at whi
31870 63 68 20 74 69 6d 65 20 74 68 65 79 20 77 69 6c ch time they wil
31880 6c 20 62 65 20 72 61 69 73 65 64 2e 0a 49 66 20 l be raised..If
31890 75 6e 73 65 74 2c 20 74 6f 6f 6c 62 61 72 20 62 unset, toolbar b
318a0 75 74 74 6f 6e 73 20 77 69 6c 6c 20 61 6c 77 61 uttons will alwa
318b0 79 73 20 61 70 70 65 61 72 20 72 61 69 73 65 64 ys appear raised
318c0 2e 0a 54 68 69 73 20 66 65 61 74 75 72 65 20 69 ..This feature i
318d0 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 s not supported
318e0 69 6e 20 4d 61 63 4f 53 58 2e 0a 0a 3c 62 6c 64 in MacOSX...<bld
318f0 3e 24 70 72 65 66 28 74 6f 6f 6c 62 61 72 49 63 >$pref(toolbarIc
31900 6f 6e 73 29 3c 2f 62 6c 64 3e 0a 0a 49 66 20 73 ons)</bld>..If s
31910 65 74 2c 20 74 68 65 20 74 6f 6f 6c 62 61 72 20 et, the toolbar
31920 62 75 74 74 6f 6e 73 20 77 69 6c 6c 20 75 73 65 buttons will use
31930 20 69 63 6f 6e 73 20 69 6e 73 74 65 61 64 20 6f icons instead o
31940 66 20 74 65 78 74 20 6c 61 62 65 6c 73 2e 0a 49 f text labels..I
31950 66 20 75 6e 73 65 74 2c 20 74 68 65 20 74 6f 6f f unset, the too
31960 6c 62 61 72 20 62 75 74 74 6f 6e 73 20 77 69 6c lbar buttons wil
31970 6c 20 75 73 65 20 74 65 78 74 20 6c 61 62 65 6c l use text label
31980 73 20 69 6e 73 74 65 61 64 20 6f 66 20 69 63 6f s instead of ico
31990 6e 73 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 ns...<bld>$pref(
319a0 61 75 74 6f 63 65 6e 74 65 72 29 3c 2f 62 6c 64 autocenter)</bld
319b0 3e 0a 0a 49 66 20 73 65 74 2c 20 77 68 65 6e 65 >..If set, whene
319c0 76 65 72 20 61 20 6e 65 77 20 64 69 66 66 20 72 ver a new diff r
319d0 65 63 6f 72 64 20 62 65 63 6f 6d 65 73 20 74 68 ecord becomes th
319e0 65 20 63 75 72 72 65 6e 74 20 64 69 66 66 20 72 e current diff r
319f0 65 63 6f 72 64 20 28 66 6f 72 20 5c 0a 20 20 20 ecord (for \.
31a00 20 20 20 65 78 61 6d 70 6c 65 2c 20 77 68 65 6e example, when
31a10 20 70 72 65 73 73 69 6e 67 20 74 68 65 20 6e 65 pressing the ne
31a20 78 74 20 6f 72 20 70 72 65 76 69 6f 75 73 20 62 xt or previous b
31a30 75 74 74 6f 6e 73 29 2c 20 74 68 65 20 64 69 66 uttons), the dif
31a40 66 20 72 65 63 6f 72 64 20 5c 0a 20 20 20 20 20 f record \.
31a50 20 77 69 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 will be automat
31a60 69 63 61 6c 6c 79 20 63 65 6e 74 65 72 65 64 20 ically centered
31a70 6f 6e 20 74 68 65 20 73 63 72 65 65 6e 2e 0a 49 on the screen..I
31a80 66 20 75 6e 73 65 74 2c 20 6e 6f 20 61 75 74 6f f unset, no auto
31a90 6d 61 74 69 63 20 73 63 72 6f 6c 6c 69 6e 67 20 matic scrolling
31aa0 77 69 6c 6c 20 6f 63 63 75 72 2e 0a 0a 3c 62 6c will occur...<bl
31ab0 64 3e 24 70 72 65 66 28 73 79 6e 63 73 63 72 6f d>$pref(syncscro
31ac0 6c 6c 29 3c 2f 62 6c 64 3e 0a 0a 49 66 20 73 65 ll)</bld>..If se
31ad0 74 2c 20 73 63 72 6f 6c 6c 69 6e 67 20 65 69 74 t, scrolling eit
31ae0 68 65 72 20 74 65 78 74 20 77 69 6e 64 6f 77 20 her text window
31af0 77 69 6c 6c 20 72 65 73 75 6c 74 20 69 6e 20 62 will result in b
31b00 6f 74 68 20 77 69 6e 64 6f 77 73 20 73 63 72 6f oth windows scro
31b10 6c 6c 69 6e 67 2e 0a 49 66 20 6e 6f 74 20 73 65 lling..If not se
31b20 74 2c 20 74 68 65 20 77 69 6e 64 6f 77 73 20 77 t, the windows w
31b30 69 6c 6c 20 73 63 72 6f 6c 6c 20 69 6e 64 65 70 ill scroll indep
31b40 65 6e 64 65 6e 74 20 6f 66 20 65 61 63 68 20 6f endent of each o
31b50 74 68 65 72 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 ther...<bld>$pre
31b60 66 28 61 75 74 6f 73 65 6c 65 63 74 29 3c 2f 62 f(autoselect)</b
31b70 6c 64 3e 0a 0a 49 66 20 73 65 74 2c 20 61 75 74 ld>..If set, aut
31b80 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 6c 65 63 omatically selec
31b90 74 20 74 68 65 20 6e 65 61 72 65 73 74 20 76 69 t the nearest vi
31ba0 73 69 62 6c 65 20 64 69 66 66 20 72 65 67 69 6f sible diff regio
31bb0 6e 20 77 68 65 6e 20 73 63 72 6f 6c 6c 69 6e 67 n when scrolling
31bc0 2e 0a 49 66 20 6e 6f 74 20 73 65 74 2c 20 74 68 ..If not set, th
31bd0 65 20 63 75 72 72 65 6e 74 20 64 69 66 66 20 72 e current diff r
31be0 65 67 69 6f 6e 20 77 69 6c 6c 20 6e 6f 74 20 63 egion will not c
31bf0 68 61 6e 67 65 20 64 75 72 69 6e 67 20 73 63 72 hange during scr
31c00 6f 6c 6c 69 6e 67 2e 0a 54 68 69 73 20 6f 6e 6c olling..This onl
31c10 79 20 74 61 6b 65 73 20 65 66 66 65 63 74 20 69 y takes effect i
31c20 66 20 3c 62 6c 64 3e 24 70 72 65 66 28 73 79 6e f <bld>$pref(syn
31c30 63 73 63 72 6f 6c 6c 29 3c 2f 62 6c 64 3e 20 69 cscroll)</bld> i
31c40 73 20 73 65 74 2e 0a 0a 3c 68 64 72 3e 44 69 73 s set...<hdr>Dis
31c50 70 6c 61 79 3c 2f 68 64 72 3e 0a 0a 3c 62 6c 64 play</hdr>..<bld
31c60 3e 24 70 72 65 66 28 73 68 6f 77 6c 6e 29 3c 2f >$pref(showln)</
31c70 62 6c 64 3e 0a 0a 49 66 20 73 65 74 2c 20 6c 69 bld>..If set, li
31c80 6e 65 20 6e 75 6d 62 65 72 73 20 77 69 6c 6c 20 ne numbers will
31c90 62 65 20 64 69 73 70 6c 61 79 65 64 20 61 6c 6f be displayed alo
31ca0 6e 67 73 69 64 65 20 65 61 63 68 20 6c 69 6e 65 ngside each line
31cb0 20 6f 66 20 65 61 63 68 20 66 69 6c 65 2e 0a 49 of each file..I
31cc0 66 20 6e 6f 74 20 73 65 74 2c 20 6e 6f 20 6c 69 f not set, no li
31cd0 6e 65 20 6e 75 6d 62 65 72 73 20 77 69 6c 6c 20 ne numbers will
31ce0 61 70 70 65 61 72 2e 0a 0a 3c 62 6c 64 3e 24 70 appear...<bld>$p
31cf0 72 65 66 28 74 61 67 6c 6e 29 3c 2f 62 6c 64 3e ref(tagln)</bld>
31d00 0a 0a 49 66 20 73 65 74 2c 20 6c 69 6e 65 20 6e ..If set, line n
31d10 75 6d 62 65 72 73 20 61 72 65 20 68 69 67 68 6c umbers are highl
31d20 69 67 68 74 65 64 20 77 69 74 68 20 74 68 65 20 ighted with the
31d30 6f 70 74 69 6f 6e 73 20 64 65 66 69 6e 65 64 20 options defined
31d40 69 6e 20 74 68 65 20 5c 0a 20 20 20 20 20 20 41 in the \. A
31d50 70 70 65 61 72 61 6e 63 65 20 73 65 63 74 69 6f ppearance sectio
31d60 6e 20 6f 66 20 74 68 65 20 70 72 65 66 65 72 65 n of the prefere
31d70 6e 63 65 73 2e 0a 49 66 20 6e 6f 74 20 73 65 74 nces..If not set
31d80 2c 20 6c 69 6e 65 20 6e 75 6d 62 65 72 73 20 77 , line numbers w
31d90 6f 6e 5c 27 74 20 62 65 20 68 69 67 68 6c 69 67 on\'t be highlig
31da0 68 74 65 64 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 hted...<bld>$pre
31db0 66 28 73 68 6f 77 63 62 73 29 3c 2f 62 6c 64 3e f(showcbs)</bld>
31dc0 0a 0a 49 66 20 73 65 74 2c 20 63 68 61 6e 67 65 ..If set, change
31dd0 20 62 61 72 73 20 77 69 6c 6c 20 62 65 20 64 69 bars will be di
31de0 73 70 6c 61 79 65 64 20 61 6c 6f 6e 67 73 69 64 splayed alongsid
31df0 65 20 65 61 63 68 20 6c 69 6e 65 20 6f 66 20 65 e each line of e
31e00 61 63 68 20 66 69 6c 65 2e 0a 49 66 20 6e 6f 74 ach file..If not
31e10 20 73 65 74 2c 20 6e 6f 20 63 68 61 6e 67 65 20 set, no change
31e20 62 61 72 73 20 77 69 6c 6c 20 61 70 70 65 61 72 bars will appear
31e30 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 74 61 ...<bld>$pref(ta
31e40 67 63 62 73 29 3c 2f 62 6c 64 3e 0a 0a 49 66 20 gcbs)</bld>..If
31e50 73 65 74 2c 20 63 68 61 6e 67 65 20 69 6e 64 69 set, change indi
31e60 63 61 74 6f 72 73 20 77 69 6c 6c 20 62 65 20 68 cators will be h
31e70 69 67 68 6c 69 67 68 74 65 64 2e 20 49 66 20 3c ighlighted. If <
31e80 69 74 6c 3e 24 70 72 65 66 28 63 6f 6c 6f 72 63 itl>$pref(colorc
31e90 62 73 29 3c 2f 69 74 6c 3e 20 5c 0a 20 20 20 20 bs)</itl> \.
31ea0 20 20 69 73 20 73 65 74 20 74 68 65 79 20 77 69 is set they wi
31eb0 6c 6c 20 61 70 70 65 61 72 20 61 73 20 73 6f 6c ll appear as sol
31ec0 69 64 20 63 6f 6c 6f 72 65 64 20 62 61 72 73 20 id colored bars
31ed0 74 68 61 74 20 6d 61 74 63 68 20 74 68 65 20 63 that match the c
31ee0 6f 6c 6f 72 73 20 5c 0a 20 20 20 20 20 20 75 73 olors \. us
31ef0 65 64 20 69 6e 20 74 68 65 20 64 69 66 66 20 6d ed in the diff m
31f00 61 70 2e 20 49 66 20 3c 69 74 6c 3e 24 70 72 65 ap. If <itl>$pre
31f10 66 28 63 6f 6c 6f 72 63 62 73 29 3c 2f 69 74 6c f(colorcbs)</itl
31f20 3e 5c 0a 20 20 20 20 20 20 69 73 20 6e 6f 74 20 >\. is not
31f30 73 65 74 2c 20 74 68 65 20 63 68 61 6e 67 65 20 set, the change
31f40 69 6e 64 69 63 61 74 6f 72 73 20 77 69 6c 6c 20 indicators will
31f50 62 65 20 68 69 67 68 6c 69 67 68 74 65 64 20 61 be highlighted a
31f60 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 ccording to the
31f70 5c 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 \. options
31f80 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65 20 41 defined in the A
31f90 70 70 65 61 72 61 6e 63 65 20 73 65 63 74 69 6f ppearance sectio
31fa0 6e 20 6f 66 20 70 72 65 66 65 72 65 6e 63 65 73 n of preferences
31fb0 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 73 68 ...<bld>$pref(sh
31fc0 6f 77 6d 61 70 29 3c 2f 62 6c 64 3e 0a 0a 49 66 owmap)</bld>..If
31fd0 20 73 65 74 2c 20 63 6f 6c 6f 72 69 7a 65 64 2c set, colorized,
31fe0 20 67 72 61 70 68 69 63 61 6c 20 22 64 69 66 66 graphical "diff
31ff0 20 6d 61 70 22 20 77 69 6c 6c 20 62 65 20 64 69 map" will be di
32000 73 70 6c 61 79 65 64 20 62 65 74 77 65 65 6e 20 splayed between
32010 74 68 65 20 74 77 6f 20 5c 0a 20 20 20 20 20 20 the two \.
32020 66 69 6c 65 73 2c 20 73 68 6f 77 69 6e 67 20 72 files, showing r
32030 65 67 69 6f 6e 73 20 74 68 61 74 20 68 61 76 65 egions that have
32040 20 63 68 61 6e 67 65 64 2e 20 52 65 64 20 69 73 changed. Red is
32050 20 75 73 65 64 20 74 6f 20 73 68 6f 77 20 64 65 used to show de
32060 6c 65 74 65 64 20 5c 0a 20 20 20 20 20 20 6c 69 leted \. li
32070 6e 65 73 2c 20 67 72 65 65 6e 20 66 6f 72 20 61 nes, green for a
32080 64 64 65 64 20 6c 69 6e 65 73 2c 20 62 6c 75 65 dded lines, blue
32090 20 66 6f 72 20 63 68 61 6e 67 65 64 5c 0a 20 20 for changed\.
320a0 20 20 20 20 6c 69 6e 65 73 2c 20 61 6e 64 20 79 lines, and y
320b0 65 6c 6c 6f 77 20 66 6f 72 20 6f 76 65 72 6c 61 ellow for overla
320c0 70 70 69 6e 67 20 6c 69 6e 65 73 20 64 75 72 69 pping lines duri
320d0 6e 67 20 61 20 33 2d 77 61 79 20 6d 65 72 67 65 ng a 3-way merge
320e0 2e 0a 49 66 20 6e 6f 74 20 73 65 74 2c 20 74 68 ..If not set, th
320f0 65 20 64 69 66 66 20 6d 61 70 20 77 69 6c 6c 20 e diff map will
32100 6e 6f 74 20 62 65 20 73 68 6f 77 6e 2e 0a 0a 3c not be shown...<
32110 62 6c 64 3e 24 70 72 65 66 28 73 68 6f 77 6c 69 bld>$pref(showli
32120 6e 65 76 69 65 77 29 3c 2f 62 6c 64 3e 0a 0a 49 neview)</bld>..I
32130 66 20 73 65 74 2c 20 73 68 6f 77 20 61 20 77 69 f set, show a wi
32140 6e 64 6f 77 20 61 74 20 74 68 65 20 62 6f 74 74 ndow at the bott
32150 6f 6d 20 6f 66 20 74 68 65 20 64 69 73 70 6c 61 om of the displa
32160 79 20 74 68 61 74 20 73 68 6f 77 73 20 74 68 65 y that shows the
32170 20 63 75 72 72 65 6e 74 20 5c 0a 20 20 20 20 20 current \.
32180 20 6c 69 6e 65 20 66 72 6f 6d 20 65 61 63 68 20 line from each
32190 66 69 6c 65 2c 20 6f 6e 65 20 6f 6e 20 74 6f 70 file, one on top
321a0 20 6f 66 20 74 68 65 20 6f 74 68 65 72 2e 20 54 of the other. T
321b0 68 69 73 20 77 69 6e 64 6f 77 20 69 73 20 6d 6f his window is mo
321c0 73 74 20 5c 0a 20 20 20 20 20 20 75 73 65 66 75 st \. usefu
321d0 6c 20 74 6f 20 64 6f 20 61 20 62 79 74 65 2d 62 l to do a byte-b
321e0 79 2d 62 79 74 65 20 63 6f 6d 70 61 72 69 73 6f y-byte compariso
321f0 6e 20 6f 66 20 61 20 6c 69 6e 65 20 74 68 61 74 n of a line that
32200 20 68 61 73 5c 0a 20 20 20 20 20 20 63 68 61 6e has\. chan
32210 67 65 64 2e 0a 49 66 20 6e 6f 74 20 73 65 74 2c ged..If not set,
32220 20 74 68 65 20 77 69 6e 64 6f 77 20 77 69 6c 6c the window will
32230 20 6e 6f 74 20 62 65 20 73 68 6f 77 6e 2e 0a 0a not be shown...
32240 3c 62 6c 64 3e 24 70 72 65 66 28 73 68 6f 77 69 <bld>$pref(showi
32250 6e 6c 69 6e 65 31 29 3c 2f 62 6c 64 3e 0a 0a 49 nline1)</bld>..I
32260 66 20 73 65 74 2c 20 73 68 6f 77 20 69 6e 6c 69 f set, show inli
32270 6e 65 20 64 69 66 66 73 20 69 6e 20 74 68 65 20 ne diffs in the
32280 6d 61 69 6e 20 77 69 6e 64 6f 77 2e 20 54 68 69 main window. Thi
32290 73 20 69 73 20 75 73 65 66 75 6c 20 74 6f 20 73 s is useful to s
322a0 65 65 20 77 68 61 74 20 74 68 65 20 5c 0a 20 20 ee what the \.
322b0 20 20 20 20 61 63 74 75 61 6c 20 64 69 66 66 73 actual diffs
322c0 20 61 72 65 20 77 69 74 68 69 6e 20 61 20 6c 61 are within a la
322d0 72 67 65 20 64 69 66 66 20 72 65 67 69 6f 6e 2e rge diff region.
322e0 20 5c 0a 49 66 20 6e 6f 74 20 73 65 74 2c 20 74 \.If not set, t
322f0 68 65 20 69 6e 6c 69 6e 65 20 64 69 66 66 73 20 he inline diffs
32300 61 72 65 20 6e 65 69 74 68 65 72 20 63 6f 6d 70 are neither comp
32310 75 74 65 64 20 6e 6f 72 20 73 68 6f 77 6e 2e 20 uted nor shown.
32320 20 54 68 69 73 20 69 73 20 74 68 65 20 5c 0a 20 This is the \.
32330 20 20 20 20 20 73 69 6d 70 6c 65 72 20 61 70 70 simpler app
32340 72 6f 61 63 68 2c 20 77 68 65 72 65 20 62 79 74 roach, where byt
32350 65 2d 62 79 2d 62 79 74 65 20 63 6f 6d 70 61 72 e-by-byte compar
32360 69 73 6f 6e 73 20 5c 0a 61 72 65 20 75 73 65 64 isons \.are used
32370 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 73 68 ...<bld>$pref(sh
32380 6f 77 69 6e 6c 69 6e 65 32 29 3c 2f 62 6c 64 3e owinline2)</bld>
32390 0a 0a 49 66 20 73 65 74 2c 20 73 68 6f 77 20 69 ..If set, show i
323a0 6e 6c 69 6e 65 20 64 69 66 66 73 20 69 6e 20 74 nline diffs in t
323b0 68 65 20 6d 61 69 6e 20 77 69 6e 64 6f 77 2e 20 he main window.
323c0 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 20 74 This is useful t
323d0 6f 20 73 65 65 20 77 68 61 74 20 74 68 65 20 5c o see what the \
323e0 0a 20 20 20 20 20 20 61 63 74 75 61 6c 20 64 69 . actual di
323f0 66 66 73 20 61 72 65 20 77 69 74 68 69 6e 20 61 ffs are within a
32400 20 6c 61 72 67 65 20 64 69 66 66 20 72 65 67 69 large diff regi
32410 6f 6e 2e 20 5c 0a 49 66 20 6e 6f 74 20 73 65 74 on. \.If not set
32420 2c 20 74 68 65 20 69 6e 6c 69 6e 65 20 64 69 66 , the inline dif
32430 66 73 20 61 72 65 20 6e 65 69 74 68 65 72 20 63 fs are neither c
32440 6f 6d 70 75 74 65 64 20 6e 6f 72 20 73 68 6f 77 omputed nor show
32450 6e 2e 20 20 54 68 69 73 20 61 70 70 72 6f 61 63 n. This approac
32460 68 20 5c 0a 20 20 20 20 20 20 69 73 20 6d 6f 72 h \. is mor
32470 65 20 63 6f 6d 70 6c 65 78 2c 20 62 75 74 20 73 e complex, but s
32480 68 6f 75 6c 64 20 67 69 76 65 20 6d 6f 72 65 20 hould give more
32490 70 6c 65 61 73 69 6e 67 20 5c 0a 72 65 73 75 6c pleasing \.resul
324a0 74 73 20 66 6f 72 20 73 6f 75 72 63 65 20 63 6f ts for source co
324b0 64 65 20 61 6e 64 20 77 72 69 74 74 65 6e 20 74 de and written t
324c0 65 78 74 20 66 69 6c 65 73 2e 20 20 54 68 69 73 ext files. This
324d0 20 69 73 20 74 68 65 20 5c 0a 20 20 20 20 20 20 is the \.
324e0 52 61 74 63 6c 69 66 66 2f 4f 62 65 72 73 68 65 Ratcliff/Obershe
324f0 6c 70 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 lp pattern match
32500 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 20 77 68 ing algorithm wh
32510 69 63 68 20 72 65 63 75 72 73 69 76 65 6c 79 20 ich recursively
32520 5c 0a 66 69 6e 64 73 20 74 68 65 20 6c 61 72 67 \.finds the larg
32530 65 73 74 20 63 6f 6d 6d 6f 6e 20 73 75 62 73 74 est common subst
32540 72 69 6e 67 2c 20 61 6e 64 20 72 65 63 75 72 73 ring, and recurs
32550 69 76 65 6c 79 20 72 65 70 65 61 74 73 20 6f 6e ively repeats on
32560 20 74 68 65 20 6c 65 66 74 20 61 6e 64 20 5c 0a the left and \.
32570 20 20 20 20 20 20 72 69 67 68 74 20 72 65 6d 61 right rema
32580 69 6e 64 65 72 73 2e 0a 0a 3c 62 6c 64 3e 24 70 inders...<bld>$p
32590 72 65 66 28 74 61 67 74 65 78 74 29 3c 2f 62 6c ref(tagtext)</bl
325a0 64 3e 0a 0a 49 66 20 73 65 74 2c 20 74 68 65 20 d>..If set, the
325b0 66 69 6c 65 20 63 6f 6e 74 65 6e 74 73 20 77 69 file contents wi
325c0 6c 6c 20 62 65 20 68 69 67 68 6c 69 67 68 74 65 ll be highlighte
325d0 64 20 77 69 74 68 20 74 68 65 20 6f 70 74 69 6f d with the optio
325e0 6e 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 ns defined in th
325f0 65 20 5c 0a 20 20 20 20 20 20 41 70 70 65 61 72 e \. Appear
32600 61 6e 63 65 20 73 65 63 74 69 6f 6e 20 6f 66 20 ance section of
32610 74 68 65 20 70 72 65 66 65 72 65 6e 63 65 73 2e the preferences.
32620 0a 49 66 20 6e 6f 74 20 73 65 74 2c 20 74 68 65 .If not set, the
32630 20 66 69 6c 65 20 63 6f 6e 74 65 6e 74 73 20 77 file contents w
32640 6f 6e 5c 27 74 20 62 65 20 68 69 67 68 6c 69 67 on\'t be highlig
32650 68 74 65 64 2e 0a 0a 3c 62 6c 64 3e 24 70 72 65 hted...<bld>$pre
32660 66 28 63 6f 6c 6f 72 63 62 73 29 3c 2f 62 6c 64 f(colorcbs)</bld
32670 3e 0a 0a 49 66 20 73 65 74 2c 20 74 68 65 20 63 >..If set, the c
32680 68 61 6e 67 65 20 62 61 72 73 20 77 69 6c 6c 20 hange bars will
32690 64 69 73 70 6c 61 79 20 61 73 20 73 6f 6c 69 64 display as solid
326a0 20 62 61 72 73 20 6f 66 20 63 6f 6c 6f 72 20 74 bars of color t
326b0 68 61 74 20 6d 61 74 63 68 20 74 68 65 20 5c 0a hat match the \.
326c0 20 20 20 20 20 20 63 6f 6c 6f 72 73 20 75 73 65 colors use
326d0 64 20 62 79 20 74 68 65 20 64 69 66 66 20 6d 61 d by the diff ma
326e0 70 2e 0a 49 66 20 6e 6f 74 20 73 65 74 2c 20 74 p..If not set, t
326f0 68 65 20 63 68 61 6e 67 65 20 62 61 72 73 20 77 he change bars w
32700 69 6c 6c 20 64 69 73 70 6c 61 79 20 61 20 22 2b ill display a "+
32710 22 20 66 6f 72 20 6c 69 6e 65 73 20 74 68 61 74 " for lines that
32720 20 65 78 69 73 74 20 69 6e 20 6f 6e 6c 79 20 5c exist in only \
32730 0a 20 20 20 20 20 20 6f 6e 65 20 66 69 6c 65 2c . one file,
32740 20 61 20 22 2d 22 20 66 6f 72 20 6c 69 6e 65 73 a "-" for lines
32750 20 74 68 61 74 20 61 72 65 20 6d 69 73 73 69 6e that are missin
32760 67 20 66 72 6f 6d 20 6f 6e 6c 79 20 6f 6e 65 20 g from only one
32770 66 69 6c 65 2c 20 61 6e 64 20 5c 0a 20 20 20 20 file, and \.
32780 20 20 22 21 22 20 66 6f 72 20 6c 69 6e 65 73 20 "!" for lines
32790 74 68 61 74 20 61 72 65 20 64 69 66 66 65 72 65 that are differe
327a0 6e 74 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 nt between the t
327b0 77 6f 20 66 69 6c 65 73 2e 0a 0a 3c 68 64 72 3e wo files...<hdr>
327c0 41 70 70 65 61 72 61 6e 63 65 3c 2f 68 64 72 3e Appearance</hdr>
327d0 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 74 65 78 ..<bld>$pref(tex
327e0 74 6f 70 74 29 3c 2f 62 6c 64 3e 0a 0a 54 68 69 topt)</bld>..Thi
327f0 73 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 54 s is a list of T
32800 6b 20 74 65 78 74 20 77 69 64 67 65 74 20 6f 70 k text widget op
32810 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 tions that are a
32820 70 70 6c 69 65 64 20 74 6f 20 65 61 63 68 20 6f pplied to each o
32830 66 20 74 68 65 20 74 77 6f 20 5c 0a 20 20 20 20 f the two \.
32840 20 20 74 65 78 74 20 77 69 6e 64 6f 77 73 20 69 text windows i
32850 6e 20 74 68 65 20 6d 61 69 6e 20 64 69 73 70 6c n the main displ
32860 61 79 2e 20 49 66 20 79 6f 75 20 68 61 76 65 20 ay. If you have
32870 54 6b 20 69 6e 73 74 61 6c 6c 65 64 20 6f 6e 20 Tk installed on
32880 79 6f 75 72 20 5c 0a 20 20 20 20 20 20 6d 61 63 your \. mac
32890 68 69 6e 65 20 74 68 65 73 65 20 77 69 6c 6c 20 hine these will
328a0 62 65 20 64 6f 63 75 6d 65 6e 74 65 64 20 69 6e be documented in
328b0 20 74 68 65 20 22 54 65 78 74 2e 6e 22 20 6d 61 the "Text.n" ma
328c0 6e 5c 0a 20 20 20 20 20 20 70 61 67 65 2e 0a 0a n\. page...
328d0 3c 62 6c 64 3e 24 70 72 65 66 28 64 69 66 66 74 <bld>$pref(difft
328e0 61 67 29 3c 2f 62 6c 64 3e 0a 0a 54 68 69 73 20 ag)</bld>..This
328f0 69 73 20 61 20 6c 69 73 74 20 6f 66 20 54 6b 20 is a list of Tk
32900 74 65 78 74 20 77 69 64 67 65 74 20 74 61 67 20 text widget tag
32910 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 options that are
32920 20 61 70 70 6c 69 65 64 20 74 6f 20 61 6c 6c 20 applied to all
32930 64 69 66 66 20 5c 0a 20 20 20 20 20 20 72 65 67 diff \. reg
32940 69 6f 6e 73 2e 20 55 73 65 20 74 68 69 73 20 6f ions. Use this o
32950 70 74 69 6f 6e 20 74 6f 20 6d 61 6b 65 20 64 69 ption to make di
32960 66 66 20 72 65 67 69 6f 6e 73 20 73 74 61 6e 64 ff regions stand
32970 20 6f 75 74 20 66 72 6f 6d 20 72 65 67 75 6c 61 out from regula
32980 72 20 74 65 78 74 2e 0a 0a 3c 62 6c 64 3e 24 70 r text...<bld>$p
32990 72 65 66 28 64 65 6c 74 61 67 29 3c 2f 62 6c 64 ref(deltag)</bld
329a0 3e 0a 0a 54 68 69 73 20 69 73 20 61 20 6c 69 73 >..This is a lis
329b0 74 20 6f 66 20 54 6b 20 74 65 78 74 20 77 69 64 t of Tk text wid
329c0 67 65 74 20 74 61 67 20 6f 70 74 69 6f 6e 73 20 get tag options
329d0 74 68 61 74 20 61 72 65 20 61 70 70 6c 69 65 64 that are applied
329e0 20 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 to the current
329f0 5c 0a 20 20 20 20 20 20 64 69 66 66 20 72 65 67 \. diff reg
32a00 69 6f 6e 2e 20 54 68 65 73 65 20 6f 70 74 69 6f ion. These optio
32a10 6e 73 20 68 61 76 65 20 61 20 68 69 67 68 65 72 ns have a higher
32a20 20 70 72 69 6f 72 69 74 79 20 74 68 61 6e 20 74 priority than t
32a30 68 6f 73 65 20 66 6f 72 20 61 6c 6c 20 5c 0a 20 hose for all \.
32a40 20 20 20 20 20 64 69 66 66 20 72 65 67 69 6f 6e diff region
32a50 73 2e 20 53 6f 2c 20 66 6f 72 20 65 78 61 6d 70 s. So, for examp
32a60 6c 65 2c 20 69 66 20 79 6f 75 20 73 65 74 20 74 le, if you set t
32a70 68 65 5c 0a 20 20 20 20 20 20 66 6f 72 67 72 6f he\. forgro
32a80 75 6e 64 20 66 6f 72 20 61 6c 6c 20 64 69 66 66 und for all diff
32a90 20 72 65 67 69 6f 6e 73 20 74 6f 20 62 65 20 62 regions to be b
32aa0 6c 61 63 6b 20 61 6e 64 20 73 65 74 20 74 68 65 lack and set the
32ab0 20 66 6f 72 65 67 72 6f 75 6e 64 20 66 6f 72 20 foreground for
32ac0 5c 0a 20 20 20 20 20 20 74 68 65 20 63 75 72 72 \. the curr
32ad0 65 6e 74 20 64 69 66 66 20 72 65 67 69 6f 6e 20 ent diff region
32ae0 74 6f 20 62 65 20 62 6c 75 65 2c 20 74 68 65 20 to be blue, the
32af0 63 75 72 72 65 6e 74 20 64 69 66 66 20 72 65 67 current diff reg
32b00 69 6f 6e 20 66 6f 72 65 67 72 6f 75 6e 64 20 5c ion foreground \
32b10 0a 20 20 20 20 20 20 63 6f 6c 6f 72 20 77 69 6c . color wil
32b20 6c 20 62 65 20 75 73 65 64 2e 0a 0a 3c 62 6c 64 l be used...<bld
32b30 3e 24 70 72 65 66 28 69 6e 73 74 61 67 29 3c 2f >$pref(instag)</
32b40 62 6c 64 3e 0a 0a 54 68 69 73 20 69 73 20 61 20 bld>..This is a
32b50 6c 69 73 74 20 6f 66 20 54 6b 20 74 65 78 74 20 list of Tk text
32b60 77 69 64 67 65 74 20 74 61 67 20 6f 70 74 69 6f widget tag optio
32b70 6e 73 20 74 68 61 74 20 61 72 65 20 61 70 70 6c ns that are appl
32b80 69 65 64 20 74 6f 20 72 65 67 69 6f 6e 73 20 74 ied to regions t
32b90 68 61 74 20 5c 0a 20 20 20 20 20 20 68 61 76 65 hat \. have
32ba0 20 62 65 65 6e 20 69 6e 73 65 72 74 65 64 2e 20 been inserted.
32bb0 54 68 65 73 65 20 6f 70 74 69 6f 6e 73 20 68 61 These options ha
32bc0 76 65 20 61 20 68 69 67 68 65 72 20 70 72 69 6f ve a higher prio
32bd0 72 69 74 79 20 74 68 61 6e 20 74 68 6f 73 65 20 rity than those
32be0 66 6f 72 20 5c 0a 20 20 20 20 20 20 61 6c 6c 20 for \. all
32bf0 64 69 66 66 20 72 65 67 69 6f 6e 73 2e 0a 0a 3c diff regions...<
32c00 62 6c 64 3e 24 70 72 65 66 28 63 68 67 74 61 67 bld>$pref(chgtag
32c10 29 3c 2f 62 6c 64 3e 0a 0a 54 68 69 73 20 69 73 )</bld>..This is
32c20 20 61 20 6c 69 73 74 20 6f 66 20 54 6b 20 74 65 a list of Tk te
32c30 78 74 20 77 69 64 67 65 74 20 74 61 67 20 6f 70 xt widget tag op
32c40 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 tions that are a
32c50 70 70 6c 69 65 64 20 74 6f 20 72 65 67 69 6f 6e pplied to region
32c60 73 20 74 68 61 74 20 5c 0a 20 20 20 20 20 20 68 s that \. h
32c70 61 76 65 20 62 65 65 6e 20 63 68 61 6e 67 65 64 ave been changed
32c80 2e 20 54 68 65 73 65 20 6f 70 74 69 6f 6e 73 20 . These options
32c90 68 61 76 65 20 61 20 68 69 67 68 65 72 20 70 72 have a higher pr
32ca0 69 6f 72 69 74 79 20 74 68 61 6e 20 74 68 6f 73 iority than thos
32cb0 65 20 66 6f 72 20 5c 0a 20 20 20 20 20 20 61 6c e for \. al
32cc0 6c 20 64 69 66 66 20 72 65 67 69 6f 6e 73 2e 0a l diff regions..
32cd0 0a 3c 62 6c 64 3e 24 70 72 65 66 28 63 75 72 72 .<bld>$pref(curr
32ce0 74 61 67 29 3c 2f 62 6c 64 3e 0a 0a 54 68 69 73 tag)</bld>..This
32cf0 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 54 6b is a list of Tk
32d00 20 74 65 78 74 20 77 69 64 67 65 74 20 74 61 67 text widget tag
32d10 20 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 61 72 options that ar
32d20 65 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 65 e applied to the
32d30 20 63 75 72 72 65 6e 74 20 5c 0a 20 20 20 20 20 current \.
32d40 20 64 69 66 66 20 72 65 67 69 6f 6e 2e 20 54 68 diff region. Th
32d50 65 73 65 20 74 61 67 73 20 68 61 76 65 20 61 20 ese tags have a
32d60 68 69 67 68 65 72 20 70 72 69 6f 72 69 74 79 20 higher priority
32d70 74 68 61 6e 20 74 68 6f 73 65 20 66 6f 72 20 61 than those for a
32d80 6c 6c 20 64 69 66 66 20 5c 0a 20 20 20 20 20 20 ll diff \.
32d90 72 65 67 69 6f 6e 73 2c 20 61 6e 64 20 61 20 68 regions, and a h
32da0 69 67 68 65 72 20 70 72 69 6f 72 69 74 79 20 74 igher priority t
32db0 68 61 6e 20 74 68 65 20 63 68 61 6e 67 65 2c 5c han the change,\
32dc0 0a 20 20 20 20 20 20 69 6e 73 65 72 74 65 64 20 . inserted
32dd0 61 6e 64 20 64 65 6c 65 74 65 64 20 64 69 66 66 and deleted diff
32de0 20 72 65 67 69 6f 6e 73 2e 0a 0a 3c 62 6c 64 3e regions...<bld>
32df0 24 70 72 65 66 28 69 6e 6c 69 6e 65 74 61 67 29 $pref(inlinetag)
32e00 3c 2f 62 6c 64 3e 0a 0a 54 68 69 73 20 69 73 20 </bld>..This is
32e10 61 20 6c 69 73 74 20 6f 66 20 54 6b 20 74 65 78 a list of Tk tex
32e20 74 20 77 69 64 67 65 74 20 74 61 67 20 6f 70 74 t widget tag opt
32e30 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 70 ions that are ap
32e40 70 6c 69 65 64 20 74 6f 20 64 69 66 66 65 72 65 plied to differe
32e50 6e 63 65 73 20 5c 0a 20 20 20 20 20 20 77 69 74 nces \. wit
32e60 68 69 6e 20 6c 69 6e 65 73 20 69 6e 20 61 20 64 hin lines in a d
32e70 69 66 66 20 72 65 67 69 6f 6e 2e 20 54 68 65 73 iff region. Thes
32e80 65 20 74 61 67 73 20 68 61 76 65 20 61 20 68 69 e tags have a hi
32e90 67 68 65 72 20 70 72 69 6f 72 69 74 79 20 74 68 gher priority th
32ea0 61 6e 20 5c 0a 20 20 20 20 20 20 74 68 6f 73 65 an \. those
32eb0 20 66 6f 72 20 61 6c 6c 20 64 69 66 66 20 72 65 for all diff re
32ec0 67 69 6f 6e 73 2c 20 61 6e 64 20 61 20 68 69 67 gions, and a hig
32ed0 68 65 72 20 70 72 69 6f 72 69 74 79 20 74 68 61 her priority tha
32ee0 6e 20 74 68 65 20 63 68 61 6e 67 65 2c 5c 0a 20 n the change,\.
32ef0 20 20 20 20 20 69 6e 73 65 72 74 65 64 20 61 6e inserted an
32f00 64 20 64 65 6c 65 74 65 64 20 64 69 66 66 20 72 d deleted diff r
32f10 65 67 69 6f 6e 73 2e 0a 0a 3c 62 6c 64 3e 24 70 egions...<bld>$p
32f20 72 65 66 28 62 79 74 65 74 61 67 29 3c 2f 62 6c ref(bytetag)</bl
32f30 64 3e 0a 0a 54 68 69 73 20 69 73 20 61 20 6c 69 d>..This is a li
32f40 73 74 20 6f 66 20 54 6b 20 74 65 78 74 20 77 69 st of Tk text wi
32f50 64 67 65 74 20 74 61 67 20 6f 70 74 69 6f 6e 73 dget tag options
32f60 20 74 68 61 74 20 61 72 65 20 61 70 70 6c 69 65 that are applie
32f70 64 20 74 6f 20 69 6e 64 69 76 69 64 75 61 6c 20 d to individual
32f80 5c 0a 20 20 20 20 20 20 63 68 61 72 61 63 74 65 \. characte
32f90 72 73 20 69 6e 20 74 68 65 20 6c 69 6e 65 20 76 rs in the line v
32fa0 69 65 77 2e 20 54 68 65 73 65 20 6f 70 74 69 6f iew. These optio
32fb0 6e 73 20 64 6f 20 6e 6f 74 20 61 66 66 65 63 74 ns do not affect
32fc0 20 74 68 65 20 6d 61 69 6e 20 74 65 78 74 20 5c the main text \
32fd0 0a 20 20 20 20 20 20 64 69 73 70 6c 61 79 73 2e . displays.
32fe0 0a 0a 3c 62 6c 64 3e 24 70 72 65 66 28 74 61 62 ..<bld>$pref(tab
32ff0 73 74 6f 70 73 29 3c 2f 62 6c 64 3e 0a 0a 54 68 stops)</bld>..Th
33000 69 73 20 64 65 66 69 6e 65 73 20 74 68 65 20 6e is defines the n
33010 75 6d 62 65 72 20 6f 66 20 63 68 61 72 61 63 74 umber of charact
33020 65 72 73 20 66 6f 72 20 65 61 63 68 20 74 61 62 ers for each tab
33030 73 74 6f 70 20 69 6e 20 74 68 65 20 6d 61 69 6e stop in the main
33040 20 64 69 73 70 6c 61 79 20 5c 0a 20 20 20 20 20 display \.
33050 20 77 69 6e 64 6f 77 73 2e 20 54 68 65 20 64 65 windows. The de
33060 66 61 75 6c 74 20 69 73 20 38 2e 0a 20 20 20 20 fault is 8..
33070 7d 0a 0a 20 20 20 20 23 20 73 69 6e 63 65 20 77 }.. # since w
33080 65 20 68 61 76 65 20 65 6d 62 65 64 64 65 64 20 e have embedded
33090 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 74 68 references to th
330a0 65 20 70 72 65 66 65 72 65 6e 63 65 20 6c 61 62 e preference lab
330b0 65 6c 73 20 69 6e 0a 20 20 20 20 23 20 74 68 65 els in. # the
330c0 20 74 65 78 74 2c 20 77 65 20 6e 65 65 64 20 74 text, we need t
330d0 6f 20 70 65 72 66 6f 72 6d 20 73 75 62 73 74 69 o perform substi
330e0 74 75 74 69 6f 6e 73 2e 20 42 65 63 61 75 73 65 tutions. Because
330f0 20 6f 66 20 74 68 69 73 2c 20 69 66 0a 20 20 20 of this, if.
33100 20 23 20 79 6f 75 20 65 64 69 74 20 74 68 65 20 # you edit the
33110 61 62 6f 76 65 20 74 65 78 74 2c 20 62 65 20 73 above text, be s
33120 75 72 65 20 74 6f 20 70 72 6f 70 65 72 6c 79 20 ure to properly
33130 65 73 63 61 70 65 20 61 6e 79 20 64 6f 6c 6c 61 escape any dolla
33140 72 0a 20 20 20 20 23 20 73 69 67 6e 73 20 74 68 r. # signs th
33150 61 74 20 61 72 65 20 6e 6f 74 20 6d 65 61 6e 74 at are not meant
33160 20 74 6f 20 62 65 20 74 72 65 61 74 65 64 20 61 to be treated a
33170 73 20 61 20 76 61 72 69 61 62 6c 65 20 72 65 66 s a variable ref
33180 65 72 65 6e 63 65 0a 0a 20 20 20 20 73 65 74 20 erence.. set
33190 74 65 78 74 20 5b 73 75 62 73 74 20 2d 6e 6f 63 text [subst -noc
331a0 6f 6d 6d 61 6e 64 73 20 24 74 65 78 74 5d 0a 20 ommands $text].
331b0 20 20 20 64 6f 2d 74 65 78 74 2d 69 6e 66 6f 20 do-text-info
331c0 2e 68 65 6c 70 2d 70 72 65 66 65 72 65 6e 63 65 .help-preference
331d0 73 20 24 74 69 74 6c 65 20 24 74 65 78 74 0a 7d s $title $text.}
331e0 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
331f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
33200 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
33210 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
33220 23 23 23 23 23 23 23 23 0a 23 0a 23 20 74 65 78 ########.#.# tex
33230 74 20 66 6f 72 6d 61 74 74 69 6e 67 20 72 6f 75 t formatting rou
33240 74 69 6e 65 73 20 64 65 72 69 76 65 64 20 66 72 tines derived fr
33250 6f 6d 20 4b 6c 6f 6e 64 69 6b 65 0a 23 20 52 65 om Klondike.# Re
33260 70 72 6f 64 75 63 65 64 20 68 65 72 65 20 77 69 produced here wi
33270 74 68 20 70 65 72 6d 69 73 73 69 6f 6e 20 66 72 th permission fr
33280 6f 6d 20 74 68 65 69 72 20 61 75 74 68 6f 72 2e om their author.
33290 0a 23 0a 23 20 43 6f 70 79 72 69 67 68 74 20 28 .#.# Copyright (
332a0 43 29 20 31 39 39 33 2c 31 39 39 34 20 62 79 20 C) 1993,1994 by
332b0 4a 6f 68 6e 20 48 65 69 64 65 6d 61 6e 6e 20 3c John Heidemann <
332c0 6a 6f 68 6e 68 40 66 69 63 75 73 2e 63 73 2e 75 johnh@ficus.cs.u
332d0 63 6c 61 2e 65 64 75 3e 0a 23 20 41 6c 6c 20 72 cla.edu>.# All r
332e0 69 67 68 74 73 20 72 65 73 65 72 76 65 64 2e 0a ights reserved..
332f0 23 0a 23 20 52 65 64 69 73 74 72 69 62 75 74 69 #.# Redistributi
33300 6f 6e 20 61 6e 64 20 75 73 65 20 69 6e 20 73 6f on and use in so
33310 75 72 63 65 20 61 6e 64 20 62 69 6e 61 72 79 20 urce and binary
33320 66 6f 72 6d 73 2c 20 77 69 74 68 20 6f 72 20 77 forms, with or w
33330 69 74 68 6f 75 74 0a 23 20 6d 6f 64 69 66 69 63 ithout.# modific
33340 61 74 69 6f 6e 2c 20 61 72 65 20 70 65 72 6d 69 ation, are permi
33350 74 74 65 64 20 70 72 6f 76 69 64 65 64 20 74 68 tted provided th
33360 61 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 at the following
33370 20 63 6f 6e 64 69 74 69 6f 6e 73 0a 23 20 61 72 conditions.# ar
33380 65 20 6d 65 74 3a 0a 23 20 31 2e 20 52 65 64 69 e met:.# 1. Redi
33390 73 74 72 69 62 75 74 69 6f 6e 73 20 6f 66 20 73 stributions of s
333a0 6f 75 72 63 65 20 63 6f 64 65 20 6d 75 73 74 20 ource code must
333b0 72 65 74 61 69 6e 20 74 68 65 20 61 62 6f 76 65 retain the above
333c0 20 63 6f 70 79 72 69 67 68 74 0a 23 20 20 20 20 copyright.#
333d0 6e 6f 74 69 63 65 2c 20 74 68 69 73 20 6c 69 73 notice, this lis
333e0 74 20 6f 66 20 63 6f 6e 64 69 74 69 6f 6e 73 20 t of conditions
333f0 61 6e 64 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e and the followin
33400 67 20 64 69 73 63 6c 61 69 6d 65 72 2e 0a 23 20 g disclaimer..#
33410 32 2e 20 52 65 64 69 73 74 72 69 62 75 74 69 6f 2. Redistributio
33420 6e 73 20 69 6e 20 62 69 6e 61 72 79 20 66 6f 72 ns in binary for
33430 6d 20 6d 75 73 74 20 72 65 70 72 6f 64 75 63 65 m must reproduce
33440 20 74 68 65 20 61 62 6f 76 65 20 63 6f 70 79 72 the above copyr
33450 69 67 68 74 0a 23 20 20 20 20 6e 6f 74 69 63 65 ight.# notice
33460 2c 20 74 68 69 73 20 6c 69 73 74 20 6f 66 20 63 , this list of c
33470 6f 6e 64 69 74 69 6f 6e 73 20 61 6e 64 20 74 68 onditions and th
33480 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 69 73 63 e following disc
33490 6c 61 69 6d 65 72 20 69 6e 20 74 68 65 0a 23 20 laimer in the.#
334a0 20 20 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e documentation
334b0 20 61 6e 64 2f 6f 72 20 6f 74 68 65 72 20 6d 61 and/or other ma
334c0 74 65 72 69 61 6c 73 20 70 72 6f 76 69 64 65 64 terials provided
334d0 20 77 69 74 68 20 74 68 65 20 64 69 73 74 72 69 with the distri
334e0 62 75 74 69 6f 6e 2e 0a 23 20 33 2e 20 54 68 65 bution..# 3. The
334f0 20 6e 61 6d 65 20 6f 66 20 4a 6f 68 6e 20 48 65 name of John He
33500 69 64 65 6d 61 6e 6e 20 6d 61 79 20 6e 6f 74 20 idemann may not
33510 62 65 20 75 73 65 64 20 74 6f 20 65 6e 64 6f 72 be used to endor
33520 73 65 20 6f 72 20 70 72 6f 6d 6f 74 65 20 70 72 se or promote pr
33530 6f 64 75 63 74 73 0a 23 20 20 20 20 64 65 72 69 oducts.# deri
33540 76 65 64 20 66 72 6f 6d 20 74 68 69 73 20 73 6f ved from this so
33550 66 74 77 61 72 65 20 77 69 74 68 6f 75 74 20 73 ftware without s
33560 70 65 63 69 66 69 63 20 70 72 69 6f 72 20 77 72 pecific prior wr
33570 69 74 74 65 6e 20 70 65 72 6d 69 73 73 69 6f 6e itten permission
33580 2e 0a 23 0a 23 20 54 48 49 53 20 53 4f 46 54 57 ..#.# THIS SOFTW
33590 41 52 45 20 49 53 20 50 52 4f 56 49 44 45 44 20 ARE IS PROVIDED
335a0 42 59 20 4a 4f 48 4e 20 48 45 49 44 45 4d 41 4e BY JOHN HEIDEMAN
335b0 4e 20 60 60 41 53 20 49 53 27 27 20 41 4e 44 0a N ``AS IS'' AND.
335c0 23 20 41 4e 59 20 45 58 50 52 45 53 53 20 4f 52 # ANY EXPRESS OR
335d0 20 49 4d 50 4c 49 45 44 20 57 41 52 52 41 4e 54 IMPLIED WARRANT
335e0 49 45 53 2c 20 49 4e 43 4c 55 44 49 4e 47 2c 20 IES, INCLUDING,
335f0 42 55 54 20 4e 4f 54 20 4c 49 4d 49 54 45 44 20 BUT NOT LIMITED
33600 54 4f 2c 20 54 48 45 0a 23 20 49 4d 50 4c 49 45 TO, THE.# IMPLIE
33610 44 20 57 41 52 52 41 4e 54 49 45 53 20 4f 46 20 D WARRANTIES OF
33620 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 20 MERCHANTABILITY
33630 41 4e 44 20 46 49 54 4e 45 53 53 20 46 4f 52 20 AND FITNESS FOR
33640 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 52 A PARTICULAR PUR
33650 50 4f 53 45 0a 23 20 41 52 45 20 44 49 53 43 4c POSE.# ARE DISCL
33660 41 49 4d 45 44 2e 20 20 49 4e 20 4e 4f 20 45 56 AIMED. IN NO EV
33670 45 4e 54 20 53 48 41 4c 4c 20 4a 4f 48 4e 20 48 ENT SHALL JOHN H
33680 45 49 44 45 4d 41 4e 4e 20 42 45 20 4c 49 41 42 EIDEMANN BE LIAB
33690 4c 45 0a 23 20 46 4f 52 20 41 4e 59 20 44 49 52 LE.# FOR ANY DIR
336a0 45 43 54 2c 20 49 4e 44 49 52 45 43 54 2c 20 49 ECT, INDIRECT, I
336b0 4e 43 49 44 45 4e 54 41 4c 2c 20 53 50 45 43 49 NCIDENTAL, SPECI
336c0 41 4c 2c 20 45 58 45 4d 50 4c 41 52 59 2c 20 4f AL, EXEMPLARY, O
336d0 52 20 43 4f 4e 53 45 51 55 45 4e 54 49 41 4c 0a R CONSEQUENTIAL.
336e0 23 20 44 41 4d 41 47 45 53 20 28 49 4e 43 4c 55 # DAMAGES (INCLU
336f0 44 49 4e 47 2c 20 42 55 54 20 4e 4f 54 20 4c 49 DING, BUT NOT LI
33700 4d 49 54 45 44 20 54 4f 2c 20 50 52 4f 43 55 52 MITED TO, PROCUR
33710 45 4d 45 4e 54 20 4f 46 20 53 55 42 53 54 49 54 EMENT OF SUBSTIT
33720 55 54 45 20 47 4f 4f 44 53 0a 23 20 4f 52 20 53 UTE GOODS.# OR S
33730 45 52 56 49 43 45 53 3b 20 4c 4f 53 53 20 4f 46 ERVICES; LOSS OF
33740 20 55 53 45 2c 20 44 41 54 41 2c 20 4f 52 20 50 USE, DATA, OR P
33750 52 4f 46 49 54 53 3b 20 4f 52 20 42 55 53 49 4e ROFITS; OR BUSIN
33760 45 53 53 20 49 4e 54 45 52 52 55 50 54 49 4f 4e ESS INTERRUPTION
33770 29 0a 23 20 48 4f 57 45 56 45 52 20 43 41 55 53 ).# HOWEVER CAUS
33780 45 44 20 41 4e 44 20 4f 4e 20 41 4e 59 20 54 48 ED AND ON ANY TH
33790 45 4f 52 59 20 4f 46 20 4c 49 41 42 49 4c 49 54 EORY OF LIABILIT
337a0 59 2c 20 57 48 45 54 48 45 52 20 49 4e 20 43 4f Y, WHETHER IN CO
337b0 4e 54 52 41 43 54 2c 20 53 54 52 49 43 54 0a 23 NTRACT, STRICT.#
337c0 20 4c 49 41 42 49 4c 49 54 59 2c 20 4f 52 20 54 LIABILITY, OR T
337d0 4f 52 54 20 28 49 4e 43 4c 55 44 49 4e 47 20 4e ORT (INCLUDING N
337e0 45 47 4c 49 47 45 4e 43 45 20 4f 52 20 4f 54 48 EGLIGENCE OR OTH
337f0 45 52 57 49 53 45 29 20 41 52 49 53 49 4e 47 20 ERWISE) ARISING
33800 49 4e 20 41 4e 59 20 57 41 59 0a 23 20 4f 55 54 IN ANY WAY.# OUT
33810 20 4f 46 20 54 48 45 20 55 53 45 20 4f 46 20 54 OF THE USE OF T
33820 48 49 53 20 53 4f 46 54 57 41 52 45 2c 20 45 56 HIS SOFTWARE, EV
33830 45 4e 20 49 46 20 41 44 56 49 53 45 44 20 4f 46 EN IF ADVISED OF
33840 20 54 48 45 20 50 4f 53 53 49 42 49 4c 49 54 59 THE POSSIBILITY
33850 20 4f 46 0a 23 20 53 55 43 48 20 44 41 4d 41 47 OF.# SUCH DAMAG
33860 45 2e 0a 23 0a 23 23 23 23 23 23 23 23 23 23 23 E..#.###########
33870 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
33880 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
33890 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
338a0 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 6f 63 ###########.proc
338b0 20 70 75 74 2d 74 65 78 74 20 7b 74 77 20 74 78 put-text {tw tx
338c0 74 7d 20 7b 0a 0a 20 20 20 20 24 74 77 20 63 6f t} {.. $tw co
338d0 6e 66 69 67 75 72 65 20 2d 66 6f 6e 74 20 7b 46 nfigure -font {F
338e0 69 78 65 64 20 31 32 7d 0a 0a 20 20 20 20 24 74 ixed 12}.. $t
338f0 77 20 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f 6e w configure -fon
33900 74 20 2d 2a 2d 54 69 6d 65 73 2d 4d 65 64 69 75 t -*-Times-Mediu
33910 6d 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a 2d 31 34 2d m-R-Normal-*-14-
33920 2a 0a 0a 20 20 20 20 24 74 77 20 74 61 67 20 63 *.. $tw tag c
33930 6f 6e 66 69 67 75 72 65 20 62 6c 64 20 2d 66 6f onfigure bld -fo
33940 6e 74 20 2d 2a 2d 54 69 6d 65 73 2d 42 6f 6c 64 nt -*-Times-Bold
33950 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a 2d 31 34 2d 2a -R-Normal-*-14-*
33960 0a 20 20 20 20 24 74 77 20 74 61 67 20 63 6f 6e . $tw tag con
33970 66 69 67 75 72 65 20 63 6d 70 20 2d 66 6f 6e 74 figure cmp -font
33980 20 2d 2a 2d 43 6f 75 72 69 65 72 2d 4d 65 64 69 -*-Courier-Medi
33990 75 6d 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a 2d 31 32 um-R-Normal-*-12
339a0 2d 2a 0a 20 20 20 20 24 74 77 20 74 61 67 20 63 -*. $tw tag c
339b0 6f 6e 66 69 67 75 72 65 20 68 64 72 20 2d 66 6f onfigure hdr -fo
339c0 6e 74 20 2d 2a 2d 48 65 6c 76 65 74 69 63 61 2d nt -*-Helvetica-
339d0 42 6f 6c 64 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a 2d Bold-R-Normal-*-
339e0 31 36 2d 2a 20 2d 75 6e 64 65 72 6c 69 6e 65 20 16-* -underline
339f0 31 0a 20 20 20 20 24 74 77 20 74 61 67 20 63 6f 1. $tw tag co
33a00 6e 66 69 67 75 72 65 20 69 74 6c 20 2d 66 6f 6e nfigure itl -fon
33a10 74 20 2d 2a 2d 54 69 6d 65 73 2d 4d 65 64 69 75 t -*-Times-Mediu
33a20 6d 2d 49 2d 4e 6f 72 6d 61 6c 2d 2a 2d 31 34 2d m-I-Normal-*-14-
33a30 2a 0a 20 20 20 20 24 74 77 20 74 61 67 20 63 6f *. $tw tag co
33a40 6e 66 69 67 75 72 65 20 74 74 6c 20 2d 66 6f 6e nfigure ttl -fon
33a50 74 20 2d 2a 2d 48 65 6c 76 65 74 69 63 61 2d 42 t -*-Helvetica-B
33a60 6f 6c 64 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a 2d 31 old-R-Normal-*-1
33a70 38 2d 2a 0a 20 20 20 20 23 24 74 77 20 74 61 67 8-*. #$tw tag
33a80 20 63 6f 6e 66 69 67 75 72 65 20 68 33 20 2d 66 configure h3 -f
33a90 6f 6e 74 20 2d 2a 2d 48 65 6c 76 65 74 69 63 61 ont -*-Helvetica
33aa0 2d 42 6f 6c 64 2d 52 2d 4e 6f 72 6d 61 6c 2d 2a -Bold-R-Normal-*
33ab0 2d 31 34 2d 2a 0a 20 20 20 20 23 24 74 77 20 74 -14-*. #$tw t
33ac0 61 67 20 63 6f 6e 66 69 67 75 72 65 20 69 74 6c ag configure itl
33ad0 20 2d 66 6f 6e 74 20 2d 2a 2d 54 69 6d 65 73 2d -font -*-Times-
33ae0 4d 65 64 69 75 6d 2d 49 2d 4e 6f 72 6d 61 6c 2d Medium-I-Normal-
33af0 2a 2d 31 34 2d 2a 0a 20 20 20 20 23 24 74 77 20 *-14-*. #$tw
33b00 74 61 67 20 63 6f 6e 66 69 67 75 72 65 20 72 65 tag configure re
33b10 76 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 77 68 v -foreground wh
33b20 69 74 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 ite -background
33b30 62 6c 61 63 6b 0a 0a 0a 20 20 20 20 24 74 77 20 black... $tw
33b40 6d 61 72 6b 20 73 65 74 20 69 6e 73 65 72 74 20 mark set insert
33b50 30 2e 30 0a 0a 20 20 20 20 73 65 74 20 74 20 24 0.0.. set t $
33b60 74 78 74 0a 0a 20 20 20 20 77 68 69 6c 65 20 7b txt.. while {
33b70 5b 72 65 67 65 78 70 20 2d 69 6e 64 69 63 65 73 [regexp -indices
33b80 20 7b 3c 28 5b 5e 40 3e 5d 2a 29 3e 7d 20 24 74 {<([^@>]*)>} $t
33b90 20 6d 61 74 63 68 20 69 6e 64 73 5d 20 3d 3d 20 match inds] ==
33ba0 31 7d 20 7b 0a 0a 09 73 65 74 20 73 74 61 72 74 1} {...set start
33bb0 20 5b 6c 69 6e 64 65 78 20 24 69 6e 64 73 20 30 [lindex $inds 0
33bc0 5d 0a 09 73 65 74 20 65 6e 64 20 5b 6c 69 6e 64 ]..set end [lind
33bd0 65 78 20 24 69 6e 64 73 20 31 5d 0a 09 73 65 74 ex $inds 1]..set
33be0 20 6b 65 79 77 6f 72 64 20 5b 73 74 72 69 6e 67 keyword [string
33bf0 20 72 61 6e 67 65 20 24 74 20 24 73 74 61 72 74 range $t $start
33c00 20 24 65 6e 64 5d 0a 0a 09 73 65 74 20 6f 6c 64 $end]...set old
33c10 65 6e 64 20 5b 24 74 77 20 69 6e 64 65 78 20 65 end [$tw index e
33c20 6e 64 5d 0a 0a 09 24 74 77 20 69 6e 73 65 72 74 nd]...$tw insert
33c30 20 65 6e 64 20 5b 73 74 72 69 6e 67 20 72 61 6e end [string ran
33c40 67 65 20 24 74 20 30 20 5b 65 78 70 72 20 7b 24 ge $t 0 [expr {$
33c50 73 74 61 72 74 20 2d 20 32 7d 5d 5d 0a 0a 09 70 start - 2}]]...p
33c60 75 72 67 65 2d 61 6c 6c 2d 74 61 67 73 20 24 74 urge-all-tags $t
33c70 77 20 24 6f 6c 64 65 6e 64 20 69 6e 73 65 72 74 w $oldend insert
33c80 0a 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 72 ...if {[string r
33c90 61 6e 67 65 20 24 6b 65 79 77 6f 72 64 20 30 20 ange $keyword 0
33ca0 30 5d 20 3d 3d 20 22 2f 22 7d 20 7b 0a 09 20 20 0] == "/"} {..
33cb0 20 20 73 65 74 20 6b 65 79 77 6f 72 64 20 5b 73 set keyword [s
33cc0 74 72 69 6e 67 20 74 72 69 6d 6c 65 66 74 20 24 tring trimleft $
33cd0 6b 65 79 77 6f 72 64 20 22 2f 22 5d 0a 09 20 20 keyword "/"]..
33ce0 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
33cf0 74 73 20 74 61 67 73 28 24 6b 65 79 77 6f 72 64 ts tags($keyword
33d00 29 5d 20 3d 3d 20 30 7d 20 7b 0a 09 09 65 72 72 )] == 0} {...err
33d10 6f 72 20 22 65 6e 64 20 74 61 67 20 24 6b 65 79 or "end tag $key
33d20 77 6f 72 64 20 77 69 74 68 6f 75 74 20 62 65 67 word without beg
33d30 69 6e 6e 69 6e 67 22 0a 09 20 20 20 20 7d 0a 09 inning".. }..
33d40 20 20 20 20 24 74 77 20 74 61 67 20 61 64 64 20 $tw tag add
33d50 24 6b 65 79 77 6f 72 64 20 24 74 61 67 73 28 24 $keyword $tags($
33d60 6b 65 79 77 6f 72 64 29 20 69 6e 73 65 72 74 0a keyword) insert.
33d70 09 20 20 20 20 75 6e 73 65 74 20 74 61 67 73 28 . unset tags(
33d80 24 6b 65 79 77 6f 72 64 29 0a 09 7d 20 65 6c 73 $keyword)..} els
33d90 65 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 69 6e e {.. if {[in
33da0 66 6f 20 65 78 69 73 74 73 20 74 61 67 73 28 24 fo exists tags($
33db0 6b 65 79 77 6f 72 64 29 5d 20 3d 3d 20 31 7d 20 keyword)] == 1}
33dc0 7b 0a 09 09 65 72 72 6f 72 20 22 6e 65 73 74 69 {...error "nesti
33dd0 6e 67 20 6f 66 20 62 65 67 69 6e 20 74 61 67 20 ng of begin tag
33de0 24 6b 65 79 77 6f 72 64 22 0a 09 20 20 20 20 7d $keyword".. }
33df0 0a 09 20 20 20 20 73 65 74 20 74 61 67 73 28 24 .. set tags($
33e00 6b 65 79 77 6f 72 64 29 20 5b 24 74 77 20 69 6e keyword) [$tw in
33e10 64 65 78 20 69 6e 73 65 72 74 5d 0a 09 7d 0a 0a dex insert]..}..
33e20 09 73 65 74 20 74 20 5b 73 74 72 69 6e 67 20 72 .set t [string r
33e30 61 6e 67 65 20 24 74 20 5b 65 78 70 72 20 7b 24 ange $t [expr {$
33e40 65 6e 64 20 2b 20 32 7d 5d 20 65 6e 64 5d 0a 20 end + 2}] end].
33e50 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 6f 6c }.. set ol
33e60 64 65 6e 64 20 5b 24 74 77 20 69 6e 64 65 78 20 dend [$tw index
33e70 65 6e 64 5d 0a 20 20 20 20 24 74 77 20 69 6e 73 end]. $tw ins
33e80 65 72 74 20 65 6e 64 20 24 74 0a 20 20 20 20 70 ert end $t. p
33e90 75 72 67 65 2d 61 6c 6c 2d 74 61 67 73 20 24 74 urge-all-tags $t
33ea0 77 20 24 6f 6c 64 65 6e 64 20 69 6e 73 65 72 74 w $oldend insert
33eb0 0a 7d 0a 0a 70 72 6f 63 20 70 75 72 67 65 2d 61 .}..proc purge-a
33ec0 6c 6c 2d 74 61 67 73 20 7b 77 20 73 74 61 72 74 ll-tags {w start
33ed0 20 65 6e 64 7d 20 7b 0a 20 20 20 20 66 6f 72 65 end} {. fore
33ee0 61 63 68 20 74 61 67 20 5b 24 77 20 74 61 67 20 ach tag [$w tag
33ef0 6e 61 6d 65 73 20 24 73 74 61 72 74 5d 20 7b 0a names $start] {.
33f00 09 24 77 20 74 61 67 20 72 65 6d 6f 76 65 20 24 .$w tag remove $
33f10 74 61 67 20 24 73 74 61 72 74 20 24 65 6e 64 0a tag $start $end.
33f20 20 20 20 20 7d 0a 7d 0a 0a 23 20 4f 70 65 6e 20 }.}..# Open
33f30 6f 6e 65 20 6f 66 20 74 68 65 20 64 69 66 66 65 one of the diffe
33f40 64 20 66 69 6c 65 73 20 69 6e 20 61 6e 20 65 64 d files in an ed
33f50 69 74 6f 72 20 69 66 20 70 6f 73 73 69 62 6c 65 itor if possible
33f60 0a 70 72 6f 63 20 64 6f 2d 65 64 69 74 20 7b 7d .proc do-edit {}
33f70 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a {. global g.
33f80 20 20 20 20 67 6c 6f 62 61 6c 20 6f 70 74 73 0a global opts.
33f90 20 20 20 20 67 6c 6f 62 61 6c 20 66 69 6e 66 6f global finfo
33fa0 0a 20 20 20 20 67 6c 6f 62 61 6c 20 77 0a 0a 20 . global w..
33fb0 20 20 20 69 66 20 7b 24 67 28 61 63 74 69 76 65 if {$g(active
33fc0 57 69 6e 64 6f 77 29 20 3d 3d 20 24 77 28 4c 65 Window) == $w(Le
33fd0 66 74 54 65 78 74 29 7d 20 7b 0a 09 73 65 74 20 ftText)} {..set
33fe0 66 69 6c 65 6e 6f 20 31 0a 20 20 20 20 7d 20 65 fileno 1. } e
33ff0 6c 73 65 69 66 20 7b 24 67 28 61 63 74 69 76 65 lseif {$g(active
34000 57 69 6e 64 6f 77 29 20 3d 3d 20 24 77 28 52 69 Window) == $w(Ri
34010 67 68 74 54 65 78 74 29 7d 20 7b 0a 09 73 65 74 ghtText)} {..set
34020 20 66 69 6c 65 6e 6f 20 32 0a 20 20 20 20 7d 20 fileno 2. }
34030 65 6c 73 65 20 7b 0a 09 73 65 74 20 66 69 6c 65 else {..set file
34040 6e 6f 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 no 1. }..
34050 69 66 20 7b 24 66 69 6e 66 6f 28 74 6d 70 2c 24 if {$finfo(tmp,$
34060 66 69 6c 65 6e 6f 29 7d 20 7b 0a 09 64 6f 2d 65 fileno)} {..do-e
34070 72 72 6f 72 20 22 54 68 69 73 20 66 69 6c 65 20 rror "This file
34080 69 73 20 6e 6f 74 20 65 64 69 74 61 62 6c 65 22 is not editable"
34090 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 69 . } else {..i
340a0 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
340b0 68 20 5b 73 74 72 69 6e 67 20 74 72 69 6d 20 24 h [string trim $
340c0 6f 70 74 73 28 65 64 69 74 6f 72 29 5d 5d 20 3d opts(editor)]] =
340d0 3d 20 30 7d 20 7b 0a 09 20 20 20 20 73 69 6d 70 = 0} {.. simp
340e0 6c 65 45 64 20 6f 70 65 6e 20 24 66 69 6e 66 6f leEd open $finfo
340f0 28 70 74 68 2c 24 66 69 6c 65 6e 6f 29 0a 09 7d (pth,$fileno)..}
34100 20 65 6c 73 65 69 66 20 7b 5b 72 65 67 65 78 70 elseif {[regexp
34110 20 22 5c 5c 5c 24 66 69 6c 65 22 20 22 24 6f 70 "\\\$file" "$op
34120 74 73 28 65 64 69 74 6f 72 29 22 5d 20 3d 3d 20 ts(editor)"] ==
34130 31 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6c 69 1} {.. set li
34140 6e 65 20 5b 6c 69 6e 64 65 78 20 5b 65 78 74 72 ne [lindex [extr
34150 61 63 74 20 24 67 28 63 75 72 72 64 69 66 66 29 act $g(currdiff)
34160 5d 20 5b 65 78 70 72 20 7b 28 24 66 69 6c 65 6e ] [expr {($filen
34170 6f 2d 31 29 20 2a 32 2b 31 7d 5d 5d 0a 09 20 20 o-1) *2+1}]]..
34180 20 20 73 65 74 20 66 69 6c 65 20 24 66 69 6e 66 set file $finf
34190 6f 28 70 74 68 2c 24 66 69 6c 65 6e 6f 29 0a 09 o(pth,$fileno)..
341a0 20 20 20 20 65 76 61 6c 20 73 65 74 20 63 6f 6d eval set com
341b0 6d 61 6e 64 6c 69 6e 65 20 5c 22 24 6f 70 74 73 mandline \"$opts
341c0 28 65 64 69 74 6f 72 29 20 26 5c 22 0a 09 20 20 (editor) &\"..
341d0 20 20 65 76 61 6c 20 65 78 65 63 20 24 63 6f 6d eval exec $com
341e0 6d 61 6e 64 6c 69 6e 65 0a 09 7d 20 65 6c 73 65 mandline..} else
341f0 20 7b 0a 09 20 20 20 20 65 76 61 6c 20 65 78 65 {.. eval exe
34200 63 20 24 6f 70 74 73 28 65 64 69 74 6f 72 29 20 c $opts(editor)
34210 22 7b 24 66 69 6e 66 6f 28 70 74 68 2c 24 66 69 "{$finfo(pth,$fi
34220 6c 65 6e 6f 29 7d 22 20 26 0a 09 7d 0a 20 20 20 leno)}" &..}.
34230 20 7d 0a 7d 0a 0a 23 23 23 23 23 23 23 23 23 23 }.}..##########
34240 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34250 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34260 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34270 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34280 0a 23 20 70 6c 61 74 66 6f 72 6d 2d 73 70 65 63 .# platform-spec
34290 69 66 69 63 20 73 74 75 66 66 0a 23 23 23 23 23 ific stuff.#####
342a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
342b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
342c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
342d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
342e0 23 23 23 23 23 0a 70 72 6f 63 20 73 65 74 41 71 #####.proc setAq
342f0 75 61 44 69 61 6c 6f 67 53 74 79 6c 65 20 7b 74 uaDialogStyle {t
34300 6f 70 6c 65 76 65 6c 7d 20 7b 0a 20 20 20 20 74 oplevel} {. t
34310 6b 3a 3a 75 6e 73 75 70 70 6f 72 74 65 64 3a 3a k::unsupported::
34320 4d 61 63 57 69 6e 64 6f 77 53 74 79 6c 65 20 73 MacWindowStyle s
34330 74 79 6c 65 20 24 74 6f 70 6c 65 76 65 6c 20 6d tyle $toplevel m
34340 6f 76 61 62 6c 65 44 42 6f 78 50 72 6f 63 0a 7d ovableDBoxProc.}
34350 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
34360 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34370 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34380 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34390 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 41 ############.# A
343a0 20 73 69 6d 70 6c 65 20 65 64 69 74 6f 72 2c 20 simple editor,
343b0 66 72 6f 6d 20 42 72 79 61 6e 20 4f 61 6b 6c 65 from Bryan Oakle
343c0 79 2e 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 y..#############
343d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
343e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
343f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
34400 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
34410 6f 63 20 73 69 6d 70 6c 65 45 64 20 7b 63 6f 6d oc simpleEd {com
34420 6d 61 6e 64 20 61 72 67 73 7d 20 7b 0a 20 20 20 mand args} {.
34430 20 67 6c 6f 62 61 6c 20 74 65 78 74 66 6f 6e 74 global textfont
34440 0a 0a 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 .. switch --
34450 24 63 6f 6d 6d 61 6e 64 20 7b 0a 20 20 20 20 6f $command {. o
34460 70 65 6e 20 7b 0a 09 20 20 20 20 73 65 74 20 66 pen {.. set f
34470 69 6c 65 6e 61 6d 65 20 5b 6c 69 6e 64 65 78 20 ilename [lindex
34480 24 61 72 67 73 20 30 5d 0a 0a 09 20 20 20 20 73 $args 0]... s
34490 65 74 20 77 20 2e 65 64 69 74 6f 72 0a 09 20 20 et w .editor..
344a0 20 20 73 65 74 20 63 6f 75 6e 74 20 30 0a 09 20 set count 0..
344b0 20 20 20 77 68 69 6c 65 20 7b 5b 77 69 6e 66 6f while {[winfo
344c0 20 65 78 69 73 74 73 20 24 7b 77 7d 24 63 6f 75 exists ${w}$cou
344d0 6e 74 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 63 6f nt]} {...incr co
344e0 75 6e 74 20 31 0a 09 20 20 20 20 7d 0a 09 20 20 unt 1.. }..
344f0 20 20 73 65 74 20 77 20 24 7b 77 7d 24 63 6f 75 set w ${w}$cou
34500 6e 74 0a 0a 09 20 20 20 20 74 6f 70 6c 65 76 65 nt... topleve
34510 6c 20 24 77 20 2d 62 6f 72 64 65 72 77 69 64 74 l $w -borderwidt
34520 68 20 32 20 2d 72 65 6c 69 65 66 20 73 75 6e 6b h 2 -relief sunk
34530 65 6e 0a 09 20 20 20 20 77 6d 20 74 69 74 6c 65 en.. wm title
34540 20 24 77 20 22 24 66 69 6c 65 6e 61 6d 65 20 2d $w "$filename -
34550 20 53 69 6d 70 6c 65 20 45 64 69 74 6f 72 22 0a Simple Editor".
34560 09 20 20 20 20 77 6d 20 67 72 6f 75 70 20 24 77 . wm group $w
34570 20 2e 0a 0a 09 20 20 20 20 6d 65 6e 75 20 24 77 .... menu $w
34580 2e 6d 65 6e 75 62 61 72 0a 09 20 20 20 20 24 77 .menubar.. $w
34590 20 63 6f 6e 66 69 67 75 72 65 20 2d 6d 65 6e 75 configure -menu
345a0 20 24 77 2e 6d 65 6e 75 62 61 72 0a 0a 09 20 20 $w.menubar...
345b0 20 20 24 77 2e 6d 65 6e 75 62 61 72 20 61 64 64 $w.menubar add
345c0 20 63 61 73 63 61 64 65 20 2d 6c 61 62 65 6c 20 cascade -label
345d0 22 46 69 6c 65 22 20 2d 6d 65 6e 75 20 24 77 2e "File" -menu $w.
345e0 6d 65 6e 75 62 61 72 2e 66 69 6c 65 4d 65 6e 75 menubar.fileMenu
345f0 0a 09 20 20 20 20 24 77 2e 6d 65 6e 75 62 61 72 .. $w.menubar
34600 20 61 64 64 20 63 61 73 63 61 64 65 20 2d 6c 61 add cascade -la
34610 62 65 6c 20 22 45 64 69 74 22 20 2d 6d 65 6e 75 bel "Edit" -menu
34620 20 24 77 2e 6d 65 6e 75 62 61 72 2e 65 64 69 74 $w.menubar.edit
34630 4d 65 6e 75 0a 0a 09 20 20 20 20 6d 65 6e 75 20 Menu... menu
34640 24 77 2e 6d 65 6e 75 62 61 72 2e 66 69 6c 65 4d $w.menubar.fileM
34650 65 6e 75 0a 09 20 20 20 20 6d 65 6e 75 20 24 77 enu.. menu $w
34660 2e 6d 65 6e 75 62 61 72 2e 65 64 69 74 4d 65 6e .menubar.editMen
34670 75 0a 0a 09 20 20 20 20 24 77 2e 6d 65 6e 75 62 u... $w.menub
34680 61 72 2e 66 69 6c 65 4d 65 6e 75 20 61 64 64 20 ar.fileMenu add
34690 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c 20 22 command -label "
346a0 53 61 76 65 22 20 2d 75 6e 64 65 72 6c 69 6e 65 Save" -underline
346b0 20 31 20 5c 0a 09 20 20 20 20 20 20 2d 63 6f 6d 1 \.. -com
346c0 6d 61 6e 64 20 5b 6c 69 73 74 20 73 69 6d 70 6c mand [list simpl
346d0 65 45 64 20 73 61 76 65 20 24 66 69 6c 65 6e 61 eEd save $filena
346e0 6d 65 20 24 77 5d 0a 09 20 20 20 20 24 77 2e 6d me $w].. $w.m
346f0 65 6e 75 62 61 72 2e 66 69 6c 65 4d 65 6e 75 20 enubar.fileMenu
34700 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 add command -lab
34710 65 6c 20 22 53 61 76 65 20 41 73 2e 2e 2e 22 20 el "Save As..."
34720 2d 75 6e 64 65 72 6c 69 6e 65 20 31 20 5c 0a 09 -underline 1 \..
34730 20 20 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 5b -command [
34740 6c 69 73 74 20 73 69 6d 70 6c 65 45 64 20 73 61 list simpleEd sa
34750 76 65 41 73 20 24 66 69 6c 65 6e 61 6d 65 20 24 veAs $filename $
34760 77 5d 0a 09 20 20 20 20 24 77 2e 6d 65 6e 75 62 w].. $w.menub
34770 61 72 2e 66 69 6c 65 4d 65 6e 75 20 61 64 64 20 ar.fileMenu add
34780 73 65 70 61 72 61 74 6f 72 0a 09 20 20 20 20 24 separator.. $
34790 77 2e 6d 65 6e 75 62 61 72 2e 66 69 6c 65 4d 65 w.menubar.fileMe
347a0 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 2d nu add command -
347b0 6c 61 62 65 6c 20 22 45 78 69 74 22 20 2d 75 6e label "Exit" -un
347c0 64 65 72 6c 69 6e 65 20 31 20 5c 0a 09 20 20 20 derline 1 \..
347d0 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 -command [lis
347e0 74 20 73 69 6d 70 6c 65 45 64 20 65 78 69 74 20 t simpleEd exit
347f0 24 77 5d 0a 0a 09 20 20 20 20 24 77 2e 6d 65 6e $w]... $w.men
34800 75 62 61 72 2e 65 64 69 74 4d 65 6e 75 20 61 64 ubar.editMenu ad
34810 64 20 63 6f 6d 6d 61 6e 64 20 2d 6c 61 62 65 6c d command -label
34820 20 22 43 75 74 22 20 2d 63 6f 6d 6d 61 6e 64 20 "Cut" -command
34830 5b 6c 69 73 74 20 65 76 65 6e 74 20 5c 0a 09 20 [list event \..
34840 20 20 20 20 20 67 65 6e 65 72 61 74 65 20 24 77 generate $w
34850 2e 74 65 78 74 20 3c 3c 43 75 74 3e 3e 5d 0a 09 .text <<Cut>>]..
34860 20 20 20 20 24 77 2e 6d 65 6e 75 62 61 72 2e 65 $w.menubar.e
34870 64 69 74 4d 65 6e 75 20 61 64 64 20 63 6f 6d 6d ditMenu add comm
34880 61 6e 64 20 2d 6c 61 62 65 6c 20 22 43 6f 70 79 and -label "Copy
34890 22 20 2d 63 6f 6d 6d 61 6e 64 20 5c 0a 09 20 20 " -command \..
348a0 20 20 20 20 5b 6c 69 73 74 20 65 76 65 6e 74 20 [list event
348b0 67 65 6e 65 72 61 74 65 20 24 77 2e 74 65 78 74 generate $w.text
348c0 20 3c 3c 43 6f 70 79 3e 3e 5d 0a 09 20 20 20 20 <<Copy>>]..
348d0 24 77 2e 6d 65 6e 75 62 61 72 2e 65 64 69 74 4d $w.menubar.editM
348e0 65 6e 75 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 enu add command
348f0 2d 6c 61 62 65 6c 20 22 50 61 73 74 65 22 20 2d -label "Paste" -
34900 63 6f 6d 6d 61 6e 64 20 5c 0a 09 20 20 20 20 20 command \..
34910 20 5b 6c 69 73 74 20 65 76 65 6e 74 20 67 65 6e [list event gen
34920 65 72 61 74 65 20 24 77 2e 74 65 78 74 20 3c 3c erate $w.text <<
34930 50 61 73 74 65 3e 3e 5d 0a 0a 09 20 20 20 20 74 Paste>>]... t
34940 65 78 74 20 24 77 2e 74 65 78 74 20 2d 77 72 61 ext $w.text -wra
34950 70 20 6e 6f 6e 65 20 2d 78 73 63 72 6f 6c 6c 63 p none -xscrollc
34960 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 24 77 2e ommand [list $w.
34970 68 73 62 20 73 65 74 5d 20 5c 0a 09 20 20 20 20 hsb set] \..
34980 20 20 2d 79 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e -yscrollcomman
34990 64 20 5b 6c 69 73 74 20 24 77 2e 76 73 62 20 73 d [list $w.vsb s
349a0 65 74 5d 20 2d 62 6f 72 64 65 72 77 69 64 74 68 et] -borderwidth
349b0 20 30 20 2d 66 6f 6e 74 20 24 74 65 78 74 66 6f 0 -font $textfo
349c0 6e 74 0a 09 20 20 20 20 73 63 72 6f 6c 6c 62 61 nt.. scrollba
349d0 72 20 24 77 2e 76 73 62 20 2d 6f 72 69 65 6e 74 r $w.vsb -orient
349e0 20 76 65 72 74 69 63 61 6c 20 2d 63 6f 6d 6d 61 vertical -comma
349f0 6e 64 20 5b 6c 69 73 74 20 24 77 2e 74 65 78 74 nd [list $w.text
34a00 20 79 76 69 65 77 5d 0a 09 20 20 20 20 73 63 72 yview].. scr
34a10 6f 6c 6c 62 61 72 20 24 77 2e 68 73 62 20 2d 6f ollbar $w.hsb -o
34a20 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e 74 61 6c rient horizontal
34a30 20 2d 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 -command [list
34a40 24 77 2e 74 65 78 74 20 78 76 69 65 77 5d 0a 0a $w.text xview]..
34a50 09 20 20 20 20 67 72 69 64 20 24 77 2e 74 65 78 . grid $w.tex
34a60 74 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e t -row 0 -column
34a70 20 30 20 2d 73 74 69 63 6b 79 20 6e 73 65 77 0a 0 -sticky nsew.
34a80 09 20 20 20 20 67 72 69 64 20 24 77 2e 76 73 62 . grid $w.vsb
34a90 20 2d 72 6f 77 20 30 20 2d 63 6f 6c 75 6d 6e 20 -row 0 -column
34aa0 31 20 2d 73 74 69 63 6b 79 20 6e 73 0a 09 20 20 1 -sticky ns..
34ab0 20 20 67 72 69 64 20 24 77 2e 68 73 62 20 2d 72 grid $w.hsb -r
34ac0 6f 77 20 31 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d ow 1 -column 0 -
34ad0 73 74 69 63 6b 79 20 65 77 0a 0a 09 20 20 20 20 sticky ew...
34ae0 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 grid columnconfi
34af0 67 75 72 65 20 24 77 20 30 20 2d 77 65 69 67 68 gure $w 0 -weigh
34b00 74 20 31 0a 09 20 20 20 20 67 72 69 64 20 63 6f t 1.. grid co
34b10 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20 24 77 lumnconfigure $w
34b20 20 31 20 2d 77 65 69 67 68 74 20 30 0a 09 20 20 1 -weight 0..
34b30 20 20 67 72 69 64 20 72 6f 77 63 6f 6e 66 69 67 grid rowconfig
34b40 75 72 65 20 24 77 20 30 20 2d 77 65 69 67 68 74 ure $w 0 -weight
34b50 20 31 0a 09 20 20 20 20 67 72 69 64 20 72 6f 77 1.. grid row
34b60 63 6f 6e 66 69 67 75 72 65 20 24 77 20 31 20 2d configure $w 1 -
34b70 77 65 69 67 68 74 20 30 0a 0a 09 20 20 20 20 73 weight 0... s
34b80 65 74 20 66 64 20 5b 6f 70 65 6e 20 24 66 69 6c et fd [open $fil
34b90 65 6e 61 6d 65 5d 0a 09 20 20 20 20 24 77 2e 74 ename].. $w.t
34ba0 65 78 74 20 69 6e 73 65 72 74 20 31 2e 30 20 5b ext insert 1.0 [
34bb0 72 65 61 64 20 24 66 64 5d 0a 09 20 20 20 20 63 read $fd].. c
34bc0 6c 6f 73 65 20 24 66 64 0a 09 7d 0a 20 20 20 20 lose $fd..}.
34bd0 73 61 76 65 20 7b 0a 09 20 20 20 20 73 65 74 20 save {.. set
34be0 66 69 6c 65 6e 61 6d 65 20 5b 6c 69 6e 64 65 78 filename [lindex
34bf0 20 24 61 72 67 73 20 30 5d 0a 09 20 20 20 20 73 $args 0].. s
34c00 65 74 20 77 20 5b 6c 69 6e 64 65 78 20 24 61 72 et w [lindex $ar
34c10 67 73 20 31 5d 0a 09 20 20 20 20 73 65 74 20 66 gs 1].. set f
34c20 64 20 5b 6f 70 65 6e 20 24 66 69 6c 65 6e 61 6d d [open $filenam
34c30 65 20 77 5d 0a 09 20 20 20 20 70 75 74 73 20 24 e w].. puts $
34c40 66 64 20 5b 24 77 2e 74 65 78 74 20 67 65 74 20 fd [$w.text get
34c50 31 2e 30 20 22 65 6e 64 2d 31 63 22 5d 0a 09 20 1.0 "end-1c"]..
34c60 20 20 20 63 6c 6f 73 65 20 24 66 64 0a 09 7d 0a close $fd..}.
34c70 20 20 20 20 73 61 76 65 41 73 20 7b 0a 09 20 20 saveAs {..
34c80 20 20 73 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b set filename [
34c90 6c 69 6e 64 65 78 20 24 61 72 67 73 20 30 5d 0a lindex $args 0].
34ca0 09 20 20 20 20 73 65 74 20 77 20 5b 6c 69 6e 64 . set w [lind
34cb0 65 78 20 24 61 72 67 73 20 31 5d 0a 09 20 20 20 ex $args 1]..
34cc0 20 73 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b 74 set filename [t
34cd0 6b 5f 67 65 74 53 61 76 65 46 69 6c 65 20 2d 69 k_getSaveFile -i
34ce0 6e 69 74 69 61 6c 66 69 6c 65 20 24 66 69 6c 65 nitialfile $file
34cf0 6e 61 6d 65 5d 0a 09 20 20 20 20 69 66 20 7b 24 name].. if {$
34d00 66 69 6c 65 6e 61 6d 65 20 21 3d 20 22 22 7d 20 filename != ""}
34d10 7b 0a 09 09 73 69 6d 70 6c 65 45 64 20 73 61 76 {...simpleEd sav
34d20 65 20 24 66 69 6c 65 6e 61 6d 65 20 24 77 0a 09 e $filename $w..
34d30 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 65 78 69 }..}. exi
34d40 74 20 7b 0a 09 20 20 20 20 73 65 74 20 77 20 5b t {.. set w [
34d50 6c 69 6e 64 65 78 20 24 61 72 67 73 20 30 5d 0a lindex $args 0].
34d60 09 20 20 20 20 64 65 73 74 72 6f 79 20 24 77 0a . destroy $w.
34d70 09 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 65 6e .}. }.}..# en
34d80 64 20 6f 66 20 73 69 6d 70 6c 65 45 64 0a 0a 23 d of simpleEd..#
34d90 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 31 Copyright (c) 1
34da0 39 39 38 2d 32 30 30 35 2c 20 42 72 79 61 6e 20 998-2005, Bryan
34db0 4f 61 6b 6c 65 79 0a 23 20 41 6c 6c 20 52 69 67 Oakley.# All Rig
34dc0 68 74 73 20 52 65 73 65 72 76 65 72 65 64 0a 23 hts Reservered.#
34dd0 0a 23 20 42 72 79 61 6e 20 4f 61 6b 6c 65 79 0a .# Bryan Oakley.
34de0 23 20 6f 61 6b 6c 65 79 40 62 61 72 64 6f 2e 63 # oakley@bardo.c
34df0 6c 65 61 72 6c 69 67 68 74 2e 63 6f 6d 0a 23 0a learlight.com.#.
34e00 23 20 63 6f 6d 62 6f 62 6f 78 20 76 32 2e 32 2e # combobox v2.2.
34e10 32 20 53 65 70 74 65 6d 62 65 72 20 32 32 2c 20 2 September 22,
34e20 32 30 30 32 0a 23 0a 23 20 61 20 63 6f 6d 62 6f 2002.#.# a combo
34e30 62 6f 78 20 2f 20 64 72 6f 70 64 6f 77 6e 20 6c box / dropdown l
34e40 69 73 74 62 6f 78 20 28 70 69 63 6b 20 79 6f 75 istbox (pick you
34e50 72 20 66 61 76 6f 72 69 74 65 20 6e 61 6d 65 29 r favorite name)
34e60 20 77 69 64 67 65 74 0a 23 20 77 72 69 74 74 65 widget.# writte
34e70 6e 20 69 6e 20 70 75 72 65 20 74 63 6c 0a 23 0a n in pure tcl.#.
34e80 23 20 74 68 69 73 20 63 6f 64 65 20 69 73 20 66 # this code is f
34e90 72 65 65 6c 79 20 64 69 73 74 72 69 62 75 74 61 reely distributa
34ea0 62 6c 65 20 77 69 74 68 6f 75 74 20 72 65 73 74 ble without rest
34eb0 72 69 63 74 69 6f 6e 2c 20 62 75 74 20 69 73 0a riction, but is.
34ec0 23 20 70 72 6f 76 69 64 65 64 20 61 73 2d 69 73 # provided as-is
34ed0 20 77 69 74 68 20 6e 6f 20 77 61 72 72 61 6e 74 with no warrant
34ee0 79 20 65 78 70 72 65 73 73 65 64 20 6f 72 20 69 y expressed or i
34ef0 6d 70 6c 69 65 64 2e 0a 23 0a 23 20 74 68 61 6e mplied..#.# than
34f00 6b 73 20 74 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 ks to the follow
34f10 69 6e 67 20 70 65 6f 70 6c 65 20 77 68 6f 20 70 ing people who p
34f20 72 6f 76 69 64 65 64 20 62 65 74 61 20 74 65 73 rovided beta tes
34f30 74 20 73 75 70 70 6f 72 74 20 6f 72 0a 23 20 70 t support or.# p
34f40 61 74 63 68 65 73 20 74 6f 20 74 68 65 20 63 6f atches to the co
34f50 64 65 20 28 69 6e 20 6e 6f 20 70 61 72 74 69 63 de (in no partic
34f60 75 6c 61 72 20 6f 72 64 65 72 29 3a 0a 23 0a 23 ular order):.#.#
34f70 20 53 63 6f 74 74 20 42 65 61 73 6c 65 79 20 20 Scott Beasley
34f80 20 20 20 41 6c 65 78 61 6e 64 72 65 20 46 65 72 Alexandre Fer
34f90 72 69 65 75 78 20 20 20 20 20 20 54 6f 64 64 20 rieux Todd
34fa0 48 65 6c 66 74 65 72 0a 23 20 4d 61 74 74 20 47 Helfter.# Matt G
34fb0 75 73 68 65 65 20 20 20 20 20 20 20 4c 61 75 72 ushee Laur
34fc0 65 6e 74 20 44 75 70 65 72 76 61 6c 20 20 20 20 ent Duperval
34fd0 20 20 20 20 4a 6f 68 6e 20 4a 61 63 6b 73 6f 6e John Jackson
34fe0 0a 23 20 46 72 65 64 20 52 61 70 70 20 20 20 20 .# Fred Rapp
34ff0 20 20 20 20 20 43 68 72 69 73 74 6f 70 68 65 72 Christopher
35000 20 4e 65 6c 73 6f 6e 0a 23 20 45 72 69 63 20 47 Nelson.# Eric G
35010 61 6c 6c 75 7a 7a 6f 20 20 20 20 20 4a 65 61 6e alluzzo Jean
35020 2d 46 72 61 6e 63 6f 69 73 20 4d 6f 69 6e 65 0a -Francois Moine.
35030 23 0a 23 20 41 20 73 70 65 63 69 61 6c 20 74 68 #.# A special th
35040 61 6e 6b 73 20 74 6f 20 4d 61 72 74 69 6e 20 4d anks to Martin M
35050 2e 20 48 75 6e 74 20 77 68 6f 20 70 72 6f 76 69 . Hunt who provi
35060 64 65 64 20 73 65 76 65 72 61 6c 20 67 6f 6f 64 ded several good
35070 20 69 64 65 61 73 2c 0a 23 20 61 6e 64 20 61 6c ideas,.# and al
35080 77 61 79 73 20 77 69 74 68 20 61 20 70 61 74 63 ways with a patc
35090 68 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 h to implement t
350a0 68 65 6d 2e 20 4a 65 61 6e 2d 46 72 61 6e 63 6f hem. Jean-Franco
350b0 69 73 20 4d 6f 69 6e 65 2c 0a 23 20 54 6f 64 64 is Moine,.# Todd
350c0 20 48 65 6c 66 74 65 72 20 61 6e 64 20 4a 6f 68 Helfter and Joh
350d0 6e 20 4a 61 63 6b 73 6f 6e 20 77 65 72 65 20 61 n Jackson were a
350e0 6c 73 6f 20 6b 69 6e 64 20 65 6e 6f 75 67 68 20 lso kind enough
350f0 74 6f 20 73 65 6e 64 20 69 6e 20 73 6f 6d 65 0a to send in some.
35100 23 20 63 6f 64 65 20 70 61 74 63 68 65 73 2e 0a # code patches..
35110 23 0a 23 20 2e 2e 2e 20 61 6e 64 20 6d 61 6e 79 #.# ... and many
35120 20 6f 74 68 65 72 73 20 6f 76 65 72 20 74 68 65 others over the
35130 20 79 65 61 72 73 2e 0a 0a 70 61 63 6b 61 67 65 years...package
35140 20 70 72 6f 76 69 64 65 20 63 6f 6d 62 6f 62 6f provide combobo
35150 78 20 32 2e 32 2e 32 0a 0a 6e 61 6d 65 73 70 61 x 2.2.2..namespa
35160 63 65 20 65 76 61 6c 20 3a 3a 63 6f 6d 62 6f 62 ce eval ::combob
35170 6f 78 20 7b 0a 0a 20 20 20 20 23 20 74 68 69 73 ox {.. # this
35180 20 69 73 20 74 68 65 20 70 75 62 6c 69 63 20 69 is the public i
35190 6e 74 65 72 66 61 63 65 0a 20 20 20 20 6e 61 6d nterface. nam
351a0 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 63 6f espace export co
351b0 6d 62 6f 62 6f 78 0a 0a 20 20 20 20 23 20 74 68 mbobox.. # th
351c0 65 73 65 20 63 6f 6e 74 61 69 6e 20 72 65 66 65 ese contain refe
351d0 72 65 6e 63 65 73 20 74 6f 20 61 76 61 69 6c 61 rences to availa
351e0 62 6c 65 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 ble options.
351f0 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 74 4f variable widgetO
35200 70 74 69 6f 6e 73 0a 0a 20 20 20 20 23 20 74 68 ptions.. # th
35210 65 73 65 20 63 6f 6e 74 61 69 6e 20 72 65 66 65 ese contain refe
35220 72 65 6e 63 65 73 20 74 6f 20 61 76 61 69 6c 61 rences to availa
35230 62 6c 65 20 63 6f 6d 6d 61 6e 64 73 20 61 6e 64 ble commands and
35240 20 73 75 62 63 6f 6d 6d 61 6e 64 73 0a 20 20 20 subcommands.
35250 20 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 74 variable widget
35260 43 6f 6d 6d 61 6e 64 73 0a 20 20 20 20 76 61 72 Commands. var
35270 69 61 62 6c 65 20 73 63 61 6e 43 6f 6d 6d 61 6e iable scanComman
35280 64 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 ds. variable
35290 6c 69 73 74 43 6f 6d 6d 61 6e 64 73 0a 7d 0a 0a listCommands.}..
352a0 23 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 63 6f # ::combobox::co
352b0 6d 62 6f 62 6f 78 20 2d 2d 0a 23 0a 23 20 20 20 mbobox --.#.#
352c0 20 20 54 68 69 73 20 69 73 20 74 68 65 20 63 6f This is the co
352d0 6d 6d 61 6e 64 20 74 68 61 74 20 67 65 74 73 20 mmand that gets
352e0 65 78 70 6f 72 74 65 64 2e 20 49 74 20 63 72 65 exported. It cre
352f0 61 74 65 73 20 61 20 6e 65 77 0a 23 20 20 20 20 ates a new.#
35300 20 63 6f 6d 62 6f 62 6f 78 20 77 69 64 67 65 74 combobox widget
35310 2e 0a 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a ..#.# Arguments:
35320 0a 23 0a 23 20 20 20 20 20 77 20 20 20 20 20 20 .#.# w
35330 20 20 70 61 74 68 20 6f 66 20 6e 65 77 20 77 69 path of new wi
35340 64 67 65 74 20 74 6f 20 63 72 65 61 74 65 0a 23 dget to create.#
35350 20 20 20 20 20 61 72 67 73 20 20 20 20 20 61 64 args ad
35360 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2f ditional option/
35370 76 61 6c 75 65 20 70 61 69 72 73 20 28 65 67 3a value pairs (eg:
35380 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 77 68 69 -background whi
35390 74 65 2c 20 65 74 63 2e 29 0a 23 0a 23 20 52 65 te, etc.).#.# Re
353a0 73 75 6c 74 73 3a 0a 23 0a 23 20 20 20 20 20 49 sults:.#.# I
353b0 74 20 63 72 65 61 74 65 73 20 74 68 65 20 77 69 t creates the wi
353c0 64 67 65 74 20 61 6e 64 20 73 65 74 73 20 75 70 dget and sets up
353d0 20 61 6c 6c 20 6f 66 20 74 68 65 20 64 65 66 61 all of the defa
353e0 75 6c 74 20 62 69 6e 64 69 6e 67 73 0a 23 0a 23 ult bindings.#.#
353f0 20 52 65 74 75 72 6e 73 3a 0a 23 0a 23 20 20 20 Returns:.#.#
35400 20 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 The name of th
35410 65 20 6e 65 77 6c 79 20 63 72 65 61 74 65 20 77 e newly create w
35420 69 64 67 65 74 0a 0a 70 72 6f 63 20 3a 3a 63 6f idget..proc ::co
35430 6d 62 6f 62 6f 78 3a 3a 63 6f 6d 62 6f 62 6f 78 mbobox::combobox
35440 20 7b 77 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 {w args} {.
35450 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 74 4f variable widgetO
35460 70 74 69 6f 6e 73 0a 20 20 20 20 76 61 72 69 61 ptions. varia
35470 62 6c 65 20 77 69 64 67 65 74 43 6f 6d 6d 61 6e ble widgetComman
35480 64 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 ds. variable
35490 73 63 61 6e 43 6f 6d 6d 61 6e 64 73 0a 20 20 20 scanCommands.
354a0 20 76 61 72 69 61 62 6c 65 20 6c 69 73 74 43 6f variable listCo
354b0 6d 6d 61 6e 64 73 0a 0a 20 20 20 20 23 20 70 65 mmands.. # pe
354c0 72 66 6f 72 6d 20 61 20 6f 6e 65 20 74 69 6d 65 rform a one time
354d0 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 0a initialization.
354e0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
354f0 78 69 73 74 73 20 77 69 64 67 65 74 4f 70 74 69 xists widgetOpti
35500 6f 6e 73 5d 7d 20 7b 0a 09 49 6e 69 74 0a 20 20 ons]} {..Init.
35510 20 20 7d 0a 0a 20 20 20 20 23 20 62 75 69 6c 64 }.. # build
35520 20 69 74 2e 2e 2e 0a 20 20 20 20 65 76 61 6c 20 it.... eval
35530 42 75 69 6c 64 20 24 77 20 24 61 72 67 73 0a 0a Build $w $args..
35540 20 20 20 20 23 20 73 65 74 20 73 6f 6d 65 20 62 # set some b
35550 69 6e 64 69 6e 67 73 2e 2e 2e 0a 20 20 20 20 53 indings.... S
35560 65 74 42 69 6e 64 69 6e 67 73 20 24 77 0a 0a 20 etBindings $w..
35570 20 20 20 23 20 61 6e 64 20 77 65 20 61 72 65 20 # and we are
35580 64 6f 6e 65 21 0a 20 20 20 20 72 65 74 75 72 6e done!. return
35590 20 24 77 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f $w.}..# ::combo
355a0 62 6f 78 3a 3a 49 6e 69 74 20 2d 2d 0a 23 0a 23 box::Init --.#.#
355b0 20 20 20 20 20 49 6e 69 74 69 61 6c 69 7a 65 20 Initialize
355c0 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 76 61 the namespace va
355d0 72 69 61 62 6c 65 73 2e 20 54 68 69 73 20 73 68 riables. This sh
355e0 6f 75 6c 64 20 6f 6e 6c 79 20 62 65 20 63 61 6c ould only be cal
355f0 6c 65 64 0a 23 20 20 20 20 20 6f 6e 63 65 2c 20 led.# once,
35600 69 6d 6d 65 64 69 61 74 65 6c 79 20 70 72 69 6f immediately prio
35610 72 20 74 6f 20 63 72 65 61 74 69 6e 67 20 74 68 r to creating th
35620 65 20 66 69 72 73 74 20 69 6e 73 74 61 6e 63 65 e first instance
35630 20 6f 66 20 74 68 65 0a 23 20 20 20 20 20 77 69 of the.# wi
35640 64 67 65 74 0a 23 0a 23 20 41 72 67 75 6d 65 6e dget.#.# Argumen
35650 74 73 3a 0a 23 0a 23 20 20 20 20 6e 6f 6e 65 0a ts:.#.# none.
35660 23 0a 23 20 52 65 73 75 6c 74 73 3a 0a 23 0a 23 #.# Results:.#.#
35670 20 20 20 20 20 41 6c 6c 20 73 74 61 74 65 20 76 All state v
35680 61 72 69 61 62 6c 65 73 20 61 72 65 20 73 65 74 ariables are set
35690 20 74 6f 20 74 68 65 69 72 20 64 65 66 61 75 6c to their defaul
356a0 74 20 76 61 6c 75 65 73 3b 20 61 6c 6c 20 6f 66 t values; all of
356b0 0a 23 20 20 20 20 20 74 68 65 20 6f 70 74 69 6f .# the optio
356c0 6e 20 64 61 74 61 62 61 73 65 20 65 6e 74 72 69 n database entri
356d0 65 73 20 77 69 6c 6c 20 65 78 69 73 74 2e 0a 23 es will exist..#
356e0 0a 23 20 52 65 74 75 72 6e 73 3a 0a 23 0a 23 20 .# Returns:.#.#
356f0 20 20 20 20 65 6d 70 74 79 20 73 74 72 69 6e 67 empty string
35700 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 6f 62 6f ..proc ::combobo
35710 78 3a 3a 49 6e 69 74 20 7b 7d 20 7b 0a 20 20 20 x::Init {} {.
35720 20 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 74 variable widget
35730 4f 70 74 69 6f 6e 73 0a 20 20 20 20 76 61 72 69 Options. vari
35740 61 62 6c 65 20 77 69 64 67 65 74 43 6f 6d 6d 61 able widgetComma
35750 6e 64 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 nds. variable
35760 20 73 63 61 6e 43 6f 6d 6d 61 6e 64 73 0a 20 20 scanCommands.
35770 20 20 76 61 72 69 61 62 6c 65 20 6c 69 73 74 43 variable listC
35780 6f 6d 6d 61 6e 64 73 0a 20 20 20 20 76 61 72 69 ommands. vari
35790 61 62 6c 65 20 64 65 66 61 75 6c 74 45 6e 74 72 able defaultEntr
357a0 79 43 75 72 73 6f 72 0a 0a 20 20 20 20 61 72 72 yCursor.. arr
357b0 61 79 20 73 65 74 20 77 69 64 67 65 74 4f 70 74 ay set widgetOpt
357c0 69 6f 6e 73 20 5b 6c 69 73 74 20 2d 62 61 63 6b ions [list -back
357d0 67 72 6f 75 6e 64 20 5c 0a 20 20 20 20 20 20 7b ground \. {
357e0 62 61 63 6b 67 72 6f 75 6e 64 20 20 20 20 20 20 background
357f0 20 20 20 20 42 61 63 6b 67 72 6f 75 6e 64 7d 20 Background}
35800 2d 62 64 20 2d 62 6f 72 64 65 72 77 69 64 74 68 -bd -borderwidth
35810 20 2d 62 67 20 2d 62 61 63 6b 67 72 6f 75 6e 64 -bg -background
35820 20 5c 0a 20 20 20 20 20 20 2d 62 6f 72 64 65 72 \. -border
35830 77 69 64 74 68 20 7b 62 6f 72 64 65 72 57 69 64 width {borderWid
35840 74 68 20 20 20 20 20 20 20 20 20 42 6f 72 64 65 th Borde
35850 72 57 69 64 74 68 7d 20 2d 63 6f 6d 6d 61 6e 64 rWidth} -command
35860 20 5c 0a 20 20 20 20 20 20 7b 63 6f 6d 6d 61 6e \. {comman
35870 64 20 43 6f 6d 6d 61 6e 64 7d 20 2d 63 6f 6d 6d d Command} -comm
35880 61 6e 64 73 74 61 74 65 20 7b 63 6f 6d 6d 61 6e andstate {comman
35890 64 53 74 61 74 65 20 20 20 20 20 20 20 20 53 74 dState St
358a0 61 74 65 7d 20 5c 0a 20 20 20 20 20 20 2d 63 75 ate} \. -cu
358b0 72 73 6f 72 20 7b 63 75 72 73 6f 72 20 20 20 20 rsor {cursor
358c0 20 20 20 20 20 20 20 20 20 20 43 75 72 73 6f 72 Cursor
358d0 7d 20 5c 0a 20 20 20 20 20 20 2d 64 69 73 61 62 } \. -disab
358e0 6c 65 64 62 61 63 6b 67 72 6f 75 6e 64 20 7b 64 ledbackground {d
358f0 69 73 61 62 6c 65 64 42 61 63 6b 67 72 6f 75 6e isabledBackgroun
35900 64 20 20 44 69 73 61 62 6c 65 64 42 61 63 6b 67 d DisabledBackg
35910 72 6f 75 6e 64 7d 20 5c 0a 20 20 20 20 20 20 2d round} \. -
35920 64 69 73 61 62 6c 65 64 66 6f 72 65 67 72 6f 75 disabledforegrou
35930 6e 64 20 7b 64 69 73 61 62 6c 65 64 46 6f 72 65 nd {disabledFore
35940 67 72 6f 75 6e 64 20 20 44 69 73 61 62 6c 65 64 ground Disabled
35950 46 6f 72 65 67 72 6f 75 6e 64 7d 20 5c 0a 20 20 Foreground} \.
35960 20 20 20 20 2d 64 72 6f 70 64 6f 77 6e 77 69 64 -dropdownwid
35970 74 68 20 7b 64 72 6f 70 64 6f 77 6e 57 69 64 74 th {dropdownWidt
35980 68 20 20 20 20 20 20 20 44 72 6f 70 64 6f 77 6e h Dropdown
35990 57 69 64 74 68 7d 20 2d 65 64 69 74 61 62 6c 65 Width} -editable
359a0 20 5c 0a 20 20 20 20 20 20 7b 65 64 69 74 61 62 \. {editab
359b0 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 45 64 le Ed
359c0 69 74 61 62 6c 65 7d 20 2d 66 67 20 2d 66 6f 72 itable} -fg -for
359d0 65 67 72 6f 75 6e 64 20 2d 66 6f 6e 74 20 5c 0a eground -font \.
359e0 20 20 20 20 20 20 7b 66 6f 6e 74 20 20 20 20 20 {font
359f0 20 20 20 20 20 20 20 20 20 20 20 46 6f 6e 74 7d Font}
35a00 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 7b 66 6f -foreground {fo
35a10 72 65 67 72 6f 75 6e 64 20 20 20 20 20 20 20 20 reground
35a20 20 20 46 6f 72 65 67 72 6f 75 6e 64 7d 20 5c 0a Foreground} \.
35a30 20 20 20 20 20 20 2d 68 65 69 67 68 74 20 7b 68 -height {h
35a40 65 69 67 68 74 20 20 20 20 20 20 20 20 20 20 20 eight
35a50 20 20 20 48 65 69 67 68 74 7d 20 5c 0a 20 20 20 Height} \.
35a60 20 20 20 2d 68 69 67 68 6c 69 67 68 74 62 61 63 -highlightbac
35a70 6b 67 72 6f 75 6e 64 20 7b 68 69 67 68 6c 69 67 kground {highlig
35a80 68 74 42 61 63 6b 67 72 6f 75 6e 64 20 48 69 67 htBackground Hig
35a90 68 6c 69 67 68 74 42 61 63 6b 67 72 6f 75 6e 64 hlightBackground
35aa0 7d 20 5c 0a 20 20 20 20 20 20 2d 68 69 67 68 6c } \. -highl
35ab0 69 67 68 74 63 6f 6c 6f 72 20 7b 68 69 67 68 6c ightcolor {highl
35ac0 69 67 68 74 43 6f 6c 6f 72 20 20 20 20 20 20 48 ightColor H
35ad0 69 67 68 6c 69 67 68 74 43 6f 6c 6f 72 7d 20 5c ighlightColor} \
35ae0 0a 20 20 20 20 20 20 2d 68 69 67 68 6c 69 67 68 . -highligh
35af0 74 74 68 69 63 6b 6e 65 73 73 20 7b 68 69 67 68 tthickness {high
35b00 6c 69 67 68 74 54 68 69 63 6b 6e 65 73 73 20 20 lightThickness
35b10 48 69 67 68 6c 69 67 68 74 54 68 69 63 6b 6e 65 HighlightThickne
35b20 73 73 7d 20 5c 0a 20 20 20 20 20 20 2d 69 6d 61 ss} \. -ima
35b30 67 65 20 7b 69 6d 61 67 65 20 20 20 20 20 20 20 ge {image
35b40 20 20 20 20 20 20 20 20 49 6d 61 67 65 7d 20 2d Image} -
35b50 6d 61 78 68 65 69 67 68 74 20 5c 0a 20 20 20 20 maxheight \.
35b60 20 20 7b 6d 61 78 48 65 69 67 68 74 20 20 20 20 {maxHeight
35b70 20 20 20 20 20 20 20 48 65 69 67 68 74 7d 20 2d Height} -
35b80 6f 70 65 6e 63 6f 6d 6d 61 6e 64 20 7b 6f 70 65 opencommand {ope
35b90 6e 63 6f 6d 6d 61 6e 64 20 20 20 20 20 20 20 20 ncommand
35ba0 20 43 6f 6d 6d 61 6e 64 7d 20 5c 0a 20 20 20 20 Command} \.
35bb0 20 20 2d 72 65 6c 69 65 66 20 7b 72 65 6c 69 65 -relief {relie
35bc0 66 20 20 20 20 20 20 20 20 20 20 20 20 20 20 52 f R
35bd0 65 6c 69 65 66 7d 20 5c 0a 20 20 20 20 20 20 2d elief} \. -
35be0 73 65 6c 65 63 74 62 61 63 6b 67 72 6f 75 6e 64 selectbackground
35bf0 20 7b 73 65 6c 65 63 74 42 61 63 6b 67 72 6f 75 {selectBackgrou
35c00 6e 64 20 20 20 20 46 6f 72 65 67 72 6f 75 6e 64 nd Foreground
35c10 7d 20 5c 0a 20 20 20 20 20 20 2d 73 65 6c 65 63 } \. -selec
35c20 74 62 6f 72 64 65 72 77 69 64 74 68 20 7b 73 65 tborderwidth {se
35c30 6c 65 63 74 42 6f 72 64 65 72 57 69 64 74 68 20 lectBorderWidth
35c40 20 20 42 6f 72 64 65 72 57 69 64 74 68 7d 20 5c BorderWidth} \
35c50 0a 20 20 20 20 20 20 2d 73 65 6c 65 63 74 66 6f . -selectfo
35c60 72 65 67 72 6f 75 6e 64 20 7b 73 65 6c 65 63 74 reground {select
35c70 46 6f 72 65 67 72 6f 75 6e 64 20 20 20 20 42 61 Foreground Ba
35c80 63 6b 67 72 6f 75 6e 64 7d 20 2d 73 74 61 74 65 ckground} -state
35c90 20 5c 0a 20 20 20 20 20 20 7b 73 74 61 74 65 20 \. {state
35ca0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 74 St
35cb0 61 74 65 7d 20 2d 74 61 6b 65 66 6f 63 75 73 20 ate} -takefocus
35cc0 7b 74 61 6b 65 46 6f 63 75 73 20 20 20 20 20 20 {takeFocus
35cd0 20 20 20 20 20 54 61 6b 65 46 6f 63 75 73 7d 20 TakeFocus}
35ce0 5c 0a 20 20 20 20 20 20 2d 74 65 78 74 76 61 72 \. -textvar
35cf0 69 61 62 6c 65 20 7b 74 65 78 74 56 61 72 69 61 iable {textVaria
35d00 62 6c 65 20 20 20 20 20 20 20 20 56 61 72 69 61 ble Varia
35d10 62 6c 65 7d 20 2d 76 61 6c 75 65 20 5c 0a 20 20 ble} -value \.
35d20 20 20 20 20 7b 76 61 6c 75 65 20 20 20 20 20 20 {value
35d30 20 20 20 20 20 20 20 20 20 56 61 6c 75 65 7d 20 Value}
35d40 2d 77 69 64 74 68 20 7b 77 69 64 74 68 20 20 20 -width {width
35d50 20 20 20 20 20 20 20 20 20 20 20 20 57 69 64 74 Widt
35d60 68 7d 20 5c 0a 20 20 20 20 20 20 2d 78 73 63 72 h} \. -xscr
35d70 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 7b 78 53 63 72 ollcommand {xScr
35d80 6f 6c 6c 43 6f 6d 6d 61 6e 64 20 20 20 20 20 20 ollCommand
35d90 53 63 72 6f 6c 6c 43 6f 6d 6d 61 6e 64 7d 5d 0a ScrollCommand}].
35da0 0a 0a 20 20 20 20 73 65 74 20 77 69 64 67 65 74 .. set widget
35db0 43 6f 6d 6d 61 6e 64 73 20 5b 6c 69 73 74 20 62 Commands [list b
35dc0 62 6f 78 20 63 67 65 74 20 63 6f 6e 66 69 67 75 box cget configu
35dd0 72 65 20 63 75 72 73 65 6c 65 63 74 69 6f 6e 20 re curselection
35de0 64 65 6c 65 74 65 20 67 65 74 20 5c 0a 20 20 20 delete get \.
35df0 20 20 20 69 63 75 72 73 6f 72 20 69 6e 64 65 78 icursor index
35e00 20 69 6e 73 65 72 74 20 6c 69 73 74 20 73 63 61 insert list sca
35e10 6e 20 73 65 6c 65 63 74 69 6f 6e 20 78 76 69 65 n selection xvie
35e20 77 20 73 65 6c 65 63 74 20 74 6f 67 67 6c 65 20 w select toggle
35e30 6f 70 65 6e 20 63 6c 6f 73 65 5d 0a 0a 20 20 20 open close]..
35e40 20 73 65 74 20 6c 69 73 74 43 6f 6d 6d 61 6e 64 set listCommand
35e50 73 20 5b 6c 69 73 74 20 64 65 6c 65 74 65 20 67 s [list delete g
35e60 65 74 20 69 6e 64 65 78 20 69 6e 73 65 72 74 20 et index insert
35e70 73 69 7a 65 5d 0a 0a 20 20 20 20 73 65 74 20 73 size].. set s
35e80 63 61 6e 43 6f 6d 6d 61 6e 64 73 20 5b 6c 69 73 canCommands [lis
35e90 74 20 6d 61 72 6b 20 64 72 61 67 74 6f 5d 0a 0a t mark dragto]..
35ea0 20 20 20 20 23 20 77 68 79 20 63 68 65 63 6b 20 # why check
35eb0 66 6f 72 20 74 68 65 20 54 6b 20 70 61 63 6b 61 for the Tk packa
35ec0 67 65 3f 20 54 68 69 73 20 6c 65 74 73 20 75 73 ge? This lets us
35ed0 20 62 65 20 73 6f 75 72 63 65 64 20 69 6e 74 6f be sourced into
35ee0 0a 20 20 20 20 23 20 61 6e 20 69 6e 74 65 72 70 . # an interp
35ef0 72 65 74 65 72 20 74 68 61 74 20 64 6f 65 73 6e reter that doesn
35f00 27 74 20 68 61 76 65 20 54 6b 20 6c 6f 61 64 65 't have Tk loade
35f10 64 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 73 d, such as the s
35f20 6c 61 76 65 0a 20 20 20 20 23 20 69 6e 74 65 72 lave. # inter
35f30 70 72 65 74 65 72 20 75 73 65 64 20 62 79 20 70 preter used by p
35f40 6b 67 5f 6d 6b 49 6e 64 65 78 2e 20 49 6e 20 74 kg_mkIndex. In t
35f50 68 65 6f 72 79 20 69 74 20 73 68 6f 75 6c 64 20 heory it should
35f60 68 61 76 65 20 6e 6f 0a 20 20 20 20 23 20 73 69 have no. # si
35f70 64 65 20 65 66 66 65 63 74 73 20 77 68 65 6e 20 de effects when
35f80 72 75 6e 0a 20 20 20 20 69 66 20 7b 5b 6c 73 65 run. if {[lse
35f90 61 72 63 68 20 2d 65 78 61 63 74 20 5b 70 61 63 arch -exact [pac
35fa0 6b 61 67 65 20 6e 61 6d 65 73 5d 20 22 54 6b 22 kage names] "Tk"
35fb0 5d 20 21 3d 20 2d 31 7d 20 7b 0a 0a 09 23 23 23 ] != -1} {...###
35fc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
35fd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
35fe0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
35ff0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
36000 09 23 2d 20 74 68 69 73 20 69 6e 69 74 69 61 6c .#- this initial
36010 69 7a 65 73 20 74 68 65 20 6f 70 74 69 6f 6e 20 izes the option
36020 64 61 74 61 62 61 73 65 2e 20 4b 69 6e 64 61 20 database. Kinda
36030 67 72 6f 73 73 2c 20 62 75 74 20 69 74 20 77 6f gross, but it wo
36040 72 6b 73 0a 09 23 2d 20 28 49 20 74 68 69 6e 6b rks..#- (I think
36050 29 2e 0a 09 23 23 23 23 23 23 23 23 23 23 23 23 )...############
36060 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36070 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36080 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
36090 23 23 23 23 23 23 0a 0a 09 23 20 74 68 65 20 69 ######...# the i
360a0 6d 61 67 65 20 75 73 65 64 20 66 6f 72 20 74 68 mage used for th
360b0 65 20 62 75 74 74 6f 6e 2e 2e 2e 0a 09 69 66 20 e button.....if
360c0 7b 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d {$::tcl_platform
360d0 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 77 (platform) == "w
360e0 69 6e 64 6f 77 73 22 7d 20 7b 0a 09 20 20 20 20 indows"} {..
360f0 69 6d 61 67 65 20 63 72 65 61 74 65 20 62 69 74 image create bit
36100 6d 61 70 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a map ::combobox::
36110 62 69 6d 61 67 65 20 2d 64 61 74 61 20 7b 0a 09 bimage -data {..
36120 09 23 64 65 66 69 6e 65 20 64 6f 77 6e 5f 61 72 .#define down_ar
36130 72 6f 77 5f 77 69 64 74 68 20 31 32 0a 09 09 23 row_width 12...#
36140 64 65 66 69 6e 65 20 64 6f 77 6e 5f 61 72 72 6f define down_arro
36150 77 5f 68 65 69 67 68 74 20 31 32 0a 09 09 73 74 w_height 12...st
36160 61 74 69 63 20 63 68 61 72 20 64 6f 77 6e 5f 61 atic char down_a
36170 72 72 6f 77 5f 62 69 74 73 5b 5d 20 3d 20 7b 0a rrow_bits[] = {.
36180 09 09 20 20 20 20 30 78 30 30 2c 30 78 30 30 2c .. 0x00,0x00,
36190 30 78 30 30 2c 30 78 30 30 2c 30 78 30 30 2c 30 0x00,0x00,0x00,0
361a0 78 30 30 2c 30 78 30 30 2c 30 78 30 30 2c 0a 09 x00,0x00,0x00,..
361b0 09 20 20 20 20 30 78 66 63 2c 30 78 66 31 2c 30 . 0xfc,0xf1,0
361c0 78 66 38 2c 30 78 66 30 2c 30 78 37 30 2c 30 78 xf8,0xf0,0x70,0x
361d0 66 30 2c 30 78 32 30 2c 30 78 66 30 2c 0a 09 09 f0,0x20,0xf0,...
361e0 20 20 20 20 30 78 30 30 2c 30 78 30 30 2c 30 78 0x00,0x00,0x
361f0 30 30 2c 30 78 30 30 2c 30 78 30 30 2c 30 78 30 00,0x00,0x00,0x0
36200 30 2c 30 78 30 30 2c 30 78 30 30 3b 0a 09 09 7d 0,0x00,0x00;...}
36210 0a 09 20 20 20 20 7d 0a 09 7d 20 65 6c 73 65 20 .. }..} else
36220 7b 0a 09 20 20 20 20 69 6d 61 67 65 20 63 72 65 {.. image cre
36230 61 74 65 20 62 69 74 6d 61 70 20 3a 3a 63 6f 6d ate bitmap ::com
36240 62 6f 62 6f 78 3a 3a 62 69 6d 61 67 65 20 2d 64 bobox::bimage -d
36250 61 74 61 20 7b 0a 09 09 23 64 65 66 69 6e 65 20 ata {...#define
36260 64 6f 77 6e 5f 61 72 72 6f 77 5f 77 69 64 74 68 down_arrow_width
36270 20 31 35 0a 09 09 23 64 65 66 69 6e 65 20 64 6f 15...#define do
36280 77 6e 5f 61 72 72 6f 77 5f 68 65 69 67 68 74 20 wn_arrow_height
36290 31 35 0a 09 09 73 74 61 74 69 63 20 63 68 61 72 15...static char
362a0 20 64 6f 77 6e 5f 61 72 72 6f 77 5f 62 69 74 73 down_arrow_bits
362b0 5b 5d 20 3d 20 7b 0a 09 09 20 20 20 20 30 78 30 [] = {... 0x0
362c0 30 2c 30 78 38 30 2c 30 78 30 30 2c 30 78 38 30 0,0x80,0x00,0x80
362d0 2c 30 78 30 30 2c 30 78 38 30 2c 30 78 30 30 2c ,0x00,0x80,0x00,
362e0 30 78 38 30 2c 0a 09 09 20 20 20 20 30 78 30 30 0x80,... 0x00
362f0 2c 30 78 38 30 2c 30 78 66 38 2c 30 78 38 66 2c ,0x80,0xf8,0x8f,
36300 30 78 66 30 2c 30 78 38 37 2c 30 78 65 30 2c 30 0xf0,0x87,0xe0,0
36310 78 38 33 2c 0a 09 09 20 20 20 20 30 78 63 30 2c x83,... 0xc0,
36320 30 78 38 31 2c 30 78 38 30 2c 30 78 38 30 2c 30 0x81,0x80,0x80,0
36330 78 30 30 2c 30 78 38 30 2c 30 78 30 30 2c 30 78 x00,0x80,0x00,0x
36340 38 30 2c 0a 09 09 20 20 20 20 30 78 30 30 2c 30 80,... 0x00,0
36350 78 38 30 2c 30 78 30 30 2c 30 78 38 30 2c 30 78 x80,0x00,0x80,0x
36360 30 30 2c 30 78 38 30 0a 09 09 7d 0a 09 20 20 20 00,0x80...}..
36370 20 7d 0a 09 7d 0a 0a 09 23 20 63 6f 6d 70 75 74 }..}...# comput
36380 65 20 61 20 77 69 64 67 65 74 20 6e 61 6d 65 20 e a widget name
36390 77 65 20 63 61 6e 20 75 73 65 20 74 6f 20 63 72 we can use to cr
363a0 65 61 74 65 20 61 20 74 65 6d 70 6f 72 61 72 79 eate a temporary
363b0 20 77 69 64 67 65 74 0a 09 73 65 74 20 74 6d 70 widget..set tmp
363c0 57 69 64 67 65 74 20 22 2e 5f 5f 74 6d 70 5f 5f Widget ".__tmp__
363d0 22 0a 09 73 65 74 20 63 6f 75 6e 74 20 30 0a 09 "..set count 0..
363e0 77 68 69 6c 65 20 7b 5b 77 69 6e 66 6f 20 65 78 while {[winfo ex
363f0 69 73 74 73 20 24 74 6d 70 57 69 64 67 65 74 5d ists $tmpWidget]
36400 20 3d 3d 20 31 7d 20 7b 0a 09 20 20 20 20 73 65 == 1} {.. se
36410 74 20 74 6d 70 57 69 64 67 65 74 20 22 2e 5f 5f t tmpWidget ".__
36420 74 6d 70 5f 5f 24 63 6f 75 6e 74 22 0a 09 20 20 tmp__$count"..
36430 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 09 7d 0a incr count..}.
36440 0a 09 23 20 67 65 74 20 74 68 65 20 73 63 72 6f ..# get the scro
36450 6c 6c 62 61 72 20 77 69 64 74 68 2e 20 42 65 63 llbar width. Bec
36460 61 75 73 65 20 77 65 20 74 72 79 20 74 6f 20 62 ause we try to b
36470 65 20 63 6c 65 76 65 72 20 61 6e 64 20 64 72 61 e clever and dra
36480 77 20 6f 75 72 0a 09 23 20 6f 77 6e 20 62 75 74 w our..# own but
36490 74 6f 6e 20 69 6e 73 74 65 61 64 20 6f 66 20 75 ton instead of u
364a0 73 69 6e 67 20 61 20 74 6b 20 77 69 64 67 65 74 sing a tk widget
364b0 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 6b 6e 6f , we need to kno
364c0 77 20 77 68 61 74 20 73 69 7a 65 0a 09 23 20 62 w what size..# b
364d0 75 74 74 6f 6e 20 74 6f 20 63 72 65 61 74 65 2e utton to create.
364e0 20 54 68 69 73 20 6c 69 74 74 6c 65 20 68 61 63 This little hac
364f0 6b 20 74 65 6c 6c 73 20 75 73 20 74 68 65 20 77 k tells us the w
36500 69 64 74 68 20 6f 66 20 61 20 73 63 72 6f 6c 6c idth of a scroll
36510 0a 09 23 20 62 61 72 2e 0a 09 23 0a 09 23 20 4e ..# bar...#..# N
36520 42 3a 20 77 65 20 6e 65 65 64 20 74 6f 20 62 65 B: we need to be
36530 20 73 75 72 65 20 61 6e 64 20 70 69 63 6b 20 61 sure and pick a
36540 20 77 69 6e 64 6f 77 20 20 74 68 61 74 20 64 6f window that do
36550 65 73 6e 27 74 20 61 6c 72 65 61 64 79 0a 09 23 esn't already..#
36560 20 65 78 69 73 74 2e 2e 2e 0a 09 73 63 72 6f 6c exist.....scrol
36570 6c 62 61 72 20 24 74 6d 70 57 69 64 67 65 74 0a lbar $tmpWidget.
36580 09 73 65 74 20 73 62 5f 77 69 64 74 68 20 5b 77 .set sb_width [w
36590 69 6e 66 6f 20 72 65 71 77 69 64 74 68 20 24 74 info reqwidth $t
365a0 6d 70 57 69 64 67 65 74 5d 0a 09 64 65 73 74 72 mpWidget]..destr
365b0 6f 79 20 24 74 6d 70 57 69 64 67 65 74 0a 0a 09 oy $tmpWidget...
365c0 23 20 73 74 65 61 6c 20 6f 70 74 69 6f 6e 73 20 # steal options
365d0 66 72 6f 6d 20 74 68 65 20 65 6e 74 72 79 20 77 from the entry w
365e0 69 64 67 65 74 0a 09 23 20 77 65 20 77 61 6e 74 idget..# we want
365f0 20 64 61 72 6e 20 6e 65 61 72 20 61 6c 6c 20 6f darn near all o
36600 70 74 69 6f 6e 73 2c 20 73 6f 20 77 65 27 6c 6c ptions, so we'll
36610 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 64 6f go ahead and do
36620 0a 09 23 20 74 68 65 6d 20 61 6c 6c 2e 20 4e 6f ..# them all. No
36630 20 68 61 72 6d 20 64 6f 6e 65 20 69 6e 20 61 64 harm done in ad
36640 64 69 6e 67 20 74 68 65 20 6f 6e 65 20 6f 72 20 ding the one or
36650 74 77 6f 20 74 68 61 74 20 77 65 0a 09 23 20 64 two that we..# d
36660 6f 6e 27 74 20 75 73 65 2e 0a 09 65 6e 74 72 79 on't use...entry
36670 20 24 74 6d 70 57 69 64 67 65 74 0a 09 66 6f 72 $tmpWidget..for
36680 65 61 63 68 20 66 6f 6f 20 5b 24 74 6d 70 57 69 each foo [$tmpWi
36690 64 67 65 74 20 63 6f 6e 66 69 67 75 72 65 5d 20 dget configure]
366a0 7b 0a 09 20 20 20 20 23 20 74 68 65 20 63 75 72 {.. # the cur
366b0 73 6f 72 20 6f 70 74 69 6f 6e 20 69 73 20 73 70 sor option is sp
366c0 65 63 69 61 6c 2c 20 73 6f 20 77 65 27 6c 6c 20 ecial, so we'll
366d0 73 61 76 65 20 69 74 20 69 6e 0a 09 20 20 20 20 save it in..
366e0 23 20 61 20 73 70 65 63 69 61 6c 20 77 61 79 0a # a special way.
366f0 09 20 20 20 20 69 66 20 7b 5b 6c 69 6e 64 65 78 . if {[lindex
36700 20 24 66 6f 6f 20 30 5d 20 3d 3d 20 22 2d 63 75 $foo 0] == "-cu
36710 72 73 6f 72 22 7d 20 7b 0a 09 09 73 65 74 20 64 rsor"} {...set d
36720 65 66 61 75 6c 74 45 6e 74 72 79 43 75 72 73 6f efaultEntryCurso
36730 72 20 5b 6c 69 6e 64 65 78 20 24 66 6f 6f 20 34 r [lindex $foo 4
36740 5d 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 69 66 ].. }.. if
36750 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 6f 6f 5d {[llength $foo]
36760 20 3d 3d 20 35 7d 20 7b 0a 09 09 73 65 74 20 6f == 5} {...set o
36770 70 74 69 6f 6e 20 5b 6c 69 6e 64 65 78 20 24 66 ption [lindex $f
36780 6f 6f 20 31 5d 0a 09 09 73 65 74 20 76 61 6c 75 oo 1]...set valu
36790 65 20 5b 6c 69 6e 64 65 78 20 24 66 6f 6f 20 34 e [lindex $foo 4
367a0 5d 0a 09 09 6f 70 74 69 6f 6e 20 61 64 64 20 2a ]...option add *
367b0 43 6f 6d 62 6f 62 6f 78 2e 24 6f 70 74 69 6f 6e Combobox.$option
367c0 20 24 76 61 6c 75 65 20 77 69 64 67 65 74 44 65 $value widgetDe
367d0 66 61 75 6c 74 0a 0a 09 09 23 20 74 68 65 73 65 fault....# these
367e0 20 6f 70 74 69 6f 6e 73 20 61 6c 73 6f 20 61 70 options also ap
367f0 70 6c 79 20 74 6f 20 74 68 65 20 64 72 6f 70 64 ply to the dropd
36800 6f 77 6e 20 6c 69 73 74 62 6f 78 0a 09 09 69 66 own listbox...if
36810 20 7b 5b 73 74 72 69 6e 67 20 63 6f 6d 70 61 72 {[string compar
36820 65 20 24 6f 70 74 69 6f 6e 20 22 66 6f 72 65 67 e $option "foreg
36830 72 6f 75 6e 64 22 5d 20 3d 3d 20 30 20 7c 7c 20 round"] == 0 ||
36840 5c 0a 09 09 20 20 5b 73 74 72 69 6e 67 20 63 6f \... [string co
36850 6d 70 61 72 65 20 24 6f 70 74 69 6f 6e 20 22 62 mpare $option "b
36860 61 63 6b 67 72 6f 75 6e 64 22 5d 20 3d 3d 20 30 ackground"] == 0
36870 20 7c 7c 20 5c 0a 09 09 20 20 5b 73 74 72 69 6e || \... [strin
36880 67 20 63 6f 6d 70 61 72 65 20 24 6f 70 74 69 6f g compare $optio
36890 6e 20 22 66 6f 6e 74 22 5d 20 3d 3d 20 30 7d 20 n "font"] == 0}
368a0 7b 0a 09 09 20 20 20 20 6f 70 74 69 6f 6e 20 61 {... option a
368b0 64 64 20 2a 43 6f 6d 62 6f 62 6f 78 2a 43 6f 6d dd *Combobox*Com
368c0 62 6f 62 6f 78 4c 69 73 74 62 6f 78 2e 24 6f 70 boboxListbox.$op
368d0 74 69 6f 6e 20 24 76 61 6c 75 65 20 5c 0a 09 09 tion $value \...
368e0 20 20 20 20 20 20 77 69 64 67 65 74 44 65 66 61 widgetDefa
368f0 75 6c 74 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 ult...}.. }..
36900 7d 0a 09 64 65 73 74 72 6f 79 20 24 74 6d 70 57 }..destroy $tmpW
36910 69 64 67 65 74 0a 0a 09 23 20 74 68 65 73 65 20 idget...# these
36920 61 72 65 20 75 6e 69 71 75 65 20 74 6f 20 75 73 are unique to us
36930 2e 2e 2e 0a 09 6f 70 74 69 6f 6e 20 61 64 64 20 .....option add
36940 2a 43 6f 6d 62 6f 62 6f 78 2e 64 72 6f 70 64 6f *Combobox.dropdo
36950 77 6e 57 69 64 74 68 20 7b 7d 20 77 69 64 67 65 wnWidth {} widge
36960 74 44 65 66 61 75 6c 74 0a 09 6f 70 74 69 6f 6e tDefault..option
36970 20 61 64 64 20 2a 43 6f 6d 62 6f 62 6f 78 2e 6f add *Combobox.o
36980 70 65 6e 43 6f 6d 6d 61 6e 64 20 7b 7d 20 77 69 penCommand {} wi
36990 64 67 65 74 44 65 66 61 75 6c 74 0a 09 6f 70 74 dgetDefault..opt
369a0 69 6f 6e 20 61 64 64 20 2a 43 6f 6d 62 6f 62 6f ion add *Combobo
369b0 78 2e 63 75 72 73 6f 72 20 7b 7d 20 77 69 64 67 x.cursor {} widg
369c0 65 74 44 65 66 61 75 6c 74 0a 09 6f 70 74 69 6f etDefault..optio
369d0 6e 20 61 64 64 20 2a 43 6f 6d 62 6f 62 6f 78 2e n add *Combobox.
369e0 63 6f 6d 6d 61 6e 64 53 74 61 74 65 20 6e 6f 72 commandState nor
369f0 6d 61 6c 20 77 69 64 67 65 74 44 65 66 61 75 6c mal widgetDefaul
36a00 74 0a 09 6f 70 74 69 6f 6e 20 61 64 64 20 2a 43 t..option add *C
36a10 6f 6d 62 6f 62 6f 78 2e 65 64 69 74 61 62 6c 65 ombobox.editable
36a20 20 31 20 77 69 64 67 65 74 44 65 66 61 75 6c 74 1 widgetDefault
36a30 0a 09 6f 70 74 69 6f 6e 20 61 64 64 20 2a 43 6f ..option add *Co
36a40 6d 62 6f 62 6f 78 2e 6d 61 78 48 65 69 67 68 74 mbobox.maxHeight
36a50 20 31 30 20 77 69 64 67 65 74 44 65 66 61 75 6c 10 widgetDefaul
36a60 74 0a 09 6f 70 74 69 6f 6e 20 61 64 64 20 2a 43 t..option add *C
36a70 6f 6d 62 6f 62 6f 78 2e 68 65 69 67 68 74 20 30 ombobox.height 0
36a80 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 73 65 . }.. # se
36a90 74 20 63 6c 61 73 73 20 62 69 6e 64 69 6e 67 73 t class bindings
36aa0 0a 20 20 20 20 53 65 74 43 6c 61 73 73 42 69 6e . SetClassBin
36ab0 64 69 6e 67 73 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d dings.}..# ::com
36ac0 62 6f 62 6f 78 3a 3a 53 65 74 43 6c 61 73 73 42 bobox::SetClassB
36ad0 69 6e 64 69 6e 67 73 20 2d 2d 0a 23 0a 23 20 20 indings --.#.#
36ae0 20 20 53 65 74 73 20 75 70 20 74 68 65 20 64 65 Sets up the de
36af0 66 61 75 6c 74 20 62 69 6e 64 69 6e 67 73 20 66 fault bindings f
36b00 6f 72 20 74 68 65 20 77 69 64 67 65 74 20 63 6c or the widget cl
36b10 61 73 73 0a 23 0a 23 20 20 20 20 74 68 69 73 20 ass.#.# this
36b20 70 72 6f 63 20 65 78 69 73 74 73 20 73 69 6e 63 proc exists sinc
36b30 65 20 69 74 27 73 20 54 68 65 20 52 69 67 68 74 e it's The Right
36b40 20 54 68 69 6e 67 20 54 6f 20 44 6f 2c 20 62 75 Thing To Do, bu
36b50 74 0a 23 20 20 20 20 49 20 68 61 76 65 6e 27 74 t.# I haven't
36b60 20 68 61 64 20 74 68 65 20 74 69 6d 65 20 74 6f had the time to
36b70 20 66 69 67 75 72 65 20 6f 75 74 20 68 6f 77 20 figure out how
36b80 74 6f 20 64 6f 20 61 6c 6c 20 74 68 65 0a 23 20 to do all the.#
36b90 20 20 20 62 69 6e 64 69 6e 67 20 73 74 75 66 66 binding stuff
36ba0 20 6f 6e 20 61 20 63 6c 61 73 73 20 6c 65 76 65 on a class leve
36bb0 6c 2e 20 54 68 65 20 6d 61 69 6e 20 70 72 6f 62 l. The main prob
36bc0 6c 65 6d 20 69 73 20 74 68 61 74 0a 23 20 20 20 lem is that.#
36bd0 20 74 68 65 20 65 6e 74 72 79 20 77 69 64 67 65 the entry widge
36be0 74 20 6d 75 73 74 20 68 61 76 65 20 66 6f 63 75 t must have focu
36bf0 73 20 66 6f 72 20 74 68 65 20 69 6e 73 65 72 74 s for the insert
36c00 69 6f 6e 20 63 75 72 73 6f 72 0a 23 20 20 20 20 ion cursor.#
36c10 74 6f 20 62 65 20 76 69 73 69 62 6c 65 2e 20 53 to be visible. S
36c20 6f 2c 20 49 20 65 69 74 68 65 72 20 68 61 76 65 o, I either have
36c30 20 74 6f 20 68 61 76 65 20 74 68 65 20 65 6e 74 to have the ent
36c40 72 79 20 77 69 64 67 65 74 0a 23 20 20 20 20 68 ry widget.# h
36c50 61 76 65 20 74 68 65 20 43 6f 6d 62 6f 62 6f 78 ave the Combobox
36c60 20 62 69 6e 64 74 61 67 2c 20 6f 72 20 64 6f 20 bindtag, or do
36c70 73 6f 6d 65 20 66 61 6e 63 79 20 6a 75 67 67 6c some fancy juggl
36c80 69 6e 67 20 6f 66 0a 23 20 20 20 20 65 76 65 6e ing of.# even
36c90 74 73 20 6f 72 20 73 6f 6d 65 20 73 75 63 68 2e ts or some such.
36ca0 20 57 68 61 74 20 61 20 70 61 69 6e 2e 0a 23 0a What a pain..#.
36cb0 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 # Arguments:.#.#
36cc0 20 20 20 20 6e 6f 6e 65 0a 23 0a 23 20 52 65 74 none.#.# Ret
36cd0 75 72 6e 73 3a 0a 23 0a 23 20 20 20 20 65 6d 70 urns:.#.# emp
36ce0 74 79 20 73 74 72 69 6e 67 0a 0a 70 72 6f 63 20 ty string..proc
36cf0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 74 43 ::combobox::SetC
36d00 6c 61 73 73 42 69 6e 64 69 6e 67 73 20 7b 7d 20 lassBindings {}
36d10 7b 0a 0a 20 20 20 20 23 20 6d 61 6b 65 20 73 75 {.. # make su
36d20 72 65 20 77 65 20 63 6c 65 61 6e 20 75 70 20 61 re we clean up a
36d30 66 74 65 72 20 6f 75 72 73 65 6c 76 65 73 2e 2e fter ourselves..
36d40 2e 0a 20 20 20 20 62 69 6e 64 20 43 6f 6d 62 6f .. bind Combo
36d50 62 6f 78 20 3c 44 65 73 74 72 6f 79 3e 20 5b 6c box <Destroy> [l
36d60 69 73 74 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a ist ::combobox::
36d70 44 65 73 74 72 6f 79 48 61 6e 64 6c 65 72 20 25 DestroyHandler %
36d80 57 5d 0a 0a 20 20 20 20 23 20 74 68 69 73 20 77 W].. # this w
36d90 69 6c 6c 20 28 68 6f 70 65 66 75 6c 6c 79 29 20 ill (hopefully)
36da0 63 6c 6f 73 65 20 28 61 6e 64 20 6c 6f 73 65 20 close (and lose
36db0 74 68 65 20 67 72 61 62 20 6f 6e 29 20 74 68 65 the grab on) the
36dc0 0a 20 20 20 20 23 20 6c 69 73 74 62 6f 78 20 69 . # listbox i
36dd0 66 20 74 68 65 20 75 73 65 72 20 63 6c 69 63 6b f the user click
36de0 73 20 61 6e 79 77 68 65 72 65 20 6f 75 74 73 69 s anywhere outsi
36df0 64 65 20 6f 66 20 69 74 2e 20 4e 6f 74 65 0a 20 de of it. Note.
36e00 20 20 20 23 20 74 68 61 74 20 6f 6e 20 57 69 6e # that on Win
36e10 64 6f 77 73 2c 20 79 6f 75 20 63 61 6e 20 63 6c dows, you can cl
36e20 69 63 6b 20 6f 6e 20 73 6f 6d 65 20 6f 74 68 65 ick on some othe
36e30 72 20 61 70 70 20 61 6e 64 0a 20 20 20 20 23 20 r app and. #
36e40 74 68 65 20 6c 69 73 74 62 6f 78 20 77 69 6c 6c the listbox will
36e50 20 73 74 69 6c 6c 20 62 65 20 74 68 65 72 65 2c still be there,
36e60 20 62 65 63 61 75 73 65 20 74 63 6c 20 77 6f 6e because tcl won
36e70 27 74 20 73 65 65 0a 20 20 20 20 23 20 74 68 61 't see. # tha
36e80 74 20 62 75 74 74 6f 6e 20 63 6c 69 63 6b 0a 20 t button click.
36e90 20 20 20 73 65 74 20 74 68 69 73 20 7b 5b 3a 3a set this {[::
36ea0 63 6f 6d 62 6f 62 6f 78 3a 3a 63 6f 6e 76 65 72 combobox::conver
36eb0 74 20 25 57 20 2d 57 5d 7d 0a 20 20 20 20 62 69 t %W -W]}. bi
36ec0 6e 64 20 43 6f 6d 62 6f 62 6f 78 20 3c 41 6e 79 nd Combobox <Any
36ed0 2d 42 75 74 74 6f 6e 50 72 65 73 73 3e 20 22 24 -ButtonPress> "$
36ee0 74 68 69 73 20 63 6c 6f 73 65 22 0a 20 20 20 20 this close".
36ef0 62 69 6e 64 20 43 6f 6d 62 6f 62 6f 78 20 3c 41 bind Combobox <A
36f00 6e 79 2d 42 75 74 74 6f 6e 52 65 6c 65 61 73 65 ny-ButtonRelease
36f10 3e 20 22 24 74 68 69 73 20 63 6c 6f 73 65 22 0a > "$this close".
36f20 0a 20 20 20 20 23 20 74 68 69 73 20 68 65 6c 70 . # this help
36f30 73 20 28 62 75 74 20 64 6f 65 73 6e 27 74 20 66 s (but doesn't f
36f40 75 6c 6c 79 20 73 6f 6c 76 65 29 20 66 6f 63 75 ully solve) focu
36f50 73 20 69 73 73 75 65 73 2e 20 54 68 65 20 67 65 s issues. The ge
36f60 6e 65 72 61 6c 0a 20 20 20 20 23 20 69 64 65 61 neral. # idea
36f70 20 69 73 2c 20 77 68 65 6e 65 76 65 72 20 74 68 is, whenever th
36f80 65 20 66 72 61 6d 65 20 67 65 74 73 20 66 6f 63 e frame gets foc
36f90 75 73 20 69 74 20 67 65 74 73 20 70 61 73 73 65 us it gets passe
36fa0 64 20 6f 6e 20 74 6f 0a 20 20 20 20 23 20 74 68 d on to. # th
36fb0 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 0a 20 e entry widget.
36fc0 20 20 20 23 62 69 6e 64 20 43 6f 6d 62 6f 62 6f #bind Combobo
36fd0 78 20 3c 46 6f 63 75 73 49 6e 3e 20 7b 3a 3a 63 x <FocusIn> {::c
36fe0 6f 6d 62 6f 62 6f 78 3a 3a 74 6b 54 61 62 54 6f ombobox::tkTabTo
36ff0 57 69 6e 64 6f 77 20 5c 0a 09 23 5b 3a 3a 63 6f Window \..#[::co
37000 6d 62 6f 62 6f 78 3a 3a 63 6f 6e 76 65 72 74 20 mbobox::convert
37010 25 57 20 2d 57 5d 2e 65 6e 74 72 79 7d 0a 0a 20 %W -W].entry}..
37020 20 20 20 23 20 74 68 69 73 20 63 6c 6f 73 65 73 # this closes
37030 20 74 68 65 20 6c 69 73 74 62 6f 78 20 69 66 20 the listbox if
37040 77 65 20 67 65 74 20 68 69 64 64 65 6e 0a 20 20 we get hidden.
37050 20 20 62 69 6e 64 20 43 6f 6d 62 6f 62 6f 78 20 bind Combobox
37060 3c 55 6e 6d 61 70 3e 20 7b 5b 3a 3a 63 6f 6d 62 <Unmap> {[::comb
37070 6f 62 6f 78 3a 3a 63 6f 6e 76 65 72 74 20 25 57 obox::convert %W
37080 20 2d 57 5d 20 63 6c 6f 73 65 7d 0a 0a 20 20 20 -W] close}..
37090 20 72 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 return "".}..#
370a0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 74 42 ::combobox::SetB
370b0 69 6e 64 69 6e 67 73 20 2d 2d 0a 23 0a 23 20 20 indings --.#.#
370c0 20 20 68 65 72 65 27 73 20 77 68 65 72 65 20 77 here's where w
370d0 65 20 64 6f 20 6d 6f 73 74 20 6f 66 20 74 68 65 e do most of the
370e0 20 62 69 6e 64 69 6e 67 20 66 6f 6f 2e 20 49 20 binding foo. I
370f0 74 68 69 6e 6b 20 74 68 65 72 65 27 73 20 70 72 think there's pr
37100 6f 62 61 62 6c 79 0a 23 20 20 20 20 61 20 66 65 obably.# a fe
37110 77 20 62 69 6e 64 69 6e 67 73 20 49 20 6f 75 67 w bindings I oug
37120 68 74 20 74 6f 20 61 64 64 20 74 68 61 74 20 49 ht to add that I
37130 20 6a 75 73 74 20 68 61 76 65 6e 27 74 20 74 68 just haven't th
37140 6f 75 67 68 74 0a 23 20 20 20 20 61 62 6f 75 74 ought.# about
37150 2e 2e 2e 0a 23 0a 23 20 20 20 20 49 27 6d 20 6e ....#.# I'm n
37160 6f 74 20 63 6f 6e 76 69 6e 63 65 64 20 74 68 65 ot convinced the
37170 73 65 20 61 72 65 20 74 68 65 20 70 72 6f 70 65 se are the prope
37180 72 20 62 69 6e 64 69 6e 67 73 2e 20 49 64 65 61 r bindings. Idea
37190 6c 6c 79 20 61 6c 6c 0a 23 20 20 20 20 62 69 6e lly all.# bin
371a0 64 69 6e 67 73 20 73 68 6f 75 6c 64 20 62 65 20 dings should be
371b0 6f 6e 20 22 43 6f 6d 62 6f 62 6f 78 22 2c 20 62 on "Combobox", b
371c0 75 74 20 62 65 63 61 75 73 65 20 6f 66 20 6d 79 ut because of my
371d0 20 6a 75 67 67 6c 69 6e 67 20 6f 66 0a 23 20 20 juggling of.#
371e0 20 20 62 69 6e 64 74 61 67 73 20 49 27 6d 20 6e bindtags I'm n
371f0 6f 74 20 63 6f 6e 76 69 6e 63 65 64 20 74 68 61 ot convinced tha
37200 74 73 20 77 68 61 74 20 49 20 77 61 6e 74 20 74 ts what I want t
37210 6f 20 64 6f 2e 20 42 75 74 2c 20 69 74 20 61 6c o do. But, it al
37220 6c 0a 23 20 20 20 20 73 65 65 6d 73 20 74 6f 20 l.# seems to
37230 77 6f 72 6b 2c 20 69 74 73 20 6a 75 73 74 20 6e work, its just n
37240 6f 74 20 61 73 20 72 6f 62 75 73 74 20 61 73 20 ot as robust as
37250 69 74 20 63 6f 75 6c 64 20 62 65 2e 0a 23 0a 23 it could be..#.#
37260 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 Arguments:.#.#
37270 20 20 20 77 20 20 20 20 77 69 64 67 65 74 20 70 w widget p
37280 61 74 68 6e 61 6d 65 0a 23 0a 23 20 52 65 74 75 athname.#.# Retu
37290 72 6e 73 3a 0a 23 0a 23 20 20 20 20 65 6d 70 74 rns:.#.# empt
372a0 79 20 73 74 72 69 6e 67 0a 0a 70 72 6f 63 20 3a y string..proc :
372b0 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 74 42 69 :combobox::SetBi
372c0 6e 64 69 6e 67 73 20 7b 77 7d 20 7b 0a 20 20 20 ndings {w} {.
372d0 20 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f upvar ::combobo
372e0 78 3a 3a 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 x::${w}::widgets
372f0 20 77 69 64 67 65 74 73 0a 20 20 20 20 75 70 76 widgets. upv
37300 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 ar ::combobox::$
37310 7b 77 7d 3a 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 {w}::options opt
37320 69 6f 6e 73 0a 0a 20 20 20 20 23 20 6a 75 67 67 ions.. # jugg
37330 6c 65 20 74 68 65 20 62 69 6e 64 74 61 67 73 2e le the bindtags.
37340 20 54 68 65 20 62 61 73 69 63 20 69 64 65 61 20 The basic idea
37350 68 65 72 65 20 69 73 20 74 6f 20 61 73 73 6f 63 here is to assoc
37360 69 61 74 65 20 74 68 65 0a 20 20 20 20 23 20 77 iate the. # w
37370 69 64 67 65 74 20 6e 61 6d 65 20 77 69 74 68 20 idget name with
37380 74 68 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 the entry widget
37390 2c 20 73 6f 20 69 66 20 61 20 75 73 65 72 20 64 , so if a user d
373a0 6f 65 73 20 61 20 62 69 6e 64 0a 20 20 20 20 23 oes a bind. #
373b0 20 6f 6e 20 74 68 65 20 63 6f 6d 62 6f 62 6f 78 on the combobox
373c0 20 69 74 20 77 69 6c 6c 20 67 65 74 20 68 61 6e it will get han
373d0 64 6c 65 64 20 70 72 6f 70 65 72 6c 79 20 73 69 dled properly si
373e0 6e 63 65 20 69 74 20 69 73 0a 20 20 20 20 23 20 nce it is. #
373f0 74 68 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 the entry widget
37400 20 74 68 61 74 20 68 61 73 20 6b 65 79 62 6f 61 that has keyboa
37410 72 64 20 66 6f 63 75 73 2e 0a 20 20 20 20 62 69 rd focus.. bi
37420 6e 64 74 61 67 73 20 24 77 69 64 67 65 74 73 28 ndtags $widgets(
37430 65 6e 74 72 79 29 20 5b 63 6f 6e 63 61 74 20 24 entry) [concat $
37440 77 69 64 67 65 74 73 28 74 68 69 73 29 20 5b 62 widgets(this) [b
37450 69 6e 64 74 61 67 73 20 24 77 69 64 67 65 74 73 indtags $widgets
37460 28 65 6e 74 72 79 29 5d 5d 0a 0a 20 20 20 20 62 (entry)]].. b
37470 69 6e 64 74 61 67 73 20 24 77 69 64 67 65 74 73 indtags $widgets
37480 28 62 75 74 74 6f 6e 29 20 5b 63 6f 6e 63 61 74 (button) [concat
37490 20 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 $widgets(this)
374a0 5c 0a 20 20 20 20 20 20 5b 62 69 6e 64 74 61 67 \. [bindtag
374b0 73 20 24 77 69 64 67 65 74 73 28 62 75 74 74 6f s $widgets(butto
374c0 6e 29 5d 5d 0a 0a 20 20 20 20 23 20 6f 76 65 72 n)]].. # over
374d0 72 69 64 65 20 74 68 65 20 64 65 66 61 75 6c 74 ride the default
374e0 20 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 74 61 bindings for ta
374f0 62 20 61 6e 64 20 73 68 69 66 74 2d 74 61 62 2e b and shift-tab.
37500 20 54 68 65 0a 20 20 20 20 23 20 66 6f 63 75 73 The. # focus
37510 20 70 72 6f 63 73 20 74 61 6b 65 20 61 20 77 69 procs take a wi
37520 64 67 65 74 20 61 73 20 74 68 65 69 72 20 6f 6e dget as their on
37530 6c 79 20 70 61 72 61 6d 65 74 65 72 20 61 6e 64 ly parameter and
37540 20 77 65 0a 20 20 20 20 23 20 77 61 6e 74 20 74 we. # want t
37550 6f 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 20 o make sure the
37560 72 69 67 68 74 20 77 69 6e 64 6f 77 20 67 65 74 right window get
37570 73 20 75 73 65 64 20 28 66 6f 72 20 73 68 69 66 s used (for shif
37580 74 2d 0a 20 20 20 20 23 20 74 61 62 20 77 65 20 t-. # tab we
37590 77 61 6e 74 20 69 74 20 74 6f 20 61 70 70 65 61 want it to appea
375a0 72 20 61 73 20 69 66 20 74 68 65 20 65 76 65 6e r as if the even
375b0 74 20 77 61 73 20 67 65 6e 65 72 61 74 65 64 0a t was generated.
375c0 20 20 20 20 23 20 6f 6e 20 74 68 65 20 66 72 61 # on the fra
375d0 6d 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 me rather than t
375e0 68 65 20 65 6e 74 72 79 2e 0a 20 20 20 20 23 62 he entry.. #b
375f0 69 6e 64 20 24 77 69 64 67 65 74 73 28 65 6e 74 ind $widgets(ent
37600 72 79 29 20 3c 54 61 62 3e 20 22 3a 3a 63 6f 6d ry) <Tab> "::com
37610 62 6f 62 6f 78 3a 3a 74 6b 54 61 62 54 6f 57 69 bobox::tkTabToWi
37620 6e 64 6f 77 20 5c 5b 74 6b 5f 66 6f 63 75 73 4e ndow \[tk_focusN
37630 65 78 74 20 5c 0a 09 23 24 77 69 64 67 65 74 73 ext \..#$widgets
37640 28 65 6e 74 72 79 29 5c 5d 3b 20 62 72 65 61 6b (entry)\]; break
37650 22 0a 20 20 20 20 23 62 69 6e 64 20 24 77 69 64 ". #bind $wid
37660 67 65 74 73 28 65 6e 74 72 79 29 20 3c 53 68 69 gets(entry) <Shi
37670 66 74 2d 54 61 62 3e 20 5c 0a 09 23 22 3a 3a 63 ft-Tab> \..#"::c
37680 6f 6d 62 6f 62 6f 78 3a 3a 74 6b 54 61 62 54 6f ombobox::tkTabTo
37690 57 69 6e 64 6f 77 20 5c 5b 74 6b 5f 66 6f 63 75 Window \[tk_focu
376a0 73 50 72 65 76 20 24 77 69 64 67 65 74 73 28 74 sPrev $widgets(t
376b0 68 69 73 29 5c 5d 3b 20 62 72 65 61 6b 22 0a 0a his)\]; break"..
376c0 20 20 20 20 23 20 74 68 69 73 20 6d 61 6b 65 73 # this makes
376d0 20 6f 75 72 20 22 62 75 74 74 6f 6e 22 20 28 77 our "button" (w
376e0 68 69 63 68 20 69 73 20 61 63 74 75 61 6c 6c 79 hich is actually
376f0 20 61 20 6c 61 62 65 6c 29 0a 20 20 20 20 23 20 a label). #
37700 64 6f 20 74 68 65 20 72 69 67 68 74 20 74 68 69 do the right thi
37710 6e 67 0a 20 20 20 20 62 69 6e 64 20 24 77 69 64 ng. bind $wid
37720 67 65 74 73 28 62 75 74 74 6f 6e 29 20 3c 42 75 gets(button) <Bu
37730 74 74 6f 6e 50 72 65 73 73 2d 31 3e 20 5b 6c 69 ttonPress-1> [li
37740 73 74 20 24 77 69 64 67 65 74 73 28 74 68 69 73 st $widgets(this
37750 29 20 74 6f 67 67 6c 65 5d 0a 0a 20 20 20 20 23 ) toggle].. #
37760 20 74 68 69 73 20 6c 65 74 73 20 74 68 65 20 61 this lets the a
37770 75 74 6f 73 63 61 6e 20 6f 66 20 74 68 65 20 6c utoscan of the l
37780 69 73 74 62 6f 78 20 77 6f 72 6b 2c 20 65 76 65 istbox work, eve
37790 6e 20 69 66 20 74 68 65 79 0a 20 20 20 20 23 20 n if they. #
377a0 6d 6f 76 65 20 74 68 65 20 63 75 72 73 6f 72 20 move the cursor
377b0 6f 76 65 72 20 74 68 65 20 65 6e 74 72 79 20 77 over the entry w
377c0 69 64 67 65 74 2e 0a 20 20 20 20 62 69 6e 64 20 idget.. bind
377d0 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 $widgets(entry)
377e0 3c 42 31 2d 45 6e 74 65 72 3e 20 22 62 72 65 61 <B1-Enter> "brea
377f0 6b 22 0a 0a 20 20 20 20 62 69 6e 64 20 24 77 69 k".. bind $wi
37800 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 3c dgets(listbox) <
37810 42 75 74 74 6f 6e 52 65 6c 65 61 73 65 2d 31 3e ButtonRelease-1>
37820 20 22 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 "::combobox::Se
37830 6c 65 63 74 20 5c 0a 20 20 20 20 20 20 5b 6c 69 lect \. [li
37840 73 74 20 24 77 69 64 67 65 74 73 28 74 68 69 73 st $widgets(this
37850 29 5d 20 5c 5b 24 77 69 64 67 65 74 73 28 6c 69 )] \[$widgets(li
37860 73 74 62 6f 78 29 20 6e 65 61 72 65 73 74 20 25 stbox) nearest %
37870 79 5c 5d 3b 20 62 72 65 61 6b 22 0a 0a 20 20 20 y\]; break"..
37880 20 62 69 6e 64 20 24 77 69 64 67 65 74 73 28 76 bind $widgets(v
37890 73 62 29 20 3c 42 75 74 74 6f 6e 50 72 65 73 73 sb) <ButtonPress
378a0 2d 31 3e 20 7b 63 6f 6e 74 69 6e 75 65 7d 0a 20 -1> {continue}.
378b0 20 20 20 62 69 6e 64 20 24 77 69 64 67 65 74 73 bind $widgets
378c0 28 76 73 62 29 20 3c 42 75 74 74 6f 6e 52 65 6c (vsb) <ButtonRel
378d0 65 61 73 65 2d 31 3e 20 7b 63 6f 6e 74 69 6e 75 ease-1> {continu
378e0 65 7d 0a 0a 20 20 20 20 62 69 6e 64 20 24 77 69 e}.. bind $wi
378f0 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 3c dgets(listbox) <
37900 41 6e 79 2d 4d 6f 74 69 6f 6e 3e 20 7b 0a 09 25 Any-Motion> {..%
37910 57 20 73 65 6c 65 63 74 69 6f 6e 20 63 6c 65 61 W selection clea
37920 72 20 30 20 65 6e 64 0a 09 25 57 20 61 63 74 69 r 0 end..%W acti
37930 76 61 74 65 20 40 25 78 2c 25 79 0a 09 25 57 20 vate @%x,%y..%W
37940 73 65 6c 65 63 74 69 6f 6e 20 61 6e 63 68 6f 72 selection anchor
37950 20 40 25 78 2c 25 79 0a 09 25 57 20 73 65 6c 65 @%x,%y..%W sele
37960 63 74 69 6f 6e 20 73 65 74 20 40 25 78 2c 25 79 ction set @%x,%y
37970 20 40 25 78 2c 25 79 0a 09 23 20 6e 65 65 64 20 @%x,%y..# need
37980 74 6f 20 64 6f 20 61 20 79 76 69 65 77 20 69 66 to do a yview if
37990 20 74 68 65 20 63 75 72 73 6f 72 20 67 6f 65 73 the cursor goes
379a0 20 6f 66 66 20 74 68 65 20 74 6f 70 0a 09 23 20 off the top..#
379b0 6f 72 20 62 6f 74 74 6f 6d 20 6f 66 20 74 68 65 or bottom of the
379c0 20 77 69 6e 64 6f 77 2e 2e 2e 20 28 6f 72 20 64 window... (or d
379d0 6f 20 77 65 3f 29 0a 20 20 20 20 7d 0a 0a 20 20 o we?). }..
379e0 20 20 23 20 74 68 65 73 65 20 65 76 65 6e 74 73 # these events
379f0 20 6e 65 65 64 20 74 6f 20 62 65 20 70 61 73 73 need to be pass
37a00 65 64 20 66 72 6f 6d 20 74 68 65 20 65 6e 74 72 ed from the entr
37a10 79 20 77 69 64 67 65 74 0a 20 20 20 20 23 20 74 y widget. # t
37a20 6f 20 74 68 65 20 6c 69 73 74 62 6f 78 2c 20 6f o the listbox, o
37a30 72 20 6f 74 68 65 72 77 69 73 65 20 6e 65 65 64 r otherwise need
37a40 20 73 6f 6d 65 20 73 6f 72 74 20 6f 66 20 73 70 some sort of sp
37a50 65 63 69 61 6c 0a 20 20 20 20 23 20 68 61 6e 64 ecial. # hand
37a60 6c 69 6e 67 2e 0a 20 20 20 20 66 6f 72 65 61 63 ling.. foreac
37a70 68 20 65 76 65 6e 74 20 5b 6c 69 73 74 20 3c 55 h event [list <U
37a80 70 3e 20 3c 44 6f 77 6e 3e 20 3c 54 61 62 3e 20 p> <Down> <Tab>
37a90 3c 52 65 74 75 72 6e 3e 20 3c 45 73 63 61 70 65 <Return> <Escape
37aa0 3e 20 3c 4e 65 78 74 3e 20 3c 50 72 69 6f 72 3e > <Next> <Prior>
37ab0 20 5c 0a 20 20 20 20 20 20 3c 44 6f 75 62 6c 65 \. <Double
37ac0 2d 31 3e 20 3c 31 3e 20 3c 41 6e 79 2d 4b 65 79 -1> <1> <Any-Key
37ad0 50 72 65 73 73 3e 20 3c 46 6f 63 75 73 49 6e 3e Press> <FocusIn>
37ae0 20 3c 46 6f 63 75 73 4f 75 74 3e 5d 20 7b 0a 09 <FocusOut>] {..
37af0 62 69 6e 64 20 24 77 69 64 67 65 74 73 28 65 6e bind $widgets(en
37b00 74 72 79 29 20 24 65 76 65 6e 74 20 5b 6c 69 73 try) $event [lis
37b10 74 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 48 61 t ::combobox::Ha
37b20 6e 64 6c 65 45 76 65 6e 74 20 5c 0a 09 20 20 24 ndleEvent \.. $
37b30 77 69 64 67 65 74 73 28 74 68 69 73 29 20 24 65 widgets(this) $e
37b40 76 65 6e 74 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 vent]. }..
37b50 20 23 20 6c 69 6b 65 20 74 68 65 20 6f 74 68 65 # like the othe
37b60 72 20 65 76 65 6e 74 73 2c 20 3c 4d 6f 75 73 65 r events, <Mouse
37b70 57 68 65 65 6c 3e 20 6e 65 65 64 73 20 74 6f 20 Wheel> needs to
37b80 62 65 20 70 61 73 73 65 64 20 66 72 6f 6d 0a 20 be passed from.
37b90 20 20 20 23 20 74 68 65 20 65 6e 74 72 79 20 77 # the entry w
37ba0 69 64 67 65 74 20 74 6f 20 74 68 65 20 6c 69 73 idget to the lis
37bb0 74 62 6f 78 2e 20 48 6f 77 65 76 65 72 2c 20 69 tbox. However, i
37bc0 6e 20 74 68 69 73 20 63 61 73 65 20 77 65 0a 20 n this case we.
37bd0 20 20 20 23 20 6e 65 65 64 20 74 6f 20 61 64 64 # need to add
37be0 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 70 an additional p
37bf0 61 72 61 6d 65 74 65 72 0a 20 20 20 20 63 61 74 arameter. cat
37c00 63 68 20 7b 0a 09 62 69 6e 64 20 24 77 69 64 67 ch {..bind $widg
37c10 65 74 73 28 65 6e 74 72 79 29 20 3c 4d 6f 75 73 ets(entry) <Mous
37c20 65 57 68 65 65 6c 3e 20 5b 6c 69 73 74 20 3a 3a eWheel> [list ::
37c30 63 6f 6d 62 6f 62 6f 78 3a 3a 48 61 6e 64 6c 65 combobox::Handle
37c40 45 76 65 6e 74 20 5c 0a 09 20 20 24 77 69 64 67 Event \.. $widg
37c50 65 74 73 28 74 68 69 73 29 20 3c 4d 6f 75 73 65 ets(this) <Mouse
37c60 57 68 65 65 6c 3e 20 25 44 5d 0a 20 20 20 20 7d Wheel> %D]. }
37c70 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 6f 78 .}..# ::combobox
37c80 3a 3a 42 75 69 6c 64 20 2d 2d 0a 23 0a 23 20 20 ::Build --.#.#
37c90 20 20 54 68 69 73 20 64 6f 65 73 20 61 6c 6c 20 This does all
37ca0 6f 66 20 74 68 65 20 77 6f 72 6b 20 6e 65 63 65 of the work nece
37cb0 73 73 61 72 79 20 74 6f 20 63 72 65 61 74 65 20 ssary to create
37cc0 74 68 65 20 62 61 73 69 63 0a 23 20 20 20 20 63 the basic.# c
37cd0 6f 6d 62 6f 62 6f 78 2e 0a 23 0a 23 20 41 72 67 ombobox..#.# Arg
37ce0 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 20 20 77 uments:.#.# w
37cf0 20 20 20 20 20 20 20 20 77 69 64 67 65 74 20 6e widget n
37d00 61 6d 65 0a 23 20 20 20 20 61 72 67 73 20 20 20 ame.# args
37d10 20 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 additional opt
37d20 69 6f 6e 2f 76 61 6c 75 65 20 70 61 69 72 73 0a ion/value pairs.
37d30 23 0a 23 20 52 65 73 75 6c 74 73 3a 0a 23 0a 23 #.# Results:.#.#
37d40 20 20 20 20 43 72 65 61 74 65 73 20 61 20 6e 65 Creates a ne
37d50 77 20 77 69 64 67 65 74 20 77 69 74 68 20 74 68 w widget with th
37d60 65 20 67 69 76 65 6e 20 6e 61 6d 65 2e 20 41 6c e given name. Al
37d70 73 6f 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 so creates a new
37d80 0a 23 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 .# namespace
37d90 70 61 74 74 65 72 65 6e 65 64 20 61 66 74 65 72 patterened after
37da0 20 74 68 65 20 77 69 64 67 65 74 20 6e 61 6d 65 the widget name
37db0 2c 20 61 73 20 61 20 63 68 69 6c 64 20 6e 61 6d , as a child nam
37dc0 65 73 70 61 63 65 0a 23 20 20 20 20 74 6f 20 3a espace.# to :
37dd0 3a 63 6f 6d 62 6f 62 6f 78 0a 23 0a 23 20 52 65 :combobox.#.# Re
37de0 74 75 72 6e 73 3a 0a 23 0a 23 20 20 20 20 74 68 turns:.#.# th
37df0 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 77 69 e name of the wi
37e00 64 67 65 74 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d dget..proc ::com
37e10 62 6f 62 6f 78 3a 3a 42 75 69 6c 64 20 7b 77 20 bobox::Build {w
37e20 61 72 67 73 7d 20 7b 0a 20 20 20 20 76 61 72 69 args} {. vari
37e30 61 62 6c 65 20 77 69 64 67 65 74 4f 70 74 69 6f able widgetOptio
37e40 6e 73 0a 0a 20 20 20 20 69 66 20 7b 5b 77 69 6e ns.. if {[win
37e50 66 6f 20 65 78 69 73 74 73 20 24 77 5d 7d 20 7b fo exists $w]} {
37e60 0a 09 65 72 72 6f 72 20 22 77 69 6e 64 6f 77 20 ..error "window
37e70 6e 61 6d 65 20 5c 22 24 77 5c 22 20 61 6c 72 65 name \"$w\" alre
37e80 61 64 79 20 65 78 69 73 74 73 22 0a 20 20 20 20 ady exists".
37e90 7d 0a 0a 20 20 20 20 23 20 63 72 65 61 74 65 20 }.. # create
37ea0 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 66 6f the namespace fo
37eb0 72 20 74 68 69 73 20 69 6e 73 74 61 6e 63 65 2c r this instance,
37ec0 20 61 6e 64 20 64 65 66 69 6e 65 20 61 20 66 65 and define a fe
37ed0 77 0a 20 20 20 20 23 20 76 61 72 69 61 62 6c 65 w. # variable
37ee0 73 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 s. namespace
37ef0 65 76 61 6c 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a eval ::combobox:
37f00 3a 24 77 20 7b 0a 0a 09 76 61 72 69 61 62 6c 65 :$w {...variable
37f10 20 69 67 6e 6f 72 65 54 72 61 63 65 20 30 0a 09 ignoreTrace 0..
37f20 76 61 72 69 61 62 6c 65 20 6f 6c 64 46 6f 63 75 variable oldFocu
37f30 73 20 7b 7d 0a 09 76 61 72 69 61 62 6c 65 20 6f s {}..variable o
37f40 6c 64 47 72 61 62 20 7b 7d 0a 09 76 61 72 69 61 ldGrab {}..varia
37f50 62 6c 65 20 6f 6c 64 56 61 6c 75 65 20 7b 7d 0a ble oldValue {}.
37f60 09 76 61 72 69 61 62 6c 65 20 6f 70 74 69 6f 6e .variable option
37f70 73 0a 09 76 61 72 69 61 62 6c 65 20 74 68 69 73 s..variable this
37f80 0a 09 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 ..variable widge
37f90 74 73 0a 0a 09 73 65 74 20 77 69 64 67 65 74 73 ts...set widgets
37fa0 28 66 6f 6f 29 20 66 6f 6f 20 3b 23 20 63 6f 65 (foo) foo ;# coe
37fb0 72 63 65 20 69 6e 74 6f 20 61 6e 20 61 72 72 61 rce into an arra
37fc0 79 0a 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 66 y..set options(f
37fd0 6f 6f 29 20 66 6f 6f 20 3b 23 20 63 6f 65 72 63 oo) foo ;# coerc
37fe0 65 20 69 6e 74 6f 20 61 6e 20 61 72 72 61 79 0a e into an array.
37ff0 0a 09 75 6e 73 65 74 20 77 69 64 67 65 74 73 28 ..unset widgets(
38000 66 6f 6f 29 0a 09 75 6e 73 65 74 20 6f 70 74 69 foo)..unset opti
38010 6f 6e 73 28 66 6f 6f 29 0a 20 20 20 20 7d 0a 0a ons(foo). }..
38020 20 20 20 20 23 20 69 6d 70 6f 72 74 20 74 68 65 # import the
38030 20 77 69 64 67 65 74 73 20 61 6e 64 20 6f 70 74 widgets and opt
38040 69 6f 6e 73 20 61 72 72 61 79 73 20 69 6e 74 6f ions arrays into
38050 20 74 68 69 73 20 70 72 6f 63 20 73 6f 0a 20 20 this proc so.
38060 20 20 23 20 77 65 20 64 6f 6e 27 74 20 68 61 76 # we don't hav
38070 65 20 74 6f 20 75 73 65 20 66 75 6c 6c 79 20 71 e to use fully q
38080 75 61 6c 69 66 69 65 64 20 6e 61 6d 65 73 2c 20 ualified names,
38090 77 68 69 63 68 20 69 73 20 61 0a 20 20 20 20 23 which is a. #
380a0 20 70 61 69 6e 2e 0a 20 20 20 20 75 70 76 61 72 pain.. upvar
380b0 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 ::combobox::${w
380c0 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 64 67 65 }::widgets widge
380d0 74 73 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 ts. upvar ::c
380e0 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f ombobox::${w}::o
380f0 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 0a 0a ptions options..
38100 20 20 20 20 23 20 74 68 69 73 20 69 73 20 6f 75 # this is ou
38110 72 20 77 69 64 67 65 74 20 2d 2d 20 61 20 66 72 r widget -- a fr
38120 61 6d 65 20 6f 66 20 63 6c 61 73 73 20 43 6f 6d ame of class Com
38130 62 6f 62 6f 78 2e 20 4e 61 74 75 72 61 6c 6c 79 bobox. Naturally
38140 2c 0a 20 20 20 20 23 20 69 74 20 77 69 6c 6c 20 ,. # it will
38150 63 6f 6e 74 61 69 6e 20 6f 74 68 65 72 20 77 69 contain other wi
38160 64 67 65 74 73 2e 20 57 65 20 63 72 65 61 74 65 dgets. We create
38170 20 69 74 20 68 65 72 65 20 62 65 63 61 75 73 65 it here because
38180 0a 20 20 20 20 23 20 77 65 20 6e 65 65 64 20 69 . # we need i
38190 74 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 73 65 t in order to se
381a0 74 20 73 6f 6d 65 20 64 65 66 61 75 6c 74 20 6f t some default o
381b0 70 74 69 6f 6e 73 2e 0a 20 20 20 20 73 65 74 20 ptions.. set
381c0 77 69 64 67 65 74 73 28 74 68 69 73 29 20 5b 66 widgets(this) [f
381d0 72 61 6d 65 20 24 77 20 2d 63 6c 61 73 73 20 43 rame $w -class C
381e0 6f 6d 62 6f 62 6f 78 20 2d 74 61 6b 65 66 6f 63 ombobox -takefoc
381f0 75 73 20 30 5d 0a 20 20 20 20 73 65 74 20 77 69 us 0]. set wi
38200 64 67 65 74 73 28 65 6e 74 72 79 29 20 5b 65 6e dgets(entry) [en
38210 74 72 79 20 24 77 2e 65 6e 74 72 79 20 2d 74 61 try $w.entry -ta
38220 6b 65 66 6f 63 75 73 20 31 5d 0a 20 20 20 20 73 kefocus 1]. s
38230 65 74 20 77 69 64 67 65 74 73 28 62 75 74 74 6f et widgets(butto
38240 6e 29 20 5b 6c 61 62 65 6c 20 24 77 2e 62 75 74 n) [label $w.but
38250 74 6f 6e 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 ton -takefocus 0
38260 5d 0a 0a 20 20 20 20 23 20 74 68 69 73 20 64 65 ].. # this de
38270 66 69 6e 65 73 20 61 6c 6c 20 6f 66 20 74 68 65 fines all of the
38280 20 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 default options
38290 2e 20 57 65 20 67 65 74 20 74 68 65 0a 20 20 20 . We get the.
382a0 20 23 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 74 # values from t
382b0 68 65 20 6f 70 74 69 6f 6e 20 64 61 74 61 62 61 he option databa
382c0 73 65 2e 20 4e 6f 74 65 20 74 68 61 74 20 69 66 se. Note that if
382d0 20 61 6e 20 61 72 72 61 79 0a 20 20 20 20 23 20 an array. #
382e0 76 61 6c 75 65 20 69 73 20 61 20 6c 69 73 74 20 value is a list
382f0 6f 66 20 6c 65 6e 67 74 68 20 6f 6e 65 20 69 74 of length one it
38300 20 69 73 20 61 6e 20 61 6c 69 61 73 20 74 6f 20 is an alias to
38310 61 6e 6f 74 68 65 72 0a 20 20 20 20 23 20 6f 70 another. # op
38320 74 69 6f 6e 2c 20 73 6f 20 77 65 20 6a 75 73 74 tion, so we just
38330 20 69 67 6e 6f 72 65 20 69 74 0a 20 20 20 20 66 ignore it. f
38340 6f 72 65 61 63 68 20 6e 61 6d 65 20 5b 61 72 72 oreach name [arr
38350 61 79 20 6e 61 6d 65 73 20 77 69 64 67 65 74 4f ay names widgetO
38360 70 74 69 6f 6e 73 5d 20 7b 0a 09 69 66 20 7b 5b ptions] {..if {[
38370 6c 6c 65 6e 67 74 68 20 24 77 69 64 67 65 74 4f llength $widgetO
38380 70 74 69 6f 6e 73 28 24 6e 61 6d 65 29 5d 20 3d ptions($name)] =
38390 3d 20 31 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 = 1} continue...
383a0 73 65 74 20 6f 70 74 4e 61 6d 65 20 5b 6c 69 6e set optName [lin
383b0 64 65 78 20 24 77 69 64 67 65 74 4f 70 74 69 6f dex $widgetOptio
383c0 6e 73 28 24 6e 61 6d 65 29 20 30 5d 0a 09 73 65 ns($name) 0]..se
383d0 74 20 6f 70 74 43 6c 61 73 73 20 5b 6c 69 6e 64 t optClass [lind
383e0 65 78 20 24 77 69 64 67 65 74 4f 70 74 69 6f 6e ex $widgetOption
383f0 73 28 24 6e 61 6d 65 29 20 31 5d 0a 0a 09 73 65 s($name) 1]...se
38400 74 20 76 61 6c 75 65 20 5b 6f 70 74 69 6f 6e 20 t value [option
38410 67 65 74 20 24 77 20 24 6f 70 74 4e 61 6d 65 20 get $w $optName
38420 24 6f 70 74 43 6c 61 73 73 5d 0a 09 73 65 74 20 $optClass]..set
38430 6f 70 74 69 6f 6e 73 28 24 6e 61 6d 65 29 20 24 options($name) $
38440 76 61 6c 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 value. }..
38450 20 23 20 61 20 63 6f 75 70 6c 65 20 6f 70 74 69 # a couple opti
38460 6f 6e 73 20 61 72 65 6e 27 74 20 61 76 61 69 6c ons aren't avail
38470 61 62 6c 65 20 69 6e 20 65 61 72 6c 69 65 72 20 able in earlier
38480 76 65 72 73 69 6f 6e 73 20 6f 66 0a 20 20 20 20 versions of.
38490 23 20 74 63 6c 2c 20 73 6f 20 77 65 27 6c 6c 20 # tcl, so we'll
384a0 73 65 74 20 74 68 65 6d 20 74 6f 20 73 61 6e 65 set them to sane
384b0 20 76 61 6c 75 65 73 2e 20 46 6f 72 20 74 68 61 values. For tha
384c0 74 20 6d 61 74 74 65 72 2c 20 69 66 0a 20 20 20 t matter, if.
384d0 20 23 20 74 68 65 79 20 65 78 69 73 74 20 62 75 # they exist bu
384e0 74 20 61 72 65 20 65 6d 70 74 79 2c 20 73 65 74 t are empty, set
384f0 20 74 68 65 6d 20 74 6f 20 73 61 6e 65 20 76 61 them to sane va
38500 6c 75 65 73 2e 0a 20 20 20 20 69 66 20 7b 5b 73 lues.. if {[s
38510 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6f 70 tring length $op
38520 74 69 6f 6e 73 28 2d 64 69 73 61 62 6c 65 64 66 tions(-disabledf
38530 6f 72 65 67 72 6f 75 6e 64 29 5d 20 3d 3d 20 30 oreground)] == 0
38540 7d 20 7b 0a 09 73 65 74 20 6f 70 74 69 6f 6e 73 } {..set options
38550 28 2d 64 69 73 61 62 6c 65 64 66 6f 72 65 67 72 (-disabledforegr
38560 6f 75 6e 64 29 20 24 6f 70 74 69 6f 6e 73 28 2d ound) $options(-
38570 66 6f 72 65 67 72 6f 75 6e 64 29 0a 20 20 20 20 foreground).
38580 7d 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e }. if {[strin
38590 67 20 6c 65 6e 67 74 68 20 24 6f 70 74 69 6f 6e g length $option
385a0 73 28 2d 64 69 73 61 62 6c 65 64 62 61 63 6b 67 s(-disabledbackg
385b0 72 6f 75 6e 64 29 5d 20 3d 3d 20 30 7d 20 7b 0a round)] == 0} {.
385c0 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 2d 64 69 .set options(-di
385d0 73 61 62 6c 65 64 62 61 63 6b 67 72 6f 75 6e 64 sabledbackground
385e0 29 20 24 6f 70 74 69 6f 6e 73 28 2d 62 61 63 6b ) $options(-back
385f0 67 72 6f 75 6e 64 29 0a 20 20 20 20 7d 0a 0a 20 ground). }..
38600 20 20 20 23 20 69 66 20 2d 76 61 6c 75 65 20 69 # if -value i
38610 73 20 73 65 74 20 74 6f 20 6e 75 6c 6c 2c 20 77 s set to null, w
38620 65 27 6c 6c 20 72 65 6d 6f 76 65 20 69 74 20 66 e'll remove it f
38630 72 6f 6d 20 6f 75 72 0a 20 20 20 20 23 20 6c 6f rom our. # lo
38640 63 61 6c 20 61 72 72 61 79 2e 20 54 68 65 20 61 cal array. The a
38650 73 73 75 6d 70 74 69 6f 6e 20 69 73 2c 20 69 66 ssumption is, if
38660 20 74 68 65 20 75 73 65 72 20 73 65 74 73 20 69 the user sets i
38670 74 20 66 72 6f 6d 0a 20 20 20 20 23 20 74 68 65 t from. # the
38680 20 6f 70 74 69 6f 6e 20 64 61 74 61 62 61 73 65 option database
38690 2c 20 74 68 65 79 20 77 69 6c 6c 20 73 65 74 20 , they will set
386a0 69 74 20 74 6f 20 73 6f 6d 65 74 68 69 6e 67 20 it to something
386b0 6f 74 68 65 72 0a 20 20 20 20 23 20 74 68 61 6e other. # than
386c0 20 6e 75 6c 6c 20 28 73 69 6e 63 65 20 69 74 27 null (since it'
386d0 73 20 69 6d 70 6f 73 73 69 62 6c 65 20 74 6f 20 s impossible to
386e0 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 64 69 determine the di
386f0 66 66 65 72 65 6e 63 65 0a 20 20 20 20 23 20 62 fference. # b
38700 65 74 77 65 65 6e 20 61 20 6e 75 6c 6c 20 76 61 etween a null va
38710 6c 75 65 20 61 6e 64 20 6e 6f 20 76 61 6c 75 65 lue and no value
38720 20 61 74 20 61 6c 6c 29 2e 0a 20 20 20 20 69 66 at all).. if
38730 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 6f {[info exists o
38740 70 74 69 6f 6e 73 28 2d 76 61 6c 75 65 29 5d 20 ptions(-value)]
38750 26 26 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 && [string lengt
38760 68 20 24 6f 70 74 69 6f 6e 73 28 2d 76 61 6c 75 h $options(-valu
38770 65 29 5d 20 3d 3d 20 5c 0a 20 20 20 20 20 20 30 e)] == \. 0
38780 7d 20 7b 0a 09 75 6e 73 65 74 20 6f 70 74 69 6f } {..unset optio
38790 6e 73 28 2d 76 61 6c 75 65 29 0a 20 20 20 20 7d ns(-value). }
387a0 0a 0a 20 20 20 20 23 20 77 65 20 77 69 6c 6c 20 .. # we will
387b0 6c 61 74 65 72 20 72 65 6e 61 6d 65 20 74 68 65 later rename the
387c0 20 66 72 61 6d 65 27 73 20 77 69 64 67 65 74 20 frame's widget
387d0 70 72 6f 63 20 74 6f 20 62 65 20 6f 75 72 0a 20 proc to be our.
387e0 20 20 20 23 20 6f 77 6e 20 63 75 73 74 6f 6d 20 # own custom
387f0 77 69 64 67 65 74 20 70 72 6f 63 2e 20 57 65 20 widget proc. We
38800 6e 65 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 need to keep tra
38810 63 6b 20 6f 66 20 74 68 69 73 0a 20 20 20 20 23 ck of this. #
38820 20 6e 65 77 20 6e 61 6d 65 2c 20 73 6f 20 77 65 new name, so we
38830 27 6c 6c 20 64 65 66 69 6e 65 20 61 6e 64 20 73 'll define and s
38840 74 6f 72 65 20 69 74 20 68 65 72 65 2e 2e 2e 0a tore it here....
38850 20 20 20 20 73 65 74 20 77 69 64 67 65 74 73 28 set widgets(
38860 66 72 61 6d 65 29 20 3a 3a 63 6f 6d 62 6f 62 6f frame) ::combobo
38870 78 3a 3a 24 7b 77 7d 3a 3a 24 77 0a 0a 20 20 20 x::${w}::$w..
38880 20 23 20 67 6f 74 74 61 20 64 6f 20 74 68 69 73 # gotta do this
38890 20 73 6f 6f 6e 65 72 20 6f 72 20 6c 61 74 65 72 sooner or later
388a0 2e 20 4d 69 67 68 74 20 61 73 20 77 65 6c 6c 20 . Might as well
388b0 64 6f 20 69 74 20 6e 6f 77 0a 20 20 20 20 70 61 do it now. pa
388c0 63 6b 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 ck $widgets(entr
388d0 79 29 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 66 y) -side left -f
388e0 69 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 ill both -expand
388f0 20 79 65 73 0a 20 20 20 20 70 61 63 6b 20 24 77 yes. pack $w
38900 69 64 67 65 74 73 28 62 75 74 74 6f 6e 29 20 2d idgets(button) -
38910 73 69 64 65 20 72 69 67 68 74 20 2d 66 69 6c 6c side right -fill
38920 20 79 20 2d 65 78 70 61 6e 64 20 6e 6f 0a 0a 20 y -expand no..
38930 20 20 20 23 20 49 20 73 68 6f 75 6c 64 20 70 72 # I should pr
38940 6f 62 61 62 6c 79 20 64 6f 20 74 68 69 73 20 69 obably do this i
38950 6e 20 61 20 63 61 74 63 68 2c 20 62 75 74 20 66 n a catch, but f
38960 6f 72 20 6e 6f 77 20 69 74 27 73 0a 20 20 20 20 or now it's.
38970 23 20 67 6f 6f 64 20 65 6e 6f 75 67 68 2e 2e 2e # good enough...
38980 20 57 68 61 74 20 69 74 20 64 6f 65 73 2c 20 6f What it does, o
38990 62 76 69 6f 75 73 6c 79 2c 20 69 73 20 70 75 74 bviously, is put
389a0 20 61 6c 6c 20 6f 66 0a 20 20 20 20 23 20 74 68 all of. # th
389b0 65 20 6f 70 74 69 6f 6e 2f 76 61 6c 75 65 73 20 e option/values
389c0 70 61 69 72 73 20 69 6e 74 6f 20 61 6e 20 61 72 pairs into an ar
389d0 72 61 79 2e 20 4d 61 6b 65 20 74 68 65 6d 20 65 ray. Make them e
389e0 61 73 69 65 72 0a 20 20 20 20 23 20 74 6f 20 68 asier. # to h
389f0 61 6e 64 6c 65 20 6c 61 74 65 72 20 6f 6e 2e 2e andle later on..
38a00 2e 0a 20 20 20 20 61 72 72 61 79 20 73 65 74 20 .. array set
38a10 6f 70 74 69 6f 6e 73 20 24 61 72 67 73 0a 0a 20 options $args..
38a20 20 20 20 23 20 6e 6f 77 2c 20 74 68 65 20 64 72 # now, the dr
38a30 6f 70 64 6f 77 6e 20 6c 69 73 74 2e 2e 2e 20 74 opdown list... t
38a40 68 65 20 73 61 6d 65 20 72 65 6e 61 6d 69 6e 67 he same renaming
38a50 20 6e 6f 6e 73 65 6e 73 65 0a 20 20 20 20 23 20 nonsense. #
38a60 6d 75 73 74 20 67 6f 20 6f 6e 20 68 65 72 65 20 must go on here
38a70 61 73 20 77 65 6c 6c 2e 2e 2e 0a 20 20 20 20 73 as well.... s
38a80 65 74 20 77 69 64 67 65 74 73 28 64 72 6f 70 64 et widgets(dropd
38a90 6f 77 6e 29 20 5b 74 6f 70 6c 65 76 65 6c 20 24 own) [toplevel $
38aa0 77 2e 74 6f 70 5d 0a 20 20 20 20 73 65 74 20 77 w.top]. set w
38ab0 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 idgets(listbox)
38ac0 5b 6c 69 73 74 62 6f 78 20 24 77 2e 74 6f 70 2e [listbox $w.top.
38ad0 6c 69 73 74 5d 0a 20 20 20 20 73 65 74 20 77 69 list]. set wi
38ae0 64 67 65 74 73 28 76 73 62 29 20 5b 73 63 72 6f dgets(vsb) [scro
38af0 6c 6c 62 61 72 20 24 77 2e 74 6f 70 2e 76 73 62 llbar $w.top.vsb
38b00 5d 0a 0a 20 20 20 20 70 61 63 6b 20 24 77 69 64 ].. pack $wid
38b10 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 2d 73 gets(listbox) -s
38b20 69 64 65 20 6c 65 66 74 20 2d 66 69 6c 6c 20 62 ide left -fill b
38b30 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 0a 0a 20 oth -expand y..
38b40 20 20 20 23 20 66 69 6e 65 20 74 75 6e 65 20 74 # fine tune t
38b50 68 65 20 77 69 64 67 65 74 73 20 62 61 73 65 64 he widgets based
38b60 20 6f 6e 20 74 68 65 20 6f 70 74 69 6f 6e 73 20 on the options
38b70 28 61 6e 64 20 61 20 66 65 77 0a 20 20 20 20 23 (and a few. #
38b80 20 61 72 62 69 74 72 61 72 79 20 76 61 6c 75 65 arbitrary value
38b90 73 2e 2e 2e 29 0a 0a 20 20 20 20 23 20 4e 42 3a s...).. # NB:
38ba0 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20 74 6f we are going to
38bb0 20 75 73 65 20 74 68 65 20 66 72 61 6d 65 20 74 use the frame t
38bc0 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 72 65 6c o handle the rel
38bd0 69 65 66 0a 20 20 20 20 23 20 6f 66 20 74 68 65 ief. # of the
38be0 20 77 69 64 67 65 74 20 61 73 20 61 20 77 68 6f widget as a who
38bf0 6c 65 2c 20 73 6f 20 74 68 65 20 65 6e 74 72 79 le, so the entry
38c00 20 77 69 64 67 65 74 20 77 69 6c 6c 20 62 65 0a widget will be.
38c10 20 20 20 20 23 20 66 6c 61 74 2e 20 54 68 69 73 # flat. This
38c20 20 6d 61 6b 65 73 20 74 68 65 20 62 75 74 74 6f makes the butto
38c30 6e 20 77 68 69 63 68 20 64 72 6f 70 73 20 64 6f n which drops do
38c40 77 6e 20 74 68 65 20 6c 69 73 74 0a 20 20 20 20 wn the list.
38c50 23 20 74 6f 20 61 70 70 65 61 72 20 22 69 6e 73 # to appear "ins
38c60 69 64 65 22 20 74 68 65 20 65 6e 74 72 79 20 77 ide" the entry w
38c70 69 64 67 65 74 2e 0a 0a 20 20 20 20 24 77 69 64 idget... $wid
38c80 67 65 74 73 28 76 73 62 29 20 63 6f 6e 66 69 67 gets(vsb) config
38c90 75 72 65 20 2d 63 6f 6d 6d 61 6e 64 20 22 24 77 ure -command "$w
38ca0 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 idgets(listbox)
38cb0 79 76 69 65 77 22 20 5c 0a 20 20 20 20 20 20 2d yview" \. -
38cc0 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 highlightthickne
38cd0 73 73 20 30 0a 0a 20 20 20 20 24 77 69 64 67 65 ss 0.. $widge
38ce0 74 73 28 62 75 74 74 6f 6e 29 20 63 6f 6e 66 69 ts(button) confi
38cf0 67 75 72 65 20 2d 68 69 67 68 6c 69 67 68 74 74 gure -highlightt
38d00 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 6f 72 64 hickness 0 -bord
38d10 65 72 77 69 64 74 68 20 31 20 5c 0a 20 20 20 20 erwidth 1 \.
38d20 20 20 2d 72 65 6c 69 65 66 20 72 61 69 73 65 64 -relief raised
38d30 20 2d 77 69 64 74 68 20 5b 65 78 70 72 20 7b 5b -width [expr {[
38d40 77 69 6e 66 6f 20 72 65 71 77 69 64 74 68 20 24 winfo reqwidth $
38d50 77 69 64 67 65 74 73 28 76 73 62 29 5d 20 2d 20 widgets(vsb)] -
38d60 32 7d 5d 0a 0a 20 20 20 20 24 77 69 64 67 65 74 2}].. $widget
38d70 73 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 s(entry) configu
38d80 72 65 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 re -borderwidth
38d90 30 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 20 2d 0 -relief flat -
38da0 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 highlightthickne
38db0 73 73 20 30 0a 0a 20 20 20 20 24 77 69 64 67 65 ss 0.. $widge
38dc0 74 73 28 64 72 6f 70 64 6f 77 6e 29 20 63 6f 6e ts(dropdown) con
38dd0 66 69 67 75 72 65 20 2d 62 6f 72 64 65 72 77 69 figure -borderwi
38de0 64 74 68 20 31 20 2d 72 65 6c 69 65 66 20 73 75 dth 1 -relief su
38df0 6e 6b 65 6e 0a 0a 20 20 20 20 24 77 69 64 67 65 nken.. $widge
38e00 74 73 28 6c 69 73 74 62 6f 78 29 20 63 6f 6e 66 ts(listbox) conf
38e10 69 67 75 72 65 20 2d 73 65 6c 65 63 74 6d 6f 64 igure -selectmod
38e20 65 20 62 72 6f 77 73 65 20 5c 0a 20 20 20 20 20 e browse \.
38e30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 5b 24 77 -background [$w
38e40 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 67 idgets(entry) cg
38e50 65 74 20 2d 62 67 5d 20 2d 79 73 63 72 6f 6c 6c et -bg] -yscroll
38e60 63 6f 6d 6d 61 6e 64 20 5c 0a 20 20 20 20 20 20 command \.
38e70 22 24 77 69 64 67 65 74 73 28 76 73 62 29 20 73 "$widgets(vsb) s
38e80 65 74 22 20 2d 65 78 70 6f 72 74 73 65 6c 65 63 et" -exportselec
38e90 74 69 6f 6e 20 66 61 6c 73 65 20 2d 62 6f 72 64 tion false -bord
38ea0 65 72 77 69 64 74 68 20 30 0a 0a 0a 20 20 20 20 erwidth 0...
38eb0 23 20 64 6f 20 73 6f 6d 65 20 77 69 6e 64 6f 77 # do some window
38ec0 20 6d 61 6e 61 67 65 6d 65 6e 74 20 66 6f 6f 20 management foo
38ed0 6f 6e 20 74 68 65 20 64 72 6f 70 64 6f 77 6e 20 on the dropdown
38ee0 77 69 6e 64 6f 77 0a 20 20 20 20 23 20 54 68 65 window. # The
38ef0 72 65 20 73 65 65 6d 73 20 74 6f 20 62 65 20 73 re seems to be s
38f00 6f 6d 65 20 6f 72 64 65 72 20 64 65 70 65 6e 64 ome order depend
38f10 65 6e 63 79 20 68 65 72 65 20 6f 6e 20 73 6f 6d ency here on som
38f20 65 20 70 6c 61 74 66 6f 72 6d 73 0a 20 20 20 20 e platforms.
38f30 77 6d 20 74 72 61 6e 73 69 65 6e 74 20 24 77 69 wm transient $wi
38f40 64 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 20 dgets(dropdown)
38f50 5b 77 69 6e 66 6f 20 74 6f 70 6c 65 76 65 6c 20 [winfo toplevel
38f60 24 77 5d 0a 20 20 20 20 77 6d 20 67 72 6f 75 70 $w]. wm group
38f70 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 6f $widgets(dropdo
38f80 77 6e 29 20 5b 77 69 6e 66 6f 20 70 61 72 65 6e wn) [winfo paren
38f90 74 20 24 77 5d 0a 20 20 20 20 77 6d 20 72 65 73 t $w]. wm res
38fa0 69 7a 61 62 6c 65 20 24 77 69 64 67 65 74 73 28 izable $widgets(
38fb0 64 72 6f 70 64 6f 77 6e 29 20 30 20 30 0a 20 20 dropdown) 0 0.
38fc0 20 20 77 6d 20 6f 76 65 72 72 69 64 65 72 65 64 wm overridered
38fd0 69 72 65 63 74 20 24 77 69 64 67 65 74 73 28 64 irect $widgets(d
38fe0 72 6f 70 64 6f 77 6e 29 20 31 0a 20 20 20 20 77 ropdown) 1. w
38ff0 6d 20 77 69 74 68 64 72 61 77 20 24 77 69 64 67 m withdraw $widg
39000 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 0a 0a 20 ets(dropdown)..
39010 20 20 20 23 20 74 68 69 73 20 6d 6f 76 65 73 20 # this moves
39020 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 66 72 61 the original fra
39030 6d 65 20 77 69 64 67 65 74 20 70 72 6f 63 20 69 me widget proc i
39040 6e 74 6f 20 6f 75 72 0a 20 20 20 20 23 20 6e 61 nto our. # na
39050 6d 65 73 70 61 63 65 20 61 6e 64 20 67 69 76 65 mespace and give
39060 73 20 69 74 20 61 20 68 61 6e 64 79 20 6e 61 6d s it a handy nam
39070 65 0a 20 20 20 20 72 65 6e 61 6d 65 20 3a 3a 24 e. rename ::$
39080 77 20 24 77 69 64 67 65 74 73 28 66 72 61 6d 65 w $widgets(frame
39090 29 0a 0a 20 20 20 20 23 20 6e 6f 77 2c 20 63 72 ).. # now, cr
390a0 65 61 74 65 20 6f 75 72 20 77 69 64 67 65 74 20 eate our widget
390b0 70 72 6f 63 2e 20 4f 62 76 69 6f 75 73 6c 79 20 proc. Obviously
390c0 28 3f 29 20 69 74 20 67 6f 65 73 20 69 6e 0a 20 (?) it goes in.
390d0 20 20 20 23 20 74 68 65 20 67 6c 6f 62 61 6c 20 # the global
390e0 6e 61 6d 65 73 70 61 63 65 2e 20 41 6c 6c 20 63 namespace. All c
390f0 6f 6d 62 6f 62 6f 78 20 77 69 64 67 65 74 73 20 ombobox widgets
39100 77 69 6c 6c 20 61 63 74 75 61 6c 6c 79 0a 20 20 will actually.
39110 20 20 23 20 73 68 61 72 65 20 74 68 65 20 73 61 # share the sa
39120 6d 65 20 77 69 64 67 65 74 20 70 72 6f 63 20 74 me widget proc t
39130 6f 20 63 75 74 20 64 6f 77 6e 20 6f 6e 20 74 68 o cut down on th
39140 65 20 61 6d 6f 75 6e 74 20 6f 66 0a 20 20 20 20 e amount of.
39150 23 20 62 6c 6f 61 74 2e 0a 20 20 20 20 70 72 6f # bloat.. pro
39160 63 20 3a 3a 24 77 20 7b 63 6f 6d 6d 61 6e 64 20 c ::$w {command
39170 61 72 67 73 7d 20 22 65 76 61 6c 20 3a 3a 63 6f args} "eval ::co
39180 6d 62 6f 62 6f 78 3a 3a 57 69 64 67 65 74 50 72 mbobox::WidgetPr
39190 6f 63 20 24 77 20 5c 24 63 6f 6d 6d 61 6e 64 20 oc $w \$command
391a0 5c 24 61 72 67 73 22 0a 0a 0a 20 20 20 20 23 20 \$args"... #
391b0 6f 6b 2c 20 74 68 65 20 74 68 69 6e 67 20 65 78 ok, the thing ex
391c0 69 73 74 73 2e 2e 2e 20 6c 65 74 27 73 20 64 6f ists... let's do
391d0 20 61 20 62 69 74 20 6d 6f 72 65 20 63 6f 6e 66 a bit more conf
391e0 69 67 75 72 61 74 69 6f 6e 2e 0a 20 20 20 20 69 iguration.. i
391f0 66 20 7b 5b 63 61 74 63 68 20 22 3a 3a 63 6f 6d f {[catch "::com
39200 62 6f 62 6f 78 3a 3a 43 6f 6e 66 69 67 75 72 65 bobox::Configure
39210 20 5b 6c 69 73 74 20 24 77 69 64 67 65 74 73 28 [list $widgets(
39220 74 68 69 73 29 5d 20 5b 61 72 72 61 79 20 67 65 this)] [array ge
39230 74 20 5c 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e t \. option
39240 73 5d 22 20 65 72 72 6f 72 5d 7d 20 7b 0a 09 63 s]" error]} {..c
39250 61 74 63 68 20 7b 64 65 73 74 72 6f 79 20 24 77 atch {destroy $w
39260 7d 0a 09 65 72 72 6f 72 20 22 69 6e 74 65 72 6e }..error "intern
39270 61 6c 20 65 72 72 6f 72 3a 20 24 65 72 72 6f 72 al error: $error
39280 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 ". }.. ret
39290 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 3a 3a 63 6f urn "".}..# ::co
392a0 6d 62 6f 62 6f 78 3a 3a 48 61 6e 64 6c 65 45 76 mbobox::HandleEv
392b0 65 6e 74 20 2d 2d 0a 23 0a 23 20 20 20 20 74 68 ent --.#.# th
392c0 69 73 20 70 72 6f 63 20 68 61 6e 64 6c 65 73 20 is proc handles
392d0 65 76 65 6e 74 73 20 66 72 6f 6d 20 74 68 65 20 events from the
392e0 65 6e 74 72 79 20 77 69 64 67 65 74 20 74 68 61 entry widget tha
392f0 74 20 77 65 20 77 61 6e 74 0a 23 20 20 20 20 68 t we want.# h
39300 61 6e 64 6c 65 64 20 73 70 65 63 69 61 6c 6c 79 andled specially
39310 20 28 74 79 70 69 63 61 6c 6c 79 2c 20 74 6f 20 (typically, to
39320 61 6c 6c 6f 77 20 6e 61 76 69 67 61 74 69 6f 6e allow navigation
39330 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 23 20 20 of the list.#
39340 20 20 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 even though th
39350 65 20 66 6f 63 75 73 20 69 73 20 69 6e 20 74 68 e focus is in th
39360 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 29 0a e entry widget).
39370 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 #.# Arguments:.#
39380 0a 23 20 20 20 20 77 20 20 20 20 20 20 20 77 69 .# w wi
39390 64 67 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 20 dget pathname.#
393a0 20 20 20 65 76 65 6e 74 20 20 20 61 20 73 74 72 event a str
393b0 69 6e 67 20 72 65 70 72 65 73 65 6e 74 69 6e 67 ing representing
393c0 20 74 68 65 20 65 76 65 6e 74 20 28 6e 6f 74 20 the event (not
393d0 6e 65 63 65 73 73 61 72 69 6c 79 20 61 6e 0a 23 necessarily an.#
393e0 20 20 20 20 20 20 20 20 20 20 20 20 61 63 74 75 actu
393f0 61 6c 20 65 76 65 6e 74 29 0a 23 20 20 20 20 61 al event).# a
39400 72 67 73 20 20 20 20 61 64 64 69 74 69 6f 6e 61 rgs additiona
39410 6c 20 61 72 67 75 6d 65 6e 74 73 20 72 65 71 75 l arguments requ
39420 69 72 65 64 20 62 79 20 70 61 72 74 69 63 75 6c ired by particul
39430 61 72 20 65 76 65 6e 74 73 0a 0a 70 72 6f 63 20 ar events..proc
39440 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 48 61 6e 64 ::combobox::Hand
39450 6c 65 45 76 65 6e 74 20 7b 77 20 65 76 65 6e 74 leEvent {w event
39460 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 75 70 76 args} {. upv
39470 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 ar ::combobox::$
39480 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 64 {w}::widgets wid
39490 67 65 74 73 0a 20 20 20 20 75 70 76 61 72 20 3a gets. upvar :
394a0 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a :combobox::${w}:
394b0 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 :options options
394c0 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 6f 6d . upvar ::com
394d0 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f 6c 64 bobox::${w}::old
394e0 56 61 6c 75 65 20 6f 6c 64 56 61 6c 75 65 0a 0a Value oldValue..
394f0 20 20 20 20 23 20 66 6f 72 20 61 6c 6c 20 6f 66 # for all of
39500 20 74 68 65 73 65 20 65 76 65 6e 74 73 2c 20 69 these events, i
39510 66 20 77 65 20 68 61 76 65 20 61 20 73 70 65 63 f we have a spec
39520 69 61 6c 20 61 63 74 69 6f 6e 20 77 65 27 6c 6c ial action we'll
39530 0a 20 20 20 20 23 20 64 6f 20 74 68 61 74 20 61 . # do that a
39540 6e 64 20 64 6f 20 61 20 22 72 65 74 75 72 6e 20 nd do a "return
39550 2d 63 6f 64 65 20 62 72 65 61 6b 22 20 74 6f 20 -code break" to
39560 6b 65 65 70 20 61 64 64 69 74 69 6f 6e 61 6c 0a keep additional.
39570 20 20 20 20 23 20 62 69 6e 64 69 6e 67 73 20 66 # bindings f
39580 72 6f 6d 20 66 69 72 69 6e 67 2e 20 4f 74 68 65 rom firing. Othe
39590 72 77 69 73 65 20 77 65 27 6c 6c 20 6c 65 74 20 rwise we'll let
395a0 74 68 65 20 65 76 65 6e 74 20 66 61 6c 6c 0a 20 the event fall.
395b0 20 20 20 23 20 6f 6e 20 74 68 72 6f 75 67 68 2e # on through.
395c0 0a 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 24 . switch -- $
395d0 65 76 65 6e 74 20 7b 0a 20 20 20 20 22 3c 4d 6f event {. "<Mo
395e0 75 73 65 57 68 65 65 6c 3e 22 20 7b 0a 09 20 20 useWheel>" {..
395f0 20 20 69 66 20 7b 5b 77 69 6e 66 6f 20 69 73 6d if {[winfo ism
39600 61 70 70 65 64 20 24 77 69 64 67 65 74 73 28 64 apped $widgets(d
39610 72 6f 70 64 6f 77 6e 29 5d 7d 20 7b 0a 09 09 73 ropdown)]} {...s
39620 65 74 20 44 20 5b 6c 69 6e 64 65 78 20 24 61 72 et D [lindex $ar
39630 67 73 20 30 5d 0a 09 09 23 20 74 68 65 20 27 31 gs 0]...# the '1
39640 32 30 27 20 6e 75 6d 62 65 72 20 69 6e 20 74 68 20' number in th
39650 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 e following expr
39660 65 73 73 69 6f 6e 20 68 61 73 0a 09 09 23 20 69 ession has...# i
39670 74 27 73 20 67 65 6e 65 73 69 73 20 69 6e 20 74 t's genesis in t
39680 68 65 20 74 6b 20 62 69 6e 64 20 6d 61 6e 70 61 he tk bind manpa
39690 67 65 2c 20 77 68 69 63 68 20 73 75 67 67 65 73 ge, which sugges
396a0 74 73 0a 09 09 23 20 74 68 61 74 20 74 68 65 20 ts...# that the
396b0 73 6d 61 6c 6c 65 73 74 20 76 61 6c 75 65 20 6f smallest value o
396c0 66 20 25 44 20 66 6f 72 20 6d 6f 75 73 65 77 68 f %D for mousewh
396d0 65 65 6c 20 65 76 65 6e 74 73 0a 09 09 23 20 77 eel events...# w
396e0 69 6c 6c 20 62 65 20 31 32 30 2e 20 54 68 65 20 ill be 120. The
396f0 69 6e 74 65 6e 74 20 69 73 20 74 6f 20 73 63 72 intent is to scr
39700 6f 6c 6c 20 6f 6e 65 20 6c 69 6e 65 20 61 74 20 oll one line at
39710 61 20 74 69 6d 65 2e 0a 09 09 24 77 69 64 67 65 a time....$widge
39720 74 73 28 6c 69 73 74 62 6f 78 29 20 79 76 69 65 ts(listbox) yvie
39730 77 20 73 63 72 6f 6c 6c 20 5b 65 78 70 72 20 7b w scroll [expr {
39740 2d 28 24 44 2f 31 32 30 29 7d 5d 20 75 6e 69 74 -($D/120)}] unit
39750 73 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 s.. }..}.
39760 22 3c 41 6e 79 2d 4b 65 79 50 72 65 73 73 3e 22 "<Any-KeyPress>"
39770 20 7b 0a 09 20 20 20 20 23 20 69 66 20 74 68 65 {.. # if the
39780 20 77 69 64 67 65 74 20 69 73 20 65 64 69 74 61 widget is edita
39790 62 6c 65 2c 20 63 6c 65 61 72 20 74 68 65 20 73 ble, clear the s
397a0 65 6c 65 63 74 69 6f 6e 2e 0a 09 20 20 20 20 23 election... #
397b0 20 74 68 69 73 20 6d 61 6b 65 73 20 69 74 20 6d this makes it m
397c0 6f 72 65 20 6f 62 76 69 6f 75 73 20 77 68 61 74 ore obvious what
397d0 20 77 69 6c 6c 20 68 61 70 70 65 6e 20 69 66 20 will happen if
397e0 74 68 65 0a 09 20 20 20 20 23 20 75 73 65 72 20 the.. # user
397f0 70 72 65 73 73 65 73 20 3c 52 65 74 75 72 6e 3e presses <Return>
39800 20 28 61 6e 64 20 68 65 6c 70 73 20 6f 75 72 20 (and helps our
39810 63 6f 64 65 20 6b 6e 6f 77 20 77 68 61 74 0a 09 code know what..
39820 20 20 20 20 23 20 74 6f 20 64 6f 20 69 66 20 74 # to do if t
39830 68 65 20 75 73 65 72 20 70 72 65 73 73 65 73 20 he user presses
39840 72 65 74 75 72 6e 29 0a 09 20 20 20 20 69 66 20 return).. if
39850 7b 24 6f 70 74 69 6f 6e 73 28 2d 65 64 69 74 61 {$options(-edita
39860 62 6c 65 29 7d 20 7b 0a 09 09 24 77 69 64 67 65 ble)} {...$widge
39870 74 73 28 6c 69 73 74 62 6f 78 29 20 73 65 65 20 ts(listbox) see
39880 30 0a 09 09 24 77 69 64 67 65 74 73 28 6c 69 73 0...$widgets(lis
39890 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 tbox) selection
398a0 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 09 24 77 clear 0 end...$w
398b0 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 idgets(listbox)
398c0 73 65 6c 65 63 74 69 6f 6e 20 61 6e 63 68 6f 72 selection anchor
398d0 20 30 0a 09 09 24 77 69 64 67 65 74 73 28 6c 69 0...$widgets(li
398e0 73 74 62 6f 78 29 20 61 63 74 69 76 61 74 65 20 stbox) activate
398f0 30 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 0.. }..}.
39900 22 3c 46 6f 63 75 73 49 6e 3e 22 20 7b 0a 09 20 "<FocusIn>" {..
39910 20 20 20 73 65 74 20 6f 6c 64 56 61 6c 75 65 20 set oldValue
39920 5b 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 [$widgets(entry)
39930 20 67 65 74 5d 0a 09 7d 0a 20 20 20 20 22 3c 46 get]..}. "<F
39940 6f 63 75 73 4f 75 74 3e 22 20 7b 0a 09 20 20 20 ocusOut>" {..
39950 20 69 66 20 7b 21 5b 77 69 6e 66 6f 20 69 73 6d if {![winfo ism
39960 61 70 70 65 64 20 24 77 69 64 67 65 74 73 28 64 apped $widgets(d
39970 72 6f 70 64 6f 77 6e 29 5d 7d 20 7b 0a 09 09 23 ropdown)]} {...#
39980 20 64 69 64 20 74 68 65 20 76 61 6c 75 65 20 63 did the value c
39990 68 61 6e 67 65 3f 0a 09 09 73 65 74 20 6e 65 77 hange?...set new
399a0 56 61 6c 75 65 20 5b 24 77 69 64 67 65 74 73 28 Value [$widgets(
399b0 65 6e 74 72 79 29 20 67 65 74 5d 0a 09 09 69 66 entry) get]...if
399c0 20 7b 24 6f 6c 64 56 61 6c 75 65 20 21 3d 20 24 {$oldValue != $
399d0 6e 65 77 56 61 6c 75 65 7d 20 7b 0a 09 09 20 20 newValue} {...
399e0 20 20 43 61 6c 6c 43 6f 6d 6d 61 6e 64 20 24 77 CallCommand $w
399f0 69 64 67 65 74 73 28 74 68 69 73 29 20 24 6e 65 idgets(this) $ne
39a00 77 56 61 6c 75 65 0a 09 09 7d 0a 09 20 20 20 20 wValue...}..
39a10 7d 0a 09 7d 0a 20 20 20 20 22 3c 31 3e 22 20 7b }..}. "<1>" {
39a20 0a 09 20 20 20 20 73 65 74 20 65 64 69 74 61 62 .. set editab
39a30 6c 65 20 5b 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a le [::combobox::
39a40 47 65 74 42 6f 6f 6c 65 61 6e 20 24 6f 70 74 69 GetBoolean $opti
39a50 6f 6e 73 28 2d 65 64 69 74 61 62 6c 65 29 5d 0a ons(-editable)].
39a60 09 20 20 20 20 69 66 20 7b 21 24 65 64 69 74 61 . if {!$edita
39a70 62 6c 65 7d 20 7b 0a 09 09 69 66 20 7b 5b 77 69 ble} {...if {[wi
39a80 6e 66 6f 20 69 73 6d 61 70 70 65 64 20 24 77 69 nfo ismapped $wi
39a90 64 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d dgets(dropdown)]
39aa0 7d 20 7b 0a 09 09 20 20 20 20 24 77 69 64 67 65 } {... $widge
39ab0 74 73 28 74 68 69 73 29 20 63 6c 6f 73 65 0a 09 ts(this) close..
39ac0 09 20 20 20 20 72 65 74 75 72 6e 20 2d 63 6f 64 . return -cod
39ad0 65 20 62 72 65 61 6b 0a 09 09 7d 20 65 6c 73 65 e break...} else
39ae0 20 7b 0a 09 09 20 20 20 20 69 66 20 7b 24 6f 70 {... if {$op
39af0 74 69 6f 6e 73 28 2d 73 74 61 74 65 29 20 21 3d tions(-state) !=
39b00 20 22 64 69 73 61 62 6c 65 64 22 7d 20 7b 0a 09 "disabled"} {..
39b10 09 20 20 20 20 20 20 20 20 24 77 69 64 67 65 74 . $widget
39b20 73 28 74 68 69 73 29 20 6f 70 65 6e 0a 09 09 20 s(this) open...
39b30 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63 return -c
39b40 6f 64 65 20 62 72 65 61 6b 0a 09 09 20 20 20 20 ode break...
39b50 7d 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 7d 0a }...}.. }..}.
39b60 20 20 20 20 22 3c 44 6f 75 62 6c 65 2d 31 3e 22 "<Double-1>"
39b70 20 7b 0a 09 20 20 20 20 69 66 20 7b 24 6f 70 74 {.. if {$opt
39b80 69 6f 6e 73 28 2d 73 74 61 74 65 29 20 21 3d 20 ions(-state) !=
39b90 22 64 69 73 61 62 6c 65 64 22 7d 20 7b 0a 09 09 "disabled"} {...
39ba0 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 74 $widgets(this) t
39bb0 6f 67 67 6c 65 0a 09 09 72 65 74 75 72 6e 20 2d oggle...return -
39bc0 63 6f 64 65 20 62 72 65 61 6b 0a 09 20 20 20 20 code break..
39bd0 7d 0a 09 7d 0a 20 20 20 20 22 3c 54 61 62 3e 22 }..}. "<Tab>"
39be0 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 6e {.. if {[win
39bf0 66 6f 20 69 73 6d 61 70 70 65 64 20 24 77 69 64 fo ismapped $wid
39c00 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d 7d gets(dropdown)]}
39c10 20 7b 0a 09 09 3a 3a 63 6f 6d 62 6f 62 6f 78 3a {...::combobox:
39c20 3a 46 69 6e 64 20 24 77 69 64 67 65 74 73 28 74 :Find $widgets(t
39c30 68 69 73 29 20 30 0a 09 09 72 65 74 75 72 6e 20 his) 0...return
39c40 2d 63 6f 64 65 20 62 72 65 61 6b 0a 09 20 20 20 -code break..
39c50 20 7d 20 65 6c 73 65 20 7b 0a 09 09 3a 3a 63 6f } else {...::co
39c60 6d 62 6f 62 6f 78 3a 3a 53 65 74 56 61 6c 75 65 mbobox::SetValue
39c70 20 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 $widgets(this)
39c80 5b 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 [$widgets(this)
39c90 67 65 74 5d 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 get].. }..}.
39ca0 20 20 20 22 3c 45 73 63 61 70 65 3e 22 20 7b 0a "<Escape>" {.
39cb0 09 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 . #
39cc0 20 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 $widgets(entry
39cd0 29 20 64 65 6c 65 74 65 20 30 20 65 6e 64 0a 09 ) delete 0 end..
39ce0 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 20 #
39cf0 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 $widgets(entry)
39d00 20 69 6e 73 65 72 74 20 30 20 24 6f 6c 64 56 61 insert 0 $oldVa
39d10 6c 75 65 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 lue.. if {[wi
39d20 6e 66 6f 20 69 73 6d 61 70 70 65 64 20 24 77 69 nfo ismapped $wi
39d30 64 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d dgets(dropdown)]
39d40 7d 20 7b 0a 09 09 24 77 69 64 67 65 74 73 28 74 } {...$widgets(t
39d50 68 69 73 29 20 63 6c 6f 73 65 0a 09 09 72 65 74 his) close...ret
39d60 75 72 6e 20 2d 63 6f 64 65 20 62 72 65 61 6b 0a urn -code break.
39d70 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 22 3c . }..}. "<
39d80 52 65 74 75 72 6e 3e 22 20 7b 0a 09 20 20 20 20 Return>" {..
39d90 23 20 64 69 64 20 74 68 65 20 76 61 6c 75 65 20 # did the value
39da0 63 68 61 6e 67 65 3f 0a 09 20 20 20 20 73 65 74 change?.. set
39db0 20 6e 65 77 56 61 6c 75 65 20 5b 24 77 69 64 67 newValue [$widg
39dc0 65 74 73 28 65 6e 74 72 79 29 20 67 65 74 5d 0a ets(entry) get].
39dd0 09 20 20 20 20 69 66 20 7b 24 6f 6c 64 56 61 6c . if {$oldVal
39de0 75 65 20 21 3d 20 24 6e 65 77 56 61 6c 75 65 7d ue != $newValue}
39df0 20 7b 0a 09 09 43 61 6c 6c 43 6f 6d 6d 61 6e 64 {...CallCommand
39e00 20 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 $widgets(this)
39e10 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d $newValue.. }
39e20 0a 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 6e 66 ... if {[winf
39e30 6f 20 69 73 6d 61 70 70 65 64 20 24 77 69 64 67 o ismapped $widg
39e40 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d 7d 20 ets(dropdown)]}
39e50 7b 0a 09 09 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a {...::combobox::
39e60 53 65 6c 65 63 74 20 24 77 69 64 67 65 74 73 28 Select $widgets(
39e70 74 68 69 73 29 20 5c 0a 09 09 20 20 5b 24 77 69 this) \... [$wi
39e80 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 63 dgets(listbox) c
39e90 75 72 73 65 6c 65 63 74 69 6f 6e 5d 0a 09 09 72 urselection]...r
39ea0 65 74 75 72 6e 20 2d 63 6f 64 65 20 62 72 65 61 eturn -code brea
39eb0 6b 0a 09 20 20 20 20 7d 0a 0a 09 7d 0a 20 20 20 k.. }...}.
39ec0 20 22 3c 4e 65 78 74 3e 22 20 7b 0a 09 20 20 20 "<Next>" {..
39ed0 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f $widgets(listbo
39ee0 78 29 20 79 76 69 65 77 20 73 63 72 6f 6c 6c 20 x) yview scroll
39ef0 31 20 70 61 67 65 73 0a 09 20 20 20 20 73 65 74 1 pages.. set
39f00 20 69 6e 64 65 78 20 5b 24 77 69 64 67 65 74 73 index [$widgets
39f10 28 6c 69 73 74 62 6f 78 29 20 69 6e 64 65 78 20 (listbox) index
39f20 40 30 2c 30 5d 0a 09 20 20 20 20 24 77 69 64 67 @0,0].. $widg
39f30 65 74 73 28 6c 69 73 74 62 6f 78 29 20 73 65 65 ets(listbox) see
39f40 20 24 69 6e 64 65 78 0a 09 20 20 20 20 24 77 69 $index.. $wi
39f50 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 61 dgets(listbox) a
39f60 63 74 69 76 61 74 65 20 24 69 6e 64 65 78 0a 09 ctivate $index..
39f70 20 20 20 20 24 77 69 64 67 65 74 73 28 6c 69 73 $widgets(lis
39f80 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 tbox) selection
39f90 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 20 20 20 clear 0 end..
39fa0 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f $widgets(listbo
39fb0 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 61 6e 63 x) selection anc
39fc0 68 6f 72 20 24 69 6e 64 65 78 0a 09 20 20 20 20 hor $index..
39fd0 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 $widgets(listbox
39fe0 29 20 73 65 6c 65 63 74 69 6f 6e 20 73 65 74 20 ) selection set
39ff0 24 69 6e 64 65 78 0a 0a 09 7d 0a 20 20 20 20 22 $index...}. "
3a000 3c 50 72 69 6f 72 3e 22 20 7b 0a 09 20 20 20 20 <Prior>" {..
3a010 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 $widgets(listbox
3a020 29 20 79 76 69 65 77 20 73 63 72 6f 6c 6c 20 2d ) yview scroll -
3a030 31 20 70 61 67 65 73 0a 09 20 20 20 20 73 65 74 1 pages.. set
3a040 20 69 6e 64 65 78 20 5b 24 77 69 64 67 65 74 73 index [$widgets
3a050 28 6c 69 73 74 62 6f 78 29 20 69 6e 64 65 78 20 (listbox) index
3a060 40 30 2c 30 5d 0a 09 20 20 20 20 24 77 69 64 67 @0,0].. $widg
3a070 65 74 73 28 6c 69 73 74 62 6f 78 29 20 61 63 74 ets(listbox) act
3a080 69 76 61 74 65 20 24 69 6e 64 65 78 0a 09 20 20 ivate $index..
3a090 20 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 $widgets(listb
3a0a0 6f 78 29 20 73 65 65 20 24 69 6e 64 65 78 0a 09 ox) see $index..
3a0b0 20 20 20 20 24 77 69 64 67 65 74 73 28 6c 69 73 $widgets(lis
3a0c0 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 tbox) selection
3a0d0 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 20 20 20 clear 0 end..
3a0e0 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f $widgets(listbo
3a0f0 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 61 6e 63 x) selection anc
3a100 68 6f 72 20 24 69 6e 64 65 78 0a 09 20 20 20 20 hor $index..
3a110 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 $widgets(listbox
3a120 29 20 73 65 6c 65 63 74 69 6f 6e 20 73 65 74 20 ) selection set
3a130 24 69 6e 64 65 78 0a 09 7d 0a 20 20 20 20 22 3c $index..}. "<
3a140 44 6f 77 6e 3e 22 20 7b 0a 09 20 20 20 20 69 66 Down>" {.. if
3a150 20 7b 5b 77 69 6e 66 6f 20 69 73 6d 61 70 70 65 {[winfo ismappe
3a160 64 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 d $widgets(dropd
3a170 6f 77 6e 29 5d 7d 20 7b 0a 09 09 3a 3a 63 6f 6d own)]} {...::com
3a180 62 6f 62 6f 78 3a 3a 74 6b 4c 69 73 74 62 6f 78 bobox::tkListbox
3a190 55 70 44 6f 77 6e 20 24 77 69 64 67 65 74 73 28 UpDown $widgets(
3a1a0 6c 69 73 74 62 6f 78 29 20 31 0a 09 09 72 65 74 listbox) 1...ret
3a1b0 75 72 6e 20 2d 63 6f 64 65 20 62 72 65 61 6b 0a urn -code break.
3a1c0 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09 . } else {...
3a1d0 69 66 20 7b 24 6f 70 74 69 6f 6e 73 28 2d 73 74 if {$options(-st
3a1e0 61 74 65 29 20 21 3d 20 22 64 69 73 61 62 6c 65 ate) != "disable
3a1f0 64 22 7d 20 7b 0a 09 09 20 20 20 20 24 77 69 64 d"} {... $wid
3a200 67 65 74 73 28 74 68 69 73 29 20 6f 70 65 6e 0a gets(this) open.
3a210 09 09 20 20 20 20 72 65 74 75 72 6e 20 2d 63 6f .. return -co
3a220 64 65 20 62 72 65 61 6b 0a 09 09 7d 0a 09 20 20 de break...}..
3a230 20 20 7d 0a 09 7d 0a 20 20 20 20 22 3c 55 70 3e }..}. "<Up>
3a240 22 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 " {.. if {[wi
3a250 6e 66 6f 20 69 73 6d 61 70 70 65 64 20 24 77 69 nfo ismapped $wi
3a260 64 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d dgets(dropdown)]
3a270 7d 20 7b 0a 09 09 3a 3a 63 6f 6d 62 6f 62 6f 78 } {...::combobox
3a280 3a 3a 74 6b 4c 69 73 74 62 6f 78 55 70 44 6f 77 ::tkListboxUpDow
3a290 6e 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 n $widgets(listb
3a2a0 6f 78 29 20 2d 31 0a 09 09 72 65 74 75 72 6e 20 ox) -1...return
3a2b0 2d 63 6f 64 65 20 62 72 65 61 6b 0a 09 20 20 20 -code break..
3a2c0 20 7d 20 65 6c 73 65 20 7b 0a 09 09 69 66 20 7b } else {...if {
3a2d0 24 6f 70 74 69 6f 6e 73 28 2d 73 74 61 74 65 29 $options(-state)
3a2e0 20 21 3d 20 22 64 69 73 61 62 6c 65 64 22 7d 20 != "disabled"}
3a2f0 7b 0a 09 09 20 20 20 20 24 77 69 64 67 65 74 73 {... $widgets
3a300 28 74 68 69 73 29 20 6f 70 65 6e 0a 09 09 20 20 (this) open...
3a310 20 20 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 62 return -code b
3a320 72 65 61 6b 0a 09 09 7d 0a 09 20 20 20 20 7d 0a reak...}.. }.
3a330 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 .}. }.. re
3a340 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 3a 3a 63 turn "".}..# ::c
3a350 6f 6d 62 6f 62 6f 78 3a 3a 44 65 73 74 72 6f 79 ombobox::Destroy
3a360 48 61 6e 64 6c 65 72 20 7b 77 7d 20 2d 2d 0a 23 Handler {w} --.#
3a370 0a 23 20 20 20 20 43 6c 65 61 6e 73 20 75 70 20 .# Cleans up
3a380 61 66 74 65 72 20 61 20 63 6f 6d 62 6f 62 6f 78 after a combobox
3a390 20 77 69 64 67 65 74 20 69 73 20 64 65 73 74 72 widget is destr
3a3a0 6f 79 65 64 0a 23 0a 23 20 41 72 67 75 6d 65 6e oyed.#.# Argumen
3a3b0 74 73 3a 0a 23 0a 23 20 20 20 20 77 20 20 20 20 ts:.#.# w
3a3c0 77 69 64 67 65 74 20 70 61 74 68 6e 61 6d 65 0a widget pathname.
3a3d0 23 0a 23 20 52 65 73 75 6c 74 73 3a 0a 23 0a 23 #.# Results:.#.#
3a3e0 20 20 20 20 54 68 65 20 6e 61 6d 65 73 70 61 63 The namespac
3a3f0 65 20 74 68 61 74 20 77 61 73 20 63 72 65 61 74 e that was creat
3a400 65 64 20 66 6f 72 20 74 68 65 20 77 69 64 67 65 ed for the widge
3a410 74 20 69 73 20 64 65 6c 65 74 65 64 2c 0a 23 20 t is deleted,.#
3a420 20 20 20 61 6e 64 20 74 68 65 20 77 69 64 67 65 and the widge
3a430 74 20 70 72 6f 63 20 69 73 20 72 65 6d 6f 76 65 t proc is remove
3a440 64 2e 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 6f d...proc ::combo
3a450 62 6f 78 3a 3a 44 65 73 74 72 6f 79 48 61 6e 64 box::DestroyHand
3a460 6c 65 72 20 7b 77 7d 20 7b 0a 0a 20 20 20 20 23 ler {w} {.. #
3a470 20 69 66 20 74 68 65 20 77 69 64 67 65 74 20 61 if the widget a
3a480 63 74 75 61 6c 6c 79 20 62 65 69 6e 67 20 64 65 ctually being de
3a490 73 74 72 6f 79 65 64 20 69 73 20 6f 66 20 63 6c stroyed is of cl
3a4a0 61 73 73 20 43 6f 6d 62 6f 62 6f 78 2c 0a 20 20 ass Combobox,.
3a4b0 20 20 23 20 63 72 75 73 68 20 74 68 65 20 6e 61 # crush the na
3a4c0 6d 65 73 70 61 63 65 20 61 6e 64 20 6b 69 6c 6c mespace and kill
3a4d0 20 74 68 65 20 70 72 6f 63 2e 20 47 65 74 20 69 the proc. Get i
3a4e0 74 3f 20 43 72 75 73 68 2e 20 4b 69 6c 6c 2e 0a t? Crush. Kill..
3a4f0 20 20 20 20 23 20 44 65 73 74 72 6f 79 2e 20 48 # Destroy. H
3a500 65 68 2e 20 44 61 6e 67 65 72 20 57 69 6c 6c 20 eh. Danger Will
3a510 52 6f 62 69 6e 73 6f 6e 21 20 4f 68 2c 20 6d 61 Robinson! Oh, ma
3a520 6e 21 20 49 27 6d 20 73 6f 20 66 75 6e 6e 79 20 n! I'm so funny
3a530 69 74 0a 20 20 20 20 23 20 62 72 69 6e 67 73 20 it. # brings
3a540 74 65 61 72 73 20 74 6f 20 6d 79 20 65 79 65 73 tears to my eyes
3a550 2e 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e .. if {[strin
3a560 67 20 63 6f 6d 70 61 72 65 20 5b 77 69 6e 66 6f g compare [winfo
3a570 20 63 6c 61 73 73 20 24 77 5d 20 22 43 6f 6d 62 class $w] "Comb
3a580 6f 62 6f 78 22 5d 20 3d 3d 20 30 7d 20 7b 0a 09 obox"] == 0} {..
3a590 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 upvar ::combobox
3a5a0 3a 3a 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 ::${w}::widgets
3a5b0 77 69 64 67 65 74 73 0a 09 75 70 76 61 72 20 3a widgets..upvar :
3a5c0 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a :combobox::${w}:
3a5d0 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 :options options
3a5e0 0a 0a 09 23 20 64 65 6c 65 74 65 20 74 68 65 20 ...# delete the
3a5f0 6e 61 6d 65 73 70 61 63 65 20 61 6e 64 20 74 68 namespace and th
3a600 65 20 70 72 6f 63 20 77 68 69 63 68 20 72 65 70 e proc which rep
3a610 72 65 73 65 6e 74 73 0a 09 23 20 6f 75 72 20 77 resents..# our w
3a620 69 64 67 65 74 0a 09 6e 61 6d 65 73 70 61 63 65 idget..namespace
3a630 20 64 65 6c 65 74 65 20 3a 3a 63 6f 6d 62 6f 62 delete ::combob
3a640 6f 78 3a 3a 24 77 0a 09 72 65 6e 61 6d 65 20 24 ox::$w..rename $
3a650 77 20 7b 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 w {}. }..
3a660 72 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 3a return "".}..# :
3a670 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 46 69 6e 64 0a :combobox::Find.
3a680 23 0a 23 20 20 20 20 66 69 6e 64 73 20 73 6f 6d #.# finds som
3a690 65 74 68 69 6e 67 20 69 6e 20 74 68 65 20 6c 69 ething in the li
3a6a0 73 74 62 6f 78 20 74 68 61 74 20 6d 61 74 63 68 stbox that match
3a6b0 65 73 20 74 68 65 20 70 61 74 74 65 72 6e 20 69 es the pattern i
3a6c0 6e 20 74 68 65 0a 23 20 20 20 20 65 6e 74 72 79 n the.# entry
3a6d0 20 77 69 64 67 65 74 20 61 6e 64 20 73 65 6c 65 widget and sele
3a6e0 63 74 73 20 69 74 0a 23 0a 23 20 20 20 20 4e 2e cts it.#.# N.
3a6f0 42 2e 20 49 27 6d 20 6e 6f 74 20 63 6f 6e 76 69 B. I'm not convi
3a700 6e 63 65 64 20 74 68 69 73 20 69 73 20 77 6f 72 nced this is wor
3a710 6b 69 6e 67 20 74 68 65 20 77 61 79 20 69 74 20 king the way it
3a720 6f 75 67 68 74 20 74 6f 2e 20 49 74 0a 23 20 20 ought to. It.#
3a730 20 20 77 6f 72 6b 73 2c 20 62 75 74 20 69 73 20 works, but is
3a740 74 68 65 20 62 65 68 61 76 69 6f 72 20 77 68 61 the behavior wha
3a750 74 20 69 73 20 65 78 70 65 63 74 65 64 3f 20 49 t is expected? I
3a760 27 76 65 20 61 6c 73 6f 20 67 6f 74 20 61 20 67 've also got a g
3a770 75 74 0a 23 20 20 20 20 66 65 65 6c 69 6e 67 20 ut.# feeling
3a780 74 68 61 74 20 74 68 65 72 65 27 73 20 61 20 62 that there's a b
3a790 65 74 74 65 72 20 77 61 79 20 74 6f 20 64 6f 20 etter way to do
3a7a0 74 68 69 73 2c 20 62 75 74 20 49 27 6d 20 74 6f this, but I'm to
3a7b0 6f 20 6c 61 7a 79 20 74 6f 0a 23 20 20 20 20 66 o lazy to.# f
3a7c0 69 67 75 72 65 20 69 74 20 6f 75 74 2e 2e 2e 0a igure it out....
3a7d0 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 #.# Arguments:.#
3a7e0 0a 23 20 20 20 20 77 20 20 20 20 20 20 77 69 64 .# w wid
3a7f0 67 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 20 20 get pathname.#
3a800 20 20 65 78 61 63 74 20 20 62 6f 6f 6c 65 61 6e exact boolean
3a810 3b 20 69 66 20 74 72 75 65 20 61 6e 20 65 78 61 ; if true an exa
3a820 63 74 20 6d 61 74 63 68 20 69 73 20 64 65 73 69 ct match is desi
3a830 72 65 64 0a 23 0a 23 20 52 65 74 75 72 6e 73 3a red.#.# Returns:
3a840 0a 23 0a 23 20 20 20 20 45 6d 70 74 79 20 73 74 .#.# Empty st
3a850 72 69 6e 67 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d ring..proc ::com
3a860 62 6f 62 6f 78 3a 3a 46 69 6e 64 20 7b 77 20 7b bobox::Find {w {
3a870 65 78 61 63 74 20 30 7d 7d 20 7b 0a 20 20 20 20 exact 0}} {.
3a880 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 upvar ::combobox
3a890 3a 3a 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 ::${w}::widgets
3a8a0 77 69 64 67 65 74 73 0a 20 20 20 20 75 70 76 61 widgets. upva
3a8b0 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b r ::combobox::${
3a8c0 77 7d 3a 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 w}::options opti
3a8d0 6f 6e 73 0a 0a 20 20 20 20 23 23 20 2a 73 69 67 ons.. ## *sig
3a8e0 68 2a 20 74 68 69 73 20 6c 6f 67 69 63 20 69 73 h* this logic is
3a8f0 20 72 61 74 68 65 72 20 67 72 6f 73 73 20 61 6e rather gross an
3a900 64 20 63 6f 6e 76 6f 6c 75 74 65 64 2e 20 53 75 d convoluted. Su
3a910 72 65 6c 79 0a 20 20 20 20 23 23 20 74 68 65 72 rely. ## ther
3a920 65 20 69 73 20 61 20 6d 6f 72 65 20 73 69 6d 70 e is a more simp
3a930 6c 65 2c 20 73 74 72 61 69 67 68 74 2d 66 6f 72 le, straight-for
3a940 77 61 72 64 20 77 61 79 20 74 6f 20 69 6d 70 6c ward way to impl
3a950 65 6d 65 6e 74 0a 20 20 20 20 23 23 20 61 6c 6c ement. ## all
3a960 20 74 68 69 73 2e 20 41 73 20 74 68 65 20 73 61 this. As the sa
3a970 79 69 6e 67 20 67 6f 65 73 2c 20 49 20 6c 61 63 ying goes, I lac
3a980 6b 20 74 68 65 20 74 69 6d 65 20 74 6f 20 6d 61 k the time to ma
3a990 6b 65 20 69 74 0a 20 20 20 20 23 23 20 73 68 6f ke it. ## sho
3a9a0 72 74 65 72 2e 2e 2e 0a 0a 20 20 20 20 23 20 75 rter..... # u
3a9b0 73 65 20 77 68 61 74 20 69 73 20 61 6c 72 65 61 se what is alrea
3a9c0 64 79 20 69 6e 20 74 68 65 20 65 6e 74 72 79 20 dy in the entry
3a9d0 77 69 64 67 65 74 20 61 73 20 61 20 70 61 74 74 widget as a patt
3a9e0 65 72 6e 0a 20 20 20 20 73 65 74 20 70 61 74 74 ern. set patt
3a9f0 65 72 6e 20 5b 24 77 69 64 67 65 74 73 28 65 6e ern [$widgets(en
3aa00 74 72 79 29 20 67 65 74 5d 0a 0a 20 20 20 20 69 try) get].. i
3aa10 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
3aa20 68 20 24 70 61 74 74 65 72 6e 5d 20 3d 3d 20 30 h $pattern] == 0
3aa30 7d 20 7b 0a 09 23 20 63 6c 65 61 72 20 74 68 65 } {..# clear the
3aa40 20 63 75 72 72 65 6e 74 20 73 65 6c 65 63 74 69 current selecti
3aa50 6f 6e 0a 09 24 77 69 64 67 65 74 73 28 6c 69 73 on..$widgets(lis
3aa60 74 62 6f 78 29 20 73 65 65 20 30 0a 09 24 77 69 tbox) see 0..$wi
3aa70 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 73 dgets(listbox) s
3aa80 65 6c 65 63 74 69 6f 6e 20 63 6c 65 61 72 20 30 election clear 0
3aa90 20 65 6e 64 0a 09 24 77 69 64 67 65 74 73 28 6c end..$widgets(l
3aaa0 69 73 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f istbox) selectio
3aab0 6e 20 61 6e 63 68 6f 72 20 30 0a 09 24 77 69 64 n anchor 0..$wid
3aac0 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 61 63 gets(listbox) ac
3aad0 74 69 76 61 74 65 20 30 0a 09 72 65 74 75 72 6e tivate 0..return
3aae0 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 77 65 . }.. # we
3aaf0 27 72 65 20 67 6f 69 6e 67 20 74 6f 20 62 65 20 're going to be
3ab00 73 65 61 72 63 68 69 6e 67 20 74 68 69 73 20 6c searching this l
3ab10 69 73 74 2e 2e 2e 0a 20 20 20 20 73 65 74 20 6c ist.... set l
3ab20 69 73 74 20 5b 24 77 69 64 67 65 74 73 28 6c 69 ist [$widgets(li
3ab30 73 74 62 6f 78 29 20 67 65 74 20 30 20 65 6e 64 stbox) get 0 end
3ab40 5d 0a 0a 20 20 20 20 23 20 69 66 20 77 65 20 61 ].. # if we a
3ab50 72 65 20 64 6f 69 6e 67 20 61 6e 20 65 78 61 63 re doing an exac
3ab60 74 20 6d 61 74 63 68 2c 20 74 72 79 20 74 6f 20 t match, try to
3ab70 66 69 6e 64 2c 0a 20 20 20 20 23 20 77 65 6c 6c find,. # well
3ab80 2c 20 61 6e 20 65 78 61 63 74 20 6d 61 74 63 68 , an exact match
3ab90 0a 20 20 20 20 73 65 74 20 65 78 61 63 74 4d 61 . set exactMa
3aba0 74 63 68 20 2d 31 0a 20 20 20 20 69 66 20 7b 24 tch -1. if {$
3abb0 65 78 61 63 74 7d 20 7b 0a 09 73 65 74 20 65 78 exact} {..set ex
3abc0 61 63 74 4d 61 74 63 68 20 5b 6c 73 65 61 72 63 actMatch [lsearc
3abd0 68 20 2d 65 78 61 63 74 20 24 6c 69 73 74 20 24 h -exact $list $
3abe0 70 61 74 74 65 72 6e 5d 0a 20 20 20 20 7d 0a 0a pattern]. }..
3abf0 20 20 20 20 23 20 73 65 61 72 63 68 20 66 6f 72 # search for
3ac00 20 69 74 2e 20 57 65 27 6c 6c 20 74 72 79 20 74 it. We'll try t
3ac10 6f 20 62 65 20 63 6c 65 76 65 72 20 61 6e 64 20 o be clever and
3ac20 6e 6f 74 20 6f 6e 6c 79 0a 20 20 20 20 23 20 73 not only. # s
3ac30 65 61 72 63 68 20 66 6f 72 20 61 20 6d 61 74 63 earch for a matc
3ac40 68 20 66 6f 72 20 77 68 61 74 20 74 68 65 79 20 h for what they
3ac50 74 79 70 65 64 2c 20 62 75 74 20 61 20 6d 61 74 typed, but a mat
3ac60 63 68 20 66 6f 72 0a 20 20 20 20 23 20 73 6f 6d ch for. # som
3ac70 65 74 68 69 6e 67 20 63 6c 6f 73 65 20 74 6f 20 ething close to
3ac80 77 68 61 74 20 74 68 65 79 20 74 79 70 65 64 2e what they typed.
3ac90 20 57 65 27 6c 6c 20 6b 65 65 70 20 72 65 6d 6f We'll keep remo
3aca0 76 69 6e 67 20 6f 6e 65 0a 20 20 20 20 23 20 63 ving one. # c
3acb0 68 61 72 61 63 74 65 72 20 61 74 20 61 20 74 69 haracter at a ti
3acc0 6d 65 20 66 72 6f 6d 20 74 68 65 20 70 61 74 74 me from the patt
3acd0 65 72 6e 20 75 6e 74 69 6c 20 77 65 20 66 69 6e ern until we fin
3ace0 64 20 61 20 6d 61 74 63 68 0a 20 20 20 20 23 20 d a match. #
3acf0 6f 66 20 73 6f 6d 65 20 73 6f 72 74 2e 0a 20 20 of some sort..
3ad00 20 20 73 65 74 20 69 6e 64 65 78 20 2d 31 0a 20 set index -1.
3ad10 20 20 20 77 68 69 6c 65 20 7b 24 69 6e 64 65 78 while {$index
3ad20 20 3d 3d 20 2d 31 20 26 26 20 5b 73 74 72 69 6e == -1 && [strin
3ad30 67 20 6c 65 6e 67 74 68 20 24 70 61 74 74 65 72 g length $patter
3ad40 6e 5d 7d 20 7b 0a 09 73 65 74 20 69 6e 64 65 78 n]} {..set index
3ad50 20 5b 6c 73 65 61 72 63 68 20 2d 67 6c 6f 62 20 [lsearch -glob
3ad60 24 6c 69 73 74 20 22 24 70 61 74 74 65 72 6e 2a $list "$pattern*
3ad70 22 5d 0a 09 69 66 20 7b 24 69 6e 64 65 78 20 3d "]..if {$index =
3ad80 3d 20 2d 31 7d 20 7b 0a 09 20 20 20 20 72 65 67 = -1} {.. reg
3ad90 73 75 62 20 7b 2e 24 7d 20 24 70 61 74 74 65 72 sub {.$} $patter
3ada0 6e 20 7b 7d 20 70 61 74 74 65 72 6e 0a 09 7d 0a n {} pattern..}.
3adb0 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 74 68 69 }.. # thi
3adc0 73 20 69 73 20 74 68 65 20 69 74 65 6d 20 74 68 s is the item th
3add0 61 74 20 6d 6f 73 74 20 63 6c 6f 73 65 6c 79 20 at most closely
3ade0 6d 61 74 63 68 65 73 2e 2e 2e 0a 20 20 20 20 73 matches.... s
3adf0 65 74 20 74 68 69 73 49 74 65 6d 20 5b 6c 69 6e et thisItem [lin
3ae00 64 65 78 20 24 6c 69 73 74 20 24 69 6e 64 65 78 dex $list $index
3ae10 5d 0a 0a 20 20 20 20 23 20 64 69 64 20 77 65 20 ].. # did we
3ae20 66 69 6e 64 20 61 20 6d 61 74 63 68 3f 20 49 66 find a match? If
3ae30 20 73 6f 2c 20 64 6f 20 73 6f 6d 65 20 61 64 64 so, do some add
3ae40 69 74 69 6f 6e 61 6c 20 6d 75 6e 67 69 6e 67 2e itional munging.
3ae50 2e 2e 0a 20 20 20 20 69 66 20 7b 24 69 6e 64 65 ... if {$inde
3ae60 78 20 21 3d 20 2d 31 7d 20 7b 0a 0a 09 23 20 77 x != -1} {...# w
3ae70 65 20 6e 65 65 64 20 74 6f 20 66 69 6e 64 20 74 e need to find t
3ae80 68 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 66 he part of the f
3ae90 69 72 73 74 20 69 74 65 6d 20 74 68 61 74 20 69 irst item that i
3aea0 73 0a 09 23 20 75 6e 69 71 75 65 20 57 52 54 20 s..# unique WRT
3aeb0 74 68 65 20 73 65 63 6f 6e 64 2e 2e 2e 20 49 20 the second... I
3aec0 6b 6e 6f 77 20 74 68 65 72 65 27 73 20 70 72 6f know there's pro
3aed0 62 61 62 6c 79 20 61 0a 09 23 20 73 69 6d 70 6c bably a..# simpl
3aee0 65 72 20 77 61 79 20 74 6f 20 64 6f 20 74 68 69 er way to do thi
3aef0 73 2e 2e 2e 0a 0a 09 73 65 74 20 6e 65 78 74 49 s......set nextI
3af00 6e 64 65 78 20 5b 65 78 70 72 20 7b 24 69 6e 64 ndex [expr {$ind
3af10 65 78 20 2b 20 31 7d 5d 0a 09 73 65 74 20 6e 65 ex + 1}]..set ne
3af20 78 74 49 74 65 6d 20 5b 6c 69 6e 64 65 78 20 24 xtItem [lindex $
3af30 6c 69 73 74 20 24 6e 65 78 74 49 6e 64 65 78 5d list $nextIndex]
3af40 0a 0a 09 23 20 77 65 20 64 6f 6e 27 74 20 72 65 ...# we don't re
3af50 61 6c 6c 79 20 6e 65 65 64 20 74 6f 20 64 6f 20 ally need to do
3af60 6d 75 63 68 20 69 66 20 74 68 65 20 6e 65 78 74 much if the next
3af70 0a 09 23 20 69 74 65 6d 20 64 6f 65 73 6e 27 74 ..# item doesn't
3af80 20 6d 61 74 63 68 20 6f 75 72 20 70 61 74 74 65 match our patte
3af90 72 6e 2e 2e 2e 0a 09 69 66 20 7b 5b 73 74 72 69 rn.....if {[stri
3afa0 6e 67 20 6d 61 74 63 68 20 24 70 61 74 74 65 72 ng match $patter
3afb0 6e 2a 20 24 6e 65 78 74 49 74 65 6d 5d 7d 20 7b n* $nextItem]} {
3afc0 0a 09 20 20 20 20 23 20 6f 6b 2c 20 74 68 65 20 .. # ok, the
3afd0 6e 65 78 74 20 69 74 65 6d 20 6d 61 74 63 68 65 next item matche
3afe0 73 20 6f 75 72 20 70 61 74 74 65 72 6e 2c 20 74 s our pattern, t
3aff0 6f 6f 0a 09 20 20 20 20 23 20 6e 6f 77 20 74 68 oo.. # now th
3b000 65 20 74 72 69 63 6b 20 69 73 20 74 6f 20 66 69 e trick is to fi
3b010 6e 64 20 74 68 65 20 66 69 72 73 74 20 63 68 61 nd the first cha
3b020 72 61 63 74 65 72 0a 09 20 20 20 20 23 20 77 68 racter.. # wh
3b030 65 72 65 20 74 68 65 79 20 2a 64 6f 6e 27 74 2a ere they *don't*
3b040 20 6d 61 74 63 68 2e 2e 2e 0a 09 20 20 20 20 73 match..... s
3b050 65 74 20 6d 61 72 6b 65 72 20 5b 73 74 72 69 6e et marker [strin
3b060 67 20 6c 65 6e 67 74 68 20 24 70 61 74 74 65 72 g length $patter
3b070 6e 5d 0a 09 20 20 20 20 77 68 69 6c 65 20 7b 24 n].. while {$
3b080 6d 61 72 6b 65 72 20 3c 3d 20 5b 73 74 72 69 6e marker <= [strin
3b090 67 20 6c 65 6e 67 74 68 20 24 70 61 74 74 65 72 g length $patter
3b0a0 6e 5d 7d 20 7b 0a 09 09 73 65 74 20 61 20 5b 73 n]} {...set a [s
3b0b0 74 72 69 6e 67 20 69 6e 64 65 78 20 24 74 68 69 tring index $thi
3b0c0 73 49 74 65 6d 20 24 6d 61 72 6b 65 72 5d 0a 09 sItem $marker]..
3b0d0 09 73 65 74 20 62 20 5b 73 74 72 69 6e 67 20 69 .set b [string i
3b0e0 6e 64 65 78 20 24 6e 65 78 74 49 74 65 6d 20 24 ndex $nextItem $
3b0f0 6d 61 72 6b 65 72 5d 0a 09 09 69 66 20 7b 5b 73 marker]...if {[s
3b100 74 72 69 6e 67 20 63 6f 6d 70 61 72 65 20 24 61 tring compare $a
3b110 20 24 62 5d 20 3d 3d 20 30 7d 20 7b 0a 09 09 20 $b] == 0} {...
3b120 20 20 20 61 70 70 65 6e 64 20 70 61 74 74 65 72 append patter
3b130 6e 20 24 61 0a 09 09 20 20 20 20 69 6e 63 72 20 n $a... incr
3b140 6d 61 72 6b 65 72 0a 09 09 7d 20 65 6c 73 65 20 marker...} else
3b150 7b 0a 09 09 20 20 20 20 62 72 65 61 6b 0a 09 09 {... break...
3b160 7d 0a 09 20 20 20 20 7d 0a 09 7d 20 65 6c 73 65 }.. }..} else
3b170 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 61 72 6b {.. set mark
3b180 65 72 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 er [string lengt
3b190 68 20 24 70 61 74 74 65 72 6e 5d 0a 09 7d 0a 0a h $pattern]..}..
3b1a0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 } else {..se
3b1b0 74 20 6d 61 72 6b 65 72 20 65 6e 64 0a 09 73 65 t marker end..se
3b1c0 74 20 69 6e 64 65 78 20 30 0a 20 20 20 20 7d 0a t index 0. }.
3b1d0 0a 20 20 20 20 23 20 6f 6b 2c 20 77 65 20 6b 6e . # ok, we kn
3b1e0 6f 77 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 ow the pattern a
3b1f0 6e 64 20 77 68 61 74 20 70 61 72 74 20 69 73 20 nd what part is
3b200 75 6e 69 71 75 65 3b 0a 20 20 20 20 23 20 75 70 unique;. # up
3b210 64 61 74 65 20 74 68 65 20 65 6e 74 72 79 20 77 date the entry w
3b220 69 64 67 65 74 20 61 6e 64 20 6c 69 73 74 62 6f idget and listbo
3b230 78 20 61 70 70 72 6f 70 72 69 61 74 65 6c 79 0a x appropriately.
3b240 20 20 20 20 69 66 20 7b 24 65 78 61 63 74 20 26 if {$exact &
3b250 26 20 24 65 78 61 63 74 4d 61 74 63 68 20 3d 3d & $exactMatch ==
3b260 20 2d 31 7d 20 7b 0a 09 23 20 74 68 69 73 20 6d -1} {..# this m
3b270 65 61 6e 73 20 77 65 20 64 69 64 6e 27 74 20 66 eans we didn't f
3b280 69 6e 64 20 61 6e 20 65 78 61 63 74 20 6d 61 74 ind an exact mat
3b290 63 68 0a 09 24 77 69 64 67 65 74 73 28 6c 69 73 ch..$widgets(lis
3b2a0 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 tbox) selection
3b2b0 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 24 77 69 clear 0 end..$wi
3b2c0 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 73 dgets(listbox) s
3b2d0 65 65 20 24 69 6e 64 65 78 0a 0a 20 20 20 20 7d ee $index.. }
3b2e0 20 65 6c 73 65 69 66 20 7b 21 24 65 78 61 63 74 elseif {!$exact
3b2f0 7d 20 7b 0a 09 23 20 74 68 69 73 20 6d 65 61 6e } {..# this mean
3b300 73 20 77 65 20 66 6f 75 6e 64 20 73 6f 6d 65 74 s we found somet
3b310 68 69 6e 67 2c 20 62 75 74 20 69 74 20 69 73 6e hing, but it isn
3b320 27 74 20 61 6e 20 65 78 61 63 74 0a 09 23 20 6d 't an exact..# m
3b330 61 74 63 68 2e 20 49 66 20 77 65 20 66 69 6e 64 atch. If we find
3b340 20 73 6f 6d 65 74 68 69 6e 67 20 74 68 61 74 20 something that
3b350 2a 69 73 2a 20 61 6e 20 65 78 61 63 74 20 6d 61 *is* an exact ma
3b360 74 63 68 20 77 65 0a 09 23 20 64 6f 6e 27 74 20 tch we..# don't
3b370 6e 65 65 64 20 74 6f 20 64 6f 20 74 68 65 20 66 need to do the f
3b380 6f 6c 6c 6f 77 69 6e 67 2c 20 73 69 6e 63 65 20 ollowing, since
3b390 69 74 20 77 6f 75 6c 64 20 6d 65 72 65 6c 79 0a it would merely.
3b3a0 09 23 20 62 65 20 72 65 70 6c 61 63 69 6e 67 20 .# be replacing
3b3b0 74 68 65 20 64 61 74 61 20 69 6e 20 74 68 65 20 the data in the
3b3c0 65 6e 74 72 79 20 77 69 64 67 65 74 20 77 69 74 entry widget wit
3b3d0 68 20 69 74 73 65 6c 66 0a 09 73 65 74 20 6f 6c h itself..set ol
3b3e0 64 73 74 61 74 65 20 5b 24 77 69 64 67 65 74 73 dstate [$widgets
3b3f0 28 65 6e 74 72 79 29 20 63 67 65 74 20 2d 73 74 (entry) cget -st
3b400 61 74 65 5d 0a 09 24 77 69 64 67 65 74 73 28 65 ate]..$widgets(e
3b410 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 72 65 20 ntry) configure
3b420 2d 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 -state normal..$
3b430 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 64 widgets(entry) d
3b440 65 6c 65 74 65 20 30 20 65 6e 64 0a 09 24 77 69 elete 0 end..$wi
3b450 64 67 65 74 73 28 65 6e 74 72 79 29 20 69 6e 73 dgets(entry) ins
3b460 65 72 74 20 65 6e 64 20 24 74 68 69 73 49 74 65 ert end $thisIte
3b470 6d 0a 09 24 77 69 64 67 65 74 73 28 65 6e 74 72 m..$widgets(entr
3b480 79 29 20 73 65 6c 65 63 74 69 6f 6e 20 63 6c 65 y) selection cle
3b490 61 72 0a 09 24 77 69 64 67 65 74 73 28 65 6e 74 ar..$widgets(ent
3b4a0 72 79 29 20 73 65 6c 65 63 74 69 6f 6e 20 72 61 ry) selection ra
3b4b0 6e 67 65 20 24 6d 61 72 6b 65 72 20 65 6e 64 0a nge $marker end.
3b4c0 09 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f .$widgets(listbo
3b4d0 78 29 20 61 63 74 69 76 61 74 65 20 24 69 6e 64 x) activate $ind
3b4e0 65 78 0a 09 24 77 69 64 67 65 74 73 28 6c 69 73 ex..$widgets(lis
3b4f0 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f 6e 20 tbox) selection
3b500 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 24 77 69 clear 0 end..$wi
3b510 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 73 dgets(listbox) s
3b520 65 6c 65 63 74 69 6f 6e 20 61 6e 63 68 6f 72 20 election anchor
3b530 24 69 6e 64 65 78 0a 09 24 77 69 64 67 65 74 73 $index..$widgets
3b540 28 6c 69 73 74 62 6f 78 29 20 73 65 6c 65 63 74 (listbox) select
3b550 69 6f 6e 20 73 65 74 20 24 69 6e 64 65 78 0a 09 ion set $index..
3b560 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 $widgets(listbox
3b570 29 20 73 65 65 20 24 69 6e 64 65 78 0a 09 24 77 ) see $index..$w
3b580 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 6f idgets(entry) co
3b590 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 24 nfigure -state $
3b5a0 6f 6c 64 73 74 61 74 65 0a 20 20 20 20 7d 0a 7d oldstate. }.}
3b5b0 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a ..# ::combobox::
3b5c0 53 65 6c 65 63 74 20 2d 2d 0a 23 0a 23 20 20 20 Select --.#.#
3b5d0 20 73 65 6c 65 63 74 73 20 61 6e 20 69 74 65 6d selects an item
3b5e0 20 66 72 6f 6d 20 74 68 65 20 6c 69 73 74 20 61 from the list a
3b5f0 6e 64 20 73 65 74 73 20 74 68 65 20 76 61 6c 75 nd sets the valu
3b600 65 20 6f 66 20 74 68 65 20 63 6f 6d 62 6f 62 6f e of the combobo
3b610 78 0a 23 20 20 20 20 74 6f 20 74 68 61 74 20 76 x.# to that v
3b620 61 6c 75 65 0a 23 0a 23 20 41 72 67 75 6d 65 6e alue.#.# Argumen
3b630 74 73 3a 0a 23 0a 23 20 20 20 20 77 20 20 20 20 ts:.#.# w
3b640 20 20 77 69 64 67 65 74 20 70 61 74 68 6e 61 6d widget pathnam
3b650 65 0a 23 20 20 20 20 69 6e 64 65 78 20 20 6c 69 e.# index li
3b660 73 74 62 6f 78 20 69 6e 64 65 78 20 6f 66 20 69 stbox index of i
3b670 74 65 6d 20 74 6f 20 62 65 20 73 65 6c 65 63 74 tem to be select
3b680 65 64 0a 23 0a 23 20 52 65 74 75 72 6e 73 3a 0a ed.#.# Returns:.
3b690 23 0a 23 20 20 20 20 65 6d 70 74 79 20 73 74 72 #.# empty str
3b6a0 69 6e 67 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 ing..proc ::comb
3b6b0 6f 62 6f 78 3a 3a 53 65 6c 65 63 74 20 7b 77 20 obox::Select {w
3b6c0 69 6e 64 65 78 7d 20 7b 0a 20 20 20 20 75 70 76 index} {. upv
3b6d0 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 ar ::combobox::$
3b6e0 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 64 {w}::widgets wid
3b6f0 67 65 74 73 0a 20 20 20 20 75 70 76 61 72 20 3a gets. upvar :
3b700 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a :combobox::${w}:
3b710 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 :options options
3b720 0a 0a 20 20 20 20 23 20 74 68 65 20 63 61 74 63 .. # the catc
3b730 68 20 69 73 20 62 65 63 61 75 73 65 20 49 27 6d h is because I'm
3b740 20 73 6c 6f 70 70 79 20 2d 2d 20 70 72 65 73 75 sloppy -- presu
3b750 6d 61 62 6c 79 2c 20 74 68 65 20 6f 6e 6c 79 20 mably, the only
3b760 74 69 6d 65 0a 20 20 20 20 23 20 61 6e 20 65 72 time. # an er
3b770 72 6f 72 20 77 69 6c 6c 20 62 65 20 63 61 75 67 ror will be caug
3b780 68 74 20 69 73 20 69 66 20 74 68 65 72 65 20 69 ht is if there i
3b790 73 20 6e 6f 20 73 65 6c 65 63 74 69 6f 6e 2e 0a s no selection..
3b7a0 20 20 20 20 69 66 20 7b 21 5b 63 61 74 63 68 20 if {![catch
3b7b0 7b 73 65 74 20 64 61 74 61 20 5b 24 77 69 64 67 {set data [$widg
3b7c0 65 74 73 28 6c 69 73 74 62 6f 78 29 20 67 65 74 ets(listbox) get
3b7d0 20 5b 6c 69 6e 64 65 78 20 24 69 6e 64 65 78 20 [lindex $index
3b7e0 30 5d 5d 7d 5d 7d 20 7b 0a 09 3a 3a 63 6f 6d 62 0]]}]} {..::comb
3b7f0 6f 62 6f 78 3a 3a 53 65 74 56 61 6c 75 65 20 24 obox::SetValue $
3b800 77 69 64 67 65 74 73 28 74 68 69 73 29 20 24 64 widgets(this) $d
3b810 61 74 61 0a 0a 09 24 77 69 64 67 65 74 73 28 6c ata...$widgets(l
3b820 69 73 74 62 6f 78 29 20 73 65 6c 65 63 74 69 6f istbox) selectio
3b830 6e 20 63 6c 65 61 72 20 30 20 65 6e 64 0a 09 24 n clear 0 end..$
3b840 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 widgets(listbox)
3b850 20 73 65 6c 65 63 74 69 6f 6e 20 61 6e 63 68 6f selection ancho
3b860 72 20 24 69 6e 64 65 78 0a 09 24 77 69 64 67 65 r $index..$widge
3b870 74 73 28 6c 69 73 74 62 6f 78 29 20 73 65 6c 65 ts(listbox) sele
3b880 63 74 69 6f 6e 20 73 65 74 20 24 69 6e 64 65 78 ction set $index
3b890 0a 0a 20 20 20 20 7d 0a 20 20 20 20 24 77 69 64 .. }. $wid
3b8a0 67 65 74 73 28 65 6e 74 72 79 29 20 73 65 6c 65 gets(entry) sele
3b8b0 63 74 69 6f 6e 20 72 61 6e 67 65 20 30 20 65 6e ction range 0 en
3b8c0 64 0a 0a 20 20 20 20 24 77 69 64 67 65 74 73 28 d.. $widgets(
3b8d0 74 68 69 73 29 20 63 6c 6f 73 65 0a 0a 20 20 20 this) close..
3b8e0 20 72 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 return "".}..#
3b8f0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 48 61 6e 64 ::combobox::Hand
3b900 6c 65 53 63 72 6f 6c 6c 62 61 72 20 2d 2d 0a 23 leScrollbar --.#
3b910 0a 23 20 20 20 20 63 61 75 73 65 73 20 74 68 65 .# causes the
3b920 20 73 63 72 6f 6c 6c 62 61 72 20 6f 66 20 74 68 scrollbar of th
3b930 65 20 64 72 6f 70 64 6f 77 6e 20 6c 69 73 74 20 e dropdown list
3b940 74 6f 20 61 70 70 65 61 72 20 6f 72 20 64 69 73 to appear or dis
3b950 61 70 70 65 61 72 0a 23 20 20 20 20 62 61 73 65 appear.# base
3b960 64 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 6e 74 d on the content
3b970 73 20 6f 66 20 74 68 65 20 64 72 6f 70 64 6f 77 s of the dropdow
3b980 6e 20 6c 69 73 74 62 6f 78 0a 23 0a 23 20 41 72 n listbox.#.# Ar
3b990 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 20 20 guments:.#.#
3b9a0 77 20 20 20 20 20 20 20 77 69 64 67 65 74 20 70 w widget p
3b9b0 61 74 68 6e 61 6d 65 0a 23 20 20 20 20 61 63 74 athname.# act
3b9c0 69 6f 6e 20 20 74 68 65 20 61 63 74 69 6f 6e 20 ion the action
3b9d0 74 6f 20 70 65 72 66 6f 72 6d 20 6f 6e 20 74 68 to perform on th
3b9e0 65 20 73 63 72 6f 6c 6c 62 61 72 0a 23 0a 23 20 e scrollbar.#.#
3b9f0 52 65 74 75 72 6e 73 3a 0a 23 0a 23 20 20 20 20 Returns:.#.#
3ba00 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 0a an empty string.
3ba10 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 6f 62 6f 78 .proc ::combobox
3ba20 3a 3a 48 61 6e 64 6c 65 53 63 72 6f 6c 6c 62 61 ::HandleScrollba
3ba30 72 20 7b 77 20 7b 61 63 74 69 6f 6e 20 22 75 6e r {w {action "un
3ba40 6b 6e 6f 77 6e 22 7d 7d 20 7b 0a 20 20 20 20 75 known"}} {. u
3ba50 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a pvar ::combobox:
3ba60 3a 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 :${w}::widgets w
3ba70 69 64 67 65 74 73 0a 20 20 20 20 75 70 76 61 72 idgets. upvar
3ba80 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 ::combobox::${w
3ba90 7d 3a 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f }::options optio
3baa0 6e 73 0a 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 ns.. if {$opt
3bab0 69 6f 6e 73 28 2d 68 65 69 67 68 74 29 20 3d 3d ions(-height) ==
3bac0 20 30 7d 20 7b 0a 09 73 65 74 20 68 6c 69 6d 69 0} {..set hlimi
3bad0 74 20 24 6f 70 74 69 6f 6e 73 28 2d 6d 61 78 68 t $options(-maxh
3bae0 65 69 67 68 74 29 0a 20 20 20 20 7d 20 65 6c 73 eight). } els
3baf0 65 20 7b 0a 09 73 65 74 20 68 6c 69 6d 69 74 20 e {..set hlimit
3bb00 24 6f 70 74 69 6f 6e 73 28 2d 68 65 69 67 68 74 $options(-height
3bb10 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 77 69 ). }.. swi
3bb20 74 63 68 20 2d 2d 20 24 61 63 74 69 6f 6e 20 7b tch -- $action {
3bb30 0a 20 20 20 20 22 67 72 6f 77 22 20 7b 0a 09 20 . "grow" {..
3bb40 20 20 20 69 66 20 7b 24 68 6c 69 6d 69 74 20 3e if {$hlimit >
3bb50 20 30 20 26 26 20 5b 24 77 69 64 67 65 74 73 28 0 && [$widgets(
3bb60 6c 69 73 74 62 6f 78 29 20 73 69 7a 65 5d 20 3e listbox) size] >
3bb70 20 24 68 6c 69 6d 69 74 7d 20 7b 0a 09 09 70 61 $hlimit} {...pa
3bb80 63 6b 20 24 77 69 64 67 65 74 73 28 76 73 62 29 ck $widgets(vsb)
3bb90 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d 66 69 -side right -fi
3bba0 6c 6c 20 79 20 2d 65 78 70 61 6e 64 20 6e 0a 09 ll y -expand n..
3bbb0 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 22 73 68 }..}. "sh
3bbc0 72 69 6e 6b 22 20 7b 0a 09 20 20 20 20 69 66 20 rink" {.. if
3bbd0 7b 24 68 6c 69 6d 69 74 20 3e 20 30 20 26 26 20 {$hlimit > 0 &&
3bbe0 5b 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f [$widgets(listbo
3bbf0 78 29 20 73 69 7a 65 5d 20 3c 3d 20 24 68 6c 69 x) size] <= $hli
3bc00 6d 69 74 7d 20 7b 0a 09 09 70 61 63 6b 20 66 6f mit} {...pack fo
3bc10 72 67 65 74 20 24 77 69 64 67 65 74 73 28 76 73 rget $widgets(vs
3bc20 62 29 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 b).. }..}.
3bc30 20 22 63 72 6f 70 22 20 7b 0a 09 20 20 20 20 23 "crop" {.. #
3bc40 20 74 68 69 73 20 6d 65 61 6e 73 20 74 68 65 20 this means the
3bc50 77 69 6e 64 6f 77 20 77 61 73 20 63 72 6f 70 70 window was cropp
3bc60 65 64 20 61 6e 64 20 77 65 20 64 65 66 69 6e 69 ed and we defini
3bc70 74 65 6c 79 0a 09 20 20 20 20 23 20 6e 65 65 64 tely.. # need
3bc80 20 61 20 73 63 72 6f 6c 6c 62 61 72 20 6e 6f 20 a scrollbar no
3bc90 6d 61 74 74 65 72 20 77 68 61 74 20 74 68 65 20 matter what the
3bca0 75 73 65 72 20 77 61 6e 74 73 0a 09 20 20 20 20 user wants..
3bcb0 70 61 63 6b 20 24 77 69 64 67 65 74 73 28 76 73 pack $widgets(vs
3bcc0 62 29 20 2d 73 69 64 65 20 72 69 67 68 74 20 2d b) -side right -
3bcd0 66 69 6c 6c 20 79 20 2d 65 78 70 61 6e 64 20 6e fill y -expand n
3bce0 0a 09 7d 0a 20 20 20 20 64 65 66 61 75 6c 74 20 ..}. default
3bcf0 7b 0a 09 20 20 20 20 69 66 20 7b 24 68 6c 69 6d {.. if {$hlim
3bd00 69 74 20 3e 20 30 20 26 26 20 5b 24 77 69 64 67 it > 0 && [$widg
3bd10 65 74 73 28 6c 69 73 74 62 6f 78 29 20 73 69 7a ets(listbox) siz
3bd20 65 5d 20 3e 20 24 68 6c 69 6d 69 74 7d 20 7b 0a e] > $hlimit} {.
3bd30 09 09 70 61 63 6b 20 24 77 69 64 67 65 74 73 28 ..pack $widgets(
3bd40 76 73 62 29 20 2d 73 69 64 65 20 72 69 67 68 74 vsb) -side right
3bd50 20 2d 66 69 6c 6c 20 79 20 2d 65 78 70 61 6e 64 -fill y -expand
3bd60 20 6e 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b n.. } else {
3bd70 0a 09 09 70 61 63 6b 20 66 6f 72 67 65 74 20 24 ...pack forget $
3bd80 77 69 64 67 65 74 73 28 76 73 62 29 0a 09 20 20 widgets(vsb)..
3bd90 20 20 7d 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 }..}. }..
3bda0 20 20 72 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 return "".}..#
3bdb0 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 43 6f 6d ::combobox::Com
3bdc0 70 75 74 65 47 65 6f 6d 65 74 72 79 20 2d 2d 0a puteGeometry --.
3bdd0 23 0a 23 20 20 20 20 63 6f 6d 70 75 74 65 73 20 #.# computes
3bde0 74 68 65 20 67 65 6f 6d 65 74 72 79 20 6f 66 20 the geometry of
3bdf0 74 68 65 20 64 72 6f 70 64 6f 77 6e 20 6c 69 73 the dropdown lis
3be00 74 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 73 t based on the s
3be10 69 7a 65 20 6f 66 20 74 68 65 0a 23 20 20 20 20 ize of the.#
3be20 63 6f 6d 62 6f 62 6f 78 2e 2e 2e 0a 23 0a 23 20 combobox....#.#
3be30 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 Arguments:.#.#
3be40 20 20 77 20 20 20 20 20 77 69 64 67 65 74 20 70 w widget p
3be50 61 74 68 6e 61 6d 65 0a 23 0a 23 20 52 65 74 75 athname.#.# Retu
3be60 72 6e 73 3a 0a 23 0a 23 20 20 20 20 74 68 65 20 rns:.#.# the
3be70 64 65 73 69 72 65 64 20 67 65 6f 6d 65 74 72 79 desired geometry
3be80 20 6f 66 20 74 68 65 20 6c 69 73 74 62 6f 78 0a of the listbox.
3be90 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 6f 62 6f 78 .proc ::combobox
3bea0 3a 3a 43 6f 6d 70 75 74 65 47 65 6f 6d 65 74 72 ::ComputeGeometr
3beb0 79 20 7b 77 7d 20 7b 0a 20 20 20 20 75 70 76 61 y {w} {. upva
3bec0 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b r ::combobox::${
3bed0 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 64 67 w}::widgets widg
3bee0 65 74 73 0a 20 20 20 20 75 70 76 61 72 20 3a 3a ets. upvar ::
3bef0 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a combobox::${w}::
3bf00 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 0a options options.
3bf10 0a 20 20 20 20 69 66 20 7b 24 6f 70 74 69 6f 6e . if {$option
3bf20 73 28 2d 68 65 69 67 68 74 29 20 3d 3d 20 30 20 s(-height) == 0
3bf30 26 26 20 24 6f 70 74 69 6f 6e 73 28 2d 6d 61 78 && $options(-max
3bf40 68 65 69 67 68 74 29 20 21 3d 20 22 30 22 7d 20 height) != "0"}
3bf50 7b 0a 09 23 20 69 66 20 74 68 69 73 20 69 73 20 {..# if this is
3bf60 74 68 65 20 63 61 73 65 2c 20 63 6f 75 6e 74 20 the case, count
3bf70 74 68 65 20 69 74 65 6d 73 20 61 6e 64 20 73 65 the items and se
3bf80 65 20 69 66 0a 09 23 20 69 74 20 65 78 63 65 65 e if..# it excee
3bf90 64 73 20 6f 75 72 20 6d 61 78 68 65 69 67 68 74 ds our maxheight
3bfa0 2e 20 49 66 20 73 6f 2c 20 73 65 74 20 74 68 65 . If so, set the
3bfb0 20 6c 69 73 74 62 6f 78 0a 09 23 20 73 69 7a 65 listbox..# size
3bfc0 20 74 6f 20 6d 61 78 68 65 69 67 68 74 2e 2e 2e to maxheight...
3bfd0 0a 09 73 65 74 20 6e 69 74 65 6d 73 20 5b 24 77 ..set nitems [$w
3bfe0 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 idgets(listbox)
3bff0 73 69 7a 65 5d 0a 09 69 66 20 7b 24 6e 69 74 65 size]..if {$nite
3c000 6d 73 20 3e 20 24 6f 70 74 69 6f 6e 73 28 2d 6d ms > $options(-m
3c010 61 78 68 65 69 67 68 74 29 7d 20 7b 0a 09 20 20 axheight)} {..
3c020 20 20 23 20 74 77 65 61 6b 20 74 68 65 20 68 65 # tweak the he
3c030 69 67 68 74 20 6f 66 20 74 68 65 20 6c 69 73 74 ight of the list
3c040 62 6f 78 0a 09 20 20 20 20 24 77 69 64 67 65 74 box.. $widget
3c050 73 28 6c 69 73 74 62 6f 78 29 20 63 6f 6e 66 69 s(listbox) confi
3c060 67 75 72 65 20 2d 68 65 69 67 68 74 20 24 6f 70 gure -height $op
3c070 74 69 6f 6e 73 28 2d 6d 61 78 68 65 69 67 68 74 tions(-maxheight
3c080 29 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 )..} else {..
3c090 20 23 20 75 6e 2d 74 77 65 61 6b 20 74 68 65 20 # un-tweak the
3c0a0 68 65 69 67 68 74 20 6f 66 20 74 68 65 20 6c 69 height of the li
3c0b0 73 74 62 6f 78 0a 09 20 20 20 20 24 77 69 64 67 stbox.. $widg
3c0c0 65 74 73 28 6c 69 73 74 62 6f 78 29 20 63 6f 6e ets(listbox) con
3c0d0 66 69 67 75 72 65 20 2d 68 65 69 67 68 74 20 30 figure -height 0
3c0e0 0a 09 7d 0a 09 75 70 64 61 74 65 20 69 64 6c 65 ..}..update idle
3c0f0 74 61 73 6b 73 0a 20 20 20 20 7d 0a 0a 20 20 20 tasks. }..
3c100 20 23 20 63 6f 6d 70 75 74 65 20 68 65 69 67 68 # compute heigh
3c110 74 20 61 6e 64 20 77 69 64 74 68 20 6f 66 20 74 t and width of t
3c120 68 65 20 64 72 6f 70 64 6f 77 6e 20 6c 69 73 74 he dropdown list
3c130 0a 20 20 20 20 73 65 74 20 62 64 20 5b 24 77 69 . set bd [$wi
3c140 64 67 65 74 73 28 64 72 6f 70 64 6f 77 6e 29 20 dgets(dropdown)
3c150 63 67 65 74 20 2d 62 6f 72 64 65 72 77 69 64 74 cget -borderwidt
3c160 68 5d 0a 20 20 20 20 73 65 74 20 68 65 69 67 68 h]. set heigh
3c170 74 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 6f 20 t [expr {[winfo
3c180 72 65 71 68 65 69 67 68 74 20 24 77 69 64 67 65 reqheight $widge
3c190 74 73 28 64 72 6f 70 64 6f 77 6e 29 5d 20 2b 20 ts(dropdown)] +
3c1a0 24 62 64 20 2b 20 24 62 64 7d 5d 0a 20 20 20 20 $bd + $bd}].
3c1b0 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
3c1c0 74 68 20 24 6f 70 74 69 6f 6e 73 28 2d 64 72 6f th $options(-dro
3c1d0 70 64 6f 77 6e 77 69 64 74 68 29 5d 20 3d 3d 20 pdownwidth)] ==
3c1e0 30 20 7c 7c 20 5c 0a 20 20 20 20 20 20 24 6f 70 0 || \. $op
3c1f0 74 69 6f 6e 73 28 2d 64 72 6f 70 64 6f 77 6e 77 tions(-dropdownw
3c200 69 64 74 68 29 20 3d 3d 20 30 7d 20 7b 0a 09 73 idth) == 0} {..s
3c210 65 74 20 77 69 64 74 68 20 5b 77 69 6e 66 6f 20 et width [winfo
3c220 77 69 64 74 68 20 24 77 69 64 67 65 74 73 28 74 width $widgets(t
3c230 68 69 73 29 5d 0a 20 20 20 20 7d 20 65 6c 73 65 his)]. } else
3c240 20 7b 0a 09 73 65 74 20 6d 20 5b 66 6f 6e 74 20 {..set m [font
3c250 6d 65 61 73 75 72 65 20 5b 24 77 69 64 67 65 74 measure [$widget
3c260 73 28 6c 69 73 74 62 6f 78 29 20 63 67 65 74 20 s(listbox) cget
3c270 2d 66 6f 6e 74 5d 20 22 6d 22 5d 0a 09 73 65 74 -font] "m"]..set
3c280 20 77 69 64 74 68 20 5b 65 78 70 72 20 7b 24 6f width [expr {$o
3c290 70 74 69 6f 6e 73 28 2d 64 72 6f 70 64 6f 77 6e ptions(-dropdown
3c2a0 77 69 64 74 68 29 20 2a 20 24 6d 7d 5d 0a 20 20 width) * $m}].
3c2b0 20 20 7d 0a 0a 20 20 20 20 23 20 66 69 67 75 72 }.. # figur
3c2c0 65 20 6f 75 74 20 77 68 65 72 65 20 74 6f 20 70 e out where to p
3c2d0 6c 61 63 65 20 69 74 20 6f 6e 20 74 68 65 20 73 lace it on the s
3c2e0 63 72 65 65 6e 2c 20 74 72 79 69 6e 67 20 74 6f creen, trying to
3c2f0 20 74 61 6b 65 20 69 6e 74 6f 0a 20 20 20 20 23 take into. #
3c300 20 61 63 63 6f 75 6e 74 20 77 65 20 6d 61 79 20 account we may
3c310 62 65 20 72 75 6e 6e 69 6e 67 20 75 6e 64 65 72 be running under
3c320 20 73 6f 6d 65 20 76 69 72 74 75 61 6c 20 77 69 some virtual wi
3c330 6e 64 6f 77 20 6d 61 6e 61 67 65 72 0a 20 20 20 ndow manager.
3c340 20 73 65 74 20 73 63 72 65 65 6e 57 69 64 74 68 set screenWidth
3c350 20 5b 77 69 6e 66 6f 20 73 63 72 65 65 6e 77 69 [winfo screenwi
3c360 64 74 68 20 24 77 69 64 67 65 74 73 28 74 68 69 dth $widgets(thi
3c370 73 29 5d 0a 20 20 20 20 73 65 74 20 73 63 72 65 s)]. set scre
3c380 65 6e 48 65 69 67 68 74 20 5b 77 69 6e 66 6f 20 enHeight [winfo
3c390 73 63 72 65 65 6e 68 65 69 67 68 74 20 24 77 69 screenheight $wi
3c3a0 64 67 65 74 73 28 74 68 69 73 29 5d 0a 20 20 20 dgets(this)].
3c3b0 20 73 65 74 20 72 6f 6f 74 78 20 5b 77 69 6e 66 set rootx [winf
3c3c0 6f 20 72 6f 6f 74 78 20 24 77 69 64 67 65 74 73 o rootx $widgets
3c3d0 28 74 68 69 73 29 5d 0a 20 20 20 20 73 65 74 20 (this)]. set
3c3e0 72 6f 6f 74 79 20 5b 77 69 6e 66 6f 20 72 6f 6f rooty [winfo roo
3c3f0 74 79 20 24 77 69 64 67 65 74 73 28 74 68 69 73 ty $widgets(this
3c400 29 5d 0a 20 20 20 20 73 65 74 20 76 72 6f 6f 74 )]. set vroot
3c410 78 20 5b 77 69 6e 66 6f 20 76 72 6f 6f 74 78 20 x [winfo vrootx
3c420 24 77 69 64 67 65 74 73 28 74 68 69 73 29 5d 0a $widgets(this)].
3c430 20 20 20 20 73 65 74 20 76 72 6f 6f 74 79 20 5b set vrooty [
3c440 77 69 6e 66 6f 20 76 72 6f 6f 74 79 20 24 77 69 winfo vrooty $wi
3c450 64 67 65 74 73 28 74 68 69 73 29 5d 0a 0a 20 20 dgets(this)]..
3c460 20 20 23 20 74 68 65 20 78 20 63 6f 6f 72 64 69 # the x coordi
3c470 6e 61 74 65 20 69 73 20 73 69 6d 70 6c 79 20 74 nate is simply t
3c480 68 65 20 72 6f 6f 74 78 20 6f 66 20 6f 75 72 20 he rootx of our
3c490 77 69 64 67 65 74 2c 20 61 64 6a 75 73 74 65 64 widget, adjusted
3c4a0 20 66 6f 72 0a 20 20 20 20 23 20 74 68 65 20 76 for. # the v
3c4b0 69 72 74 75 61 6c 20 77 69 6e 64 6f 77 2e 20 57 irtual window. W
3c4c0 65 20 77 6f 6e 27 74 20 77 6f 72 72 79 20 61 62 e won't worry ab
3c4d0 6f 75 74 20 77 68 65 74 68 65 72 20 74 68 65 20 out whether the
3c4e0 77 69 6e 64 6f 77 20 77 69 6c 6c 0a 20 20 20 20 window will.
3c4f0 23 20 62 65 20 6f 66 66 73 63 72 65 65 6e 20 74 # be offscreen t
3c500 6f 20 74 68 65 20 6c 65 66 74 20 6f 72 20 72 69 o the left or ri
3c510 67 68 74 20 2d 2d 20 77 65 20 77 61 6e 74 20 74 ght -- we want t
3c520 68 65 20 69 6c 6c 75 73 69 6f 6e 20 74 68 61 74 he illusion that
3c530 20 69 74 0a 20 20 20 20 23 20 69 73 20 70 61 72 it. # is par
3c540 74 20 6f 66 20 74 68 65 20 65 6e 74 72 79 20 77 t of the entry w
3c550 69 64 67 65 74 2c 20 73 6f 20 69 66 20 70 61 72 idget, so if par
3c560 74 20 6f 66 20 74 68 65 20 65 6e 74 72 79 20 77 t of the entry w
3c570 69 64 67 65 74 20 69 73 20 6f 66 66 2d 0a 20 20 idget is off-.
3c580 20 20 23 20 73 63 72 65 65 6e 2c 20 73 6f 20 77 # screen, so w
3c590 69 6c 6c 20 74 68 65 20 6c 69 73 74 2e 20 49 66 ill the list. If
3c5a0 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 63 68 61 you want to cha
3c5b0 6e 67 65 20 74 68 65 20 62 65 68 61 76 69 6f 72 nge the behavior
3c5c0 2c 0a 20 20 20 20 23 20 73 69 6d 70 6c 79 20 63 ,. # simply c
3c5d0 68 61 6e 67 65 20 74 68 65 20 69 66 20 73 74 61 hange the if sta
3c5e0 74 65 6d 65 6e 74 2e 2e 2e 20 28 61 6e 64 20 62 tement... (and b
3c5f0 65 20 73 75 72 65 20 74 6f 20 75 70 64 61 74 65 e sure to update
3c600 20 74 68 69 73 0a 20 20 20 20 23 20 63 6f 6d 6d this. # comm
3c610 65 6e 74 21 29 0a 20 20 20 20 73 65 74 20 78 20 ent!). set x
3c620 5b 65 78 70 72 20 7b 24 72 6f 6f 74 78 20 2b 20 [expr {$rootx +
3c630 24 76 72 6f 6f 74 78 7d 5d 0a 20 20 20 20 69 66 $vrootx}]. if
3c640 20 7b 30 7d 20 7b 0a 09 73 65 74 20 72 69 67 68 {0} {..set righ
3c650 74 45 64 67 65 20 5b 65 78 70 72 20 7b 24 78 20 tEdge [expr {$x
3c660 2b 20 24 77 69 64 74 68 7d 5d 0a 09 69 66 20 7b + $width}]..if {
3c670 24 72 69 67 68 74 45 64 67 65 20 3e 20 24 73 63 $rightEdge > $sc
3c680 72 65 65 6e 57 69 64 74 68 7d 20 7b 0a 09 20 20 reenWidth} {..
3c690 20 20 73 65 74 20 78 20 5b 65 78 70 72 20 7b 24 set x [expr {$
3c6a0 73 63 72 65 65 6e 57 69 64 74 68 20 2d 20 24 77 screenWidth - $w
3c6b0 69 64 74 68 7d 5d 0a 09 7d 0a 09 69 66 20 7b 24 idth}]..}..if {$
3c6c0 78 20 3c 20 30 7d 20 7b 0a 09 20 20 20 20 73 65 x < 0} {.. se
3c6d0 74 20 78 20 30 0a 09 7d 0a 20 20 20 20 7d 0a 0a t x 0..}. }..
3c6e0 20 20 20 20 23 20 74 68 65 20 79 20 63 6f 6f 72 # the y coor
3c6f0 64 69 6e 61 74 65 20 69 73 20 74 68 65 20 72 6f dinate is the ro
3c700 6f 74 79 20 70 6c 75 73 20 76 72 6f 6f 74 79 20 oty plus vrooty
3c710 6f 66 66 73 65 74 20 70 6c 75 73 0a 20 20 20 20 offset plus.
3c720 23 20 74 68 65 20 68 65 69 67 68 74 20 6f 66 20 # the height of
3c730 74 68 65 20 73 74 61 74 69 63 20 70 61 72 74 20 the static part
3c740 6f 66 20 74 68 65 20 77 69 64 67 65 74 20 70 6c of the widget pl
3c750 75 73 20 31 20 66 6f 72 20 61 0a 20 20 20 20 23 us 1 for a. #
3c760 20 74 69 6e 79 20 62 69 74 20 6f 66 20 76 69 73 tiny bit of vis
3c770 75 61 6c 20 73 65 70 61 72 61 74 69 6f 6e 2e 2e ual separation..
3c780 2e 0a 20 20 20 20 73 65 74 20 79 20 5b 65 78 70 .. set y [exp
3c790 72 20 7b 24 72 6f 6f 74 79 20 2b 20 24 76 72 6f r {$rooty + $vro
3c7a0 6f 74 79 20 2b 20 5b 77 69 6e 66 6f 20 72 65 71 oty + [winfo req
3c7b0 68 65 69 67 68 74 20 24 77 69 64 67 65 74 73 28 height $widgets(
3c7c0 74 68 69 73 29 5d 20 2b 20 31 7d 5d 0a 20 20 20 this)] + 1}].
3c7d0 20 73 65 74 20 62 6f 74 74 6f 6d 45 64 67 65 20 set bottomEdge
3c7e0 5b 65 78 70 72 20 7b 24 79 20 2b 20 24 68 65 69 [expr {$y + $hei
3c7f0 67 68 74 7d 5d 0a 0a 20 20 20 20 69 66 20 7b 24 ght}].. if {$
3c800 62 6f 74 74 6f 6d 45 64 67 65 20 3e 3d 20 24 73 bottomEdge >= $s
3c810 63 72 65 65 6e 48 65 69 67 68 74 7d 20 7b 0a 09 creenHeight} {..
3c820 23 20 6f 6b 2e 20 46 69 6e 65 2e 20 50 6f 70 20 # ok. Fine. Pop
3c830 69 74 20 75 70 20 61 62 6f 76 65 20 74 68 65 20 it up above the
3c840 65 6e 74 72 79 20 77 69 64 67 65 74 20 69 73 6e entry widget isn
3c850 74 65 61 64 20 6f 66 0a 09 23 20 62 65 6c 6f 77 tead of..# below
3c860 2e 0a 09 73 65 74 20 79 20 5b 65 78 70 72 20 7b ...set y [expr {
3c870 28 24 72 6f 6f 74 79 20 2d 20 24 68 65 69 67 68 ($rooty - $heigh
3c880 74 20 2d 20 31 29 20 2b 20 24 76 72 6f 6f 74 79 t - 1) + $vrooty
3c890 7d 5d 0a 0a 09 69 66 20 7b 24 79 20 3c 20 30 7d }]...if {$y < 0}
3c8a0 20 7b 0a 09 20 20 20 20 23 20 74 68 69 73 20 6d {.. # this m
3c8b0 65 61 6e 73 20 69 74 20 65 78 74 65 6e 64 73 20 eans it extends
3c8c0 62 65 79 6f 6e 64 20 6f 75 72 20 73 63 72 65 65 beyond our scree
3c8d0 6e 2e 20 48 6f 77 20 61 6e 6e 6f 79 69 6e 67 2e n. How annoying.
3c8e0 0a 09 20 20 20 20 23 20 4e 6f 77 20 77 65 27 6c .. # Now we'l
3c8f0 6c 20 74 72 79 20 74 6f 20 62 65 20 72 65 61 6c l try to be real
3c900 20 63 6c 65 76 65 72 20 61 6e 64 20 65 69 74 68 clever and eith
3c910 65 72 20 70 6f 70 20 69 74 20 75 70 20 6f 72 0a er pop it up or.
3c920 09 20 20 20 20 23 20 64 6f 77 6e 2c 20 64 65 70 . # down, dep
3c930 65 6e 64 69 6e 67 20 6f 6e 20 77 68 69 63 68 20 ending on which
3c940 77 61 79 20 67 69 76 65 73 20 75 73 20 74 68 65 way gives us the
3c950 20 62 69 67 67 65 73 74 20 6c 69 73 74 2e 0a 09 biggest list...
3c960 20 20 20 20 23 20 74 68 65 6e 2c 20 77 65 27 6c # then, we'l
3c970 6c 20 74 72 69 6d 20 74 68 65 20 6c 69 73 74 20 l trim the list
3c980 74 6f 20 66 69 74 20 61 6e 64 20 66 6f 72 63 65 to fit and force
3c990 20 74 68 65 20 75 73 65 20 6f 66 0a 09 20 20 20 the use of..
3c9a0 20 23 20 61 20 73 63 72 6f 6c 6c 62 61 72 0a 0a # a scrollbar..
3c9b0 09 20 20 20 20 23 20 28 73 61 64 6c 79 2c 20 66 . # (sadly, f
3c9c0 6f 72 20 77 69 6e 64 6f 77 73 20 75 73 65 72 73 or windows users
3c9d0 20 74 68 69 73 20 6d 65 61 73 75 72 65 6d 65 6e this measuremen
3c9e0 74 20 64 6f 65 73 6e 27 74 0a 09 20 20 20 20 23 t doesn't.. #
3c9f0 20 74 61 6b 65 20 69 6e 74 6f 20 63 6f 6e 73 69 take into consi
3ca00 64 65 72 61 74 69 6f 6e 20 74 68 65 20 68 65 69 deration the hei
3ca10 67 68 74 20 6f 66 20 74 68 65 20 74 61 73 6b 62 ght of the taskb
3ca20 61 72 2c 0a 09 20 20 20 20 23 20 62 75 74 20 64 ar,.. # but d
3ca30 6f 6e 27 74 20 62 6c 61 6d 65 20 6d 65 20 2d 2d on't blame me --
3ca40 20 74 68 65 72 65 20 69 73 6e 27 74 20 61 6e 79 there isn't any
3ca50 20 77 61 79 20 74 6f 20 64 65 74 65 63 74 0a 09 way to detect..
3ca60 20 20 20 20 23 20 69 74 20 6f 72 20 66 69 67 75 # it or figu
3ca70 72 65 20 6f 75 74 20 69 74 73 20 64 69 6d 65 6e re out its dimen
3ca80 73 69 6f 6e 73 2e 20 54 68 65 20 73 61 6d 65 20 sions. The same
3ca90 70 72 6f 62 61 62 6c 79 0a 09 20 20 20 20 23 20 probably.. #
3caa0 61 70 70 6c 69 65 73 20 74 6f 20 61 6e 79 20 77 applies to any w
3cab0 69 6e 64 6f 77 20 6d 61 6e 61 67 65 72 20 77 69 indow manager wi
3cac0 74 68 20 73 6f 6d 65 20 6d 61 67 69 63 20 77 69 th some magic wi
3cad0 6e 64 6f 77 73 0a 09 20 20 20 20 23 20 67 6c 75 ndows.. # glu
3cae0 65 64 20 74 6f 20 74 68 65 20 74 6f 70 20 6f 72 ed to the top or
3caf0 20 62 6f 74 74 6f 6d 20 6f 66 20 74 68 65 20 73 bottom of the s
3cb00 63 72 65 65 6e 29 0a 0a 09 20 20 20 20 69 66 20 creen)... if
3cb10 7b 24 72 6f 6f 74 79 20 3e 20 5b 65 78 70 72 20 {$rooty > [expr
3cb20 7b 24 73 63 72 65 65 6e 48 65 69 67 68 74 20 2f {$screenHeight /
3cb30 20 32 7d 5d 7d 20 7b 0a 09 09 23 20 77 65 20 61 2}]} {...# we a
3cb40 72 65 20 69 6e 20 74 68 65 20 6c 6f 77 65 72 20 re in the lower
3cb50 68 61 6c 66 20 6f 66 20 74 68 65 20 73 63 72 65 half of the scre
3cb60 65 6e 20 2d 2d 0a 09 09 23 20 70 6f 70 20 69 74 en --...# pop it
3cb70 20 75 70 2e 20 59 20 69 73 20 7a 65 72 6f 3b 20 up. Y is zero;
3cb80 74 68 61 74 20 70 61 72 74 73 20 65 61 73 79 2e that parts easy.
3cb90 20 54 68 65 20 68 65 69 67 68 74 0a 09 09 23 20 The height...#
3cba0 69 73 20 73 69 6d 70 6c 79 20 74 68 65 20 79 20 is simply the y
3cbb0 63 6f 6f 72 64 69 6e 61 74 65 20 6f 66 20 6f 75 coordinate of ou
3cbc0 72 20 77 69 64 67 65 74 2c 20 6d 69 6e 75 73 0a r widget, minus.
3cbd0 09 09 23 20 61 20 70 69 78 65 6c 20 66 6f 72 20 ..# a pixel for
3cbe0 73 6f 6d 65 20 76 69 73 75 61 6c 20 73 65 70 61 some visual sepa
3cbf0 72 61 74 69 6f 6e 2e 20 54 68 65 20 79 20 63 6f ration. The y co
3cc00 6f 72 64 69 6e 61 74 65 0a 09 09 23 20 77 69 6c ordinate...# wil
3cc10 6c 20 62 65 20 74 68 65 20 74 6f 70 6f 66 20 74 l be the topof t
3cc20 68 65 20 73 63 72 65 65 6e 2e 0a 09 09 73 65 74 he screen....set
3cc30 20 79 20 31 0a 09 09 73 65 74 20 68 65 69 67 68 y 1...set heigh
3cc40 74 20 5b 65 78 70 72 20 7b 24 72 6f 6f 74 79 20 t [expr {$rooty
3cc50 2d 20 31 20 2d 20 24 79 7d 5d 0a 0a 09 20 20 20 - 1 - $y}]...
3cc60 20 7d 20 65 6c 73 65 20 7b 0a 09 09 23 20 77 65 } else {...# we
3cc70 20 61 72 65 20 69 6e 20 74 68 65 20 75 70 70 65 are in the uppe
3cc80 72 20 68 61 6c 66 20 6f 66 20 74 68 65 20 73 63 r half of the sc
3cc90 72 65 65 6e 20 2d 2d 0a 09 09 23 20 70 6f 70 20 reen --...# pop
3cca0 69 74 20 64 6f 77 6e 0a 09 09 73 65 74 20 79 20 it down...set y
3ccb0 5b 65 78 70 72 20 7b 24 72 6f 6f 74 79 20 2b 20 [expr {$rooty +
3ccc0 24 76 72 6f 6f 74 79 20 2b 20 5b 77 69 6e 66 6f $vrooty + [winfo
3ccd0 20 72 65 71 68 65 69 67 68 74 20 5c 0a 09 09 20 reqheight \...
3cce0 20 24 77 69 64 67 65 74 73 28 74 68 69 73 29 5d $widgets(this)]
3ccf0 20 2b 20 31 7d 5d 0a 09 09 73 65 74 20 68 65 69 + 1}]...set hei
3cd00 67 68 74 20 5b 65 78 70 72 20 7b 24 73 63 72 65 ght [expr {$scre
3cd10 65 6e 48 65 69 67 68 74 20 2d 20 24 79 7d 5d 0a enHeight - $y}].
3cd20 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 20 .. }... #
3cd30 66 6f 72 63 65 20 61 20 73 63 72 6f 6c 6c 62 61 force a scrollba
3cd40 72 0a 09 20 20 20 20 48 61 6e 64 6c 65 53 63 72 r.. HandleScr
3cd50 6f 6c 6c 62 61 72 20 24 77 69 64 67 65 74 73 28 ollbar $widgets(
3cd60 74 68 69 73 29 20 63 72 6f 70 0a 09 7d 0a 20 20 this) crop..}.
3cd70 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 24 79 20 }.. if {$y
3cd80 3c 20 30 7d 20 7b 0a 09 23 20 68 6d 6d 6d 2e 20 < 0} {..# hmmm.
3cd90 42 75 6d 6d 65 72 2e 0a 09 73 65 74 20 79 20 30 Bummer...set y 0
3cda0 0a 09 73 65 74 20 68 65 69 67 68 74 20 24 73 63 ..set height $sc
3cdb0 72 65 65 6e 68 65 69 67 68 74 0a 20 20 20 20 7d reenheight. }
3cdc0 0a 0a 20 20 20 20 73 65 74 20 67 65 6f 6d 65 74 .. set geomet
3cdd0 72 79 20 5b 66 6f 72 6d 61 74 20 22 3d 25 64 78 ry [format "=%dx
3cde0 25 64 2b 25 64 2b 25 64 22 20 24 77 69 64 74 68 %d+%d+%d" $width
3cdf0 20 24 68 65 69 67 68 74 20 24 78 20 24 79 5d 0a $height $x $y].
3ce00 0a 20 20 20 20 72 65 74 75 72 6e 20 24 67 65 6f . return $geo
3ce10 6d 65 74 72 79 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d metry.}..# ::com
3ce20 62 6f 62 6f 78 3a 3a 44 6f 49 6e 74 65 72 6e 61 bobox::DoInterna
3ce30 6c 57 69 64 67 65 74 43 6f 6d 6d 61 6e 64 20 2d lWidgetCommand -
3ce40 2d 0a 23 0a 23 20 20 20 20 70 65 72 66 6f 72 6d -.#.# perform
3ce50 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 77 69 64 an internal wid
3ce60 67 65 74 20 63 6f 6d 6d 61 6e 64 2c 20 74 68 65 get command, the
3ce70 6e 20 6d 75 6e 67 20 61 6e 79 20 65 72 72 6f 72 n mung any error
3ce80 20 72 65 73 75 6c 74 73 0a 23 20 20 20 20 74 6f results.# to
3ce90 20 6c 6f 6f 6b 20 6c 69 6b 65 20 69 74 20 63 61 look like it ca
3cea0 6d 65 20 66 72 6f 6d 20 6f 75 72 20 6d 65 67 61 me from our mega
3ceb0 77 69 64 67 65 74 2e 20 41 20 6c 6f 74 20 6f 66 widget. A lot of
3cec0 20 77 6f 72 6b 20 6a 75 73 74 20 74 6f 0a 23 20 work just to.#
3ced0 20 20 20 67 69 76 65 20 74 68 65 20 69 6c 6c 75 give the illu
3cee0 73 69 6f 6e 20 74 68 61 74 20 6f 75 72 20 6d 65 sion that our me
3cef0 67 61 77 69 64 67 65 74 20 69 73 20 61 6e 20 61 gawidget is an a
3cf00 74 6f 6d 69 63 20 77 69 64 67 65 74 0a 23 0a 23 tomic widget.#.#
3cf10 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 Arguments:.#.#
3cf20 20 20 20 77 20 20 20 20 20 20 20 20 20 20 20 77 w w
3cf30 69 64 67 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 idget pathname.#
3cf40 20 20 20 20 73 75 62 77 69 64 67 65 74 20 20 20 subwidget
3cf50 70 61 74 68 6e 61 6d 65 20 6f 66 20 74 68 65 20 pathname of the
3cf60 73 75 62 77 69 64 67 65 74 0a 23 20 20 20 20 63 subwidget.# c
3cf70 6f 6d 6d 61 6e 64 20 20 20 20 20 73 75 62 77 69 ommand subwi
3cf80 64 67 65 74 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 dget command to
3cf90 62 65 20 65 78 65 63 75 74 65 64 0a 23 20 20 20 be executed.#
3cfa0 20 61 72 67 73 20 20 20 20 20 20 20 20 61 72 67 args arg
3cfb0 75 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 63 6f uments to the co
3cfc0 6d 6d 61 6e 64 0a 23 0a 23 20 52 65 74 75 72 6e mmand.#.# Return
3cfd0 73 3a 0a 23 0a 23 20 20 20 20 54 68 65 20 72 65 s:.#.# The re
3cfe0 73 75 6c 74 20 6f 66 20 74 68 65 20 73 75 62 77 sult of the subw
3cff0 69 64 67 65 74 20 63 6f 6d 6d 61 6e 64 2c 20 6f idget command, o
3d000 72 20 61 6e 20 65 72 72 6f 72 0a 0a 70 72 6f 63 r an error..proc
3d010 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 44 6f 49 ::combobox::DoI
3d020 6e 74 65 72 6e 61 6c 57 69 64 67 65 74 43 6f 6d nternalWidgetCom
3d030 6d 61 6e 64 20 7b 77 20 73 75 62 77 69 64 67 65 mand {w subwidge
3d040 74 20 63 6f 6d 6d 61 6e 64 20 61 72 67 73 7d 20 t command args}
3d050 7b 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 6f {. upvar ::co
3d060 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 77 69 mbobox::${w}::wi
3d070 64 67 65 74 73 20 77 69 64 67 65 74 73 0a 20 20 dgets widgets.
3d080 20 20 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 upvar ::combob
3d090 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f 70 74 69 6f 6e ox::${w}::option
3d0a0 73 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 73 s options.. s
3d0b0 65 74 20 73 75 62 63 6f 6d 6d 61 6e 64 20 24 63 et subcommand $c
3d0c0 6f 6d 6d 61 6e 64 0a 20 20 20 20 73 65 74 20 63 ommand. set c
3d0d0 6f 6d 6d 61 6e 64 20 5b 63 6f 6e 63 61 74 20 24 ommand [concat $
3d0e0 77 69 64 67 65 74 73 28 24 73 75 62 77 69 64 67 widgets($subwidg
3d0f0 65 74 29 20 24 63 6f 6d 6d 61 6e 64 20 24 61 72 et) $command $ar
3d100 67 73 5d 0a 20 20 20 20 69 66 20 7b 5b 63 61 74 gs]. if {[cat
3d110 63 68 20 24 63 6f 6d 6d 61 6e 64 20 72 65 73 75 ch $command resu
3d120 6c 74 5d 7d 20 7b 0a 09 23 20 72 65 70 6c 61 63 lt]} {..# replac
3d130 65 20 74 68 65 20 73 75 62 77 69 64 67 65 74 20 e the subwidget
3d140 6e 61 6d 65 20 77 69 74 68 20 74 68 65 20 6d 65 name with the me
3d150 67 61 77 69 64 67 65 74 20 6e 61 6d 65 0a 09 72 gawidget name..r
3d160 65 67 73 75 62 20 24 77 69 64 67 65 74 73 28 24 egsub $widgets($
3d170 73 75 62 77 69 64 67 65 74 29 20 24 72 65 73 75 subwidget) $resu
3d180 6c 74 20 24 77 69 64 67 65 74 73 28 74 68 69 73 lt $widgets(this
3d190 29 20 72 65 73 75 6c 74 0a 0a 09 23 20 72 65 70 ) result...# rep
3d1a0 6c 61 63 65 20 73 70 65 63 69 66 69 63 20 69 6e lace specific in
3d1b0 73 74 61 6e 63 65 73 20 6f 66 20 74 68 65 20 73 stances of the s
3d1c0 75 62 77 69 64 67 65 74 20 63 6f 6d 6d 61 6e 64 ubwidget command
3d1d0 0a 09 23 20 77 69 74 68 20 6f 75 72 20 6d 65 67 ..# with our meg
3d1e0 61 77 69 64 67 65 74 20 63 6f 6d 6d 61 6e 64 0a awidget command.
3d1f0 09 73 77 69 74 63 68 20 2d 2d 20 24 73 75 62 77 .switch -- $subw
3d200 69 64 67 65 74 2c 24 73 75 62 63 6f 6d 6d 61 6e idget,$subcomman
3d210 64 20 7b 0a 09 6c 69 73 74 62 6f 78 2c 69 6e 64 d {..listbox,ind
3d220 65 78 20 7b 0a 09 09 72 65 67 73 75 62 20 22 69 ex {...regsub "i
3d230 6e 64 65 78 22 20 24 72 65 73 75 6c 74 20 22 6c ndex" $result "l
3d240 69 73 74 20 69 6e 64 65 78 22 20 72 65 73 75 6c ist index" resul
3d250 74 0a 09 20 20 20 20 7d 0a 09 6c 69 73 74 62 6f t.. }..listbo
3d260 78 2c 69 6e 73 65 72 74 20 7b 0a 09 09 72 65 67 x,insert {...reg
3d270 73 75 62 20 22 69 6e 73 65 72 74 22 20 24 72 65 sub "insert" $re
3d280 73 75 6c 74 20 22 6c 69 73 74 20 69 6e 73 65 72 sult "list inser
3d290 74 22 20 72 65 73 75 6c 74 0a 09 20 20 20 20 7d t" result.. }
3d2a0 0a 09 6c 69 73 74 62 6f 78 2c 64 65 6c 65 74 65 ..listbox,delete
3d2b0 20 7b 0a 09 09 72 65 67 73 75 62 20 22 64 65 6c {...regsub "del
3d2c0 65 74 65 22 20 24 72 65 73 75 6c 74 20 22 6c 69 ete" $result "li
3d2d0 73 74 20 64 65 6c 65 74 65 22 20 72 65 73 75 6c st delete" resul
3d2e0 74 0a 09 20 20 20 20 7d 0a 09 6c 69 73 74 62 6f t.. }..listbo
3d2f0 78 2c 67 65 74 20 7b 0a 09 09 72 65 67 73 75 62 x,get {...regsub
3d300 20 22 67 65 74 22 20 24 72 65 73 75 6c 74 20 22 "get" $result "
3d310 6c 69 73 74 20 67 65 74 22 20 72 65 73 75 6c 74 list get" result
3d320 0a 09 20 20 20 20 7d 0a 09 6c 69 73 74 62 6f 78 .. }..listbox
3d330 2c 73 69 7a 65 20 7b 0a 09 09 72 65 67 73 75 62 ,size {...regsub
3d340 20 22 73 69 7a 65 22 20 24 72 65 73 75 6c 74 20 "size" $result
3d350 22 6c 69 73 74 20 73 69 7a 65 22 20 72 65 73 75 "list size" resu
3d360 6c 74 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 65 72 lt.. }..}..er
3d370 72 6f 72 20 24 72 65 73 75 6c 74 0a 0a 20 20 20 ror $result..
3d380 20 7d 20 65 6c 73 65 20 7b 0a 09 72 65 74 75 72 } else {..retur
3d390 6e 20 24 72 65 73 75 6c 74 0a 20 20 20 20 7d 0a n $result. }.
3d3a0 7d 0a 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 6f 78 }...# ::combobox
3d3b0 3a 3a 57 69 64 67 65 74 50 72 6f 63 20 2d 2d 0a ::WidgetProc --.
3d3c0 23 0a 23 20 20 20 20 54 68 69 73 20 67 65 74 73 #.# This gets
3d3d0 20 75 73 65 73 20 61 73 20 74 68 65 20 77 69 64 uses as the wid
3d3e0 67 65 74 70 72 6f 63 20 66 6f 72 20 61 6e 20 63 getproc for an c
3d3f0 6f 6d 62 6f 62 6f 78 20 77 69 64 67 65 74 2e 0a ombobox widget..
3d400 23 20 20 20 20 4e 6f 74 69 63 65 20 77 68 65 72 # Notice wher
3d410 65 20 74 68 65 20 77 69 64 67 65 74 20 69 73 20 e the widget is
3d420 63 72 65 61 74 65 64 20 61 6e 64 20 79 6f 75 27 created and you'
3d430 6c 6c 20 73 65 65 20 74 68 61 74 20 74 68 65 0a ll see that the.
3d440 23 20 20 20 20 61 63 74 75 61 6c 20 77 69 64 67 # actual widg
3d450 65 74 20 70 72 6f 63 20 6d 65 72 65 6c 79 20 65 et proc merely e
3d460 76 61 6c 73 20 74 68 69 73 20 70 72 6f 63 20 77 vals this proc w
3d470 69 74 68 20 61 6c 6c 20 6f 66 20 74 68 65 0a 23 ith all of the.#
3d480 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 69 6e arguments in
3d490 74 61 63 74 2e 0a 23 0a 23 20 20 20 20 4e 6f 74 tact..#.# Not
3d4a0 65 20 74 68 61 74 20 73 6f 6d 65 20 77 69 64 67 e that some widg
3d4b0 65 74 20 63 6f 6d 6d 61 6e 64 73 20 61 72 65 20 et commands are
3d4c0 64 65 66 69 6e 65 64 20 22 69 6e 6c 69 6e 65 22 defined "inline"
3d4d0 20 28 69 65 3a 0a 23 20 20 20 20 77 69 74 68 69 (ie:.# withi
3d4e0 6e 20 74 68 69 73 20 70 72 6f 63 29 2c 20 61 6e n this proc), an
3d4f0 64 20 73 6f 6d 65 20 64 6f 20 6d 6f 73 74 20 6f d some do most o
3d500 66 20 74 68 65 69 72 20 77 6f 72 6b 20 69 6e 0a f their work in.
3d510 23 20 20 20 20 73 65 70 61 72 61 74 65 20 70 72 # separate pr
3d520 6f 63 73 2e 20 54 68 69 73 20 69 73 20 6d 65 72 ocs. This is mer
3d530 65 6c 79 20 62 65 63 61 75 73 65 20 73 6f 6d 65 ely because some
3d540 74 69 6d 65 73 20 69 74 20 77 61 73 0a 23 20 20 times it was.#
3d550 20 20 65 61 73 69 65 72 20 74 6f 20 64 6f 20 69 easier to do i
3d560 74 20 6f 6e 65 20 77 61 79 20 6f 72 20 74 68 65 t one way or the
3d570 20 6f 74 68 65 72 2e 0a 23 0a 23 20 41 72 67 75 other..#.# Argu
3d580 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 20 20 77 20 ments:.#.# w
3d590 20 20 20 20 20 20 20 20 77 69 64 67 65 74 20 70 widget p
3d5a0 61 74 68 6e 61 6d 65 0a 23 20 20 20 20 63 6f 6d athname.# com
3d5b0 6d 61 6e 64 20 20 20 77 69 64 67 65 74 20 73 75 mand widget su
3d5c0 62 63 6f 6d 6d 61 6e 64 0a 23 20 20 20 20 61 72 bcommand.# ar
3d5d0 67 73 20 20 20 20 20 20 61 64 64 69 74 69 6f 6e gs addition
3d5e0 61 6c 20 61 72 67 75 6d 65 6e 74 73 3b 20 76 61 al arguments; va
3d5f0 72 69 65 73 20 77 69 74 68 20 74 68 65 20 73 75 ries with the su
3d600 62 63 6f 6d 6d 61 6e 64 0a 23 0a 23 20 52 65 73 bcommand.#.# Res
3d610 75 6c 74 73 3a 0a 23 0a 23 20 20 20 20 50 65 72 ults:.#.# Per
3d620 66 6f 72 6d 73 20 74 68 65 20 72 65 71 75 65 73 forms the reques
3d630 74 65 64 20 77 69 64 67 65 74 20 63 6f 6d 6d 61 ted widget comma
3d640 6e 64 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 6f nd..proc ::combo
3d650 62 6f 78 3a 3a 57 69 64 67 65 74 50 72 6f 63 20 box::WidgetProc
3d660 7b 77 20 63 6f 6d 6d 61 6e 64 20 61 72 67 73 7d {w command args}
3d670 20 7b 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 {. upvar ::c
3d680 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 77 ombobox::${w}::w
3d690 69 64 67 65 74 73 20 77 69 64 67 65 74 73 0a 20 idgets widgets.
3d6a0 20 20 20 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f upvar ::combo
3d6b0 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f 70 74 69 6f box::${w}::optio
3d6c0 6e 73 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 75 ns options. u
3d6d0 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a pvar ::combobox:
3d6e0 3a 24 7b 77 7d 3a 3a 6f 6c 64 46 6f 63 75 73 20 :${w}::oldFocus
3d6f0 6f 6c 64 46 6f 63 75 73 0a 20 20 20 20 75 70 76 oldFocus. upv
3d700 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 ar ::combobox::$
3d710 7b 77 7d 3a 3a 6f 6c 64 46 6f 63 75 73 20 6f 6c {w}::oldFocus ol
3d720 64 47 72 61 62 0a 0a 20 20 20 20 73 65 74 20 63 dGrab.. set c
3d730 6f 6d 6d 61 6e 64 20 5b 3a 3a 63 6f 6d 62 6f 62 ommand [::combob
3d740 6f 78 3a 3a 43 61 6e 6f 6e 69 7a 65 20 24 77 20 ox::Canonize $w
3d750 63 6f 6d 6d 61 6e 64 20 24 63 6f 6d 6d 61 6e 64 command $command
3d760 5d 0a 0a 20 20 20 20 23 20 74 68 69 73 20 69 73 ].. # this is
3d770 20 6a 75 73 74 20 73 68 6f 72 74 68 61 6e 64 20 just shorthand
3d780 6e 6f 74 61 74 69 6f 6e 2e 2e 2e 0a 20 20 20 20 notation....
3d790 73 65 74 20 64 6f 57 69 64 67 65 74 43 6f 6d 6d set doWidgetComm
3d7a0 61 6e 64 20 5b 6c 69 73 74 20 3a 3a 63 6f 6d 62 and [list ::comb
3d7b0 6f 62 6f 78 3a 3a 44 6f 49 6e 74 65 72 6e 61 6c obox::DoInternal
3d7c0 57 69 64 67 65 74 43 6f 6d 6d 61 6e 64 20 5c 0a WidgetCommand \.
3d7d0 20 20 20 20 20 20 24 77 69 64 67 65 74 73 28 74 $widgets(t
3d7e0 68 69 73 29 5d 0a 0a 20 20 20 20 69 66 20 7b 24 his)].. if {$
3d7f0 63 6f 6d 6d 61 6e 64 20 3d 3d 20 22 6c 69 73 74 command == "list
3d800 22 7d 20 7b 0a 09 23 20 6f 6b 2c 20 74 68 65 20 "} {..# ok, the
3d810 6e 65 78 74 20 61 72 67 75 6d 65 6e 74 20 69 73 next argument is
3d820 20 61 20 6c 69 73 74 20 63 6f 6d 6d 61 6e 64 3b a list command;
3d830 20 77 65 27 6c 6c 0a 09 23 20 72 69 70 20 69 74 we'll..# rip it
3d840 20 66 72 6f 6d 20 61 72 67 73 20 61 6e 64 20 61 from args and a
3d850 70 70 65 6e 64 20 69 74 20 74 6f 20 63 6f 6d 6d ppend it to comm
3d860 61 6e 64 20 74 6f 0a 09 23 20 63 72 65 61 74 65 and to..# create
3d870 20 61 20 75 6e 69 71 75 65 20 69 6e 74 65 72 6e a unique intern
3d880 61 6c 20 63 6f 6d 6d 61 6e 64 0a 09 23 0a 09 23 al command..#..#
3d890 20 4e 42 3a 20 62 65 63 61 75 73 65 20 6f 66 20 NB: because of
3d8a0 74 68 65 20 73 6c 6f 70 70 79 20 77 61 79 20 77 the sloppy way w
3d8b0 65 20 61 72 65 20 64 6f 69 6e 67 20 74 68 69 73 e are doing this
3d8c0 2c 0a 09 23 20 77 65 27 6c 6c 20 61 6c 73 6f 20 ,..# we'll also
3d8d0 6c 65 74 20 74 68 65 20 75 73 65 72 20 65 6e 74 let the user ent
3d8e0 65 72 20 6f 75 72 20 73 65 63 72 65 74 20 63 6f er our secret co
3d8f0 6d 6d 61 6e 64 0a 09 23 20 64 69 72 65 63 74 6c mmand..# directl
3d900 79 20 28 65 67 3a 20 6c 69 73 74 69 6e 73 65 72 y (eg: listinser
3d910 74 2c 20 6c 69 73 74 64 65 6c 65 74 65 29 2c 20 t, listdelete),
3d920 62 75 74 20 77 65 0a 09 23 20 77 6f 6e 27 74 20 but we..# won't
3d930 64 6f 63 75 6d 65 6e 74 20 74 68 61 74 20 66 61 document that fa
3d940 63 74 0a 09 73 65 74 20 63 6f 6d 6d 61 6e 64 20 ct..set command
3d950 22 6c 69 73 74 2d 5b 6c 69 6e 64 65 78 20 24 61 "list-[lindex $a
3d960 72 67 73 20 30 5d 22 0a 09 73 65 74 20 61 72 67 rgs 0]"..set arg
3d970 73 20 5b 6c 72 61 6e 67 65 20 24 61 72 67 73 20 s [lrange $args
3d980 31 20 65 6e 64 5d 0a 20 20 20 20 7d 0a 0a 20 20 1 end]. }..
3d990 20 20 73 65 74 20 72 65 73 75 6c 74 20 22 22 0a set result "".
3d9a0 0a 20 20 20 20 23 20 6d 61 6e 79 20 6f 66 20 74 . # many of t
3d9b0 68 65 73 65 20 63 6f 6d 6d 61 6e 64 73 20 61 72 hese commands ar
3d9c0 65 20 6a 75 73 74 20 73 79 6e 6f 6e 79 6d 73 20 e just synonyms
3d9d0 66 6f 72 20 73 70 65 63 69 66 69 63 0a 20 20 20 for specific.
3d9e0 20 23 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 20 6f # commands in o
3d9f0 6e 65 20 6f 66 20 74 68 65 20 73 75 62 77 69 64 ne of the subwid
3da00 67 65 74 73 2e 20 57 65 27 6c 6c 20 67 65 74 20 gets. We'll get
3da10 74 68 65 6d 20 6f 75 74 0a 20 20 20 20 23 20 6f them out. # o
3da20 66 20 74 68 65 20 77 61 79 20 66 69 72 73 74 2c f the way first,
3da30 20 74 68 65 6e 20 64 6f 20 74 68 65 20 63 75 73 then do the cus
3da40 74 6f 6d 20 63 6f 6d 6d 61 6e 64 73 2e 0a 20 20 tom commands..
3da50 20 20 73 77 69 74 63 68 20 2d 2d 20 24 63 6f 6d switch -- $com
3da60 6d 61 6e 64 20 7b 0a 20 20 20 20 62 62 6f 78 20 mand {. bbox
3da70 2d 0a 20 20 20 20 64 65 6c 65 74 65 20 2d 0a 20 -. delete -.
3da80 20 20 20 67 65 74 20 2d 0a 20 20 20 20 69 63 75 get -. icu
3da90 72 73 6f 72 20 2d 0a 20 20 20 20 69 6e 64 65 78 rsor -. index
3daa0 20 2d 0a 20 20 20 20 69 6e 73 65 72 74 20 2d 0a -. insert -.
3dab0 20 20 20 20 73 63 61 6e 20 2d 0a 20 20 20 20 73 scan -. s
3dac0 65 6c 65 63 74 69 6f 6e 20 2d 0a 20 20 20 20 78 election -. x
3dad0 76 69 65 77 20 7b 0a 09 20 20 20 20 73 65 74 20 view {.. set
3dae0 72 65 73 75 6c 74 20 5b 65 76 61 6c 20 24 64 6f result [eval $do
3daf0 57 69 64 67 65 74 43 6f 6d 6d 61 6e 64 20 65 6e WidgetCommand en
3db00 74 72 79 20 24 63 6f 6d 6d 61 6e 64 20 24 61 72 try $command $ar
3db10 67 73 5d 0a 09 7d 0a 20 20 20 20 6c 69 73 74 2d gs]..}. list-
3db20 67 65 74 20 7b 0a 09 20 20 20 20 73 65 74 20 72 get {.. set r
3db30 65 73 75 6c 74 20 5b 65 76 61 6c 20 24 64 6f 57 esult [eval $doW
3db40 69 64 67 65 74 43 6f 6d 6d 61 6e 64 20 6c 69 73 idgetCommand lis
3db50 74 62 6f 78 20 67 65 74 20 24 61 72 67 73 5d 0a tbox get $args].
3db60 09 7d 0a 20 20 20 20 6c 69 73 74 2d 69 6e 64 65 .}. list-inde
3db70 78 20 7b 0a 09 20 20 20 20 73 65 74 20 72 65 73 x {.. set res
3db80 75 6c 74 20 5b 65 76 61 6c 20 24 64 6f 57 69 64 ult [eval $doWid
3db90 67 65 74 43 6f 6d 6d 61 6e 64 20 6c 69 73 74 62 getCommand listb
3dba0 6f 78 20 69 6e 64 65 78 20 24 61 72 67 73 5d 0a ox index $args].
3dbb0 09 7d 0a 20 20 20 20 6c 69 73 74 2d 73 69 7a 65 .}. list-size
3dbc0 20 7b 0a 09 20 20 20 20 73 65 74 20 72 65 73 75 {.. set resu
3dbd0 6c 74 20 5b 65 76 61 6c 20 24 64 6f 57 69 64 67 lt [eval $doWidg
3dbe0 65 74 43 6f 6d 6d 61 6e 64 20 6c 69 73 74 62 6f etCommand listbo
3dbf0 78 20 73 69 7a 65 20 24 61 72 67 73 5d 0a 09 7d x size $args]..}
3dc00 0a 20 20 20 20 73 65 6c 65 63 74 20 7b 0a 09 20 . select {..
3dc10 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 if {[llength
3dc20 24 61 72 67 73 5d 20 3d 3d 20 31 7d 20 7b 0a 09 $args] == 1} {..
3dc30 09 73 65 74 20 69 6e 64 65 78 20 5b 6c 69 6e 64 .set index [lind
3dc40 65 78 20 24 61 72 67 73 20 30 5d 0a 09 09 73 65 ex $args 0]...se
3dc50 74 20 72 65 73 75 6c 74 20 5b 53 65 6c 65 63 74 t result [Select
3dc60 20 24 77 69 64 67 65 74 73 28 74 68 69 73 29 20 $widgets(this)
3dc70 24 69 6e 64 65 78 5d 0a 09 20 20 20 20 7d 20 65 $index].. } e
3dc80 6c 73 65 20 7b 0a 09 09 65 72 72 6f 72 20 22 75 lse {...error "u
3dc90 73 61 67 65 3a 20 24 77 20 73 65 6c 65 63 74 20 sage: $w select
3dca0 69 6e 64 65 78 22 0a 09 20 20 20 20 7d 0a 09 7d index".. }..}
3dcb0 0a 20 20 20 20 73 75 62 77 69 64 67 65 74 20 7b . subwidget {
3dcc0 0a 09 20 20 20 20 73 65 74 20 6b 6e 6f 77 6e 57 .. set knownW
3dcd0 69 64 67 65 74 73 20 5b 6c 69 73 74 20 62 75 74 idgets [list but
3dce0 74 6f 6e 20 65 6e 74 72 79 20 6c 69 73 74 62 6f ton entry listbo
3dcf0 78 20 64 72 6f 70 64 6f 77 6e 20 76 73 62 5d 0a x dropdown vsb].
3dd00 09 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 . if {[llengt
3dd10 68 20 24 61 72 67 73 5d 20 3d 3d 20 30 7d 20 7b h $args] == 0} {
3dd20 0a 09 09 72 65 74 75 72 6e 20 24 6b 6e 6f 77 6e ...return $known
3dd30 57 69 64 67 65 74 73 0a 09 20 20 20 20 7d 0a 0a Widgets.. }..
3dd40 09 20 20 20 20 73 65 74 20 6e 61 6d 65 20 5b 6c . set name [l
3dd50 69 6e 64 65 78 20 24 61 72 67 73 20 30 5d 0a 09 index $args 0]..
3dd60 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 68 if {[lsearch
3dd70 20 24 6b 6e 6f 77 6e 57 69 64 67 65 74 73 20 24 $knownWidgets $
3dd80 6e 61 6d 65 5d 20 21 3d 20 2d 31 7d 20 7b 0a 09 name] != -1} {..
3dd90 09 73 65 74 20 72 65 73 75 6c 74 20 24 77 69 64 .set result $wid
3dda0 67 65 74 73 28 24 6e 61 6d 65 29 0a 09 20 20 20 gets($name)..
3ddb0 20 7d 20 65 6c 73 65 20 7b 0a 09 09 65 72 72 6f } else {...erro
3ddc0 72 20 22 75 6e 6b 6e 6f 77 6e 20 73 75 62 77 69 r "unknown subwi
3ddd0 64 67 65 74 20 24 6e 61 6d 65 22 0a 09 20 20 20 dget $name"..
3dde0 20 7d 0a 09 7d 0a 20 20 20 20 63 75 72 73 65 6c }..}. cursel
3ddf0 65 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 73 65 ection {.. se
3de00 74 20 72 65 73 75 6c 74 20 5b 65 76 61 6c 20 24 t result [eval $
3de10 64 6f 57 69 64 67 65 74 43 6f 6d 6d 61 6e 64 20 doWidgetCommand
3de20 6c 69 73 74 62 6f 78 20 63 75 72 73 65 6c 65 63 listbox curselec
3de30 74 69 6f 6e 5d 0a 09 7d 0a 20 20 20 20 6c 69 73 tion]..}. lis
3de40 74 2d 69 6e 73 65 72 74 20 7b 0a 09 20 20 20 20 t-insert {..
3de50 65 76 61 6c 20 24 64 6f 57 69 64 67 65 74 43 6f eval $doWidgetCo
3de60 6d 6d 61 6e 64 20 6c 69 73 74 62 6f 78 20 69 6e mmand listbox in
3de70 73 65 72 74 20 24 61 72 67 73 0a 09 20 20 20 20 sert $args..
3de80 73 65 74 20 72 65 73 75 6c 74 20 5b 48 61 6e 64 set result [Hand
3de90 6c 65 53 63 72 6f 6c 6c 62 61 72 20 24 77 20 22 leScrollbar $w "
3dea0 67 72 6f 77 22 5d 0a 09 7d 0a 20 20 20 20 6c 69 grow"]..}. li
3deb0 73 74 2d 64 65 6c 65 74 65 20 7b 0a 09 20 20 20 st-delete {..
3dec0 20 65 76 61 6c 20 24 64 6f 57 69 64 67 65 74 43 eval $doWidgetC
3ded0 6f 6d 6d 61 6e 64 20 6c 69 73 74 62 6f 78 20 64 ommand listbox d
3dee0 65 6c 65 74 65 20 24 61 72 67 73 0a 09 20 20 20 elete $args..
3def0 20 73 65 74 20 72 65 73 75 6c 74 20 5b 48 61 6e set result [Han
3df00 64 6c 65 53 63 72 6f 6c 6c 62 61 72 20 24 77 20 dleScrollbar $w
3df10 22 73 68 72 69 6e 6b 22 5d 0a 09 7d 0a 20 20 20 "shrink"]..}.
3df20 20 74 6f 67 67 6c 65 20 7b 0a 09 20 20 20 20 23 toggle {.. #
3df30 20 69 67 6e 6f 72 65 20 74 68 69 73 20 63 6f 6d ignore this com
3df40 6d 61 6e 64 20 69 66 20 74 68 65 20 77 69 64 67 mand if the widg
3df50 65 74 20 69 73 20 64 69 73 61 62 6c 65 64 2e 2e et is disabled..
3df60 2e 0a 09 20 20 20 20 69 66 20 7b 24 6f 70 74 69 ... if {$opti
3df70 6f 6e 73 28 2d 73 74 61 74 65 29 20 3d 3d 20 22 ons(-state) == "
3df80 64 69 73 61 62 6c 65 64 22 7d 20 72 65 74 75 72 disabled"} retur
3df90 6e 0a 0a 09 20 20 20 20 23 20 70 6f 70 73 20 64 n... # pops d
3dfa0 6f 77 6e 20 74 68 65 20 6c 69 73 74 20 69 66 20 own the list if
3dfb0 69 74 20 69 73 20 6e 6f 74 2c 20 68 69 64 65 73 it is not, hides
3dfc0 20 69 74 0a 09 20 20 20 20 23 20 69 66 20 69 74 it.. # if it
3dfd0 20 69 73 2e 2e 2e 0a 09 20 20 20 20 69 66 20 7b is..... if {
3dfe0 5b 77 69 6e 66 6f 20 69 73 6d 61 70 70 65 64 20 [winfo ismapped
3dff0 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 6f 77 $widgets(dropdow
3e000 6e 29 5d 7d 20 7b 0a 09 09 73 65 74 20 72 65 73 n)]} {...set res
3e010 75 6c 74 20 5b 24 77 69 64 67 65 74 73 28 74 68 ult [$widgets(th
3e020 69 73 29 20 63 6c 6f 73 65 5d 0a 09 20 20 20 20 is) close]..
3e030 7d 20 65 6c 73 65 20 7b 0a 09 09 73 65 74 20 72 } else {...set r
3e040 65 73 75 6c 74 20 5b 24 77 69 64 67 65 74 73 28 esult [$widgets(
3e050 74 68 69 73 29 20 6f 70 65 6e 5d 0a 09 20 20 20 this) open]..
3e060 20 7d 0a 09 7d 0a 20 20 20 20 6f 70 65 6e 20 7b }..}. open {
3e070 0a 0a 09 20 20 20 20 23 20 69 66 20 74 68 69 73 ... # if this
3e080 20 69 73 20 61 6e 20 65 64 69 74 61 62 6c 65 20 is an editable
3e090 63 6f 6d 62 6f 62 6f 78 2c 20 74 68 65 20 66 6f combobox, the fo
3e0a0 63 75 73 20 73 68 6f 75 6c 64 0a 09 20 20 20 20 cus should..
3e0b0 23 20 62 65 20 73 65 74 20 74 6f 20 74 68 65 20 # be set to the
3e0c0 65 6e 74 72 79 20 77 69 64 67 65 74 0a 09 20 20 entry widget..
3e0d0 20 20 69 66 20 7b 24 6f 70 74 69 6f 6e 73 28 2d if {$options(-
3e0e0 65 64 69 74 61 62 6c 65 29 7d 20 7b 0a 09 09 66 editable)} {...f
3e0f0 6f 63 75 73 20 24 77 69 64 67 65 74 73 28 65 6e ocus $widgets(en
3e100 74 72 79 29 0a 09 09 24 77 69 64 67 65 74 73 28 try)...$widgets(
3e110 65 6e 74 72 79 29 20 73 65 6c 65 63 74 20 72 61 entry) select ra
3e120 6e 67 65 20 30 20 65 6e 64 0a 09 09 24 77 69 64 nge 0 end...$wid
3e130 67 65 74 73 28 65 6e 74 72 79 29 20 69 63 75 72 gets(entry) icur
3e140 20 65 6e 64 0a 09 20 20 20 20 7d 0a 0a 09 20 20 end.. }...
3e150 20 20 23 20 69 66 20 77 65 20 61 72 65 20 64 69 # if we are di
3e160 73 61 62 6c 65 64 2c 20 77 65 20 77 6f 6e 27 74 sabled, we won't
3e170 20 61 6c 6c 6f 77 20 74 68 69 73 20 74 6f 20 68 allow this to h
3e180 61 70 70 65 6e 0a 09 20 20 20 20 69 66 20 7b 24 appen.. if {$
3e190 6f 70 74 69 6f 6e 73 28 2d 73 74 61 74 65 29 20 options(-state)
3e1a0 3d 3d 20 22 64 69 73 61 62 6c 65 64 22 7d 20 7b == "disabled"} {
3e1b0 0a 09 09 72 65 74 75 72 6e 20 30 0a 09 20 20 20 ...return 0..
3e1c0 20 7d 0a 0a 09 20 20 20 20 23 20 69 66 20 74 68 }... # if th
3e1d0 65 72 65 20 69 73 20 61 20 2d 6f 70 65 6e 63 6f ere is a -openco
3e1e0 6d 6d 61 6e 64 2c 20 65 78 65 63 75 74 65 20 69 mmand, execute i
3e1f0 74 20 6e 6f 77 0a 09 20 20 20 20 69 66 20 7b 5b t now.. if {[
3e200 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6f string length $o
3e210 70 74 69 6f 6e 73 28 2d 6f 70 65 6e 63 6f 6d 6d ptions(-opencomm
3e220 61 6e 64 29 5d 20 3e 20 30 7d 20 7b 0a 09 09 23 and)] > 0} {...#
3e230 20 68 6d 6d 6d 2e 2e 2e 20 73 68 6f 75 6c 64 20 hmmm... should
3e240 49 20 64 6f 20 61 20 63 61 74 63 68 2c 20 6f 72 I do a catch, or
3e250 20 6a 75 73 74 20 6c 65 74 20 74 68 65 20 6e 6f just let the no
3e260 72 6d 61 6c 0a 09 09 23 20 65 72 72 6f 72 20 68 rmal...# error h
3e270 61 6e 64 6c 69 6e 67 20 68 61 6e 64 6c 65 20 61 andling handle a
3e280 6e 79 20 65 72 72 6f 72 73 3f 20 46 6f 72 20 6e ny errors? For n
3e290 6f 77 2c 20 74 68 65 20 6c 61 74 74 65 72 2e 2e ow, the latter..
3e2a0 2e 0a 09 09 75 70 6c 65 76 65 6c 20 5c 23 30 20 ....uplevel \#0
3e2b0 24 6f 70 74 69 6f 6e 73 28 2d 6f 70 65 6e 63 6f $options(-openco
3e2c0 6d 6d 61 6e 64 29 0a 09 20 20 20 20 7d 0a 0a 09 mmand).. }...
3e2d0 20 20 20 20 23 20 63 6f 6d 70 75 74 65 20 74 68 # compute th
3e2e0 65 20 67 65 6f 6d 65 74 72 79 20 6f 66 20 74 68 e geometry of th
3e2f0 65 20 77 69 6e 64 6f 77 20 74 6f 20 70 6f 70 20 e window to pop
3e300 75 70 2c 20 61 6e 64 20 73 65 74 0a 09 20 20 20 up, and set..
3e310 20 23 20 69 74 2c 20 61 6e 64 20 66 6f 72 63 65 # it, and force
3e320 20 74 68 65 20 77 69 6e 64 6f 77 20 6d 61 6e 61 the window mana
3e330 67 65 72 20 74 6f 20 74 61 6b 65 20 6e 6f 74 69 ger to take noti
3e340 63 65 0a 09 20 20 20 20 23 20 28 65 76 65 6e 20 ce.. # (even
3e350 69 66 20 69 74 20 69 73 20 6e 6f 74 20 70 72 65 if it is not pre
3e360 73 65 6e 74 6c 79 20 76 69 73 69 62 6c 65 29 2e sently visible).
3e370 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20 74 .. #.. # t
3e380 68 69 73 20 69 73 6e 27 74 20 73 74 72 69 63 74 his isn't strict
3e390 6c 79 20 6e 65 63 65 73 73 61 72 79 20 69 66 20 ly necessary if
3e3a0 74 68 65 20 77 69 6e 64 6f 77 20 69 73 20 61 6c the window is al
3e3b0 72 65 61 64 79 0a 09 20 20 20 20 23 20 6d 61 70 ready.. # map
3e3c0 70 65 64 2c 20 62 75 74 20 77 65 27 6c 6c 20 67 ped, but we'll g
3e3d0 6f 20 61 68 65 61 64 20 61 6e 64 20 73 65 74 20 o ahead and set
3e3e0 74 68 65 20 67 65 6f 6d 65 74 72 79 20 68 65 72 the geometry her
3e3f0 65 0a 09 20 20 20 20 23 20 73 69 6e 63 65 20 69 e.. # since i
3e400 74 73 20 68 61 72 6d 6c 65 73 73 20 61 6e 64 20 ts harmless and
3e410 2a 6d 61 79 2a 20 61 63 74 75 61 6c 6c 79 20 72 *may* actually r
3e420 65 73 65 74 20 74 68 65 20 67 65 6f 6d 65 74 72 eset the geometr
3e430 79 0a 09 20 20 20 20 23 20 74 6f 20 73 6f 6d 65 y.. # to some
3e440 74 68 69 6e 67 20 62 65 74 74 65 72 20 69 6e 20 thing better in
3e450 73 6f 6d 65 20 77 65 69 72 64 20 63 61 73 65 2e some weird case.
3e460 0a 09 20 20 20 20 73 65 74 20 67 65 6f 6d 65 74 .. set geomet
3e470 72 79 20 5b 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a ry [::combobox::
3e480 43 6f 6d 70 75 74 65 47 65 6f 6d 65 74 72 79 20 ComputeGeometry
3e490 24 77 69 64 67 65 74 73 28 74 68 69 73 29 5d 0a $widgets(this)].
3e4a0 09 20 20 20 20 77 6d 20 67 65 6f 6d 65 74 72 79 . wm geometry
3e4b0 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 6f $widgets(dropdo
3e4c0 77 6e 29 20 24 67 65 6f 6d 65 74 72 79 0a 09 20 wn) $geometry..
3e4d0 20 20 20 75 70 64 61 74 65 20 69 64 6c 65 74 61 update idleta
3e4e0 73 6b 73 0a 0a 09 20 20 20 20 23 20 69 66 20 77 sks... # if w
3e4f0 65 20 61 72 65 20 61 6c 72 65 61 64 79 20 6f 70 e are already op
3e500 65 6e 2c 20 74 68 65 72 65 27 73 20 6e 6f 74 68 en, there's noth
3e510 69 6e 67 20 65 6c 73 65 20 74 6f 20 64 6f 0a 09 ing else to do..
3e520 20 20 20 20 69 66 20 7b 5b 77 69 6e 66 6f 20 69 if {[winfo i
3e530 73 6d 61 70 70 65 64 20 24 77 69 64 67 65 74 73 smapped $widgets
3e540 28 64 72 6f 70 64 6f 77 6e 29 5d 7d 20 7b 0a 09 (dropdown)]} {..
3e550 09 72 65 74 75 72 6e 20 30 0a 09 20 20 20 20 7d .return 0.. }
3e560 0a 0a 09 20 20 20 20 23 20 73 61 76 65 20 74 68 ... # save th
3e570 65 20 77 69 64 67 65 74 20 74 68 61 74 20 63 75 e widget that cu
3e580 72 72 65 6e 74 6c 79 20 68 61 73 20 74 68 65 20 rrently has the
3e590 66 6f 63 75 73 3b 20 77 65 27 6c 6c 20 72 65 73 focus; we'll res
3e5a0 74 6f 72 65 0a 09 20 20 20 20 23 20 74 68 65 20 tore.. # the
3e5b0 66 6f 63 75 73 20 74 68 65 72 65 20 77 68 65 6e focus there when
3e5c0 20 77 65 27 72 65 20 64 6f 6e 65 0a 09 20 20 20 we're done..
3e5d0 20 73 65 74 20 6f 6c 64 46 6f 63 75 73 20 5b 66 set oldFocus [f
3e5e0 6f 63 75 73 5d 0a 0a 09 20 20 20 20 23 20 6f 6b ocus]... # ok
3e5f0 2c 20 74 77 65 61 6b 20 74 68 65 20 76 69 73 75 , tweak the visu
3e600 61 6c 20 61 70 70 65 61 72 61 6e 63 65 20 6f 66 al appearance of
3e610 20 74 68 69 6e 67 73 20 61 6e 64 0a 09 20 20 20 things and..
3e620 20 23 20 6d 61 6b 65 20 74 68 65 20 6c 69 73 74 # make the list
3e630 20 70 6f 70 20 75 70 0a 09 20 20 20 20 24 77 69 pop up.. $wi
3e640 64 67 65 74 73 28 62 75 74 74 6f 6e 29 20 63 6f dgets(button) co
3e650 6e 66 69 67 75 72 65 20 2d 72 65 6c 69 65 66 20 nfigure -relief
3e660 73 75 6e 6b 65 6e 0a 09 20 20 20 20 72 61 69 73 sunken.. rais
3e670 65 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 e $widgets(dropd
3e680 6f 77 6e 29 0a 09 20 20 20 20 77 6d 20 64 65 69 own).. wm dei
3e690 63 6f 6e 69 66 79 20 24 77 69 64 67 65 74 73 28 conify $widgets(
3e6a0 64 72 6f 70 64 6f 77 6e 29 0a 09 20 20 20 20 74 dropdown).. t
3e6b0 6b 77 61 69 74 20 76 69 73 69 62 69 6c 69 74 79 kwait visibility
3e6c0 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 6f $widgets(dropdo
3e6d0 77 6e 29 0a 09 20 20 20 20 66 6f 63 75 73 20 2d wn).. focus -
3e6e0 66 6f 72 63 65 20 24 77 69 64 67 65 74 73 28 64 force $widgets(d
3e6f0 72 6f 70 64 6f 77 6e 29 0a 0a 09 20 20 20 20 23 ropdown)... #
3e700 20 66 6f 72 63 65 20 66 6f 63 75 73 20 74 6f 20 force focus to
3e710 74 68 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 the entry widget
3e720 20 73 6f 20 77 65 20 63 61 6e 20 68 61 6e 64 6c so we can handl
3e730 65 20 6b 65 79 70 72 65 73 73 0a 09 20 20 20 20 e keypress..
3e740 23 20 65 76 65 6e 74 73 20 66 6f 72 20 74 72 61 # events for tra
3e750 76 65 72 73 61 6c 0a 09 20 20 20 20 66 6f 63 75 versal.. focu
3e760 73 20 2d 66 6f 72 63 65 20 24 77 69 64 67 65 74 s -force $widget
3e770 73 28 65 6e 74 72 79 29 0a 0a 09 20 20 20 20 23 s(entry)... #
3e780 20 73 65 6c 65 63 74 20 73 6f 6d 65 74 68 69 6e select somethin
3e790 67 20 62 79 20 64 65 66 61 75 6c 74 2c 20 62 75 g by default, bu
3e7a0 74 20 6f 6e 6c 79 20 69 66 20 69 74 73 20 61 6e t only if its an
3e7b0 0a 09 20 20 20 20 23 20 65 78 61 63 74 20 6d 61 .. # exact ma
3e7c0 74 63 68 2e 2e 2e 0a 09 20 20 20 20 3a 3a 63 6f tch..... ::co
3e7d0 6d 62 6f 62 6f 78 3a 3a 46 69 6e 64 20 24 77 69 mbobox::Find $wi
3e7e0 64 67 65 74 73 28 74 68 69 73 29 20 31 0a 0a 09 dgets(this) 1...
3e7f0 20 20 20 20 23 20 73 61 76 65 20 74 68 65 20 63 # save the c
3e800 75 72 72 65 6e 74 20 67 72 61 62 20 73 74 61 74 urrent grab stat
3e810 65 20 66 6f 72 20 74 68 65 20 64 69 73 70 6c 61 e for the displa
3e820 79 20 63 6f 6e 74 61 69 6e 69 6e 67 0a 09 20 20 y containing..
3e830 20 20 23 20 74 68 69 73 20 77 69 64 67 65 74 2e # this widget.
3e840 20 57 65 27 6c 6c 20 72 65 73 74 6f 72 65 20 69 We'll restore i
3e850 74 20 77 68 65 6e 20 77 65 20 63 6c 6f 73 65 20 t when we close
3e860 74 68 65 20 64 72 6f 70 64 6f 77 6e 0a 09 20 20 the dropdown..
3e870 20 20 23 20 6c 69 73 74 0a 09 20 20 20 20 73 65 # list.. se
3e880 74 20 73 74 61 74 75 73 20 22 6e 6f 6e 65 22 0a t status "none".
3e890 09 20 20 20 20 73 65 74 20 67 72 61 62 20 5b 67 . set grab [g
3e8a0 72 61 62 20 63 75 72 72 65 6e 74 20 24 77 69 64 rab current $wid
3e8b0 67 65 74 73 28 74 68 69 73 29 5d 0a 09 20 20 20 gets(this)]..
3e8c0 20 69 66 20 7b 24 67 72 61 62 20 21 3d 20 22 22 if {$grab != ""
3e8d0 7d 20 7b 0a 09 09 73 65 74 20 73 74 61 74 75 73 } {...set status
3e8e0 20 5b 67 72 61 62 20 73 74 61 74 75 73 20 24 67 [grab status $g
3e8f0 72 61 62 5d 0a 09 20 20 20 20 7d 0a 09 20 20 20 rab].. }..
3e900 20 73 65 74 20 6f 6c 64 47 72 61 62 20 5b 6c 69 set oldGrab [li
3e910 73 74 20 24 67 72 61 62 20 24 73 74 61 74 75 73 st $grab $status
3e920 5d 0a 09 20 20 20 20 75 6e 73 65 74 20 67 72 61 ].. unset gra
3e930 62 20 73 74 61 74 75 73 0a 0a 09 20 20 20 20 23 b status... #
3e940 20 2a 67 61 73 70 2a 20 64 6f 20 61 20 67 6c 6f *gasp* do a glo
3e950 62 61 6c 20 67 72 61 62 21 21 21 20 4d 6f 6d 20 bal grab!!! Mom
3e960 61 6c 77 61 79 73 20 74 6f 6c 64 20 6d 65 20 6e always told me n
3e970 6f 74 20 74 6f 0a 09 20 20 20 20 23 20 64 6f 20 ot to.. # do
3e980 74 68 69 6e 67 73 20 6c 69 6b 65 20 74 68 69 73 things like this
3e990 2c 20 62 75 74 20 73 6f 6d 65 74 69 6d 65 73 20 , but sometimes
3e9a0 61 20 6d 61 6e 27 73 20 67 6f 74 74 61 20 64 6f a man's gotta do
3e9b0 0a 09 20 20 20 20 23 20 77 68 61 74 20 61 20 6d .. # what a m
3e9c0 61 6e 27 73 20 67 6f 74 74 61 20 64 6f 2e 0a 09 an's gotta do...
3e9d0 20 20 20 20 72 61 69 73 65 20 24 77 69 64 67 65 raise $widge
3e9e0 74 73 28 64 72 6f 70 64 6f 77 6e 29 0a 09 20 20 ts(dropdown)..
3e9f0 20 20 67 72 61 62 20 2d 67 6c 6f 62 61 6c 20 24 grab -global $
3ea00 77 69 64 67 65 74 73 28 74 68 69 73 29 0a 0a 09 widgets(this)...
3ea10 20 20 20 20 23 20 66 61 6b 65 20 74 68 65 20 6c # fake the l
3ea20 69 73 74 62 6f 78 20 69 6e 74 6f 20 74 68 69 6e istbox into thin
3ea30 6b 69 6e 67 20 69 74 20 68 61 73 20 66 6f 63 75 king it has focu
3ea40 73 2e 20 54 68 69 73 20 69 73 0a 09 20 20 20 20 s. This is..
3ea50 23 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 67 # necessary to g
3ea60 65 74 20 73 63 61 6e 6e 69 6e 67 20 69 6e 69 74 et scanning init
3ea70 69 61 6c 69 7a 65 64 20 70 72 6f 70 65 72 6c 79 ialized properly
3ea80 20 69 6e 20 74 68 65 0a 09 20 20 20 20 23 20 6c in the.. # l
3ea90 69 73 74 62 6f 78 2e 0a 09 20 20 20 20 65 76 65 istbox... eve
3eaa0 6e 74 20 67 65 6e 65 72 61 74 65 20 24 77 69 64 nt generate $wid
3eab0 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 3c 42 gets(listbox) <B
3eac0 31 2d 45 6e 74 65 72 3e 0a 0a 09 20 20 20 20 72 1-Enter>... r
3ead0 65 74 75 72 6e 20 31 0a 09 7d 0a 20 20 20 20 63 eturn 1..}. c
3eae0 6c 6f 73 65 20 7b 0a 09 20 20 20 20 23 20 69 66 lose {.. # if
3eaf0 20 77 65 20 61 72 65 20 61 6c 72 65 61 64 79 20 we are already
3eb00 63 6c 6f 73 65 64 2c 20 64 6f 6e 27 74 20 64 6f closed, don't do
3eb10 20 61 6e 79 74 68 69 6e 67 2e 2e 2e 0a 09 20 20 anything.....
3eb20 20 20 69 66 20 7b 21 5b 77 69 6e 66 6f 20 69 73 if {![winfo is
3eb30 6d 61 70 70 65 64 20 24 77 69 64 67 65 74 73 28 mapped $widgets(
3eb40 64 72 6f 70 64 6f 77 6e 29 5d 7d 20 7b 0a 09 09 dropdown)]} {...
3eb50 72 65 74 75 72 6e 20 30 0a 09 20 20 20 20 7d 0a return 0.. }.
3eb60 0a 09 20 20 20 20 23 20 72 65 73 74 6f 72 65 20 .. # restore
3eb70 74 68 65 20 66 6f 63 75 73 20 61 6e 64 20 67 72 the focus and gr
3eb80 61 62 2c 20 62 75 74 20 69 67 6e 6f 72 65 20 61 ab, but ignore a
3eb90 6e 79 20 65 72 72 6f 72 73 2e 2e 2e 0a 09 20 20 ny errors.....
3eba0 20 20 23 20 77 65 27 72 65 20 67 6f 69 6e 67 20 # we're going
3ebb0 74 6f 20 62 65 20 70 61 72 61 6e 6f 69 64 20 61 to be paranoid a
3ebc0 6e 64 20 72 65 6c 65 61 73 65 20 74 68 65 20 67 nd release the g
3ebd0 72 61 62 20 62 65 66 6f 72 65 0a 09 20 20 20 20 rab before..
3ebe0 23 20 74 72 79 69 6e 67 20 74 6f 20 73 65 74 20 # trying to set
3ebf0 61 6e 79 20 6f 74 68 65 72 20 67 72 61 62 20 62 any other grab b
3ec00 65 63 61 75 73 65 20 77 65 20 72 65 61 6c 6c 79 ecause we really
3ec10 20 72 65 61 6c 6c 79 0a 09 20 20 20 20 23 20 72 really.. # r
3ec20 65 61 6c 6c 79 20 77 61 6e 74 20 74 6f 20 6d 61 eally want to ma
3ec30 6b 65 20 73 75 72 65 20 74 68 65 20 67 72 61 62 ke sure the grab
3ec40 20 69 73 20 72 65 6c 65 61 73 65 64 2e 0a 09 20 is released...
3ec50 20 20 20 63 61 74 63 68 20 7b 66 6f 63 75 73 20 catch {focus
3ec60 24 6f 6c 64 46 6f 63 75 73 7d 20 72 65 73 75 6c $oldFocus} resul
3ec70 74 0a 09 20 20 20 20 63 61 74 63 68 20 7b 67 72 t.. catch {gr
3ec80 61 62 20 72 65 6c 65 61 73 65 20 24 77 69 64 67 ab release $widg
3ec90 65 74 73 28 74 68 69 73 29 7d 0a 09 20 20 20 20 ets(this)}..
3eca0 63 61 74 63 68 20 7b 0a 09 09 73 65 74 20 73 74 catch {...set st
3ecb0 61 74 75 73 20 5b 6c 69 6e 64 65 78 20 24 6f 6c atus [lindex $ol
3ecc0 64 47 72 61 62 20 31 5d 0a 09 09 69 66 20 7b 24 dGrab 1]...if {$
3ecd0 73 74 61 74 75 73 20 3d 3d 20 22 67 6c 6f 62 61 status == "globa
3ece0 6c 22 7d 20 7b 0a 09 09 20 20 20 20 67 72 61 62 l"} {... grab
3ecf0 20 2d 67 6c 6f 62 61 6c 20 5b 6c 69 6e 64 65 78 -global [lindex
3ed00 20 24 6f 6c 64 47 72 61 62 20 30 5d 0a 09 09 7d $oldGrab 0]...}
3ed10 20 65 6c 73 65 69 66 20 7b 24 73 74 61 74 75 73 elseif {$status
3ed20 20 3d 3d 20 22 6c 6f 63 61 6c 22 7d 20 7b 0a 09 == "local"} {..
3ed30 09 20 20 20 20 67 72 61 62 20 5b 6c 69 6e 64 65 . grab [linde
3ed40 78 20 24 6f 6c 64 47 72 61 62 20 30 5d 0a 09 09 x $oldGrab 0]...
3ed50 7d 0a 09 09 75 6e 73 65 74 20 73 74 61 74 75 73 }...unset status
3ed60 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 20 .. }... #
3ed70 68 69 64 65 73 20 74 68 65 20 6c 69 73 74 62 6f hides the listbo
3ed80 78 0a 09 20 20 20 20 24 77 69 64 67 65 74 73 28 x.. $widgets(
3ed90 62 75 74 74 6f 6e 29 20 63 6f 6e 66 69 67 75 72 button) configur
3eda0 65 20 2d 72 65 6c 69 65 66 20 72 61 69 73 65 64 e -relief raised
3edb0 0a 09 20 20 20 20 77 6d 20 77 69 74 68 64 72 61 .. wm withdra
3edc0 77 20 24 77 69 64 67 65 74 73 28 64 72 6f 70 64 w $widgets(dropd
3edd0 6f 77 6e 29 0a 0a 09 20 20 20 20 23 20 73 65 6c own)... # sel
3ede0 65 63 74 20 74 68 65 20 64 61 74 61 20 69 6e 20 ect the data in
3edf0 74 68 65 20 65 6e 74 72 79 20 77 69 64 67 65 74 the entry widget
3ee00 2e 20 4e 6f 74 20 73 75 72 65 0a 09 20 20 20 20 . Not sure..
3ee10 23 20 77 68 79 2c 20 6f 74 68 65 72 20 74 68 61 # why, other tha
3ee20 6e 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 73 65 n observation se
3ee30 65 6d 73 20 74 6f 20 73 75 67 67 65 73 74 20 74 ems to suggest t
3ee40 68 61 74 27 73 0a 09 20 20 20 20 23 20 77 68 61 hat's.. # wha
3ee50 74 20 77 69 6e 64 6f 77 73 20 77 69 64 67 65 74 t windows widget
3ee60 73 20 64 6f 2e 0a 09 20 20 20 20 73 65 74 20 65 s do... set e
3ee70 64 69 74 61 62 6c 65 20 5b 3a 3a 63 6f 6d 62 6f ditable [::combo
3ee80 62 6f 78 3a 3a 47 65 74 42 6f 6f 6c 65 61 6e 20 box::GetBoolean
3ee90 24 6f 70 74 69 6f 6e 73 28 2d 65 64 69 74 61 62 $options(-editab
3eea0 6c 65 29 5d 0a 09 20 20 20 20 69 66 20 7b 24 65 le)].. if {$e
3eeb0 64 69 74 61 62 6c 65 7d 20 7b 0a 09 09 24 77 69 ditable} {...$wi
3eec0 64 67 65 74 73 28 65 6e 74 72 79 29 20 73 65 6c dgets(entry) sel
3eed0 65 63 74 69 6f 6e 20 72 61 6e 67 65 20 30 20 65 ection range 0 e
3eee0 6e 64 0a 09 09 24 77 69 64 67 65 74 73 28 62 75 nd...$widgets(bu
3eef0 74 74 6f 6e 29 20 63 6f 6e 66 69 67 75 72 65 20 tton) configure
3ef00 2d 72 65 6c 69 65 66 20 72 61 69 73 65 64 0a 09 -relief raised..
3ef10 20 20 20 20 7d 0a 0a 0a 09 20 20 20 20 23 20 6d }.... # m
3ef20 61 67 69 63 20 74 63 6c 20 73 74 75 66 66 20 28 agic tcl stuff (
3ef30 73 65 65 20 74 6b 2e 74 63 6c 20 69 6e 20 74 68 see tk.tcl in th
3ef40 65 20 64 69 73 74 72 69 62 75 74 69 6f 6e 0a 09 e distribution..
3ef50 20 20 20 20 23 20 6c 69 62 20 64 69 72 65 63 74 # lib direct
3ef60 6f 72 79 29 0a 09 20 20 20 20 3a 3a 63 6f 6d 62 ory).. ::comb
3ef70 6f 62 6f 78 3a 3a 74 6b 43 61 6e 63 65 6c 52 65 obox::tkCancelRe
3ef80 70 65 61 74 0a 0a 09 20 20 20 20 72 65 74 75 72 peat... retur
3ef90 6e 20 31 0a 09 7d 0a 20 20 20 20 63 67 65 74 20 n 1..}. cget
3efa0 7b 0a 09 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e {.. if {[llen
3efb0 67 74 68 20 24 61 72 67 73 5d 20 21 3d 20 31 7d gth $args] != 1}
3efc0 20 7b 0a 09 09 65 72 72 6f 72 20 22 77 72 6f 6e {...error "wron
3efd0 67 20 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 g # args: should
3efe0 20 62 65 20 24 77 20 63 67 65 74 20 6f 70 74 69 be $w cget opti
3eff0 6f 6e 22 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 on".. }..
3f000 73 65 74 20 6f 70 74 20 5b 3a 3a 63 6f 6d 62 6f set opt [::combo
3f010 62 6f 78 3a 3a 43 61 6e 6f 6e 69 7a 65 20 24 77 box::Canonize $w
3f020 20 6f 70 74 69 6f 6e 20 5b 6c 69 6e 64 65 78 20 option [lindex
3f030 24 61 72 67 73 20 30 5d 5d 0a 0a 09 20 20 20 20 $args 0]]...
3f040 69 66 20 7b 24 6f 70 74 20 3d 3d 20 22 2d 76 61 if {$opt == "-va
3f050 6c 75 65 22 7d 20 7b 0a 09 09 73 65 74 20 72 65 lue"} {...set re
3f060 73 75 6c 74 20 5b 24 77 69 64 67 65 74 73 28 65 sult [$widgets(e
3f070 6e 74 72 79 29 20 67 65 74 5d 0a 09 20 20 20 20 ntry) get]..
3f080 7d 20 65 6c 73 65 20 7b 0a 09 09 73 65 74 20 72 } else {...set r
3f090 65 73 75 6c 74 20 24 6f 70 74 69 6f 6e 73 28 24 esult $options($
3f0a0 6f 70 74 29 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 opt).. }..}.
3f0b0 20 20 20 63 6f 6e 66 69 67 75 72 65 20 7b 0a 09 configure {..
3f0c0 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b set result [
3f0d0 65 76 61 6c 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a eval ::combobox:
3f0e0 3a 43 6f 6e 66 69 67 75 72 65 20 7b 24 77 7d 20 :Configure {$w}
3f0f0 24 61 72 67 73 5d 0a 09 7d 0a 20 20 20 20 64 65 $args]..}. de
3f100 66 61 75 6c 74 20 7b 0a 09 20 20 20 20 65 72 72 fault {.. err
3f110 6f 72 20 22 62 61 64 20 6f 70 74 69 6f 6e 20 5c or "bad option \
3f120 22 24 63 6f 6d 6d 61 6e 64 5c 22 22 0a 09 7d 0a "$command\""..}.
3f130 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 }.. retur
3f140 6e 20 24 72 65 73 75 6c 74 0a 7d 0a 0a 23 20 3a n $result.}..# :
3f150 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 43 6f 6e 66 69 :combobox::Confi
3f160 67 75 72 65 20 2d 2d 0a 23 0a 23 20 20 20 20 49 gure --.#.# I
3f170 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 22 63 mplements the "c
3f180 6f 6e 66 69 67 75 72 65 22 20 77 69 64 67 65 74 onfigure" widget
3f190 20 73 75 62 63 6f 6d 6d 61 6e 64 0a 23 0a 23 20 subcommand.#.#
3f1a0 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 Arguments:.#.#
3f1b0 20 20 77 20 20 20 20 20 20 77 69 64 67 65 74 20 w widget
3f1c0 70 61 74 68 6e 61 6d 65 0a 23 20 20 20 20 61 72 pathname.# ar
3f1d0 67 73 20 20 20 7a 65 72 6f 20 6f 72 20 6d 6f 72 gs zero or mor
3f1e0 65 20 6f 70 74 69 6f 6e 2f 76 61 6c 75 65 20 70 e option/value p
3f1f0 61 69 72 73 20 28 6f 72 20 61 20 73 69 6e 67 6c airs (or a singl
3f200 65 20 6f 70 74 69 6f 6e 29 0a 23 0a 23 20 52 65 e option).#.# Re
3f210 73 75 6c 74 73 3a 0a 23 0a 23 20 20 20 20 50 65 sults:.#.# Pe
3f220 72 66 6f 72 6d 73 20 74 79 70 63 69 61 6c 20 22 rforms typcial "
3f230 63 6f 6e 66 69 67 75 72 65 22 20 74 79 70 65 20 configure" type
3f240 72 65 71 75 65 73 74 73 20 6f 6e 20 74 68 65 20 requests on the
3f250 77 69 64 67 65 74 0a 0a 70 72 6f 63 20 3a 3a 63 widget..proc ::c
3f260 6f 6d 62 6f 62 6f 78 3a 3a 43 6f 6e 66 69 67 75 ombobox::Configu
3f270 72 65 20 7b 77 20 61 72 67 73 7d 20 7b 0a 20 20 re {w args} {.
3f280 20 20 76 61 72 69 61 62 6c 65 20 77 69 64 67 65 variable widge
3f290 74 4f 70 74 69 6f 6e 73 0a 20 20 20 20 76 61 72 tOptions. var
3f2a0 69 61 62 6c 65 20 64 65 66 61 75 6c 74 45 6e 74 iable defaultEnt
3f2b0 72 79 43 75 72 73 6f 72 0a 0a 20 20 20 20 75 70 ryCursor.. up
3f2c0 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a var ::combobox::
3f2d0 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 ${w}::widgets wi
3f2e0 64 67 65 74 73 0a 20 20 20 20 75 70 76 61 72 20 dgets. upvar
3f2f0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d ::combobox::${w}
3f300 3a 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e ::options option
3f310 73 0a 0a 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e s.. if {[llen
3f320 67 74 68 20 24 61 72 67 73 5d 20 3d 3d 20 30 7d gth $args] == 0}
3f330 20 7b 0a 09 23 20 68 6d 6d 6d 2e 20 55 73 65 72 {..# hmmm. User
3f340 20 6d 75 73 74 20 62 65 20 77 61 6e 74 69 6e 67 must be wanting
3f350 20 61 6c 6c 20 63 6f 6e 66 69 67 75 72 61 74 69 all configurati
3f360 6f 6e 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 on information..
3f370 23 20 6e 6f 74 65 20 74 68 61 74 20 69 66 20 74 # note that if t
3f380 68 65 20 76 61 6c 75 65 20 6f 66 20 61 6e 20 61 he value of an a
3f390 72 72 61 79 20 65 6c 65 6d 65 6e 74 20 69 73 20 rray element is
3f3a0 6f 66 20 6c 65 6e 67 74 68 0a 09 23 20 6f 6e 65 of length..# one
3f3b0 20 69 74 20 69 73 20 61 6e 20 61 6c 69 61 73 2c it is an alias,
3f3c0 20 77 68 69 63 68 20 6e 65 65 64 73 20 74 6f 20 which needs to
3f3d0 62 65 20 68 61 6e 64 6c 65 64 20 73 6c 69 67 68 be handled sligh
3f3e0 74 6c 79 0a 09 23 20 64 69 66 66 65 72 65 6e 74 tly..# different
3f3f0 6c 79 0a 09 73 65 74 20 72 65 73 75 6c 74 73 20 ly..set results
3f400 7b 7d 0a 09 66 6f 72 65 61 63 68 20 6f 70 74 20 {}..foreach opt
3f410 5b 6c 73 6f 72 74 20 5b 61 72 72 61 79 20 6e 61 [lsort [array na
3f420 6d 65 73 20 77 69 64 67 65 74 4f 70 74 69 6f 6e mes widgetOption
3f430 73 5d 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b s]] {.. if {[
3f440 6c 6c 65 6e 67 74 68 20 24 77 69 64 67 65 74 4f llength $widgetO
3f450 70 74 69 6f 6e 73 28 24 6f 70 74 29 5d 20 3d 3d ptions($opt)] ==
3f460 20 31 7d 20 7b 0a 09 09 73 65 74 20 61 6c 69 61 1} {...set alia
3f470 73 20 24 77 69 64 67 65 74 4f 70 74 69 6f 6e 73 s $widgetOptions
3f480 28 24 6f 70 74 29 0a 09 09 73 65 74 20 6f 70 74 ($opt)...set opt
3f490 4e 61 6d 65 20 24 77 69 64 67 65 74 4f 70 74 69 Name $widgetOpti
3f4a0 6f 6e 73 28 24 61 6c 69 61 73 29 0a 09 09 6c 61 ons($alias)...la
3f4b0 70 70 65 6e 64 20 72 65 73 75 6c 74 73 20 5b 6c ppend results [l
3f4c0 69 73 74 20 24 6f 70 74 20 24 6f 70 74 4e 61 6d ist $opt $optNam
3f4d0 65 5d 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b e].. } else {
3f4e0 0a 09 09 73 65 74 20 6f 70 74 4e 61 6d 65 20 5b ...set optName [
3f4f0 6c 69 6e 64 65 78 20 24 77 69 64 67 65 74 4f 70 lindex $widgetOp
3f500 74 69 6f 6e 73 28 24 6f 70 74 29 20 30 5d 0a 09 tions($opt) 0]..
3f510 09 73 65 74 20 6f 70 74 43 6c 61 73 73 20 5b 6c .set optClass [l
3f520 69 6e 64 65 78 20 24 77 69 64 67 65 74 4f 70 74 index $widgetOpt
3f530 69 6f 6e 73 28 24 6f 70 74 29 20 31 5d 0a 09 09 ions($opt) 1]...
3f540 73 65 74 20 64 65 66 61 75 6c 74 20 5b 6f 70 74 set default [opt
3f550 69 6f 6e 20 67 65 74 20 24 77 20 24 6f 70 74 4e ion get $w $optN
3f560 61 6d 65 20 24 6f 70 74 43 6c 61 73 73 5d 0a 09 ame $optClass]..
3f570 09 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 .if {[info exist
3f580 73 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 29 5d s options($opt)]
3f590 7d 20 7b 0a 09 09 20 20 20 20 6c 61 70 70 65 6e } {... lappen
3f5a0 64 20 72 65 73 75 6c 74 73 20 5b 6c 69 73 74 20 d results [list
3f5b0 24 6f 70 74 20 24 6f 70 74 4e 61 6d 65 20 24 6f $opt $optName $o
3f5c0 70 74 43 6c 61 73 73 20 24 64 65 66 61 75 6c 74 ptClass $default
3f5d0 20 5c 0a 09 09 20 20 20 20 20 20 24 6f 70 74 69 \... $opti
3f5e0 6f 6e 73 28 24 6f 70 74 29 5d 0a 09 09 7d 20 65 ons($opt)]...} e
3f5f0 6c 73 65 20 7b 0a 09 09 20 20 20 20 6c 61 70 70 lse {... lapp
3f600 65 6e 64 20 72 65 73 75 6c 74 73 20 5b 6c 69 73 end results [lis
3f610 74 20 24 6f 70 74 20 24 6f 70 74 4e 61 6d 65 20 t $opt $optName
3f620 24 6f 70 74 43 6c 61 73 73 20 24 64 65 66 61 75 $optClass $defau
3f630 6c 74 20 22 22 5d 0a 09 09 7d 0a 09 20 20 20 20 lt ""]...}..
3f640 7d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 20 24 72 }..}...return $r
3f650 65 73 75 6c 74 73 0a 20 20 20 20 7d 0a 0a 20 20 esults. }..
3f660 20 20 23 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 # one argument
3f670 20 6d 65 61 6e 73 20 77 65 20 61 72 65 20 6c 6f means we are lo
3f680 6f 6b 69 6e 67 20 66 6f 72 20 63 6f 6e 66 69 67 oking for config
3f690 75 72 61 74 69 6f 6e 0a 20 20 20 20 23 20 69 6e uration. # in
3f6a0 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 61 20 73 formation on a s
3f6b0 69 6e 67 6c 65 20 6f 70 74 69 6f 6e 0a 20 20 20 ingle option.
3f6c0 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 61 if {[llength $a
3f6d0 72 67 73 5d 20 3d 3d 20 31 7d 20 7b 0a 09 73 65 rgs] == 1} {..se
3f6e0 74 20 6f 70 74 20 5b 3a 3a 63 6f 6d 62 6f 62 6f t opt [::combobo
3f6f0 78 3a 3a 43 61 6e 6f 6e 69 7a 65 20 24 77 20 6f x::Canonize $w o
3f700 70 74 69 6f 6e 20 5b 6c 69 6e 64 65 78 20 24 61 ption [lindex $a
3f710 72 67 73 20 30 5d 5d 0a 0a 09 73 65 74 20 6f 70 rgs 0]]...set op
3f720 74 4e 61 6d 65 20 5b 6c 69 6e 64 65 78 20 24 77 tName [lindex $w
3f730 69 64 67 65 74 4f 70 74 69 6f 6e 73 28 24 6f 70 idgetOptions($op
3f740 74 29 20 30 5d 0a 09 73 65 74 20 6f 70 74 43 6c t) 0]..set optCl
3f750 61 73 73 20 5b 6c 69 6e 64 65 78 20 24 77 69 64 ass [lindex $wid
3f760 67 65 74 4f 70 74 69 6f 6e 73 28 24 6f 70 74 29 getOptions($opt)
3f770 20 31 5d 0a 09 73 65 74 20 64 65 66 61 75 6c 74 1]..set default
3f780 20 5b 6f 70 74 69 6f 6e 20 67 65 74 20 24 77 20 [option get $w
3f790 24 6f 70 74 4e 61 6d 65 20 24 6f 70 74 43 6c 61 $optName $optCla
3f7a0 73 73 5d 0a 09 73 65 74 20 72 65 73 75 6c 74 73 ss]..set results
3f7b0 20 5b 6c 69 73 74 20 24 6f 70 74 20 24 6f 70 74 [list $opt $opt
3f7c0 4e 61 6d 65 20 24 6f 70 74 43 6c 61 73 73 20 24 Name $optClass $
3f7d0 64 65 66 61 75 6c 74 20 24 6f 70 74 69 6f 6e 73 default $options
3f7e0 28 24 6f 70 74 29 5d 0a 09 72 65 74 75 72 6e 20 ($opt)]..return
3f7f0 24 72 65 73 75 6c 74 73 0a 20 20 20 20 7d 0a 0a $results. }..
3f800 20 20 20 20 23 20 69 66 20 77 65 20 68 61 76 65 # if we have
3f810 20 61 6e 20 6f 64 64 20 6e 75 6d 62 65 72 20 6f an odd number o
3f820 66 20 76 61 6c 75 65 73 2c 20 62 61 69 6c 2e 0a f values, bail..
3f830 20 20 20 20 69 66 20 7b 5b 65 78 70 72 20 7b 5b if {[expr {[
3f840 6c 6c 65 6e 67 74 68 20 24 61 72 67 73 5d 25 32 llength $args]%2
3f850 7d 5d 20 3d 3d 20 31 7d 20 7b 0a 09 23 20 68 6d }] == 1} {..# hm
3f860 6d 6d 2e 20 41 6e 20 6f 64 64 20 6e 75 6d 62 65 mm. An odd numbe
3f870 72 20 6f 66 20 65 6c 65 6d 65 6e 74 73 20 69 6e r of elements in
3f880 20 61 72 67 73 0a 09 65 72 72 6f 72 20 22 76 61 args..error "va
3f890 6c 75 65 20 66 6f 72 20 5c 22 5b 6c 69 6e 64 65 lue for \"[linde
3f8a0 78 20 24 61 72 67 73 20 65 6e 64 5d 5c 22 20 6d x $args end]\" m
3f8b0 69 73 73 69 6e 67 22 0a 20 20 20 20 7d 0a 0a 20 issing". }..
3f8c0 20 20 20 23 20 47 72 65 61 74 2e 20 41 6e 20 65 # Great. An e
3f8d0 76 65 6e 20 6e 75 6d 62 65 72 20 6f 66 20 6f 70 ven number of op
3f8e0 74 69 6f 6e 73 2e 20 4c 65 74 27 73 20 6d 61 6b tions. Let's mak
3f8f0 65 20 73 75 72 65 20 74 68 65 79 0a 20 20 20 20 e sure they.
3f900 23 20 61 72 65 20 61 6c 6c 20 76 61 6c 69 64 20 # are all valid
3f910 62 65 66 6f 72 65 20 77 65 20 64 6f 20 61 6e 79 before we do any
3f920 74 68 69 6e 67 2e 20 4e 6f 74 65 20 74 68 61 74 thing. Note that
3f930 20 43 61 6e 6f 6e 69 7a 65 0a 20 20 20 20 23 20 Canonize. #
3f940 77 69 6c 6c 20 67 65 6e 65 72 61 74 65 20 61 6e will generate an
3f950 20 65 72 72 6f 72 20 69 66 20 69 74 20 66 69 6e error if it fin
3f960 64 73 20 61 20 62 6f 67 75 73 20 6f 70 74 69 6f ds a bogus optio
3f970 6e 3b 20 6f 74 68 65 72 77 69 73 65 0a 20 20 20 n; otherwise.
3f980 20 23 20 69 74 20 72 65 74 75 72 6e 73 20 74 68 # it returns th
3f990 65 20 63 61 6e 6f 6e 69 63 61 6c 20 6f 70 74 69 e canonical opti
3f9a0 6f 6e 20 6e 61 6d 65 0a 20 20 20 20 66 6f 72 65 on name. fore
3f9b0 61 63 68 20 7b 6e 61 6d 65 20 76 61 6c 75 65 7d ach {name value}
3f9c0 20 24 61 72 67 73 20 7b 0a 09 73 65 74 20 6e 61 $args {..set na
3f9d0 6d 65 20 5b 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a me [::combobox::
3f9e0 43 61 6e 6f 6e 69 7a 65 20 24 77 20 6f 70 74 69 Canonize $w opti
3f9f0 6f 6e 20 24 6e 61 6d 65 5d 0a 09 73 65 74 20 6f on $name]..set o
3fa00 70 74 73 28 24 6e 61 6d 65 29 20 24 76 61 6c 75 pts($name) $valu
3fa10 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 70 e. }.. # p
3fa20 72 6f 63 65 73 73 20 61 6c 6c 20 6f 66 20 74 68 rocess all of th
3fa30 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
3fa40 6f 70 74 69 6f 6e 73 0a 20 20 20 20 23 20 73 6f options. # so
3fa50 6d 65 20 28 61 63 74 75 61 6c 6c 79 2c 20 6d 6f me (actually, mo
3fa60 73 74 29 20 6f 70 74 69 6f 6e 73 20 72 65 71 75 st) options requ
3fa70 69 72 65 20 75 73 20 74 6f 0a 20 20 20 20 23 20 ire us to. #
3fa80 64 6f 20 73 6f 6d 65 74 68 69 6e 67 2c 20 6c 69 do something, li
3fa90 6b 65 20 63 68 61 6e 67 65 20 74 68 65 20 61 74 ke change the at
3faa0 74 72 69 62 75 74 65 73 20 6f 66 0a 20 20 20 20 tributes of.
3fab0 23 20 61 20 77 69 64 67 65 74 20 6f 72 20 74 77 # a widget or tw
3fac0 6f 2e 20 48 65 72 65 27 73 20 77 68 65 72 65 20 o. Here's where
3fad0 77 65 20 64 6f 20 74 68 61 74 2e 2e 2e 0a 20 20 we do that....
3fae0 20 20 23 0a 20 20 20 20 23 20 6e 6f 74 65 20 74 #. # note t
3faf0 68 61 74 20 74 68 65 20 68 61 6e 64 6c 69 6e 67 hat the handling
3fb00 20 6f 66 20 64 69 73 61 62 6c 65 64 66 6f 72 65 of disabledfore
3fb10 67 72 6f 75 6e 64 20 61 6e 64 0a 20 20 20 20 23 ground and. #
3fb20 20 64 69 73 61 62 6c 65 64 62 61 63 6b 67 72 6f disabledbackgro
3fb30 75 6e 64 20 69 73 20 61 20 6c 69 74 74 6c 65 20 und is a little
3fb40 77 6f 6e 6b 79 2e 20 46 69 72 73 74 2c 20 77 65 wonky. First, we
3fb50 20 68 61 76 65 0a 20 20 20 20 23 20 74 6f 20 64 have. # to d
3fb60 65 61 6c 20 77 69 74 68 20 62 61 63 6b 77 61 72 eal with backwar
3fb70 64 73 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 ds compatibility
3fb80 20 28 69 65 3a 20 74 6b 20 38 2e 33 20 61 6e 64 (ie: tk 8.3 and
3fb90 20 62 65 6c 6f 77 0a 20 20 20 20 23 20 64 69 64 below. # did
3fba0 6e 27 74 20 68 61 76 65 20 73 75 63 68 20 6f 70 n't have such op
3fbb0 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 65 6e tions for the en
3fbc0 74 72 79 20 77 69 64 67 65 74 29 2c 20 61 6e 64 try widget), and
3fbd0 0a 20 20 20 20 23 20 77 65 20 68 61 76 65 20 74 . # we have t
3fbe0 6f 20 64 65 61 6c 20 77 69 74 68 20 74 68 65 20 o deal with the
3fbf0 66 61 63 74 20 77 65 20 6d 69 67 68 74 20 77 61 fact we might wa
3fc00 6e 74 20 74 6f 20 64 69 73 61 62 6c 65 0a 20 20 nt to disable.
3fc10 20 20 23 20 74 68 65 20 65 6e 74 72 79 20 77 69 # the entry wi
3fc20 64 67 65 74 20 62 75 74 20 75 73 65 20 74 68 65 dget but use the
3fc30 20 6e 6f 72 6d 61 6c 20 66 6f 72 65 67 72 6f 75 normal foregrou
3fc40 6e 64 2f 62 61 63 6b 67 72 6f 75 6e 64 0a 20 20 nd/background.
3fc50 20 20 23 20 66 6f 72 20 77 68 65 6e 20 74 68 65 # for when the
3fc60 20 63 6f 6d 62 6f 62 6f 78 20 69 73 20 6e 6f 74 combobox is not
3fc70 20 64 69 73 61 62 6c 65 64 2c 20 62 75 74 20 6e disabled, but n
3fc80 6f 74 20 65 64 69 74 61 62 6c 65 20 65 69 74 68 ot editable eith
3fc90 65 72 2e 0a 0a 20 20 20 20 73 65 74 20 75 70 64 er... set upd
3fca0 61 74 65 56 69 73 75 61 6c 20 30 0a 20 20 20 20 ateVisual 0.
3fcb0 66 6f 72 65 61 63 68 20 6f 70 74 69 6f 6e 20 5b foreach option [
3fcc0 61 72 72 61 79 20 6e 61 6d 65 73 20 6f 70 74 73 array names opts
3fcd0 5d 20 7b 0a 09 73 65 74 20 6e 65 77 56 61 6c 75 ] {..set newValu
3fce0 65 20 24 6f 70 74 73 28 24 6f 70 74 69 6f 6e 29 e $opts($option)
3fcf0 0a 09 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 ..if {[info exis
3fd00 74 73 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 ts options($opti
3fd10 6f 6e 29 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 on)]} {.. set
3fd20 20 6f 6c 64 56 61 6c 75 65 20 24 6f 70 74 69 6f oldValue $optio
3fd30 6e 73 28 24 6f 70 74 69 6f 6e 29 0a 09 7d 0a 0a ns($option)..}..
3fd40 09 73 77 69 74 63 68 20 2d 2d 20 24 6f 70 74 69 .switch -- $opti
3fd50 6f 6e 20 7b 0a 09 2d 62 61 63 6b 67 72 6f 75 6e on {..-backgroun
3fd60 64 20 7b 0a 09 09 73 65 74 20 75 70 64 61 74 65 d {...set update
3fd70 56 69 73 75 61 6c 20 31 0a 09 09 73 65 74 20 6f Visual 1...set o
3fd80 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 ptions($option)
3fd90 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d $newValue.. }
3fda0 0a 09 2d 62 6f 72 64 65 72 77 69 64 74 68 20 7b ..-borderwidth {
3fdb0 0a 09 09 24 77 69 64 67 65 74 73 28 66 72 61 6d ...$widgets(fram
3fdc0 65 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 6f e) configure -bo
3fdd0 72 64 65 72 77 69 64 74 68 20 24 6e 65 77 56 61 rderwidth $newVa
3fde0 6c 75 65 0a 09 09 73 65 74 20 6f 70 74 69 6f 6e lue...set option
3fdf0 73 28 24 6f 70 74 69 6f 6e 29 20 24 6e 65 77 56 s($option) $newV
3fe00 61 6c 75 65 0a 09 20 20 20 20 7d 0a 09 2d 63 6f alue.. }..-co
3fe10 6d 6d 61 6e 64 20 7b 0a 09 09 23 20 6e 6f 74 68 mmand {...# noth
3fe20 69 6e 67 20 65 6c 73 65 20 74 6f 20 64 6f 2e 2e ing else to do..
3fe30 2e 0a 09 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 ....set options(
3fe40 24 6f 70 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c $option) $newVal
3fe50 75 65 0a 09 20 20 20 20 7d 0a 09 2d 63 6f 6d 6d ue.. }..-comm
3fe60 61 6e 64 73 74 61 74 65 20 7b 0a 09 09 23 20 64 andstate {...# d
3fe70 6f 20 73 6f 6d 65 20 76 61 6c 75 65 20 63 68 65 o some value che
3fe80 63 6b 69 6e 67 2e 2e 2e 0a 09 09 69 66 20 7b 24 cking......if {$
3fe90 6e 65 77 56 61 6c 75 65 20 21 3d 20 22 6e 6f 72 newValue != "nor
3fea0 6d 61 6c 22 20 26 26 20 24 6e 65 77 56 61 6c 75 mal" && $newValu
3feb0 65 20 21 3d 20 22 64 69 73 61 62 6c 65 64 22 7d e != "disabled"}
3fec0 20 7b 0a 09 09 20 20 20 20 73 65 74 20 6f 70 74 {... set opt
3fed0 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 6f ions($option) $o
3fee0 6c 64 56 61 6c 75 65 0a 09 09 20 20 20 20 73 65 ldValue... se
3fef0 74 20 6d 65 73 73 61 67 65 20 22 62 61 64 20 73 t message "bad s
3ff00 74 61 74 65 20 76 61 6c 75 65 20 5c 22 24 6e 65 tate value \"$ne
3ff10 77 56 61 6c 75 65 5c 22 3b 22 0a 09 09 20 20 20 wValue\";"...
3ff20 20 61 70 70 65 6e 64 20 6d 65 73 73 61 67 65 20 append message
3ff30 22 20 6d 75 73 74 20 62 65 20 6e 6f 72 6d 61 6c " must be normal
3ff40 20 6f 72 20 64 69 73 61 62 6c 65 64 22 0a 09 09 or disabled"...
3ff50 20 20 20 20 65 72 72 6f 72 20 24 6d 65 73 73 61 error $messa
3ff60 67 65 0a 09 09 7d 0a 09 09 73 65 74 20 6f 70 74 ge...}...set opt
3ff70 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 6e ions($option) $n
3ff80 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d 0a 09 ewValue.. }..
3ff90 2d 63 75 72 73 6f 72 20 7b 0a 09 09 24 77 69 64 -cursor {...$wid
3ffa0 67 65 74 73 28 66 72 61 6d 65 29 20 63 6f 6e 66 gets(frame) conf
3ffb0 69 67 75 72 65 20 2d 63 75 72 73 6f 72 20 24 6e igure -cursor $n
3ffc0 65 77 56 61 6c 75 65 0a 09 09 24 77 69 64 67 65 ewValue...$widge
3ffd0 74 73 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 ts(entry) config
3ffe0 75 72 65 20 2d 63 75 72 73 6f 72 20 24 6e 65 77 ure -cursor $new
3fff0 56 61 6c 75 65 0a 09 09 24 77 69 64 67 65 74 73 Value...$widgets
40000 28 6c 69 73 74 62 6f 78 29 20 63 6f 6e 66 69 67 (listbox) config
40010 75 72 65 20 2d 63 75 72 73 6f 72 20 24 6e 65 77 ure -cursor $new
40020 56 61 6c 75 65 0a 09 09 73 65 74 20 6f 70 74 69 Value...set opti
40030 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 6e 65 ons($option) $ne
40040 77 56 61 6c 75 65 0a 09 20 20 20 20 7d 0a 09 2d wValue.. }..-
40050 64 69 73 61 62 6c 65 64 66 6f 72 65 67 72 6f 75 disabledforegrou
40060 6e 64 20 7b 0a 09 09 73 65 74 20 75 70 64 61 74 nd {...set updat
40070 65 56 69 73 75 61 6c 20 31 0a 09 09 73 65 74 20 eVisual 1...set
40080 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 options($option)
40090 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 $newValue..
400a0 7d 0a 09 2d 64 69 73 61 62 6c 65 64 62 61 63 6b }..-disabledback
400b0 67 72 6f 75 6e 64 20 7b 0a 09 09 73 65 74 20 75 ground {...set u
400c0 70 64 61 74 65 56 69 73 75 61 6c 20 31 0a 09 09 pdateVisual 1...
400d0 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 set options($opt
400e0 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 ion) $newValue..
400f0 20 20 20 20 7d 0a 09 2d 64 72 6f 70 64 6f 77 6e }..-dropdown
40100 77 69 64 74 68 20 7b 0a 09 09 73 65 74 20 6f 70 width {...set op
40110 74 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 tions($option) $
40120 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d 0a newValue.. }.
40130 09 2d 65 64 69 74 61 62 6c 65 20 7b 0a 09 09 73 .-editable {...s
40140 65 74 20 75 70 64 61 74 65 56 69 73 75 61 6c 20 et updateVisual
40150 31 0a 09 09 69 66 20 7b 24 6e 65 77 56 61 6c 75 1...if {$newValu
40160 65 7d 20 7b 0a 09 09 20 20 20 20 23 20 69 74 27 e} {... # it'
40170 73 20 65 64 69 74 61 62 6c 65 2e 2e 2e 0a 09 09 s editable......
40180 20 20 20 20 24 77 69 64 67 65 74 73 28 65 6e 74 $widgets(ent
40190 72 79 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 ry) configure -s
401a0 74 61 74 65 20 6e 6f 72 6d 61 6c 20 5c 0a 09 09 tate normal \...
401b0 20 20 20 20 20 20 2d 63 75 72 73 6f 72 20 24 64 -cursor $d
401c0 65 66 61 75 6c 74 45 6e 74 72 79 43 75 72 73 6f efaultEntryCurso
401d0 72 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 r...} else {...
401e0 20 20 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 $widgets(entr
401f0 79 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 y) configure -st
40200 61 74 65 20 64 69 73 61 62 6c 65 64 20 5c 0a 09 ate disabled \..
40210 09 20 20 20 20 20 20 2d 63 75 72 73 6f 72 20 24 . -cursor $
40220 6f 70 74 69 6f 6e 73 28 2d 63 75 72 73 6f 72 29 options(-cursor)
40230 0a 09 09 7d 0a 09 09 73 65 74 20 6f 70 74 69 6f ...}...set optio
40240 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 6e 65 77 ns($option) $new
40250 56 61 6c 75 65 0a 09 20 20 20 20 7d 0a 09 2d 66 Value.. }..-f
40260 6f 6e 74 20 7b 0a 09 09 24 77 69 64 67 65 74 73 ont {...$widgets
40270 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 72 (entry) configur
40280 65 20 2d 66 6f 6e 74 20 24 6e 65 77 56 61 6c 75 e -font $newValu
40290 65 0a 09 09 24 77 69 64 67 65 74 73 28 6c 69 73 e...$widgets(lis
402a0 74 62 6f 78 29 20 63 6f 6e 66 69 67 75 72 65 20 tbox) configure
402b0 2d 66 6f 6e 74 20 24 6e 65 77 56 61 6c 75 65 0a -font $newValue.
402c0 09 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f ..set options($o
402d0 70 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 ption) $newValue
402e0 0a 09 20 20 20 20 7d 0a 09 2d 66 6f 72 65 67 72 .. }..-foregr
402f0 6f 75 6e 64 20 7b 0a 09 09 73 65 74 20 75 70 64 ound {...set upd
40300 61 74 65 56 69 73 75 61 6c 20 31 0a 09 09 73 65 ateVisual 1...se
40310 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f t options($optio
40320 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 n) $newValue..
40330 20 20 7d 0a 09 2d 68 65 69 67 68 74 20 7b 0a 09 }..-height {..
40340 09 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f .$widgets(listbo
40350 78 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 x) configure -he
40360 69 67 68 74 20 24 6e 65 77 56 61 6c 75 65 0a 09 ight $newValue..
40370 09 48 61 6e 64 6c 65 53 63 72 6f 6c 6c 62 61 72 .HandleScrollbar
40380 20 24 77 0a 09 09 73 65 74 20 6f 70 74 69 6f 6e $w...set option
40390 73 28 24 6f 70 74 69 6f 6e 29 20 24 6e 65 77 56 s($option) $newV
403a0 61 6c 75 65 0a 09 20 20 20 20 7d 0a 09 2d 68 69 alue.. }..-hi
403b0 67 68 6c 69 67 68 74 62 61 63 6b 67 72 6f 75 6e ghlightbackgroun
403c0 64 20 7b 0a 09 09 24 77 69 64 67 65 74 73 28 66 d {...$widgets(f
403d0 72 61 6d 65 29 20 63 6f 6e 66 69 67 75 72 65 20 rame) configure
403e0 2d 68 69 67 68 6c 69 67 68 74 62 61 63 6b 67 72 -highlightbackgr
403f0 6f 75 6e 64 20 24 6e 65 77 56 61 6c 75 65 0a 09 ound $newValue..
40400 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 .set options($op
40410 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a tion) $newValue.
40420 09 20 20 20 20 7d 0a 09 2d 68 69 67 68 6c 69 67 . }..-highlig
40430 68 74 63 6f 6c 6f 72 20 7b 0a 09 09 24 77 69 64 htcolor {...$wid
40440 67 65 74 73 28 66 72 61 6d 65 29 20 63 6f 6e 66 gets(frame) conf
40450 69 67 75 72 65 20 2d 68 69 67 68 6c 69 67 68 74 igure -highlight
40460 63 6f 6c 6f 72 20 24 6e 65 77 56 61 6c 75 65 0a color $newValue.
40470 09 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f ..set options($o
40480 70 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 ption) $newValue
40490 0a 09 20 20 20 20 7d 0a 09 2d 68 69 67 68 6c 69 .. }..-highli
404a0 67 68 74 74 68 69 63 6b 6e 65 73 73 20 7b 0a 09 ghtthickness {..
404b0 09 24 77 69 64 67 65 74 73 28 66 72 61 6d 65 29 .$widgets(frame)
404c0 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 69 67 68 configure -high
404d0 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 24 lightthickness $
404e0 6e 65 77 56 61 6c 75 65 0a 09 09 73 65 74 20 6f newValue...set o
404f0 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 ptions($option)
40500 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d $newValue.. }
40510 0a 09 2d 69 6d 61 67 65 20 7b 0a 09 09 69 66 20 ..-image {...if
40520 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
40530 24 6e 65 77 56 61 6c 75 65 5d 20 3e 20 30 7d 20 $newValue] > 0}
40540 7b 0a 09 09 20 20 20 20 24 77 69 64 67 65 74 73 {... $widgets
40550 28 62 75 74 74 6f 6e 29 20 63 6f 6e 66 69 67 75 (button) configu
40560 72 65 20 2d 69 6d 61 67 65 20 24 6e 65 77 56 61 re -image $newVa
40570 6c 75 65 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 lue...} else {..
40580 09 20 20 20 20 24 77 69 64 67 65 74 73 28 62 75 . $widgets(bu
40590 74 74 6f 6e 29 20 63 6f 6e 66 69 67 75 72 65 20 tton) configure
405a0 2d 69 6d 61 67 65 20 3a 3a 63 6f 6d 62 6f 62 6f -image ::combobo
405b0 78 3a 3a 62 69 6d 61 67 65 0a 09 09 7d 0a 09 09 x::bimage...}...
405c0 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 set options($opt
405d0 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 ion) $newValue..
405e0 20 20 20 20 7d 0a 09 2d 6d 61 78 68 65 69 67 68 }..-maxheigh
405f0 74 20 7b 0a 09 09 23 20 43 6f 6d 70 75 74 65 47 t {...# ComputeG
40600 65 6f 6d 65 74 72 79 20 6d 61 79 20 64 6f 72 6b eometry may dork
40610 20 77 69 74 68 20 74 68 65 20 61 63 74 75 61 6c with the actual
40620 20 68 65 69 67 68 74 0a 09 09 23 20 6f 66 20 74 height...# of t
40630 68 65 20 6c 69 73 74 62 6f 78 2c 20 73 6f 20 6c he listbox, so l
40640 65 74 27 73 20 75 6e 64 6f 72 6b 20 69 74 0a 09 et's undork it..
40650 09 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f .$widgets(listbo
40660 78 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 x) configure -he
40670 69 67 68 74 20 24 6f 70 74 69 6f 6e 73 28 2d 68 ight $options(-h
40680 65 69 67 68 74 29 0a 09 09 48 61 6e 64 6c 65 53 eight)...HandleS
40690 63 72 6f 6c 6c 62 61 72 20 24 77 0a 09 09 73 65 crollbar $w...se
406a0 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f t options($optio
406b0 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 n) $newValue..
406c0 20 20 7d 0a 09 2d 6f 70 65 6e 63 6f 6d 6d 61 6e }..-opencomman
406d0 64 20 7b 0a 09 09 23 20 6e 6f 74 68 69 6e 67 20 d {...# nothing
406e0 65 6c 73 65 20 74 6f 20 64 6f 2e 2e 2e 0a 09 09 else to do......
406f0 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 set options($opt
40700 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 ion) $newValue..
40710 20 20 20 20 7d 0a 09 2d 72 65 6c 69 65 66 20 7b }..-relief {
40720 0a 09 09 24 77 69 64 67 65 74 73 28 66 72 61 6d ...$widgets(fram
40730 65 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 72 65 e) configure -re
40740 6c 69 65 66 20 24 6e 65 77 56 61 6c 75 65 0a 09 lief $newValue..
40750 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 .set options($op
40760 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a tion) $newValue.
40770 09 20 20 20 20 7d 0a 09 2d 73 65 6c 65 63 74 62 . }..-selectb
40780 61 63 6b 67 72 6f 75 6e 64 20 7b 0a 09 09 24 77 ackground {...$w
40790 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 6f idgets(entry) co
407a0 6e 66 69 67 75 72 65 20 2d 73 65 6c 65 63 74 62 nfigure -selectb
407b0 61 63 6b 67 72 6f 75 6e 64 20 24 6e 65 77 56 61 ackground $newVa
407c0 6c 75 65 0a 09 09 24 77 69 64 67 65 74 73 28 6c lue...$widgets(l
407d0 69 73 74 62 6f 78 29 20 63 6f 6e 66 69 67 75 72 istbox) configur
407e0 65 20 2d 73 65 6c 65 63 74 62 61 63 6b 67 72 6f e -selectbackgro
407f0 75 6e 64 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 und $newValue...
40800 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 set options($opt
40810 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 ion) $newValue..
40820 20 20 20 20 7d 0a 09 2d 73 65 6c 65 63 74 62 6f }..-selectbo
40830 72 64 65 72 77 69 64 74 68 20 7b 0a 09 09 24 77 rderwidth {...$w
40840 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 6f idgets(entry) co
40850 6e 66 69 67 75 72 65 20 2d 73 65 6c 65 63 74 62 nfigure -selectb
40860 6f 72 64 65 72 77 69 64 74 68 20 24 6e 65 77 56 orderwidth $newV
40870 61 6c 75 65 0a 09 09 24 77 69 64 67 65 74 73 28 alue...$widgets(
40880 6c 69 73 74 62 6f 78 29 20 63 6f 6e 66 69 67 75 listbox) configu
40890 72 65 20 2d 73 65 6c 65 63 74 62 6f 72 64 65 72 re -selectborder
408a0 77 69 64 74 68 20 24 6e 65 77 56 61 6c 75 65 0a width $newValue.
408b0 09 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f ..set options($o
408c0 70 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 ption) $newValue
408d0 0a 09 20 20 20 20 7d 0a 09 2d 73 65 6c 65 63 74 .. }..-select
408e0 66 6f 72 65 67 72 6f 75 6e 64 20 7b 0a 09 09 24 foreground {...$
408f0 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 widgets(entry) c
40900 6f 6e 66 69 67 75 72 65 20 2d 73 65 6c 65 63 74 onfigure -select
40910 66 6f 72 65 67 72 6f 75 6e 64 20 24 6e 65 77 56 foreground $newV
40920 61 6c 75 65 0a 09 09 24 77 69 64 67 65 74 73 28 alue...$widgets(
40930 6c 69 73 74 62 6f 78 29 20 63 6f 6e 66 69 67 75 listbox) configu
40940 72 65 20 2d 73 65 6c 65 63 74 66 6f 72 65 67 72 re -selectforegr
40950 6f 75 6e 64 20 24 6e 65 77 56 61 6c 75 65 0a 09 ound $newValue..
40960 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 .set options($op
40970 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a tion) $newValue.
40980 09 20 20 20 20 7d 0a 09 2d 73 74 61 74 65 20 7b . }..-state {
40990 0a 09 09 69 66 20 7b 24 6e 65 77 56 61 6c 75 65 ...if {$newValue
409a0 20 3d 3d 20 22 6e 6f 72 6d 61 6c 22 7d 20 7b 0a == "normal"} {.
409b0 09 09 20 20 20 20 73 65 74 20 75 70 64 61 74 65 .. set update
409c0 56 69 73 75 61 6c 20 31 0a 09 09 20 20 20 20 23 Visual 1... #
409d0 20 69 74 27 73 20 65 6e 61 62 6c 65 64 0a 0a 09 it's enabled...
409e0 09 20 20 20 20 73 65 74 20 65 64 69 74 61 62 6c . set editabl
409f0 65 20 5b 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 47 e [::combobox::G
40a00 65 74 42 6f 6f 6c 65 61 6e 20 24 6f 70 74 69 6f etBoolean $optio
40a10 6e 73 28 2d 65 64 69 74 61 62 6c 65 29 5d 0a 09 ns(-editable)]..
40a20 09 20 20 20 20 69 66 20 7b 24 65 64 69 74 61 62 . if {$editab
40a30 6c 65 7d 20 7b 0a 09 09 20 20 20 20 20 20 20 20 le} {...
40a40 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 $widgets(entry)
40a50 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 74 65 configure -state
40a60 20 6e 6f 72 6d 61 6c 0a 09 09 20 20 20 20 20 20 normal...
40a70 20 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 $widgets(entry
40a80 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 61 6b ) configure -tak
40a90 65 66 6f 63 75 73 20 31 0a 09 09 20 20 20 20 7d efocus 1... }
40aa0 0a 0a 09 09 20 20 20 20 23 20 6e 6f 74 65 20 74 .... # note t
40ab0 68 61 74 20 24 77 69 64 67 65 74 73 28 62 75 74 hat $widgets(but
40ac0 74 6f 6e 29 20 69 73 20 61 63 74 75 61 6c 6c 79 ton) is actually
40ad0 20 61 20 6c 61 62 65 6c 2c 0a 09 09 20 20 20 20 a label,...
40ae0 23 20 6e 6f 74 20 61 20 62 75 74 74 6f 6e 2e 20 # not a button.
40af0 41 6e 64 20 62 65 69 6e 67 20 61 62 6c 65 20 74 And being able t
40b00 6f 20 64 69 73 61 62 6c 65 20 6c 61 62 65 6c 73 o disable labels
40b10 0a 09 09 20 20 20 20 23 20 77 61 73 6e 27 74 20 ... # wasn't
40b20 70 6f 73 73 69 62 6c 65 20 75 6e 74 69 6c 20 74 possible until t
40b30 6b 20 38 2e 33 2e 20 28 6d 61 6b 65 73 20 6d 65 k 8.3. (makes me
40b40 20 77 6f 6e 64 65 72 0a 09 09 20 20 20 20 23 20 wonder... #
40b50 77 68 79 20 49 20 63 68 6f 73 65 20 74 6f 20 75 why I chose to u
40b60 73 65 20 61 20 6c 61 62 65 6c 2c 20 62 75 74 20 se a label, but
40b70 74 68 61 74 20 61 6e 73 77 65 72 20 69 73 0a 09 that answer is..
40b80 09 20 20 20 20 23 20 6c 6f 73 74 20 74 6f 20 61 . # lost to a
40b90 6e 74 69 71 75 69 74 79 29 0a 09 09 20 20 20 20 ntiquity)...
40ba0 69 66 20 7b 5b 69 6e 66 6f 20 70 61 74 63 68 6c if {[info patchl
40bb0 65 76 65 6c 5d 20 3e 3d 20 38 2e 33 7d 20 7b 0a evel] >= 8.3} {.
40bc0 09 09 20 20 20 20 20 20 20 20 24 77 69 64 67 65 .. $widge
40bd0 74 73 28 62 75 74 74 6f 6e 29 20 63 6f 6e 66 69 ts(button) confi
40be0 67 75 72 65 20 2d 73 74 61 74 65 20 6e 6f 72 6d gure -state norm
40bf0 61 6c 0a 09 09 20 20 20 20 7d 0a 0a 09 09 7d 20 al... }....}
40c00 65 6c 73 65 69 66 20 7b 24 6e 65 77 56 61 6c 75 elseif {$newValu
40c10 65 20 3d 3d 20 22 64 69 73 61 62 6c 65 64 22 7d e == "disabled"}
40c20 20 7b 0a 09 09 20 20 20 20 73 65 74 20 75 70 64 {... set upd
40c30 61 74 65 56 69 73 75 61 6c 20 31 0a 09 09 20 20 ateVisual 1...
40c40 20 20 23 20 69 74 27 73 20 64 69 73 61 62 6c 65 # it's disable
40c50 64 0a 09 09 20 20 20 20 24 77 69 64 67 65 74 73 d... $widgets
40c60 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 72 (entry) configur
40c70 65 20 2d 73 74 61 74 65 20 64 69 73 61 62 6c 65 e -state disable
40c80 64 0a 09 09 20 20 20 20 24 77 69 64 67 65 74 73 d... $widgets
40c90 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 72 (entry) configur
40ca0 65 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 0a 09 e -takefocus 0..
40cb0 09 20 20 20 20 23 20 6e 6f 74 65 20 74 68 61 74 . # note that
40cc0 20 24 77 69 64 67 65 74 73 28 62 75 74 74 6f 6e $widgets(button
40cd0 29 20 69 73 20 61 63 74 75 61 6c 6c 79 20 61 20 ) is actually a
40ce0 6c 61 62 65 6c 2c 0a 09 09 20 20 20 20 23 20 6e label,... # n
40cf0 6f 74 20 61 20 62 75 74 74 6f 6e 2e 20 41 6e 64 ot a button. And
40d00 20 62 65 69 6e 67 20 61 62 6c 65 20 74 6f 20 64 being able to d
40d10 69 73 61 62 6c 65 20 6c 61 62 65 6c 73 0a 09 09 isable labels...
40d20 20 20 20 20 23 20 77 61 73 6e 27 74 20 70 6f 73 # wasn't pos
40d30 73 69 62 6c 65 20 75 6e 74 69 6c 20 74 6b 20 38 sible until tk 8
40d40 2e 33 2e 20 28 6d 61 6b 65 73 20 6d 65 20 77 6f .3. (makes me wo
40d50 6e 64 65 72 0a 09 09 20 20 20 20 23 20 77 68 79 nder... # why
40d60 20 49 20 63 68 6f 73 65 20 74 6f 20 75 73 65 20 I chose to use
40d70 61 20 6c 61 62 65 6c 2c 20 62 75 74 20 74 68 61 a label, but tha
40d80 74 20 61 6e 73 77 65 72 20 69 73 0a 09 09 20 20 t answer is...
40d90 20 20 23 20 6c 6f 73 74 20 74 6f 20 61 6e 74 69 # lost to anti
40da0 71 75 69 74 79 29 0a 09 09 20 20 20 20 69 66 20 quity)... if
40db0 7b 24 3a 3a 74 63 6c 5f 76 65 72 73 69 6f 6e 20 {$::tcl_version
40dc0 3e 3d 20 38 2e 33 7d 20 7b 0a 09 09 20 20 20 20 >= 8.3} {...
40dd0 20 20 20 20 24 77 69 64 67 65 74 73 28 62 75 74 $widgets(but
40de0 74 6f 6e 29 20 63 6f 6e 66 69 67 75 72 65 20 2d ton) configure -
40df0 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09 state disabled..
40e00 09 20 20 20 20 7d 0a 0a 09 09 7d 20 65 6c 73 65 . }....} else
40e10 20 7b 0a 09 09 20 20 20 20 73 65 74 20 6f 70 74 {... set opt
40e20 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 6f ions($option) $o
40e30 6c 64 56 61 6c 75 65 0a 09 09 20 20 20 20 73 65 ldValue... se
40e40 74 20 6d 65 73 73 61 67 65 20 22 62 61 64 20 73 t message "bad s
40e50 74 61 74 65 20 76 61 6c 75 65 20 5c 22 24 6e 65 tate value \"$ne
40e60 77 56 61 6c 75 65 5c 22 3b 22 0a 09 09 20 20 20 wValue\";"...
40e70 20 61 70 70 65 6e 64 20 6d 65 73 73 61 67 65 20 append message
40e80 22 20 6d 75 73 74 20 62 65 20 6e 6f 72 6d 61 6c " must be normal
40e90 20 6f 72 20 64 69 73 61 62 6c 65 64 22 0a 09 09 or disabled"...
40ea0 20 20 20 20 65 72 72 6f 72 20 24 6d 65 73 73 61 error $messa
40eb0 67 65 0a 09 09 7d 0a 0a 09 09 73 65 74 20 6f 70 ge...}....set op
40ec0 74 69 6f 6e 73 28 24 6f 70 74 69 6f 6e 29 20 24 tions($option) $
40ed0 6e 65 77 56 61 6c 75 65 0a 09 20 20 20 20 7d 0a newValue.. }.
40ee0 09 2d 74 61 6b 65 66 6f 63 75 73 20 7b 0a 09 09 .-takefocus {...
40ef0 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 29 20 $widgets(entry)
40f00 63 6f 6e 66 69 67 75 72 65 20 2d 74 61 6b 65 66 configure -takef
40f10 6f 63 75 73 20 24 6e 65 77 56 61 6c 75 65 0a 09 ocus $newValue..
40f20 09 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 .set options($op
40f30 74 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a tion) $newValue.
40f40 09 20 20 20 20 7d 0a 09 2d 74 65 78 74 76 61 72 . }..-textvar
40f50 69 61 62 6c 65 20 7b 0a 09 09 24 77 69 64 67 65 iable {...$widge
40f60 74 73 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 ts(entry) config
40f70 75 72 65 20 2d 74 65 78 74 76 61 72 69 61 62 6c ure -textvariabl
40f80 65 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 73 65 e $newValue...se
40f90 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f t options($optio
40fa0 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 n) $newValue..
40fb0 20 20 7d 0a 09 2d 76 61 6c 75 65 20 7b 0a 09 09 }..-value {...
40fc0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 74 56 ::combobox::SetV
40fd0 61 6c 75 65 20 24 77 69 64 67 65 74 73 28 74 68 alue $widgets(th
40fe0 69 73 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 is) $newValue...
40ff0 73 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 set options($opt
41000 69 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 ion) $newValue..
41010 20 20 20 20 7d 0a 09 2d 77 69 64 74 68 20 7b 0a }..-width {.
41020 09 09 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 ..$widgets(entry
41030 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 77 69 64 ) configure -wid
41040 74 68 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 24 th $newValue...$
41050 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 widgets(listbox)
41060 20 63 6f 6e 66 69 67 75 72 65 20 2d 77 69 64 74 configure -widt
41070 68 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 73 65 h $newValue...se
41080 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 6f t options($optio
41090 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 20 n) $newValue..
410a0 20 20 7d 0a 09 2d 78 73 63 72 6f 6c 6c 63 6f 6d }..-xscrollcom
410b0 6d 61 6e 64 20 7b 0a 09 09 24 77 69 64 67 65 74 mand {...$widget
410c0 73 28 65 6e 74 72 79 29 20 63 6f 6e 66 69 67 75 s(entry) configu
410d0 72 65 20 2d 78 73 63 72 6f 6c 6c 63 6f 6d 6d 61 re -xscrollcomma
410e0 6e 64 20 24 6e 65 77 56 61 6c 75 65 0a 09 09 73 nd $newValue...s
410f0 65 74 20 6f 70 74 69 6f 6e 73 28 24 6f 70 74 69 et options($opti
41100 6f 6e 29 20 24 6e 65 77 56 61 6c 75 65 0a 09 20 on) $newValue..
41110 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 20 7b 24 75 }..}...if {$u
41120 70 64 61 74 65 56 69 73 75 61 6c 7d 20 7b 0a 09 pdateVisual} {..
41130 20 20 20 20 55 70 64 61 74 65 56 69 73 75 61 6c UpdateVisual
41140 41 74 74 72 69 62 75 74 65 73 20 24 77 0a 09 7d Attributes $w..}
41150 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 3a 3a 63 6f . }.}..# ::co
41160 6d 62 6f 62 6f 78 3a 3a 55 70 64 61 74 65 56 69 mbobox::UpdateVi
41170 73 75 61 6c 41 74 74 72 69 62 75 74 65 73 20 2d sualAttributes -
41180 2d 0a 23 0a 23 20 73 65 74 73 20 74 68 65 20 76 -.#.# sets the v
41190 69 73 75 61 6c 20 61 74 74 72 69 62 75 74 65 73 isual attributes
411a0 20 28 66 6f 72 65 67 72 6f 75 6e 64 2c 20 62 61 (foreground, ba
411b0 63 6b 67 72 6f 75 6e 64 20 6d 6f 73 74 6c 79 29 ckground mostly)
411c0 0a 23 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 .# based on the
411d0 63 75 72 72 65 6e 74 20 73 74 61 74 65 20 6f 66 current state of
411e0 20 74 68 65 20 77 69 64 67 65 74 20 28 6e 6f 72 the widget (nor
411f0 6d 61 6c 2f 64 69 73 61 62 6c 65 64 2c 0a 23 20 mal/disabled,.#
41200 65 64 69 74 61 62 6c 65 2f 6e 6f 6e 2d 65 64 69 editable/non-edi
41210 74 61 62 6c 65 29 0a 23 0a 23 20 77 68 79 20 61 table).#.# why a
41220 20 70 72 6f 63 20 66 6f 72 20 73 75 63 68 20 61 proc for such a
41230 20 73 69 6d 70 6c 65 20 74 68 69 6e 67 3f 20 57 simple thing? W
41240 65 6c 6c 2c 20 69 6e 20 61 64 64 69 74 69 6f 6e ell, in addition
41250 20 74 6f 20 74 68 65 0a 23 20 76 61 72 69 6f 75 to the.# variou
41260 73 20 73 74 61 74 65 73 20 6f 66 20 74 68 65 20 s states of the
41270 77 69 64 67 65 74 2c 20 77 65 20 61 6c 73 6f 20 widget, we also
41280 68 61 76 65 20 74 6f 20 63 6f 6e 73 69 64 65 72 have to consider
41290 20 74 68 65 0a 23 20 76 65 72 73 69 6f 6e 20 6f the.# version o
412a0 66 20 74 6b 20 62 65 69 6e 67 20 75 73 65 64 20 f tk being used
412b0 2d 2d 20 76 65 72 73 69 6f 6e 73 20 66 72 6f 6d -- versions from
412c0 20 38 2e 34 20 61 6e 64 20 62 65 79 6f 6e 64 20 8.4 and beyond
412d0 68 61 76 65 0a 23 20 74 68 65 20 6e 6f 74 69 6f have.# the notio
412e0 6e 20 6f 66 20 64 69 73 61 62 6c 65 64 20 66 6f n of disabled fo
412f0 72 65 67 72 6f 75 6e 64 2f 62 61 63 6b 67 72 6f reground/backgro
41300 75 6e 64 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 und options for
41310 76 61 72 69 6f 75 73 0a 23 20 77 69 64 67 65 74 various.# widget
41320 73 2e 20 41 6c 6c 20 6f 66 20 74 68 65 20 70 65 s. All of the pe
41330 72 6d 75 74 61 74 69 6f 6e 73 20 63 61 6e 20 67 rmutations can g
41340 65 74 20 6e 61 73 74 79 2c 20 73 6f 20 77 65 20 et nasty, so we
41350 65 6e 63 61 70 73 75 6c 61 74 65 0a 23 20 69 74 encapsulate.# it
41360 20 61 6c 6c 20 69 6e 20 6f 6e 65 20 73 70 6f 74 all in one spot
41370 2e 0a 23 0a 23 20 6e 6f 74 65 20 61 6c 73 6f 20 ..#.# note also
41380 74 68 61 74 20 77 65 20 64 6f 6e 27 74 20 68 61 that we don't ha
41390 6e 64 6c 65 20 61 6c 6c 20 76 69 73 75 61 6c 20 ndle all visual
413a0 61 74 74 72 69 62 75 74 65 73 20 68 65 72 65 3b attributes here;
413b0 20 6a 75 73 74 0a 23 20 74 68 65 20 6f 6e 65 73 just.# the ones
413c0 20 74 68 61 74 20 64 65 70 65 6e 64 20 6f 6e 20 that depend on
413d0 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 the state of the
413e0 20 77 69 64 67 65 74 2e 20 54 68 65 20 72 65 73 widget. The res
413f0 74 20 61 72 65 0a 23 20 68 61 6e 64 6c 65 64 20 t are.# handled
41400 6f 6e 20 61 20 63 61 73 65 20 62 79 20 63 61 73 on a case by cas
41410 65 20 62 61 73 69 73 0a 23 0a 23 20 41 72 67 75 e basis.#.# Argu
41420 6d 65 6e 74 73 3a 0a 23 20 20 20 20 77 20 20 20 ments:.# w
41430 20 20 20 20 20 20 20 20 20 20 20 20 20 77 69 64 wid
41440 67 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 0a 23 get pathname.#.#
41450 20 52 65 74 75 72 6e 73 3a 0a 23 20 20 20 20 65 Returns:.# e
41460 6d 70 74 79 20 73 74 72 69 6e 67 0a 0a 70 72 6f mpty string..pro
41470 63 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 55 70 c ::combobox::Up
41480 64 61 74 65 56 69 73 75 61 6c 41 74 74 72 69 62 dateVisualAttrib
41490 75 74 65 73 20 7b 77 7d 20 7b 0a 0a 20 20 20 20 utes {w} {..
414a0 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 upvar ::combobox
414b0 3a 3a 24 7b 77 7d 3a 3a 77 69 64 67 65 74 73 20 ::${w}::widgets
414c0 77 69 64 67 65 74 73 0a 20 20 20 20 75 70 76 61 widgets. upva
414d0 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b r ::combobox::${
414e0 77 7d 3a 3a 6f 70 74 69 6f 6e 73 20 6f 70 74 69 w}::options opti
414f0 6f 6e 73 0a 0a 20 20 20 20 69 66 20 7b 24 6f 70 ons.. if {$op
41500 74 69 6f 6e 73 28 2d 73 74 61 74 65 29 20 3d 3d tions(-state) ==
41510 20 22 6e 6f 72 6d 61 6c 22 7d 20 7b 0a 0a 09 73 "normal"} {...s
41520 65 74 20 66 6f 72 65 67 72 6f 75 6e 64 20 24 6f et foreground $o
41530 70 74 69 6f 6e 73 28 2d 66 6f 72 65 67 72 6f 75 ptions(-foregrou
41540 6e 64 29 0a 09 73 65 74 20 62 61 63 6b 67 72 6f nd)..set backgro
41550 75 6e 64 20 24 6f 70 74 69 6f 6e 73 28 2d 62 61 und $options(-ba
41560 63 6b 67 72 6f 75 6e 64 29 0a 0a 20 20 20 20 7d ckground).. }
41570 20 65 6c 73 65 69 66 20 7b 24 6f 70 74 69 6f 6e elseif {$option
41580 73 28 2d 73 74 61 74 65 29 20 3d 3d 20 22 64 69 s(-state) == "di
41590 73 61 62 6c 65 64 22 7d 20 7b 0a 0a 09 73 65 74 sabled"} {...set
415a0 20 66 6f 72 65 67 72 6f 75 6e 64 20 24 6f 70 74 foreground $opt
415b0 69 6f 6e 73 28 2d 64 69 73 61 62 6c 65 64 66 6f ions(-disabledfo
415c0 72 65 67 72 6f 75 6e 64 29 0a 09 73 65 74 20 62 reground)..set b
415d0 61 63 6b 67 72 6f 75 6e 64 20 24 6f 70 74 69 6f ackground $optio
415e0 6e 73 28 2d 64 69 73 61 62 6c 65 64 62 61 63 6b ns(-disabledback
415f0 67 72 6f 75 6e 64 29 0a 20 20 20 20 7d 0a 0a 20 ground). }..
41600 20 20 20 24 77 69 64 67 65 74 73 28 65 6e 74 72 $widgets(entr
41610 79 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f y) configure -fo
41620 72 65 67 72 6f 75 6e 64 20 24 66 6f 72 65 67 72 reground $foregr
41630 6f 75 6e 64 20 2d 62 61 63 6b 67 72 6f 75 6e 64 ound -background
41640 20 24 62 61 63 6b 67 72 6f 75 6e 64 0a 20 20 20 $background.
41650 20 24 77 69 64 67 65 74 73 28 6c 69 73 74 62 6f $widgets(listbo
41660 78 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f x) configure -fo
41670 72 65 67 72 6f 75 6e 64 20 24 66 6f 72 65 67 72 reground $foregr
41680 6f 75 6e 64 20 2d 62 61 63 6b 67 72 6f 75 6e 64 ound -background
41690 20 24 62 61 63 6b 67 72 6f 75 6e 64 0a 20 20 20 $background.
416a0 20 24 77 69 64 67 65 74 73 28 62 75 74 74 6f 6e $widgets(button
416b0 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 66 6f 72 ) configure -for
416c0 65 67 72 6f 75 6e 64 20 24 66 6f 72 65 67 72 6f eground $foregro
416d0 75 6e 64 0a 20 20 20 20 24 77 69 64 67 65 74 73 und. $widgets
416e0 28 76 73 62 29 20 63 6f 6e 66 69 67 75 72 65 20 (vsb) configure
416f0 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 61 63 -background $bac
41700 6b 67 72 6f 75 6e 64 20 2d 74 72 6f 75 67 68 63 kground -troughc
41710 6f 6c 6f 72 20 24 62 61 63 6b 67 72 6f 75 6e 64 olor $background
41720 0a 20 20 20 20 24 77 69 64 67 65 74 73 28 66 72 . $widgets(fr
41730 61 6d 65 29 20 63 6f 6e 66 69 67 75 72 65 20 2d ame) configure -
41740 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 61 63 6b background $back
41750 67 72 6f 75 6e 64 0a 0a 20 20 20 20 23 20 77 65 ground.. # we
41760 20 6e 65 65 64 20 74 6f 20 73 65 74 20 74 68 65 need to set the
41770 20 64 69 73 61 62 6c 65 64 20 63 6f 6c 6f 72 73 disabled colors
41780 20 69 6e 20 63 61 73 65 20 6f 75 72 20 77 69 64 in case our wid
41790 67 65 74 20 69 73 20 64 69 73 61 62 6c 65 64 2e get is disabled.
417a0 0a 20 20 20 20 23 20 57 65 20 63 6f 75 6c 64 20 . # We could
417b0 61 63 74 75 61 6c 6c 79 20 63 68 65 63 6b 20 66 actually check f
417c0 6f 72 20 64 69 73 61 62 6c 65 64 2d 6e 65 73 73 or disabled-ness
417d0 2c 20 62 75 74 20 77 65 20 61 6c 73 6f 20 6e 65 , but we also ne
417e0 65 64 20 74 6f 0a 20 20 20 20 23 20 63 68 65 63 ed to. # chec
417f0 6b 20 77 68 65 74 68 65 72 20 77 65 27 72 65 20 k whether we're
41800 65 6e 61 62 6c 65 64 20 62 75 74 20 6e 6f 74 20 enabled but not
41810 65 64 69 74 61 62 6c 65 2c 20 69 6e 20 77 68 69 editable, in whi
41820 63 68 20 63 61 73 65 20 74 68 65 0a 20 20 20 20 ch case the.
41830 23 20 65 6e 74 72 79 20 77 69 64 67 65 74 20 69 # entry widget i
41840 73 20 64 69 73 61 62 6c 65 64 20 62 75 74 20 77 s disabled but w
41850 65 20 73 74 69 6c 6c 20 77 61 6e 74 20 74 68 65 e still want the
41860 20 65 6e 61 62 6c 65 64 20 63 6f 6c 6f 72 73 2e enabled colors.
41870 20 49 74 27 73 0a 20 20 20 20 23 20 65 61 73 69 It's. # easi
41880 65 72 20 6a 75 73 74 20 74 6f 20 73 65 74 20 65 er just to set e
41890 76 65 72 79 74 68 69 6e 67 20 61 6e 64 20 62 65 verything and be
418a0 20 64 6f 6e 65 20 77 69 74 68 20 69 74 2e 0a 0a done with it...
418b0 20 20 20 20 69 66 20 7b 24 3a 3a 74 63 6c 5f 76 if {$::tcl_v
418c0 65 72 73 69 6f 6e 20 3e 3d 20 38 2e 34 7d 20 7b ersion >= 8.4} {
418d0 0a 09 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 ..$widgets(entry
418e0 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 64 69 73 ) configure -dis
418f0 61 62 6c 65 64 66 6f 72 65 67 72 6f 75 6e 64 20 abledforeground
41900 24 66 6f 72 65 67 72 6f 75 6e 64 20 5c 0a 09 20 $foreground \..
41910 20 2d 64 69 73 61 62 6c 65 64 62 61 63 6b 67 72 -disabledbackgr
41920 6f 75 6e 64 20 24 62 61 63 6b 67 72 6f 75 6e 64 ound $background
41930 0a 09 24 77 69 64 67 65 74 73 28 62 75 74 74 6f ..$widgets(butto
41940 6e 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 64 69 n) configure -di
41950 73 61 62 6c 65 64 66 6f 72 65 67 72 6f 75 6e 64 sabledforeground
41960 20 24 66 6f 72 65 67 72 6f 75 6e 64 0a 09 24 77 $foreground..$w
41970 69 64 67 65 74 73 28 6c 69 73 74 62 6f 78 29 20 idgets(listbox)
41980 63 6f 6e 66 69 67 75 72 65 20 2d 64 69 73 61 62 configure -disab
41990 6c 65 64 66 6f 72 65 67 72 6f 75 6e 64 20 24 66 ledforeground $f
419a0 6f 72 65 67 72 6f 75 6e 64 0a 20 20 20 20 7d 0a oreground. }.
419b0 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a }..# ::combobox:
419c0 3a 53 65 74 56 61 6c 75 65 20 2d 2d 0a 23 0a 23 :SetValue --.#.#
419d0 20 20 20 20 73 65 74 73 20 74 68 65 20 76 61 6c sets the val
419e0 75 65 20 6f 66 20 74 68 65 20 63 6f 6d 62 6f 62 ue of the combob
419f0 6f 78 20 61 6e 64 20 63 61 6c 6c 73 20 74 68 65 ox and calls the
41a00 20 2d 63 6f 6d 6d 61 6e 64 2c 0a 23 20 20 20 20 -command,.#
41a10 69 66 20 64 65 66 69 6e 65 64 0a 23 0a 23 20 41 if defined.#.# A
41a20 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 20 20 20 rguments:.#.#
41a30 20 77 20 20 20 20 20 20 20 20 20 20 77 69 64 67 w widg
41a40 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 20 20 20 et pathname.#
41a50 20 6e 65 77 56 61 6c 75 65 20 20 20 74 68 65 20 newValue the
41a60 6e 65 77 20 76 61 6c 75 65 20 6f 66 20 74 68 65 new value of the
41a70 20 63 6f 6d 62 6f 62 6f 78 0a 23 0a 23 20 52 65 combobox.#.# Re
41a80 74 75 72 6e 73 0a 23 0a 23 20 20 20 20 45 6d 70 turns.#.# Emp
41a90 74 79 20 73 74 72 69 6e 67 0a 0a 70 72 6f 63 20 ty string..proc
41aa0 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 53 65 74 56 ::combobox::SetV
41ab0 61 6c 75 65 20 7b 77 20 6e 65 77 56 61 6c 75 65 alue {w newValue
41ac0 7d 20 7b 0a 0a 20 20 20 20 75 70 76 61 72 20 3a } {.. upvar :
41ad0 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a :combobox::${w}:
41ae0 3a 77 69 64 67 65 74 73 20 77 69 64 67 65 74 73 :widgets widgets
41af0 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 6f 6d . upvar ::com
41b00 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f 70 74 bobox::${w}::opt
41b10 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 0a 20 20 20 ions options.
41b20 20 75 70 76 61 72 20 3a 3a 63 6f 6d 62 6f 62 6f upvar ::combobo
41b30 78 3a 3a 24 7b 77 7d 3a 3a 69 67 6e 6f 72 65 54 x::${w}::ignoreT
41b40 72 61 63 65 20 69 67 6e 6f 72 65 54 72 61 63 65 race ignoreTrace
41b50 0a 20 20 20 20 75 70 76 61 72 20 3a 3a 63 6f 6d . upvar ::com
41b60 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a 6f 6c 64 bobox::${w}::old
41b70 56 61 6c 75 65 20 6f 6c 64 56 61 6c 75 65 0a 0a Value oldValue..
41b80 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
41b90 69 73 74 73 20 6f 70 74 69 6f 6e 73 28 2d 74 65 ists options(-te
41ba0 78 74 76 61 72 69 61 62 6c 65 29 5d 20 26 26 20 xtvariable)] &&
41bb0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5c [string length \
41bc0 0a 20 20 20 20 20 20 24 6f 70 74 69 6f 6e 73 28 . $options(
41bd0 2d 74 65 78 74 76 61 72 69 61 62 6c 65 29 5d 20 -textvariable)]
41be0 3e 20 30 7d 20 7b 0a 09 73 65 74 20 76 61 72 69 > 0} {..set vari
41bf0 61 62 6c 65 20 3a 3a 24 6f 70 74 69 6f 6e 73 28 able ::$options(
41c00 2d 74 65 78 74 76 61 72 69 61 62 6c 65 29 0a 09 -textvariable)..
41c10 73 65 74 20 24 76 61 72 69 61 62 6c 65 20 24 6e set $variable $n
41c20 65 77 56 61 6c 75 65 0a 20 20 20 20 7d 20 65 6c ewValue. } el
41c30 73 65 20 7b 0a 09 73 65 74 20 6f 6c 64 73 74 61 se {..set oldsta
41c40 74 65 20 5b 24 77 69 64 67 65 74 73 28 65 6e 74 te [$widgets(ent
41c50 72 79 29 20 63 67 65 74 20 2d 73 74 61 74 65 5d ry) cget -state]
41c60 0a 09 24 77 69 64 67 65 74 73 28 65 6e 74 72 79 ..$widgets(entry
41c70 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 74 61 ) configure -sta
41c80 74 65 20 6e 6f 72 6d 61 6c 0a 09 24 77 69 64 67 te normal..$widg
41c90 65 74 73 28 65 6e 74 72 79 29 20 64 65 6c 65 74 ets(entry) delet
41ca0 65 20 30 20 65 6e 64 0a 09 24 77 69 64 67 65 74 e 0 end..$widget
41cb0 73 28 65 6e 74 72 79 29 20 69 6e 73 65 72 74 20 s(entry) insert
41cc0 30 20 24 6e 65 77 56 61 6c 75 65 0a 09 24 77 69 0 $newValue..$wi
41cd0 64 67 65 74 73 28 65 6e 74 72 79 29 20 63 6f 6e dgets(entry) con
41ce0 66 69 67 75 72 65 20 2d 73 74 61 74 65 20 24 6f figure -state $o
41cf0 6c 64 73 74 61 74 65 0a 20 20 20 20 7d 0a 0a 20 ldstate. }..
41d00 20 20 20 23 20 73 65 74 20 6f 75 72 20 69 6e 74 # set our int
41d10 65 72 6e 61 6c 20 74 65 78 74 76 61 72 69 61 62 ernal textvariab
41d20 6c 65 3b 20 74 68 69 73 20 77 69 6c 6c 20 63 61 le; this will ca
41d30 75 73 65 20 61 6e 79 20 70 75 62 6c 69 63 0a 20 use any public.
41d40 20 20 20 23 20 74 65 78 74 76 61 72 69 61 62 6c # textvariabl
41d50 65 20 28 69 65 3a 20 64 65 66 69 6e 65 64 20 62 e (ie: defined b
41d60 79 20 74 68 65 20 75 73 65 72 29 20 74 6f 20 62 y the user) to b
41d70 65 20 75 70 64 61 74 65 64 20 61 73 0a 20 20 20 e updated as.
41d80 20 23 20 77 65 6c 6c 0a 20 20 20 20 23 20 20 20 # well. #
41d90 20 73 65 74 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a set ::combobox:
41da0 3a 24 7b 77 7d 3a 3a 65 6e 74 72 79 54 65 78 74 :${w}::entryText
41db0 56 61 72 69 61 62 6c 65 20 24 6e 65 77 56 61 6c Variable $newVal
41dc0 75 65 0a 0a 20 20 20 20 23 20 72 65 64 65 66 69 ue.. # redefi
41dd0 6e 65 20 6f 75 72 20 63 6f 6e 63 65 70 74 20 6f ne our concept o
41de0 66 20 74 68 65 20 22 6f 6c 64 20 76 61 6c 75 65 f the "old value
41df0 22 2e 20 44 6f 20 69 74 20 62 65 66 6f 72 65 20 ". Do it before
41e00 72 75 6e 6e 69 6e 67 0a 20 20 20 20 23 20 61 6e running. # an
41e10 79 20 61 73 73 6f 63 69 61 74 65 64 20 63 6f 6d y associated com
41e20 6d 61 6e 64 20 73 6f 20 77 65 20 63 61 6e 20 62 mand so we can b
41e30 65 20 73 75 72 65 20 69 74 20 68 61 70 70 65 6e e sure it happen
41e40 73 20 65 76 65 6e 0a 20 20 20 20 23 20 69 66 20 s even. # if
41e50 74 68 65 20 63 6f 6d 6d 61 6e 64 20 73 6f 6d 65 the command some
41e60 68 6f 77 20 66 61 69 6c 73 2e 0a 20 20 20 20 73 how fails.. s
41e70 65 74 20 6f 6c 64 56 61 6c 75 65 20 24 6e 65 77 et oldValue $new
41e80 56 61 6c 75 65 0a 0a 0a 20 20 20 20 23 20 63 61 Value... # ca
41e90 6c 6c 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 ll the associate
41ea0 64 20 63 6f 6d 6d 61 6e 64 2e 20 54 68 65 20 70 d command. The p
41eb0 72 6f 63 20 77 69 6c 6c 20 68 61 6e 64 6c 65 20 roc will handle
41ec0 77 68 65 74 68 65 72 20 6f 72 0a 20 20 20 20 23 whether or. #
41ed0 20 6e 6f 74 20 74 6f 20 61 63 74 75 61 6c 6c 79 not to actually
41ee0 20 63 61 6c 6c 20 69 74 2c 20 61 6e 64 20 77 69 call it, and wi
41ef0 74 68 20 77 68 61 74 20 61 72 67 73 0a 20 20 20 th what args.
41f00 20 43 61 6c 6c 43 6f 6d 6d 61 6e 64 20 24 77 20 CallCommand $w
41f10 24 6e 65 77 56 61 6c 75 65 0a 0a 20 20 20 20 72 $newValue.. r
41f20 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 23 20 3a 3a eturn "".}..# ::
41f30 63 6f 6d 62 6f 62 6f 78 3a 3a 43 61 6c 6c 43 6f combobox::CallCo
41f40 6d 6d 61 6e 64 20 2d 2d 0a 23 0a 23 20 20 20 63 mmand --.#.# c
41f50 61 6c 6c 73 20 74 68 65 20 61 73 73 6f 63 69 61 alls the associa
41f60 74 65 64 20 63 6f 6d 6d 61 6e 64 2c 20 69 66 20 ted command, if
41f70 61 6e 79 2c 20 61 70 70 65 6e 64 69 6e 67 20 74 any, appending t
41f80 68 65 20 6e 65 77 0a 23 20 20 20 76 61 6c 75 65 he new.# value
41f90 20 74 6f 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 to the command
41fa0 74 6f 20 62 65 20 63 61 6c 6c 65 64 2e 0a 23 0a to be called..#.
41fb0 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 # Arguments:.#.#
41fc0 20 20 20 20 77 20 20 20 20 20 20 20 20 20 77 69 w wi
41fd0 64 67 65 74 20 70 61 74 68 6e 61 6d 65 0a 23 20 dget pathname.#
41fe0 20 20 20 6e 65 77 56 61 6c 75 65 20 20 74 68 65 newValue the
41ff0 20 6e 65 77 20 76 61 6c 75 65 20 6f 66 20 74 68 new value of th
42000 65 20 63 6f 6d 62 6f 62 6f 78 0a 23 0a 23 20 52 e combobox.#.# R
42010 65 74 75 72 6e 73 0a 23 0a 23 20 20 20 20 65 6d eturns.#.# em
42020 70 74 79 20 73 74 72 69 6e 67 0a 0a 70 72 6f 63 pty string..proc
42030 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 43 61 6c ::combobox::Cal
42040 6c 43 6f 6d 6d 61 6e 64 20 7b 77 20 6e 65 77 56 lCommand {w newV
42050 61 6c 75 65 7d 20 7b 0a 20 20 20 20 75 70 76 61 alue} {. upva
42060 72 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b r ::combobox::${
42070 77 7d 3a 3a 77 69 64 67 65 74 73 20 77 69 64 67 w}::widgets widg
42080 65 74 73 0a 20 20 20 20 75 70 76 61 72 20 3a 3a ets. upvar ::
42090 63 6f 6d 62 6f 62 6f 78 3a 3a 24 7b 77 7d 3a 3a combobox::${w}::
420a0 6f 70 74 69 6f 6e 73 20 6f 70 74 69 6f 6e 73 0a options options.
420b0 0a 20 20 20 20 23 20 63 61 6c 6c 20 74 68 65 20 . # call the
420c0 61 73 73 6f 63 69 61 74 65 64 20 63 6f 6d 6d 61 associated comma
420d0 6e 64 2c 20 69 66 20 64 65 66 69 6e 65 64 20 61 nd, if defined a
420e0 6e 64 20 2d 63 6f 6d 6d 61 6e 64 73 74 61 74 65 nd -commandstate
420f0 20 69 73 0a 20 20 20 20 23 20 73 65 74 20 74 6f is. # set to
42100 20 22 6e 6f 72 6d 61 6c 22 0a 20 20 20 20 69 66 "normal". if
42110 20 7b 24 6f 70 74 69 6f 6e 73 28 2d 63 6f 6d 6d {$options(-comm
42120 61 6e 64 73 74 61 74 65 29 20 3d 3d 20 22 6e 6f andstate) == "no
42130 72 6d 61 6c 22 20 26 26 20 5b 73 74 72 69 6e 67 rmal" && [string
42140 20 6c 65 6e 67 74 68 20 5c 0a 20 20 20 20 20 20 length \.
42150 24 6f 70 74 69 6f 6e 73 28 2d 63 6f 6d 6d 61 6e $options(-comman
42160 64 29 5d 20 3e 20 30 7d 20 7b 0a 09 73 65 74 20 d)] > 0} {..set
42170 61 72 67 73 20 5b 6c 69 73 74 20 24 77 69 64 67 args [list $widg
42180 65 74 73 28 74 68 69 73 29 20 24 6e 65 77 56 61 ets(this) $newVa
42190 6c 75 65 5d 0a 09 75 70 6c 65 76 65 6c 20 5c 23 lue]..uplevel \#
421a0 30 20 24 6f 70 74 69 6f 6e 73 28 2d 63 6f 6d 6d 0 $options(-comm
421b0 61 6e 64 29 20 24 61 72 67 73 0a 20 20 20 20 7d and) $args. }
421c0 0a 7d 0a 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 6f .}...# ::combobo
421d0 78 3a 3a 47 65 74 42 6f 6f 6c 65 61 6e 20 2d 2d x::GetBoolean --
421e0 0a 23 0a 23 20 20 20 20 20 72 65 74 75 72 6e 73 .#.# returns
421f0 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 the value of a
42200 28 70 72 65 73 75 6d 61 62 6c 79 29 20 62 6f 6f (presumably) boo
42210 6c 65 61 6e 20 73 74 72 69 6e 67 20 28 69 65 3a lean string (ie:
42220 20 69 74 20 73 68 6f 75 6c 64 0a 23 20 20 20 20 it should.#
42230 20 64 6f 20 74 68 65 20 72 69 67 68 74 20 74 68 do the right th
42240 69 6e 67 20 69 66 20 74 68 65 20 73 74 72 69 6e ing if the strin
42250 67 20 69 73 20 22 79 65 73 22 2c 20 22 6e 6f 22 g is "yes", "no"
42260 2c 20 22 74 72 75 65 22 2c 20 31 2c 20 65 74 63 , "true", 1, etc
42270 0a 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a .#.# Arguments:.
42280 23 0a 23 20 20 20 20 20 76 61 6c 75 65 20 20 20 #.# value
42290 20 20 20 20 76 61 6c 75 65 20 74 6f 20 62 65 20 value to be
422a0 63 6f 6e 76 65 72 74 65 64 0a 23 20 20 20 20 20 converted.#
422b0 65 72 72 6f 72 56 61 6c 75 65 20 20 61 20 64 65 errorValue a de
422c0 66 61 75 6c 74 20 76 61 6c 75 65 20 74 6f 20 62 fault value to b
422d0 65 20 72 65 74 75 72 6e 65 64 20 69 6e 20 63 61 e returned in ca
422e0 73 65 20 6f 66 20 61 6e 20 65 72 72 6f 72 0a 23 se of an error.#
422f0 0a 23 20 52 65 74 75 72 6e 73 3a 0a 23 0a 23 20 .# Returns:.#.#
42300 20 20 20 20 61 20 31 20 6f 72 20 7a 65 72 6f 2c a 1 or zero,
42310 20 6f 72 20 74 68 65 20 76 61 6c 75 65 20 6f 66 or the value of
42320 20 65 72 72 6f 72 56 61 6c 75 65 20 69 66 20 74 errorValue if t
42330 68 65 20 73 74 72 69 6e 67 20 69 73 6e 27 74 0a he string isn't.
42340 23 20 20 20 20 20 61 20 70 72 6f 70 65 72 20 62 # a proper b
42350 6f 6f 6c 65 61 6e 20 76 61 6c 75 65 0a 0a 70 72 oolean value..pr
42360 6f 63 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 47 oc ::combobox::G
42370 65 74 42 6f 6f 6c 65 61 6e 20 7b 76 61 6c 75 65 etBoolean {value
42380 20 7b 65 72 72 6f 72 56 61 6c 75 65 20 31 7d 7d {errorValue 1}}
42390 20 7b 0a 20 20 20 20 69 66 20 7b 5b 63 61 74 63 {. if {[catc
423a0 68 20 7b 65 78 70 72 20 7b 28 5b 73 74 72 69 6e h {expr {([strin
423b0 67 20 74 72 69 6d 20 24 76 61 6c 75 65 5d 29 20 g trim $value])
423c0 3f 31 3a 30 7d 7d 20 72 65 73 5d 7d 20 7b 0a 09 ?1:0}} res]} {..
423d0 72 65 74 75 72 6e 20 24 65 72 72 6f 72 56 61 6c return $errorVal
423e0 75 65 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a ue. } else {.
423f0 09 72 65 74 75 72 6e 20 24 72 65 73 0a 20 20 20 .return $res.
42400 20 7d 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 }.}..# ::combob
42410 6f 78 3a 3a 63 6f 6e 76 65 72 74 20 2d 2d 0a 23 ox::convert --.#
42420 0a 23 20 20 20 20 20 70 75 62 6c 69 63 20 72 6f .# public ro
42430 75 74 69 6e 65 20 74 6f 20 63 6f 6e 76 65 72 74 utine to convert
42440 20 25 78 2c 20 25 79 20 61 6e 64 20 25 57 20 62 %x, %y and %W b
42450 69 6e 64 69 6e 67 20 73 75 62 73 74 69 74 75 74 inding substitut
42460 69 6f 6e 73 2e 0a 23 20 20 20 20 20 47 69 76 65 ions..# Give
42470 6e 20 61 6e 20 78 2c 20 79 20 61 6e 64 20 6f 72 n an x, y and or
42480 20 25 57 20 76 61 6c 75 65 20 72 65 6c 61 74 69 %W value relati
42490 76 65 20 74 6f 20 61 20 67 69 76 65 6e 20 77 69 ve to a given wi
424a0 64 67 65 74 2c 20 74 68 69 73 0a 23 20 20 20 20 dget, this.#
424b0 20 72 6f 75 74 69 6e 65 20 77 69 6c 6c 20 63 6f routine will co
424c0 6e 76 65 72 74 20 74 68 65 20 76 61 6c 75 65 73 nvert the values
424d0 20 74 6f 20 62 65 20 72 65 6c 61 74 69 76 65 20 to be relative
424e0 74 6f 20 74 68 65 20 63 6f 6d 62 6f 62 6f 78 0a to the combobox.
424f0 23 20 20 20 20 20 77 69 64 67 65 74 2e 20 46 6f # widget. Fo
42500 72 20 65 78 61 6d 70 6c 65 2c 20 69 74 20 63 6f r example, it co
42510 75 6c 64 20 62 65 20 75 73 65 64 20 69 6e 20 61 uld be used in a
42520 20 62 69 6e 64 69 6e 67 20 6c 69 6b 65 20 74 68 binding like th
42530 69 73 3a 0a 23 0a 23 20 20 20 20 20 62 69 6e 64 is:.#.# bind
42540 20 2e 63 6f 6d 62 6f 62 6f 78 20 3c 62 6c 61 68 .combobox <blah
42550 3e 20 7b 64 6f 53 6f 6d 65 74 68 69 6e 67 20 5b > {doSomething [
42560 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 63 6f 6e 76 ::combobox::conv
42570 65 72 74 20 25 57 20 2d 78 20 25 78 5d 7d 0a 23 ert %W -x %x]}.#
42580 0a 23 20 20 20 20 20 4e 6f 74 65 20 74 68 61 74 .# Note that
42590 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 this procedure
425a0 69 73 20 2a 6e 6f 74 2a 20 65 78 70 6f 72 74 65 is *not* exporte
425b0 64 2c 20 62 75 74 20 69 73 20 69 6e 74 65 6e 64 d, but is intend
425c0 65 64 20 66 6f 72 0a 23 20 20 20 20 20 70 75 62 ed for.# pub
425d0 6c 69 63 20 75 73 65 2e 20 49 74 20 69 73 20 6e lic use. It is n
425e0 6f 74 20 65 78 70 6f 72 74 65 64 20 62 65 63 61 ot exported beca
425f0 75 73 65 20 74 68 65 20 6e 61 6d 65 20 63 6f 75 use the name cou
42600 6c 64 20 65 61 73 69 6c 79 0a 23 20 20 20 20 20 ld easily.#
42610 63 6c 61 73 68 20 77 69 74 68 20 65 78 69 73 74 clash with exist
42620 69 6e 67 20 63 6f 6d 6d 61 6e 64 73 2e 0a 23 0a ing commands..#.
42630 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 0a 23 # Arguments:.#.#
42640 20 20 20 20 20 77 20 20 20 20 20 61 20 77 69 64 w a wid
42650 67 65 74 20 70 61 74 68 3b 20 74 79 70 69 63 61 get path; typica
42660 6c 6c 79 20 74 68 65 20 61 63 74 75 61 6c 20 72 lly the actual r
42670 65 73 75 6c 74 20 6f 66 20 61 20 25 57 0a 23 20 esult of a %W.#
42680 20 20 20 20 20 20 20 20 20 20 73 75 62 73 74 69 substi
42690 74 75 74 69 6f 6e 20 69 6e 20 61 20 62 69 6e 64 tution in a bind
426a0 69 6e 67 2e 20 49 74 20 73 68 6f 75 6c 64 20 62 ing. It should b
426b0 65 20 65 69 74 68 65 72 20 61 0a 23 20 20 20 20 e either a.#
426c0 20 20 20 20 20 20 20 63 6f 6d 62 6f 62 6f 78 20 combobox
426d0 77 69 64 67 65 74 20 6f 72 20 6f 6e 65 20 6f 66 widget or one of
426e0 20 69 74 73 20 73 75 62 77 69 64 67 65 74 73 0a its subwidgets.
426f0 23 0a 23 20 20 20 20 20 61 72 67 73 20 20 73 68 #.# args sh
42700 6f 75 6c 64 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 ould one or more
42710 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e of the followin
42720 67 20 61 72 67 75 6d 65 6e 74 73 20 6f 72 0a 23 g arguments or.#
42730 20 20 20 20 20 20 20 20 20 20 20 70 61 69 72 73 pairs
42740 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 3a 0a 23 of arguments:.#
42750 0a 23 20 20 20 20 20 20 20 20 20 20 20 2d 78 20 .# -x
42760 3c 78 3e 20 20 20 20 20 20 77 69 6c 6c 20 63 6f <x> will co
42770 6e 76 65 72 74 20 74 68 65 20 76 61 6c 75 65 20 nvert the value
42780 3c 78 3e 3b 20 74 79 70 69 63 61 6c 6c 79 20 3c <x>; typically <
42790 78 3e 20 77 69 6c 6c 0a 23 20 20 20 20 20 20 20 x> will.#
427a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
427b0 62 65 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 be the result of
427c0 20 61 20 25 78 20 73 75 62 73 74 69 74 75 74 69 a %x substituti
427d0 6f 6e 0a 23 20 20 20 20 20 20 20 20 20 20 20 2d on.# -
427e0 79 20 3c 79 3e 20 20 20 20 20 20 77 69 6c 6c 20 y <y> will
427f0 63 6f 6e 76 65 72 74 20 74 68 65 20 76 61 6c 75 convert the valu
42800 65 20 3c 79 3e 3b 20 74 79 70 69 63 61 6c 6c 79 e <y>; typically
42810 20 3c 79 3e 20 77 69 6c 6c 0a 23 20 20 20 20 20 <y> will.#
42820 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
42830 20 20 62 65 20 74 68 65 20 72 65 73 75 6c 74 20 be the result
42840 6f 66 20 61 20 25 79 20 73 75 62 73 74 69 74 75 of a %y substitu
42850 74 69 6f 6e 0a 23 20 20 20 20 20 20 20 20 20 20 tion.#
42860 20 2d 57 20 28 6f 72 20 2d 77 29 20 20 77 69 6c -W (or -w) wil
42870 6c 20 72 65 74 75 72 6e 20 74 68 65 20 6e 61 6d l return the nam
42880 65 20 6f 66 20 74 68 65 20 63 6f 6d 62 6f 62 6f e of the combobo
42890 78 20 77 69 64 67 65 74 0a 23 20 20 20 20 20 20 x widget.#
428a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
428b0 20 77 68 69 63 68 20 69 73 20 74 68 65 20 70 61 which is the pa
428c0 72 65 6e 74 20 6f 66 20 24 77 0a 23 0a 23 20 52 rent of $w.#.# R
428d0 65 74 75 72 6e 73 3a 0a 23 0a 23 20 20 20 20 20 eturns:.#.#
428e0 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 72 65 a list of the re
428f0 71 75 65 73 74 65 64 20 76 61 6c 75 65 73 2e 20 quested values.
42900 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 20 73 For example, a s
42910 69 6e 67 6c 65 20 2d 77 20 77 69 6c 6c 0a 23 20 ingle -w will.#
42920 20 20 20 20 72 65 73 75 6c 74 20 69 6e 20 61 20 result in a
42930 6c 69 73 74 20 6f 66 20 6f 6e 65 20 69 74 65 6d list of one item
42940 73 2c 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 s, the name of t
42950 68 65 20 63 6f 6d 62 6f 62 6f 78 20 77 69 64 67 he combobox widg
42960 65 74 2e 0a 23 20 20 20 20 20 53 75 70 70 6c 79 et..# Supply
42970 69 6e 67 20 22 2d 78 20 31 30 20 2d 79 20 32 30 ing "-x 10 -y 20
42980 20 2d 57 22 20 28 69 6e 20 61 6e 79 20 6f 72 64 -W" (in any ord
42990 65 72 29 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 er) will return
429a0 61 20 6c 69 73 74 20 6f 66 0a 23 20 20 20 20 20 a list of.#
429b0 74 68 72 65 65 20 76 61 6c 75 65 73 3a 20 74 68 three values: th
429c0 65 20 63 6f 6e 76 65 72 74 65 64 20 78 20 61 6e e converted x an
429d0 64 20 79 20 76 61 6c 75 65 73 2c 20 61 6e 64 20 d y values, and
429e0 74 68 65 20 6e 61 6d 65 20 6f 66 0a 23 20 20 20 the name of.#
429f0 20 20 74 68 65 20 63 6f 6d 62 6f 62 6f 78 20 77 the combobox w
42a00 69 64 67 65 74 2e 0a 0a 70 72 6f 63 20 3a 3a 63 idget...proc ::c
42a10 6f 6d 62 6f 62 6f 78 3a 3a 63 6f 6e 76 65 72 74 ombobox::convert
42a20 20 7b 77 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 {w args} {.
42a30 73 65 74 20 72 65 73 75 6c 74 20 7b 7d 0a 20 20 set result {}.
42a40 20 20 69 66 20 7b 21 5b 77 69 6e 66 6f 20 65 78 if {![winfo ex
42a50 69 73 74 73 20 24 77 5d 7d 20 7b 0a 09 65 72 72 ists $w]} {..err
42a60 6f 72 20 22 77 69 6e 64 6f 77 20 5c 22 24 77 5c or "window \"$w\
42a70 22 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 22 " doesn't exist"
42a80 0a 20 20 20 20 7d 0a 0a 20 20 20 20 77 68 69 6c . }.. whil
42a90 65 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 61 72 67 e {[llength $arg
42aa0 73 5d 20 3e 20 30 7d 20 7b 0a 09 73 65 74 20 6f s] > 0} {..set o
42ab0 70 74 69 6f 6e 20 5b 6c 69 6e 64 65 78 20 24 61 ption [lindex $a
42ac0 72 67 73 20 30 5d 0a 09 73 65 74 20 61 72 67 73 rgs 0]..set args
42ad0 20 5b 6c 72 61 6e 67 65 20 24 61 72 67 73 20 31 [lrange $args 1
42ae0 20 65 6e 64 5d 0a 0a 09 73 77 69 74 63 68 20 2d end]...switch -
42af0 65 78 61 63 74 20 2d 2d 20 24 6f 70 74 69 6f 6e exact -- $option
42b00 20 7b 0a 09 2d 78 20 7b 0a 09 09 73 65 74 20 76 {..-x {...set v
42b10 61 6c 75 65 20 5b 6c 69 6e 64 65 78 20 24 61 72 alue [lindex $ar
42b20 67 73 20 30 5d 0a 09 09 73 65 74 20 61 72 67 73 gs 0]...set args
42b30 20 5b 6c 72 61 6e 67 65 20 24 61 72 67 73 20 31 [lrange $args 1
42b40 20 65 6e 64 5d 0a 09 09 73 65 74 20 77 69 6e 20 end]...set win
42b50 24 77 0a 09 09 77 68 69 6c 65 20 7b 5b 77 69 6e $w...while {[win
42b60 66 6f 20 63 6c 61 73 73 20 24 77 69 6e 5d 20 21 fo class $win] !
42b70 3d 20 22 43 6f 6d 62 6f 62 6f 78 22 7d 20 7b 0a = "Combobox"} {.
42b80 09 09 20 20 20 20 69 6e 63 72 20 76 61 6c 75 65 .. incr value
42b90 20 5b 77 69 6e 66 6f 20 78 20 24 77 69 6e 5d 0a [winfo x $win].
42ba0 09 09 20 20 20 20 73 65 74 20 77 69 6e 20 5b 77 .. set win [w
42bb0 69 6e 66 6f 20 70 61 72 65 6e 74 20 24 77 69 6e info parent $win
42bc0 5d 0a 09 09 20 20 20 20 69 66 20 7b 24 77 69 6e ]... if {$win
42bd0 20 3d 3d 20 22 2e 22 7d 20 62 72 65 61 6b 0a 09 == "."} break..
42be0 09 7d 0a 09 09 6c 61 70 70 65 6e 64 20 72 65 73 .}...lappend res
42bf0 75 6c 74 20 24 76 61 6c 75 65 0a 09 20 20 20 20 ult $value..
42c00 7d 0a 09 2d 79 20 7b 0a 09 09 73 65 74 20 76 61 }..-y {...set va
42c10 6c 75 65 20 5b 6c 69 6e 64 65 78 20 24 61 72 67 lue [lindex $arg
42c20 73 20 30 5d 0a 09 09 73 65 74 20 61 72 67 73 20 s 0]...set args
42c30 5b 6c 72 61 6e 67 65 20 24 61 72 67 73 20 31 20 [lrange $args 1
42c40 65 6e 64 5d 0a 09 09 73 65 74 20 77 69 6e 20 24 end]...set win $
42c50 77 0a 09 09 77 68 69 6c 65 20 7b 5b 77 69 6e 66 w...while {[winf
42c60 6f 20 63 6c 61 73 73 20 24 77 69 6e 5d 20 21 3d o class $win] !=
42c70 20 22 43 6f 6d 62 6f 62 6f 78 22 7d 20 7b 0a 09 "Combobox"} {..
42c80 09 20 20 20 20 69 6e 63 72 20 76 61 6c 75 65 20 . incr value
42c90 5b 77 69 6e 66 6f 20 79 20 24 77 69 6e 5d 0a 09 [winfo y $win]..
42ca0 09 20 20 20 20 73 65 74 20 77 69 6e 20 5b 77 69 . set win [wi
42cb0 6e 66 6f 20 70 61 72 65 6e 74 20 24 77 69 6e 5d nfo parent $win]
42cc0 0a 09 09 20 20 20 20 69 66 20 7b 24 77 69 6e 20 ... if {$win
42cd0 3d 3d 20 22 2e 22 7d 20 62 72 65 61 6b 0a 09 09 == "."} break...
42ce0 7d 0a 09 09 6c 61 70 70 65 6e 64 20 72 65 73 75 }...lappend resu
42cf0 6c 74 20 24 76 61 6c 75 65 0a 09 20 20 20 20 7d lt $value.. }
42d00 0a 09 2d 77 20 2d 0a 09 2d 57 20 7b 0a 09 09 73 ..-w -..-W {...s
42d10 65 74 20 77 69 6e 20 24 77 0a 09 09 77 68 69 6c et win $w...whil
42d20 65 20 7b 5b 77 69 6e 66 6f 20 63 6c 61 73 73 20 e {[winfo class
42d30 24 77 69 6e 5d 20 21 3d 20 22 43 6f 6d 62 6f 62 $win] != "Combob
42d40 6f 78 22 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 ox"} {... set
42d50 20 77 69 6e 20 5b 77 69 6e 66 6f 20 70 61 72 65 win [winfo pare
42d60 6e 74 20 24 77 69 6e 5d 0a 09 09 20 20 20 20 69 nt $win]... i
42d70 66 20 7b 24 77 69 6e 20 3d 3d 20 22 2e 22 7d 20 f {$win == "."}
42d80 62 72 65 61 6b 0a 0a 09 09 7d 0a 09 09 6c 61 70 break....}...lap
42d90 70 65 6e 64 20 72 65 73 75 6c 74 20 24 77 69 6e pend result $win
42da0 0a 09 20 20 20 20 7d 0a 09 7d 0a 20 20 20 20 7d .. }..}. }
42db0 0a 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 . return $res
42dc0 75 6c 74 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f ult.}..# ::combo
42dd0 62 6f 78 3a 3a 43 61 6e 6f 6e 69 7a 65 20 2d 2d box::Canonize --
42de0 0a 23 0a 23 20 20 20 20 74 61 6b 65 73 20 61 20 .#.# takes a
42df0 28 70 6f 73 73 69 62 6c 79 20 61 62 62 72 65 76 (possibly abbrev
42e00 69 61 74 65 64 29 20 6f 70 74 69 6f 6e 20 6f 72 iated) option or
42e10 20 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 20 61 6e command name an
42e20 64 20 65 69 74 68 65 72 0a 23 20 20 20 20 72 65 d either.# re
42e30 74 75 72 6e 73 20 74 68 65 20 63 61 6e 6f 6e 69 turns the canoni
42e40 63 61 6c 20 6e 61 6d 65 20 6f 72 20 61 6e 20 65 cal name or an e
42e50 72 72 6f 72 0a 23 0a 23 20 41 72 67 75 6d 65 6e rror.#.# Argumen
42e60 74 73 3a 0a 23 0a 23 20 20 20 20 77 20 20 20 20 ts:.#.# w
42e70 20 20 20 20 77 69 64 67 65 74 20 70 61 74 68 6e widget pathn
42e80 61 6d 65 0a 23 20 20 20 20 6f 62 6a 65 63 74 20 ame.# object
42e90 20 20 74 79 70 65 20 6f 66 20 6f 62 6a 65 63 74 type of object
42ea0 20 74 6f 20 63 61 6e 6f 6e 69 7a 65 3b 20 6d 75 to canonize; mu
42eb0 73 74 20 62 65 20 6f 6e 65 20 6f 66 20 22 63 6f st be one of "co
42ec0 6d 6d 61 6e 64 22 2c 0a 23 20 20 20 20 20 20 20 mmand",.#
42ed0 20 20 20 20 20 20 22 6f 70 74 69 6f 6e 22 2c 20 "option",
42ee0 22 73 63 61 6e 20 63 6f 6d 6d 61 6e 64 22 20 6f "scan command" o
42ef0 72 20 22 6c 69 73 74 20 63 6f 6d 6d 61 6e 64 22 r "list command"
42f00 0a 23 20 20 20 20 6f 70 74 20 20 20 20 20 20 74 .# opt t
42f10 68 65 20 6f 70 74 69 6f 6e 20 28 6f 72 20 63 6f he option (or co
42f20 6d 6d 61 6e 64 29 20 74 6f 20 62 65 20 63 61 6e mmand) to be can
42f30 6f 6e 69 7a 65 64 0a 23 0a 23 20 52 65 74 75 72 onized.#.# Retur
42f40 6e 73 3a 0a 23 0a 23 20 20 20 20 52 65 74 75 72 ns:.#.# Retur
42f50 6e 73 20 65 69 74 68 65 72 20 74 68 65 20 63 61 ns either the ca
42f60 6e 6f 6e 69 63 61 6c 20 66 6f 72 6d 20 6f 66 20 nonical form of
42f70 61 6e 20 6f 70 74 69 6f 6e 20 6f 72 20 63 6f 6d an option or com
42f80 6d 61 6e 64 2c 0a 23 20 20 20 20 6f 72 20 72 61 mand,.# or ra
42f90 69 73 65 73 20 61 6e 20 65 72 72 6f 72 20 69 66 ises an error if
42fa0 20 74 68 65 20 6f 70 74 69 6f 6e 20 6f 72 20 63 the option or c
42fb0 6f 6d 6d 61 6e 64 20 69 73 20 75 6e 6b 6e 6f 77 ommand is unknow
42fc0 6e 20 6f 72 0a 23 20 20 20 20 61 6d 62 69 67 75 n or.# ambigu
42fd0 6f 75 73 2e 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d ous...proc ::com
42fe0 62 6f 62 6f 78 3a 3a 43 61 6e 6f 6e 69 7a 65 20 bobox::Canonize
42ff0 7b 77 20 6f 62 6a 65 63 74 20 6f 70 74 7d 20 7b {w object opt} {
43000 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 77 69 . variable wi
43010 64 67 65 74 4f 70 74 69 6f 6e 73 0a 20 20 20 20 dgetOptions.
43020 76 61 72 69 61 62 6c 65 20 63 6f 6c 75 6d 6e 4f variable columnO
43030 70 74 69 6f 6e 73 0a 20 20 20 20 76 61 72 69 61 ptions. varia
43040 62 6c 65 20 77 69 64 67 65 74 43 6f 6d 6d 61 6e ble widgetComman
43050 64 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 ds. variable
43060 6c 69 73 74 43 6f 6d 6d 61 6e 64 73 0a 20 20 20 listCommands.
43070 20 76 61 72 69 61 62 6c 65 20 73 63 61 6e 43 6f variable scanCo
43080 6d 6d 61 6e 64 73 0a 0a 20 20 20 20 73 77 69 74 mmands.. swit
43090 63 68 20 2d 2d 20 24 6f 62 6a 65 63 74 20 7b 0a ch -- $object {.
430a0 20 20 20 20 63 6f 6d 6d 61 6e 64 20 7b 0a 09 20 command {..
430b0 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 68 20 if {[lsearch
430c0 2d 65 78 61 63 74 20 24 77 69 64 67 65 74 43 6f -exact $widgetCo
430d0 6d 6d 61 6e 64 73 20 24 6f 70 74 5d 20 3e 3d 20 mmands $opt] >=
430e0 30 7d 20 7b 0a 09 09 72 65 74 75 72 6e 20 24 6f 0} {...return $o
430f0 70 74 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 pt.. }...
43100 23 20 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 73 20 # command names
43110 61 72 65 6e 27 74 20 73 74 6f 72 65 64 20 69 6e aren't stored in
43120 20 61 6e 20 61 72 72 61 79 2c 20 61 6e 64 20 74 an array, and t
43130 68 65 72 65 0a 09 20 20 20 20 23 20 69 73 6e 27 here.. # isn'
43140 74 20 61 20 77 61 79 20 74 6f 20 67 65 74 20 61 t a way to get a
43150 6c 6c 20 74 68 65 20 6d 61 74 63 68 65 73 20 69 ll the matches i
43160 6e 20 61 20 6c 69 73 74 2c 20 73 6f 0a 09 20 20 n a list, so..
43170 20 20 23 20 77 65 27 6c 6c 20 73 74 75 66 66 20 # we'll stuff
43180 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 20 the commands in
43190 61 20 74 65 6d 70 6f 72 61 72 79 20 61 72 72 61 a temporary arra
431a0 79 20 73 6f 0a 09 20 20 20 20 23 20 77 65 20 63 y so.. # we c
431b0 61 6e 20 75 73 65 20 5b 61 72 72 61 79 20 6e 61 an use [array na
431c0 6d 65 73 5d 0a 09 20 20 20 20 73 65 74 20 6c 69 mes].. set li
431d0 73 74 20 24 77 69 64 67 65 74 43 6f 6d 6d 61 6e st $widgetComman
431e0 64 73 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 ds.. foreach
431f0 65 6c 65 6d 65 6e 74 20 24 6c 69 73 74 20 7b 0a element $list {.
43200 09 09 73 65 74 20 74 6d 70 28 24 65 6c 65 6d 65 ..set tmp($eleme
43210 6e 74 29 20 22 22 0a 09 20 20 20 20 7d 0a 09 20 nt) "".. }..
43220 20 20 20 73 65 74 20 6d 61 74 63 68 65 73 20 5b set matches [
43230 61 72 72 61 79 20 6e 61 6d 65 73 20 74 6d 70 20 array names tmp
43240 24 7b 6f 70 74 7d 2a 5d 0a 09 7d 0a 20 20 20 20 ${opt}*]..}.
43250 7b 6c 69 73 74 20 63 6f 6d 6d 61 6e 64 7d 20 7b {list command} {
43260 0a 09 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 .. if {[lsear
43270 63 68 20 2d 65 78 61 63 74 20 24 6c 69 73 74 43 ch -exact $listC
43280 6f 6d 6d 61 6e 64 73 20 24 6f 70 74 5d 20 3e 3d ommands $opt] >=
43290 20 30 7d 20 7b 0a 09 09 72 65 74 75 72 6e 20 24 0} {...return $
432a0 6f 70 74 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 opt.. }...
432b0 20 23 20 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 73 # command names
432c0 20 61 72 65 6e 27 74 20 73 74 6f 72 65 64 20 69 aren't stored i
432d0 6e 20 61 6e 20 61 72 72 61 79 2c 20 61 6e 64 20 n an array, and
432e0 74 68 65 72 65 0a 09 20 20 20 20 23 20 69 73 6e there.. # isn
432f0 27 74 20 61 20 77 61 79 20 74 6f 20 67 65 74 20 't a way to get
43300 61 6c 6c 20 74 68 65 20 6d 61 74 63 68 65 73 20 all the matches
43310 69 6e 20 61 20 6c 69 73 74 2c 20 73 6f 0a 09 20 in a list, so..
43320 20 20 20 23 20 77 65 27 6c 6c 20 73 74 75 66 66 # we'll stuff
43330 20 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 69 6e the commands in
43340 20 61 20 74 65 6d 70 6f 72 61 72 79 20 61 72 72 a temporary arr
43350 61 79 20 73 6f 0a 09 20 20 20 20 23 20 77 65 20 ay so.. # we
43360 63 61 6e 20 75 73 65 20 5b 61 72 72 61 79 20 6e can use [array n
43370 61 6d 65 73 5d 0a 09 20 20 20 20 73 65 74 20 6c ames].. set l
43380 69 73 74 20 24 6c 69 73 74 43 6f 6d 6d 61 6e 64 ist $listCommand
43390 73 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 65 s.. foreach e
433a0 6c 65 6d 65 6e 74 20 24 6c 69 73 74 20 7b 0a 09 lement $list {..
433b0 09 73 65 74 20 74 6d 70 28 24 65 6c 65 6d 65 6e .set tmp($elemen
433c0 74 29 20 22 22 0a 09 20 20 20 20 7d 0a 09 20 20 t) "".. }..
433d0 20 20 73 65 74 20 6d 61 74 63 68 65 73 20 5b 61 set matches [a
433e0 72 72 61 79 20 6e 61 6d 65 73 20 74 6d 70 20 24 rray names tmp $
433f0 7b 6f 70 74 7d 2a 5d 0a 09 7d 0a 20 20 20 20 7b {opt}*]..}. {
43400 73 63 61 6e 20 63 6f 6d 6d 61 6e 64 7d 20 7b 0a scan command} {.
43410 09 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 . if {[lsearc
43420 68 20 2d 65 78 61 63 74 20 24 73 63 61 6e 43 6f h -exact $scanCo
43430 6d 6d 61 6e 64 73 20 24 6f 70 74 5d 20 3e 3d 20 mmands $opt] >=
43440 30 7d 20 7b 0a 09 09 72 65 74 75 72 6e 20 24 6f 0} {...return $o
43450 70 74 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 pt.. }...
43460 23 20 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 73 20 # command names
43470 61 72 65 6e 27 74 20 73 74 6f 72 65 64 20 69 6e aren't stored in
43480 20 61 6e 20 61 72 72 61 79 2c 20 61 6e 64 20 74 an array, and t
43490 68 65 72 65 0a 09 20 20 20 20 23 20 69 73 6e 27 here.. # isn'
434a0 74 20 61 20 77 61 79 20 74 6f 20 67 65 74 20 61 t a way to get a
434b0 6c 6c 20 74 68 65 20 6d 61 74 63 68 65 73 20 69 ll the matches i
434c0 6e 20 61 20 6c 69 73 74 2c 20 73 6f 0a 09 20 20 n a list, so..
434d0 20 20 23 20 77 65 27 6c 6c 20 73 74 75 66 66 20 # we'll stuff
434e0 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 20 the commands in
434f0 61 20 74 65 6d 70 6f 72 61 72 79 20 61 72 72 61 a temporary arra
43500 79 20 73 6f 0a 09 20 20 20 20 23 20 77 65 20 63 y so.. # we c
43510 61 6e 20 75 73 65 20 5b 61 72 72 61 79 20 6e 61 an use [array na
43520 6d 65 73 5d 0a 09 20 20 20 20 73 65 74 20 6c 69 mes].. set li
43530 73 74 20 24 73 63 61 6e 43 6f 6d 6d 61 6e 64 73 st $scanCommands
43540 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 65 6c .. foreach el
43550 65 6d 65 6e 74 20 24 6c 69 73 74 20 7b 0a 09 09 ement $list {...
43560 73 65 74 20 74 6d 70 28 24 65 6c 65 6d 65 6e 74 set tmp($element
43570 29 20 22 22 0a 09 20 20 20 20 7d 0a 09 20 20 20 ) "".. }..
43580 20 73 65 74 20 6d 61 74 63 68 65 73 20 5b 61 72 set matches [ar
43590 72 61 79 20 6e 61 6d 65 73 20 74 6d 70 20 24 7b ray names tmp ${
435a0 6f 70 74 7d 2a 5d 0a 09 7d 0a 20 20 20 20 6f 70 opt}*]..}. op
435b0 74 69 6f 6e 20 7b 0a 09 20 20 20 20 69 66 20 7b tion {.. if {
435c0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 77 69 64 [info exists wid
435d0 67 65 74 4f 70 74 69 6f 6e 73 28 24 6f 70 74 29 getOptions($opt)
435e0 5d 20 26 26 20 5c 0a 09 20 20 20 20 20 20 5b 6c ] && \.. [l
435f0 6c 65 6e 67 74 68 20 24 77 69 64 67 65 74 4f 70 length $widgetOp
43600 74 69 6f 6e 73 28 24 6f 70 74 29 5d 20 3d 3d 20 tions($opt)] ==
43610 32 7d 20 7b 0a 09 09 72 65 74 75 72 6e 20 24 6f 2} {...return $o
43620 70 74 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 73 pt.. }.. s
43630 65 74 20 6c 69 73 74 20 5b 61 72 72 61 79 20 6e et list [array n
43640 61 6d 65 73 20 77 69 64 67 65 74 4f 70 74 69 6f ames widgetOptio
43650 6e 73 5d 0a 09 20 20 20 20 73 65 74 20 6d 61 74 ns].. set mat
43660 63 68 65 73 20 5b 61 72 72 61 79 20 6e 61 6d 65 ches [array name
43670 73 20 77 69 64 67 65 74 4f 70 74 69 6f 6e 73 20 s widgetOptions
43680 24 7b 6f 70 74 7d 2a 5d 0a 09 7d 0a 20 20 20 20 ${opt}*]..}.
43690 7d 0a 0a 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e }.. if {[llen
436a0 67 74 68 20 24 6d 61 74 63 68 65 73 5d 20 3d 3d gth $matches] ==
436b0 20 30 7d 20 7b 0a 09 73 65 74 20 63 68 6f 69 63 0} {..set choic
436c0 65 73 20 5b 48 75 6d 61 6e 69 7a 65 4c 69 73 74 es [HumanizeList
436d0 20 24 6c 69 73 74 5d 0a 09 65 72 72 6f 72 20 22 $list]..error "
436e0 75 6e 6b 6e 6f 77 6e 20 24 6f 62 6a 65 63 74 20 unknown $object
436f0 5c 22 24 6f 70 74 5c 22 3b 20 6d 75 73 74 20 62 \"$opt\"; must b
43700 65 20 6f 6e 65 20 6f 66 20 24 63 68 6f 69 63 65 e one of $choice
43710 73 22 0a 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 s".. } elseif
43720 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6d 61 74 63 {[llength $matc
43730 68 65 73 5d 20 3d 3d 20 31 7d 20 7b 0a 09 73 65 hes] == 1} {..se
43740 74 20 6f 70 74 20 5b 6c 69 6e 64 65 78 20 24 6d t opt [lindex $m
43750 61 74 63 68 65 73 20 30 5d 0a 0a 09 23 20 64 65 atches 0]...# de
43760 61 6c 20 77 69 74 68 20 6f 70 74 69 6f 6e 20 61 al with option a
43770 6c 69 61 73 65 73 0a 09 73 77 69 74 63 68 20 2d liases..switch -
43780 2d 20 24 6f 62 6a 65 63 74 20 7b 0a 09 6f 70 74 - $object {..opt
43790 69 6f 6e 20 7b 0a 09 09 73 65 74 20 6f 70 74 20 ion {...set opt
437a0 5b 6c 69 6e 64 65 78 20 24 6d 61 74 63 68 65 73 [lindex $matches
437b0 20 30 5d 0a 09 09 69 66 20 7b 5b 6c 6c 65 6e 67 0]...if {[lleng
437c0 74 68 20 24 77 69 64 67 65 74 4f 70 74 69 6f 6e th $widgetOption
437d0 73 28 24 6f 70 74 29 5d 20 3d 3d 20 31 7d 20 7b s($opt)] == 1} {
437e0 0a 09 09 20 20 20 20 73 65 74 20 6f 70 74 20 24 ... set opt $
437f0 77 69 64 67 65 74 4f 70 74 69 6f 6e 73 28 24 6f widgetOptions($o
43800 70 74 29 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 pt)...}.. }..
43810 7d 0a 0a 09 72 65 74 75 72 6e 20 24 6f 70 74 0a }...return $opt.
43820 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 . } else {..s
43830 65 74 20 63 68 6f 69 63 65 73 20 5b 48 75 6d 61 et choices [Huma
43840 6e 69 7a 65 4c 69 73 74 20 24 6c 69 73 74 5d 0a nizeList $list].
43850 09 65 72 72 6f 72 20 22 61 6d 62 69 67 75 6f 75 .error "ambiguou
43860 73 20 24 6f 62 6a 65 63 74 20 5c 22 24 6f 70 74 s $object \"$opt
43870 5c 22 3b 20 6d 75 73 74 20 62 65 20 6f 6e 65 20 \"; must be one
43880 6f 66 20 24 63 68 6f 69 63 65 73 22 0a 20 20 20 of $choices".
43890 20 7d 0a 7d 0a 0a 23 20 3a 3a 63 6f 6d 62 6f 62 }.}..# ::combob
438a0 6f 78 3a 3a 48 75 6d 61 6e 69 7a 65 4c 69 73 74 ox::HumanizeList
438b0 20 2d 2d 0a 23 0a 23 20 20 20 20 52 65 74 75 72 --.#.# Retur
438c0 6e 73 20 61 20 68 75 6d 61 6e 2d 72 65 61 64 61 ns a human-reada
438d0 62 6c 65 20 66 6f 72 6d 20 6f 66 20 61 20 6c 69 ble form of a li
438e0 73 74 20 62 79 20 73 65 70 61 72 61 74 69 6e 67 st by separating
438f0 20 69 74 65 6d 73 0a 23 20 20 20 20 62 79 20 63 items.# by c
43900 6f 6c 75 6d 6e 73 2c 20 62 75 74 20 73 65 70 61 olumns, but sepa
43910 72 61 74 69 6e 67 20 74 68 65 20 6c 61 73 74 20 rating the last
43920 74 77 6f 20 65 6c 65 6d 65 6e 74 73 20 77 69 74 two elements wit
43930 68 20 22 6f 72 22 0a 23 20 20 20 20 28 65 67 3a h "or".# (eg:
43940 20 66 6f 6f 2c 20 62 61 72 20 6f 72 20 62 61 7a foo, bar or baz
43950 29 0a 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a ).#.# Arguments:
43960 0a 23 0a 23 20 20 20 20 6c 69 73 74 20 20 20 20 .#.# list
43970 61 20 76 61 6c 69 64 20 74 63 6c 20 6c 69 73 74 a valid tcl list
43980 0a 23 0a 23 20 52 65 73 75 6c 74 73 3a 0a 23 0a .#.# Results:.#.
43990 23 20 20 20 20 41 20 73 74 72 69 6e 67 20 77 68 # A string wh
439a0 69 63 68 20 61 73 20 61 6c 6c 20 6f 66 20 74 68 ich as all of th
439b0 65 20 65 6c 65 6d 65 6e 74 73 20 6a 6f 69 6e 65 e elements joine
439c0 64 20 77 69 74 68 20 22 2c 20 22 20 6f 72 0a 23 d with ", " or.#
439d0 20 20 20 20 74 68 65 20 77 6f 72 64 20 22 20 6f the word " o
439e0 72 20 22 0a 0a 70 72 6f 63 20 3a 3a 63 6f 6d 62 r "..proc ::comb
439f0 6f 62 6f 78 3a 3a 48 75 6d 61 6e 69 7a 65 4c 69 obox::HumanizeLi
43a00 73 74 20 7b 6c 69 73 74 7d 20 7b 0a 0a 20 20 20 st {list} {..
43a10 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c if {[llength $l
43a20 69 73 74 5d 20 3d 3d 20 31 7d 20 7b 0a 09 72 65 ist] == 1} {..re
43a30 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 24 6c 69 turn [lindex $li
43a40 73 74 20 30 5d 0a 20 20 20 20 7d 20 65 6c 73 65 st 0]. } else
43a50 20 7b 0a 09 73 65 74 20 6c 69 73 74 20 5b 6c 73 {..set list [ls
43a60 6f 72 74 20 24 6c 69 73 74 5d 0a 09 73 65 74 20 ort $list]..set
43a70 73 65 63 6f 6e 64 54 6f 4c 61 73 74 20 5b 65 78 secondToLast [ex
43a80 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c 69 pr {[llength $li
43a90 73 74 5d 20 2d 32 7d 5d 0a 09 73 65 74 20 6d 6f st] -2}]..set mo
43aa0 73 74 20 5b 6c 72 61 6e 67 65 20 24 6c 69 73 74 st [lrange $list
43ab0 20 30 20 24 73 65 63 6f 6e 64 54 6f 4c 61 73 74 0 $secondToLast
43ac0 5d 0a 09 73 65 74 20 6c 61 73 74 20 5b 6c 69 6e ]..set last [lin
43ad0 64 65 78 20 24 6c 69 73 74 20 65 6e 64 5d 0a 0a dex $list end]..
43ae0 09 72 65 74 75 72 6e 20 22 5b 6a 6f 69 6e 20 24 .return "[join $
43af0 6d 6f 73 74 20 7b 2c 20 7d 5d 20 6f 72 20 24 6c most {, }] or $l
43b00 61 73 74 22 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 ast". }.}..#
43b10 54 68 69 73 20 69 73 20 73 6f 6d 65 20 62 61 63 This is some bac
43b20 6b 77 61 72 64 73 2d 63 6f 6d 70 61 74 69 62 69 kwards-compatibi
43b30 6c 69 74 79 20 63 6f 64 65 20 74 6f 20 68 61 6e lity code to han
43b40 64 6c 65 20 54 49 50 20 34 34 0a 23 20 28 68 74 dle TIP 44.# (ht
43b50 74 70 3a 2f 2f 70 75 72 6c 2e 6f 72 67 2f 74 63 tp://purl.org/tc
43b60 6c 2f 74 69 70 2f 34 34 2e 68 74 6d 6c 29 2e 20 l/tip/44.html).
43b70 46 6f 72 20 61 6c 6c 20 70 72 69 76 61 74 65 20 For all private
43b80 74 6b 20 63 6f 6d 6d 61 6e 64 73 0a 23 20 75 73 tk commands.# us
43b90 65 64 20 62 79 20 74 68 69 73 20 77 69 64 67 65 ed by this widge
43ba0 74 2c 20 77 65 27 6c 6c 20 6d 61 6b 65 20 64 75 t, we'll make du
43bb0 70 6c 69 63 61 74 65 73 20 6f 66 20 74 68 65 20 plicates of the
43bc0 70 72 6f 63 73 20 69 6e 20 74 68 65 0a 23 20 63 procs in the.# c
43bd0 6f 6d 62 6f 62 6f 78 20 6e 61 6d 65 73 70 61 63 ombobox namespac
43be0 65 2e 0a 23 0a 23 20 49 27 6d 20 6e 6f 74 20 65 e..#.# I'm not e
43bf0 6e 74 69 72 65 6c 79 20 63 6f 6e 76 69 6e 63 65 ntirely convince
43c00 64 20 74 68 69 73 20 69 73 20 74 68 65 20 72 69 d this is the ri
43c10 67 68 74 20 74 68 69 6e 67 20 74 6f 20 64 6f 2e ght thing to do.
43c20 20 49 20 70 72 6f 62 61 62 6c 79 0a 23 20 73 68 I probably.# sh
43c30 6f 75 6c 64 6e 27 74 20 65 76 65 6e 20 62 65 20 ouldn't even be
43c40 75 73 69 6e 67 20 74 68 65 20 70 72 69 76 61 74 using the privat
43c50 65 20 63 6f 6d 6d 61 6e 64 73 2e 20 54 68 65 6e e commands. Then
43c60 20 61 67 61 69 6e 2c 20 6d 61 79 62 65 20 74 68 again, maybe th
43c70 65 0a 23 20 70 72 69 76 61 74 65 20 63 6f 6d 6d e.# private comm
43c80 61 6e 64 73 20 72 65 61 6c 6c 79 20 73 68 6f 75 ands really shou
43c90 6c 64 20 62 65 20 70 75 62 6c 69 63 2e 20 4f 68 ld be public. Oh
43ca0 20 77 65 6c 6c 3b 20 69 74 20 77 6f 72 6b 73 20 well; it works
43cb0 73 6f 20 69 74 0a 23 20 6d 75 73 74 20 62 65 20 so it.# must be
43cc0 4f 4b 2e 2e 2e 0a 66 6f 72 65 61 63 68 20 63 6f OK....foreach co
43cd0 6d 6d 61 6e 64 20 7b 54 61 62 54 6f 57 69 6e 64 mmand {TabToWind
43ce0 6f 77 20 43 61 6e 63 65 6c 52 65 70 65 61 74 20 ow CancelRepeat
43cf0 4c 69 73 74 62 6f 78 55 70 44 6f 77 6e 7d 20 7b ListboxUpDown} {
43d00 0a 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 . if {[llengt
43d10 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 h [info commands
43d20 20 3a 3a 63 6f 6d 62 6f 62 6f 78 3a 3a 74 6b 24 ::combobox::tk$
43d30 63 6f 6d 6d 61 6e 64 5d 5d 20 3d 3d 20 31 7d 20 command]] == 1}
43d40 62 72 65 61 6b 0a 0a 0a 20 20 20 20 73 65 74 20 break... set
43d50 74 6d 70 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e tmp [info comman
43d60 64 73 20 74 6b 24 63 6f 6d 6d 61 6e 64 5d 0a 20 ds tk$command].
43d70 20 20 20 73 65 74 20 70 72 6f 63 20 3a 3a 63 6f set proc ::co
43d80 6d 62 6f 62 6f 78 3a 3a 74 6b 24 63 6f 6d 6d 61 mbobox::tk$comma
43d90 6e 64 0a 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e nd. if {[llen
43da0 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e gth [info comman
43db0 64 73 20 74 6b 24 63 6f 6d 6d 61 6e 64 5d 5d 20 ds tk$command]]
43dc0 3d 3d 20 31 7d 20 7b 0a 09 73 65 74 20 63 6f 6d == 1} {..set com
43dd0 6d 61 6e 64 20 5b 6e 61 6d 65 73 70 61 63 65 20 mand [namespace
43de0 77 68 69 63 68 20 5b 6c 69 6e 64 65 78 20 24 74 which [lindex $t
43df0 6d 70 20 30 5d 5d 0a 09 70 72 6f 63 20 24 70 72 mp 0]]..proc $pr
43e00 6f 63 20 7b 61 72 67 73 7d 20 22 75 70 6c 65 76 oc {args} "uplev
43e10 65 6c 20 24 63 6f 6d 6d 61 6e 64 20 5c 24 61 72 el $command \$ar
43e20 67 73 22 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b gs". } else {
43e30 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b ..if {[llength [
43e40 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 3a 3a info commands ::
43e50 74 6b 3a 3a 24 63 6f 6d 6d 61 6e 64 5d 5d 20 3d tk::$command]] =
43e60 3d 20 31 7d 20 7b 0a 09 20 20 20 20 70 72 6f 63 = 1} {.. proc
43e70 20 24 70 72 6f 63 20 7b 61 72 67 73 7d 20 22 75 $proc {args} "u
43e80 70 6c 65 76 65 6c 20 3a 3a 74 6b 3a 3a 24 63 6f plevel ::tk::$co
43e90 6d 6d 61 6e 64 20 5c 24 61 72 67 73 22 0a 09 7d mmand \$args"..}
43ea0 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 65 6e 64 20 . }.}..# end
43eb0 6f 66 20 63 6f 6d 62 6f 62 6f 78 2e 74 63 6c 0a of combobox.tcl.
43ec0 0a 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ..##############
43ed0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43ee0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43ef0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43f00 23 23 23 23 23 23 23 23 0a 23 20 69 63 6f 6e 20 ########.# icon
43f10 69 6d 61 67 65 20 64 61 74 61 2e 0a 23 23 23 23 image data..####
43f20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43f30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43f40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43f50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
43f60 23 23 0a 69 6d 61 67 65 20 63 72 65 61 74 65 20 ##.image create
43f70 62 69 74 6d 61 70 20 64 65 6c 74 61 34 38 20 2d bitmap delta48 -
43f80 64 61 74 61 20 7b 0a 20 20 23 64 65 66 69 6e 65 data {. #define
43f90 20 64 65 6c 74 61 34 38 5f 77 69 64 74 68 20 34 delta48_width 4
43fa0 38 0a 20 20 23 64 65 66 69 6e 65 20 64 65 6c 74 8. #define delt
43fb0 61 34 38 5f 68 65 69 67 68 74 20 34 38 0a 20 20 a48_height 48.
43fc0 73 74 61 74 69 63 20 63 68 61 72 20 64 65 6c 74 static char delt
43fd0 61 34 38 5f 62 69 74 73 5b 5d 20 3d 20 7b 0a 20 a48_bits[] = {.
43fe0 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
43ff0 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 0, 0x00, 0x00, 0
44000 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x00, 0x00, 0x00,
44010 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44020 30 2c 20 30 78 30 30 2c 0a 20 20 30 78 30 30 2c 0, 0x00,. 0x00,
44030 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44040 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 0, 0x00, 0x00, 0
44050 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x00, 0x00, 0x00,
44060 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44070 30 2c 0a 20 20 30 78 30 30 2c 20 30 78 30 30 2c 0,. 0x00, 0x00,
44080 20 30 78 30 30 2c 20 30 78 30 66 2c 20 30 78 30 0x00, 0x0f, 0x0
44090 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 0, 0x00, 0x00, 0
440a0 78 30 30 2c 20 30 78 38 30 2c 20 30 78 31 33 2c x00, 0x80, 0x13,
440b0 20 30 78 30 30 2c 20 30 78 30 30 2c 0a 20 20 30 0x00, 0x00,. 0
440c0 78 30 30 2c 20 30 78 30 30 2c 20 30 78 63 30 2c x00, 0x00, 0xc0,
440d0 20 30 78 31 30 2c 20 30 78 30 30 2c 20 30 78 30 0x10, 0x00, 0x0
440e0 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 0, 0x00, 0x00, 0
440f0 78 34 30 2c 20 30 78 30 38 2c 20 30 78 30 30 2c x40, 0x08, 0x00,
44100 20 30 78 30 30 2c 0a 20 20 30 78 30 30 2c 20 30 0x00,. 0x00, 0
44110 78 30 30 2c 20 30 78 32 30 2c 20 30 78 30 38 2c x00, 0x20, 0x08,
44120 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44130 30 2c 20 30 78 30 30 2c 20 30 78 33 30 2c 20 30 0, 0x00, 0x30, 0
44140 78 30 63 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x0c, 0x00, 0x00,
44150 0a 20 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 . 0x00, 0x00, 0
44160 78 31 30 2c 20 30 78 30 34 2c 20 30 78 30 30 2c x10, 0x04, 0x00,
44170 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44180 30 2c 20 30 78 30 63 2c 20 30 78 30 65 2c 20 30 0, 0x0c, 0x0e, 0
44190 78 30 30 2c 20 30 78 30 30 2c 0a 20 20 30 78 30 x00, 0x00,. 0x0
441a0 30 2c 20 30 78 30 30 2c 20 30 78 30 34 2c 20 30 0, 0x00, 0x04, 0
441b0 78 31 62 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x1b, 0x00, 0x00,
441c0 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
441d0 36 2c 20 30 78 31 62 2c 20 30 78 30 30 2c 20 30 6, 0x1b, 0x00, 0
441e0 78 30 30 2c 0a 20 20 30 78 30 30 2c 20 30 78 30 x00,. 0x00, 0x0
441f0 30 2c 20 30 78 30 32 2c 20 30 78 33 33 2c 20 30 0, 0x02, 0x33, 0
44200 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x00, 0x00, 0x00,
44210 20 30 78 30 30 2c 20 30 78 30 33 2c 20 30 78 32 0x00, 0x03, 0x2
44220 65 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 0a 20 e, 0x00, 0x00,.
44230 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 31 0x00, 0x00, 0x1
44240 31 2c 20 30 78 36 63 2c 20 30 78 30 30 2c 20 30 1, 0x6c, 0x00, 0
44250 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x00, 0x00, 0x00,
44260 20 30 78 31 31 2c 20 30 78 36 38 2c 20 30 78 30 0x11, 0x68, 0x0
44270 30 2c 20 30 78 30 30 2c 0a 20 20 30 78 30 30 2c 0, 0x00,. 0x00,
44280 20 30 78 38 30 2c 20 30 78 31 30 2c 20 30 78 63 0x80, 0x10, 0xc
44290 38 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 8, 0x00, 0x00, 0
442a0 78 30 30 2c 20 30 78 38 30 2c 20 30 78 31 30 2c x00, 0x80, 0x10,
442b0 20 30 78 61 38 2c 20 30 78 30 31 2c 20 30 78 30 0xa8, 0x01, 0x0
442c0 30 2c 0a 20 20 30 78 30 30 2c 20 30 78 38 30 2c 0,. 0x00, 0x80,
442d0 20 30 78 30 38 2c 20 30 78 30 38 2c 20 30 78 30 0x08, 0x08, 0x0
442e0 31 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 1, 0x00, 0x00, 0
442f0 78 38 30 2c 20 30 78 30 38 2c 20 30 78 61 63 2c x80, 0x08, 0xac,
44300 20 30 78 30 33 2c 20 30 78 30 30 2c 0a 20 20 30 0x03, 0x00,. 0
44310 78 30 30 2c 20 30 78 38 30 2c 20 30 78 30 39 2c x00, 0x80, 0x09,
44320 20 30 78 30 36 2c 20 30 78 30 32 2c 20 30 78 30 0x06, 0x02, 0x0
44330 30 2c 20 30 78 30 30 2c 20 30 78 63 30 2c 20 30 0, 0x00, 0xc0, 0
44340 78 30 39 2c 20 30 78 61 61 2c 20 30 78 30 36 2c x09, 0xaa, 0x06,
44350 20 30 78 30 30 2c 0a 20 20 30 78 30 30 2c 20 30 0x00,. 0x00, 0
44360 78 34 30 2c 20 30 78 30 39 2c 20 30 78 30 31 2c x40, 0x09, 0x01,
44370 20 30 78 30 34 2c 20 30 78 30 30 2c 20 30 78 30 0x04, 0x00, 0x0
44380 30 2c 20 30 78 65 30 2c 20 30 78 39 33 2c 20 30 0, 0xe0, 0x93, 0
44390 78 61 65 2c 20 30 78 30 61 2c 20 30 78 30 30 2c xae, 0x0a, 0x00,
443a0 0a 20 20 30 78 30 30 2c 20 30 78 33 30 2c 20 30 . 0x00, 0x30, 0
443b0 78 39 32 2c 20 30 78 30 36 2c 20 30 78 31 38 2c x92, 0x06, 0x18,
443c0 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 62 0x00, 0x00, 0xb
443d0 30 2c 20 30 78 39 32 2c 20 30 78 61 64 2c 20 30 0, 0x92, 0xad, 0
443e0 78 31 61 2c 20 30 78 30 30 2c 0a 20 20 30 78 30 x1a, 0x00,. 0x0
443f0 30 2c 20 30 78 31 38 2c 20 30 78 35 33 2c 20 30 0, 0x18, 0x53, 0
44400 78 30 34 2c 20 30 78 33 30 2c 20 30 78 30 30 2c x04, 0x30, 0x00,
44410 20 30 78 30 30 2c 20 30 78 61 38 2c 20 30 78 31 0x00, 0xa8, 0x1
44420 31 2c 20 30 78 61 63 2c 20 30 78 32 61 2c 20 30 1, 0xac, 0x2a, 0
44430 78 30 30 2c 0a 20 20 30 78 30 30 2c 20 30 78 30 x00,. 0x00, 0x0
44440 63 2c 20 30 78 31 32 2c 20 30 78 30 34 2c 20 30 c, 0x12, 0x04, 0
44450 78 36 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x60, 0x00, 0x00,
44460 20 30 78 61 63 2c 20 30 78 31 32 2c 20 30 78 61 0xac, 0x12, 0xa
44470 63 2c 20 30 78 36 61 2c 20 30 78 30 30 2c 0a 20 c, 0x6a, 0x00,.
44480 20 30 78 30 30 2c 20 30 78 30 32 2c 20 30 78 31 0x00, 0x02, 0x1
44490 34 2c 20 30 78 30 34 2c 20 30 78 38 30 2c 20 30 4, 0x04, 0x80, 0
444a0 78 30 30 2c 20 30 78 30 30 2c 20 30 78 61 62 2c x00, 0x00, 0xab,
444b0 20 30 78 30 61 2c 20 30 78 61 65 2c 20 30 78 61 0x0a, 0xae, 0xa
444c0 61 2c 20 30 78 30 31 2c 0a 20 20 30 78 30 30 2c a, 0x01,. 0x00,
444d0 20 30 78 30 31 2c 20 30 78 32 38 2c 20 30 78 30 0x01, 0x28, 0x0
444e0 32 2c 20 30 78 30 30 2c 20 30 78 30 31 2c 20 30 2, 0x00, 0x01, 0
444f0 78 38 30 2c 20 30 78 61 62 2c 20 30 78 33 61 2c x80, 0xab, 0x3a,
44500 20 30 78 61 66 2c 20 30 78 61 61 2c 20 30 78 30 0xaf, 0xaa, 0x0
44510 33 2c 0a 20 20 30 78 38 30 2c 20 30 78 30 30 2c 3,. 0x80, 0x00,
44520 20 30 78 37 30 2c 20 30 78 30 63 2c 20 30 78 30 0x70, 0x0c, 0x0
44530 30 2c 20 30 78 30 32 2c 20 30 78 63 30 2c 20 30 0, 0x02, 0xc0, 0
44540 78 61 61 2c 20 30 78 35 61 2c 20 30 78 61 38 2c xaa, 0x5a, 0xa8,
44550 20 30 78 61 61 2c 20 30 78 30 36 2c 0a 20 20 30 0xaa, 0x06,. 0
44560 78 34 30 2c 20 30 78 30 30 2c 20 30 78 61 30 2c x40, 0x00, 0xa0,
44570 20 30 78 30 38 2c 20 30 78 30 30 2c 20 30 78 30 0x08, 0x00, 0x0
44580 63 2c 20 30 78 61 30 2c 20 30 78 61 61 2c 20 30 c, 0xa0, 0xaa, 0
44590 78 65 61 2c 20 30 78 61 63 2c 20 30 78 61 61 2c xea, 0xac, 0xaa,
445a0 20 30 78 30 61 2c 0a 20 20 30 78 33 30 2c 20 30 0x0a,. 0x30, 0
445b0 78 30 30 2c 20 30 78 38 30 2c 20 30 78 30 35 2c x00, 0x80, 0x05,
445c0 20 30 78 30 30 2c 20 30 78 31 38 2c 20 30 78 62 0x00, 0x18, 0xb
445d0 30 2c 20 30 78 61 61 2c 20 30 78 61 61 2c 20 30 0, 0xaa, 0xaa, 0
445e0 78 61 62 2c 20 30 78 61 61 2c 20 30 78 31 61 2c xab, 0xaa, 0x1a,
445f0 0a 20 20 30 78 30 38 2c 20 30 78 30 30 2c 20 30 . 0x08, 0x00, 0
44600 78 30 30 2c 20 30 78 30 34 2c 20 30 78 30 30 2c x00, 0x04, 0x00,
44610 20 30 78 33 30 2c 20 30 78 66 63 2c 20 30 78 66 0x30, 0xfc, 0xf
44620 66 2c 20 30 78 66 66 2c 20 30 78 62 65 2c 20 30 f, 0xff, 0xbe, 0
44630 78 66 66 2c 20 30 78 37 66 2c 0a 20 20 30 78 66 xff, 0x7f,. 0xf
44640 63 2c 20 30 78 66 66 2c 20 30 78 66 66 2c 20 30 c, 0xff, 0xff, 0
44650 78 62 64 2c 20 30 78 66 66 2c 20 30 78 37 66 2c xbd, 0xff, 0x7f,
44660 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
44670 30 2c 20 30 78 37 30 2c 20 30 78 30 30 2c 20 30 0, 0x70, 0x00, 0
44680 78 30 30 2c 0a 20 20 30 78 30 30 2c 20 30 78 30 x00,. 0x00, 0x0
44690 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 0, 0x00, 0x00, 0
446a0 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c x00, 0x00, 0x00,
446b0 20 30 78 30 30 2c 20 30 78 30 30 2c 20 30 78 30 0x00, 0x00, 0x0
446c0 30 2c 20 30 78 30 30 2c 20 30 78 30 30 2c 0a 20 0, 0x00, 0x00,.
446d0 20 7d 0a 7d 0a 0a 69 6d 61 67 65 20 63 72 65 61 }.}..image crea
446e0 74 65 20 70 68 6f 74 6f 20 64 65 6c 74 61 47 69 te photo deltaGi
446f0 66 20 2d 66 6f 72 6d 61 74 20 67 69 66 20 2d 64 f -format gif -d
44700 61 74 61 20 7b 0a 52 30 6c 47 4f 44 6c 68 4d 41 ata {.R0lGODlhMA
44710 41 77 41 4f 63 41 41 41 49 79 52 73 51 57 47 4a AwAOcAAAIyRsQWGJ
44720 34 65 49 49 59 72 4b 30 61 4b 34 6a 5a 32 79 58 4eIIYrK0aK4jZ2yX
44730 49 6b 4b 4f 4a 32 68 68 70 4b 67 71 5a 2b 69 73 IkKOJ2hhpKgqZ+is
44740 4a 57 0a 59 31 49 75 4e 70 42 65 62 4b 4a 69 66 JW.Y1IuNpBebKJif
44750 69 35 71 75 6d 70 4b 55 73 51 30 4f 45 34 79 53 i5qumpKUsQ0OE4yS
44760 6b 4a 69 69 70 35 53 58 6f 5a 57 58 6e 70 57 61 kJiip5SXoZWXnpWa
44770 68 5a 47 66 70 35 47 55 69 64 65 70 74 72 47 0a hZGfp5GUideptrG.
44780 79 6f 70 53 57 74 70 4f 56 6e 70 2b 6b 69 59 36 yopSWtpOVnp+kiY6
44790 58 69 56 61 6f 49 4a 47 54 70 68 4b 56 6a 78 4d XiVaoIJGTphKVjxM
447a0 63 4a 34 35 50 73 6f 36 50 69 46 57 6d 67 59 79 cJ45Pso6PiFWmgYy
447b0 5a 74 35 53 57 72 6f 65 48 72 61 75 0a 74 6d 61 Zt5SWroeHrau.tma
447c0 43 6c 75 34 65 4a 73 6f 65 48 6c 4a 6d 68 74 73 Clu4eJsoeHlJmhts
447d0 2b 51 33 4a 43 53 69 35 4b 65 70 6f 32 50 70 4b +Q3JCSi5Kepo2PpK
447e0 47 6b 69 42 53 6c 71 49 69 49 75 61 57 6c 6c 59 GkiBSlqIiIuaWllY
447f0 36 51 72 51 6d 4a 6d 4a 79 0a 6b 6a 70 36 7a 6b 6QrQmJmJy.kjp6zk
44800 36 57 39 68 35 4f 6a 78 34 79 50 68 31 43 63 35 6W9h5Ojx4yPh1Cc5
44810 59 65 49 73 70 61 61 74 6f 69 4a 76 4a 63 61 45 YeIspaatoiJvJcaE
44820 35 65 65 6b 70 69 68 70 52 32 67 4d 49 69 49 74 5eekpihpR2gMIiIt
44830 74 65 5a 7a 36 43 0a 32 6e 5a 71 66 75 59 32 50 teZz6C.2nZqfuY2P
44840 75 39 4d 56 47 35 61 59 71 34 69 49 75 74 47 54 u9MVG5aYq4iIutGT
44850 71 4a 4f 58 6b 59 2b 53 75 4b 4b 6b 67 63 36 63 qJOXkY+SuKKkgc6c
44860 34 59 79 4d 6b 71 4f 36 63 5a 43 55 67 49 32 56 4YyMkqO6cZCUgI2V
44870 69 70 69 0a 72 56 34 69 49 6e 49 32 50 71 35 79 ipi.rV4iInI2Pq5y
44880 65 70 49 69 49 73 49 72 4b 36 45 72 4c 42 70 4b epIiIsIrK6ErLBpK
44890 68 72 59 2b 52 73 6f 7a 4d 30 35 32 75 68 49 75 hrY+RsozM052uhIu
448a0 54 73 4a 71 68 72 4a 65 62 75 35 55 57 4c 52 4d TsJqhrJebu5UWLRM
448b0 0a 57 6f 70 57 62 72 34 69 49 6c 35 6d 6a 74 70 .WopWbr4iIl5mjtp
448c0 43 52 45 36 47 32 75 35 65 61 74 56 69 62 71 77 CRE6G2u5eatVibqw
448d0 63 48 6a 5a 47 56 6f 41 6f 4b 72 35 32 66 74 6f cHjZGVoAoKr52fto
448e0 53 45 6d 6f 32 53 73 59 6d 4b 6c 61 53 0a 35 70 SEmo2SsYmKlaS.5p
448f0 59 69 49 74 5a 57 62 72 70 75 63 70 70 69 61 6c YiItZWbrpucppial
44900 4b 4f 33 6d 35 47 55 73 63 71 4b 79 42 47 66 75 KO3m5GUscqKyBGfu
44910 64 4b 55 63 38 79 4d 79 5a 4b 65 68 34 36 59 69 dKUc8yMyZKeh46Yi
44920 5a 47 61 67 34 32 54 73 34 36 0a 50 6a 5a 79 78 ZGag42Ts46.PjZyx
44930 4b 63 71 4b 2b 4a 43 53 4d 70 43 53 75 37 47 78 KcqK+JCSMpCSu7Gx
44940 68 35 53 6b 70 35 43 52 74 55 2b 50 78 39 4f 69 h5Skp5CRtU+Px9Oi
44950 55 49 2b 59 72 6f 70 4b 55 53 43 32 70 70 4f 57 UI+YropKUSC2ppOW
44960 6d 34 65 48 70 49 70 0a 4b 62 56 2f 68 38 35 71 m4eHpIp.KbV/h85q
44970 63 73 59 75 4c 6e 5a 4f 59 6f 73 70 4b 6f 5a 6d csYuLnZOYospKoZm
44980 63 71 6c 61 59 35 5a 57 57 6e 5a 69 5a 75 59 6f cqlaY5ZWWnZiZuYo
44990 4c 6c 35 53 63 6d 34 71 4c 6c 53 57 38 6a 5a 43 Ll5Scm4qLlSW8jZC
449a0 58 70 67 6d 0a 4b 49 4a 43 53 74 70 69 62 41 49 Xpgm.KIJCStpibAI
449b0 32 54 72 59 75 4d 4b 34 70 4b 70 34 79 4e 74 70 2TrYuMK4pKp4yNtp
449c0 61 5a 72 35 38 68 6b 36 4f 35 74 31 47 53 4e 45 aZr58hk6O5t1GSNE
449d0 32 4e 38 35 43 52 6f 70 53 63 69 4a 4b 66 75 59 2N85CRopSciJKfuY
449e0 2b 0a 52 67 6f 32 55 75 4a 4f 57 6a 35 2b 31 43 +.Rgo2UuJOWj5+1C
449f0 70 6d 73 4c 4a 6b 63 6e 34 75 4e 69 35 51 67 45 pmsLJkcn4uNi5QgE
44a00 57 47 34 5a 49 2b 52 42 70 47 67 4e 55 36 50 45 WG4ZI+RBpGgNU6PE
44a10 5a 4f 63 70 41 79 4e 4c 35 4f 57 6f 42 51 0a 5a ZOcpAyNL5OWoBQ.Z
44a20 4a 4a 4b 5a 71 70 53 59 69 35 65 6f 76 4b 57 6e JJKZqpSYi5eovKWn
44a30 6d 70 61 66 6c 65 61 2b 43 5a 53 6a 6a 46 75 76 mpaflea+CZSjjFuv
44a40 55 32 4b 33 63 6f 75 4d 4c 70 6b 63 6e 49 71 4c U2K3couMLpkcnIqL
44a50 75 4a 61 58 6e 70 79 68 75 70 61 0a 5a 6a 35 47 uJaXnpyhupa.Zj5G
44a60 61 72 34 75 4c 70 49 75 4d 6f 34 75 4c 75 46 4c ar4uLpIuMo4uLuFL
44a70 54 38 34 71 4b 6b 36 53 37 4a 5a 5a 5a 36 6b 6c T84qKk6S7JZZZ6kl
44a80 4a 2f 5a 4b 55 75 4a 6d 64 6a 5a 47 61 68 35 57 J/ZKUuJmdjZGah5W
44a90 6f 72 55 71 4b 71 59 32 0a 51 75 64 4f 55 70 6b orUqKqY2.QudOUpk
44aa0 71 4b 34 5a 61 62 6e 4a 61 65 67 49 32 58 69 4e qK4ZabnJaegI2XiN
44ab0 47 64 73 70 71 67 75 4a 47 53 37 49 61 48 75 4a GdspqguJGS7IaHuJ
44ac0 65 5a 75 4a 61 59 6c 4b 53 37 53 70 47 62 6b 79 eZuJaYlKS7SpGbky
44ad0 4b 35 4f 70 30 0a 66 4e 35 43 52 59 35 6d 63 74 K5Op0.fN5CRY5mct
44ae0 5a 45 53 44 5a 53 68 74 5a 6d 62 68 70 4b 69 72 ZESDZShtZmbhpKir
44af0 34 71 4b 69 35 6d 74 41 49 79 55 74 70 47 55 75 4qKi5mtAIyUtpGUu
44b00 42 59 62 68 35 4b 67 49 4a 36 69 6d 35 2b 6c 74 BYbh5KgIJ6im5+lt
44b10 49 65 0a 49 6c 70 6d 67 6e 70 43 53 75 49 69 4a Ie.IlpmgnpCSuIiJ
44b20 67 59 34 54 76 2f 2f 2f 79 48 35 42 41 45 4b 41 gY4Tv///yH5BAEKA
44b30 50 38 41 4c 41 41 41 41 41 41 77 41 44 41 41 41 P8ALAAAAAAwADAAA
44b40 41 6a 2b 41 50 38 4a 48 45 69 77 6f 4d 47 44 0a Aj+AP8JHEiwoMGD.
44b50 43 42 4d 71 58 4a 67 77 46 4d 4f 48 45 41 30 75 CBMqXJgwFMOHEA0u
44b60 73 49 4a 70 53 4d 53 4c 43 31 30 6f 4d 7a 43 41 sIJpSMSLC10oMzCA
44b70 46 73 61 50 42 78 2f 30 79 4f 4a 6d 77 42 75 51 FsaPBx/0yOJmwBuQ
44b80 4b 41 58 6d 63 63 4e 6d 67 42 74 65 0a 57 46 4b KAXmccNmgBte.WFK
44b90 43 72 46 46 4c 67 49 41 42 6c 6b 52 63 6b 76 6d CrFFLgIABlkRckvm
44ba0 52 77 6f 42 79 6c 6f 4a 4f 34 50 6d 78 55 78 59 RwoByloJO4PmxUxY
44bb0 32 6c 67 77 77 2b 6b 49 30 34 68 56 49 4c 47 64 2lgww+kI04hVILGd
44bc0 41 69 79 50 44 47 4c 57 6d 0a 44 44 38 4d 32 46 AiyPDGLWm.DD8M2F
44bd0 6f 4f 46 4c 63 4c 77 34 4c 4a 49 6f 5a 56 49 53 oOFLcLw4LJIoZVIS
44be0 36 63 30 55 35 34 41 77 57 6a 51 72 46 5a 55 73 6c0U54AwWjQrFZUs
44bf0 6f 69 31 4d 44 4c 55 71 51 6c 53 37 5a 59 59 78 oi1MDLUqQlS7ZYYx
44c00 44 69 48 51 6b 63 0a 36 4f 51 61 66 42 51 74 6b DiHQkc.6OQafBQtk
44c10 72 63 41 31 72 5a 30 77 51 51 69 32 62 30 71 36 rcA1rZ0wQQi2b0q6
44c20 67 51 58 54 42 54 4a 4d 42 78 72 31 6b 70 5a 73 gQXTBTJMBxr1kpZs
44c30 31 46 48 43 49 6c 42 6e 69 51 4c 5a 43 44 43 6d 1FHCIlBniQLZCDCm
44c40 7a 64 72 0a 41 51 69 56 32 72 62 74 6d 61 68 38 zdr.AQiV2rbtmah8
44c50 69 7a 44 63 43 69 77 5a 6b 36 6b 74 57 32 79 73 izDcCiwZk6ktW2ys
44c60 57 4c 31 4e 48 71 55 31 4e 37 67 67 63 68 42 58 WL1NHqU1N7ggchBX
44c70 4d 6a 44 63 68 49 69 59 32 64 5a 49 58 69 4e 6b MjDchIiY2dZIXiNk
44c80 0a 61 79 52 77 69 65 63 42 42 31 6d 35 2b 4d 68 .ayRwiecBB1m5+Mh
44c90 73 55 61 32 76 55 58 4d 39 6c 46 62 2b 6a 56 75 sUa2vUXM9lFb+jVu
44ca0 45 51 44 68 6b 77 63 7a 49 71 4e 37 32 51 35 34 EQDhkwczIqN72Q54
44cb0 57 4c 5a 54 30 43 45 4a 31 4c 78 65 43 0a 65 43 WLZT0CEJ1LxeC.eC
44cc0 51 4b 30 4d 5a 36 70 74 66 71 52 76 33 49 41 78 QK0MZ6ptfqRv3IAx
44cd0 34 6c 6c 4c 42 79 42 41 4c 32 63 61 47 44 62 47 4llLByBAL2caGDbG
44ce0 56 52 77 34 49 43 70 44 51 69 68 77 72 77 55 59 VRw4ICpDQihwrwUY
44cf0 49 4d 42 4a 65 49 67 38 43 47 0a 75 58 42 52 56 IMBJeIg8CG.uXBRV
44d00 51 35 59 47 57 45 4c 4c 52 41 30 6f 73 63 6d 79 Q5YGWELLRA0oscmy
44d10 43 44 6a 42 53 58 56 38 4d 41 68 68 7a 70 34 59 CDjBSXV8MAhhzp4Y
44d20 41 51 65 52 4b 45 7a 7a 79 4b 56 47 4b 4c 46 4e AQeRKEzzyKVGKLFN
44d30 4a 74 59 69 45 77 79 0a 51 51 43 53 7a 59 5a 45 JtYiEwy.QQCSzYZE
44d40 43 6a 66 50 56 54 4a 35 49 67 73 4a 38 59 53 67 CjfPVTJ5IgsJ8YSg
44d50 67 42 64 39 49 4f 47 46 46 32 76 45 6b 49 49 6b gBd9IOGFF2vEkIIk
44d60 6b 79 42 6f 33 34 62 34 79 5a 4b 4b 54 41 52 55 kyBo34b4yZKKTARU
44d70 6f 55 4d 75 0a 50 48 79 7a 51 52 2b 76 65 4c 47 oUMu.PHyzQR+veLG
44d80 4b 4b 4b 6a 59 4d 51 49 32 52 43 4a 59 6e 67 35 KKKjYMQI2RCJYng5
44d90 56 33 4a 4b 53 46 49 4f 51 77 45 55 75 45 66 43 V3JKSFIOQwEUuEfC
44da0 6a 53 42 39 38 72 4c 4b 4b 49 6c 34 67 6f 30 73 jSB98rLKKIl4go0s
44db0 52 0a 52 4e 71 58 34 47 66 46 66 65 51 49 42 6f R.RNqX4GfFfeQIBo
44dc0 74 77 63 51 38 49 70 4f 69 78 79 68 69 43 72 71 twcQ8IpOixyhiCrq
44dd0 4b 4c 4c 6f 6f 67 75 6d 57 69 43 7a 6f 43 45 6a KLLoogumWiCzoCEj
44de0 55 4f 49 4c 49 6e 41 6d 57 34 30 34 63 58 0a 6d UOILInAmW404cX.m
44df0 47 37 4b 71 53 37 2b 39 6d 79 70 36 49 62 43 4f G7KqS7+9myp6IbCO
44e00 66 44 6c 52 63 66 49 34 6b 47 6b 47 33 4a 79 69 fDlRcfI4kGkG3Jyi
44e10 71 42 4a 62 4b 70 49 43 79 33 6f 59 6b 36 63 73 qBJbKpICy3oYk6cs
44e20 6b 37 6e 67 53 7a 48 58 43 54 46 0a 4c 44 71 63 k7ngSzHXCTF.LDqc
44e30 6d 6f 73 72 44 55 6a 54 68 7a 52 6f 63 4b 6f 49 mosrDUjThzRocKoI
44e40 47 76 55 38 38 57 4b 63 63 38 34 53 47 55 54 45 GvU88WKcc84SGUTE
44e50 46 4d 44 6b 74 39 6d 45 55 59 38 71 66 43 69 79 FMDkt9mEUY8qfCiy
44e60 4c 54 76 4c 37 41 50 75 0a 72 50 66 6c 64 78 31 LTvL7APu.rPfldx1
44e70 44 74 32 41 77 35 72 79 37 69 4d 4a 4f 45 75 2f Dt2Aw5ry7iMJOEu/
44e80 71 51 6f 4f 38 39 4d 36 71 49 49 4d 4d 6f 57 4f qQoO89M6qIIMMoWO
44e90 4d 44 4e 4b 2b 6d 41 73 34 7a 53 54 42 44 68 72 MDNK+mAs4zSTBDhr
44ea0 73 72 4c 4f 50 0a 4f 4f 4a 38 69 6d 78 35 56 65 srLOP.OOJ8imx5Ve
44eb0 32 58 6b 42 45 65 52 4a 74 6f 6f 73 36 6f 6b 51 2XkBEeRJtoos6okQ
44ec0 51 35 37 4d 51 69 54 44 6f 4a 53 4a 4b 4f 6e 44 Q57MQiTDoJSJKOnD
44ed0 44 54 47 71 4d 52 7a 53 5a 45 7a 54 79 6d 61 68 DTGqMRzSZEzTymah
44ee0 79 6e 0a 4d 2b 65 34 77 77 54 4b 36 78 51 52 79 yn.M+e4wwTK6xQRy
44ef0 77 45 76 6a 43 78 6e 67 6a 72 4d 4d 2b 35 42 71 wEvjCxngjrMM+5Bq
44f00 53 77 5a 6a 36 77 77 32 37 65 48 4c 37 46 63 51 SwZj6ww27eHL7FcQ
44f10 77 34 35 30 72 52 51 43 43 70 37 4f 4c 78 78 0a w450rRQCCp7OLxx.
44f20 6c 30 67 61 64 41 75 30 58 48 7a 72 74 54 69 74 l0gadAu0XHzrtTit
44f30 41 4d 47 45 4e 46 67 58 4d 6f 54 5a 5a 69 73 34 AMGENFgXMoTZZis4
44f40 69 35 30 47 45 5a 4e 6e 32 52 72 72 6a 4d 43 7a i50GEZNn2RrrjMCz
44f50 48 6d 58 77 77 55 63 33 30 73 42 6a 0a 79 38 68 HmXwwUc30sBj.y8h
44f60 35 30 79 72 44 49 48 4d 55 6c 45 61 2b 76 47 35 50yrDIHMUlEa+vG5
44f70 38 39 4e 47 2f 4d 4b 47 4b 43 52 7a 6f 2f 54 69 89NG/MKGKCRzo/Ti
44f80 43 58 4d 52 32 53 78 6f 45 53 57 45 4d 49 68 61 CXMR2SxoESWEMIha
44f90 45 4c 76 72 6f 70 49 66 2b 0a 42 7a 64 71 4e 4d ELvropIf+.BzdqNM
44fa0 46 44 36 61 79 4c 50 6c 79 6a 6e 75 43 41 43 42 FD6ayLPlyjnuCACB
44fb0 51 6c 31 46 35 37 4f 4c 62 6e 72 6e 73 48 55 2f Ql1F57OLbnrnsHU/
44fc0 67 41 68 75 37 41 36 77 34 46 49 6a 6a 55 4c 49 gAhu7A6w4FIjjULI
44fd0 73 32 55 4e 41 7a 0a 43 67 43 6a 4e 4e 38 38 38 s2UNAz.CgCjNN888
44fe0 38 73 37 4c 7a 30 41 54 74 69 6a 68 44 2f 52 51 8s7Lz0ATtijhD/RQ
44ff0 79 2f 39 38 38 33 54 41 34 55 32 73 76 7a 6a 43 y/9883TA4U2svzjC
45000 50 4c 68 55 47 48 2b 2b 65 69 6e 6e 7a 34 73 6c PLhUGH++einnz4sl
45010 34 6a 69 0a 79 77 36 42 2b 4b 50 2b 2f 4f 46 38 4ji.yw6B+KP+/OF8
45020 4c 79 70 52 62 57 67 69 42 6a 77 4b 56 50 4f 4a LypRbWgiBjwKVPOJ
45030 61 41 2b 35 41 79 34 79 41 63 41 43 47 68 41 69 aA+5Ay4yAcACGhAi
45040 41 51 45 41 4f 77 3d 3d 0a 7d 0a 0a 69 6d 61 67 AQEAOw==.}..imag
45050 65 20 63 72 65 61 74 65 20 70 68 6f 74 6f 20 66 e create photo f
45060 69 6e 64 49 6d 61 67 65 20 2d 66 6f 72 6d 61 74 indImage -format
45070 20 67 69 66 20 2d 64 61 74 61 20 7b 0a 52 30 6c gif -data {.R0l
45080 47 4f 44 64 68 46 41 41 55 41 50 66 2f 41 41 41 GODdhFAAUAPf/AAA
45090 41 41 49 41 41 41 41 43 41 41 49 43 41 41 41 41 AAIAAAACAAICAAAA
450a0 41 67 49 41 41 67 41 43 41 67 4d 44 41 77 4d 44 AgIAAgACAgMDAwMD
450b0 63 77 4b 62 4b 38 50 2f 77 31 50 2f 69 73 66 2f cwKbK8P/w1P/isf/
450c0 55 6a 76 2f 47 0a 61 2f 2b 34 53 50 2b 71 4a 66 Ujv/G.a/+4SP+qJf
450d0 2b 71 41 4e 79 53 41 4c 6c 36 41 4a 5a 69 41 48 +qANySALl6AJZiAH
450e0 4e 4b 41 46 41 79 41 50 2f 6a 31 50 2f 48 73 66 NKAFAyAP/j1P/Hsf
450f0 2b 72 6a 76 2b 50 61 2f 39 7a 53 50 39 58 4a 66 +rjv+Pa/9zSP9XJf
45100 39 56 41 4e 78 4a 41 4c 6b 39 41 4a 59 78 0a 41 9VANxJALk9AJYx.A
45110 48 4d 6c 41 46 41 5a 41 50 2f 55 31 50 2b 78 73 HMlAFAZAP/U1P+xs
45120 66 2b 4f 6a 76 39 72 61 2f 39 49 53 50 38 6c 4a f+Ojv9ra/9ISP8lJ
45130 66 34 41 41 4e 77 41 41 4c 6b 41 41 4a 59 41 41 f4AANwAALkAAJYAA
45140 48 4d 41 41 46 41 41 41 50 2f 55 34 2f 2b 78 78 HMAAFAAAP/U4/+xx
45150 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 49 63 2f 38 6c /+Oq/9r.j/9Ic/8l
45160 56 2f 38 41 56 64 77 41 53 62 6b 41 50 5a 59 41 V/8AVdwASbkAPZYA
45170 4d 58 4d 41 4a 56 41 41 47 66 2f 55 38 50 2b 78 MXMAJVAAGf/U8P+x
45180 34 76 2b 4f 31 50 39 72 78 76 39 49 75 50 38 6c 4v+O1P9rxv9IuP8l
45190 71 76 38 41 71 74 77 41 6b 72 6b 41 65 70 59 41 qv8AqtwAkrkAepYA
451a0 0a 59 6e 4d 41 53 6c 41 41 4d 76 2f 55 2f 2f 2b .YnMASlAAMv/U//+
451b0 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 2f 2f 38 x//+O//9r//9I//8
451c0 6c 2f 2f 34 41 2f 74 77 41 33 4c 6b 41 75 5a 59 l//4A/twA3LkAuZY
451d0 41 6c 6e 4d 41 63 31 41 41 55 50 44 55 2f 2b 4b AlnMAc1AAUPDU/+K
451e0 78 2f 39 53 4f 2f 38 5a 72 0a 2f 37 68 49 2f 36 x/9SO/8Zr./7hI/6
451f0 6f 6c 2f 36 6f 41 2f 35 49 41 33 48 6f 41 75 57 ol/6oA/5IA3HoAuW
45200 49 41 6c 6b 6f 41 63 7a 49 41 55 4f 50 55 2f 38 IAlkoAczIAUOPU/8
45210 65 78 2f 36 75 4f 2f 34 39 72 2f 33 4e 49 2f 31 ex/6uO/49r/3NI/1
45220 63 6c 2f 31 55 41 2f 30 6b 41 33 44 30 41 75 54 cl/1UA/0kA3D0AuT
45230 45 41 0a 6c 69 55 41 63 78 6b 41 55 4e 54 55 2f EA.liUAcxkAUNTU/
45240 37 47 78 2f 34 36 4f 2f 32 74 72 2f 30 68 49 2f 7Gx/46O/2tr/0hI/
45250 79 55 6c 2f 77 41 41 2f 67 41 41 33 41 41 41 75 yUl/wAA/gAA3AAAu
45260 51 41 41 6c 67 41 41 63 77 41 41 55 4e 54 6a 2f QAAlgAAcwAAUNTj/
45270 37 48 48 2f 34 36 72 2f 32 75 50 0a 2f 30 68 7a 7HH/46r/2uP./0hz
45280 2f 79 56 58 2f 77 42 56 2f 77 42 4a 33 41 41 39 /yVX/wBV/wBJ3AA9
45290 75 51 41 78 6c 67 41 6c 63 77 41 5a 55 4e 54 77 uQAxlgAlcwAZUNTw
452a0 2f 37 48 69 2f 34 37 55 2f 32 76 47 2f 30 69 34 /7Hi/47U/2vG/0i4
452b0 2f 79 57 71 2f 77 43 71 2f 77 43 53 33 41 42 36 /yWq/wCq/wCS3AB6
452c0 75 51 42 69 0a 6c 67 42 4b 63 77 41 79 55 4e 54 uQBi.lgBKcwAyUNT
452d0 2f 2f 37 48 2f 2f 34 37 2f 2f 32 76 2f 2f 30 6a //7H//47//2v//0j
452e0 2f 2f 79 58 2f 2f 77 44 2b 2f 67 44 63 33 41 43 //yX//wD+/gDc3AC
452f0 35 75 51 43 57 6c 67 42 7a 63 77 42 51 55 4e 54 5uQCWlgBzcwBQUNT
45300 2f 38 4c 48 2f 34 6f 37 2f 31 47 76 2f 0a 78 6b /8LH/4o7/1Gv/.xk
45310 6a 2f 75 43 58 2f 71 67 44 2f 71 67 44 63 6b 67 j/uCX/qgD/qgDckg
45320 43 35 65 67 43 57 59 67 42 7a 53 67 42 51 4d 74 C5egCWYgBzSgBQMt
45330 54 2f 34 37 48 2f 78 34 37 2f 71 32 76 2f 6a 30 T/47H/x47/q2v/j0
45340 6a 2f 63 79 58 2f 56 77 44 2f 56 51 44 63 53 51 j/cyX/VwD/VQDcSQ
45350 43 35 50 51 43 57 0a 4d 51 42 7a 4a 51 42 51 47 C5PQCW.MQBzJQBQG
45360 64 54 2f 31 4c 48 2f 73 59 37 2f 6a 6d 76 2f 61 dT/1LH/sY7/jmv/a
45370 30 6a 2f 53 43 58 2f 4a 51 44 2b 41 41 44 63 41 0j/SCX/JQD+AADcA
45380 41 43 35 41 41 43 57 41 41 42 7a 41 41 42 51 41 AC5AACWAABzAABQA
45390 4f 50 2f 31 4d 66 2f 73 61 76 2f 6a 6f 2f 2f 0a OP/1Mf/sav/jo//.
453a0 61 33 50 2f 53 46 66 2f 4a 56 58 2f 41 45 6e 63 a3P/SFf/JVX/AEnc
453b0 41 44 32 35 41 44 47 57 41 43 56 7a 41 42 6c 51 AD25ADGWACVzABlQ
453c0 41 50 44 2f 31 4f 4c 2f 73 64 54 2f 6a 73 62 2f APD/1OL/sdT/jsb/
453d0 61 37 6a 2f 53 4b 72 2f 4a 61 72 2f 41 4a 4c 63 a7j/SKr/Jar/AJLc
453e0 41 48 71 35 41 47 4b 57 0a 41 45 70 7a 41 44 4a AHq5AGKW.AEpzADJ
453f0 51 41 50 2f 2f 31 50 2f 2f 73 66 2f 2f 6a 76 2f QAP//1P//sf//jv/
45400 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 37 2b 41 4e 7a /a///SP//Jf7+ANz
45410 63 41 4c 6d 35 41 4a 61 57 41 48 4e 7a 41 46 42 cALm5AJaWAHNzAFB
45420 51 41 50 4c 79 38 75 62 6d 35 74 72 61 32 73 37 QAPLy8ubm5tra2s7
45430 4f 0a 7a 73 4c 43 77 72 61 32 74 71 71 71 71 70 O.zsLCwra2tqqqqp
45440 36 65 6e 70 4b 53 6b 6f 61 47 68 6e 70 36 65 6d 6enpKSkoaGhnp6em
45450 35 75 62 6d 4a 69 59 6c 5a 57 56 6b 70 4b 53 6a 5ubmJiYlZWVkpKSj
45460 34 2b 50 6a 49 79 4d 69 59 6d 4a 68 6f 61 47 67 4+PjIyMiYmJhoaGg
45470 34 4f 44 76 2f 37 38 4b 43 67 0a 70 49 43 41 67 4ODv/78KCg.pICAg
45480 50 38 41 41 41 44 2f 41 50 2f 2f 41 41 41 41 2f P8AAAD/AP//AAAA/
45490 2f 38 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 48 35 42 /8A/wD//////yH5B
454a0 41 45 41 41 41 45 41 4c 41 41 41 41 41 41 55 41 AEAAAEALAAAAAAUA
454b0 42 51 41 51 41 6a 55 41 41 4d 49 48 45 69 77 6f BQAQAjUAAMIHEiwo
454c0 45 46 33 0a 41 4f 51 70 58 4d 69 51 49 51 42 33 EF3.AOQpXMiQIQB3
454d0 41 52 43 36 61 36 66 4f 33 62 75 48 41 69 56 57 ARC6a6fO3buHAiVW
454e0 66 41 63 50 59 77 42 31 41 4e 36 70 61 2f 66 51 fAcPYwB1AN6pa/fQ
454f0 6e 55 6b 41 49 79 2b 71 45 77 69 79 33 62 70 30 nUkAIy+qEwiy3bp0
45500 37 44 71 61 50 50 6d 53 33 54 71 53 0a 4b 7a 2f 7DqaPPmS3TqS.Kz/
45510 53 41 38 41 54 51 44 79 42 38 58 6f 43 6f 4a 63 SA8ATQDyB8XoCoJc
45520 7a 49 34 42 32 46 2b 56 42 6a 43 6a 76 6f 63 79 zI4B2F+VBjCjvocy
45530 42 43 4e 4f 56 53 39 63 78 41 45 2b 72 55 71 6c BCNOVS9cxAE+rUql
45540 69 52 48 68 7a 6e 62 75 6e 45 59 39 36 64 62 6c iRHhznbunEY96dbl
45550 31 35 6b 79 43 0a 5a 73 38 4f 72 44 67 7a 4a 31 15kyC.Zs8OrDgzJ1
45560 75 54 52 56 6e 53 59 7a 63 4f 35 4d 38 41 51 65 uTRVnSYzcO5M8AQe
45570 75 36 49 30 6f 51 35 44 75 6b 41 4f 41 4a 6c 67 u6I0oQ5DukAOAJlg
45580 6c 50 4a 56 52 35 67 42 4d 69 66 4e 6a 55 71 54 lPJVR5gBMifNjUqT
45590 79 6f 41 4d 36 4e 4b 31 66 31 61 75 54 4a 0a 59 yoAM6NK1f1auTJ.Y
455a0 44 75 75 4f 78 64 54 4b 4d 2f 4e 6e 65 47 46 48 DuuOxdTKM/NneGFH
455b0 56 6b 52 4c 45 4b 4b 45 30 47 65 46 47 7a 52 64 VkRLEKKE0GeFGzRd
455c0 4f 44 57 4d 68 64 37 58 69 70 62 36 46 4b 44 75 ODWMhd7Xipb6FKDu
455d0 41 73 47 42 41 41 37 0a 7d 0a 0a 69 6d 61 67 65 AsGBAA7.}..image
455e0 20 63 72 65 61 74 65 20 70 68 6f 74 6f 20 63 65 create photo ce
455f0 6e 74 65 72 44 69 66 66 73 49 6d 61 67 65 20 2d nterDiffsImage -
45600 66 6f 72 6d 61 74 20 67 69 66 20 2d 64 61 74 61 format gif -data
45610 20 7b 0a 52 30 6c 47 4f 44 6c 68 46 41 41 55 41 {.R0lGODlhFAAUA
45620 50 63 41 41 41 41 41 41 49 41 41 41 41 43 41 41 PcAAAAAAIAAAACAA
45630 49 43 41 41 41 41 41 67 49 41 41 67 41 43 41 67 ICAAAAAgIAAgACAg
45640 4d 44 41 77 4d 44 63 77 4b 62 4b 38 50 2f 77 31 MDAwMDcwKbK8P/w1
45650 50 2f 69 73 66 2f 55 6a 76 2f 47 0a 61 2f 2b 34 P/isf/Ujv/G.a/+4
45660 53 50 2b 71 4a 66 2b 71 41 4e 79 53 41 4c 6c 36 SP+qJf+qANySALl6
45670 41 4a 5a 69 41 48 4e 4b 41 46 41 79 41 50 2f 6a AJZiAHNKAFAyAP/j
45680 31 50 2f 48 73 66 2b 72 6a 76 2b 50 61 2f 39 7a 1P/Hsf+rjv+Pa/9z
45690 53 50 39 58 4a 66 39 56 41 4e 78 4a 41 4c 6b 39 SP9XJf9VANxJALk9
456a0 41 4a 59 78 0a 41 48 4d 6c 41 46 41 5a 41 50 2f AJYx.AHMlAFAZAP/
456b0 55 31 50 2b 78 73 66 2b 4f 6a 76 39 72 61 2f 39 U1P+xsf+Ojv9ra/9
456c0 49 53 50 38 6c 4a 66 34 41 41 4e 77 41 41 4c 6b ISP8lJf4AANwAALk
456d0 41 41 4a 59 41 41 48 4d 41 41 46 41 41 41 50 2f AAJYAAHMAAFAAAP/
456e0 55 34 2f 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a 2f U4/+xx/+Oq/9r.j/
456f0 39 49 63 2f 38 6c 56 2f 38 41 56 64 77 41 53 62 9Ic/8lV/8AVdwASb
45700 6b 41 50 5a 59 41 4d 58 4d 41 4a 56 41 41 47 66 kAPZYAMXMAJVAAGf
45710 2f 55 38 50 2b 78 34 76 2b 4f 31 50 39 72 78 76 /U8P+x4v+O1P9rxv
45720 39 49 75 50 38 6c 71 76 38 41 71 74 77 41 6b 72 9IuP8lqv8AqtwAkr
45730 6b 41 65 70 59 41 0a 59 6e 4d 41 53 6c 41 41 4d kAepYA.YnMASlAAM
45740 76 2f 55 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 2f v/U//+x//+O//9r/
45750 2f 39 49 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 33 /9I//8l//4A/twA3
45760 4c 6b 41 75 5a 59 41 6c 6e 4d 41 63 31 41 41 55 LkAuZYAlnMAc1AAU
45770 50 44 55 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 0a PDU/+Kx/9SO/8Zr.
45780 2f 37 68 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 41 /7hI/6ol/6oA/5IA
45790 33 48 6f 41 75 57 49 41 6c 6b 6f 41 63 7a 49 41 3HoAuWIAlkoAczIA
457a0 55 4f 50 55 2f 38 65 78 2f 36 75 4f 2f 34 39 72 UOPU/8ex/6uO/49r
457b0 2f 33 4e 49 2f 31 63 6c 2f 31 55 41 2f 30 6b 41 /3NI/1cl/1UA/0kA
457c0 33 44 30 41 75 54 45 41 0a 6c 69 55 41 63 78 6b 3D0AuTEA.liUAcxk
457d0 41 55 4e 54 55 2f 37 47 78 2f 34 36 4f 2f 32 74 AUNTU/7Gx/46O/2t
457e0 72 2f 30 68 49 2f 79 55 6c 2f 77 41 41 2f 67 41 r/0hI/yUl/wAA/gA
457f0 41 33 41 41 41 75 51 41 41 6c 67 41 41 63 77 41 A3AAAuQAAlgAAcwA
45800 41 55 4e 54 6a 2f 37 48 48 2f 34 36 72 2f 32 75 AUNTj/7HH/46r/2u
45810 50 0a 2f 30 68 7a 2f 79 56 58 2f 77 42 56 2f 77 P./0hz/yVX/wBV/w
45820 42 4a 33 41 41 39 75 51 41 78 6c 67 41 6c 63 77 BJ3AA9uQAxlgAlcw
45830 41 5a 55 4e 54 77 2f 37 48 69 2f 34 37 55 2f 32 AZUNTw/7Hi/47U/2
45840 76 47 2f 30 69 34 2f 79 57 71 2f 77 43 71 2f 77 vG/0i4/yWq/wCq/w
45850 43 53 33 41 42 36 75 51 42 69 0a 6c 67 42 4b 63 CS3AB6uQBi.lgBKc
45860 77 41 79 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f 2f wAyUNT//7H//47//
45870 32 76 2f 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b 2f 2v//0j//yX//wD+/
45880 67 44 63 33 41 43 35 75 51 43 57 6c 67 42 7a 63 gDc3AC5uQCWlgBzc
45890 77 42 51 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f 31 wBQUNT/8LH/4o7/1
458a0 47 76 2f 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 2f Gv/.xkj/uCX/qgD/
458b0 71 67 44 63 6b 67 43 35 65 67 43 57 59 67 42 7a qgDckgC5egCWYgBz
458c0 53 67 42 51 4d 74 54 2f 34 37 48 2f 78 34 37 2f SgBQMtT/47H/x47/
458d0 71 32 76 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 2f q2v/j0j/cyX/VwD/
458e0 56 51 44 63 53 51 43 35 50 51 43 57 0a 4d 51 42 VQDcSQC5PQCW.MQB
458f0 7a 4a 51 42 51 47 64 54 2f 31 4c 48 2f 73 59 37 zJQBQGdT/1LH/sY7
45900 2f 6a 6d 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 44 /jmv/a0j/SCX/JQD
45910 2b 41 41 44 63 41 41 43 35 41 41 43 57 41 41 42 +AADcAAC5AACWAAB
45920 7a 41 41 42 51 41 4f 50 2f 31 4d 66 2f 73 61 76 zAABQAOP/1Mf/sav
45930 2f 6a 6f 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a 56 /jo//.a3P/SFf/JV
45940 58 2f 41 45 6e 63 41 44 32 35 41 44 47 57 41 43 X/AEncAD25ADGWAC
45950 56 7a 41 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 64 VzABlQAPD/1OL/sd
45960 54 2f 6a 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a 61 T/jsb/a7j/SKr/Ja
45970 72 2f 41 4a 4c 63 41 48 71 35 41 47 4b 57 0a 41 r/AJLcAHq5AGKW.A
45980 45 70 7a 41 44 4a 51 41 50 2f 2f 31 50 2f 2f 73 EpzADJQAP//1P//s
45990 66 2f 2f 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f 4a f//jv//a///SP//J
459a0 66 37 2b 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 41 f7+ANzcALm5AJaWA
459b0 48 4e 7a 41 46 42 51 41 50 4c 79 38 75 62 6d 35 HNzAFBQAPLy8ubm5
459c0 74 72 61 32 73 37 4f 0a 7a 73 4c 43 77 72 61 32 tra2s7O.zsLCwra2
459d0 74 71 71 71 71 70 36 65 6e 70 4b 53 6b 6f 61 47 tqqqqp6enpKSkoaG
459e0 68 6e 70 36 65 6d 35 75 62 6d 4a 69 59 6c 5a 57 hnp6em5ubmJiYlZW
459f0 56 6b 70 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 6d VkpKSj4+PjIyMiYm
45a00 4a 68 6f 61 47 67 34 4f 44 76 2f 37 38 4b 43 67 JhoaGg4ODv/78KCg
45a10 0a 70 49 43 41 67 50 38 41 41 41 44 2f 41 50 2f .pICAgP8AAAD/AP/
45a20 2f 41 41 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f 2f /AAAA//8A/wD////
45a30 2f 2f 79 48 35 42 41 45 41 41 41 45 41 4c 41 41 //yH5BAEAAAEALAA
45a40 41 41 41 41 55 41 42 51 41 41 41 69 55 41 41 4d AAAAUABQAAAiUAAM
45a50 49 48 42 6a 41 48 59 43 44 0a 41 4e 77 52 48 48 IHBjAHYCD.ANwRHH
45a60 6a 4f 6e 63 4f 48 42 67 6b 52 53 67 6a 52 59 55 jOncOHBgkRSgjRYU
45a70 4f 45 47 41 45 59 4d 70 51 52 6f 55 4d 41 2f 38 OEGAEYMpQRoUMA/8
45a80 53 4a 46 47 64 77 59 30 4a 79 4b 46 46 53 42 47 SJFGdwY0JyKFFSBG
45a90 43 75 5a 63 75 53 48 4e 32 35 62 4c 6d 79 6f 30 CuZcuSHN25bLmyo0
45aa0 61 4f 0a 4e 6a 2b 47 4a 41 6b 67 30 63 61 4e 69 aO.Nj+GJAkg0caNi
45ab0 55 36 71 2f 44 6a 54 6f 45 39 44 51 57 57 36 72 U6q/DjToE9DQWW6r
45ac0 4e 6b 78 55 64 43 63 42 6e 65 4f 4e 48 68 79 35 NkxUdCcBneONHhy5
45ad0 46 43 44 4d 31 30 36 7a 45 72 7a 6f 38 32 76 42 FCDM106zErzo82vB
45ae0 33 58 75 54 45 6d 32 37 45 71 75 0a 61 4a 64 36 3XuTEm27Equ.aJd6
45af0 42 51 73 56 70 46 53 52 5a 63 6d 65 54 59 75 57 BQsVpFSRZcmeTYuW
45b00 4b 64 75 4d 37 68 70 57 33 4c 76 33 33 4d 4b 2f KduM7hpW3Lv33MK/
45b10 67 41 55 47 42 41 41 37 0a 7d 0a 0a 69 6d 61 67 gAUGBAA7.}..imag
45b20 65 20 63 72 65 61 74 65 20 70 68 6f 74 6f 20 66 e create photo f
45b30 69 72 73 74 44 69 66 66 49 6d 61 67 65 20 2d 66 irstDiffImage -f
45b40 6f 72 6d 61 74 20 67 69 66 20 2d 64 61 74 61 20 ormat gif -data
45b50 7b 0a 52 30 6c 47 4f 44 6c 68 46 41 41 55 41 50 {.R0lGODlhFAAUAP
45b60 63 41 41 41 41 41 41 49 41 41 41 41 43 41 41 49 cAAAAAAIAAAACAAI
45b70 43 41 41 41 41 41 67 49 41 41 67 41 43 41 67 4d CAAAAAgIAAgACAgM
45b80 44 41 77 4d 44 63 77 4b 62 4b 38 50 2f 77 31 50 DAwMDcwKbK8P/w1P
45b90 2f 69 73 66 2f 55 6a 76 2f 47 0a 61 2f 2b 34 53 /isf/Ujv/G.a/+4S
45ba0 50 2b 71 4a 66 2b 71 41 4e 79 53 41 4c 6c 36 41 P+qJf+qANySALl6A
45bb0 4a 5a 69 41 48 4e 4b 41 46 41 79 41 50 2f 6a 31 JZiAHNKAFAyAP/j1
45bc0 50 2f 48 73 66 2b 72 6a 76 2b 50 61 2f 39 7a 53 P/Hsf+rjv+Pa/9zS
45bd0 50 39 58 4a 66 39 56 41 4e 78 4a 41 4c 6b 39 41 P9XJf9VANxJALk9A
45be0 4a 59 78 0a 41 48 4d 6c 41 46 41 5a 41 50 2f 55 JYx.AHMlAFAZAP/U
45bf0 31 50 2b 78 73 66 2b 4f 6a 76 39 72 61 2f 39 49 1P+xsf+Ojv9ra/9I
45c00 53 50 38 6c 4a 66 34 41 41 4e 77 41 41 4c 6b 41 SP8lJf4AANwAALkA
45c10 41 4a 59 41 41 48 4d 41 41 46 41 41 41 50 2f 55 AJYAAHMAAFAAAP/U
45c20 34 2f 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 4/+xx/+Oq/9r.j/9
45c30 49 63 2f 38 6c 56 2f 38 41 56 64 77 41 53 62 6b Ic/8lV/8AVdwASbk
45c40 41 50 5a 59 41 4d 58 4d 41 4a 56 41 41 47 66 2f APZYAMXMAJVAAGf/
45c50 55 38 50 2b 78 34 76 2b 4f 31 50 39 72 78 76 39 U8P+x4v+O1P9rxv9
45c60 49 75 50 38 6c 71 76 38 41 71 74 77 41 6b 72 6b IuP8lqv8AqtwAkrk
45c70 41 65 70 59 41 0a 59 6e 4d 41 53 6c 41 41 4d 76 AepYA.YnMASlAAMv
45c80 2f 55 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f /U//+x//+O//9r//
45c90 39 49 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 33 4c 9I//8l//4A/twA3L
45ca0 6b 41 75 5a 59 41 6c 6e 4d 41 63 31 41 41 55 50 kAuZYAlnMAc1AAUP
45cb0 44 55 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 0a 2f DU/+Kx/9SO/8Zr./
45cc0 37 68 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 41 33 7hI/6ol/6oA/5IA3
45cd0 48 6f 41 75 57 49 41 6c 6b 6f 41 63 7a 49 41 55 HoAuWIAlkoAczIAU
45ce0 4f 50 55 2f 38 65 78 2f 36 75 4f 2f 34 39 72 2f OPU/8ex/6uO/49r/
45cf0 33 4e 49 2f 31 63 6c 2f 31 55 41 2f 30 6b 41 33 3NI/1cl/1UA/0kA3
45d00 44 30 41 75 54 45 41 0a 6c 69 55 41 63 78 6b 41 D0AuTEA.liUAcxkA
45d10 55 4e 54 55 2f 37 47 78 2f 34 36 4f 2f 32 74 72 UNTU/7Gx/46O/2tr
45d20 2f 30 68 49 2f 79 55 6c 2f 77 41 41 2f 67 41 41 /0hI/yUl/wAA/gAA
45d30 33 41 41 41 75 51 41 41 6c 67 41 41 63 77 41 41 3AAAuQAAlgAAcwAA
45d40 55 4e 54 6a 2f 37 48 48 2f 34 36 72 2f 32 75 50 UNTj/7HH/46r/2uP
45d50 0a 2f 30 68 7a 2f 79 56 58 2f 77 42 56 2f 77 42 ./0hz/yVX/wBV/wB
45d60 4a 33 41 41 39 75 51 41 78 6c 67 41 6c 63 77 41 J3AA9uQAxlgAlcwA
45d70 5a 55 4e 54 77 2f 37 48 69 2f 34 37 55 2f 32 76 ZUNTw/7Hi/47U/2v
45d80 47 2f 30 69 34 2f 79 57 71 2f 77 43 71 2f 77 43 G/0i4/yWq/wCq/wC
45d90 53 33 41 42 36 75 51 42 69 0a 6c 67 42 4b 63 77 S3AB6uQBi.lgBKcw
45da0 41 79 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f 2f 32 AyUNT//7H//47//2
45db0 76 2f 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b 2f 67 v//0j//yX//wD+/g
45dc0 44 63 33 41 43 35 75 51 43 57 6c 67 42 7a 63 77 Dc3AC5uQCWlgBzcw
45dd0 42 51 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f 31 47 BQUNT/8LH/4o7/1G
45de0 76 2f 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 2f 71 v/.xkj/uCX/qgD/q
45df0 67 44 63 6b 67 43 35 65 67 43 57 59 67 42 7a 53 gDckgC5egCWYgBzS
45e00 67 42 51 4d 74 54 2f 34 37 48 2f 78 34 37 2f 71 gBQMtT/47H/x47/q
45e10 32 76 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 2f 56 2v/j0j/cyX/VwD/V
45e20 51 44 63 53 51 43 35 50 51 43 57 0a 4d 51 42 7a QDcSQC5PQCW.MQBz
45e30 4a 51 42 51 47 64 54 2f 31 4c 48 2f 73 59 37 2f JQBQGdT/1LH/sY7/
45e40 6a 6d 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 44 2b jmv/a0j/SCX/JQD+
45e50 41 41 44 63 41 41 43 35 41 41 43 57 41 41 42 7a AADcAAC5AACWAABz
45e60 41 41 42 51 41 4f 50 2f 31 4d 66 2f 73 61 76 2f AABQAOP/1Mf/sav/
45e70 6a 6f 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a 56 58 jo//.a3P/SFf/JVX
45e80 2f 41 45 6e 63 41 44 32 35 41 44 47 57 41 43 56 /AEncAD25ADGWACV
45e90 7a 41 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 64 54 zABlQAPD/1OL/sdT
45ea0 2f 6a 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a 61 72 /jsb/a7j/SKr/Jar
45eb0 2f 41 4a 4c 63 41 48 71 35 41 47 4b 57 0a 41 45 /AJLcAHq5AGKW.AE
45ec0 70 7a 41 44 4a 51 41 50 2f 2f 31 50 2f 2f 73 66 pzADJQAP//1P//sf
45ed0 2f 2f 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 //jv//a///SP//Jf
45ee0 37 2b 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 41 48 7+ANzcALm5AJaWAH
45ef0 4e 7a 41 46 42 51 41 50 4c 79 38 75 62 6d 35 74 NzAFBQAPLy8ubm5t
45f00 72 61 32 73 37 4f 0a 7a 73 4c 43 77 72 61 32 74 ra2s7O.zsLCwra2t
45f10 71 71 71 71 70 36 65 6e 70 4b 53 6b 6f 61 47 68 qqqqp6enpKSkoaGh
45f20 6e 70 36 65 6d 35 75 62 6d 4a 69 59 6c 5a 57 56 np6em5ubmJiYlZWV
45f30 6b 70 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 6d 4a kpKSj4+PjIyMiYmJ
45f40 68 6f 61 47 67 34 4f 44 76 2f 37 38 4b 43 67 0a hoaGg4ODv/78KCg.
45f50 70 49 43 41 67 50 38 41 41 41 44 2f 41 50 2f 2f pICAgP8AAAD/AP//
45f60 41 41 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f 2f 2f AAAA//8A/wD/////
45f70 2f 79 48 35 42 41 45 41 41 41 45 41 4c 41 41 41 /yH5BAEAAAEALAAA
45f80 41 41 41 55 41 42 51 41 41 41 69 55 41 41 4d 49 AAAUABQAAAiUAAMI
45f90 64 46 65 76 6f 4d 47 44 0a 42 64 30 4a 58 42 69 dFevoMGD.Bd0JXBi
45fa0 67 33 6a 39 43 68 41 78 4a 6e 44 69 78 48 6b 4f g3j9ChAxJnDixHkO
45fb0 42 44 69 6c 71 6c 47 6a 78 49 6b 47 45 49 42 56 BDilqlGjxIkGEIBV
45fc0 65 76 48 6a 4f 6e 62 74 7a 49 31 4d 4b 4c 41 6b evHjOnbtzI1MKLAk
45fd0 41 77 45 6d 56 4a 4e 30 42 49 4b 54 49 4a 55 71 AwEmVJN0BIKTIJUq
45fe0 59 0a 41 56 67 53 2b 6e 65 6f 35 6b 75 56 4f 76 Y.AVgS+neo5kuVOv
45ff0 39 4a 37 47 6b 7a 70 63 35 42 46 49 6e 2b 58 48 9J7Gkzpc5BFIn+XH
46000 67 30 36 53 47 6c 4e 31 66 4b 62 44 6c 54 59 69 g06SGlN1fKbDlTYi
46010 4b 71 52 52 6d 57 4e 46 6e 56 30 46 57 54 53 37 KqRRmWNFnV0FWTS7
46020 58 71 74 47 6f 7a 36 73 69 78 0a 58 72 4d 43 6c XqtGoz6six.XrMCl
46030 52 6b 78 62 64 69 7a 62 4d 6d 2b 6a 51 6e 67 55 RkxbdizbMm+jQngU
46040 4b 4b 37 61 6f 31 4f 78 54 6f 33 4a 6c 69 54 5a KK7ao1OxTo3JliTZ
46050 67 55 47 42 41 41 37 0a 7d 0a 0a 69 6d 61 67 65 gUGBAA7.}..image
46060 20 63 72 65 61 74 65 20 70 68 6f 74 6f 20 70 72 create photo pr
46070 65 76 44 69 66 66 49 6d 61 67 65 20 2d 66 6f 72 evDiffImage -for
46080 6d 61 74 20 67 69 66 20 2d 64 61 74 61 20 7b 0a mat gif -data {.
46090 52 30 6c 47 4f 44 64 68 46 41 41 55 41 50 66 2f R0lGODdhFAAUAPf/
460a0 41 41 41 41 41 49 41 41 41 41 43 41 41 49 43 41 AAAAAIAAAACAAICA
460b0 41 41 41 41 67 49 41 41 67 41 43 41 67 4d 44 41 AAAAgIAAgACAgMDA
460c0 77 4d 44 63 77 4b 62 4b 38 50 2f 77 31 50 2f 69 wMDcwKbK8P/w1P/i
460d0 73 66 2f 55 6a 76 2f 47 0a 61 2f 2b 34 53 50 2b sf/Ujv/G.a/+4SP+
460e0 71 4a 66 2b 71 41 4e 79 53 41 4c 6c 36 41 4a 5a qJf+qANySALl6AJZ
460f0 69 41 48 4e 4b 41 46 41 79 41 50 2f 6a 31 50 2f iAHNKAFAyAP/j1P/
46100 48 73 66 2b 72 6a 76 2b 50 61 2f 39 7a 53 50 39 Hsf+rjv+Pa/9zSP9
46110 58 4a 66 39 56 41 4e 78 4a 41 4c 6b 39 41 4a 59 XJf9VANxJALk9AJY
46120 78 0a 41 48 4d 6c 41 46 41 5a 41 50 2f 55 31 50 x.AHMlAFAZAP/U1P
46130 2b 78 73 66 2b 4f 6a 76 39 72 61 2f 39 49 53 50 +xsf+Ojv9ra/9ISP
46140 38 6c 4a 66 34 41 41 4e 77 41 41 4c 6b 41 41 4a 8lJf4AANwAALkAAJ
46150 59 41 41 48 4d 41 41 46 41 41 41 50 2f 55 34 2f YAAHMAAFAAAP/U4/
46160 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 49 63 +xx/+Oq/9r.j/9Ic
46170 2f 38 6c 56 2f 38 41 56 64 77 41 53 62 6b 41 50 /8lV/8AVdwASbkAP
46180 5a 59 41 4d 58 4d 41 4a 56 41 41 47 66 2f 55 38 ZYAMXMAJVAAGf/U8
46190 50 2b 78 34 76 2b 4f 31 50 39 72 78 76 39 49 75 P+x4v+O1P9rxv9Iu
461a0 50 38 6c 71 76 38 41 71 74 77 41 6b 72 6b 41 65 P8lqv8AqtwAkrkAe
461b0 70 59 41 0a 59 6e 4d 41 53 6c 41 41 4d 76 2f 55 pYA.YnMASlAAMv/U
461c0 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 //+x//+O//9r//9I
461d0 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 33 4c 6b 41 //8l//4A/twA3LkA
461e0 75 5a 59 41 6c 6e 4d 41 63 31 41 41 55 50 44 55 uZYAlnMAc1AAUPDU
461f0 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 0a 2f 37 68 /+Kx/9SO/8Zr./7h
46200 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 41 33 48 6f I/6ol/6oA/5IA3Ho
46210 41 75 57 49 41 6c 6b 6f 41 63 7a 49 41 55 4f 50 AuWIAlkoAczIAUOP
46220 55 2f 38 65 78 2f 36 75 4f 2f 34 39 72 2f 33 4e U/8ex/6uO/49r/3N
46230 49 2f 31 63 6c 2f 31 55 41 2f 30 6b 41 33 44 30 I/1cl/1UA/0kA3D0
46240 41 75 54 45 41 0a 6c 69 55 41 63 78 6b 41 55 4e AuTEA.liUAcxkAUN
46250 54 55 2f 37 47 78 2f 34 36 4f 2f 32 74 72 2f 30 TU/7Gx/46O/2tr/0
46260 68 49 2f 79 55 6c 2f 77 41 41 2f 67 41 41 33 41 hI/yUl/wAA/gAA3A
46270 41 41 75 51 41 41 6c 67 41 41 63 77 41 41 55 4e AAuQAAlgAAcwAAUN
46280 54 6a 2f 37 48 48 2f 34 36 72 2f 32 75 50 0a 2f Tj/7HH/46r/2uP./
46290 30 68 7a 2f 79 56 58 2f 77 42 56 2f 77 42 4a 33 0hz/yVX/wBV/wBJ3
462a0 41 41 39 75 51 41 78 6c 67 41 6c 63 77 41 5a 55 AA9uQAxlgAlcwAZU
462b0 4e 54 77 2f 37 48 69 2f 34 37 55 2f 32 76 47 2f NTw/7Hi/47U/2vG/
462c0 30 69 34 2f 79 57 71 2f 77 43 71 2f 77 43 53 33 0i4/yWq/wCq/wCS3
462d0 41 42 36 75 51 42 69 0a 6c 67 42 4b 63 77 41 79 AB6uQBi.lgBKcwAy
462e0 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f 2f 32 76 2f UNT//7H//47//2v/
462f0 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b 2f 67 44 63 /0j//yX//wD+/gDc
46300 33 41 43 35 75 51 43 57 6c 67 42 7a 63 77 42 51 3AC5uQCWlgBzcwBQ
46310 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f 31 47 76 2f UNT/8LH/4o7/1Gv/
46320 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 2f 71 67 44 .xkj/uCX/qgD/qgD
46330 63 6b 67 43 35 65 67 43 57 59 67 42 7a 53 67 42 ckgC5egCWYgBzSgB
46340 51 4d 74 54 2f 34 37 48 2f 78 34 37 2f 71 32 76 QMtT/47H/x47/q2v
46350 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 2f 56 51 44 /j0j/cyX/VwD/VQD
46360 63 53 51 43 35 50 51 43 57 0a 4d 51 42 7a 4a 51 cSQC5PQCW.MQBzJQ
46370 42 51 47 64 54 2f 31 4c 48 2f 73 59 37 2f 6a 6d BQGdT/1LH/sY7/jm
46380 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 44 2b 41 41 v/a0j/SCX/JQD+AA
46390 44 63 41 41 43 35 41 41 43 57 41 41 42 7a 41 41 DcAAC5AACWAABzAA
463a0 42 51 41 4f 50 2f 31 4d 66 2f 73 61 76 2f 6a 6f BQAOP/1Mf/sav/jo
463b0 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a 56 58 2f 41 //.a3P/SFf/JVX/A
463c0 45 6e 63 41 44 32 35 41 44 47 57 41 43 56 7a 41 EncAD25ADGWACVzA
463d0 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 64 54 2f 6a BlQAPD/1OL/sdT/j
463e0 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a 61 72 2f 41 sb/a7j/SKr/Jar/A
463f0 4a 4c 63 41 48 71 35 41 47 4b 57 0a 41 45 70 7a JLcAHq5AGKW.AEpz
46400 41 44 4a 51 41 50 2f 2f 31 50 2f 2f 73 66 2f 2f ADJQAP//1P//sf//
46410 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 37 2b jv//a///SP//Jf7+
46420 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 41 48 4e 7a ANzcALm5AJaWAHNz
46430 41 46 42 51 41 50 4c 79 38 75 62 6d 35 74 72 61 AFBQAPLy8ubm5tra
46440 32 73 37 4f 0a 7a 73 4c 43 77 72 61 32 74 71 71 2s7O.zsLCwra2tqq
46450 71 71 70 36 65 6e 70 4b 53 6b 6f 61 47 68 6e 70 qqp6enpKSkoaGhnp
46460 36 65 6d 35 75 62 6d 4a 69 59 6c 5a 57 56 6b 70 6em5ubmJiYlZWVkp
46470 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 6d 4a 68 6f KSj4+PjIyMiYmJho
46480 61 47 67 34 4f 44 76 2f 37 38 4b 43 67 0a 70 49 aGg4ODv/78KCg.pI
46490 43 41 67 50 38 41 41 41 44 2f 41 50 2f 2f 41 41 CAgP8AAAD/AP//AA
464a0 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 AA//8A/wD//////y
464b0 48 35 42 41 45 41 41 41 45 41 4c 41 41 41 41 41 H5BAEAAAEALAAAAA
464c0 41 55 41 42 51 41 51 41 69 47 41 41 4d 49 48 43 AUABQAQAiGAAMIHC
464d0 6a 77 6e 44 74 33 0a 35 77 67 71 4c 48 6a 51 48 jwnDt3.5wgqLHjQH
464e0 51 42 43 68 67 77 6c 41 74 41 77 34 63 49 41 42 QBChgwlAtAw4cIAB
464f0 68 39 47 6e 49 6a 77 49 73 4f 48 2f 79 49 65 55 h9GnIjwIsOH/yIeU
46500 6b 54 52 34 73 57 4d 45 43 57 57 39 44 67 51 4a kTR4sWMECWW9DgQJ
46510 63 6d 4f 4a 78 30 53 47 68 52 52 35 4b 47 52 0a cmOJx0SGhRR5KGR.
46520 4b 78 65 69 33 4a 6a 54 34 30 36 56 4d 48 30 36 Kxei3JjT406VMH06
46530 42 45 43 55 61 46 43 57 47 58 73 69 6c 66 6b 50 BECUaFCWGXsilfkP
46540 35 31 47 43 4b 47 6e 57 64 47 72 79 59 39 47 55 51GCKGnWdGryY9GU
46550 45 34 73 2b 78 66 69 54 34 37 6d 71 43 72 73 71 E4s+xfiT47mqCrsq
46560 31 53 6d 54 35 31 61 6f 0a 5a 59 47 43 44 65 76 1SmT51ao.ZYGCDev
46570 77 55 4b 4b 33 59 38 6b 32 50 4c 67 32 49 41 41 wUKK3Y8k2PLg2IAA
46580 37 0a 7d 0a 0a 69 6d 61 67 65 20 63 72 65 61 74 7.}..image creat
46590 65 20 70 68 6f 74 6f 20 6e 65 78 74 44 69 66 66 e photo nextDiff
465a0 49 6d 61 67 65 20 2d 66 6f 72 6d 61 74 20 67 69 Image -format gi
465b0 66 20 2d 64 61 74 61 20 7b 0a 52 30 6c 47 4f 44 f -data {.R0lGOD
465c0 64 68 46 41 41 55 41 50 66 2f 41 41 41 41 41 49 dhFAAUAPf/AAAAAI
465d0 41 41 41 41 43 41 41 49 43 41 41 41 41 41 67 49 AAAACAAICAAAAAgI
465e0 41 41 67 41 43 41 67 4d 44 41 77 4d 44 63 77 4b AAgACAgMDAwMDcwK
465f0 62 4b 38 50 2f 77 31 50 2f 69 73 66 2f 55 6a 76 bK8P/w1P/isf/Ujv
46600 2f 47 0a 61 2f 2b 34 53 50 2b 71 4a 66 2b 71 41 /G.a/+4SP+qJf+qA
46610 4e 79 53 41 4c 6c 36 41 4a 5a 69 41 48 4e 4b 41 NySALl6AJZiAHNKA
46620 46 41 79 41 50 2f 6a 31 50 2f 48 73 66 2b 72 6a FAyAP/j1P/Hsf+rj
46630 76 2b 50 61 2f 39 7a 53 50 39 58 4a 66 39 56 41 v+Pa/9zSP9XJf9VA
46640 4e 78 4a 41 4c 6b 39 41 4a 59 78 0a 41 48 4d 6c NxJALk9AJYx.AHMl
46650 41 46 41 5a 41 50 2f 55 31 50 2b 78 73 66 2b 4f AFAZAP/U1P+xsf+O
46660 6a 76 39 72 61 2f 39 49 53 50 38 6c 4a 66 34 41 jv9ra/9ISP8lJf4A
46670 41 4e 77 41 41 4c 6b 41 41 4a 59 41 41 48 4d 41 ANwAALkAAJYAAHMA
46680 41 46 41 41 41 50 2f 55 34 2f 2b 78 78 2f 2b 4f AFAAAP/U4/+xx/+O
46690 71 2f 39 72 0a 6a 2f 39 49 63 2f 38 6c 56 2f 38 q/9r.j/9Ic/8lV/8
466a0 41 56 64 77 41 53 62 6b 41 50 5a 59 41 4d 58 4d AVdwASbkAPZYAMXM
466b0 41 4a 56 41 41 47 66 2f 55 38 50 2b 78 34 76 2b AJVAAGf/U8P+x4v+
466c0 4f 31 50 39 72 78 76 39 49 75 50 38 6c 71 76 38 O1P9rxv9IuP8lqv8
466d0 41 71 74 77 41 6b 72 6b 41 65 70 59 41 0a 59 6e AqtwAkrkAepYA.Yn
466e0 4d 41 53 6c 41 41 4d 76 2f 55 2f 2f 2b 78 2f 2f MASlAAMv/U//+x//
466f0 2b 4f 2f 2f 39 72 2f 2f 39 49 2f 2f 38 6c 2f 2f +O//9r//9I//8l//
46700 34 41 2f 74 77 41 33 4c 6b 41 75 5a 59 41 6c 6e 4A/twA3LkAuZYAln
46710 4d 41 63 31 41 41 55 50 44 55 2f 2b 4b 78 2f 39 MAc1AAUPDU/+Kx/9
46720 53 4f 2f 38 5a 72 0a 2f 37 68 49 2f 36 6f 6c 2f SO/8Zr./7hI/6ol/
46730 36 6f 41 2f 35 49 41 33 48 6f 41 75 57 49 41 6c 6oA/5IA3HoAuWIAl
46740 6b 6f 41 63 7a 49 41 55 4f 50 55 2f 38 65 78 2f koAczIAUOPU/8ex/
46750 36 75 4f 2f 34 39 72 2f 33 4e 49 2f 31 63 6c 2f 6uO/49r/3NI/1cl/
46760 31 55 41 2f 30 6b 41 33 44 30 41 75 54 45 41 0a 1UA/0kA3D0AuTEA.
46770 6c 69 55 41 63 78 6b 41 55 4e 54 55 2f 37 47 78 liUAcxkAUNTU/7Gx
46780 2f 34 36 4f 2f 32 74 72 2f 30 68 49 2f 79 55 6c /46O/2tr/0hI/yUl
46790 2f 77 41 41 2f 67 41 41 33 41 41 41 75 51 41 41 /wAA/gAA3AAAuQAA
467a0 6c 67 41 41 63 77 41 41 55 4e 54 6a 2f 37 48 48 lgAAcwAAUNTj/7HH
467b0 2f 34 36 72 2f 32 75 50 0a 2f 30 68 7a 2f 79 56 /46r/2uP./0hz/yV
467c0 58 2f 77 42 56 2f 77 42 4a 33 41 41 39 75 51 41 X/wBV/wBJ3AA9uQA
467d0 78 6c 67 41 6c 63 77 41 5a 55 4e 54 77 2f 37 48 xlgAlcwAZUNTw/7H
467e0 69 2f 34 37 55 2f 32 76 47 2f 30 69 34 2f 79 57 i/47U/2vG/0i4/yW
467f0 71 2f 77 43 71 2f 77 43 53 33 41 42 36 75 51 42 q/wCq/wCS3AB6uQB
46800 69 0a 6c 67 42 4b 63 77 41 79 55 4e 54 2f 2f 37 i.lgBKcwAyUNT//7
46810 48 2f 2f 34 37 2f 2f 32 76 2f 2f 30 6a 2f 2f 79 H//47//2v//0j//y
46820 58 2f 2f 77 44 2b 2f 67 44 63 33 41 43 35 75 51 X//wD+/gDc3AC5uQ
46830 43 57 6c 67 42 7a 63 77 42 51 55 4e 54 2f 38 4c CWlgBzcwBQUNT/8L
46840 48 2f 34 6f 37 2f 31 47 76 2f 0a 78 6b 6a 2f 75 H/4o7/1Gv/.xkj/u
46850 43 58 2f 71 67 44 2f 71 67 44 63 6b 67 43 35 65 CX/qgD/qgDckgC5e
46860 67 43 57 59 67 42 7a 53 67 42 51 4d 74 54 2f 34 gCWYgBzSgBQMtT/4
46870 37 48 2f 78 34 37 2f 71 32 76 2f 6a 30 6a 2f 63 7H/x47/q2v/j0j/c
46880 79 58 2f 56 77 44 2f 56 51 44 63 53 51 43 35 50 yX/VwD/VQDcSQC5P
46890 51 43 57 0a 4d 51 42 7a 4a 51 42 51 47 64 54 2f QCW.MQBzJQBQGdT/
468a0 31 4c 48 2f 73 59 37 2f 6a 6d 76 2f 61 30 6a 2f 1LH/sY7/jmv/a0j/
468b0 53 43 58 2f 4a 51 44 2b 41 41 44 63 41 41 43 35 SCX/JQD+AADcAAC5
468c0 41 41 43 57 41 41 42 7a 41 41 42 51 41 4f 50 2f AACWAABzAABQAOP/
468d0 31 4d 66 2f 73 61 76 2f 6a 6f 2f 2f 0a 61 33 50 1Mf/sav/jo//.a3P
468e0 2f 53 46 66 2f 4a 56 58 2f 41 45 6e 63 41 44 32 /SFf/JVX/AEncAD2
468f0 35 41 44 47 57 41 43 56 7a 41 42 6c 51 41 50 44 5ADGWACVzABlQAPD
46900 2f 31 4f 4c 2f 73 64 54 2f 6a 73 62 2f 61 37 6a /1OL/sdT/jsb/a7j
46910 2f 53 4b 72 2f 4a 61 72 2f 41 4a 4c 63 41 48 71 /SKr/Jar/AJLcAHq
46920 35 41 47 4b 57 0a 41 45 70 7a 41 44 4a 51 41 50 5AGKW.AEpzADJQAP
46930 2f 2f 31 50 2f 2f 73 66 2f 2f 6a 76 2f 2f 61 2f //1P//sf//jv//a/
46940 2f 2f 53 50 2f 2f 4a 66 37 2b 41 4e 7a 63 41 4c //SP//Jf7+ANzcAL
46950 6d 35 41 4a 61 57 41 48 4e 7a 41 46 42 51 41 50 m5AJaWAHNzAFBQAP
46960 4c 79 38 75 62 6d 35 74 72 61 32 73 37 4f 0a 7a Ly8ubm5tra2s7O.z
46970 73 4c 43 77 72 61 32 74 71 71 71 71 70 36 65 6e sLCwra2tqqqqp6en
46980 70 4b 53 6b 6f 61 47 68 6e 70 36 65 6d 35 75 62 pKSkoaGhnp6em5ub
46990 6d 4a 69 59 6c 5a 57 56 6b 70 4b 53 6a 34 2b 50 mJiYlZWVkpKSj4+P
469a0 6a 49 79 4d 69 59 6d 4a 68 6f 61 47 67 34 4f 44 jIyMiYmJhoaGg4OD
469b0 76 2f 37 38 4b 43 67 0a 70 49 43 41 67 50 38 41 v/78KCg.pICAgP8A
469c0 41 41 44 2f 41 50 2f 2f 41 41 41 41 2f 2f 38 41 AAD/AP//AAAA//8A
469d0 2f 77 44 2f 2f 2f 2f 2f 2f 79 48 35 42 41 45 41 /wD//////yH5BAEA
469e0 41 41 45 41 4c 41 41 41 41 41 41 55 41 42 51 41 AAEALAAAAAAUABQA
469f0 51 41 69 47 41 41 4d 49 48 48 6a 4f 6e 63 47 44 QAiGAAMIHHjOncGD
46a00 0a 35 77 59 71 56 46 67 51 41 43 46 44 68 68 49 .5wYqVFgQACFDhhI
46a10 42 63 4a 64 77 49 55 4e 33 44 67 73 64 55 6a 53 BcJdwIUN3DgsdUjS
46a20 78 6f 6b 57 42 44 52 39 47 37 50 69 78 49 59 43 xokWBDR9G7PixIYC
46a30 54 49 69 57 65 4a 47 6d 78 34 54 39 43 68 41 36 TIiWeJGmx4T9ChA6
46a40 78 2f 42 67 67 4a 45 53 4a 0a 46 47 6e 57 74 44 x/BggJESJ.FGnWtD
46a50 6d 53 6f 73 65 4c 47 53 46 43 33 44 69 7a 4a 4d mSoseLGSFC3DizJM
46a60 61 69 4e 45 32 75 52 4c 72 51 35 55 32 6d 51 46 aiNE2uRLrQ5U2mQF
46a70 4e 43 4a 59 68 52 61 6b 36 64 50 48 48 2b 76 47 NCJYhRak6dPHH+vG
46a80 6a 51 34 56 4f 45 54 61 73 57 45 6d 72 6f 6b 46 jQ4VOETasWEmrokF
46a90 6d 4f 0a 56 36 4f 4f 4c 59 74 32 61 31 69 48 62 mO.V6OOLYt2a1iHb
46aa0 58 57 47 54 62 73 77 49 41 41 37 0a 7d 0a 0a 69 XWGTbswIAA7.}..i
46ab0 6d 61 67 65 20 63 72 65 61 74 65 20 70 68 6f 74 mage create phot
46ac0 6f 20 6c 61 73 74 44 69 66 66 49 6d 61 67 65 20 o lastDiffImage
46ad0 2d 66 6f 72 6d 61 74 20 67 69 66 20 2d 64 61 74 -format gif -dat
46ae0 61 20 7b 0a 52 30 6c 47 4f 44 6c 68 46 41 41 55 a {.R0lGODlhFAAU
46af0 41 50 63 41 41 41 41 41 41 49 41 41 41 41 43 41 APcAAAAAAIAAAACA
46b00 41 49 43 41 41 41 41 41 67 49 41 41 67 41 43 41 AICAAAAAgIAAgACA
46b10 67 4d 44 41 77 4d 44 63 77 4b 62 4b 38 50 2f 77 gMDAwMDcwKbK8P/w
46b20 31 50 2f 69 73 66 2f 55 6a 76 2f 47 0a 61 2f 2b 1P/isf/Ujv/G.a/+
46b30 34 53 50 2b 71 4a 66 2b 71 41 4e 79 53 41 4c 6c 4SP+qJf+qANySALl
46b40 36 41 4a 5a 69 41 48 4e 4b 41 46 41 79 41 50 2f 6AJZiAHNKAFAyAP/
46b50 6a 31 50 2f 48 73 66 2b 72 6a 76 2b 50 61 2f 39 j1P/Hsf+rjv+Pa/9
46b60 7a 53 50 39 58 4a 66 39 56 41 4e 78 4a 41 4c 6b zSP9XJf9VANxJALk
46b70 39 41 4a 59 78 0a 41 48 4d 6c 41 46 41 5a 41 50 9AJYx.AHMlAFAZAP
46b80 2f 55 31 50 2b 78 73 66 2b 4f 6a 76 39 72 61 2f /U1P+xsf+Ojv9ra/
46b90 39 49 53 50 38 6c 4a 66 34 41 41 4e 77 41 41 4c 9ISP8lJf4AANwAAL
46ba0 6b 41 41 4a 59 41 41 48 4d 41 41 46 41 41 41 50 kAAJYAAHMAAFAAAP
46bb0 2f 55 34 2f 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a /U4/+xx/+Oq/9r.j
46bc0 2f 39 49 63 2f 38 6c 56 2f 38 41 56 64 77 41 53 /9Ic/8lV/8AVdwAS
46bd0 62 6b 41 50 5a 59 41 4d 58 4d 41 4a 56 41 41 47 bkAPZYAMXMAJVAAG
46be0 66 2f 55 38 50 2b 78 34 76 2b 4f 31 50 39 72 78 f/U8P+x4v+O1P9rx
46bf0 76 39 49 75 50 38 6c 71 76 38 41 71 74 77 41 6b v9IuP8lqv8AqtwAk
46c00 72 6b 41 65 70 59 41 0a 59 6e 4d 41 53 6c 41 41 rkAepYA.YnMASlAA
46c10 4d 76 2f 55 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 Mv/U//+x//+O//9r
46c20 2f 2f 39 49 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 //9I//8l//4A/twA
46c30 33 4c 6b 41 75 5a 59 41 6c 6e 4d 41 63 31 41 41 3LkAuZYAlnMAc1AA
46c40 55 50 44 55 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 UPDU/+Kx/9SO/8Zr
46c50 0a 2f 37 68 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 ./7hI/6ol/6oA/5I
46c60 41 33 48 6f 41 75 57 49 41 6c 6b 6f 41 63 7a 49 A3HoAuWIAlkoAczI
46c70 41 55 4f 50 55 2f 38 65 78 2f 36 75 4f 2f 34 39 AUOPU/8ex/6uO/49
46c80 72 2f 33 4e 49 2f 31 63 6c 2f 31 55 41 2f 30 6b r/3NI/1cl/1UA/0k
46c90 41 33 44 30 41 75 54 45 41 0a 6c 69 55 41 63 78 A3D0AuTEA.liUAcx
46ca0 6b 41 55 4e 54 55 2f 37 47 78 2f 34 36 4f 2f 32 kAUNTU/7Gx/46O/2
46cb0 74 72 2f 30 68 49 2f 79 55 6c 2f 77 41 41 2f 67 tr/0hI/yUl/wAA/g
46cc0 41 41 33 41 41 41 75 51 41 41 6c 67 41 41 63 77 AA3AAAuQAAlgAAcw
46cd0 41 41 55 4e 54 6a 2f 37 48 48 2f 34 36 72 2f 32 AAUNTj/7HH/46r/2
46ce0 75 50 0a 2f 30 68 7a 2f 79 56 58 2f 77 42 56 2f uP./0hz/yVX/wBV/
46cf0 77 42 4a 33 41 41 39 75 51 41 78 6c 67 41 6c 63 wBJ3AA9uQAxlgAlc
46d00 77 41 5a 55 4e 54 77 2f 37 48 69 2f 34 37 55 2f wAZUNTw/7Hi/47U/
46d10 32 76 47 2f 30 69 34 2f 79 57 71 2f 77 43 71 2f 2vG/0i4/yWq/wCq/
46d20 77 43 53 33 41 42 36 75 51 42 69 0a 6c 67 42 4b wCS3AB6uQBi.lgBK
46d30 63 77 41 79 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f cwAyUNT//7H//47/
46d40 2f 32 76 2f 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b /2v//0j//yX//wD+
46d50 2f 67 44 63 33 41 43 35 75 51 43 57 6c 67 42 7a /gDc3AC5uQCWlgBz
46d60 63 77 42 51 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f cwBQUNT/8LH/4o7/
46d70 31 47 76 2f 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 1Gv/.xkj/uCX/qgD
46d80 2f 71 67 44 63 6b 67 43 35 65 67 43 57 59 67 42 /qgDckgC5egCWYgB
46d90 7a 53 67 42 51 4d 74 54 2f 34 37 48 2f 78 34 37 zSgBQMtT/47H/x47
46da0 2f 71 32 76 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 /q2v/j0j/cyX/VwD
46db0 2f 56 51 44 63 53 51 43 35 50 51 43 57 0a 4d 51 /VQDcSQC5PQCW.MQ
46dc0 42 7a 4a 51 42 51 47 64 54 2f 31 4c 48 2f 73 59 BzJQBQGdT/1LH/sY
46dd0 37 2f 6a 6d 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 7/jmv/a0j/SCX/JQ
46de0 44 2b 41 41 44 63 41 41 43 35 41 41 43 57 41 41 D+AADcAAC5AACWAA
46df0 42 7a 41 41 42 51 41 4f 50 2f 31 4d 66 2f 73 61 BzAABQAOP/1Mf/sa
46e00 76 2f 6a 6f 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a v/jo//.a3P/SFf/J
46e10 56 58 2f 41 45 6e 63 41 44 32 35 41 44 47 57 41 VX/AEncAD25ADGWA
46e20 43 56 7a 41 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 CVzABlQAPD/1OL/s
46e30 64 54 2f 6a 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a dT/jsb/a7j/SKr/J
46e40 61 72 2f 41 4a 4c 63 41 48 71 35 41 47 4b 57 0a ar/AJLcAHq5AGKW.
46e50 41 45 70 7a 41 44 4a 51 41 50 2f 2f 31 50 2f 2f AEpzADJQAP//1P//
46e60 73 66 2f 2f 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f sf//jv//a///SP//
46e70 4a 66 37 2b 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 Jf7+ANzcALm5AJaW
46e80 41 48 4e 7a 41 46 42 51 41 50 4c 79 38 75 62 6d AHNzAFBQAPLy8ubm
46e90 35 74 72 61 32 73 37 4f 0a 7a 73 4c 43 77 72 61 5tra2s7O.zsLCwra
46ea0 32 74 71 71 71 71 70 36 65 6e 70 4b 53 6b 6f 61 2tqqqqp6enpKSkoa
46eb0 47 68 6e 70 36 65 6d 35 75 62 6d 4a 69 59 6c 5a Ghnp6em5ubmJiYlZ
46ec0 57 56 6b 70 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 WVkpKSj4+PjIyMiY
46ed0 6d 4a 68 6f 61 47 67 34 4f 44 76 2f 37 38 4b 43 mJhoaGg4ODv/78KC
46ee0 67 0a 70 49 43 41 67 50 38 41 41 41 44 2f 41 50 g.pICAgP8AAAD/AP
46ef0 2f 2f 41 41 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f //AAAA//8A/wD///
46f00 2f 2f 2f 79 48 35 42 41 45 41 41 41 45 41 4c 41 ///yH5BAEAAAEALA
46f10 41 41 41 41 41 55 41 42 51 41 41 41 69 54 41 41 AAAAAUABQAAAiTAA
46f20 4d 49 48 48 6a 4f 6e 63 47 44 0a 35 77 59 71 56 MIHHjOncGD.5wYqV
46f30 46 67 51 67 4d 4f 48 37 68 49 75 5a 4f 67 4f 77 FgQgMOH7hIuZOgOw
46f40 44 39 43 68 41 34 42 69 44 69 52 6f 6b 56 44 68 D9ChA4BiDiRokVDh
46f50 68 4a 74 6c 4e 67 78 51 45 4e 43 49 45 56 79 4c hJtlNgxQENCIEVyL
46f60 47 6d 79 49 73 71 51 49 31 6d 65 4f 35 6c 79 4a GmyIsqQI1meO5lyJ
46f70 45 6d 4b 0a 42 67 47 38 56 47 6e 77 5a 73 75 48 EmK.BgG8VGnwZsuH
46f80 4f 6d 74 43 76 48 6d 79 45 45 69 51 68 35 49 71 OmtCvHmyEEiQh5Iq
46f90 69 75 6d 52 6b 4e 47 6a 68 35 61 75 58 46 67 55 iumRkNGjh5auXFgU
46fa0 71 56 53 66 54 51 74 46 5a 53 72 54 35 56 57 57 qVSfTQtFZSrT5VWW
46fb0 48 72 6d 43 46 56 68 77 61 6b 6c 33 0a 39 64 4b HrmCFVhwakl3.9dK
46fc0 71 58 5a 76 57 33 63 52 36 46 31 38 65 6e 56 76 qXZvW3cR6F18enVv
46fd0 76 37 62 2b 35 65 45 48 57 58 59 69 57 72 56 2b v7b+5eEHWXYiWrV+
46fe0 33 41 67 4d 43 41 44 73 3d 0a 7d 0a 0a 69 6d 61 3AgMCADs=.}..ima
46ff0 67 65 20 63 72 65 61 74 65 20 70 68 6f 74 6f 20 ge create photo
47000 72 65 64 69 66 66 49 6d 61 67 65 20 2d 66 6f 72 rediffImage -for
47010 6d 61 74 20 67 69 66 20 2d 64 61 74 61 20 7b 0a mat gif -data {.
47020 52 30 6c 47 4f 44 64 68 46 41 41 55 41 50 66 2f R0lGODdhFAAUAPf/
47030 41 41 41 41 41 49 41 41 41 41 43 41 41 49 43 41 AAAAAIAAAACAAICA
47040 41 41 41 41 67 49 41 41 67 41 43 41 67 4d 44 41 AAAAgIAAgACAgMDA
47050 77 4d 44 63 77 4b 62 4b 38 50 2f 77 31 50 2f 69 wMDcwKbK8P/w1P/i
47060 73 66 2f 55 6a 76 2f 47 0a 61 2f 2b 34 53 50 2b sf/Ujv/G.a/+4SP+
47070 71 4a 66 2b 71 41 4e 79 53 41 4c 6c 36 41 4a 5a qJf+qANySALl6AJZ
47080 69 41 48 4e 4b 41 46 41 79 41 50 2f 6a 31 50 2f iAHNKAFAyAP/j1P/
47090 48 73 66 2b 72 6a 76 2b 50 61 2f 39 7a 53 50 39 Hsf+rjv+Pa/9zSP9
470a0 58 4a 66 39 56 41 4e 78 4a 41 4c 6b 39 41 4a 59 XJf9VANxJALk9AJY
470b0 78 0a 41 48 4d 6c 41 46 41 5a 41 50 2f 55 31 50 x.AHMlAFAZAP/U1P
470c0 2b 78 73 66 2b 4f 6a 76 39 72 61 2f 39 49 53 50 +xsf+Ojv9ra/9ISP
470d0 38 6c 4a 66 34 41 41 4e 77 41 41 4c 6b 41 41 4a 8lJf4AANwAALkAAJ
470e0 59 41 41 48 4d 41 41 46 41 41 41 50 2f 55 34 2f YAAHMAAFAAAP/U4/
470f0 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 49 63 +xx/+Oq/9r.j/9Ic
47100 2f 38 6c 56 2f 38 41 56 64 77 41 53 62 6b 41 50 /8lV/8AVdwASbkAP
47110 5a 59 41 4d 58 4d 41 4a 56 41 41 47 66 2f 55 38 ZYAMXMAJVAAGf/U8
47120 50 2b 78 34 76 2b 4f 31 50 39 72 78 76 39 49 75 P+x4v+O1P9rxv9Iu
47130 50 38 6c 71 76 38 41 71 74 77 41 6b 72 6b 41 65 P8lqv8AqtwAkrkAe
47140 70 59 41 0a 59 6e 4d 41 53 6c 41 41 4d 76 2f 55 pYA.YnMASlAAMv/U
47150 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 //+x//+O//9r//9I
47160 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 33 4c 6b 41 //8l//4A/twA3LkA
47170 75 5a 59 41 6c 6e 4d 41 63 31 41 41 55 50 44 55 uZYAlnMAc1AAUPDU
47180 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 0a 2f 37 68 /+Kx/9SO/8Zr./7h
47190 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 41 33 48 6f I/6ol/6oA/5IA3Ho
471a0 41 75 57 49 41 6c 6b 6f 41 63 7a 49 41 55 4f 50 AuWIAlkoAczIAUOP
471b0 55 2f 38 65 78 2f 36 75 4f 2f 34 39 72 2f 33 4e U/8ex/6uO/49r/3N
471c0 49 2f 31 63 6c 2f 31 55 41 2f 30 6b 41 33 44 30 I/1cl/1UA/0kA3D0
471d0 41 75 54 45 41 0a 6c 69 55 41 63 78 6b 41 55 4e AuTEA.liUAcxkAUN
471e0 54 55 2f 37 47 78 2f 34 36 4f 2f 32 74 72 2f 30 TU/7Gx/46O/2tr/0
471f0 68 49 2f 79 55 6c 2f 77 41 41 2f 67 41 41 33 41 hI/yUl/wAA/gAA3A
47200 41 41 75 51 41 41 6c 67 41 41 63 77 41 41 55 4e AAuQAAlgAAcwAAUN
47210 54 6a 2f 37 48 48 2f 34 36 72 2f 32 75 50 0a 2f Tj/7HH/46r/2uP./
47220 30 68 7a 2f 79 56 58 2f 77 42 56 2f 77 42 4a 33 0hz/yVX/wBV/wBJ3
47230 41 41 39 75 51 41 78 6c 67 41 6c 63 77 41 5a 55 AA9uQAxlgAlcwAZU
47240 4e 54 77 2f 37 48 69 2f 34 37 55 2f 32 76 47 2f NTw/7Hi/47U/2vG/
47250 30 69 34 2f 79 57 71 2f 77 43 71 2f 77 43 53 33 0i4/yWq/wCq/wCS3
47260 41 42 36 75 51 42 69 0a 6c 67 42 4b 63 77 41 79 AB6uQBi.lgBKcwAy
47270 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f 2f 32 76 2f UNT//7H//47//2v/
47280 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b 2f 67 44 63 /0j//yX//wD+/gDc
47290 33 41 43 35 75 51 43 57 6c 67 42 7a 63 77 42 51 3AC5uQCWlgBzcwBQ
472a0 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f 31 47 76 2f UNT/8LH/4o7/1Gv/
472b0 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 2f 71 67 44 .xkj/uCX/qgD/qgD
472c0 63 6b 67 43 35 65 67 43 57 59 67 42 7a 53 67 42 ckgC5egCWYgBzSgB
472d0 51 4d 74 54 2f 34 37 48 2f 78 34 37 2f 71 32 76 QMtT/47H/x47/q2v
472e0 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 2f 56 51 44 /j0j/cyX/VwD/VQD
472f0 63 53 51 43 72 50 51 43 57 0a 4d 51 42 7a 4a 51 cSQCrPQCW.MQBzJQ
47300 42 51 47 64 54 2f 31 4c 48 2f 73 59 37 2f 6a 6d BQGdT/1LH/sY7/jm
47310 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 44 2b 41 41 v/a0j/SCX/JQD+AA
47320 44 63 41 41 43 35 41 41 43 57 41 41 42 7a 41 41 DcAAC5AACWAABzAA
47330 42 51 41 4f 50 2f 31 4d 66 2f 73 61 76 2f 6a 6f BQAOP/1Mf/sav/jo
47340 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a 56 58 2f 41 //.a3P/SFf/JVX/A
47350 45 6e 63 41 44 32 35 41 44 47 57 41 43 56 7a 41 EncAD25ADGWACVzA
47360 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 64 54 2f 6a BlQAPD/1OL/sdT/j
47370 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a 61 72 2f 41 sb/a7j/SKr/Jar/A
47380 4a 4c 63 41 48 71 35 41 47 4b 57 0a 41 45 70 7a JLcAHq5AGKW.AEpz
47390 41 44 4a 51 41 50 2f 2f 31 50 2f 2f 73 66 2f 2f ADJQAP//1P//sf//
473a0 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 37 2b jv//a///SP//Jf7+
473b0 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 41 48 4e 7a ANzcALm5AJaWAHNz
473c0 41 46 42 51 41 50 4c 79 38 75 62 6d 35 74 72 61 AFBQAPLy8ubm5tra
473d0 32 73 37 4f 0a 7a 73 4c 43 77 72 61 32 74 71 71 2s7O.zsLCwra2tqq
473e0 71 71 70 36 65 6e 70 4b 53 6b 6f 61 47 68 6e 70 qqp6enpKSkoaGhnp
473f0 36 65 6d 35 75 62 6d 4a 69 59 6c 5a 57 56 6b 70 6em5ubmJiYlZWVkp
47400 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 6d 4a 68 6f KSj4+PjIyMiYmJho
47410 61 47 67 34 4f 44 76 2f 37 38 4b 43 67 0a 70 49 aGg4ODv/78KCg.pI
47420 43 41 67 50 38 41 41 41 44 2f 41 50 2f 2f 41 41 CAgP8AAAD/AP//AA
47430 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 AA//8A/wD//////y
47440 48 35 42 41 45 41 41 41 45 41 4c 41 41 41 41 41 H5BAEAAAEALAAAAA
47450 41 55 41 42 51 41 51 41 69 63 41 41 4d 49 48 45 AUABQAQAicAAMIHE
47460 69 77 6f 4d 46 30 0a 37 41 44 30 65 75 56 4b 6c iwoMF0.7AD0euVKl
47470 38 4f 48 72 68 6a 71 41 67 44 76 6e 44 73 41 47 8OHrhjqAgDvnDsAG
47480 44 4f 6d 47 32 6a 52 33 54 6d 44 49 41 56 61 78 DOmG2jR3TmDIAVax
47490 46 69 52 6f 4d 4a 58 4b 46 2f 31 79 70 67 52 35 FiRoMJXKF/1ypgR5
474a0 55 71 50 49 57 4f 43 54 49 66 51 6e 63 32 62 0a UqPIWOCTIfQnc2b.
474b0 41 42 70 53 2f 42 67 67 33 63 6d 55 51 49 4f 71 ABpS/Bgg3cmUQIOq
474c0 42 48 42 78 49 55 70 59 41 44 59 4b 4c 45 71 55 BHBxIUpYADYKLEqU
474d0 70 38 79 6e 55 4b 4d 61 74 46 67 79 35 4c 6d 72 p8ynUKMatFgy5Lmr
474e0 57 45 64 4f 72 44 6f 51 49 63 75 76 72 6e 53 57 WEdOrDoQIcuvrnSW
474f0 50 4a 66 51 71 46 43 67 0a 59 68 50 43 41 74 71 PJfQqFCg.YhPCAtq
47500 72 72 64 75 55 4c 38 2f 39 66 49 57 55 4a 73 32 rrduUL8/9fIWUJs2
47510 4c 51 32 45 47 6d 46 74 33 34 4d 57 6d 42 4e 50 LQ2EGmFt34MWmBNP
47520 64 76 4b 6c 55 71 75 45 41 41 51 45 41 4f 77 3d dvKlUquEAAQEAOw=
47530 3d 0a 7d 0a 0a 69 6d 61 67 65 20 63 72 65 61 74 =.}..image creat
47540 65 20 70 68 6f 74 6f 20 6d 61 72 6b 53 65 74 49 e photo markSetI
47550 6d 61 67 65 20 2d 66 6f 72 6d 61 74 20 67 69 66 mage -format gif
47560 20 2d 64 61 74 61 20 7b 0a 52 30 6c 47 4f 44 6c -data {.R0lGODl
47570 68 46 41 41 55 41 50 63 41 41 41 41 41 41 49 41 hFAAUAPcAAAAAAIA
47580 41 41 41 43 41 41 49 43 41 41 41 41 41 67 49 41 AAACAAICAAAAAgIA
47590 41 67 41 43 41 67 4d 44 41 77 4d 44 63 77 4b 62 AgACAgMDAwMDcwKb
475a0 4b 38 50 2f 77 31 50 6a 69 73 64 2f 55 6a 74 48 K8P/w1Pjisd/UjtH
475b0 4a 0a 61 38 4f 34 53 4c 32 71 4a 63 57 71 41 4b J.a8O4SL2qJcWqAK
475c0 2b 53 41 4a 4e 36 41 47 4a 69 41 45 70 4b 41 44 +SAJN6AGJiAEpKAD
475d0 49 79 41 50 2f 6a 31 50 2f 48 73 66 2b 72 6a 76 IyAP/j1P/Hsf+rjv
475e0 2b 50 61 2f 39 7a 53 50 39 58 4a 66 39 56 41 4e +Pa/9zSP9XJf9VAN
475f0 78 4a 41 4c 6b 39 41 4a 59 78 0a 41 48 4d 6c 41 xJALk9AJYx.AHMlA
47600 46 41 5a 41 50 2f 55 31 50 2b 78 73 66 2b 4f 6a FAZAP/U1P+xsf+Oj
47610 76 39 72 61 2f 39 49 53 50 38 6c 4a 66 34 41 41 v9ra/9ISP8lJf4AA
47620 4e 77 41 41 4c 6b 41 41 4a 59 41 41 48 4d 41 41 NwAALkAAJYAAHMAA
47630 46 41 41 41 50 2f 55 34 2f 2b 78 78 2f 2b 4f 71 FAAAP/U4/+xx/+Oq
47640 2f 39 72 0a 6a 2f 39 49 63 2f 38 6c 56 2f 38 41 /9r.j/9Ic/8lV/8A
47650 56 64 77 41 53 62 6b 41 50 5a 59 41 4d 58 4d 41 VdwASbkAPZYAMXMA
47660 4a 56 41 41 47 66 2f 55 38 50 2b 78 34 76 2b 4f JVAAGf/U8P+x4v+O
47670 31 50 39 72 78 76 39 49 75 50 38 6c 71 76 38 41 1P9rxv9IuP8lqv8A
47680 71 74 77 41 6b 72 6b 41 65 70 59 41 0a 59 6e 4d qtwAkrkAepYA.YnM
47690 41 53 6c 41 41 4d 76 2f 55 2f 2f 2b 78 2f 2f 2b ASlAAMv/U//+x//+
476a0 4f 2f 2f 39 72 2f 2f 39 49 2f 2f 38 6c 2f 2f 34 O//9r//9I//8l//4
476b0 41 2f 74 77 41 33 4c 6b 41 75 5a 59 41 6c 6e 4d A/twA3LkAuZYAlnM
476c0 41 63 31 41 41 55 50 44 55 2f 2b 4b 78 2f 39 53 Ac1AAUPDU/+Kx/9S
476d0 4f 2f 38 5a 72 0a 2f 37 68 49 2f 36 6f 6c 2f 36 O/8Zr./7hI/6ol/6
476e0 6f 41 2f 35 49 41 33 48 6f 41 75 57 49 41 6c 6b oA/5IA3HoAuWIAlk
476f0 6f 41 63 7a 49 41 55 4f 50 55 2f 38 65 78 2f 36 oAczIAUOPU/8ex/6
47700 75 4f 2f 34 39 72 2f 33 4e 49 2f 31 63 6c 2f 31 uO/49r/3NI/1cl/1
47710 55 41 2f 30 6b 41 33 44 30 41 75 54 45 41 0a 6c UA/0kA3D0AuTEA.l
47720 69 55 41 63 78 6b 41 55 4e 54 55 2f 37 47 78 2f iUAcxkAUNTU/7Gx/
47730 34 36 4f 2f 32 74 72 2f 30 68 49 2f 79 55 6c 2f 46O/2tr/0hI/yUl/
47740 77 41 41 2f 67 41 41 33 41 41 41 75 51 41 41 6c wAA/gAA3AAAuQAAl
47750 67 41 41 63 77 41 41 55 4e 54 6a 2f 37 48 48 2f gAAcwAAUNTj/7HH/
47760 34 36 72 2f 32 75 50 0a 2f 30 68 7a 2f 79 56 58 46r/2uP./0hz/yVX
47770 2f 77 42 56 2f 77 42 4a 33 41 41 39 75 51 41 78 /wBV/wBJ3AA9uQAx
47780 6c 67 41 6c 63 77 41 5a 55 4e 54 77 2f 37 48 69 lgAlcwAZUNTw/7Hi
47790 2f 34 37 55 2f 32 76 47 2f 30 69 34 2f 79 57 71 /47U/2vG/0i4/yWq
477a0 2f 77 43 71 2f 77 43 53 33 41 42 36 75 51 42 69 /wCq/wCS3AB6uQBi
477b0 0a 6c 67 42 4b 63 77 41 79 55 4e 54 2f 2f 37 48 .lgBKcwAyUNT//7H
477c0 2f 2f 34 37 2f 2f 32 76 2f 2f 30 6a 2f 2f 79 58 //47//2v//0j//yX
477d0 2f 2f 77 44 2b 2f 67 44 63 33 41 43 35 75 51 43 //wD+/gDc3AC5uQC
477e0 57 6c 67 42 7a 63 77 42 51 55 4e 54 2f 38 4c 48 WlgBzcwBQUNT/8LH
477f0 2f 34 6f 37 2f 31 47 76 2f 0a 78 6b 6a 2f 75 43 /4o7/1Gv/.xkj/uC
47800 58 2f 71 67 44 2f 71 67 44 63 6b 67 43 35 65 67 X/qgD/qgDckgC5eg
47810 43 57 59 67 42 7a 53 67 42 51 4d 74 54 2f 34 37 CWYgBzSgBQMtT/47
47820 48 2f 78 34 37 2f 71 32 76 2f 6a 30 6a 2f 63 79 H/x47/q2v/j0j/cy
47830 58 2f 56 77 44 2f 56 51 44 63 53 51 43 35 50 51 X/VwD/VQDcSQC5PQ
47840 43 57 0a 4d 51 42 7a 4a 51 42 51 47 64 54 2f 31 CW.MQBzJQBQGdT/1
47850 4c 48 2f 73 59 37 2f 6a 6d 76 2f 61 30 6a 2f 53 LH/sY7/jmv/a0j/S
47860 43 58 2f 4a 51 44 2b 41 41 44 63 41 41 43 35 41 CX/JQD+AADcAAC5A
47870 41 43 57 41 41 42 7a 41 41 42 51 41 4f 50 2f 31 ACWAABzAABQAOP/1
47880 4d 66 2f 73 61 76 2f 6a 6f 2f 2f 0a 61 33 50 2f Mf/sav/jo//.a3P/
47890 53 46 66 2f 4a 56 58 2f 41 45 6e 63 41 44 32 35 SFf/JVX/AEncAD25
478a0 41 44 47 57 41 43 56 7a 41 42 6c 51 41 50 44 2f ADGWACVzABlQAPD/
478b0 31 4f 4c 2f 73 64 54 2f 6a 73 62 2f 61 37 6a 2f 1OL/sdT/jsb/a7j/
478c0 53 4b 72 2f 4a 61 72 2f 41 4a 4c 63 41 48 71 35 SKr/Jar/AJLcAHq5
478d0 41 47 4b 57 0a 41 45 70 7a 41 44 4a 51 41 50 2f AGKW.AEpzADJQAP/
478e0 2f 31 50 2f 2f 73 66 2f 2f 6a 76 2f 2f 61 2f 2f /1P//sf//jv//a//
478f0 2f 53 50 2f 2f 4a 66 37 2b 41 4e 7a 63 41 4c 6d /SP//Jf7+ANzcALm
47900 35 41 4a 61 57 41 48 4e 7a 41 46 42 51 41 50 4c 5AJaWAHNzAFBQAPL
47910 79 38 75 62 6d 35 74 72 61 32 73 37 4f 0a 7a 73 y8ubm5tra2s7O.zs
47920 4c 43 77 72 61 32 74 71 71 71 71 70 36 65 6e 70 LCwra2tqqqqp6enp
47930 4b 53 6b 6f 61 47 68 6e 70 36 65 6d 35 75 62 6d KSkoaGhnp6em5ubm
47940 4a 69 59 6c 5a 57 56 6b 70 4b 53 6a 34 2b 50 6a JiYlZWVkpKSj4+Pj
47950 49 79 4d 69 59 6d 4a 68 6f 61 47 67 34 4f 44 76 IyMiYmJhoaGg4ODv
47960 2f 37 38 4b 43 67 0a 70 49 43 41 67 50 38 41 41 /78KCg.pICAgP8AA
47970 41 44 2f 41 50 2f 2f 41 41 41 41 2f 2f 38 41 2f AD/AP//AAAA//8A/
47980 77 44 2f 2f 2f 2f 2f 2f 79 48 35 42 41 45 41 41 wD//////yH5BAEAA
47990 41 45 41 4c 41 41 41 41 41 41 55 41 42 51 41 41 AEALAAAAAAUABQAA
479a0 41 69 5a 41 41 4d 49 48 45 68 51 6f 4c 71 44 0a AiZAAMIHEhQoLqD.
479b0 43 41 73 71 46 41 69 67 49 51 42 33 44 64 30 74 CAsqFAigIQB3Dd0t
479c0 4e 4b 6a 4f 58 53 78 58 72 6d 41 42 57 42 41 42 NKjOXSxXrmABWBAB
479d0 67 4c 71 43 42 79 45 43 75 41 69 72 35 45 59 4a gLqCByECuAir5EYJ
479e0 48 69 6d 4b 76 4f 67 71 46 71 78 58 72 7a 5a 32 HimKvOgqFqxXrzZ2
479f0 6c 42 68 67 4a 55 61 59 0a 4c 56 2f 47 4f 70 6b lBhgJUaY.LV/GOpk
47a00 53 49 71 79 62 4f 46 33 43 6c 50 6c 51 49 45 53 SIqybOF3ClPlQIES
47a10 68 4d 46 2f 6c 66 4c 56 7a 41 63 71 50 52 68 73 hMF/lfLVzAcqPRhs
47a20 4b 58 52 71 54 59 31 47 43 46 61 55 79 31 63 6b KXRqTY1GCFaUy1ck
47a30 54 4b 6b 69 52 47 68 74 61 70 54 6b 78 61 38 32 TKkiRGhtapTkxa82
47a40 75 0a 45 78 55 53 4a 5a 73 32 71 74 4f 55 62 51 u.ExUSJZs2qtOUbQ
47a50 32 75 6a 54 73 51 34 6c 75 76 62 64 58 4e 70 52 2ujTsQ4luvbdXNpR
47a60 74 41 37 31 32 2b 55 65 45 43 37 6f 75 33 59 45 tA712+UeEC7ou3YE
47a70 41 41 41 44 74 3d 0a 7d 0a 0a 69 6d 61 67 65 20 AAADt=.}..image
47a80 63 72 65 61 74 65 20 70 68 6f 74 6f 20 6d 61 72 create photo mar
47a90 6b 43 6c 65 61 72 49 6d 61 67 65 20 2d 66 6f 72 kClearImage -for
47aa0 6d 61 74 20 67 69 66 20 2d 64 61 74 61 20 7b 0a mat gif -data {.
47ab0 52 30 6c 47 4f 44 6c 68 46 41 41 55 41 50 63 41 R0lGODlhFAAUAPcA
47ac0 41 41 41 41 41 49 41 41 41 41 43 41 41 49 43 41 AAAAAIAAAACAAICA
47ad0 41 41 41 41 67 49 41 41 67 41 43 41 67 4d 44 41 AAAAgIAAgACAgMDA
47ae0 77 4d 44 63 77 4b 62 4b 38 50 2f 77 31 50 6a 69 wMDcwKbK8P/w1Pji
47af0 73 64 2f 55 6a 74 48 4a 0a 61 38 4f 34 53 4c 32 sd/UjtHJ.a8O4SL2
47b00 71 4a 63 57 71 41 4b 2b 53 41 4a 4e 36 41 47 4a qJcWqAK+SAJN6AGJ
47b10 69 41 45 70 4b 41 44 49 79 41 50 2f 6a 31 50 2f iAEpKADIyAP/j1P/
47b20 48 73 66 2b 72 6a 76 2b 50 61 2f 39 7a 53 50 39 Hsf+rjv+Pa/9zSP9
47b30 58 4a 66 39 56 41 4e 78 4a 41 4c 6b 39 41 4a 59 XJf9VANxJALk9AJY
47b40 78 0a 41 48 4d 6c 41 46 41 5a 41 50 2f 55 31 50 x.AHMlAFAZAP/U1P
47b50 2b 78 73 66 2b 4f 6a 76 39 72 61 2f 39 49 53 50 +xsf+Ojv9ra/9ISP
47b60 38 6c 4a 66 34 41 41 4e 77 41 41 4c 6b 41 41 4a 8lJf4AANwAALkAAJ
47b70 59 41 41 48 4d 41 41 46 41 41 41 50 2f 55 34 2f YAAHMAAFAAAP/U4/
47b80 2b 78 78 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 49 63 +xx/+Oq/9r.j/9Ic
47b90 2f 38 6c 56 2f 38 41 56 64 77 41 53 62 6b 41 50 /8lV/8AVdwASbkAP
47ba0 5a 59 41 4d 58 4d 41 4a 56 41 41 47 66 2f 55 38 ZYAMXMAJVAAGf/U8
47bb0 50 2b 78 34 76 2b 4f 31 50 39 72 78 76 39 49 75 P+x4v+O1P9rxv9Iu
47bc0 50 38 6c 71 76 38 41 71 74 77 41 6b 72 6b 41 65 P8lqv8AqtwAkrkAe
47bd0 70 59 41 0a 59 6e 4d 41 53 6c 41 41 4d 76 2f 55 pYA.YnMASlAAMv/U
47be0 2f 2f 2b 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 //+x//+O//9r//9I
47bf0 2f 2f 38 6c 2f 2f 34 41 2f 74 77 41 33 4c 6b 41 //8l//4A/twA3LkA
47c00 75 5a 59 41 6c 6e 4d 41 63 31 41 41 55 50 44 55 uZYAlnMAc1AAUPDU
47c10 2f 2b 4b 78 2f 39 53 4f 2f 38 5a 72 0a 2f 37 68 /+Kx/9SO/8Zr./7h
47c20 49 2f 36 6f 6c 2f 36 6f 41 2f 35 49 41 33 48 6f I/6ol/6oA/5IA3Ho
47c30 41 75 57 49 41 6c 6b 6f 41 63 7a 49 41 55 4f 50 AuWIAlkoAczIAUOP
47c40 55 2f 38 65 78 2f 36 75 4f 2f 34 39 72 2f 33 4e U/8ex/6uO/49r/3N
47c50 49 2f 31 63 6c 2f 31 55 41 2f 30 6b 41 33 44 30 I/1cl/1UA/0kA3D0
47c60 41 75 54 45 41 0a 6c 69 55 41 63 78 6b 41 55 4e AuTEA.liUAcxkAUN
47c70 54 55 2f 37 47 78 2f 34 36 4f 2f 32 74 72 2f 30 TU/7Gx/46O/2tr/0
47c80 68 49 2f 79 55 6c 2f 77 41 41 2f 67 41 41 33 41 hI/yUl/wAA/gAA3A
47c90 41 41 75 51 41 41 6c 67 41 41 63 77 41 41 55 4e AAuQAAlgAAcwAAUN
47ca0 54 6a 2f 37 48 48 2f 34 36 72 2f 32 75 50 0a 2f Tj/7HH/46r/2uP./
47cb0 30 68 7a 2f 79 56 58 2f 77 42 56 2f 77 42 4a 33 0hz/yVX/wBV/wBJ3
47cc0 41 41 39 75 51 41 78 6c 67 41 6c 63 77 41 5a 55 AA9uQAxlgAlcwAZU
47cd0 4e 54 77 2f 37 48 69 2f 34 37 55 2f 32 76 47 2f NTw/7Hi/47U/2vG/
47ce0 30 69 34 2f 79 57 71 2f 77 43 71 2f 77 43 53 33 0i4/yWq/wCq/wCS3
47cf0 41 42 36 75 51 42 69 0a 6c 67 42 4b 63 77 41 79 AB6uQBi.lgBKcwAy
47d00 55 4e 54 2f 2f 37 48 2f 2f 34 37 2f 2f 32 76 2f UNT//7H//47//2v/
47d10 2f 30 6a 2f 2f 79 58 2f 2f 77 44 2b 2f 67 44 63 /0j//yX//wD+/gDc
47d20 33 41 43 35 75 51 43 57 6c 67 42 7a 63 77 42 51 3AC5uQCWlgBzcwBQ
47d30 55 4e 54 2f 38 4c 48 2f 34 6f 37 2f 31 47 76 2f UNT/8LH/4o7/1Gv/
47d40 0a 78 6b 6a 2f 75 43 58 2f 71 67 44 2f 71 67 44 .xkj/uCX/qgD/qgD
47d50 63 6b 67 43 35 65 67 43 57 59 67 42 7a 53 67 42 ckgC5egCWYgBzSgB
47d60 51 4d 74 54 2f 34 37 48 2f 78 34 37 2f 71 32 76 QMtT/47H/x47/q2v
47d70 2f 6a 30 6a 2f 63 79 58 2f 56 77 44 2f 56 51 44 /j0j/cyX/VwD/VQD
47d80 63 53 51 43 35 50 51 43 57 0a 4d 51 42 7a 4a 51 cSQC5PQCW.MQBzJQ
47d90 42 51 47 64 54 2f 31 4c 48 2f 73 59 37 2f 6a 6d BQGdT/1LH/sY7/jm
47da0 76 2f 61 30 6a 2f 53 43 58 2f 4a 51 44 2b 41 41 v/a0j/SCX/JQD+AA
47db0 44 63 41 41 43 35 41 41 43 57 41 41 42 7a 41 41 DcAAC5AACWAABzAA
47dc0 42 51 41 4f 50 2f 31 4d 66 2f 73 61 76 2f 6a 6f BQAOP/1Mf/sav/jo
47dd0 2f 2f 0a 61 33 50 2f 53 46 66 2f 4a 56 58 2f 41 //.a3P/SFf/JVX/A
47de0 45 6e 63 41 44 32 35 41 44 47 57 41 43 56 7a 41 EncAD25ADGWACVzA
47df0 42 6c 51 41 50 44 2f 31 4f 4c 2f 73 64 54 2f 6a BlQAPD/1OL/sdT/j
47e00 73 62 2f 61 37 6a 2f 53 4b 72 2f 4a 61 72 2f 41 sb/a7j/SKr/Jar/A
47e10 4a 4c 63 41 48 71 35 41 47 4b 57 0a 41 45 70 7a JLcAHq5AGKW.AEpz
47e20 41 44 4a 51 41 50 2f 2f 31 50 2f 2f 73 66 2f 2f ADJQAP//1P//sf//
47e30 6a 76 2f 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 37 2b jv//a///SP//Jf7+
47e40 41 4e 7a 63 41 4c 6d 35 41 4a 61 57 41 48 4e 7a ANzcALm5AJaWAHNz
47e50 41 46 42 51 41 50 4c 79 38 75 62 6d 35 74 72 61 AFBQAPLy8ubm5tra
47e60 32 73 37 4f 0a 7a 73 4c 43 77 72 61 32 74 71 71 2s7O.zsLCwra2tqq
47e70 71 71 70 36 65 6e 70 4b 53 6b 6f 61 47 68 6e 70 qqp6enpKSkoaGhnp
47e80 36 65 6d 35 75 62 6d 4a 69 59 6c 5a 57 56 6b 70 6em5ubmJiYlZWVkp
47e90 4b 53 6a 34 2b 50 6a 49 79 4d 69 59 6d 4a 68 6f KSj4+PjIyMiYmJho
47ea0 61 47 67 34 4f 44 76 2f 37 38 4b 43 67 0a 70 49 aGg4ODv/78KCg.pI
47eb0 43 41 67 50 38 41 41 41 44 2f 41 50 2f 2f 41 41 CAgP8AAAD/AP//AA
47ec0 41 41 2f 2f 38 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 AA//8A/wD//////y
47ed0 48 35 42 41 45 41 41 41 45 41 4c 41 41 41 41 41 H5BAEAAAEALAAAAA
47ee0 41 55 41 42 51 41 41 41 69 77 41 41 4d 49 48 45 AUABQAAAiwAAMIHE
47ef0 68 51 6f 4c 71 44 0a 43 41 73 43 57 4b 68 77 49 hQoLqD.CAsCWKhwI
47f00 62 79 46 41 4e 77 4e 58 42 69 44 34 55 46 33 73 byFANwNXBiD4UF3s
47f10 56 77 39 72 4c 68 51 58 51 43 4b 4e 54 67 75 7a Vw9rLhQXQCKNTguz
47f20 4c 67 78 5a 4d 65 50 4d 57 71 6f 35 4f 67 71 56 LgxZMePMWqo5OgqV
47f30 6b 6d 56 4e 77 41 49 58 48 68 44 70 55 6c 33 0a kmVNwAIXHhDpUl3.
47f40 37 67 43 6b 68 4d 6b 77 4a 30 32 62 48 48 66 57 7gCkhMkwJ02bHHfW
47f50 69 43 6b 7a 51 4d 35 59 50 31 63 4b 4a 65 70 52 iCkzQM5YP1cKJepR
47f60 6f 4d 2b 6b 4e 6f 63 75 6c 45 68 51 58 63 36 63 oM+kNoculEhQXc6c
47f70 4e 57 33 47 7a 4e 6d 30 6f 46 57 64 55 53 76 69 NW3GzNm0oFWdUSvi
47f80 4c 44 67 52 62 46 53 54 0a 52 52 73 75 7a 59 70 LDgRbFST.RRsuzYp
47f90 57 72 56 61 6f 48 4d 73 75 6a 59 67 56 4b 4d 4f WrVaoHMsujYgVKMO
47fa0 50 55 59 6b 43 57 50 43 51 62 59 32 69 50 2f 55 PUYkCWPCQbY2iP/U
47fb0 75 69 41 43 67 72 39 53 30 4e 44 76 75 6c 51 42 uiACgr9S0NDvulQB
47fc0 41 58 64 2b 37 5a 59 76 36 62 50 6f 77 4c 64 6d AXd+7ZYv6bPowLdm
47fd0 42 0a 42 79 38 4c 44 41 67 41 4f 77 3d 3d 0a 7d B.By8LDAgAOw==.}
47fe0 0a 0a 69 6d 61 67 65 20 63 72 65 61 74 65 20 70 ..image create p
47ff0 68 6f 74 6f 20 6d 65 72 67 65 43 68 6f 69 63 65 hoto mergeChoice
48000 31 49 6d 61 67 65 20 2d 66 6f 72 6d 61 74 20 67 1Image -format g
48010 69 66 20 2d 64 61 74 61 20 7b 0a 52 30 6c 47 4f if -data {.R0lGO
48020 44 64 68 46 41 41 55 41 50 66 2f 41 41 41 41 41 DdhFAAUAPf/AAAAA
48030 49 41 41 41 41 43 41 41 49 43 41 41 41 41 41 67 IAAAACAAICAAAAAg
48040 49 41 41 67 41 43 41 67 4d 44 41 77 4d 44 63 77 IAAgACAgMDAwMDcw
48050 4b 62 4b 38 50 2f 77 31 50 2f 69 73 66 2f 55 6a KbK8P/w1P/isf/Uj
48060 76 2f 47 0a 61 2f 2b 34 53 50 2b 71 4a 66 2b 71 v/G.a/+4SP+qJf+q
48070 41 4e 79 53 41 4c 6c 36 41 4a 5a 69 41 48 4e 4b ANySALl6AJZiAHNK
48080 41 46 41 79 41 50 2f 6a 31 50 2f 48 73 66 2b 72 AFAyAP/j1P/Hsf+r
48090 6a 76 2b 50 61 2f 39 7a 53 50 39 58 4a 66 39 56 jv+Pa/9zSP9XJf9V
480a0 41 4e 78 4a 41 4c 6b 39 41 4a 59 78 0a 41 48 4d ANxJALk9AJYx.AHM
480b0 6c 41 46 41 5a 41 50 2f 55 31 50 2b 78 73 66 2b lAFAZAP/U1P+xsf+
480c0 4f 6a 76 39 72 61 2f 39 49 53 50 38 6c 4a 66 34 Ojv9ra/9ISP8lJf4
480d0 41 41 4e 77 41 41 4c 6b 41 41 4a 59 41 41 48 4d AANwAALkAAJYAAHM
480e0 41 41 46 41 41 41 50 2f 55 34 2f 2b 78 78 2f 2b AAFAAAP/U4/+xx/+
480f0 4f 71 2f 39 72 0a 6a 2f 39 49 63 2f 38 6c 56 2f Oq/9r.j/9Ic/8lV/
48100 38 41 56 64 77 41 53 62 6b 41 50 5a 59 41 4d 58 8AVdwASbkAPZYAMX
48110 4d 41 4a 56 41 41 47 66 2f 55 38 50 2b 78 34 76 MAJVAAGf/U8P+x4v
48120 2b 4f 31 50 39 72 78 76 39 49 75 50 38 6c 71 76 +O1P9rxv9IuP8lqv
48130 38 41 71 74 77 41 6b 72 6b 41 65 70 59 41 0a 59 8AqtwAkrkAepYA.Y
48140 6e 4d 41 53 6c 41 41 4d 76 2f 55 2f 2f 2b 78 2f nMASlAAMv/U//+x/
48150 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 2f 2f 38 6c 2f /+O//9r//9I//8l/
48160 2f 34 41 2f 74 77 41 33 4c 6b 41 75 5a 59 41 6c /4A/twA3LkAuZYAl
48170 6e 4d 41 63 31 41 41 55 50 44 55 2f 2b 4b 78 2f nMAc1AAUPDU/+Kx/
48180 39 53 4f 2f 38 5a 72 0a 2f 37 68 49 2f 36 6f 6c 9SO/8Zr./7hI/6ol
48190 2f 36 6f 41 2f 35 49 41 33 48 6f 41 75 57 49 41 /6oA/5IA3HoAuWIA
481a0 6c 6b 6f 41 63 7a 49 41 55 4f 50 55 2f 38 65 78 lkoAczIAUOPU/8ex
481b0 2f 36 75 4f 2f 34 39 72 2f 33 4e 49 2f 31 63 6c /6uO/49r/3NI/1cl
481c0 2f 31 55 41 2f 30 6b 41 33 44 30 41 75 54 45 41 /1UA/0kA3D0AuTEA
481d0 0a 6c 69 55 41 63 78 6b 41 55 4e 54 55 2f 37 47 .liUAcxkAUNTU/7G
481e0 78 2f 34 36 4f 2f 32 74 72 2f 30 68 49 2f 79 55 x/46O/2tr/0hI/yU
481f0 6c 2f 77 41 41 2f 67 41 41 33 41 41 41 75 51 41 l/wAA/gAA3AAAuQA
48200 41 6c 67 41 41 63 77 41 41 55 4e 54 6a 2f 37 48 AlgAAcwAAUNTj/7H
48210 48 2f 34 36 72 2f 32 75 50 0a 2f 30 68 7a 2f 79 H/46r/2uP./0hz/y
48220 56 58 2f 77 42 56 2f 77 42 4a 33 41 41 39 75 51 VX/wBV/wBJ3AA9uQ
48230 41 78 6c 67 41 6c 63 77 41 5a 55 4e 54 77 2f 37 AxlgAlcwAZUNTw/7
48240 48 69 2f 34 37 55 2f 32 76 47 2f 30 69 34 2f 79 Hi/47U/2vG/0i4/y
48250 57 71 2f 77 43 71 2f 77 43 53 33 41 42 36 75 51 Wq/wCq/wCS3AB6uQ
48260 42 69 0a 6c 67 42 4b 63 77 41 79 55 4e 54 2f 2f Bi.lgBKcwAyUNT//
48270 37 48 2f 2f 34 37 2f 2f 32 76 2f 2f 30 6a 2f 2f 7H//47//2v//0j//
48280 79 58 2f 2f 77 44 2b 2f 67 44 63 33 41 43 35 75 yX//wD+/gDc3AC5u
48290 51 43 57 6c 67 42 7a 63 77 42 51 55 4e 54 2f 38 QCWlgBzcwBQUNT/8
482a0 4c 48 2f 34 6f 37 2f 31 47 76 2f 0a 78 6b 6a 2f LH/4o7/1Gv/.xkj/
482b0 75 43 58 2f 71 67 44 2f 71 67 44 63 6b 67 43 35 uCX/qgD/qgDckgC5
482c0 65 67 43 57 59 67 42 7a 53 67 42 51 4d 74 54 2f egCWYgBzSgBQMtT/
482d0 34 37 48 2f 78 34 37 2f 71 32 76 2f 6a 30 6a 2f 47H/x47/q2v/j0j/
482e0 63 79 58 2f 56 77 44 2f 56 51 44 63 53 51 43 35 cyX/VwD/VQDcSQC5
482f0 50 51 43 57 0a 4d 51 42 7a 4a 51 42 51 47 64 54 PQCW.MQBzJQBQGdT
48300 2f 31 4c 48 2f 73 59 37 2f 6a 6d 76 2f 61 30 6a /1LH/sY7/jmv/a0j
48310 2f 53 43 58 2f 4a 51 44 2b 41 41 44 63 41 41 43 /SCX/JQD+AADcAAC
48320 35 41 41 43 57 41 41 42 7a 41 41 42 51 41 4f 50 5AACWAABzAABQAOP
48330 2f 31 4d 66 2f 73 61 76 2f 6a 6f 2f 2f 0a 61 33 /1Mf/sav/jo//.a3
48340 50 2f 53 46 66 2f 4a 56 58 2f 41 45 6e 63 41 44 P/SFf/JVX/AEncAD
48350 32 35 41 44 47 57 41 43 56 7a 41 42 6c 51 41 50 25ADGWACVzABlQAP
48360 44 2f 31 4f 4c 2f 73 64 54 2f 6a 73 62 2f 61 37 D/1OL/sdT/jsb/a7
48370 6a 2f 53 4b 72 2f 4a 61 72 2f 41 4a 4c 63 41 48 j/SKr/Jar/AJLcAH
48380 71 35 41 47 4b 57 0a 41 45 70 7a 41 44 4a 51 41 q5AGKW.AEpzADJQA
48390 50 2f 2f 31 50 2f 2f 73 66 2f 2f 6a 76 2f 2f 61 P//1P//sf//jv//a
483a0 2f 2f 2f 53 50 2f 2f 4a 66 37 2b 41 4e 7a 63 41 ///SP//Jf7+ANzcA
483b0 4c 6d 35 41 4a 61 57 41 48 4e 7a 41 46 42 51 41 Lm5AJaWAHNzAFBQA
483c0 50 4c 79 38 75 62 6d 35 74 72 61 32 73 37 4f 0a PLy8ubm5tra2s7O.
483d0 7a 73 4c 43 77 72 61 32 74 71 71 71 71 70 36 65 zsLCwra2tqqqqp6e
483e0 6e 70 4b 53 6b 6f 61 47 68 6e 70 36 65 6d 35 75 npKSkoaGhnp6em5u
483f0 62 6d 4a 69 59 6c 5a 57 56 6b 70 4b 53 6a 34 2b bmJiYlZWVkpKSj4+
48400 50 6a 49 79 4d 69 59 6d 4a 68 6f 61 47 67 34 4f PjIyMiYmJhoaGg4O
48410 44 76 2f 37 38 4b 43 67 0a 70 49 43 41 67 50 38 Dv/78KCg.pICAgP8
48420 41 41 41 44 2f 41 50 2f 2f 41 41 41 41 2f 2f 38 AAAD/AP//AAAA//8
48430 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 48 35 42 41 45 A/wD//////yH5BAE
48440 41 41 41 45 41 4c 41 41 41 41 41 41 55 41 42 51 AAAEALAAAAAAUABQ
48450 41 51 41 69 49 41 41 4d 49 48 45 69 77 59 4d 46 AQAiIAAMIHEiwYMF
48460 7a 0a 37 67 41 51 2b 6d 65 6f 49 61 47 48 45 43 z.7gAQ+meoIaGHEC
48470 45 65 41 75 44 75 6f 44 74 33 35 77 78 71 46 49 EeAuDuoDt35wxqFI
48480 67 51 41 4d 57 4d 47 7a 6b 6d 56 48 52 6f 6f 73 gQAMWMGzkmVHRoos
48490 65 54 4b 44 31 57 50 41 67 79 35 4d 43 4f 68 41 eTKD1WPAgy5MCOhA
484a0 5a 52 76 45 69 7a 4a 73 61 52 0a 68 78 72 71 33 ZRvEizJsaR.hxrq3
484b0 4c 6b 7a 45 63 57 58 49 7a 2b 65 47 30 71 55 71 LkzEcWXIz+eG0qUq
484c0 4d 75 6a 53 4a 4d 69 78 4a 67 30 41 45 79 68 52 MujSJMixJg0AEyhR
484d0 59 75 4b 56 44 6a 49 55 4d 71 72 4d 78 55 79 35 YuKVDjIUMqrMxUy5
484e0 4d 6e 56 6b 4d 2b 62 41 45 67 61 4f 70 53 6f 72 MnVkM+bAEgaOpSor
484f0 4e 6d 7a 0a 58 36 65 53 6e 47 6d 7a 5a 6b 75 6e Nmz.X6eSnGmzZkun
48500 43 54 38 32 35 66 68 32 62 74 4b 41 41 44 74 3d CT825fh2btKAADt=
48510 0a 7d 0a 0a 69 6d 61 67 65 20 63 72 65 61 74 65 .}..image create
48520 20 70 68 6f 74 6f 20 6d 65 72 67 65 43 68 6f 69 photo mergeChoi
48530 63 65 32 49 6d 61 67 65 20 2d 66 6f 72 6d 61 74 ce2Image -format
48540 20 67 69 66 20 2d 64 61 74 61 20 7b 0a 52 30 6c gif -data {.R0l
48550 47 4f 44 64 68 46 41 41 55 41 50 66 2f 41 41 41 GODdhFAAUAPf/AAA
48560 41 41 49 41 41 41 41 43 41 41 49 43 41 41 41 41 AAIAAAACAAICAAAA
48570 41 67 49 41 41 67 41 43 41 67 4d 44 41 77 4d 44 AgIAAgACAgMDAwMD
48580 63 77 4b 62 4b 38 50 2f 77 31 50 2f 69 73 66 2f cwKbK8P/w1P/isf/
48590 55 6a 76 2f 47 0a 61 2f 2b 34 53 50 2b 71 4a 66 Ujv/G.a/+4SP+qJf
485a0 2b 71 41 4e 79 53 41 4c 6c 36 41 4a 5a 69 41 48 +qANySALl6AJZiAH
485b0 4e 4b 41 46 41 79 41 50 2f 6a 31 50 2f 48 73 66 NKAFAyAP/j1P/Hsf
485c0 2b 72 6a 76 2b 50 61 2f 39 7a 53 50 39 58 4a 66 +rjv+Pa/9zSP9XJf
485d0 39 56 41 4e 78 4a 41 4c 6b 39 41 4a 59 78 0a 41 9VANxJALk9AJYx.A
485e0 48 4d 6c 41 46 41 5a 41 50 2f 55 31 50 2b 78 73 HMlAFAZAP/U1P+xs
485f0 66 2b 4f 6a 76 39 72 61 2f 39 49 53 50 38 6c 4a f+Ojv9ra/9ISP8lJ
48600 66 34 41 41 4e 77 41 41 4c 6b 41 41 4a 59 41 41 f4AANwAALkAAJYAA
48610 48 4d 41 41 46 41 41 41 50 2f 55 34 2f 2b 78 78 HMAAFAAAP/U4/+xx
48620 2f 2b 4f 71 2f 39 72 0a 6a 2f 39 49 63 2f 38 6c /+Oq/9r.j/9Ic/8l
48630 56 2f 38 41 56 64 77 41 53 62 6b 41 50 5a 59 41 V/8AVdwASbkAPZYA
48640 4d 58 4d 41 4a 56 41 41 47 66 2f 55 38 50 2b 78 MXMAJVAAGf/U8P+x
48650 34 76 2b 4f 31 50 39 72 78 76 39 49 75 50 38 6c 4v+O1P9rxv9IuP8l
48660 71 76 38 41 71 74 77 41 6b 72 6b 41 65 70 59 41 qv8AqtwAkrkAepYA
48670 0a 59 6e 4d 41 53 6c 41 41 4d 76 2f 55 2f 2f 2b .YnMASlAAMv/U//+
48680 78 2f 2f 2b 4f 2f 2f 39 72 2f 2f 39 49 2f 2f 38 x//+O//9r//9I//8
48690 6c 2f 2f 34 41 2f 74 77 41 33 4c 6b 41 75 5a 59 l//4A/twA3LkAuZY
486a0 41 6c 6e 4d 41 63 31 41 41 55 50 44 55 2f 2b 4b AlnMAc1AAUPDU/+K
486b0 78 2f 39 53 4f 2f 38 5a 72 0a 2f 37 68 49 2f 36 x/9SO/8Zr./7hI/6
486c0 6f 6c 2f 36 6f 41 2f 35 49 41 33 48 6f 41 75 57 ol/6oA/5IA3HoAuW
486d0 49 41 6c 6b 6f 41 63 7a 49 41 55 4f 50 55 2f 38 IAlkoAczIAUOPU/8
486e0 65 78 2f 36 75 4f 2f 34 39 72 2f 33 4e 49 2f 31 ex/6uO/49r/3NI/1
486f0 63 6c 2f 31 55 41 2f 30 6b 41 33 44 30 41 75 54 cl/1UA/0kA3D0AuT
48700 45 41 0a 6c 69 55 41 63 78 6b 41 55 4e 54 55 2f EA.liUAcxkAUNTU/
48710 37 47 78 2f 34 36 4f 2f 32 74 72 2f 30 68 49 2f 7Gx/46O/2tr/0hI/
48720 79 55 6c 2f 77 41 41 2f 67 41 41 33 41 41 41 75 yUl/wAA/gAA3AAAu
48730 51 41 41 6c 67 41 41 63 77 41 41 55 4e 54 6a 2f QAAlgAAcwAAUNTj/
48740 37 48 48 2f 34 36 72 2f 32 75 50 0a 2f 30 68 7a 7HH/46r/2uP./0hz
48750 2f 79 56 58 2f 77 42 56 2f 77 42 4a 33 41 41 39 /yVX/wBV/wBJ3AA9
48760 75 51 41 78 6c 67 41 6c 63 77 41 5a 55 4e 54 77 uQAxlgAlcwAZUNTw
48770 2f 37 48 69 2f 34 37 55 2f 32 76 47 2f 30 69 34 /7Hi/47U/2vG/0i4
48780 2f 79 57 71 2f 77 43 71 2f 77 43 53 33 41 42 36 /yWq/wCq/wCS3AB6
48790 75 51 42 69 0a 6c 67 42 4b 63 77 41 79 55 4e 54 uQBi.lgBKcwAyUNT
487a0 2f 2f 37 48 2f 2f 34 37 2f 2f 32 76 2f 2f 30 6a //7H//47//2v//0j
487b0 2f 2f 79 58 2f 2f 77 44 2b 2f 67 44 63 33 41 43 //yX//wD+/gDc3AC
487c0 35 75 51 43 57 6c 67 42 7a 63 77 42 51 55 4e 54 5uQCWlgBzcwBQUNT
487d0 2f 38 4c 48 2f 34 6f 37 2f 31 47 76 2f 0a 78 6b /8LH/4o7/1Gv/.xk
487e0 6a 2f 75 43 58 2f 71 67 44 2f 71 67 44 63 6b 67 j/uCX/qgD/qgDckg
487f0 43 35 65 67 43 57 59 67 42 7a 53 67 42 51 4d 74 C5egCWYgBzSgBQMt
48800 54 2f 34 37 48 2f 78 34 37 2f 71 32 76 2f 6a 30 T/47H/x47/q2v/j0
48810 6a 2f 63 79 58 2f 56 77 44 2f 56 51 44 63 53 51 j/cyX/VwD/VQDcSQ
48820 43 35 50 51 43 57 0a 4d 51 42 7a 4a 51 42 51 47 C5PQCW.MQBzJQBQG
48830 64 54 2f 31 4c 48 2f 73 59 37 2f 6a 6d 76 2f 61 dT/1LH/sY7/jmv/a
48840 30 6a 2f 53 43 58 2f 4a 51 44 2b 41 41 44 63 41 0j/SCX/JQD+AADcA
48850 41 43 35 41 41 43 57 41 41 42 7a 41 41 42 51 41 AC5AACWAABzAABQA
48860 4f 50 2f 31 4d 66 2f 73 61 76 2f 6a 6f 2f 2f 0a OP/1Mf/sav/jo//.
48870 61 33 50 2f 53 46 66 2f 4a 56 58 2f 41 45 6e 63 a3P/SFf/JVX/AEnc
48880 41 44 32 35 41 44 47 57 41 43 56 7a 41 42 6c 51 AD25ADGWACVzABlQ
48890 41 50 44 2f 31 4f 4c 2f 73 64 54 2f 6a 73 62 2f APD/1OL/sdT/jsb/
488a0 61 37 6a 2f 53 4b 72 2f 4a 61 72 2f 41 4a 4c 63 a7j/SKr/Jar/AJLc
488b0 41 48 71 35 41 47 4b 57 0a 41 45 70 7a 41 44 4a AHq5AGKW.AEpzADJ
488c0 51 41 50 2f 2f 31 50 2f 2f 73 66 2f 2f 6a 76 2f QAP//1P//sf//jv/
488d0 2f 61 2f 2f 2f 53 50 2f 2f 4a 66 37 2b 41 4e 7a /a///SP//Jf7+ANz
488e0 63 41 4c 6d 35 41 4a 61 57 41 48 4e 7a 41 46 42 cALm5AJaWAHNzAFB
488f0 51 41 50 4c 79 38 75 62 6d 35 74 72 61 32 73 37 QAPLy8ubm5tra2s7
48900 4f 0a 7a 73 4c 43 77 72 61 32 74 71 71 71 71 70 O.zsLCwra2tqqqqp
48910 36 65 6e 70 4b 53 6b 6f 61 47 68 6e 70 36 65 6d 6enpKSkoaGhnp6em
48920 35 75 62 6d 4a 69 59 6c 5a 57 56 6b 70 4b 53 6a 5ubmJiYlZWVkpKSj
48930 34 2b 50 6a 49 79 4d 69 59 6d 4a 68 6f 61 47 67 4+PjIyMiYmJhoaGg
48940 34 4f 44 76 2f 37 38 4b 43 67 0a 70 49 43 41 67 4ODv/78KCg.pICAg
48950 50 38 41 41 41 44 2f 41 50 2f 2f 41 41 41 41 2f P8AAAD/AP//AAAA/
48960 2f 38 41 2f 77 44 2f 2f 2f 2f 2f 2f 79 48 35 42 /8A/wD//////yH5B
48970 41 45 41 41 41 45 41 4c 41 41 41 41 41 41 55 41 AEAAAEALAAAAAAUA
48980 42 51 41 51 41 69 4e 41 41 4d 49 48 45 69 77 59 BQAQAiNAAMIHEiwY
48990 45 46 33 0a 41 50 37 39 47 7a 53 49 6b 4d 4f 48 EF3.AP79GzSIkMOH
489a0 68 41 77 5a 4b 6b 51 49 67 4c 74 7a 42 67 75 65 hAwZKkQIgLtzBgue
489b0 63 33 63 78 6f 38 65 4e 41 43 78 69 48 49 67 77 c3cxo8eNACxiHIgw
489c0 70 4d 6d 54 49 51 38 64 55 69 54 53 6f 38 61 52 pMmTIQ8dUiTSo8aR
489d0 42 44 64 79 6e 45 6b 54 49 63 57 57 0a 41 52 42 BDdynEkTIcWW.ARB
489e0 47 6c 4d 69 7a 4a 38 2b 56 46 67 4f 63 47 30 71 GlMizJ8+VFgOcG0q
489f0 30 4b 45 4b 57 48 56 30 71 58 63 70 30 71 55 79 0KEKWHV0qXcp0qUy
48a00 59 41 34 74 4b 42 56 6b 78 61 55 36 55 57 41 46 YA4tKBVkxaU6UWAF
48a10 4d 72 49 6f 52 34 53 43 66 59 43 58 65 35 41 6a MrIoR4SCfYCXe5Aj
48a20 67 55 4b 4b 7a 0a 61 4e 4d 65 4d 67 54 30 6f 73 gUKKz.aNMeMgT0os
48a30 79 61 4e 4d 73 69 68 66 71 78 70 4e 57 6d 51 35 yaNMsihfqxpNWmQ5
48a40 73 32 44 51 67 41 4f 77 3d 3d 0a 7d 0a 0a 69 6d s2DQgAOw==.}..im
48a50 61 67 65 20 63 72 65 61 74 65 20 70 68 6f 74 6f age create photo
48a60 20 6d 65 72 67 65 43 68 6f 69 63 65 31 32 49 6d mergeChoice12Im
48a70 61 67 65 20 2d 66 6f 72 6d 61 74 20 67 69 66 20 age -format gif
48a80 2d 64 61 74 61 20 7b 0a 52 30 6c 47 4f 44 6c 68 -data {.R0lGODlh
48a90 46 41 41 55 41 50 4d 48 41 41 41 41 41 41 42 36 FAAUAPMHAAAAAAB6
48aa0 75 51 43 53 33 43 57 71 2f 30 69 34 2f 34 37 55 uQCS3CWq/0i4/47U
48ab0 2f 37 48 69 2f 2f 2f 2f 2f 37 32 39 76 51 41 41 /7Hi/////729vQAA
48ac0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
48ad0 41 41 41 41 0a 41 41 41 41 41 43 48 35 42 41 45 AAAA.AAAAACH5BAE
48ae0 41 41 41 67 41 4c 41 41 41 41 41 41 55 41 42 51 AAAgALAAAAAAUABQ
48af0 41 41 41 54 2b 45 43 47 45 45 43 67 41 49 59 51 AAAT+ECGEECgAIYQ
48b00 51 67 67 67 68 68 42 42 43 43 49 46 69 41 45 51 QggghhBBCCIFiAEQ
48b10 49 49 59 51 51 51 67 67 68 68 43 41 43 78 52 41 IIYQQQgghhCACxRA
48b20 41 0a 41 41 41 41 41 41 41 42 41 41 67 68 55 41 A.AAAAAAABAAghUA
48b30 34 68 70 42 52 59 53 69 6d 6c 6c 41 45 51 41 75 4hpBRYSimllAEQAu
48b40 56 41 51 67 67 68 68 42 42 43 43 43 45 43 41 6f VAQgghhBBCCCECAo
48b50 52 41 47 49 51 51 51 67 67 68 6b 42 42 43 69 41 RAGIQQQgghkBBCiA
48b60 41 49 49 52 41 47 67 55 4d 49 49 59 51 51 0a 51 AIIRAGgUMIIYQQ.Q
48b70 67 67 42 45 45 51 49 67 54 41 47 41 41 41 41 41 ggBEEQIgTAGAAAAA
48b80 43 41 41 41 41 43 45 45 45 49 67 44 41 41 52 51 CAAAACEEEIgDAARQ
48b90 67 67 68 68 42 42 43 43 43 47 49 45 41 49 42 49 gghhBBCCCGIEAIBI
48ba0 49 51 51 51 67 68 42 68 42 42 43 43 43 47 45 45 IQQQghBhBBCCCGEE
48bb0 45 49 49 49 67 51 4b 51 41 67 68 0a 68 42 42 43 EIIIgQKQAgh.hBBC
48bc0 45 43 47 45 45 45 49 49 6d 41 49 51 67 67 67 68 ECGEEEIImAIQgggh
48bd0 41 41 41 41 41 41 41 41 41 41 54 45 46 49 41 51 AAAAAAAAAATEFIAQ
48be0 51 6d 43 55 55 6d 41 70 70 5a 52 43 43 44 6b 46 QmCUUmAppZRCCDkF
48bf0 49 41 51 52 45 49 51 51 51 67 67 68 68 42 42 49 IAQREIQQQgghhBBI
48c00 79 43 6b 41 49 53 41 49 0a 49 59 52 41 51 67 67 yCkAISAI.IYRAQgg
48c10 68 68 4a 41 52 41 45 49 41 43 69 47 45 45 45 49 hhJARAEIACiGEEEI
48c20 49 49 51 59 5a 4d 41 43 45 45 41 41 41 41 41 41 IIQYZMACEEAAAAAA
48c30 41 67 41 43 41 4d 51 4a 41 43 43 47 45 45 45 51 AgACAMQJACCGEEEQ
48c40 49 49 59 51 51 41 69 4d 41 68 43 41 50 51 67 67 IIYQQAiMAhCAPQgg
48c50 68 68 42 42 43 0a 43 43 45 45 51 51 41 49 49 59 hhBBC.CCEEQQAIIY
48c60 51 69 41 44 73 3d 0a 7d 0a 0a 69 6d 61 67 65 20 QiADs=.}..image
48c70 63 72 65 61 74 65 20 70 68 6f 74 6f 20 6d 65 72 create photo mer
48c80 67 65 43 68 6f 69 63 65 32 31 49 6d 61 67 65 20 geChoice21Image
48c90 2d 66 6f 72 6d 61 74 20 67 69 66 20 2d 64 61 74 -format gif -dat
48ca0 61 20 7b 0a 52 30 6c 47 4f 44 6c 68 46 41 41 55 a {.R0lGODlhFAAU
48cb0 41 50 4d 48 41 41 41 41 41 41 42 36 75 51 43 53 APMHAAAAAAB6uQCS
48cc0 33 43 57 71 2f 30 69 34 2f 34 37 55 2f 37 48 69 3CWq/0i4/47U/7Hi
48cd0 2f 2f 2f 2f 2f 37 32 39 76 51 41 41 41 41 41 41 /////729vQAAAAAA
48ce0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
48cf0 0a 41 41 41 41 41 43 48 35 42 41 45 41 41 41 67 .AAAAACH5BAEAAAg
48d00 41 4c 41 41 41 41 41 41 55 41 42 51 41 41 41 54 ALAAAAAAUABQAAAT
48d10 2b 45 43 47 45 45 45 49 49 49 59 52 41 67 51 41 +ECGEEEIIIYRAgQA
48d20 68 68 42 42 43 43 43 47 45 45 45 51 49 49 57 41 hhBBCCCGEEEQIIWA
48d30 4b 51 41 67 68 42 43 41 41 41 41 41 41 0a 41 41 KQAghBCAAAAAA.AA
48d40 43 41 6d 41 49 42 51 67 69 42 55 55 6f 70 70 52 CAmAIBQgiBUUoppR
48d50 52 59 43 69 48 6b 46 49 41 51 41 6f 4a 41 51 67 RYCiHkFIAQAoJAQg
48d60 67 68 68 42 42 43 43 44 6b 46 41 6f 53 41 49 49 ghhBBCCDkFAoSAII
48d70 51 51 51 67 67 68 6b 42 42 43 52 67 41 49 41 53 QQQgghkBBCRgAIAS
48d80 47 45 67 45 49 49 49 59 51 59 0a 5a 41 53 41 45 GEgEIIIYQY.ZASAE
48d90 45 51 41 41 41 41 41 41 41 41 41 4d 4f 41 49 41 EQAAAAAAAAAMOAIA
48da0 43 47 45 45 45 49 49 49 51 51 52 51 67 69 4d 41 CGEEEIIIQQRQgiMA
48db0 42 42 43 43 43 47 49 45 45 49 49 49 59 51 51 43 BBCCCGIEEIIIYQQC
48dc0 41 42 42 68 42 42 43 43 43 45 45 43 6b 41 49 49 ABBhBBCCCEECkAII
48dd0 6f 51 51 51 67 67 68 0a 68 42 42 43 45 42 51 44 oQQQggh.hBBCEBQD
48de0 45 45 49 49 49 59 51 51 67 67 67 68 68 45 41 78 EEIIIYQQggghhEAx
48df0 42 41 41 41 41 41 51 41 41 41 41 41 51 67 69 55 BAAAAAQAAAAAQgiU
48e00 51 79 41 68 70 5a 52 53 53 69 6c 6c 41 41 51 52 QyAhpZRSSillAAQR
48e10 4b 49 63 51 51 67 67 68 68 42 42 49 43 42 45 41 KIcQQgghhBBICBEA
48e20 49 52 41 47 0a 49 59 52 41 51 67 67 68 68 42 41 IRAG.IYRAQgghhBA
48e30 69 41 45 49 49 67 6a 44 49 45 45 49 49 49 59 51 iAEIIgjDIEEIIIYQ
48e40 51 55 41 69 41 45 45 49 67 6a 41 45 41 67 41 41 QUAiAEEIgjAEAgAA
48e50 41 41 41 41 41 41 43 47 45 45 41 52 68 41 49 51 AAAAAACGEEARhAIQ
48e60 51 51 67 67 68 68 43 41 50 51 67 67 68 68 45 41 QQgghhCAPQgghhEA
48e70 41 0a 43 43 45 45 45 55 49 49 49 59 51 69 41 44 A.CCEEEUIIIYQiAD
48e80 73 3d 0a 7d 0a 0a 69 6d 61 67 65 20 63 72 65 61 s=.}..image crea
48e90 74 65 20 70 68 6f 74 6f 20 6e 75 6c 6c 49 6d 61 te photo nullIma
48ea0 67 65 0a 0a 69 6d 61 67 65 20 63 72 65 61 74 65 ge..image create
48eb0 20 62 69 74 6d 61 70 20 72 65 73 69 7a 65 20 2d bitmap resize -
48ec0 64 61 74 61 20 7b 0a 20 20 20 20 23 64 65 66 69 data {. #defi
48ed0 6e 65 20 72 65 73 69 7a 65 5f 77 69 64 74 68 20 ne resize_width
48ee0 31 34 0a 20 20 20 20 23 64 65 66 69 6e 65 20 72 14. #define r
48ef0 65 73 69 7a 65 5f 68 65 69 67 68 74 20 31 31 0a esize_height 11.
48f00 20 20 20 20 73 74 61 74 69 63 20 63 68 61 72 20 static char
48f10 72 65 73 69 7a 65 5f 62 69 74 73 5b 5d 20 3d 20 resize_bits[] =
48f20 7b 0a 09 30 78 32 30 2c 20 30 78 30 31 2c 20 30 {..0x20, 0x01, 0
48f30 78 33 30 2c 20 30 78 30 33 2c 20 30 78 33 38 2c x30, 0x03, 0x38,
48f40 20 30 78 30 37 2c 20 30 78 33 63 2c 20 30 78 30 0x07, 0x3c, 0x0
48f50 66 2c 20 30 78 33 65 2c 20 30 78 31 66 2c 20 30 f, 0x3e, 0x1f, 0
48f60 78 33 66 2c 20 30 78 33 66 2c 0a 09 30 78 33 65 x3f, 0x3f,..0x3e
48f70 2c 20 30 78 31 66 2c 20 30 78 33 63 2c 20 30 78 , 0x1f, 0x3c, 0x
48f80 30 66 2c 20 30 78 33 38 2c 20 30 78 30 37 2c 20 0f, 0x38, 0x07,
48f90 30 78 33 30 2c 20 30 78 30 33 2c 20 30 78 32 30 0x30, 0x03, 0x20
48fa0 2c 20 30 78 30 31 0a 20 20 20 20 7d 0a 7d 0a 0a , 0x01. }.}..
48fb0 23 20 54 6f 6f 6c 74 69 70 20 70 6f 70 75 70 73 # Tooltip popups
48fc0 0a 0a 23 0a 23 20 74 6f 6f 6c 74 69 70 73 20 76 ..#.# tooltips v
48fd0 65 72 73 69 6f 6e 20 30 2e 31 0a 23 20 50 61 75 ersion 0.1.# Pau
48fe0 6c 20 42 6f 79 65 72 0a 23 20 53 63 69 65 6e 63 l Boyer.# Scienc
48ff0 65 20 41 70 70 6c 69 63 61 74 69 6f 6e 73 20 49 e Applications I
49000 6e 74 65 72 6e 61 74 69 6f 6e 61 6c 20 43 6f 72 nternational Cor
49010 70 2e 0a 23 0a 0a 23 23 23 23 23 23 23 23 23 23 p..#..##########
49020 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
49030 23 23 23 23 0a 23 20 73 65 74 5f 74 6f 6f 6c 74 ####.# set_toolt
49040 69 70 73 20 67 65 74 73 20 61 20 62 75 74 74 6f ips gets a butto
49050 6e 27 73 20 6e 61 6d 65 20 61 6e 64 20 74 68 65 n's name and the
49060 20 74 6f 6f 6c 74 69 70 20 73 74 72 69 6e 67 20 tooltip string
49070 61 73 0a 23 20 61 72 67 75 6d 65 6e 74 73 20 61 as.# arguments a
49080 6e 64 20 63 72 65 61 74 65 73 20 74 68 65 20 70 nd creates the p
49090 72 6f 70 65 72 20 62 69 6e 64 69 6e 67 73 20 66 roper bindings f
490a0 6f 72 20 65 6e 74 65 72 69 6e 67 0a 23 20 61 6e or entering.# an
490b0 64 20 6c 65 61 76 69 6e 67 20 74 68 65 20 62 75 d leaving the bu
490c0 74 74 6f 6e 0a 23 23 23 23 23 23 23 23 23 23 23 tton.###########
490d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
490e0 23 23 23 0a 70 72 6f 63 20 73 65 74 5f 74 6f 6f ###.proc set_too
490f0 6c 74 69 70 73 20 7b 77 69 64 67 65 74 20 6e 61 ltips {widget na
49100 6d 65 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c me} {. global
49110 20 67 0a 0a 20 20 20 20 62 69 6e 64 20 24 77 69 g.. bind $wi
49120 64 67 65 74 20 3c 45 6e 74 65 72 3e 20 22 0a 20 dget <Enter> ".
49130 20 20 20 63 61 74 63 68 20 7b 20 61 66 74 65 72 catch { after
49140 20 35 30 30 20 7b 20 69 6e 74 65 72 6e 61 6c 5f 500 { internal_
49150 74 6f 6f 6c 74 69 70 73 5f 50 6f 70 55 70 20 25 tooltips_PopUp %
49160 57 20 24 6e 61 6d 65 20 7d 20 7d 20 20 67 28 74 W $name } } g(t
49170 6f 6f 6c 74 69 70 5f 69 64 29 0a 20 20 22 0a 20 ooltip_id). ".
49180 20 20 20 62 69 6e 64 20 24 77 69 64 67 65 74 20 bind $widget
49190 3c 4c 65 61 76 65 3e 20 22 69 6e 74 65 72 6e 61 <Leave> "interna
491a0 6c 5f 74 6f 6f 6c 74 69 70 73 5f 50 6f 70 44 6f l_tooltips_PopDo
491b0 77 6e 22 0a 20 20 20 20 62 69 6e 64 20 24 77 69 wn". bind $wi
491c0 64 67 65 74 20 3c 42 75 74 74 6f 6e 2d 31 3e 20 dget <Button-1>
491d0 22 69 6e 74 65 72 6e 61 6c 5f 74 6f 6f 6c 74 69 "internal_toolti
491e0 70 73 5f 50 6f 70 44 6f 77 6e 22 0a 7d 0a 0a 23 ps_PopDown".}..#
491f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
49200 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 #############.#
49210 69 6e 74 65 72 6e 61 6c 5f 74 6f 6f 6c 74 69 70 internal_tooltip
49220 73 5f 50 6f 70 55 70 20 69 73 20 75 73 65 64 20 s_PopUp is used
49230 74 6f 20 61 63 74 69 76 61 74 65 20 74 68 65 20 to activate the
49240 74 6f 6f 6c 74 69 70 20 77 69 6e 64 6f 77 0a 23 tooltip window.#
49250 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
49260 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 70 72 #############.pr
49270 6f 63 20 69 6e 74 65 72 6e 61 6c 5f 74 6f 6f 6c oc internal_tool
49280 74 69 70 73 5f 50 6f 70 55 70 20 7b 77 69 64 20 tips_PopUp {wid
49290 6e 61 6d 65 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 name} {. glob
492a0 61 6c 20 67 0a 0a 20 20 20 20 23 20 67 65 74 20 al g.. # get
492b0 72 69 64 20 6f 66 20 6f 74 68 65 72 20 65 78 69 rid of other exi
492c0 73 74 69 6e 67 20 74 6f 6f 6c 74 69 70 73 0a 20 sting tooltips.
492d0 20 20 20 63 61 74 63 68 20 7b 64 65 73 74 72 6f catch {destro
492e0 79 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e 64 y .tooltips_wind
492f0 7d 0a 0a 20 20 20 20 74 6f 70 6c 65 76 65 6c 20 }.. toplevel
49300 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e 64 20 2d .tooltips_wind -
49310 63 6c 61 73 73 20 54 6f 6f 6c 54 69 70 0a 20 20 class ToolTip.
49320 20 20 73 65 74 20 73 69 7a 65 5f 63 68 61 6e 67 set size_chang
49330 65 64 20 30 0a 20 20 20 20 73 65 74 20 62 67 20 ed 0. set bg
49340 5b 6f 70 74 69 6f 6e 20 67 65 74 20 2e 74 6f 6f [option get .too
49350 6c 74 69 70 73 5f 77 69 6e 64 20 62 61 63 6b 67 ltips_wind backg
49360 72 6f 75 6e 64 20 62 61 63 6b 67 72 6f 75 6e 64 round background
49370 5d 0a 20 20 20 20 73 65 74 20 66 67 20 5b 6f 70 ]. set fg [op
49380 74 69 6f 6e 20 67 65 74 20 2e 74 6f 6f 6c 74 69 tion get .toolti
49390 70 73 5f 77 69 6e 64 20 66 6f 72 65 67 72 6f 75 ps_wind foregrou
493a0 6e 64 20 66 6f 72 65 67 72 6f 75 6e 64 5d 0a 0a nd foreground]..
493b0 20 20 20 20 23 20 67 65 74 20 74 68 65 20 63 75 # get the cu
493c0 72 73 6f 72 20 70 6f 73 69 74 69 6f 6e 0a 20 20 rsor position.
493d0 20 20 73 65 74 20 58 20 5b 77 69 6e 66 6f 20 70 set X [winfo p
493e0 6f 69 6e 74 65 72 78 20 24 77 69 64 5d 0a 20 20 ointerx $wid].
493f0 20 20 73 65 74 20 59 20 5b 77 69 6e 66 6f 20 70 set Y [winfo p
49400 6f 69 6e 74 65 72 79 20 24 77 69 64 5d 0a 0a 20 ointery $wid]..
49410 20 20 20 23 20 61 64 64 20 61 20 73 6c 69 67 68 # add a sligh
49420 74 20 6f 66 66 73 65 74 20 74 6f 20 6d 61 6b 65 t offset to make
49430 20 74 6f 6f 6c 74 69 70 73 20 66 61 6c 6c 20 62 tooltips fall b
49440 65 6c 6f 77 20 63 75 72 73 6f 72 0a 20 20 20 20 elow cursor.
49450 73 65 74 20 59 20 5b 65 78 70 72 20 7b 24 59 20 set Y [expr {$Y
49460 2b 20 32 30 7d 5d 0a 0a 20 20 20 20 23 20 4e 6f + 20}].. # No
49470 77 20 70 6f 70 20 75 70 20 74 68 65 20 6e 65 77 w pop up the new
49480 20 77 69 64 67 65 74 4c 61 62 65 6c 0a 20 20 20 widgetLabel.
49490 20 77 6d 20 6f 76 65 72 72 69 64 65 72 65 64 69 wm overrideredi
494a0 72 65 63 74 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 rect .tooltips_w
494b0 69 6e 64 20 31 0a 20 20 20 20 77 6d 20 67 65 6f ind 1. wm geo
494c0 6d 65 74 72 79 20 2e 74 6f 6f 6c 74 69 70 73 5f metry .tooltips_
494d0 77 69 6e 64 20 2b 24 58 2b 24 59 0a 20 20 20 20 wind +$X+$Y.
494e0 6c 61 62 65 6c 20 2e 74 6f 6f 6c 74 69 70 73 5f label .tooltips_
494f0 77 69 6e 64 2e 6c 20 2d 74 65 78 74 20 24 6e 61 wind.l -text $na
49500 6d 65 20 2d 62 6f 72 64 65 72 20 32 20 2d 72 65 me -border 2 -re
49510 6c 69 65 66 20 72 61 69 73 65 64 20 5c 0a 20 20 lief raised \.
49520 20 20 20 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 -background
49530 24 62 67 20 2d 66 6f 72 65 67 72 6f 75 6e 64 20 $bg -foreground
49540 24 66 67 0a 20 20 20 20 70 61 63 6b 20 2e 74 6f $fg. pack .to
49550 6f 6c 74 69 70 73 5f 77 69 6e 64 2e 6c 0a 0a 20 oltips_wind.l..
49560 20 20 20 23 20 6d 61 6b 65 20 69 6e 76 69 73 69 # make invisi
49570 62 6c 65 0a 20 20 20 20 77 6d 20 77 69 74 68 64 ble. wm withd
49580 72 61 77 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 raw .tooltips_wi
49590 6e 64 0a 20 20 20 20 75 70 64 61 74 65 20 69 64 nd. update id
495a0 6c 65 74 61 73 6b 73 0a 0a 20 20 20 20 23 20 61 letasks.. # a
495b0 64 6a 75 73 74 20 66 6f 72 20 62 6f 74 74 6f 6d djust for bottom
495c0 20 6f 66 20 73 63 72 65 65 6e 0a 20 20 20 20 69 of screen. i
495d0 66 20 7b 28 24 59 20 2b 20 5b 77 69 6e 66 6f 20 f {($Y + [winfo
495e0 72 65 71 68 65 69 67 68 74 20 2e 74 6f 6f 6c 74 reqheight .toolt
495f0 69 70 73 5f 77 69 6e 64 5d 29 20 3e 20 5b 77 69 ips_wind]) > [wi
49600 6e 66 6f 20 73 63 72 65 65 6e 68 65 69 67 68 74 nfo screenheight
49610 20 2e 5d 7d 20 7b 0a 09 73 65 74 20 59 20 5b 65 .]} {..set Y [e
49620 78 70 72 20 7b 24 59 20 2d 20 5b 77 69 6e 66 6f xpr {$Y - [winfo
49630 20 72 65 71 68 65 69 67 68 74 20 2e 74 6f 6f 6c reqheight .tool
49640 74 69 70 73 5f 77 69 6e 64 5d 20 2d 20 32 35 7d tips_wind] - 25}
49650 5d 0a 09 73 65 74 20 73 69 7a 65 5f 63 68 61 6e ]..set size_chan
49660 67 65 64 20 31 0a 20 20 20 20 7d 0a 20 20 20 20 ged 1. }.
49670 23 20 61 64 6a 75 73 74 20 66 6f 72 20 72 69 67 # adjust for rig
49680 68 74 20 62 6f 72 64 65 72 20 6f 66 20 73 63 72 ht border of scr
49690 65 65 6e 0a 20 20 20 20 69 66 20 7b 28 24 58 20 een. if {($X
496a0 2b 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 64 74 + [winfo reqwidt
496b0 68 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e 64 h .tooltips_wind
496c0 5d 29 20 3e 20 5b 77 69 6e 66 6f 20 73 63 72 65 ]) > [winfo scre
496d0 65 6e 77 69 64 74 68 20 2e 5d 7d 20 7b 0a 09 73 enwidth .]} {..s
496e0 65 74 20 58 20 5b 65 78 70 72 20 7b 5b 77 69 6e et X [expr {[win
496f0 66 6f 20 73 63 72 65 65 6e 77 69 64 74 68 20 2e fo screenwidth .
49700 5d 20 2d 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 ] - [winfo reqwi
49710 64 74 68 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 dth .tooltips_wi
49720 6e 64 5d 7d 5d 0a 09 73 65 74 20 73 69 7a 65 5f nd]}]..set size_
49730 63 68 61 6e 67 65 64 20 31 0a 20 20 20 20 7d 0a changed 1. }.
49740 20 20 20 20 23 20 72 65 73 65 74 20 70 6f 73 69 # reset posi
49750 74 69 6f 6e 0a 20 20 20 20 69 66 20 7b 24 73 69 tion. if {$si
49760 7a 65 5f 63 68 61 6e 67 65 64 20 3d 3d 20 31 7d ze_changed == 1}
49770 20 7b 0a 09 77 6d 20 67 65 6f 6d 65 74 72 79 20 {..wm geometry
49780 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e 64 20 2b .tooltips_wind +
49790 24 58 2b 24 59 0a 20 20 20 20 7d 0a 20 20 20 20 $X+$Y. }.
497a0 23 20 6d 61 6b 65 20 76 69 73 69 62 6c 65 0a 20 # make visible.
497b0 20 20 20 77 6d 20 64 65 69 63 6f 6e 69 66 79 20 wm deiconify
497c0 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e 64 0a 0a .tooltips_wind..
497d0 20 20 20 20 23 20 6d 61 6b 65 20 74 6f 6f 6c 74 # make toolt
497e0 69 70 20 64 69 73 73 61 70 70 65 61 72 20 61 66 ip dissappear af
497f0 74 65 72 20 35 20 73 65 63 0a 20 20 20 20 73 65 ter 5 sec. se
49800 74 20 67 28 74 6f 6f 6c 74 69 70 5f 69 64 29 20 t g(tooltip_id)
49810 5b 61 66 74 65 72 20 35 30 30 30 20 7b 20 69 6e [after 5000 { in
49820 74 65 72 6e 61 6c 5f 74 6f 6f 6c 74 69 70 73 5f ternal_tooltips_
49830 50 6f 70 44 6f 77 6e 20 7d 5d 0a 7d 0a 0a 70 72 PopDown }].}..pr
49840 6f 63 20 69 6e 74 65 72 6e 61 6c 5f 74 6f 6f 6c oc internal_tool
49850 74 69 70 73 5f 50 6f 70 44 6f 77 6e 20 7b 7d 20 tips_PopDown {}
49860 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 67 0a 0a {. global g..
49870 20 20 20 20 61 66 74 65 72 20 63 61 6e 63 65 6c after cancel
49880 20 24 67 28 74 6f 6f 6c 74 69 70 5f 69 64 29 0a $g(tooltip_id).
49890 20 20 20 20 63 61 74 63 68 20 7b 64 65 73 74 72 catch {destr
498a0 6f 79 20 2e 74 6f 6f 6c 74 69 70 73 5f 77 69 6e oy .tooltips_win
498b0 64 7d 0a 7d 0a 0a 23 20 4d 6f 73 74 20 6f 66 20 d}.}..# Most of
498c0 74 68 69 73 20 77 61 73 20 73 74 6f 6c 65 6e 20 this was stolen
498d0 66 72 6f 6d 20 74 68 65 20 22 43 44 45 22 20 70 from the "CDE" p
498e0 61 63 6b 61 67 65 20 62 79 20 44 2e 20 4a 2e 20 ackage by D. J.
498f0 48 61 67 62 65 72 67 2e 0a 23 20 49 20 64 69 67 Hagberg..# I dig
49900 20 61 20 63 6f 75 70 6c 65 20 6d 6f 72 65 20 74 a couple more t
49910 68 69 6e 67 73 20 6f 75 74 20 6f 66 20 74 68 65 hings out of the
49920 20 70 61 6c 65 74 74 65 2e 20 2d 64 61 72 0a 70 palette. -dar.p
49930 72 6f 63 20 67 65 74 5f 63 64 65 5f 70 61 72 61 roc get_cde_para
49940 6d 73 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 ms {} {. glob
49950 61 6c 20 77 0a 0a 20 20 20 20 23 20 53 65 74 20 al w.. # Set
49960 64 65 66 61 75 6c 74 73 20 66 6f 72 20 61 6c 6c defaults for all
49970 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 74 the necessary t
49980 68 69 6e 67 73 0a 20 20 20 20 73 65 74 20 62 67 hings. set bg
49990 20 5b 6f 70 74 69 6f 6e 20 67 65 74 20 2e 20 62 [option get . b
499a0 61 63 6b 67 72 6f 75 6e 64 20 62 61 63 6b 67 72 ackground backgr
499b0 6f 75 6e 64 5d 0a 20 20 20 20 73 65 74 20 66 67 ound]. set fg
499c0 20 5b 6f 70 74 69 6f 6e 20 67 65 74 20 2e 20 66 [option get . f
499d0 6f 72 65 67 72 6f 75 6e 64 20 66 6f 72 65 67 72 oreground foregr
499e0 6f 75 6e 64 5d 0a 20 20 20 20 73 65 74 20 67 75 ound]. set gu
499f0 69 66 6f 6e 74 20 5b 6f 70 74 69 6f 6e 20 67 65 ifont [option ge
49a00 74 20 2e 20 62 75 74 74 6f 6e 46 6f 6e 74 4c 69 t . buttonFontLi
49a10 73 74 20 62 75 74 74 6f 6e 46 6f 6e 74 4c 69 73 st buttonFontLis
49a20 74 5d 0a 20 20 20 20 73 65 74 20 74 78 74 66 6f t]. set txtfo
49a30 6e 74 20 5b 6f 70 74 69 6f 6e 20 67 65 74 20 2e nt [option get .
49a40 20 46 6f 6e 74 53 65 74 20 46 6f 6e 74 53 65 74 FontSet FontSet
49a50 5d 0a 20 20 20 20 73 65 74 20 6c 69 73 74 66 6f ]. set listfo
49a60 6e 74 20 5b 6f 70 74 69 6f 6e 20 67 65 74 20 2e nt [option get .
49a70 20 74 65 78 74 46 6f 6e 74 4c 69 73 74 20 74 65 textFontList te
49a80 78 74 46 6f 6e 74 4c 69 73 74 5d 0a 20 20 20 20 xtFontList].
49a90 73 65 74 20 74 65 78 74 62 67 20 24 62 67 0a 20 set textbg $bg.
49aa0 20 20 20 73 65 74 20 74 65 78 74 66 67 20 24 66 set textfg $f
49ab0 67 0a 0a 20 20 20 20 23 20 49 66 20 61 6e 79 20 g.. # If any
49ac0 6f 66 20 74 68 65 73 65 20 61 72 65 6e 27 74 20 of these aren't
49ad0 73 65 74 2c 20 49 20 64 6f 6e 27 74 20 74 68 69 set, I don't thi
49ae0 6e 6b 20 77 65 27 72 65 20 69 6e 20 43 44 45 20 nk we're in CDE
49af0 61 66 74 65 72 20 61 6c 6c 0a 20 20 20 20 69 66 after all. if
49b00 20 7b 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 {![string lengt
49b10 68 20 24 66 67 5d 7d 20 7b 0a 09 72 65 74 75 72 h $fg]} {..retur
49b20 6e 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 n 0. }. if
49b30 20 7b 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 {![string lengt
49b40 68 20 24 62 67 5d 7d 20 7b 0a 09 72 65 74 75 72 h $bg]} {..retur
49b50 6e 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 n 0. }. if
49b60 20 7b 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 {![string lengt
49b70 68 20 24 67 75 69 66 6f 6e 74 5d 7d 20 7b 0a 09 h $guifont]} {..
49b80 72 65 74 75 72 6e 20 30 0a 20 20 20 20 7d 0a 20 return 0. }.
49b90 20 20 20 69 66 20 7b 21 5b 73 74 72 69 6e 67 20 if {![string
49ba0 6c 65 6e 67 74 68 20 24 74 78 74 66 6f 6e 74 5d length $txtfont]
49bb0 7d 20 7b 0a 09 72 65 74 75 72 6e 20 30 0a 20 20 } {..return 0.
49bc0 20 20 7d 0a 0a 20 20 20 20 73 65 74 20 67 75 69 }.. set gui
49bd0 66 6f 6e 74 20 5b 73 74 72 69 6e 67 20 74 72 69 font [string tri
49be0 6d 72 69 67 68 74 20 24 67 75 69 66 6f 6e 74 20 mright $guifont
49bf0 22 3a 22 5d 0a 20 20 20 20 73 65 74 20 74 78 74 ":"]. set txt
49c00 66 6f 6e 74 20 5b 73 74 72 69 6e 67 20 74 72 69 font [string tri
49c10 6d 72 69 67 68 74 20 24 74 78 74 66 6f 6e 74 20 mright $txtfont
49c20 22 3a 22 5d 0a 20 20 20 20 73 65 74 20 6c 69 73 ":"]. set lis
49c30 74 66 6f 6e 74 20 5b 73 74 72 69 6e 67 20 74 72 tfont [string tr
49c40 69 6d 72 69 67 68 74 20 24 74 78 74 66 6f 6e 74 imright $txtfont
49c50 20 22 3a 22 5d 0a 20 20 20 20 72 65 67 73 75 62 ":"]. regsub
49c60 20 7b 6d 65 64 69 75 6d 7d 20 24 74 78 74 66 6f {medium} $txtfo
49c70 6e 74 20 22 62 6f 6c 64 22 20 64 6c 67 66 6f 6e nt "bold" dlgfon
49c80 74 0a 0a 20 20 20 20 23 20 54 68 65 79 20 64 6f t.. # They do
49c90 6e 27 74 20 74 65 6c 6c 20 75 73 20 74 68 65 20 n't tell us the
49ca0 73 6c 69 67 68 74 6c 79 20 64 61 72 6b 65 72 20 slightly darker
49cb0 63 6f 6c 6f 72 20 74 68 65 79 20 75 73 65 20 66 color they use f
49cc0 6f 72 20 74 68 65 0a 20 20 20 20 23 20 73 63 72 or the. # scr
49cd0 6f 6c 6c 62 61 72 20 62 61 63 6b 67 72 6f 75 6e ollbar backgroun
49ce0 64 73 20 61 6e 64 20 67 72 61 70 68 69 63 73 20 ds and graphics
49cf0 62 61 63 6b 67 72 6f 75 6e 64 73 2c 20 73 6f 20 backgrounds, so
49d00 77 65 27 6c 6c 20 6d 61 6b 65 0a 20 20 20 20 23 we'll make. #
49d10 20 6f 6e 65 20 75 70 2e 0a 20 20 20 20 73 65 74 one up.. set
49d20 20 72 67 62 5f 62 67 20 5b 77 69 6e 66 6f 20 72 rgb_bg [winfo r
49d30 67 62 20 2e 20 24 62 67 5d 0a 20 20 20 20 73 65 gb . $bg]. se
49d40 74 20 73 68 61 64 6f 77 20 5b 66 6f 72 6d 61 74 t shadow [format
49d50 20 23 25 30 32 78 25 30 32 78 25 30 32 78 20 5b #%02x%02x%02x [
49d60 65 78 70 72 20 7b 28 39 2a 5b 6c 69 6e 64 65 78 expr {(9*[lindex
49d70 20 24 72 67 62 5f 62 67 20 30 5d 29 20 2f 32 35 $rgb_bg 0]) /25
49d80 36 30 7d 5d 20 5c 0a 20 20 20 20 20 20 5b 65 78 60}] \. [ex
49d90 70 72 20 7b 28 39 2a 5b 6c 69 6e 64 65 78 20 24 pr {(9*[lindex $
49da0 72 67 62 5f 62 67 20 31 5d 29 20 2f 32 35 36 30 rgb_bg 1]) /2560
49db0 7d 5d 20 5b 65 78 70 72 20 7b 28 39 2a 5b 6c 69 }] [expr {(9*[li
49dc0 6e 64 65 78 20 24 72 67 62 5f 62 67 20 32 5d 29 ndex $rgb_bg 2])
49dd0 20 5c 0a 20 20 20 20 20 20 2f 32 35 36 30 7d 5d \. /2560}]
49de0 5d 0a 0a 20 20 20 20 23 20 49 66 20 77 65 20 63 ].. # If we c
49df0 61 6e 20 66 69 6e 64 20 74 68 65 20 75 73 65 72 an find the user
49e00 27 73 20 64 74 2e 72 65 73 6f 75 72 63 65 73 20 's dt.resources
49e10 66 69 6c 65 2c 20 77 65 20 63 61 6e 20 66 69 6e file, we can fin
49e20 64 20 6f 75 74 20 74 68 65 0a 20 20 20 20 23 20 d out the. #
49e30 70 61 6c 65 74 74 65 20 61 6e 64 20 62 61 63 6b palette and back
49e40 67 72 6f 75 6e 64 2f 66 6f 72 65 67 72 6f 75 6e ground/foregroun
49e50 64 20 63 6f 6c 6f 72 73 0a 20 20 20 20 73 65 74 d colors. set
49e60 20 66 68 20 22 22 0a 20 20 20 20 73 65 74 20 70 fh "". set p
49e70 61 6c 65 74 74 65 20 22 22 0a 20 20 20 20 73 65 alette "". se
49e80 74 20 63 75 72 5f 72 73 72 63 20 7e 2f 2e 64 74 t cur_rsrc ~/.dt
49e90 2f 73 65 73 73 69 6f 6e 73 2f 63 75 72 72 65 6e /sessions/curren
49ea0 74 2f 64 74 2e 72 65 73 6f 75 72 63 65 73 0a 20 t/dt.resources.
49eb0 20 20 20 73 65 74 20 68 6f 6d 5f 72 73 72 63 20 set hom_rsrc
49ec0 7e 2f 2e 64 74 2f 73 65 73 73 69 6f 6e 73 2f 68 ~/.dt/sessions/h
49ed0 6f 6d 65 2f 64 74 2e 72 65 73 6f 75 72 63 65 73 ome/dt.resources
49ee0 0a 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 72 . if {[file r
49ef0 65 61 64 61 62 6c 65 20 24 63 75 72 5f 72 73 72 eadable $cur_rsr
49f00 63 5d 20 26 26 20 5b 66 69 6c 65 20 72 65 61 64 c] && [file read
49f10 61 62 6c 65 20 24 68 6f 6d 5f 72 73 72 63 5d 7d able $hom_rsrc]}
49f20 20 7b 0a 09 69 66 20 7b 5b 66 69 6c 65 20 6d 74 {..if {[file mt
49f30 69 6d 65 20 24 63 75 72 5f 72 73 72 63 5d 20 3e ime $cur_rsrc] >
49f40 20 5b 66 69 6c 65 20 6d 74 69 6d 65 20 24 68 6f [file mtime $ho
49f50 6d 5f 72 73 72 63 5d 7d 20 7b 0a 09 20 20 20 20 m_rsrc]} {..
49f60 69 66 20 7b 5b 63 61 74 63 68 20 7b 6f 70 65 6e if {[catch {open
49f70 20 24 63 75 72 5f 72 73 72 63 20 72 7d 20 66 68 $cur_rsrc r} fh
49f80 5d 7d 20 7b 0a 09 09 73 65 74 20 66 68 20 22 22 ]} {...set fh ""
49f90 0a 09 20 20 20 20 7d 0a 09 7d 20 65 6c 73 65 20 .. }..} else
49fa0 7b 0a 09 20 20 20 20 69 66 20 7b 5b 63 61 74 63 {.. if {[catc
49fb0 68 20 7b 6f 70 65 6e 20 24 68 6f 6d 5f 72 73 72 h {open $hom_rsr
49fc0 63 20 72 7d 20 66 68 5d 7d 20 7b 0a 09 09 73 65 c r} fh]} {...se
49fd0 74 20 66 68 20 22 22 0a 09 20 20 20 20 7d 0a 09 t fh "".. }..
49fe0 7d 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b }. } elseif {
49ff0 5b 66 69 6c 65 20 72 65 61 64 61 62 6c 65 20 24 [file readable $
4a000 63 75 72 5f 72 73 72 63 5d 7d 20 7b 0a 09 69 66 cur_rsrc]} {..if
4a010 20 7b 5b 63 61 74 63 68 20 7b 6f 70 65 6e 20 24 {[catch {open $
4a020 63 75 72 5f 72 73 72 63 20 72 7d 20 66 68 5d 7d cur_rsrc r} fh]}
4a030 20 7b 0a 09 20 20 20 20 73 65 74 20 66 68 20 22 {.. set fh "
4a040 22 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 69 "..}. } elsei
4a050 66 20 7b 5b 66 69 6c 65 20 72 65 61 64 61 62 6c f {[file readabl
4a060 65 20 24 68 6f 6d 5f 72 73 72 63 5d 7d 20 7b 0a e $hom_rsrc]} {.
4a070 09 69 66 20 7b 5b 63 61 74 63 68 20 7b 6f 70 65 .if {[catch {ope
4a080 6e 20 24 68 6f 6d 5f 72 73 72 63 20 72 7d 20 66 n $hom_rsrc r} f
4a090 68 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 66 h]} {.. set f
4a0a0 68 20 22 22 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 h ""..}. }.
4a0b0 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
4a0c0 6e 67 74 68 20 24 66 68 5d 7d 20 7b 0a 09 73 65 ngth $fh]} {..se
4a0d0 74 20 70 61 6c 66 20 22 22 0a 09 77 68 69 6c 65 t palf ""..while
4a0e0 20 7b 5b 67 65 74 73 20 24 66 68 20 6c 6e 5d 20 {[gets $fh ln]
4a0f0 21 3d 20 2d 31 7d 20 7b 0a 09 20 20 20 20 72 65 != -1} {.. re
4a100 67 65 78 70 20 22 5e 5c 5c 2a 62 61 63 6b 67 72 gexp "^\\*backgr
4a110 6f 75 6e 64 3a 5c 5b 20 5c 74 5d 2a 28 2e 2a 29 ound:\[ \t]*(.*)
4a120 5c 24 22 20 24 6c 6e 20 6e 69 6c 20 74 65 78 74 \$" $ln nil text
4a130 62 67 0a 09 20 20 20 20 72 65 67 65 78 70 20 22 bg.. regexp "
4a140 5e 5c 5c 2a 66 6f 72 65 67 72 6f 75 6e 64 3a 5c ^\\*foreground:\
4a150 5b 20 5c 74 5d 2a 28 2e 2a 29 5c 24 22 20 24 6c [ \t]*(.*)\$" $l
4a160 6e 20 6e 69 6c 20 74 65 78 74 62 67 0a 09 20 20 n nil textbg..
4a170 20 20 72 65 67 65 78 70 20 22 5e 5c 5c 2a 30 5c regexp "^\\*0\
4a180 5c 2a 43 6f 6c 6f 72 50 61 6c 65 74 74 65 3a 5c \*ColorPalette:\
4a190 5b 20 5c 74 5d 2a 28 2e 2a 29 5c 24 22 20 24 6c [ \t]*(.*)\$" $l
4a1a0 6e 20 6e 69 6c 20 70 61 6c 65 74 74 65 0a 09 20 n nil palette..
4a1b0 20 20 20 72 65 67 65 78 70 20 22 5e 57 69 6e 64 regexp "^Wind
4a1c0 6f 77 2e 43 6f 6c 6f 72 2e 42 61 63 6b 67 72 6f ow.Color.Backgro
4a1d0 75 6e 64 3a 5c 5b 20 5c 74 5d 2a 28 2e 2a 29 5c und:\[ \t]*(.*)\
4a1e0 24 22 20 24 6c 6e 20 6e 69 6c 20 74 65 78 74 62 $" $ln nil textb
4a1f0 67 0a 09 20 20 20 20 72 65 67 65 78 70 20 22 5e g.. regexp "^
4a200 57 69 6e 64 6f 77 2e 43 6f 6c 6f 72 2e 46 6f 72 Window.Color.For
4a210 65 67 72 6f 75 6e 64 3a 5c 5b 20 5c 74 5d 2a 28 eground:\[ \t]*(
4a220 2e 2a 29 5c 24 22 20 24 6c 6e 20 6e 69 6c 20 74 .*)\$" $ln nil t
4a230 65 78 74 66 67 0a 09 7d 0a 09 63 61 74 63 68 20 extfg..}..catch
4a240 7b 63 6c 6f 73 65 20 24 66 68 7d 0a 09 23 0a 09 {close $fh}..#..
4a250 23 20 49 66 20 74 68 65 20 2a 30 2a 43 6f 6c 6f # If the *0*Colo
4a260 72 50 61 6c 65 74 74 65 20 73 65 74 74 69 6e 67 rPalette setting
4a270 20 77 61 73 20 66 6f 75 6e 64 20 61 62 6f 76 65 was found above
4a280 2c 20 74 72 79 20 74 6f 20 66 69 6e 64 20 74 68 , try to find th
4a290 65 0a 09 23 20 69 6e 64 69 63 61 74 65 64 20 66 e..# indicated f
4a2a0 69 6c 65 20 69 6e 20 7e 2f 2e 64 74 2c 20 24 44 ile in ~/.dt, $D
4a2b0 54 48 4f 4d 45 2c 20 6f 72 20 2f 75 73 72 2f 64 THOME, or /usr/d
4a2c0 74 2e 0a 09 23 0a 09 69 66 20 7b 5b 73 74 72 69 t...#..if {[stri
4a2d0 6e 67 20 6c 65 6e 67 74 68 20 24 70 61 6c 65 74 ng length $palet
4a2e0 74 65 5d 7d 20 7b 0a 09 20 20 20 20 66 6f 72 65 te]} {.. fore
4a2f0 61 63 68 20 64 74 64 69 72 20 7b 2f 75 73 72 2f ach dtdir {/usr/
4a300 64 74 20 2f 65 74 63 2f 64 74 20 7e 2f 2e 64 74 dt /etc/dt ~/.dt
4a310 7d 20 7b 0a 09 09 23 20 54 68 69 73 20 75 73 65 } {...# This use
4a320 73 20 74 68 65 20 6c 61 73 74 20 70 61 6c 65 74 s the last palet
4a330 74 65 20 74 68 61 74 20 77 65 20 66 69 6e 64 0a te that we find.
4a340 09 09 69 66 20 7b 5b 66 69 6c 65 20 72 65 61 64 ..if {[file read
4a350 61 62 6c 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 able [file join
4a360 24 64 74 64 69 72 20 70 61 6c 65 74 74 65 73 20 $dtdir palettes
4a370 24 70 61 6c 65 74 74 65 5d 5d 7d 20 7b 0a 09 09 $palette]]} {...
4a380 20 20 20 20 73 65 74 20 70 61 6c 66 20 5b 66 69 set palf [fi
4a390 6c 65 20 6a 6f 69 6e 20 24 64 74 64 69 72 20 70 le join $dtdir p
4a3a0 61 6c 65 74 74 65 73 20 24 70 61 6c 65 74 74 65 alettes $palette
4a3b0 5d 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 20 20 ]...}.. }..
4a3c0 20 20 23 20 64 65 62 75 67 2d 69 6e 66 6f 20 22 # debug-info "
4a3d0 55 73 69 6e 67 20 70 61 6c 65 74 74 65 20 24 70 Using palette $p
4a3e0 61 6c 66 22 0a 09 20 20 20 20 69 66 20 7b 5b 73 alf".. if {[s
4a3f0 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 61 tring length $pa
4a400 6c 66 5d 7d 20 7b 0a 09 09 69 66 20 7b 21 5b 63 lf]} {...if {![c
4a410 61 74 63 68 20 7b 6f 70 65 6e 20 24 70 61 6c 66 atch {open $palf
4a420 20 72 7d 20 66 68 5d 7d 20 7b 0a 09 09 20 20 20 r} fh]} {...
4a430 20 67 65 74 73 20 24 66 68 20 61 63 74 69 76 65 gets $fh active
4a440 74 69 74 6c 65 0a 09 09 20 20 20 20 67 65 74 73 title... gets
4a450 20 24 66 68 20 69 6e 61 63 74 69 76 65 74 69 74 $fh inactivetit
4a460 6c 65 0a 09 09 20 20 20 20 67 65 74 73 20 24 66 le... gets $f
4a470 68 20 77 6b 73 70 63 31 0a 09 09 20 20 20 20 67 h wkspc1... g
4a480 65 74 73 20 24 66 68 20 74 65 78 74 62 67 0a 09 ets $fh textbg..
4a490 09 20 20 20 20 67 65 74 73 20 24 66 68 20 67 75 . gets $fh gu
4a4a0 69 62 67 20 3b 23 28 2a 2e 62 61 63 6b 67 72 6f ibg ;#(*.backgro
4a4b0 75 6e 64 29 20 2d 20 64 65 66 61 75 6c 74 20 66 und) - default f
4a4c0 6f 72 20 74 6b 20 75 6e 64 65 72 20 63 64 65 0a or tk under cde.
4a4d0 09 09 20 20 20 20 67 65 74 73 20 24 66 68 20 6d .. gets $fh m
4a4e0 65 6e 75 62 67 0a 09 09 20 20 20 20 67 65 74 73 enubg... gets
4a4f0 20 24 66 68 20 77 6b 73 70 63 34 0a 09 09 20 20 $fh wkspc4...
4a500 20 20 67 65 74 73 20 24 66 68 20 69 63 6f 6e 62 gets $fh iconb
4a510 67 20 3b 23 63 6f 6e 74 72 6f 6c 20 70 61 6e 65 g ;#control pane
4a520 6c 20 62 67 20 74 6f 6f 0a 09 09 20 20 20 20 63 l bg too... c
4a530 6c 6f 73 65 20 24 66 68 0a 0a 09 09 20 20 20 20 lose $fh....
4a540 6f 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e 74 72 option add *Entr
4a550 79 2e 68 69 67 68 6c 69 67 68 74 43 6f 6c 6f 72 y.highlightColor
4a560 20 24 61 63 74 69 76 65 74 69 74 6c 65 20 75 73 $activetitle us
4a570 65 72 44 65 66 61 75 6c 74 0a 09 09 20 20 20 20 erDefault...
4a580 6f 70 74 69 6f 6e 20 61 64 64 20 2a 73 65 6c 65 option add *sele
4a590 63 74 43 6f 6c 6f 72 20 24 61 63 74 69 76 65 74 ctColor $activet
4a5a0 69 74 6c 65 20 75 73 65 72 44 65 66 61 75 6c 74 itle userDefault
4a5b0 0a 09 09 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 ... option ad
4a5c0 64 20 2a 54 65 78 74 2e 68 69 67 68 6c 69 67 68 d *Text.highligh
4a5d0 74 43 6f 6c 6f 72 20 24 77 6b 73 70 63 34 20 75 tColor $wkspc4 u
4a5e0 73 65 72 44 65 66 61 75 6c 74 0a 09 09 20 20 20 serDefault...
4a5f0 20 6f 70 74 69 6f 6e 20 61 64 64 20 2a 44 69 61 option add *Dia
4a600 6c 6f 67 2e 42 61 63 6b 67 72 6f 75 6e 64 20 24 log.Background $
4a610 6d 65 6e 75 62 67 20 75 73 65 72 44 65 66 61 75 menubg userDefau
4a620 6c 74 0a 09 09 20 20 20 20 6f 70 74 69 6f 6e 20 lt... option
4a630 61 64 64 20 2a 4d 65 6e 75 2e 42 61 63 6b 67 72 add *Menu.Backgr
4a640 6f 75 6e 64 20 24 6d 65 6e 75 62 67 20 75 73 65 ound $menubg use
4a650 72 44 65 66 61 75 6c 74 0a 09 09 20 20 20 20 6f rDefault... o
4a660 70 74 69 6f 6e 20 61 64 64 20 2a 4d 65 6e 75 62 ption add *Menub
4a670 75 74 74 6f 6e 2e 42 61 63 6b 67 72 6f 75 6e 64 utton.Background
4a680 20 24 6d 65 6e 75 62 67 20 75 73 65 72 44 65 66 $menubg userDef
4a690 61 75 6c 74 0a 09 09 20 20 20 20 6f 70 74 69 6f ault... optio
4a6a0 6e 20 61 64 64 20 2a 4d 65 6e 75 2e 61 63 74 69 n add *Menu.acti
4a6b0 76 65 42 61 63 6b 67 72 6f 75 6e 64 20 24 6d 65 veBackground $me
4a6c0 6e 75 62 67 20 75 73 65 72 44 65 66 61 75 6c 74 nubg userDefault
4a6d0 0a 09 09 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 ... option ad
4a6e0 64 20 2a 4d 65 6e 75 62 75 74 74 6f 6e 2e 61 63 d *Menubutton.ac
4a6f0 74 69 76 65 42 61 63 6b 67 72 6f 75 6e 64 20 24 tiveBackground $
4a700 6d 65 6e 75 62 67 20 75 73 65 72 44 65 66 61 75 menubg userDefau
4a710 6c 74 0a 09 09 20 20 20 20 73 65 74 20 77 28 73 lt... set w(s
4a720 65 6c 63 6f 6c 6f 72 29 20 24 61 63 74 69 76 65 elcolor) $active
4a730 74 69 74 6c 65 0a 09 09 7d 0a 09 20 20 20 20 7d title...}.. }
4a740 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b ..}. } else {
4a750 0a 09 70 75 74 73 20 73 74 64 65 72 72 20 22 4e ..puts stderr "N
4a760 65 69 74 68 65 72 20 7e 2f 2e 64 74 2f 73 65 73 either ~/.dt/ses
4a770 73 69 6f 6e 73 2f 63 75 72 72 65 6e 74 2f 64 74 sions/current/dt
4a780 2e 72 65 73 6f 75 72 63 65 73 20 6e 6f 72 22 0a .resources nor".
4a790 09 70 75 74 73 20 73 74 64 65 72 72 20 22 20 20 .puts stderr "
4a7a0 20 20 20 20 20 20 7e 2f 2e 64 74 2f 73 65 73 73 ~/.dt/sess
4a7b0 69 6f 6e 73 2f 68 6f 6d 65 2f 64 74 2e 72 65 73 ions/home/dt.res
4a7c0 6f 75 72 63 65 73 20 77 61 73 20 72 65 61 64 61 ources was reada
4a7d0 62 6c 65 22 0a 09 70 75 74 73 20 73 74 64 65 72 ble"..puts stder
4a7e0 72 20 22 20 20 20 46 61 6c 6c 69 6e 67 20 62 61 r " Falling ba
4a7f0 63 6b 20 74 6f 20 70 6c 61 69 6e 20 58 22 0a 09 ck to plain X"..
4a800 72 65 74 75 72 6e 20 30 0a 20 20 20 20 7d 0a 0a return 0. }..
4a810 20 20 20 20 23 6f 70 74 69 6f 6e 20 61 64 64 20 #option add
4a820 2a 42 75 74 74 6f 6e 2e 66 6f 6e 74 20 24 67 75 *Button.font $gu
4a830 69 66 6f 6e 74 20 75 73 65 72 44 65 66 61 75 6c ifont userDefaul
4a840 74 0a 20 20 20 20 23 6f 70 74 69 6f 6e 20 61 64 t. #option ad
4a850 64 20 2a 4c 61 62 65 6c 2e 66 6f 6e 74 20 24 67 d *Label.font $g
4a860 75 69 66 6f 6e 74 20 75 73 65 72 44 65 66 61 75 uifont userDefau
4a870 6c 74 0a 20 20 20 20 23 6f 70 74 69 6f 6e 20 61 lt. #option a
4a880 64 64 20 2a 4d 65 6e 75 2e 66 6f 6e 74 20 24 67 dd *Menu.font $g
4a890 75 69 66 6f 6e 74 20 75 73 65 72 44 65 66 61 75 uifont userDefau
4a8a0 6c 74 0a 20 20 20 20 23 6f 70 74 69 6f 6e 20 61 lt. #option a
4a8b0 64 64 20 2a 4d 65 6e 75 62 75 74 74 6f 6e 2e 66 dd *Menubutton.f
4a8c0 6f 6e 74 20 24 67 75 69 66 6f 6e 74 20 75 73 65 ont $guifont use
4a8d0 72 44 65 66 61 75 6c 74 0a 20 20 20 20 23 6f 70 rDefault. #op
4a8e0 74 69 6f 6e 20 61 64 64 20 2a 44 69 61 6c 6f 67 tion add *Dialog
4a8f0 2e 6d 73 67 2e 66 6f 6e 74 20 24 64 6c 67 66 6f .msg.font $dlgfo
4a900 6e 74 20 75 73 65 72 44 65 66 61 75 6c 74 0a 0a nt userDefault..
4a910 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 64 20 2a option add *
4a920 54 65 78 74 2e 42 61 63 6b 67 72 6f 75 6e 64 20 Text.Background
4a930 24 74 65 78 74 62 67 20 75 73 65 72 44 65 66 61 $textbg userDefa
4a940 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 ult. option a
4a950 64 64 20 2a 45 6e 74 72 79 2e 42 61 63 6b 67 72 dd *Entry.Backgr
4a960 6f 75 6e 64 20 24 74 65 78 74 62 67 20 75 73 65 ound $textbg use
4a970 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f 70 74 rDefault. opt
4a980 69 6f 6e 20 61 64 64 20 2a 54 65 78 74 2e 46 6f ion add *Text.Fo
4a990 72 65 67 72 6f 75 6e 64 20 24 74 65 78 74 66 67 reground $textfg
4a9a0 20 75 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 userDefault.
4a9b0 20 6f 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e 74 option add *Ent
4a9c0 72 79 2e 46 6f 72 65 67 72 6f 75 6e 64 20 24 74 ry.Foreground $t
4a9d0 65 78 74 66 67 20 75 73 65 72 44 65 66 61 75 6c extfg userDefaul
4a9e0 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 64 t. option add
4a9f0 20 2a 42 75 74 74 6f 6e 2e 61 63 74 69 76 65 42 *Button.activeB
4aa00 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 20 75 73 ackground $bg us
4aa10 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f 70 erDefault. op
4aa20 74 69 6f 6e 20 61 64 64 20 2a 42 75 74 74 6f 6e tion add *Button
4aa30 2e 61 63 74 69 76 65 46 6f 72 65 67 72 6f 75 6e .activeForegroun
4aa40 64 20 24 66 67 20 75 73 65 72 44 65 66 61 75 6c d $fg userDefaul
4aa50 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 64 t. option add
4aa60 20 2a 53 63 72 6f 6c 6c 62 61 72 2e 61 63 74 69 *Scrollbar.acti
4aa70 76 65 42 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 veBackground $bg
4aa80 20 75 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 userDefault.
4aa90 20 6f 70 74 69 6f 6e 20 61 64 64 20 2a 53 63 72 option add *Scr
4aaa0 6f 6c 6c 62 61 72 2e 74 72 6f 75 67 68 43 6f 6c ollbar.troughCol
4aab0 6f 72 20 24 73 68 61 64 6f 77 20 75 73 65 72 44 or $shadow userD
4aac0 65 66 61 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f efault. optio
4aad0 6e 20 61 64 64 20 2a 43 61 6e 76 61 73 2e 42 61 n add *Canvas.Ba
4aae0 63 6b 67 72 6f 75 6e 64 20 24 73 68 61 64 6f 77 ckground $shadow
4aaf0 20 75 73 65 72 44 65 66 61 75 6c 74 0a 0a 20 20 userDefault..
4ab00 20 20 23 20 54 68 65 73 65 20 6d 65 6e 75 20 63 # These menu c
4ab10 6f 6e 66 69 67 73 20 77 6f 72 6b 20 69 66 20 79 onfigs work if y
4ab20 6f 75 20 75 73 65 20 6e 61 74 69 76 65 20 6d 65 ou use native me
4ab30 6e 75 73 2e 0a 20 20 20 20 6f 70 74 69 6f 6e 20 nus.. option
4ab40 61 64 64 20 2a 4d 65 6e 75 2e 62 6f 72 64 65 72 add *Menu.border
4ab50 57 69 64 74 68 20 31 20 75 73 65 72 44 65 66 61 Width 1 userDefa
4ab60 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 ult. option a
4ab70 64 64 20 2a 4d 65 6e 75 2e 61 63 74 69 76 65 46 dd *Menu.activeF
4ab80 6f 72 65 67 72 6f 75 6e 64 20 24 66 67 20 75 73 oreground $fg us
4ab90 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f 70 erDefault. op
4aba0 74 69 6f 6e 20 61 64 64 20 2a 4d 65 6e 75 62 75 tion add *Menubu
4abb0 74 74 6f 6e 2e 61 63 74 69 76 65 46 6f 72 65 67 tton.activeForeg
4abc0 72 6f 75 6e 64 20 24 66 67 20 75 73 65 72 44 65 round $fg userDe
4abd0 66 61 75 6c 74 0a 0a 20 20 20 20 23 20 54 68 69 fault.. # Thi
4abe0 73 20 64 72 61 77 73 20 61 20 74 68 69 6e 20 62 s draws a thin b
4abf0 6f 72 64 65 72 20 61 72 6f 75 6e 64 20 62 75 74 order around but
4ac00 74 6f 6e 73 0a 20 20 20 20 23 6f 70 74 69 6f 6e tons. #option
4ac10 20 61 64 64 20 2a 68 69 67 68 6c 69 67 68 74 42 add *highlightB
4ac20 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 20 75 73 ackground $bg us
4ac30 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 23 20 erDefault. #
4ac40 53 75 70 70 72 65 73 73 20 74 68 65 20 62 6f 72 Suppress the bor
4ac50 64 65 72 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 der. option a
4ac60 64 64 20 2a 48 69 67 68 6c 69 67 68 74 54 68 69 dd *HighlightThi
4ac70 63 6b 6e 65 73 73 20 30 20 75 73 65 72 44 65 66 ckness 0 userDef
4ac80 61 75 6c 74 0a 20 20 20 20 23 20 41 64 64 20 69 ault. # Add i
4ac90 74 20 62 61 63 6b 20 66 6f 72 20 74 65 78 74 20 t back for text
4aca0 61 6e 64 20 65 6e 74 72 79 20 77 69 64 67 65 74 and entry widget
4acb0 73 0a 20 20 20 20 6f 70 74 69 6f 6e 20 61 64 64 s. option add
4acc0 20 2a 54 65 78 74 2e 68 69 67 68 6c 69 67 68 74 *Text.highlight
4acd0 42 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 20 75 Background $bg u
4ace0 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f serDefault. o
4acf0 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e 74 72 79 ption add *Entry
4ad00 2e 68 69 67 68 6c 69 67 68 74 42 61 63 6b 67 72 .highlightBackgr
4ad10 6f 75 6e 64 20 24 62 67 20 75 73 65 72 44 65 66 ound $bg userDef
4ad20 61 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 ault. option
4ad30 61 64 64 20 2a 54 65 78 74 2e 48 69 67 68 6c 69 add *Text.Highli
4ad40 67 68 74 54 68 69 63 6b 6e 65 73 73 20 32 20 75 ghtThickness 2 u
4ad50 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f serDefault. o
4ad60 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e 74 72 79 ption add *Entry
4ad70 2e 48 69 67 68 6c 69 67 68 74 54 68 69 63 6b 6e .HighlightThickn
4ad80 65 73 73 20 31 20 75 73 65 72 44 65 66 61 75 6c ess 1 userDefaul
4ad90 74 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 31 0a t.. return 1.
4ada0 7d 0a 0a 23 20 4d 61 79 62 65 20 74 68 69 73 20 }..# Maybe this
4adb0 63 6f 75 6c 64 20 62 65 20 65 6e 68 61 6e 63 65 could be enhance
4adc0 64 20 74 6f 20 67 65 74 20 63 6f 6e 66 69 67 73 d to get configs
4add0 20 66 72 6f 6d 20 74 68 65 6d 65 73 20 61 6e 64 from themes and
4ade0 20 73 6f 20 6f 6e 3f 0a 23 20 52 69 67 68 74 20 so on?.# Right
4adf0 6e 6f 77 20 69 74 20 6a 75 73 74 20 73 65 74 73 now it just sets
4ae00 20 63 6f 6c 6f 72 73 20 73 6f 20 65 76 65 72 79 colors so every
4ae10 74 68 69 6e 67 20 69 73 6e 27 74 20 62 6c 69 6e thing isn't blin
4ae20 64 69 6e 67 20 77 68 69 74 65 2e 0a 70 72 6f 63 ding white..proc
4ae30 20 67 65 74 5f 61 71 75 61 5f 70 61 72 61 6d 73 get_aqua_params
4ae40 20 7b 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c {} {. global
4ae50 20 77 0a 0a 20 20 20 20 23 20 54 68 69 73 20 64 w.. # This d
4ae60 6f 65 73 6e 27 74 20 73 65 65 6d 20 74 6f 20 64 oesn't seem to d
4ae70 6f 20 61 6e 79 74 68 69 6e 67 3f 0a 20 20 20 20 o anything?.
4ae80 73 65 74 20 77 28 73 65 6c 63 6f 6c 6f 72 29 20 set w(selcolor)
4ae90 6c 69 67 68 74 73 74 65 65 6c 62 6c 75 65 0a 0a lightsteelblue..
4aea0 20 20 20 20 23 20 62 75 74 74 6f 6e 20 68 69 67 # button hig
4aeb0 68 6c 69 67 68 74 62 61 63 6b 67 72 6f 75 6e 64 hlightbackground
4aec0 20 68 61 73 20 74 6f 20 62 65 20 74 68 65 20 73 has to be the s
4aed0 61 6d 65 20 61 73 20 62 61 63 6b 67 72 6f 75 6e ame as backgroun
4aee0 64 0a 20 20 20 20 23 20 6f 72 20 65 6c 73 65 20 d. # or else
4aef0 74 68 65 72 65 20 61 72 65 20 6c 69 74 74 6c 65 there are little
4af00 20 77 68 69 74 65 20 62 6f 78 65 73 20 61 72 6f white boxes aro
4af10 75 6e 64 20 74 68 65 20 62 75 74 74 6f 6e 20 22 und the button "
4af20 70 69 6c 6c 22 0a 20 20 20 20 6f 70 74 69 6f 6e pill". option
4af30 20 61 64 64 20 2a 62 61 63 6b 67 72 6f 75 6e 64 add *background
4af40 20 23 65 62 65 62 65 62 20 75 73 65 72 44 65 66 #ebebeb userDef
4af50 61 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f 6e 20 ault. option
4af60 61 64 64 20 2a 42 75 74 74 6f 6e 2e 68 69 67 68 add *Button.high
4af70 6c 69 67 68 74 42 61 63 6b 67 72 6f 75 6e 64 20 lightBackground
4af80 23 65 62 65 62 65 62 20 75 73 65 72 44 65 66 61 #ebebeb userDefa
4af90 75 6c 74 0a 0a 20 20 20 20 6f 70 74 69 6f 6e 20 ult.. option
4afa0 61 64 64 20 2a 45 6e 74 72 79 2e 48 69 67 68 6c add *Entry.Highl
4afb0 69 67 68 74 54 68 69 63 6b 6e 65 73 73 20 32 20 ightThickness 2
4afc0 75 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 userDefault.
4afd0 6f 70 74 69 6f 6e 20 61 64 64 20 2a 45 6e 74 72 option add *Entr
4afe0 79 2e 68 69 67 68 6c 69 67 68 74 42 61 63 6b 67 y.highlightBackg
4aff0 72 6f 75 6e 64 20 24 77 28 73 65 6c 63 6f 6c 6f round $w(selcolo
4b000 72 29 20 75 73 65 72 44 65 66 61 75 6c 74 0a 20 r) userDefault.
4b010 20 20 20 23 6f 70 74 69 6f 6e 20 61 64 64 20 2a #option add *
4b020 43 61 6e 76 61 73 2e 62 61 63 6b 67 72 6f 75 6e Canvas.backgroun
4b030 64 20 23 65 65 65 65 65 65 20 75 73 65 72 44 65 d #eeeeee userDe
4b040 66 61 75 6c 74 0a 20 20 20 20 6f 70 74 69 6f 6e fault. option
4b050 20 61 64 64 20 2a 45 6e 74 72 79 2e 62 61 63 6b add *Entry.back
4b060 67 72 6f 75 6e 64 20 23 66 66 66 66 66 66 20 75 ground #ffffff u
4b070 73 65 72 44 65 66 61 75 6c 74 0a 20 20 20 20 6f serDefault. o
4b080 70 74 69 6f 6e 20 61 64 64 20 2a 54 65 78 74 2e ption add *Text.
4b090 62 61 63 6b 67 72 6f 75 6e 64 20 77 68 69 74 65 background white
4b0a0 20 75 73 65 72 44 65 66 61 75 6c 74 0a 7d 0a 0a userDefault.}..
4b0b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b0c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b0d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b0e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4b0f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
4b100 0a 23 20 72 75 6e 20 74 68 65 20 6d 61 69 6e 20 .# run the main
4b110 70 72 6f 63 0a 6d 61 69 6e 0a 0a proc.main..