Bwidget Source Code
Hex Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Artifact 5b2f4f7edb79250147a5c93a2a44abbdc3de4faf:


0000: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0050: 0a 23 20 20 6d 61 69 6e 66 72 61 6d 65 2e 74 63  .#  mainframe.tc
0060: 6c 0a 23 20 20 54 68 69 73 20 66 69 6c 65 20 69  l.#  This file i
0070: 73 20 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78  s part of Unifix
0080: 20 42 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74   BWidget Toolkit
0090: 0a 23 20 20 24 49 64 3a 20 6d 61 69 6e 66 72 61  .#  $Id: mainfra
00a0: 6d 65 2e 74 63 6c 2c 76 20 31 2e 31 31 20 32 30  me.tcl,v 1.11 20
00b0: 30 31 2f 31 32 2f 32 39 20 30 32 3a 30 36 3a 33  01/12/29 02:06:3
00c0: 36 20 68 6f 62 62 73 20 45 78 70 20 24 0a 23 20  6 hobbs Exp $.# 
00d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0120: 20 20 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d 61    Index of comma
0130: 6e 64 73 3a 0a 23 20 20 20 20 20 2d 20 4d 61 69  nds:.#     - Mai
0140: 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74 65 0a 23  nFrame::create.#
0150: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
0160: 3a 3a 63 6f 6e 66 69 67 75 72 65 0a 23 20 20 20  ::configure.#   
0170: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63    - MainFrame::c
0180: 67 65 74 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e  get.#     - Main
0190: 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 0a  Frame::getframe.
01a0: 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d  #     - MainFram
01b0: 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 0a 23 20  e::addtoolbar.# 
01c0: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
01d0: 3a 67 65 74 74 6f 6f 6c 62 61 72 0a 23 20 20 20  :gettoolbar.#   
01e0: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61    - MainFrame::a
01f0: 64 64 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20  ddindicator.#   
0200: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67    - MainFrame::g
0210: 65 74 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20  etindicator.#   
0220: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67    - MainFrame::g
0230: 65 74 6d 65 6e 75 0a 23 20 20 20 20 20 2d 20 4d  etmenu.#     - M
0240: 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e  ainFrame::menuon
0250: 6c 79 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46  ly.#     - MainF
0260: 72 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61  rame::showtoolba
0270: 72 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  r.#     - MainFr
0280: 61 6d 65 3a 3a 73 68 6f 77 73 74 61 74 75 73 62  ame::showstatusb
0290: 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46  ar.#     - MainF
02a0: 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 6d 65  rame::_create_me
02b0: 6e 75 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61  nubar.#     - Ma
02c0: 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65  inFrame::_create
02d0: 5f 65 6e 74 72 69 65 73 0a 23 20 20 20 20 20 2d  _entries.#     -
02e0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72   MainFrame::_par
02f0: 73 65 5f 6e 61 6d 65 0a 23 20 20 20 20 20 2d 20  se_name.#     - 
0300: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73  MainFrame::_pars
0310: 65 5f 61 63 63 65 6c 65 72 61 74 6f 72 0a 23 20  e_accelerator.# 
0320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a  --------------..
0370: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 4d  namespace eval M
0380: 61 69 6e 46 72 61 6d 65 20 7b 0a 20 20 20 20 50  ainFrame {.    P
0390: 72 6f 67 72 65 73 73 42 61 72 3a 3a 75 73 65 0a  rogressBar::use.
03a0: 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 62 77 69  .    Widget::bwi
03b0: 6e 63 6c 75 64 65 20 4d 61 69 6e 46 72 61 6d 65  nclude MainFrame
03c0: 20 50 72 6f 67 72 65 73 73 42 61 72 20 2e 73 74   ProgressBar .st
03d0: 61 74 75 73 2e 70 72 67 20 5c 0a 09 20 20 20 20  atus.prg \..    
03e0: 72 65 6d 6f 76 65 20 7b 0a 09 2d 66 67 20 2d 62  remove {..-fg -b
03f0: 67 20 2d 62 64 20 2d 74 72 6f 75 67 68 63 6f 6c  g -bd -troughcol
0400: 6f 72 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 2d  or -background -
0410: 62 6f 72 64 65 72 77 69 64 74 68 0a 09 2d 72 65  borderwidth..-re
0420: 6c 69 65 66 20 2d 6f 72 69 65 6e 74 20 2d 77 69  lief -orient -wi
0430: 64 74 68 20 2d 68 65 69 67 68 74 0a 20 20 20 20  dth -height.    
0440: 7d 20 5c 0a 09 20 20 20 20 72 65 6e 61 6d 65 20  } \..    rename 
0450: 7b 0a 09 2d 6d 61 78 69 6d 75 6d 20 20 20 20 2d  {..-maximum    -
0460: 70 72 6f 67 72 65 73 73 6d 61 78 0a 09 2d 76 61  progressmax..-va
0470: 72 69 61 62 6c 65 20 20 20 2d 70 72 6f 67 72 65  riable   -progre
0480: 73 73 76 61 72 0a 09 2d 74 79 70 65 20 20 20 20  ssvar..-type    
0490: 20 20 20 2d 70 72 6f 67 72 65 73 73 74 79 70 65     -progresstype
04a0: 0a 09 2d 66 6f 72 65 67 72 6f 75 6e 64 20 2d 70  ..-foreground -p
04b0: 72 6f 67 72 65 73 73 66 67 0a 20 20 20 20 7d 0a  rogressfg.    }.
04c0: 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 64 65 63  .    Widget::dec
04d0: 6c 61 72 65 20 4d 61 69 6e 46 72 61 6d 65 20 7b  lare MainFrame {
04e0: 0a 09 7b 2d 77 69 64 74 68 20 20 20 20 20 20 20  ..{-width       
04f0: 20 54 6b 52 65 73 6f 75 72 63 65 20 30 20 20 20   TkResource 0   
0500: 20 20 20 30 20 66 72 61 6d 65 7d 0a 09 7b 2d 68     0 frame}..{-h
0510: 65 69 67 68 74 20 20 20 20 20 20 20 54 6b 52 65  eight       TkRe
0520: 73 6f 75 72 63 65 20 30 20 20 20 20 20 20 30 20  source 0      0 
0530: 66 72 61 6d 65 7d 0a 09 7b 2d 62 61 63 6b 67 72  frame}..{-backgr
0540: 6f 75 6e 64 20 20 20 54 6b 52 65 73 6f 75 72 63  ound   TkResourc
0550: 65 20 22 22 20 20 20 20 20 30 20 66 72 61 6d 65  e ""     0 frame
0560: 7d 0a 09 7b 2d 74 65 78 74 76 61 72 69 61 62 6c  }..{-textvariabl
0570: 65 20 53 74 72 69 6e 67 20 20 20 20 20 22 22 20  e String     "" 
0580: 20 20 20 20 30 7d 0a 09 7b 2d 6d 65 6e 75 20 20      0}..{-menu  
0590: 20 20 20 20 20 20 20 53 74 72 69 6e 67 20 20 20         String   
05a0: 20 20 7b 7d 20 20 20 20 20 31 7d 0a 09 7b 2d 73    {}     1}..{-s
05b0: 65 70 61 72 61 74 6f 72 20 20 20 20 45 6e 75 6d  eparator    Enum
05c0: 20 20 20 20 20 20 20 62 6f 74 68 20 20 20 31 20         both   1 
05d0: 7b 6e 6f 6e 65 20 74 6f 70 20 62 6f 74 74 6f 6d  {none top bottom
05e0: 20 62 6f 74 68 7d 7d 0a 09 7b 2d 62 67 20 20 20   both}}..{-bg   
05f0: 20 20 20 20 20 20 20 20 53 79 6e 6f 6e 79 6d 20          Synonym 
0600: 20 20 20 2d 62 61 63 6b 67 72 6f 75 6e 64 7d 0a     -background}.
0610: 0a 09 7b 2d 6d 65 6e 75 62 61 72 66 6f 6e 74 20  ..{-menubarfont 
0620: 20 20 53 74 72 69 6e 67 20 20 20 20 20 22 22 20    String     "" 
0630: 20 30 7d 0a 09 7b 2d 6d 65 6e 75 65 6e 74 72 79   0}..{-menuentry
0640: 66 6f 6e 74 20 53 74 72 69 6e 67 20 20 20 20 20  font String     
0650: 22 22 20 20 30 7d 0a 09 7b 2d 73 74 61 74 75 73  ""  0}..{-status
0660: 62 61 72 66 6f 6e 74 20 53 74 72 69 6e 67 20 20  barfont String  
0670: 20 20 20 22 22 20 20 30 7d 0a 20 20 20 20 7d 0a     ""  0}.    }.
0680: 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64  .    Widget::add
0690: 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22  map MainFrame ""
06a0: 20 2e 66 72 61 6d 65 20 20 7b 2d 77 69 64 74 68   .frame  {-width
06b0: 20 7b 7d 20 2d 68 65 69 67 68 74 20 7b 7d 20 2d   {} -height {} -
06c0: 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20  background {}}. 
06d0: 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61     Widget::addma
06e0: 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e  p MainFrame "" .
06f0: 74 6f 70 66 20 20 20 7b 2d 62 61 63 6b 67 72 6f  topf   {-backgro
0700: 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67  und {}}.    Widg
0710: 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46  et::addmap MainF
0720: 72 61 6d 65 20 22 22 20 2e 62 6f 74 66 20 20 20  rame "" .botf   
0730: 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d  {-background {}}
0740: 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64  .    Widget::add
0750: 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22  map MainFrame ""
0760: 20 2e 73 74 61 74 75 73 20 7b 2d 62 61 63 6b 67   .status {-backg
0770: 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69  round {}}.    Wi
0780: 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69  dget::addmap Mai
0790: 6e 46 72 61 6d 65 20 22 22 20 2e 73 74 61 74 75  nFrame "" .statu
07a0: 73 2e 6c 61 62 65 6c 20 7b 2d 62 61 63 6b 67 72  s.label {-backgr
07b0: 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64  ound {}}.    Wid
07c0: 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e  get::addmap Main
07d0: 46 72 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73  Frame "" .status
07e0: 2e 69 6e 64 66 20 20 7b 2d 62 61 63 6b 67 72 6f  .indf  {-backgro
07f0: 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67  und {}}.    Widg
0800: 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46  et::addmap MainF
0810: 72 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e  rame "" .status.
0820: 70 72 67 66 20 20 7b 2d 62 61 63 6b 67 72 6f 75  prgf  {-backgrou
0830: 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65  nd {}}.    Widge
0840: 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72  t::addmap MainFr
0850: 61 6d 65 20 50 72 6f 67 72 65 73 73 42 61 72 20  ame ProgressBar 
0860: 2e 73 74 61 74 75 73 2e 70 72 67 20 7b 2d 62 61  .status.prg {-ba
0870: 63 6b 67 72 6f 75 6e 64 20 7b 7d 20 2d 62 61 63  ckground {} -bac
0880: 6b 67 72 6f 75 6e 64 20 2d 74 72 6f 75 67 68 63  kground -troughc
0890: 6f 6c 6f 72 7d 0a 0a 20 20 20 20 70 72 6f 63 20  olor}..    proc 
08a0: 3a 3a 4d 61 69 6e 46 72 61 6d 65 20 7b 20 70 61  ::MainFrame { pa
08b0: 74 68 20 61 72 67 73 20 7d 20 7b 20 72 65 74 75  th args } { retu
08c0: 72 6e 20 5b 65 76 61 6c 20 4d 61 69 6e 46 72 61  rn [eval MainFra
08d0: 6d 65 3a 3a 63 72 65 61 74 65 20 24 70 61 74 68  me::create $path
08e0: 20 24 61 72 67 73 5d 20 7d 0a 20 20 20 20 70 72   $args] }.    pr
08f0: 6f 63 20 75 73 65 20 7b 7d 20 7b 7d 0a 0a 20 20  oc use {} {}..  
0900: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
0910: 65 74 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d  et.}...# -------
0920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0960: 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
0970: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 72  nd MainFrame::cr
0980: 65 61 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  eate.# ---------
0990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09d0: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
09e0: 72 61 6d 65 3a 3a 63 72 65 61 74 65 20 7b 20 70  rame::create { p
09f0: 61 74 68 20 61 72 67 73 20 7d 20 7b 0a 20 20 20  ath args } {.   
0a00: 20 67 6c 6f 62 61 6c 20 20 20 74 63 6c 5f 70 6c   global   tcl_pl
0a10: 61 74 66 6f 72 6d 0a 20 20 20 20 76 61 72 69 61  atform.    varia
0a20: 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20  ble _widget..   
0a30: 20 73 65 74 20 70 61 74 68 20 5b 66 72 61 6d 65   set path [frame
0a40: 20 24 70 61 74 68 20 2d 74 61 6b 65 66 6f 63 75   $path -takefocu
0a50: 73 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68  s 0 -highlightth
0a60: 69 63 6b 6e 65 73 73 20 30 5d 0a 20 20 20 20 73  ickness 0].    s
0a70: 65 74 20 74 6f 70 20 20 5b 77 69 6e 66 6f 20 70  et top  [winfo p
0a80: 61 72 65 6e 74 20 24 70 61 74 68 5d 0a 20 20 20  arent $path].   
0a90: 20 69 66 20 7b 20 5b 73 74 72 69 6e 67 20 63 6f   if { [string co
0aa0: 6d 70 61 72 65 20 5b 77 69 6e 66 6f 20 74 6f 70  mpare [winfo top
0ab0: 6c 65 76 65 6c 20 24 70 61 74 68 5d 20 24 74 6f  level $path] $to
0ac0: 70 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 64  p] } {.        d
0ad0: 65 73 74 72 6f 79 20 24 70 61 74 68 0a 20 20 20  estroy $path.   
0ae0: 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63 6f 64       return -cod
0af0: 65 20 65 72 72 6f 72 20 22 70 61 72 65 6e 74 20  e error "parent 
0b00: 6d 75 73 74 20 62 65 20 61 20 74 6f 70 6c 65 76  must be a toplev
0b10: 65 6c 22 0a 20 20 20 20 7d 0a 20 20 20 20 57 69  el".    }.    Wi
0b20: 64 67 65 74 3a 3a 69 6e 69 74 20 4d 61 69 6e 46  dget::init MainF
0b30: 72 61 6d 65 20 24 70 61 74 68 20 24 61 72 67 73  rame $path $args
0b40: 0a 0a 20 20 20 20 69 66 20 7b 20 24 74 63 6c 5f  ..    if { $tcl_
0b50: 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72  platform(platfor
0b60: 6d 29 20 3d 3d 20 22 75 6e 69 78 22 20 7d 20 7b  m) == "unix" } {
0b70: 0a 20 20 20 20 20 20 20 20 73 65 74 20 72 65 6c  .        set rel
0b80: 69 65 66 20 72 61 69 73 65 64 0a 20 20 20 20 20  ief raised.     
0b90: 20 20 20 73 65 74 20 62 64 20 20 20 20 20 31 0a     set bd     1.
0ba0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20      } else {.   
0bb0: 20 20 20 20 20 73 65 74 20 72 65 6c 69 65 66 20       set relief 
0bc0: 66 6c 61 74 0a 20 20 20 20 20 20 20 20 73 65 74  flat.        set
0bd0: 20 62 64 20 20 20 20 20 30 0a 20 20 20 20 7d 0a   bd     0.    }.
0be0: 20 20 20 20 73 65 74 20 74 6f 70 66 72 61 6d 65      set topframe
0bf0: 20 20 5b 65 76 61 6c 20 66 72 61 6d 65 20 24 70    [eval frame $p
0c00: 61 74 68 2e 74 6f 70 66 20 2d 72 65 6c 69 65 66  ath.topf -relief
0c10: 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64   flat -borderwid
0c20: 74 68 20 30 20 5c 0a 09 20 20 20 20 5b 57 69 64  th 0 \..    [Wid
0c30: 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70 61  get::subcget $pa
0c40: 74 68 20 2e 74 6f 70 66 5d 5d 0a 20 20 20 20 73  th .topf]].    s
0c50: 65 74 20 75 73 65 72 66 72 61 6d 65 20 5b 65 76  et userframe [ev
0c60: 61 6c 20 66 72 61 6d 65 20 24 70 61 74 68 2e 66  al frame $path.f
0c70: 72 61 6d 65 20 5b 57 69 64 67 65 74 3a 3a 73 75  rame [Widget::su
0c80: 62 63 67 65 74 20 24 70 61 74 68 20 2e 66 72 61  bcget $path .fra
0c90: 6d 65 5d 20 5c 0a 20 20 20 20 20 20 20 20 20 20  me] \.          
0ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 72 65               -re
0cb0: 6c 69 65 66 20 24 72 65 6c 69 65 66 20 2d 62 6f  lief $relief -bo
0cc0: 72 64 65 72 77 69 64 74 68 20 24 62 64 5d 0a 20  rderwidth $bd]. 
0cd0: 20 20 20 73 65 74 20 62 6f 74 66 72 61 6d 65 20     set botframe 
0ce0: 20 5b 65 76 61 6c 20 66 72 61 6d 65 20 24 70 61   [eval frame $pa
0cf0: 74 68 2e 62 6f 74 66 20 2d 72 65 6c 69 65 66 20  th.botf -relief 
0d00: 24 72 65 6c 69 65 66 20 2d 62 6f 72 64 65 72 77  $relief -borderw
0d10: 69 64 74 68 20 24 62 64 20 5c 0a 09 20 20 20 20  idth $bd \..    
0d20: 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74  [Widget::subcget
0d30: 20 24 70 61 74 68 20 2e 62 6f 74 66 5d 5d 0a 0a   $path .botf]]..
0d40: 20 20 20 20 70 61 63 6b 20 24 74 6f 70 66 72 61      pack $topfra
0d50: 6d 65 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 67  me -fill x.    g
0d60: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67  rid columnconfig
0d70: 75 72 65 20 24 74 6f 70 66 72 61 6d 65 20 30 20  ure $topframe 0 
0d80: 2d 77 65 69 67 68 74 20 31 0a 0a 20 20 20 20 73  -weight 1..    s
0d90: 65 74 20 62 67 20 5b 57 69 64 67 65 74 3a 3a 63  et bg [Widget::c
0da0: 67 65 74 20 24 70 61 74 68 20 2d 62 61 63 6b 67  get $path -backg
0db0: 72 6f 75 6e 64 5d 0a 20 20 20 20 24 70 61 74 68  round].    $path
0dc0: 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 61 63 6b   configure -back
0dd0: 67 72 6f 75 6e 64 20 24 62 67 0a 20 20 20 20 69  ground $bg.    i
0de0: 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72  f { $tcl_platfor
0df0: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 21 3d 20 22  m(platform) != "
0e00: 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20  unix" } {.      
0e10: 20 20 73 65 74 20 73 65 70 6f 70 74 20 5b 57 69    set sepopt [Wi
0e20: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
0e30: 24 70 61 74 68 20 2d 73 65 70 61 72 61 74 6f 72  $path -separator
0e40: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 24  ].        if { $
0e50: 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74 68 22  sepopt == "both"
0e60: 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d 3d 20 22   || $sepopt == "
0e70: 74 6f 70 22 20 7d 20 7b 0a 20 20 20 20 20 20 20  top" } {.       
0e80: 20 20 20 20 20 73 65 74 20 73 65 70 20 5b 53 65       set sep [Se
0e90: 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74 65 20  parator::create 
0ea0: 24 70 61 74 68 2e 73 65 70 20 2d 6f 72 69 65 6e  $path.sep -orien
0eb0: 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 62 61  t horizontal -ba
0ec0: 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20  ckground $bg].  
0ed0: 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 20 24            pack $
0ee0: 73 65 70 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20  sep -fill x.    
0ef0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66      }.        if
0f00: 20 7b 20 24 73 65 70 6f 70 74 20 3d 3d 20 22 62   { $sepopt == "b
0f10: 6f 74 68 22 20 7c 7c 20 24 73 65 70 6f 70 74 20  oth" || $sepopt 
0f20: 3d 3d 20 22 62 6f 74 74 6f 6d 22 20 7d 20 7b 0a  == "bottom" } {.
0f30: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20              set 
0f40: 73 65 70 20 5b 53 65 70 61 72 61 74 6f 72 3a 3a  sep [Separator::
0f50: 63 72 65 61 74 65 20 24 62 6f 74 66 72 61 6d 65  create $botframe
0f60: 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72  .sep -orient hor
0f70: 69 7a 6f 6e 74 61 6c 20 2d 62 61 63 6b 67 72 6f  izontal -backgro
0f80: 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 20 20 20  und $bg].       
0f90: 20 20 20 20 20 70 61 63 6b 20 24 73 65 70 20 2d       pack $sep -
0fa0: 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20 20 7d  fill x.        }
0fb0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 2d 2d  .    }..    # --
0fc0: 2d 20 73 74 61 74 75 73 20 62 61 72 20 2d 2d 2d  - status bar ---
0fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1010: 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 69 66 20 7b 5b  ------.    if {[
1020: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57  string length [W
1030: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
1040: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
1050: 72 66 6f 6e 74 5d 5d 20 3e 30 20 7d 20 7b 0a 09  rfont]] >0 } {..
1060: 73 65 74 20 73 62 66 6e 74 20 22 2d 66 6f 6e 74  set sbfnt "-font
1070: 20 5c 22 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f   \"[Widget::geto
1080: 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74 61  ption $path -sta
1090: 74 75 73 62 61 72 66 6f 6e 74 5d 5c 22 22 0a 20  tusbarfont]\"". 
10a0: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74     } else {..set
10b0: 20 73 62 66 6e 74 20 22 22 0a 20 20 20 20 7d 0a   sbfnt "".    }.
10c0: 0a 20 20 20 20 73 65 74 20 73 74 61 74 75 73 20  .    set status 
10d0: 20 20 5b 66 72 61 6d 65 20 24 70 61 74 68 2e 73    [frame $path.s
10e0: 74 61 74 75 73 20 2d 72 65 6c 69 65 66 20 66 6c  tatus -relief fl
10f0: 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20  at -borderwidth 
1100: 30 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  0 \.            
1110: 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65 66            -takef
1120: 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67 68  ocus 0 -highligh
1130: 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 61  tthickness 0 -ba
1140: 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20  ckground $bg].  
1150: 20 20 73 65 74 20 6c 61 62 65 6c 20 20 20 20 5b    set label    [
1160: 65 76 61 6c 20 6c 61 62 65 6c 20 24 73 74 61 74  eval label $stat
1170: 75 73 2e 6c 61 62 65 6c 20 5c 0a 09 20 20 20 20  us.label \..    
1180: 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 5b 57  -textvariable [W
1190: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
11a0: 20 24 70 61 74 68 20 2d 74 65 78 74 76 61 72 69   $path -textvari
11b0: 61 62 6c 65 5d 20 5c 0a 09 20 20 20 20 2d 74 61  able] \..    -ta
11c0: 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c  kefocus 0 -highl
11d0: 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20  ightthickness 0 
11e0: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 20  -background $bg 
11f0: 24 73 62 66 6e 74 5d 0a 20 20 20 20 73 65 74 20  $sbfnt].    set 
1200: 69 6e 64 66 72 61 6d 65 20 5b 66 72 61 6d 65 20  indframe [frame 
1210: 24 73 74 61 74 75 73 2e 69 6e 64 66 20 2d 72 65  $status.indf -re
1220: 6c 69 65 66 20 66 6c 61 74 20 2d 62 6f 72 64 65  lief flat -borde
1230: 72 77 69 64 74 68 20 30 20 5c 0a 20 20 20 20 20  rwidth 0 \.     
1240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1250: 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 2d 68   -takefocus 0 -h
1260: 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73  ighlightthicknes
1270: 73 20 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20  s 0 -background 
1280: 24 62 67 5d 0a 20 20 20 20 73 65 74 20 70 72 67  $bg].    set prg
1290: 66 72 61 6d 65 20 5b 66 72 61 6d 65 20 24 73 74  frame [frame $st
12a0: 61 74 75 73 2e 70 72 67 66 20 2d 72 65 6c 69 65  atus.prgf -relie
12b0: 66 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69  f flat -borderwi
12c0: 64 74 68 20 30 20 5c 0a 20 20 20 20 20 20 20 20  dth 0 \.        
12d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 74                -t
12e0: 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68  akefocus 0 -high
12f0: 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30  lightthickness 0
1300: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
1310: 5d 0a 0a 20 20 20 20 70 6c 61 63 65 20 24 6c 61  ]..    place $la
1320: 62 65 6c 20 20 20 20 2d 61 6e 63 68 6f 72 20 77  bel    -anchor w
1330: 20 2d 78 20 30 20 2d 72 65 6c 79 20 30 2e 35 0a   -x 0 -rely 0.5.
1340: 20 20 20 20 70 6c 61 63 65 20 24 69 6e 64 66 72      place $indfr
1350: 61 6d 65 20 2d 61 6e 63 68 6f 72 20 6e 65 20 2d  ame -anchor ne -
1360: 72 65 6c 78 20 31 20 2d 79 20 30 20 2d 72 65 6c  relx 1 -y 0 -rel
1370: 68 65 69 67 68 74 20 31 0a 20 20 20 20 70 61 63  height 1.    pac
1380: 6b 20 20 24 70 72 67 66 72 61 6d 65 20 2d 69 6e  k  $prgframe -in
1390: 20 24 69 6e 64 66 72 61 6d 65 20 2d 73 69 64 65   $indframe -side
13a0: 20 6c 65 66 74 20 2d 70 61 64 78 20 32 0a 20 20   left -padx 2.  
13b0: 20 20 24 73 74 61 74 75 73 20 63 6f 6e 66 69 67    $status config
13c0: 75 72 65 20 2d 68 65 69 67 68 74 20 5b 77 69 6e  ure -height [win
13d0: 66 6f 20 72 65 71 68 65 69 67 68 74 20 24 6c 61  fo reqheight $la
13e0: 62 65 6c 5d 0a 0a 20 20 20 20 73 65 74 20 70 72  bel]..    set pr
13f0: 6f 67 72 65 73 73 20 5b 65 76 61 6c 20 50 72 6f  ogress [eval Pro
1400: 67 72 65 73 73 42 61 72 3a 3a 63 72 65 61 74 65  gressBar::create
1410: 20 24 73 74 61 74 75 73 2e 70 72 67 20 5b 57 69   $status.prg [Wi
1420: 64 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70  dget::subcget $p
1430: 61 74 68 20 2e 73 74 61 74 75 73 2e 70 72 67 5d  ath .status.prg]
1440: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   \.             
1450: 20 20 20 20 20 20 20 20 20 2d 77 69 64 74 68 20           -width 
1460: 20 20 20 20 20 20 35 30 20 5c 0a 20 20 20 20 20        50 \.     
1470: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1480: 20 2d 68 65 69 67 68 74 20 20 20 20 20 20 5b 65   -height      [e
1490: 78 70 72 20 7b 5b 77 69 6e 66 6f 20 72 65 71 68  xpr {[winfo reqh
14a0: 65 69 67 68 74 20 24 6c 61 62 65 6c 5d 2d 32 7d  eight $label]-2}
14b0: 5d 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  ] \.            
14c0: 20 20 20 20 20 20 20 20 20 20 2d 62 6f 72 64 65            -borde
14d0: 72 77 69 64 74 68 20 31 20 5c 0a 20 20 20 20 20  rwidth 1 \.     
14e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
14f0: 20 2d 72 65 6c 69 65 66 20 20 20 20 20 20 73 75   -relief      su
1500: 6e 6b 65 6e 5d 0a 20 20 20 20 70 61 63 6b 20 24  nken].    pack $
1510: 73 74 61 74 75 73 20 20 20 20 2d 69 6e 20 24 62  status    -in $b
1520: 6f 74 66 72 61 6d 65 20 2d 66 69 6c 6c 20 78 20  otframe -fill x 
1530: 2d 70 61 64 79 20 32 0a 20 20 20 20 70 61 63 6b  -pady 2.    pack
1540: 20 24 62 6f 74 66 72 61 6d 65 20 20 2d 73 69 64   $botframe  -sid
1550: 65 20 62 6f 74 74 6f 6d 20 2d 66 69 6c 6c 20 78  e bottom -fill x
1560: 0a 20 20 20 20 70 61 63 6b 20 24 75 73 65 72 66  .    pack $userf
1570: 72 61 6d 65 20 2d 66 69 6c 6c 20 62 6f 74 68 20  rame -fill both 
1580: 2d 65 78 70 61 6e 64 20 79 65 73 0a 0a 20 20 20  -expand yes..   
1590: 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61   set _widget($pa
15a0: 74 68 2c 74 6f 70 29 20 20 20 20 20 20 24 74 6f  th,top)      $to
15b0: 70 0a 20 20 20 20 73 65 74 20 5f 77 69 64 67 65  p.    set _widge
15c0: 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c 62 61 72  t($path,ntoolbar
15d0: 29 20 30 0a 20 20 20 20 73 65 74 20 5f 77 69 64  ) 0.    set _wid
15e0: 67 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63  get($path,nindic
15f0: 29 20 20 20 30 0a 0a 20 20 20 20 73 65 74 20 6d  )   0..    set m
1600: 65 6e 75 20 5b 57 69 64 67 65 74 3a 3a 67 65 74  enu [Widget::get
1610: 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 6d 65  option $path -me
1620: 6e 75 5d 0a 20 20 20 20 69 66 20 7b 20 5b 6c 6c  nu].    if { [ll
1630: 65 6e 67 74 68 20 24 6d 65 6e 75 5d 20 7d 20 7b  ength $menu] } {
1640: 0a 20 20 20 20 20 20 20 20 5f 63 72 65 61 74 65  .        _create
1650: 5f 6d 65 6e 75 62 61 72 20 24 70 61 74 68 20 24  _menubar $path $
1660: 6d 65 6e 75 0a 20 20 20 20 7d 0a 0a 20 20 20 20  menu.    }..    
1670: 62 69 6e 64 20 24 70 61 74 68 20 3c 44 65 73 74  bind $path <Dest
1680: 72 6f 79 3e 20 7b 4d 61 69 6e 46 72 61 6d 65 3a  roy> {MainFrame:
1690: 3a 5f 64 65 73 74 72 6f 79 20 25 57 7d 0a 0a 20  :_destroy %W}.. 
16a0: 20 20 20 72 65 6e 61 6d 65 20 24 70 61 74 68 20     rename $path 
16b0: 3a 3a 24 70 61 74 68 3a 63 6d 64 0a 20 20 20 20  ::$path:cmd.    
16c0: 70 72 6f 63 20 3a 3a 24 70 61 74 68 20 7b 20 63  proc ::$path { c
16d0: 6d 64 20 61 72 67 73 20 7d 20 22 72 65 74 75 72  md args } "retur
16e0: 6e 20 5c 5b 65 76 61 6c 20 4d 61 69 6e 46 72 61  n \[eval MainFra
16f0: 6d 65 3a 3a 5c 24 63 6d 64 20 24 70 61 74 68 20  me::\$cmd $path 
1700: 5c 24 61 72 67 73 5c 5d 22 0a 0a 20 20 20 20 72  \$args\]"..    r
1710: 65 74 75 72 6e 20 24 70 61 74 68 0a 7d 0a 0a 0a  eturn $path.}...
1720: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
1730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1770: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e  .#  Command Main
1780: 46 72 61 6d 65 3a 3a 63 6f 6e 66 69 67 75 72 65  Frame::configure
1790: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
17a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17e0: 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65  -.proc MainFrame
17f0: 3a 3a 63 6f 6e 66 69 67 75 72 65 20 7b 20 70 61  ::configure { pa
1800: 74 68 20 61 72 67 73 20 7d 20 7b 0a 20 20 20 20  th args } {.    
1810: 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74  variable _widget
1820: 0a 0a 20 20 20 20 73 65 74 20 72 65 73 20 5b 57  ..    set res [W
1830: 69 64 67 65 74 3a 3a 63 6f 6e 66 69 67 75 72 65  idget::configure
1840: 20 24 70 61 74 68 20 24 61 72 67 73 5d 0a 0a 20   $path $args].. 
1850: 20 20 20 69 66 20 7b 20 5b 57 69 64 67 65 74 3a     if { [Widget:
1860: 3a 68 61 73 43 68 61 6e 67 65 64 20 24 70 61 74  :hasChanged $pat
1870: 68 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20  h -textvariable 
1880: 6e 65 77 76 5d 20 7d 20 7b 0a 20 20 20 20 20 20  newv] } {.      
1890: 20 20 75 70 6c 65 76 65 6c 20 5c 23 30 20 24 70    uplevel \#0 $p
18a0: 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65 6c  ath.status.label
18b0: 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 65 78 74   configure -text
18c0: 76 61 72 69 61 62 6c 65 20 5b 6c 69 73 74 20 24  variable [list $
18d0: 6e 65 77 76 5d 0a 20 20 20 20 7d 0a 0a 20 20 20  newv].    }..   
18e0: 20 69 66 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68   if { [Widget::h
18f0: 61 73 43 68 61 6e 67 65 64 20 24 70 61 74 68 20  asChanged $path 
1900: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 62 67 5d 20  -background bg] 
1910: 7d 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74 20  } {.        set 
1920: 6c 69 73 74 6d 65 6e 75 20 5b 24 5f 77 69 64 67  listmenu [$_widg
1930: 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 63 67  et($path,top) cg
1940: 65 74 20 2d 6d 65 6e 75 5d 0a 20 20 20 20 20 20  et -menu].      
1950: 20 20 77 68 69 6c 65 20 7b 20 5b 6c 6c 65 6e 67    while { [lleng
1960: 74 68 20 24 6c 69 73 74 6d 65 6e 75 5d 20 7d 20  th $listmenu] } 
1970: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65  {.            se
1980: 74 20 6e 65 77 6c 69 73 74 20 7b 7d 0a 20 20 20  t newlist {}.   
1990: 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68           foreach
19a0: 20 6d 65 6e 75 20 24 6c 69 73 74 6d 65 6e 75 20   menu $listmenu 
19b0: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  {.              
19c0: 20 20 24 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72    $menu configur
19d0: 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62  e -background $b
19e0: 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  g.              
19f0: 20 20 73 65 74 20 6e 65 77 6c 69 73 74 20 5b 63    set newlist [c
1a00: 6f 6e 63 61 74 20 24 6e 65 77 6c 69 73 74 20 5b  oncat $newlist [
1a10: 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e 20 24  winfo children $
1a20: 6d 65 6e 75 5d 5d 0a 20 20 20 20 20 20 20 20 20  menu]].         
1a30: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20     }.           
1a40: 20 73 65 74 20 6c 69 73 74 6d 65 6e 75 20 24 6e   set listmenu $n
1a50: 65 77 6c 69 73 74 0a 20 20 20 20 20 20 20 20 7d  ewlist.        }
1a60: 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68  .        foreach
1a70: 20 73 65 70 20 7b 2e 73 65 70 20 2e 62 6f 74 66   sep {.sep .botf
1a80: 2e 73 65 70 7d 20 7b 0a 20 20 20 20 20 20 20 20  .sep} {.        
1a90: 20 20 20 20 69 66 20 7b 20 5b 77 69 6e 66 6f 20      if { [winfo 
1aa0: 65 78 69 73 74 73 20 24 70 61 74 68 2e 24 73 65  exists $path.$se
1ab0: 70 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20  p] } {.         
1ac0: 20 20 20 20 20 20 20 53 65 70 61 72 61 74 6f 72         Separator
1ad0: 3a 3a 63 6f 6e 66 69 67 75 72 65 20 24 70 61 74  ::configure $pat
1ae0: 68 2e 24 73 65 70 20 2d 62 61 63 6b 67 72 6f 75  h.$sep -backgrou
1af0: 6e 64 20 24 62 67 0a 20 20 20 20 20 20 20 20 20  nd $bg.         
1b00: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20     }.        }. 
1b10: 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 77         foreach w
1b20: 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e   [winfo children
1b30: 20 24 70 61 74 68 2e 74 6f 70 66 5d 20 7b 0a 20   $path.topf] {. 
1b40: 20 20 20 20 20 20 20 20 20 20 20 24 77 20 63 6f             $w co
1b50: 6e 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72 6f  nfigure -backgro
1b60: 75 6e 64 20 24 62 67 0a 20 20 20 20 20 20 20 20  und $bg.        
1b70: 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20  }.    }..    if 
1b80: 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68  { [Widget::hasCh
1b90: 61 6e 67 65 64 20 24 70 61 74 68 20 2d 6d 65 6e  anged $path -men
1ba0: 75 62 61 72 66 6f 6e 74 20 6e 65 77 6d 62 66 6e  ubarfont newmbfn
1bb0: 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72  t] } {..if {[str
1bc0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 6d  ing length $newm
1bd0: 62 66 6e 74 5d 20 3e 30 20 7d 20 7b 0a 09 20 20  bfnt] >0 } {..  
1be0: 20 20 73 65 74 20 6d 62 66 6e 74 20 22 2d 66 6f    set mbfnt "-fo
1bf0: 6e 74 20 5c 22 24 6e 65 77 6d 62 66 6e 74 5c 22  nt \"$newmbfnt\"
1c00: 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20  "..} else {..   
1c10: 20 73 65 74 20 6d 62 66 6e 74 20 22 22 0a 09 7d   set mbfnt ""..}
1c20: 0a 09 73 65 74 20 74 6f 70 20 20 20 20 20 24 5f  ..set top     $_
1c30: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70  widget($path,top
1c40: 29 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 63  )..if {[string c
1c50: 6f 6d 70 61 72 65 20 24 74 6f 70 20 2e 5d 20 3d  ompare $top .] =
1c60: 3d 20 30 7d 20 7b 0a 09 20 20 20 20 65 76 61 6c  = 0} {..    eval
1c70: 20 2e 6d 65 6e 75 62 61 72 20 63 6f 6e 66 69 67   .menubar config
1c80: 75 72 65 20 24 6d 62 66 6e 74 0a 09 7d 20 65 6c  ure $mbfnt..} el
1c90: 73 65 20 7b 0a 09 20 20 20 20 65 76 61 6c 20 24  se {..    eval $
1ca0: 74 6f 70 2e 6d 65 6e 75 62 61 72 20 63 6f 6e 66  top.menubar conf
1cb0: 69 67 75 72 65 20 24 6d 62 66 6e 74 0a 09 7d 0a  igure $mbfnt..}.
1cc0: 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 20 5b      }.    if { [
1cd0: 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67  Widget::hasChang
1ce0: 65 64 20 24 70 61 74 68 20 2d 6d 65 6e 75 65 6e  ed $path -menuen
1cf0: 74 72 79 66 6f 6e 74 20 6e 65 77 6d 65 66 6e 74  tryfont newmefnt
1d00: 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72 69  ] } {..if {[stri
1d10: 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 6d 65  ng length $newme
1d20: 66 6e 74 5d 20 3e 30 20 7d 20 7b 0a 09 20 20 20  fnt] >0 } {..   
1d30: 20 73 65 74 20 6d 65 66 6e 74 20 22 2d 66 6f 6e   set mefnt "-fon
1d40: 74 20 5c 22 24 6e 65 77 6d 65 66 6e 74 5c 22 22  t \"$newmefnt\""
1d50: 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20  ..} else {..    
1d60: 73 65 74 20 6d 65 66 6e 74 20 22 22 0a 09 7d 0a  set mefnt ""..}.
1d70: 09 73 65 74 20 74 6f 70 20 20 20 20 20 24 5f 77  .set top     $_w
1d80: 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29  idget($path,top)
1d90: 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 63 6f  ..if {[string co
1da0: 6d 70 61 72 65 20 24 74 6f 70 20 2e 5d 20 3d 3d  mpare $top .] ==
1db0: 20 30 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6d   0} {..    set m
1dc0: 62 20 2e 6d 65 6e 75 62 61 72 0a 09 7d 20 65 6c  b .menubar..} el
1dd0: 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 62  se {..    set mb
1de0: 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72 0a 09 7d   $top.menubar..}
1df0: 0a 09 73 65 74 20 6c 20 5b 77 69 6e 66 6f 20 63  ..set l [winfo c
1e00: 68 69 6c 64 72 65 6e 20 24 6d 62 5d 0a 09 77 68  hildren $mb]..wh
1e10: 69 6c 65 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c  ile {[llength $l
1e20: 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 65 20  ]} {..    set e 
1e30: 5b 6c 69 6e 64 65 78 20 24 6c 20 30 5d 0a 09 20  [lindex $l 0].. 
1e40: 20 20 20 73 65 74 20 6c 20 5b 6c 72 61 6e 67 65     set l [lrange
1e50: 20 24 6c 20 31 20 65 6e 64 5d 0a 09 20 20 20 20   $l 1 end]..    
1e60: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67  if {[string leng
1e70: 74 68 20 24 65 5d 20 3d 3d 20 30 7d 20 7b 63 6f  th $e] == 0} {co
1e80: 6e 74 69 6e 75 65 7d 0a 09 20 20 20 20 6c 61 70  ntinue}..    lap
1e90: 70 65 6e 64 20 6c 20 5b 77 69 6e 66 6f 20 63 68  pend l [winfo ch
1ea0: 69 6c 64 72 65 6e 20 24 65 5d 0a 09 20 20 20 20  ildren $e]..    
1eb0: 65 76 61 6c 20 24 65 20 63 6f 6e 66 69 67 75 72  eval $e configur
1ec0: 65 20 24 6d 65 66 6e 74 0a 09 7d 0a 20 20 20 20  e $mefnt..}.    
1ed0: 7d 0a 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57 69  }...    if { [Wi
1ee0: 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64  dget::hasChanged
1ef0: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
1f00: 72 66 6f 6e 74 20 6e 65 77 73 62 66 6e 74 5d 20  rfont newsbfnt] 
1f10: 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67  } {..if {[string
1f20: 20 6c 65 6e 67 74 68 20 24 6e 65 77 73 62 66 6e   length $newsbfn
1f30: 74 5d 20 3e 30 20 7d 20 7b 0a 09 20 20 20 20 73  t] >0 } {..    s
1f40: 65 74 20 73 62 66 6e 74 20 22 2d 66 6f 6e 74 20  et sbfnt "-font 
1f50: 5c 22 24 6e 65 77 73 62 66 6e 74 5c 22 22 0a 09  \"$newsbfnt\""..
1f60: 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65  } else {..    se
1f70: 74 20 73 62 66 6e 74 20 22 22 0a 09 7d 0a 09 66  t sbfnt ""..}..f
1f80: 6f 72 20 7b 73 65 74 20 69 6e 64 65 78 20 30 7d  or {set index 0}
1f90: 20 7b 24 69 6e 64 65 78 3c 24 5f 77 69 64 67 65   {$index<$_widge
1fa0: 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63 29 7d  t($path,nindic)}
1fb0: 20 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0a   {incr index} {.
1fc0: 09 20 20 20 20 73 65 74 20 69 6e 64 69 63 20 24  .    set indic $
1fd0: 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e 64 66  path.status.indf
1fe0: 2e 66 24 69 6e 64 65 78 0a 09 20 20 20 20 65 76  .f$index..    ev
1ff0: 61 6c 20 24 69 6e 64 69 63 20 63 6f 6e 66 69 67  al $indic config
2000: 75 72 65 20 24 73 62 66 6e 74 0a 09 7d 0a 09 65  ure $sbfnt..}..e
2010: 76 61 6c 20 24 70 61 74 68 2e 73 74 61 74 75 73  val $path.status
2020: 2e 6c 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65  .label configure
2030: 20 24 73 62 66 6e 74 0a 09 24 70 61 74 68 2e 73   $sbfnt..$path.s
2040: 74 61 74 75 73 20 63 6f 6e 66 69 67 75 72 65 20  tatus configure 
2050: 2d 68 65 69 67 68 74 20 5b 77 69 6e 66 6f 20 72  -height [winfo r
2060: 65 71 68 65 69 67 68 74 20 24 70 61 74 68 2e 73  eqheight $path.s
2070: 74 61 74 75 73 2e 6c 61 62 65 6c 5d 0a 0a 09 24  tatus.label]...$
2080: 70 61 74 68 2e 73 74 61 74 75 73 2e 70 72 67 20  path.status.prg 
2090: 63 6f 6e 66 69 67 75 72 65 20 5c 0a 09 09 2d 68  configure \...-h
20a0: 65 69 67 68 74 20 5b 65 78 70 72 20 7b 5b 77 69  eight [expr {[wi
20b0: 6e 66 6f 20 72 65 71 68 65 69 67 68 74 20 24 70  nfo reqheight $p
20c0: 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65 6c  ath.status.label
20d0: 5d 2d 32 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20  ]-2}].    }..   
20e0: 20 72 65 74 75 72 6e 20 24 72 65 73 0a 7d 0a 0a   return $res.}..
20f0: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2140: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
2150: 6e 46 72 61 6d 65 3a 3a 63 67 65 74 0a 23 20 2d  nFrame::cget.# -
2160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2180: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2190: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
21b0: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 67  oc MainFrame::cg
21c0: 65 74 20 7b 20 70 61 74 68 20 6f 70 74 69 6f 6e  et { path option
21d0: 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20   } {.    return 
21e0: 5b 57 69 64 67 65 74 3a 3a 63 67 65 74 20 24 70  [Widget::cget $p
21f0: 61 74 68 20 24 6f 70 74 69 6f 6e 5d 0a 7d 0a 0a  ath $option].}..
2200: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2250: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
2260: 6e 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65  nFrame::getframe
2270: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22c0: 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65  -.proc MainFrame
22d0: 3a 3a 67 65 74 66 72 61 6d 65 20 7b 20 70 61 74  ::getframe { pat
22e0: 68 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e  h } {.    return
22f0: 20 24 70 61 74 68 2e 66 72 61 6d 65 0a 7d 0a 0a   $path.frame.}..
2300: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2350: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
2360: 6e 46 72 61 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62  nFrame::addtoolb
2370: 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ar.# -----------
2380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
23a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
23b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
23c0: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
23d0: 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 20 7b  me::addtoolbar {
23e0: 20 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 67 6c   path } {.    gl
23f0: 6f 62 61 6c 20 20 20 74 63 6c 5f 70 6c 61 74 66  obal   tcl_platf
2400: 6f 72 6d 0a 20 20 20 20 76 61 72 69 61 62 6c 65  orm.    variable
2410: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65   _widget..    se
2420: 74 20 69 6e 64 65 78 20 20 20 20 20 24 5f 77 69  t index     $_wi
2430: 64 67 65 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c  dget($path,ntool
2440: 62 61 72 29 0a 20 20 20 20 73 65 74 20 74 6f 6f  bar).    set too
2450: 6c 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f 70  lframe $path.top
2460: 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 73 65  f.f$index.    se
2470: 74 20 74 6f 6f 6c 62 61 72 20 20 20 24 70 61 74  t toolbar   $pat
2480: 68 2e 74 6f 70 66 2e 74 62 24 69 6e 64 65 78 0a  h.topf.tb$index.
2490: 20 20 20 20 73 65 74 20 62 67 20 20 20 20 20 20      set bg      
24a0: 20 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70    [Widget::getop
24b0: 74 69 6f 6e 20 24 70 61 74 68 20 2d 62 61 63 6b  tion $path -back
24c0: 67 72 6f 75 6e 64 5d 0a 20 20 20 20 69 66 20 7b  ground].    if {
24d0: 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70   $tcl_platform(p
24e0: 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69  latform) == "uni
24f0: 78 22 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 66  x" } {.        f
2500: 72 61 6d 65 20 24 74 6f 6f 6c 66 72 61 6d 65 20  rame $toolframe 
2510: 2d 72 65 6c 69 65 66 20 72 61 69 73 65 64 20 2d  -relief raised -
2520: 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 5c 0a  borderwidth 1 \.
2530: 20 20 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b              -tak
2540: 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69  efocus 0 -highli
2550: 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d  ghtthickness 0 -
2560: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 20  background $bg. 
2570: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20     } else {.    
2580: 20 20 20 20 66 72 61 6d 65 20 24 74 6f 6f 6c 66      frame $toolf
2590: 72 61 6d 65 20 2d 72 65 6c 69 65 66 20 66 6c 61  rame -relief fla
25a0: 74 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30  t -borderwidth 0
25b0: 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 5c 0a   -takefocus 0 \.
25c0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 68 69 67              -hig
25d0: 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20  hlightthickness 
25e0: 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62  0 -background $b
25f0: 67 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 65  g.        set se
2600: 70 20 5b 53 65 70 61 72 61 74 6f 72 3a 3a 63 72  p [Separator::cr
2610: 65 61 74 65 20 24 74 6f 6f 6c 66 72 61 6d 65 2e  eate $toolframe.
2620: 73 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69  sep -orient hori
2630: 7a 6f 6e 74 61 6c 20 2d 62 61 63 6b 67 72 6f 75  zontal -backgrou
2640: 6e 64 20 24 62 67 5d 0a 20 20 20 20 20 20 20 20  nd $bg].        
2650: 70 61 63 6b 20 24 73 65 70 20 2d 66 69 6c 6c 20  pack $sep -fill 
2660: 78 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74 20  x.    }.    set 
2670: 74 6f 6f 6c 62 61 72 20 5b 66 72 61 6d 65 20 24  toolbar [frame $
2680: 74 6f 6f 6c 62 61 72 20 2d 72 65 6c 69 65 66 20  toolbar -relief 
2690: 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74  flat -borderwidt
26a0: 68 20 32 20 5c 0a 20 20 20 20 20 20 20 20 20 20  h 2 \.          
26b0: 20 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65             -take
26c0: 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67  focus 0 -highlig
26d0: 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62  htthickness 0 -b
26e0: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20  ackground $bg]. 
26f0: 20 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72     pack $toolbar
2700: 20 2d 69 6e 20 24 74 6f 6f 6c 66 72 61 6d 65 20   -in $toolframe 
2710: 2d 61 6e 63 68 6f 72 20 77 20 2d 65 78 70 61 6e  -anchor w -expan
2720: 64 20 79 65 73 20 2d 66 69 6c 6c 20 78 0a 20 20  d yes -fill x.  
2730: 20 20 69 6e 63 72 20 5f 77 69 64 67 65 74 28 24    incr _widget($
2740: 70 61 74 68 2c 6e 74 6f 6f 6c 62 61 72 29 0a 20  path,ntoolbar). 
2750: 20 20 20 67 72 69 64 20 24 74 6f 6f 6c 66 72 61     grid $toolfra
2760: 6d 65 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 72 6f  me -column 0 -ro
2770: 77 20 24 69 6e 64 65 78 20 2d 73 74 69 63 6b 79  w $index -sticky
2780: 20 65 77 0a 20 20 20 20 72 65 74 75 72 6e 20 24   ew.    return $
2790: 74 6f 6f 6c 62 61 72 0a 7d 0a 0a 0a 23 20 2d 2d  toolbar.}...# --
27a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
27f0: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
2800: 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 0a 23 20  e::gettoolbar.# 
2810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2820: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70  --------------.p
2860: 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67  roc MainFrame::g
2870: 65 74 74 6f 6f 6c 62 61 72 20 7b 20 70 61 74 68  ettoolbar { path
2880: 20 69 6e 64 65 78 20 7d 20 7b 0a 20 20 20 20 72   index } {.    r
2890: 65 74 75 72 6e 20 24 70 61 74 68 2e 74 6f 70 66  eturn $path.topf
28a0: 2e 74 62 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23 20  .tb$index.}...# 
28b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
2900: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
2910: 61 6d 65 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f  ame::addindicato
2920: 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  r.# ------------
2930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2970: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2980: 65 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f 72 20  e::addindicator 
2990: 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b 0a  { path args } {.
29a0: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69      variable _wi
29b0: 64 67 65 74 0a 0a 20 20 20 20 69 66 20 7b 5b 73  dget..    if {[s
29c0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57 69  tring length [Wi
29d0: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
29e0: 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61 72  $path -statusbar
29f0: 66 6f 6e 74 5d 5d 7d 20 7b 0a 09 73 65 74 20 73  font]]} {..set s
2a00: 62 66 6e 74 20 22 2d 66 6f 6e 74 20 5c 22 5b 57  bfnt "-font \"[W
2a10: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
2a20: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
2a30: 72 66 6f 6e 74 5d 5c 22 22 0a 20 20 20 20 7d 20  rfont]\"".    } 
2a40: 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 62 66 6e  else {..set sbfn
2a50: 74 20 22 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20  t "".    }..    
2a60: 73 65 74 20 69 6e 64 65 78 20 24 5f 77 69 64 67  set index $_widg
2a70: 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63 29  et($path,nindic)
2a80: 0a 20 20 20 20 73 65 74 20 69 6e 64 69 63 20 24  .    set indic $
2a90: 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e 64 66  path.status.indf
2aa0: 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 65 76 61  .f$index.    eva
2ab0: 6c 20 6c 61 62 65 6c 20 24 69 6e 64 69 63 20 24  l label $indic $
2ac0: 61 72 67 73 20 2d 72 65 6c 69 65 66 20 73 75 6e  args -relief sun
2ad0: 6b 65 6e 20 2d 62 6f 72 64 65 72 77 69 64 74 68  ken -borderwidth
2ae0: 20 31 20 5c 0a 20 20 20 20 20 20 20 20 2d 74 61   1 \.        -ta
2af0: 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c  kefocus 0 -highl
2b00: 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20  ightthickness 0 
2b10: 24 73 62 66 6e 74 0a 0a 20 20 20 20 70 61 63 6b  $sbfnt..    pack
2b20: 20 24 69 6e 64 69 63 20 2d 73 69 64 65 20 6c 65   $indic -side le
2b30: 66 74 20 2d 61 6e 63 68 6f 72 20 77 20 2d 70 61  ft -anchor w -pa
2b40: 64 78 20 32 20 2d 66 69 6c 6c 20 79 20 2d 65 78  dx 2 -fill y -ex
2b50: 70 61 6e 64 20 31 0a 0a 20 20 20 20 69 6e 63 72  pand 1..    incr
2b60: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e   _widget($path,n
2b70: 69 6e 64 69 63 29 0a 0a 20 20 20 20 72 65 74 75  indic)..    retu
2b80: 72 6e 20 24 69 6e 64 69 63 0a 7d 0a 0a 0a 23 20  rn $indic.}...# 
2b90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ba0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
2be0: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
2bf0: 61 6d 65 3a 3a 67 65 74 69 6e 64 69 63 61 74 6f  ame::getindicato
2c00: 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  r.# ------------
2c10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c50: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2c60: 65 3a 3a 67 65 74 69 6e 64 69 63 61 74 6f 72 20  e::getindicator 
2c70: 7b 20 70 61 74 68 20 69 6e 64 65 78 20 7d 20 7b  { path index } {
2c80: 0a 20 20 20 20 72 65 74 75 72 6e 20 24 70 61 74  .    return $pat
2c90: 68 2e 73 74 61 74 75 73 2e 69 6e 64 66 2e 66 24  h.status.indf.f$
2ca0: 69 6e 64 65 78 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d  index.}...# ----
2cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
2d00: 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a  mmand MainFrame:
2d10: 3a 67 65 74 6d 65 6e 75 0a 23 20 2d 2d 2d 2d 2d  :getmenu.# -----
2d20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d  ---------.proc M
2d70: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65 6e  ainFrame::getmen
2d80: 75 20 7b 20 70 61 74 68 20 6d 65 6e 75 69 64 20  u { path menuid 
2d90: 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65  } {.    variable
2da0: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 69 66   _widget..    if
2db0: 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20   { [info exists 
2dc0: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65  _widget($path,me
2dd0: 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 5d 20 7d  nuid,$menuid)] }
2de0: 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72   {.        retur
2df0: 6e 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68  n $_widget($path
2e00: 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29  ,menuid,$menuid)
2e10: 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72  .    }.    retur
2e20: 6e 20 22 22 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  n "".}...# -----
2e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e70: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
2e80: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73  and MainFrame::s
2e90: 65 74 6d 65 6e 75 73 74 61 74 65 0a 23 20 2d 2d  etmenustate.# --
2ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
2ef0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 65 74 6d   MainFrame::setm
2f00: 65 6e 75 73 74 61 74 65 20 7b 20 70 61 74 68 20  enustate { path 
2f10: 74 61 67 20 73 74 61 74 65 20 7d 20 7b 0a 20 20  tag state } {.  
2f20: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
2f30: 65 74 0a 0a 20 20 20 20 23 20 20 20 20 69 66 20  et..    #    if 
2f40: 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 5f  { [info exists _
2f50: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
2f60: 73 2c 24 74 61 67 29 5d 20 7d 20 7b 0a 20 20 20  s,$tag)] } {.   
2f70: 20 23 20 20 20 20 20 20 20 20 66 6f 72 65 61 63   #        foreac
2f80: 68 20 7b 6d 65 6e 75 20 65 6e 74 72 79 7d 20 24  h {menu entry} $
2f90: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61  _widget($path,ta
2fa0: 67 73 2c 24 74 61 67 29 20 7b 0a 20 20 20 20 23  gs,$tag) {.    #
2fb0: 20 20 20 20 20 20 20 20 20 20 20 20 24 6d 65 6e              $men
2fc0: 75 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65  u entryconfigure
2fd0: 20 24 65 6e 74 72 79 20 2d 73 74 61 74 65 20 24   $entry -state $
2fe0: 73 74 61 74 65 0a 20 20 20 20 23 20 20 20 20 20  state.    #     
2ff0: 20 20 20 7d 0a 20 20 20 20 23 20 20 20 20 7d 0a     }.    #    }.
3000: 0a 20 20 20 20 23 20 57 65 20 6e 65 65 64 20 61  .    # We need a
3010: 20 6d 6f 72 65 20 73 6f 70 68 69 73 74 69 63 61   more sophistica
3020: 74 65 64 20 73 74 61 74 65 20 73 79 73 74 65 6d  ted state system
3030: 2e 0a 20 20 20 20 23 20 54 68 65 20 6f 72 69 67  ..    # The orig
3040: 69 6e 61 6c 20 6d 6f 64 65 6c 20 77 61 73 20 74  inal model was t
3050: 68 69 73 3a 20 20 65 61 63 68 20 6d 65 6e 75 20  his:  each menu 
3060: 69 74 65 6d 20 68 61 73 20 61 20 6c 69 73 74 20  item has a list 
3070: 6f 66 20 74 61 67 73 3b 0a 20 20 20 20 23 20 77  of tags;.    # w
3080: 68 65 6e 65 76 65 72 20 61 6e 79 20 6f 6e 65 20  henever any one 
3090: 6f 66 20 74 68 6f 73 65 20 74 61 67 73 20 63 68  of those tags ch
30a0: 61 6e 67 65 64 20 73 74 61 74 65 2c 20 74 68 65  anged state, the
30b0: 20 6d 65 6e 75 20 69 74 65 6d 20 64 69 64 20 74   menu item did t
30c0: 6f 6f 2e 0a 20 20 20 20 23 20 54 68 69 73 20 6d  oo..    # This m
30d0: 61 6b 65 73 20 69 74 20 68 61 72 64 20 74 6f 20  akes it hard to 
30e0: 68 61 76 65 20 69 74 65 6d 73 20 74 68 61 74 20  have items that 
30f0: 61 72 65 20 65 6e 61 62 6c 65 64 20 6f 6e 6c 79  are enabled only
3100: 20 77 68 65 6e 20 62 6f 74 68 20 74 61 67 41 20   when both tagA 
3110: 61 6e 64 0a 20 20 20 20 23 20 74 61 67 42 20 61  and.    # tagB a
3120: 72 65 2e 20 20 54 68 65 20 6e 65 77 20 6d 6f 64  re.  The new mod
3130: 65 6c 20 74 68 65 72 65 66 6f 72 65 20 6f 6e 6c  el therefore onl
3140: 79 20 73 65 74 73 20 74 68 65 20 6d 65 6e 75 73  y sets the menus
3150: 74 61 74 65 20 74 6f 20 65 6e 61 62 6c 65 64 0a  tate to enabled.
3160: 20 20 20 20 23 20 77 68 65 6e 20 41 4c 4c 20 6f      # when ALL o
3170: 66 20 69 74 73 20 74 61 67 73 20 61 72 65 20 65  f its tags are e
3180: 6e 61 62 6c 65 64 2e 0a 0a 20 20 20 20 23 20 46  nabled...    # F
3190: 69 72 73 74 20 73 65 65 20 69 66 20 74 68 69 73  irst see if this
31a0: 20 69 73 20 61 20 72 65 61 6c 20 74 61 67 0a 20   is a real tag. 
31b0: 20 20 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78     if { [info ex
31c0: 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70 61  ists _widget($pa
31d0: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67  th,tagstate,$tag
31e0: 29 5d 20 7d 20 7b 0a 09 69 66 20 7b 20 5b 73 74  )] } {..if { [st
31f0: 72 69 6e 67 20 63 6f 6d 70 61 72 65 20 24 73 74  ring compare $st
3200: 61 74 65 20 22 64 69 73 61 62 6c 65 64 22 5d 20  ate "disabled"] 
3210: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 5f 77 69  } {..    set _wi
3220: 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74  dget($path,tagst
3230: 61 74 65 2c 24 74 61 67 29 20 31 0a 09 7d 20 65  ate,$tag) 1..} e
3240: 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 5f  lse {..    set _
3250: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
3260: 73 74 61 74 65 2c 24 74 61 67 29 20 30 0a 09 7d  state,$tag) 0..}
3270: 0a 09 66 6f 72 65 61 63 68 20 7b 6d 65 6e 75 20  ..foreach {menu 
3280: 65 6e 74 72 79 7d 20 24 5f 77 69 64 67 65 74 28  entry} $_widget(
3290: 24 70 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29  $path,tags,$tag)
32a0: 20 7b 0a 09 20 20 20 20 73 65 74 20 65 78 70 72   {..    set expr
32b0: 65 73 73 69 6f 6e 20 22 31 22 0a 09 20 20 20 20  ession "1"..    
32c0: 66 6f 72 65 61 63 68 20 6d 65 6e 75 74 61 67 20  foreach menutag 
32d0: 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d  $_widget($path,m
32e0: 65 6e 75 74 61 67 73 2c 5b 6c 69 73 74 20 24 6d  enutags,[list $m
32f0: 65 6e 75 20 24 65 6e 74 72 79 5d 29 20 7b 0a 09  enu $entry]) {..
3300: 09 61 70 70 65 6e 64 20 65 78 70 72 65 73 73 69  .append expressi
3310: 6f 6e 20 22 20 26 26 20 24 5f 77 69 64 67 65 74  on " && $_widget
3320: 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c  ($path,tagstate,
3330: 24 6d 65 6e 75 74 61 67 29 22 0a 09 20 20 20 20  $menutag)"..    
3340: 7d 0a 09 20 20 20 20 69 66 20 7b 20 5b 65 78 70  }..    if { [exp
3350: 72 20 24 65 78 70 72 65 73 73 69 6f 6e 5d 20 7d  r $expression] }
3360: 20 7b 0a 09 09 73 65 74 20 73 74 61 74 65 20 6e   {...set state n
3370: 6f 72 6d 61 6c 0a 09 20 20 20 20 7d 20 65 6c 73  ormal..    } els
3380: 65 20 7b 0a 09 09 73 65 74 20 73 74 61 74 65 20  e {...set state 
3390: 64 69 73 61 62 6c 65 64 0a 09 20 20 20 20 7d 0a  disabled..    }.
33a0: 09 20 20 20 20 24 6d 65 6e 75 20 65 6e 74 72 79  .    $menu entry
33b0: 63 6f 6e 66 69 67 75 72 65 20 24 65 6e 74 72 79  configure $entry
33c0: 20 2d 73 74 61 74 65 20 24 73 74 61 74 65 0a 09   -state $state..
33d0: 7d 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75  }.    }.    retu
33e0: 72 6e 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d  rn.}...# -------
33f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3430: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
3440: 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e  d MainFrame::men
3450: 75 6f 6e 6c 79 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  uonly.# --------
3460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 64 2d  --------------d-
3470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34a0: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
34b0: 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e 6c 79 20 7b  rame::menuonly {
34c0: 20 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 76 61   path } {.    va
34d0: 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a  riable _widget..
34e0: 20 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20      catch {pack 
34f0: 66 6f 72 67 65 74 20 24 70 61 74 68 2e 73 65 70  forget $path.sep
3500: 7d 0a 20 20 20 20 63 61 74 63 68 20 7b 70 61 63  }.    catch {pac
3510: 6b 20 66 6f 72 67 65 74 20 24 70 61 74 68 2e 62  k forget $path.b
3520: 6f 74 66 2e 73 65 70 7d 0a 20 20 20 20 63 61 74  otf.sep}.    cat
3530: 63 68 20 7b 70 61 63 6b 20 66 6f 72 67 65 74 20  ch {pack forget 
3540: 24 70 61 74 68 2e 66 72 61 6d 65 7d 0a 7d 0a 0a  $path.frame}.}..
3550: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
3560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3580: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3590: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35a0: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e  .#  Command Main
35b0: 46 72 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62  Frame::showtoolb
35c0: 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ar.# -----------
35d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3600: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3610: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
3620: 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61 72 20  me::showtoolbar 
3630: 7b 20 70 61 74 68 20 69 6e 64 65 78 20 62 6f 6f  { path index boo
3640: 6c 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62  l } {.    variab
3650: 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20  le _widget..    
3660: 73 65 74 20 74 6f 6f 6c 66 72 61 6d 65 20 24 70  set toolframe $p
3670: 61 74 68 2e 74 6f 70 66 2e 66 24 69 6e 64 65 78  ath.topf.f$index
3680: 0a 20 20 20 20 69 66 20 7b 20 5b 77 69 6e 66 6f  .    if { [winfo
3690: 20 65 78 69 73 74 73 20 24 74 6f 6f 6c 66 72 61   exists $toolfra
36a0: 6d 65 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  me] } {.        
36b0: 69 66 20 7b 20 21 24 62 6f 6f 6c 20 26 26 20 5b  if { !$bool && [
36c0: 6c 6c 65 6e 67 74 68 20 5b 67 72 69 64 20 69 6e  llength [grid in
36d0: 66 6f 20 24 74 6f 6f 6c 66 72 61 6d 65 5d 5d 20  fo $toolframe]] 
36e0: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
36f0: 67 72 69 64 20 66 6f 72 67 65 74 20 24 74 6f 6f  grid forget $too
3700: 6c 66 72 61 6d 65 0a 20 20 20 20 20 20 20 20 20  lframe.         
3710: 20 20 20 24 70 61 74 68 2e 74 6f 70 66 20 63 6f     $path.topf co
3720: 6e 66 69 67 75 72 65 20 2d 68 65 69 67 68 74 20  nfigure -height 
3730: 31 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65  1.        } else
3740: 69 66 20 7b 20 24 62 6f 6f 6c 20 26 26 20 21 5b  if { $bool && ![
3750: 6c 6c 65 6e 67 74 68 20 5b 67 72 69 64 20 69 6e  llength [grid in
3760: 66 6f 20 24 74 6f 6f 6c 66 72 61 6d 65 5d 5d 20  fo $toolframe]] 
3770: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
3780: 67 72 69 64 20 24 74 6f 6f 6c 66 72 61 6d 65 20  grid $toolframe 
3790: 2d 63 6f 6c 75 6d 6e 20 30 20 2d 72 6f 77 20 24  -column 0 -row $
37a0: 69 6e 64 65 78 20 2d 73 74 69 63 6b 79 20 65 77  index -sticky ew
37b0: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 7d  .        }.    }
37c0: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
37d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
37e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
37f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3810: 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
3820: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77   MainFrame::show
3830: 73 74 61 74 75 73 62 61 72 0a 23 20 2d 2d 2d 2d  statusbar.# ----
3840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
3890: 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 73  MainFrame::shows
38a0: 74 61 74 75 73 62 61 72 20 7b 20 70 61 74 68 20  tatusbar { path 
38b0: 6e 61 6d 65 20 7d 20 7b 0a 20 20 20 20 73 65 74  name } {.    set
38c0: 20 73 74 61 74 75 73 20 24 70 61 74 68 2e 73 74   status $path.st
38d0: 61 74 75 73 0a 20 20 20 20 69 66 20 7b 20 21 5b  atus.    if { ![
38e0: 73 74 72 69 6e 67 20 63 6f 6d 70 61 72 65 20 24  string compare $
38f0: 6e 61 6d 65 20 22 6e 6f 6e 65 22 5d 20 7d 20 7b  name "none"] } {
3900: 0a 20 20 20 20 20 20 20 20 70 61 63 6b 20 66 6f  .        pack fo
3910: 72 67 65 74 20 24 73 74 61 74 75 73 0a 20 20 20  rget $status.   
3920: 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20   } else {.      
3930: 20 20 70 61 63 6b 20 24 73 74 61 74 75 73 20 2d    pack $status -
3940: 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20 20 73  fill x.        s
3950: 77 69 74 63 68 20 2d 2d 20 24 6e 61 6d 65 20 7b  witch -- $name {
3960: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 74 61  .            sta
3970: 74 75 73 20 7b 0a 20 20 20 20 20 20 20 20 20 20  tus {.          
3980: 20 20 20 20 20 20 63 61 74 63 68 20 7b 70 61 63        catch {pac
3990: 6b 20 66 6f 72 67 65 74 20 24 73 74 61 74 75 73  k forget $status
39a0: 2e 70 72 67 7d 0a 20 20 20 20 20 20 20 20 20 20  .prg}.          
39b0: 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20    }.            
39c0: 70 72 6f 67 72 65 73 73 69 6f 6e 20 7b 0a 20 20  progression {.  
39d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61                pa
39e0: 63 6b 20 24 73 74 61 74 75 73 2e 70 72 67 20 2d  ck $status.prg -
39f0: 69 6e 20 24 73 74 61 74 75 73 2e 70 72 67 66 0a  in $status.prgf.
3a00: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20              }.  
3a10: 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a        }.    }.}.
3a20: 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..# ------------
3a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a70: 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61  --.#  Command Ma
3a80: 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73 74 72 6f  inFrame::_destro
3a90: 79 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  y.# ------------
3aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ad0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ae0: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
3af0: 65 3a 3a 5f 64 65 73 74 72 6f 79 20 7b 20 70 61  e::_destroy { pa
3b00: 74 68 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61  th } {.    varia
3b10: 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20  ble _widget..   
3b20: 20 57 69 64 67 65 74 3a 3a 64 65 73 74 72 6f 79   Widget::destroy
3b30: 20 24 70 61 74 68 0a 20 20 20 20 63 61 74 63 68   $path.    catch
3b40: 20 7b 64 65 73 74 72 6f 79 20 5b 24 5f 77 69 64   {destroy [$_wid
3b50: 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 63  get($path,top) c
3b60: 67 65 74 20 2d 6d 65 6e 75 5d 7d 0a 20 20 20 20  get -menu]}.    
3b70: 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74  $_widget($path,t
3b80: 6f 70 29 20 63 6f 6e 66 69 67 75 72 65 20 2d 6d  op) configure -m
3b90: 65 6e 75 20 7b 7d 0a 0a 20 20 20 20 23 20 55 6e  enu {}..    # Un
3ba0: 73 65 74 20 61 6c 6c 20 6f 66 20 74 68 65 20 73  set all of the s
3bb0: 74 61 74 65 20 76 61 72 73 20 61 73 73 6f 63 69  tate vars associ
3bc0: 61 74 65 64 20 77 69 74 68 20 74 68 69 73 20 6d  ated with this m
3bd0: 61 69 6e 20 66 72 61 6d 65 2e 0a 20 20 20 20 66  ain frame..    f
3be0: 6f 72 65 61 63 68 20 69 6e 64 65 78 20 5b 61 72  oreach index [ar
3bf0: 72 61 79 20 6e 61 6d 65 73 20 5f 77 69 64 67 65  ray names _widge
3c00: 74 20 24 70 61 74 68 2c 2a 5d 20 7b 0a 09 75 6e  t $path,*] {..un
3c10: 73 65 74 20 5f 77 69 64 67 65 74 28 24 69 6e 64  set _widget($ind
3c20: 65 78 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65  ex).    }.    re
3c30: 6e 61 6d 65 20 24 70 61 74 68 20 7b 7d 0a 7d 0a  name $path {}.}.
3c40: 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..# ------------
3c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c90: 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61  --.#  Command Ma
3ca0: 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65  inFrame::_create
3cb0: 5f 6d 65 6e 75 62 61 72 0a 23 20 2d 2d 2d 2d 2d  _menubar.# -----
3cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d  ---------.proc M
3d10: 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74  ainFrame::_creat
3d20: 65 5f 6d 65 6e 75 62 61 72 20 7b 20 70 61 74 68  e_menubar { path
3d30: 20 64 65 73 63 6d 65 6e 75 20 7d 20 7b 0a 20 20   descmenu } {.  
3d40: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
3d50: 65 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 20 20  et.    global   
3d60: 20 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 0a 0a 20   tcl_platform.. 
3d70: 20 20 20 73 65 74 20 62 67 20 20 20 20 20 20 5b     set bg      [
3d80: 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f  Widget::getoptio
3d90: 6e 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f  n $path -backgro
3da0: 75 6e 64 5d 0a 20 20 20 20 73 65 74 20 74 6f 70  und].    set top
3db0: 20 20 20 20 20 24 5f 77 69 64 67 65 74 28 24 70       $_widget($p
3dc0: 61 74 68 2c 74 6f 70 29 0a 0a 20 20 20 20 66 6f  ath,top)..    fo
3dd0: 72 65 61 63 68 20 7b 76 20 78 7d 20 7b 6d 62 66  reach {v x} {mbf
3de0: 6e 74 20 2d 6d 65 6e 75 62 61 72 66 6f 6e 74 20  nt -menubarfont 
3df0: 6d 65 66 6e 74 20 2d 6d 65 6e 75 65 6e 74 72 79  mefnt -menuentry
3e00: 66 6f 6e 74 7d 20 7b 0a 09 69 66 20 7b 5b 73 74  font} {..if {[st
3e10: 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57 69 64  ring length [Wid
3e20: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
3e30: 70 61 74 68 20 24 78 5d 5d 7d 20 7b 0a 09 20 20  path $x]]} {..  
3e40: 20 20 73 65 74 20 24 76 20 22 2d 66 6f 6e 74 20    set $v "-font 
3e50: 5c 22 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70  \"[Widget::getop
3e60: 74 69 6f 6e 20 24 70 61 74 68 20 24 78 5d 5c 22  tion $path $x]\"
3e70: 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20  "..} else {..   
3e80: 20 73 65 74 20 24 76 20 22 22 0a 09 7d 0a 20 20   set $v ""..}.  
3e90: 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 20 24 74    }..    if { $t
3ea0: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74  cl_platform(plat
3eb0: 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78 22 20  form) == "unix" 
3ec0: 7d 20 7b 0a 09 73 65 74 20 6d 65 6e 75 62 61 72  } {..set menubar
3ed0: 20 5b 65 76 61 6c 20 6d 65 6e 75 20 24 74 6f 70   [eval menu $top
3ee0: 2e 6d 65 6e 75 62 61 72 20 2d 74 65 61 72 6f 66  .menubar -tearof
3ef0: 66 20 30 20 5c 0a 09 09 2d 62 61 63 6b 67 72 6f  f 0 \...-backgro
3f00: 75 6e 64 20 24 62 67 20 2d 62 6f 72 64 65 72 77  und $bg -borderw
3f10: 69 64 74 68 20 31 20 24 6d 62 66 6e 74 5d 0a 20  idth 1 $mbfnt]. 
3f20: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74     } else {..set
3f30: 20 6d 65 6e 75 62 61 72 20 5b 65 76 61 6c 20 6d   menubar [eval m
3f40: 65 6e 75 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72  enu $top.menubar
3f50: 20 2d 74 65 61 72 6f 66 66 20 30 20 5c 0a 09 09   -tearoff 0 \...
3f60: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 20  -background $bg 
3f70: 24 6d 62 66 6e 74 5d 0a 20 20 20 20 7d 0a 20 20  $mbfnt].    }.  
3f80: 20 20 24 74 6f 70 20 63 6f 6e 66 69 67 75 72 65    $top configure
3f90: 20 2d 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 0a   -menu $menubar.
3fa0: 0a 20 20 20 20 73 65 74 20 63 6f 75 6e 74 20 30  .    set count 0
3fb0: 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b 6e 61  .    foreach {na
3fc0: 6d 65 20 74 61 67 73 20 6d 65 6e 75 69 64 20 74  me tags menuid t
3fd0: 65 61 72 6f 66 66 20 65 6e 74 72 69 65 73 7d 20  earoff entries} 
3fe0: 24 64 65 73 63 6d 65 6e 75 20 7b 0a 20 20 20 20  $descmenu {.    
3ff0: 20 20 20 20 73 65 74 20 6f 70 74 20 20 5b 5f 70      set opt  [_p
4000: 61 72 73 65 5f 6e 61 6d 65 20 24 6e 61 6d 65 5d  arse_name $name]
4010: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73  .        if { [s
4020: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65  tring length $me
4030: 6e 75 69 64 5d 20 26 26 20 21 5b 69 6e 66 6f 20  nuid] && ![info 
4040: 65 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24  exists _widget($
4050: 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e  path,menuid,$men
4060: 75 69 64 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20  uid)] } {.      
4070: 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68 61 73        # menu has
4080: 20 69 64 65 6e 74 69 66 69 65 72 0a 09 20 20 20   identifier..   
4090: 20 23 20 77 65 20 75 73 65 20 69 74 20 66 6f 72   # we use it for
40a0: 20 69 74 73 20 70 61 74 68 6e 61 6d 65 2c 20 74   its pathname, t
40b0: 6f 20 65 6e 61 62 6c 65 20 73 70 65 63 69 61 6c  o enable special
40c0: 20 6d 65 6e 75 20 65 6e 74 72 69 65 73 0a 09 20   menu entries.. 
40d0: 20 20 20 23 20 28 68 65 6c 70 2c 20 73 79 73 74     # (help, syst
40e0: 65 6d 2c 20 2e 2e 2e 29 0a 09 20 20 20 20 73 65  em, ...)..    se
40f0: 74 20 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 2e  t menu $menubar.
4100: 24 6d 65 6e 75 69 64 0a 20 20 20 20 20 20 20 20  $menuid.        
4110: 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65  } else {..    se
4120: 74 20 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 2e  t menu $menubar.
4130: 6d 65 6e 75 24 63 6f 75 6e 74 0a 09 7d 0a 20 20  menu$count..}.  
4140: 20 20 20 20 20 20 65 76 61 6c 20 24 6d 65 6e 75        eval $menu
4150: 62 61 72 20 61 64 64 20 63 61 73 63 61 64 65 20  bar add cascade 
4160: 24 6f 70 74 20 2d 6d 65 6e 75 20 24 6d 65 6e 75  $opt -menu $menu
4170: 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b 6c  .        eval [l
4180: 69 73 74 20 6d 65 6e 75 20 24 6d 65 6e 75 20 2d  ist menu $menu -
4190: 74 65 61 72 6f 66 66 20 24 74 65 61 72 6f 66 66  tearoff $tearoff
41a0: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
41b0: 5d 20 24 6d 65 66 6e 74 0a 20 20 20 20 20 20 20  ] $mefnt.       
41c0: 20 66 6f 72 65 61 63 68 20 74 61 67 20 24 74 61   foreach tag $ta
41d0: 67 73 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20  gs {.           
41e0: 20 6c 61 70 70 65 6e 64 20 5f 77 69 64 67 65 74   lappend _widget
41f0: 28 24 70 61 74 68 2c 74 61 67 73 2c 24 74 61 67  ($path,tags,$tag
4200: 29 20 24 6d 65 6e 75 62 61 72 20 24 63 6f 75 6e  ) $menubar $coun
4210: 74 0a 09 20 20 20 20 23 20 65 72 69 63 6d 40 73  t..    # [email protected]
4220: 63 72 69 70 74 69 63 73 3a 20 20 41 64 64 20 61  criptics:  Add a
4230: 20 74 61 67 73 74 61 74 65 20 74 72 61 63 6b 65   tagstate tracke
4240: 72 0a 09 20 20 20 20 69 66 20 7b 20 21 5b 69 6e  r..    if { ![in
4250: 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64 67 65  fo exists _widge
4260: 74 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65  t($path,tagstate
4270: 2c 24 74 61 67 29 5d 20 7d 20 7b 0a 09 09 73 65  ,$tag)] } {...se
4280: 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c  t _widget($path,
4290: 74 61 67 73 74 61 74 65 2c 24 74 61 67 29 20 31  tagstate,$tag) 1
42a0: 0a 09 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20  ..    }.        
42b0: 7d 0a 09 23 20 65 72 69 63 6d 40 73 63 72 69 70  }..# [email protected]
42c0: 74 69 63 73 2e 63 6f 6d 3a 20 20 41 64 64 20 6d  tics.com:  Add m
42d0: 61 70 70 69 6e 67 20 66 72 6f 6d 20 6d 65 6e 75  apping from menu
42e0: 20 69 74 65 6d 73 20 74 6f 20 74 61 67 73 0a 09   items to tags..
42f0: 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74  set _widget($pat
4300: 68 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c 69 73 74  h,menutags,[list
4310: 20 24 6d 65 6e 75 62 61 72 20 24 63 6f 75 6e 74   $menubar $count
4320: 5d 29 20 24 74 61 67 73 0a 09 20 20 20 20 0a 20  ]) $tags..    . 
4330: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72         if { [str
4340: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75  ing length $menu
4350: 69 64 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  id] } {.        
4360: 20 20 20 20 23 20 6d 65 6e 75 20 68 61 73 20 69      # menu has i
4370: 64 65 6e 74 69 66 69 65 72 0a 20 20 20 20 20 20  dentifier.      
4380: 20 20 20 20 20 20 73 65 74 20 5f 77 69 64 67 65        set _widge
4390: 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24  t($path,menuid,$
43a0: 6d 65 6e 75 69 64 29 20 24 6d 65 6e 75 0a 20 20  menuid) $menu.  
43b0: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20        }.        
43c0: 5f 63 72 65 61 74 65 5f 65 6e 74 72 69 65 73 20  _create_entries 
43d0: 24 70 61 74 68 20 24 6d 65 6e 75 20 24 62 67 20  $path $menu $bg 
43e0: 24 65 6e 74 72 69 65 73 0a 20 20 20 20 20 20 20  $entries.       
43f0: 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20 20   incr count.    
4400: 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  }.}...# --------
4410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4450: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
4460: 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72  d MainFrame::_cr
4470: 65 61 74 65 5f 65 6e 74 72 69 65 73 0a 23 20 2d  eate_entries.# -
4480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
44a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
44b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
44c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
44d0: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63  oc MainFrame::_c
44e0: 72 65 61 74 65 5f 65 6e 74 72 69 65 73 20 7b 20  reate_entries { 
44f0: 70 61 74 68 20 6d 65 6e 75 20 62 67 20 65 6e 74  path menu bg ent
4500: 72 69 65 73 20 7d 20 7b 0a 20 20 20 20 76 61 72  ries } {.    var
4510: 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20  iable _widget.. 
4520: 20 20 20 73 65 74 20 63 6f 75 6e 74 20 20 20 20     set count    
4530: 20 20 5b 24 6d 65 6e 75 20 63 67 65 74 20 2d 74    [$menu cget -t
4540: 65 61 72 6f 66 66 5d 0a 20 20 20 20 73 65 74 20  earoff].    set 
4550: 72 65 67 69 73 74 65 72 65 64 20 30 0a 20 20 20  registered 0.   
4560: 20 66 6f 72 65 61 63 68 20 65 6e 74 72 79 20 24   foreach entry $
4570: 65 6e 74 72 69 65 73 20 7b 0a 20 20 20 20 20 20  entries {.      
4580: 20 20 73 65 74 20 6c 65 6e 20 20 5b 6c 6c 65 6e    set len  [llen
4590: 67 74 68 20 24 65 6e 74 72 79 5d 0a 20 20 20 20  gth $entry].    
45a0: 20 20 20 20 73 65 74 20 74 79 70 65 20 5b 6c 69      set type [li
45b0: 6e 64 65 78 20 24 65 6e 74 72 79 20 30 5d 0a 0a  ndex $entry 0]..
45c0: 20 20 20 20 20 20 20 20 69 66 20 7b 20 21 5b 73          if { ![s
45d0: 74 72 69 6e 67 20 63 6f 6d 70 61 72 65 20 24 74  tring compare $t
45e0: 79 70 65 20 22 73 65 70 61 72 61 74 6f 72 22 5d  ype "separator"]
45f0: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20   } {.           
4600: 20 24 6d 65 6e 75 20 61 64 64 20 73 65 70 61 72   $menu add separ
4610: 61 74 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20  ator.           
4620: 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20 20   incr count.    
4630: 20 20 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 65          continue
4640: 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20  .        }..    
4650: 20 20 20 20 23 20 65 6e 74 72 79 20 6e 61 6d 65      # entry name
4660: 20 61 6e 64 20 74 61 67 73 0a 20 20 20 20 20 20   and tags.      
4670: 20 20 73 65 74 20 6f 70 74 20 20 5b 5f 70 61 72    set opt  [_par
4680: 73 65 5f 6e 61 6d 65 20 5b 6c 69 6e 64 65 78 20  se_name [lindex 
4690: 24 65 6e 74 72 79 20 31 5d 5d 0a 20 20 20 20 20  $entry 1]].     
46a0: 20 20 20 73 65 74 20 74 61 67 73 20 5b 6c 69 6e     set tags [lin
46b0: 64 65 78 20 24 65 6e 74 72 79 20 32 5d 0a 20 20  dex $entry 2].  
46c0: 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 74 61        foreach ta
46d0: 67 20 24 74 61 67 73 20 7b 0a 20 20 20 20 20 20  g $tags {.      
46e0: 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 5f 77        lappend _w
46f0: 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73  idget($path,tags
4700: 2c 24 74 61 67 29 20 24 6d 65 6e 75 20 24 63 6f  ,$tag) $menu $co
4710: 75 6e 74 0a 09 20 20 20 20 23 20 65 72 69 63 6d  unt..    # ericm
4720: 40 73 63 72 69 70 74 69 63 73 3a 20 20 41 64 64  @scriptics:  Add
4730: 20 61 20 74 61 67 73 74 61 74 65 20 74 72 61 63   a tagstate trac
4740: 6b 65 72 0a 09 20 20 20 20 69 66 20 7b 20 21 5b  ker..    if { ![
4750: 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64  info exists _wid
4760: 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74 61  get($path,tagsta
4770: 74 65 2c 24 74 61 67 29 5d 20 7d 20 7b 0a 09 09  te,$tag)] } {...
4780: 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74  set _widget($pat
4790: 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67 29  h,tagstate,$tag)
47a0: 20 31 0a 09 20 20 20 20 7d 0a 20 20 20 20 20 20   1..    }.      
47b0: 20 20 7d 0a 09 23 20 65 72 69 63 6d 40 73 63 72    }..# [email protected]
47c0: 69 70 74 69 63 73 2e 63 6f 6d 3a 20 20 41 64 64  iptics.com:  Add
47d0: 20 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20 6d 65   mapping from me
47e0: 6e 75 20 69 74 65 6d 73 20 74 6f 20 74 61 67 73  nu items to tags
47f0: 0a 09 73 65 74 20 5f 77 69 64 67 65 74 28 24 70  ..set _widget($p
4800: 61 74 68 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c 69  ath,menutags,[li
4810: 73 74 20 24 6d 65 6e 75 20 24 63 6f 75 6e 74 5d  st $menu $count]
4820: 29 20 24 74 61 67 73 0a 0a 20 20 20 20 20 20 20  ) $tags..       
4830: 20 69 66 20 7b 20 21 5b 73 74 72 69 6e 67 20 63   if { ![string c
4840: 6f 6d 70 61 72 65 20 24 74 79 70 65 20 22 63 61  ompare $type "ca
4850: 73 63 61 64 22 5d 20 7d 20 7b 0a 20 20 20 20 20  scad"] } {.     
4860: 20 20 20 20 20 20 20 73 65 74 20 6d 65 6e 75 69         set menui
4870: 64 20 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72  d  [lindex $entr
4880: 79 20 33 5d 0a 20 20 20 20 20 20 20 20 20 20 20  y 3].           
4890: 20 73 65 74 20 74 65 61 72 6f 66 66 20 5b 6c 69   set tearoff [li
48a0: 6e 64 65 78 20 24 65 6e 74 72 79 20 34 5d 0a 20  ndex $entry 4]. 
48b0: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73             set s
48c0: 75 62 6d 65 6e 75 20 24 6d 65 6e 75 2e 6d 65 6e  ubmenu $menu.men
48d0: 75 24 63 6f 75 6e 74 0a 20 20 20 20 20 20 20 20  u$count.        
48e0: 20 20 20 20 65 76 61 6c 20 24 6d 65 6e 75 20 61      eval $menu a
48f0: 64 64 20 63 61 73 63 61 64 20 24 6f 70 74 20 2d  dd cascad $opt -
4900: 6d 65 6e 75 20 24 73 75 62 6d 65 6e 75 0a 20 20  menu $submenu.  
4910: 20 20 20 20 20 20 20 20 20 20 6d 65 6e 75 20 24            menu $
4920: 73 75 62 6d 65 6e 75 20 2d 74 65 61 72 6f 66 66  submenu -tearoff
4930: 20 24 74 65 61 72 6f 66 66 20 2d 62 61 63 6b 67   $tearoff -backg
4940: 72 6f 75 6e 64 20 24 62 67 0a 20 20 20 20 20 20  round $bg.      
4950: 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69        if { [stri
4960: 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75 69  ng length $menui
4970: 64 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20  d] } {.         
4980: 20 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68 61         # menu ha
4990: 73 20 69 64 65 6e 74 69 66 69 65 72 0a 20 20 20  s identifier.   
49a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74               set
49b0: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d   _widget($path,m
49c0: 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 20 24  enuid,$menuid) $
49d0: 73 75 62 6d 65 6e 75 0a 20 20 20 20 20 20 20 20  submenu.        
49e0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20      }.          
49f0: 20 20 5f 63 72 65 61 74 65 5f 65 6e 74 72 69 65    _create_entrie
4a00: 73 20 24 70 61 74 68 20 24 73 75 62 6d 65 6e 75  s $path $submenu
4a10: 20 24 62 67 20 5b 6c 69 6e 64 65 78 20 24 65 6e   $bg [lindex $en
4a20: 74 72 79 20 35 5d 0a 20 20 20 20 20 20 20 20 20  try 5].         
4a30: 20 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20     incr count.  
4a40: 20 20 20 20 20 20 20 20 20 20 63 6f 6e 74 69 6e            contin
4a50: 75 65 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20  ue.        }..  
4a60: 20 20 20 20 20 20 23 20 65 6e 74 72 79 20 68 65        # entry he
4a70: 6c 70 20 64 65 73 63 72 69 70 74 69 6f 6e 0a 20  lp description. 
4a80: 20 20 20 20 20 20 20 73 65 74 20 64 65 73 63 20         set desc 
4a90: 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 33  [lindex $entry 3
4aa0: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b  ].        if { [
4ab0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 64  string length $d
4ac0: 65 73 63 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  esc] } {.       
4ad0: 20 20 20 20 20 69 66 20 7b 20 21 24 72 65 67 69       if { !$regi
4ae0: 73 74 65 72 65 64 20 7d 20 7b 0a 20 20 20 20 20  stered } {.     
4af0: 20 20 20 20 20 20 20 20 20 20 20 44 79 6e 61 6d             Dynam
4b00: 69 63 48 65 6c 70 3a 3a 72 65 67 69 73 74 65 72  icHelp::register
4b10: 20 24 6d 65 6e 75 20 6d 65 6e 75 20 5b 57 69 64   $menu menu [Wid
4b20: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
4b30: 70 61 74 68 20 2d 74 65 78 74 76 61 72 69 61 62  path -textvariab
4b40: 6c 65 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20  le].            
4b50: 20 20 20 20 73 65 74 20 72 65 67 69 73 74 65 72      set register
4b60: 65 64 20 31 0a 20 20 20 20 20 20 20 20 20 20 20  ed 1.           
4b70: 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 44   }.            D
4b80: 79 6e 61 6d 69 63 48 65 6c 70 3a 3a 72 65 67 69  ynamicHelp::regi
4b90: 73 74 65 72 20 24 6d 65 6e 75 20 6d 65 6e 75 65  ster $menu menue
4ba0: 6e 74 72 79 20 24 63 6f 75 6e 74 20 24 64 65 73  ntry $count $des
4bb0: 63 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20  c.        }..   
4bc0: 20 20 20 20 20 23 20 65 6e 74 72 79 20 61 63 63       # entry acc
4bd0: 65 6c 65 72 61 74 6f 72 0a 20 20 20 20 20 20 20  elerator.       
4be0: 20 73 65 74 20 61 63 63 65 6c 20 5b 5f 70 61 72   set accel [_par
4bf0: 73 65 5f 61 63 63 65 6c 65 72 61 74 6f 72 20 5b  se_accelerator [
4c00: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 34 5d  lindex $entry 4]
4c10: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b  ].        if { [
4c20: 6c 6c 65 6e 67 74 68 20 24 61 63 63 65 6c 5d 20  llength $accel] 
4c30: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
4c40: 6c 61 70 70 65 6e 64 20 6f 70 74 20 2d 61 63 63  lappend opt -acc
4c50: 65 6c 65 72 61 74 6f 72 20 5b 6c 69 6e 64 65 78  elerator [lindex
4c60: 20 24 61 63 63 65 6c 20 30 5d 0a 20 20 20 20 20   $accel 0].     
4c70: 20 20 20 20 20 20 20 62 69 6e 64 20 24 5f 77 69         bind $_wi
4c80: 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20  dget($path,top) 
4c90: 5b 6c 69 6e 64 65 78 20 24 61 63 63 65 6c 20 31  [lindex $accel 1
4ca0: 5d 20 22 24 6d 65 6e 75 20 69 6e 76 6f 6b 65 20  ] "$menu invoke 
4cb0: 24 63 6f 75 6e 74 22 0a 20 20 20 20 20 20 20 20  $count".        
4cc0: 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 75 73 65  }..        # use
4cd0: 72 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 20 20  r options.      
4ce0: 20 20 73 65 74 20 75 73 65 72 6f 70 74 20 5b 6c    set useropt [l
4cf0: 72 61 6e 67 65 20 24 65 6e 74 72 79 20 35 20 65  range $entry 5 e
4d00: 6e 64 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b  nd].        if {
4d10: 20 21 5b 73 74 72 69 6e 67 20 63 6f 6d 70 61 72   ![string compar
4d20: 65 20 24 74 79 70 65 20 22 63 6f 6d 6d 61 6e 64  e $type "command
4d30: 22 5d 20 7c 7c 20 0a 20 20 20 20 20 20 20 20 20  "] || .         
4d40: 20 20 20 20 21 5b 73 74 72 69 6e 67 20 63 6f 6d      ![string com
4d50: 70 61 72 65 20 24 74 79 70 65 20 22 72 61 64 69  pare $type "radi
4d60: 6f 62 75 74 74 6f 6e 22 5d 20 7c 7c 0a 20 20 20  obutton"] ||.   
4d70: 20 20 20 20 20 20 20 20 20 20 21 5b 73 74 72 69            ![stri
4d80: 6e 67 20 63 6f 6d 70 61 72 65 20 24 74 79 70 65  ng compare $type
4d90: 20 22 63 68 65 63 6b 62 75 74 74 6f 6e 22 5d 20   "checkbutton"] 
4da0: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
4db0: 65 76 61 6c 20 24 6d 65 6e 75 20 61 64 64 20 24  eval $menu add $
4dc0: 74 79 70 65 20 24 6f 70 74 20 24 75 73 65 72 6f  type $opt $usero
4dd0: 70 74 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73  pt.        } els
4de0: 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  e {.            
4df0: 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72  return -code err
4e00: 6f 72 20 22 69 6e 76 61 6c 69 64 20 6d 65 6e 75  or "invalid menu
4e10: 20 74 79 70 65 20 5c 22 24 74 79 70 65 5c 22 22   type \"$type\""
4e20: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20  .        }.     
4e30: 20 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20     incr count.  
4e40: 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d    }.}...# ------
4e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e90: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
4ea0: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f  and MainFrame::_
4eb0: 70 61 72 73 65 5f 6e 61 6d 65 0a 23 20 2d 2d 2d  parse_name.# ---
4ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4ef0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4f00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
4f10: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72   MainFrame::_par
4f20: 73 65 5f 6e 61 6d 65 20 7b 20 6d 65 6e 75 6e 61  se_name { menuna
4f30: 6d 65 20 7d 20 7b 0a 20 20 20 20 73 65 74 20 69  me } {.    set i
4f40: 64 78 20 5b 73 74 72 69 6e 67 20 66 69 72 73 74  dx [string first
4f50: 20 22 26 22 20 24 6d 65 6e 75 6e 61 6d 65 5d 0a   "&" $menuname].
4f60: 20 20 20 20 69 66 20 7b 20 24 69 64 78 20 3d 3d      if { $idx ==
4f70: 20 2d 31 20 7d 20 7b 0a 20 20 20 20 20 20 20 20   -1 } {.        
4f80: 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 2d 6c 61  return [list -la
4f90: 62 65 6c 20 24 6d 65 6e 75 6e 61 6d 65 5d 0a 20  bel $menuname]. 
4fa0: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20     } else {.    
4fb0: 20 20 20 20 73 65 74 20 62 65 67 20 5b 73 74 72      set beg [str
4fc0: 69 6e 67 20 72 61 6e 67 65 20 24 6d 65 6e 75 6e  ing range $menun
4fd0: 61 6d 65 20 30 20 5b 65 78 70 72 20 7b 24 69 64  ame 0 [expr {$id
4fe0: 78 2d 31 7d 5d 5d 0a 20 20 20 20 20 20 20 20 73  x-1}]].        s
4ff0: 65 74 20 65 6e 64 20 5b 73 74 72 69 6e 67 20 72  et end [string r
5000: 61 6e 67 65 20 24 6d 65 6e 75 6e 61 6d 65 20 5b  ange $menuname [
5010: 65 78 70 72 20 7b 24 69 64 78 2b 31 7d 5d 20 65  expr {$idx+1}] e
5020: 6e 64 5d 0a 20 20 20 20 20 20 20 20 61 70 70 65  nd].        appe
5030: 6e 64 20 62 65 67 20 24 65 6e 64 0a 20 20 20 20  nd beg $end.    
5040: 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74      return [list
5050: 20 2d 6c 61 62 65 6c 20 24 62 65 67 20 2d 75 6e   -label $beg -un
5060: 64 65 72 6c 69 6e 65 20 24 69 64 78 5d 0a 20 20  derline $idx].  
5070: 20 20 7d 0a 7d 0a 0a 0a 23 20 4d 61 69 6e 46 72    }.}...# MainFr
5080: 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 61 63 63 65  ame::_parse_acce
5090: 6c 65 72 61 74 6f 72 20 2d 2d 0a 23 0a 23 09 47  lerator --.#.#.G
50a0: 69 76 65 6e 20 61 20 6b 65 79 20 63 6f 6d 62 6f  iven a key combo
50b0: 20 64 65 73 63 72 69 70 74 69 6f 6e 2c 20 63 6f   description, co
50c0: 6e 73 74 72 75 63 74 20 61 6e 20 61 70 70 72 6f  nstruct an appro
50d0: 70 72 69 61 74 65 20 68 75 6d 61 6e 20 72 65 61  priate human rea
50e0: 64 61 62 6c 65 0a 23 09 73 74 72 69 6e 67 20 28  dable.#.string (
50f0: 66 6f 72 20 64 69 73 70 6c 61 79 20 6f 6e 20 61  for display on a
5100: 73 20 61 20 6d 65 6e 75 20 61 63 63 65 6c 65 72  s a menu acceler
5110: 61 74 6f 72 29 20 61 6e 64 20 74 68 65 20 63 6f  ator) and the co
5120: 72 72 65 73 70 6f 6e 64 69 6e 67 0a 23 09 62 69  rresponding.#.bi
5130: 6e 64 20 65 76 65 6e 74 2e 0a 23 0a 23 20 41 72  nd event..#.# Ar
5140: 67 75 6d 65 6e 74 73 3a 0a 23 09 64 65 73 63 09  guments:.#.desc.
5150: 61 20 6c 69 73 74 20 77 69 74 68 20 74 68 65 20  a list with the 
5160: 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 61 74  following format
5170: 3a 0a 23 09 09 09 3f 73 65 71 75 65 6e 63 65 3f  :.#...?sequence?
5180: 20 6b 65 79 0a 23 09 09 73 65 71 75 65 6e 63 65   key.#..sequence
5190: 20 6d 61 79 20 62 65 20 4e 6f 6e 65 2c 20 43 74   may be None, Ct
51a0: 72 6c 2c 20 41 6c 74 2c 20 6f 72 20 43 74 72 6c  rl, Alt, or Ctrl
51b0: 41 6c 74 0a 23 09 09 6b 65 79 20 6d 61 79 20 62  Alt.#..key may b
51c0: 65 20 61 6e 79 20 6b 65 79 0a 23 0a 23 20 52 65  e any key.#.# Re
51d0: 73 75 6c 74 73 3a 0a 23 09 7b 61 63 63 65 6c 20  sults:.#.{accel 
51e0: 65 76 65 6e 74 7d 09 61 20 6c 69 73 74 20 63 6f  event}.a list co
51f0: 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 61 63 63  ntaining the acc
5200: 65 6c 65 72 61 74 6f 72 20 73 74 72 69 6e 67 20  elerator string 
5210: 61 6e 64 20 74 68 65 20 65 76 65 6e 74 0a 0a 70  and the event..p
5220: 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f  roc MainFrame::_
5230: 70 61 72 73 65 5f 61 63 63 65 6c 65 72 61 74 6f  parse_accelerato
5240: 72 20 7b 20 64 65 73 63 20 7d 20 7b 0a 20 20 20  r { desc } {.   
5250: 20 69 66 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24   if { [llength $
5260: 64 65 73 63 5d 20 3d 3d 20 31 20 7d 20 7b 0a 09  desc] == 1 } {..
5270: 73 65 74 20 73 65 71 20 4e 6f 6e 65 0a 09 73 65  set seq None..se
5280: 74 20 6b 65 79 20 5b 73 74 72 69 6e 67 20 74 6f  t key [string to
5290: 6c 6f 77 65 72 20 5b 6c 69 6e 64 65 78 20 24 64  lower [lindex $d
52a0: 65 73 63 20 30 5d 5d 0a 09 23 20 49 66 20 74 68  esc 0]]..# If th
52b0: 65 20 6b 65 79 20 69 73 20 61 6e 20 46 20 6b 65  e key is an F ke
52c0: 79 20 28 69 65 2c 20 46 31 2c 20 46 32 2c 20 65  y (ie, F1, F2, e
52d0: 74 63 29 2c 20 69 74 20 68 61 73 20 74 6f 20 62  tc), it has to b
52e0: 65 20 63 61 70 69 74 61 6c 69 7a 65 64 0a 09 69  e capitalized..i
52f0: 66 20 7b 5b 72 65 67 65 78 70 20 7b 66 5b 31 5d  f {[regexp {f[1]
5300: 3f 5b 30 2d 39 5d 2a 7d 20 24 6b 65 79 5d 7d 20  ?[0-9]*} $key]} 
5310: 7b 0a 09 20 20 20 20 73 65 74 20 6b 65 79 20 5b  {..    set key [
5320: 73 74 72 69 6e 67 20 74 6f 75 70 70 65 72 20 24  string toupper $
5330: 6b 65 79 5d 0a 09 7d 0a 20 20 20 20 7d 20 65 6c  key]..}.    } el
5340: 73 65 69 66 20 7b 20 5b 6c 6c 65 6e 67 74 68 20  seif { [llength 
5350: 24 64 65 73 63 5d 20 3d 3d 20 32 20 7d 20 7b 0a  $desc] == 2 } {.
5360: 20 20 20 20 20 20 20 20 73 65 74 20 73 65 71 20          set seq 
5370: 5b 6c 69 6e 64 65 78 20 24 64 65 73 63 20 30 5d  [lindex $desc 0]
5380: 0a 20 20 20 20 20 20 20 20 73 65 74 20 6b 65 79  .        set key
5390: 20 5b 73 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72   [string tolower
53a0: 20 5b 6c 69 6e 64 65 78 20 24 64 65 73 63 20 31   [lindex $desc 1
53b0: 5d 5d 0a 09 23 20 49 66 20 74 68 65 20 6b 65 79  ]]..# If the key
53c0: 20 69 73 20 61 6e 20 46 20 6b 65 79 20 28 69 65   is an F key (ie
53d0: 2c 20 46 31 2c 20 46 32 2c 20 65 74 63 29 2c 20  , F1, F2, etc), 
53e0: 69 74 20 68 61 73 20 74 6f 20 62 65 20 63 61 70  it has to be cap
53f0: 69 74 61 6c 69 7a 65 64 0a 09 69 66 20 7b 5b 72  italized..if {[r
5400: 65 67 65 78 70 20 7b 66 5b 31 5d 3f 5b 30 2d 39  egexp {f[1]?[0-9
5410: 5d 2a 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20  ]*} $key]} {..  
5420: 20 20 73 65 74 20 6b 65 79 20 5b 73 74 72 69 6e    set key [strin
5430: 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a  g toupper $key].
5440: 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  .}.    } else {.
5450: 09 72 65 74 75 72 6e 20 7b 7d 0a 20 20 20 20 7d  .return {}.    }
5460: 0a 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 24  .    switch -- $
5470: 73 65 71 20 7b 0a 09 4e 6f 6e 65 20 7b 0a 09 20  seq {..None {.. 
5480: 20 20 20 73 65 74 20 61 63 63 65 6c 20 22 5b 73     set accel "[s
5490: 74 72 69 6e 67 20 74 6f 75 70 70 65 72 20 24 6b  tring toupper $k
54a0: 65 79 5d 22 0a 09 20 20 20 20 73 65 74 20 65 76  ey]"..    set ev
54b0: 65 6e 74 20 22 3c 4b 65 79 2d 24 6b 65 79 3e 22  ent "<Key-$key>"
54c0: 0a 09 7d 0a 09 43 74 72 6c 20 7b 0a 09 20 20 20  ..}..Ctrl {..   
54d0: 20 73 65 74 20 61 63 63 65 6c 20 22 43 74 72 6c   set accel "Ctrl
54e0: 2b 5b 73 74 72 69 6e 67 20 74 6f 75 70 70 65 72  +[string toupper
54f0: 20 24 6b 65 79 5d 22 0a 09 20 20 20 20 73 65 74   $key]"..    set
5500: 20 65 76 65 6e 74 20 22 3c 43 6f 6e 74 72 6f 6c   event "<Control
5510: 2d 4b 65 79 2d 24 6b 65 79 3e 22 0a 09 7d 0a 09  -Key-$key>"..}..
5520: 41 6c 74 20 7b 0a 09 20 20 20 20 73 65 74 20 61  Alt {..    set a
5530: 63 63 65 6c 20 22 41 6c 74 2b 5b 73 74 72 69 6e  ccel "Alt+[strin
5540: 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 22  g toupper $key]"
5550: 0a 09 20 20 20 20 73 65 74 20 65 76 65 6e 74 20  ..    set event 
5560: 22 3c 41 6c 74 2d 4b 65 79 2d 24 6b 65 79 3e 22  "<Alt-Key-$key>"
5570: 0a 09 7d 0a 09 43 74 72 6c 41 6c 74 20 7b 0a 09  ..}..CtrlAlt {..
5580: 20 20 20 20 73 65 74 20 61 63 63 65 6c 20 22 43      set accel "C
5590: 74 72 6c 2b 41 6c 74 2b 5b 73 74 72 69 6e 67 20  trl+Alt+[string 
55a0: 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a 09  toupper $key]"..
55b0: 20 20 20 20 73 65 74 20 65 76 65 6e 74 20 22 3c      set event "<
55c0: 43 6f 6e 74 72 6f 6c 2d 41 6c 74 2d 4b 65 79 2d  Control-Alt-Key-
55d0: 24 6b 65 79 3e 22 0a 09 7d 0a 09 64 65 66 61 75  $key>"..}..defau
55e0: 6c 74 20 7b 0a 09 20 20 20 20 72 65 74 75 72 6e  lt {..    return
55f0: 20 2d 63 6f 64 65 20 65 72 72 6f 72 20 22 69 6e   -code error "in
5600: 76 61 6c 69 64 20 61 63 63 65 6c 65 72 61 74 6f  valid accelerato
5610: 72 20 63 6f 64 65 20 24 73 65 71 22 0a 09 7d 0a  r code $seq"..}.
5620: 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e      }.    return
5630: 20 5b 6c 69 73 74 20 24 61 63 63 65 6c 20 24 65   [list $accel $e
5640: 76 65 6e 74 5d 0a 7d 0a 0a 0a                    vent].}...