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 d06873965fa4b2996d67d560e5f5d18e97898b0a:


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 0a 23  --------------.#
0050: 20 20 6d 61 69 6e 66 72 61 6d 65 2e 74 63 6c 0a    mainframe.tcl.
0060: 23 20 20 54 68 69 73 20 66 69 6c 65 20 69 73 20  #  This file is 
0070: 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78 20 42  part of Unifix B
0080: 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74 0a 23  Widget Toolkit.#
0090: 20 20 24 49 64 3a 20 6d 61 69 6e 66 72 61 6d 65    $Id: mainframe
00a0: 2e 74 63 6c 2c 76 20 31 2e 31 36 20 32 30 30 34  .tcl,v 1.16 2004
00b0: 2f 30 32 2f 30 34 20 30 30 3a 31 31 3a 34 33 20  /02/04 00:11:43 
00c0: 68 6f 62 62 73 20 45 78 70 20 24 0a 23 20 2d 2d  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 0a 23 20 20  ------------.#  
0120: 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d 61 6e 64  Index of command
0130: 73 3a 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46  s:.#     - MainF
0140: 72 61 6d 65 3a 3a 63 72 65 61 74 65 0a 23 20 20  rame::create.#  
0150: 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a     - MainFrame::
0160: 63 6f 6e 66 69 67 75 72 65 0a 23 20 20 20 20 20  configure.#     
0170: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 67 65  - MainFrame::cge
0180: 74 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  t.#     - MainFr
0190: 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 0a 23 20  ame::getframe.# 
01a0: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
01b0: 3a 61 64 64 74 6f 6f 6c 62 61 72 0a 23 20 20 20  :addtoolbar.#   
01c0: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67    - MainFrame::g
01d0: 65 74 74 6f 6f 6c 62 61 72 0a 23 20 20 20 20 20  ettoolbar.#     
01e0: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61 64 64  - MainFrame::add
01f0: 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20 20 20  indicator.#     
0200: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74  - MainFrame::get
0210: 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20 20 20  indicator.#     
0220: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74  - MainFrame::get
0230: 6d 65 6e 75 0a 23 20 20 20 20 20 2d 20 4d 61 69  menu.#     - Mai
0240: 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e 6c 79  nFrame::menuonly
0250: 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61  .#     - MainFra
0260: 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61 72 0a  me::showtoolbar.
0270: 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d  #     - MainFram
0280: 65 3a 3a 73 68 6f 77 73 74 61 74 75 73 62 61 72  e::showstatusbar
0290: 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61  .#     - MainFra
02a0: 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 6d 65 6e 75  me::_create_menu
02b0: 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e  bar.#     - Main
02c0: 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 65  Frame::_create_e
02d0: 6e 74 72 69 65 73 0a 23 20 20 20 20 20 2d 20 4d  ntries.#     - M
02e0: 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65  ainFrame::_parse
02f0: 5f 6e 61 6d 65 0a 23 20 20 20 20 20 2d 20 4d 61  _name.#     - Ma
0300: 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65 5f  inFrame::_parse_
0310: 61 63 63 65 6c 65 72 61 74 6f 72 0a 23 20 2d 2d  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 0a 0a 6e 61 6d 65  ----------..name
0370: 73 70 61 63 65 20 65 76 61 6c 20 4d 61 69 6e 46  space eval MainF
0380: 72 61 6d 65 20 7b 0a 20 20 20 20 57 69 64 67 65  rame {.    Widge
0390: 74 3a 3a 64 65 66 69 6e 65 20 4d 61 69 6e 46 72  t::define MainFr
03a0: 61 6d 65 20 6d 61 69 6e 66 72 61 6d 65 20 50 72  ame mainframe Pr
03b0: 6f 67 72 65 73 73 42 61 72 0a 0a 20 20 20 20 57  ogressBar..    W
03c0: 69 64 67 65 74 3a 3a 62 77 69 6e 63 6c 75 64 65  idget::bwinclude
03d0: 20 4d 61 69 6e 46 72 61 6d 65 20 50 72 6f 67 72   MainFrame Progr
03e0: 65 73 73 42 61 72 20 2e 73 74 61 74 75 73 2e 70  essBar .status.p
03f0: 72 67 20 5c 0a 09 20 20 20 20 72 65 6d 6f 76 65  rg \..    remove
0400: 20 7b 0a 09 2d 66 67 20 2d 62 67 20 2d 62 64 20   {..-fg -bg -bd 
0410: 2d 74 72 6f 75 67 68 63 6f 6c 6f 72 20 2d 62 61  -troughcolor -ba
0420: 63 6b 67 72 6f 75 6e 64 20 2d 62 6f 72 64 65 72  ckground -border
0430: 77 69 64 74 68 0a 09 2d 72 65 6c 69 65 66 20 2d  width..-relief -
0440: 6f 72 69 65 6e 74 20 2d 77 69 64 74 68 20 2d 68  orient -width -h
0450: 65 69 67 68 74 0a 20 20 20 20 7d 20 5c 0a 09 20  eight.    } \.. 
0460: 20 20 20 72 65 6e 61 6d 65 20 7b 0a 09 2d 6d 61     rename {..-ma
0470: 78 69 6d 75 6d 20 20 20 20 2d 70 72 6f 67 72 65  ximum    -progre
0480: 73 73 6d 61 78 0a 09 2d 76 61 72 69 61 62 6c 65  ssmax..-variable
0490: 20 20 20 2d 70 72 6f 67 72 65 73 73 76 61 72 0a     -progressvar.
04a0: 09 2d 74 79 70 65 20 20 20 20 20 20 20 2d 70 72  .-type       -pr
04b0: 6f 67 72 65 73 73 74 79 70 65 0a 09 2d 66 6f 72  ogresstype..-for
04c0: 65 67 72 6f 75 6e 64 20 2d 70 72 6f 67 72 65 73  eground -progres
04d0: 73 66 67 0a 20 20 20 20 7d 0a 0a 20 20 20 20 57  sfg.    }..    W
04e0: 69 64 67 65 74 3a 3a 64 65 63 6c 61 72 65 20 4d  idget::declare M
04f0: 61 69 6e 46 72 61 6d 65 20 7b 0a 09 7b 2d 77 69  ainFrame {..{-wi
0500: 64 74 68 20 20 20 20 20 20 20 20 54 6b 52 65 73  dth        TkRes
0510: 6f 75 72 63 65 20 30 20 20 20 20 20 20 30 20 66  ource 0      0 f
0520: 72 61 6d 65 7d 0a 09 7b 2d 68 65 69 67 68 74 20  rame}..{-height 
0530: 20 20 20 20 20 20 54 6b 52 65 73 6f 75 72 63 65        TkResource
0540: 20 30 20 20 20 20 20 20 30 20 66 72 61 6d 65 7d   0      0 frame}
0550: 0a 09 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 20  ..{-background  
0560: 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22 20 20   TkResource ""  
0570: 20 20 20 30 20 66 72 61 6d 65 7d 0a 09 7b 2d 74     0 frame}..{-t
0580: 65 78 74 76 61 72 69 61 62 6c 65 20 53 74 72 69  extvariable Stri
0590: 6e 67 20 20 20 20 20 22 22 20 20 20 20 20 30 7d  ng     ""     0}
05a0: 0a 09 7b 2d 6d 65 6e 75 20 20 20 20 20 20 20 20  ..{-menu        
05b0: 20 53 74 72 69 6e 67 20 20 20 20 20 7b 7d 20 20   String     {}  
05c0: 20 20 20 31 7d 0a 09 7b 2d 73 65 70 61 72 61 74     1}..{-separat
05d0: 6f 72 20 20 20 20 45 6e 75 6d 20 20 20 20 20 20  or    Enum      
05e0: 20 62 6f 74 68 20 20 20 31 20 7b 6e 6f 6e 65 20   both   1 {none 
05f0: 74 6f 70 20 62 6f 74 74 6f 6d 20 62 6f 74 68 7d  top bottom both}
0600: 7d 0a 09 7b 2d 62 67 20 20 20 20 20 20 20 20 20  }..{-bg         
0610: 20 20 53 79 6e 6f 6e 79 6d 20 20 20 20 2d 62 61    Synonym    -ba
0620: 63 6b 67 72 6f 75 6e 64 7d 0a 0a 09 7b 2d 6d 65  ckground}...{-me
0630: 6e 75 62 61 72 66 6f 6e 74 20 20 20 53 74 72 69  nubarfont   Stri
0640: 6e 67 20 20 20 20 20 22 22 20 20 30 7d 0a 09 7b  ng     ""  0}..{
0650: 2d 6d 65 6e 75 65 6e 74 72 79 66 6f 6e 74 20 53  -menuentryfont S
0660: 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 30 7d  tring     ""  0}
0670: 0a 09 7b 2d 73 74 61 74 75 73 62 61 72 66 6f 6e  ..{-statusbarfon
0680: 74 20 53 74 72 69 6e 67 20 20 20 20 20 22 22 20  t String     "" 
0690: 20 30 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 57   0}.    }..    W
06a0: 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61  idget::addmap Ma
06b0: 69 6e 46 72 61 6d 65 20 22 22 20 2e 66 72 61 6d  inFrame "" .fram
06c0: 65 20 20 7b 2d 77 69 64 74 68 20 7b 7d 20 2d 68  e  {-width {} -h
06d0: 65 69 67 68 74 20 7b 7d 20 2d 62 61 63 6b 67 72  eight {} -backgr
06e0: 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64  ound {}}.    Wid
06f0: 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e  get::addmap Main
0700: 46 72 61 6d 65 20 22 22 20 2e 74 6f 70 66 20 20  Frame "" .topf  
0710: 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d   {-background {}
0720: 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64  }.    Widget::ad
0730: 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 22  dmap MainFrame "
0740: 22 20 2e 62 6f 74 66 20 20 20 7b 2d 62 61 63 6b  " .botf   {-back
0750: 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57  ground {}}.    W
0760: 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61  idget::addmap Ma
0770: 69 6e 46 72 61 6d 65 20 22 22 20 2e 73 74 61 74  inFrame "" .stat
0780: 75 73 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20  us {-background 
0790: 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a  {}}.    Widget::
07a0: 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65  addmap MainFrame
07b0: 20 22 22 20 2e 73 74 61 74 75 73 2e 6c 61 62 65   "" .status.labe
07c0: 6c 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 7b  l {-background {
07d0: 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61  }}.    Widget::a
07e0: 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20  ddmap MainFrame 
07f0: 22 22 20 2e 73 74 61 74 75 73 2e 69 6e 64 66 20  "" .status.indf 
0800: 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d   {-background {}
0810: 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64  }.    Widget::ad
0820: 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 22  dmap MainFrame "
0830: 22 20 2e 73 74 61 74 75 73 2e 70 72 67 66 20 20  " .status.prgf  
0840: 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d  {-background {}}
0850: 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64  .    Widget::add
0860: 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 50 72  map MainFrame Pr
0870: 6f 67 72 65 73 73 42 61 72 20 2e 73 74 61 74 75  ogressBar .statu
0880: 73 2e 70 72 67 20 7b 2d 62 61 63 6b 67 72 6f 75  s.prg {-backgrou
0890: 6e 64 20 7b 7d 20 2d 62 61 63 6b 67 72 6f 75 6e  nd {} -backgroun
08a0: 64 20 2d 74 72 6f 75 67 68 63 6f 6c 6f 72 7d 0a  d -troughcolor}.
08b0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77  .    variable _w
08c0: 69 64 67 65 74 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d  idget.}...# ----
08d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0910: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
0920: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63  and MainFrame::c
0930: 72 65 61 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  reate.# --------
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 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0980: 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
0990: 61 6d 65 3a 3a 63 72 65 61 74 65 20 7b 20 70 61  ame::create { pa
09a0: 74 68 20 61 72 67 73 20 7d 20 7b 0a 20 20 20 20  th args } {.    
09b0: 67 6c 6f 62 61 6c 20 20 20 74 63 6c 5f 70 6c 61  global   tcl_pla
09c0: 74 66 6f 72 6d 0a 20 20 20 20 76 61 72 69 61 62  tform.    variab
09d0: 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20  le _widget..    
09e0: 73 65 74 20 70 61 74 68 20 5b 66 72 61 6d 65 20  set path [frame 
09f0: 24 70 61 74 68 20 2d 74 61 6b 65 66 6f 63 75 73  $path -takefocus
0a00: 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69   0 -highlightthi
0a10: 63 6b 6e 65 73 73 20 30 5d 0a 20 20 20 20 73 65  ckness 0].    se
0a20: 74 20 74 6f 70 20 20 5b 77 69 6e 66 6f 20 70 61  t top  [winfo pa
0a30: 72 65 6e 74 20 24 70 61 74 68 5d 0a 20 20 20 20  rent $path].    
0a40: 69 66 20 7b 20 21 5b 73 74 72 69 6e 67 20 65 71  if { ![string eq
0a50: 75 61 6c 20 5b 77 69 6e 66 6f 20 74 6f 70 6c 65  ual [winfo tople
0a60: 76 65 6c 20 24 70 61 74 68 5d 20 24 74 6f 70 5d  vel $path] $top]
0a70: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73   } {.        des
0a80: 74 72 6f 79 20 24 70 61 74 68 0a 20 20 20 20 20  troy $path.     
0a90: 20 20 20 72 65 74 75 72 6e 20 2d 63 6f 64 65 20     return -code 
0aa0: 65 72 72 6f 72 20 22 70 61 72 65 6e 74 20 6d 75  error "parent mu
0ab0: 73 74 20 62 65 20 61 20 74 6f 70 6c 65 76 65 6c  st be a toplevel
0ac0: 22 0a 20 20 20 20 7d 0a 20 20 20 20 57 69 64 67  ".    }.    Widg
0ad0: 65 74 3a 3a 69 6e 69 74 20 4d 61 69 6e 46 72 61  et::init MainFra
0ae0: 6d 65 20 24 70 61 74 68 20 24 61 72 67 73 0a 0a  me $path $args..
0af0: 20 20 20 20 69 66 20 7b 20 24 74 63 6c 5f 70 6c      if { $tcl_pl
0b00: 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29  atform(platform)
0b10: 20 3d 3d 20 22 75 6e 69 78 22 20 7d 20 7b 0a 20   == "unix" } {. 
0b20: 20 20 20 20 20 20 20 73 65 74 20 72 65 6c 69 65         set relie
0b30: 66 20 72 61 69 73 65 64 0a 20 20 20 20 20 20 20  f raised.       
0b40: 20 73 65 74 20 62 64 20 20 20 20 20 31 0a 20 20   set bd     1.  
0b50: 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20    } else {.     
0b60: 20 20 20 73 65 74 20 72 65 6c 69 65 66 20 66 6c     set relief fl
0b70: 61 74 0a 20 20 20 20 20 20 20 20 73 65 74 20 62  at.        set b
0b80: 64 20 20 20 20 20 30 0a 20 20 20 20 7d 0a 20 20  d     0.    }.  
0b90: 20 20 73 65 74 20 74 6f 70 66 72 61 6d 65 20 20    set topframe  
0ba0: 5b 65 76 61 6c 20 5b 6c 69 73 74 20 66 72 61 6d  [eval [list fram
0bb0: 65 20 24 70 61 74 68 2e 74 6f 70 66 5d 20 5c 0a  e $path.topf] \.
0bc0: 09 09 20 20 20 20 20 20 20 2d 72 65 6c 69 65 66  ..       -relief
0bd0: 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64   flat -borderwid
0be0: 74 68 20 30 20 5c 0a 09 09 20 20 20 20 20 20 20  th 0 \...       
0bf0: 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74  [Widget::subcget
0c00: 20 24 70 61 74 68 20 2e 74 6f 70 66 5d 5d 0a 20   $path .topf]]. 
0c10: 20 20 20 73 65 74 20 75 73 65 72 66 72 61 6d 65     set userframe
0c20: 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 66 72 61   [eval [list fra
0c30: 6d 65 20 24 70 61 74 68 2e 66 72 61 6d 65 5d 20  me $path.frame] 
0c40: 5c 0a 09 09 20 20 20 20 20 20 20 5b 57 69 64 67  \...       [Widg
0c50: 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70 61 74  et::subcget $pat
0c60: 68 20 2e 66 72 61 6d 65 5d 20 5c 0a 20 20 20 20  h .frame] \.    
0c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0c80: 20 20 20 2d 72 65 6c 69 65 66 20 24 72 65 6c 69     -relief $reli
0c90: 65 66 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20  ef -borderwidth 
0ca0: 24 62 64 5d 0a 20 20 20 20 73 65 74 20 62 6f 74  $bd].    set bot
0cb0: 66 72 61 6d 65 20 20 5b 65 76 61 6c 20 5b 6c 69  frame  [eval [li
0cc0: 73 74 20 66 72 61 6d 65 20 24 70 61 74 68 2e 62  st frame $path.b
0cd0: 6f 74 66 5d 20 5c 0a 09 09 20 20 20 20 20 20 20  otf] \...       
0ce0: 2d 72 65 6c 69 65 66 20 24 72 65 6c 69 65 66 20  -relief $relief 
0cf0: 2d 62 6f 72 64 65 72 77 69 64 74 68 20 24 62 64  -borderwidth $bd
0d00: 20 5c 0a 09 09 20 20 20 20 20 20 20 5b 57 69 64   \...       [Wid
0d10: 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70 61  get::subcget $pa
0d20: 74 68 20 2e 62 6f 74 66 5d 5d 0a 0a 20 20 20 20  th .botf]]..    
0d30: 70 61 63 6b 20 24 74 6f 70 66 72 61 6d 65 20 2d  pack $topframe -
0d40: 66 69 6c 6c 20 78 0a 20 20 20 20 67 72 69 64 20  fill x.    grid 
0d50: 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75 72 65 20  columnconfigure 
0d60: 24 74 6f 70 66 72 61 6d 65 20 30 20 2d 77 65 69  $topframe 0 -wei
0d70: 67 68 74 20 31 0a 0a 20 20 20 20 73 65 74 20 62  ght 1..    set b
0d80: 67 20 5b 57 69 64 67 65 74 3a 3a 63 67 65 74 20  g [Widget::cget 
0d90: 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75 6e  $path -backgroun
0da0: 64 5d 0a 20 20 20 20 24 70 61 74 68 20 63 6f 6e  d].    $path con
0db0: 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75  figure -backgrou
0dc0: 6e 64 20 24 62 67 0a 20 20 20 20 69 66 20 7b 20  nd $bg.    if { 
0dd0: 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c  $tcl_platform(pl
0de0: 61 74 66 6f 72 6d 29 20 21 3d 20 22 75 6e 69 78  atform) != "unix
0df0: 22 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 73 65  " } {.        se
0e00: 74 20 73 65 70 6f 70 74 20 5b 57 69 64 67 65 74  t sepopt [Widget
0e10: 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74  ::getoption $pat
0e20: 68 20 2d 73 65 70 61 72 61 74 6f 72 5d 0a 20 20  h -separator].  
0e30: 20 20 20 20 20 20 69 66 20 7b 20 24 73 65 70 6f        if { $sepo
0e40: 70 74 20 3d 3d 20 22 62 6f 74 68 22 20 7c 7c 20  pt == "both" || 
0e50: 24 73 65 70 6f 70 74 20 3d 3d 20 22 74 6f 70 22  $sepopt == "top"
0e60: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20   } {.           
0e70: 20 73 65 74 20 73 65 70 20 5b 53 65 70 61 72 61   set sep [Separa
0e80: 74 6f 72 3a 3a 63 72 65 61 74 65 20 24 70 61 74  tor::create $pat
0e90: 68 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f  h.sep -orient ho
0ea0: 72 69 7a 6f 6e 74 61 6c 20 2d 62 61 63 6b 67 72  rizontal -backgr
0eb0: 6f 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 20 20  ound $bg].      
0ec0: 20 20 20 20 20 20 70 61 63 6b 20 24 73 65 70 20        pack $sep 
0ed0: 2d 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20 20  -fill x.        
0ee0: 7d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 24  }.        if { $
0ef0: 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74 68 22  sepopt == "both"
0f00: 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d 3d 20 22   || $sepopt == "
0f10: 62 6f 74 74 6f 6d 22 20 7d 20 7b 0a 20 20 20 20  bottom" } {.    
0f20: 20 20 20 20 20 20 20 20 73 65 74 20 73 65 70 20          set sep 
0f30: 5b 53 65 70 61 72 61 74 6f 72 3a 3a 63 72 65 61  [Separator::crea
0f40: 74 65 20 24 62 6f 74 66 72 61 6d 65 2e 73 65 70  te $botframe.sep
0f50: 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e   -orient horizon
0f60: 74 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20  tal -background 
0f70: 24 62 67 5d 0a 20 20 20 20 20 20 20 20 20 20 20  $bg].           
0f80: 20 70 61 63 6b 20 24 73 65 70 20 2d 66 69 6c 6c   pack $sep -fill
0f90: 20 78 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20   x.        }.   
0fa0: 20 7d 0a 0a 20 20 20 20 23 20 2d 2d 2d 20 73 74   }..    # --- st
0fb0: 61 74 75 73 20 62 61 72 20 2d 2d 2d 2d 2d 2d 2d  atus bar -------
0fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69  --.    if {[stri
1000: 6e 67 20 6c 65 6e 67 74 68 20 5b 57 69 64 67 65  ng length [Widge
1010: 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61  t::getoption $pa
1020: 74 68 20 2d 73 74 61 74 75 73 62 61 72 66 6f 6e  th -statusbarfon
1030: 74 5d 5d 20 3e 30 20 7d 20 7b 0a 09 73 65 74 20  t]] >0 } {..set 
1040: 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f 6e  sbfnt [list -fon
1050: 74 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70  t [Widget::getop
1060: 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74 61 74  tion $path -stat
1070: 75 73 62 61 72 66 6f 6e 74 5d 5d 0a 20 20 20 20  usbarfont]].    
1080: 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 62  } else {..set sb
1090: 66 6e 74 20 22 22 0a 20 20 20 20 7d 0a 0a 20 20  fnt "".    }..  
10a0: 20 20 73 65 74 20 73 74 61 74 75 73 20 20 20 5b    set status   [
10b0: 66 72 61 6d 65 20 24 70 61 74 68 2e 73 74 61 74  frame $path.stat
10c0: 75 73 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 20  us -relief flat 
10d0: 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30 20 5c  -borderwidth 0 \
10e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
10f0: 20 20 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75         -takefocu
1100: 73 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68  s 0 -highlightth
1110: 69 63 6b 6e 65 73 73 20 30 20 2d 62 61 63 6b 67  ickness 0 -backg
1120: 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 73  round $bg].    s
1130: 65 74 20 6c 61 62 65 6c 20 20 20 20 5b 65 76 61  et label    [eva
1140: 6c 20 5b 6c 69 73 74 20 6c 61 62 65 6c 20 24 73  l [list label $s
1150: 74 61 74 75 73 2e 6c 61 62 65 6c 20 5c 0a 09 20  tatus.label \.. 
1160: 20 20 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65     -textvariable
1170: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
1180: 69 6f 6e 20 24 70 61 74 68 20 2d 74 65 78 74 76  ion $path -textv
1190: 61 72 69 61 62 6c 65 5d 20 5c 0a 09 20 20 20 20  ariable] \..    
11a0: 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69  -takefocus 0 -hi
11b0: 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73  ghlightthickness
11c0: 20 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24   0 -background $
11d0: 62 67 5d 20 24 73 62 66 6e 74 5d 0a 20 20 20 20  bg] $sbfnt].    
11e0: 73 65 74 20 69 6e 64 66 72 61 6d 65 20 5b 66 72  set indframe [fr
11f0: 61 6d 65 20 24 73 74 61 74 75 73 2e 69 6e 64 66  ame $status.indf
1200: 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 20 2d 62   -relief flat -b
1210: 6f 72 64 65 72 77 69 64 74 68 20 30 20 5c 0a 20  orderwidth 0 \. 
1220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1230: 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 73 20       -takefocus 
1240: 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63  0 -highlightthic
1250: 6b 6e 65 73 73 20 30 20 2d 62 61 63 6b 67 72 6f  kness 0 -backgro
1260: 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 73 65 74  und $bg].    set
1270: 20 70 72 67 66 72 61 6d 65 20 5b 66 72 61 6d 65   prgframe [frame
1280: 20 24 73 74 61 74 75 73 2e 70 72 67 66 20 2d 72   $status.prgf -r
1290: 65 6c 69 65 66 20 66 6c 61 74 20 2d 62 6f 72 64  elief flat -bord
12a0: 65 72 77 69 64 74 68 20 30 20 5c 0a 20 20 20 20  erwidth 0 \.    
12b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
12c0: 20 20 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 2d    -takefocus 0 -
12d0: 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65  highlightthickne
12e0: 73 73 20 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64  ss 0 -background
12f0: 20 24 62 67 5d 0a 0a 20 20 20 20 70 6c 61 63 65   $bg]..    place
1300: 20 24 6c 61 62 65 6c 20 20 20 20 2d 61 6e 63 68   $label    -anch
1310: 6f 72 20 77 20 2d 78 20 30 20 2d 72 65 6c 79 20  or w -x 0 -rely 
1320: 30 2e 35 0a 20 20 20 20 70 6c 61 63 65 20 24 69  0.5.    place $i
1330: 6e 64 66 72 61 6d 65 20 2d 61 6e 63 68 6f 72 20  ndframe -anchor 
1340: 6e 65 20 2d 72 65 6c 78 20 31 20 2d 79 20 30 20  ne -relx 1 -y 0 
1350: 2d 72 65 6c 68 65 69 67 68 74 20 31 0a 20 20 20  -relheight 1.   
1360: 20 70 61 63 6b 20 20 24 70 72 67 66 72 61 6d 65   pack  $prgframe
1370: 20 2d 69 6e 20 24 69 6e 64 66 72 61 6d 65 20 2d   -in $indframe -
1380: 73 69 64 65 20 6c 65 66 74 20 2d 70 61 64 78 20  side left -padx 
1390: 32 0a 20 20 20 20 24 73 74 61 74 75 73 20 63 6f  2.    $status co
13a0: 6e 66 69 67 75 72 65 20 2d 68 65 69 67 68 74 20  nfigure -height 
13b0: 5b 77 69 6e 66 6f 20 72 65 71 68 65 69 67 68 74  [winfo reqheight
13c0: 20 24 6c 61 62 65 6c 5d 0a 0a 20 20 20 20 73 65   $label]..    se
13d0: 74 20 70 72 6f 67 72 65 73 73 20 5b 65 76 61 6c  t progress [eval
13e0: 20 5b 6c 69 73 74 20 50 72 6f 67 72 65 73 73 42   [list ProgressB
13f0: 61 72 3a 3a 63 72 65 61 74 65 20 24 73 74 61 74  ar::create $stat
1400: 75 73 2e 70 72 67 5d 20 5c 0a 09 09 20 20 20 20  us.prg] \...    
1410: 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67    [Widget::subcg
1420: 65 74 20 24 70 61 74 68 20 2e 73 74 61 74 75 73  et $path .status
1430: 2e 70 72 67 5d 20 5c 0a 20 20 20 20 20 20 20 20  .prg] \.        
1440: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 77                -w
1450: 69 64 74 68 20 20 20 20 20 20 20 35 30 20 5c 0a  idth       50 \.
1460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1470: 20 20 20 20 20 20 2d 68 65 69 67 68 74 20 20 20        -height   
1480: 20 20 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 6f     [expr {[winfo
1490: 20 72 65 71 68 65 69 67 68 74 20 24 6c 61 62 65   reqheight $labe
14a0: 6c 5d 2d 32 7d 5d 20 5c 0a 20 20 20 20 20 20 20  l]-2}] \.       
14b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
14c0: 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 5c 0a  borderwidth 1 \.
14d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
14e0: 20 20 20 20 20 20 2d 72 65 6c 69 65 66 20 20 20        -relief   
14f0: 20 20 20 73 75 6e 6b 65 6e 5d 0a 20 20 20 20 70     sunken].    p
1500: 61 63 6b 20 24 73 74 61 74 75 73 20 20 20 20 2d  ack $status    -
1510: 69 6e 20 24 62 6f 74 66 72 61 6d 65 20 2d 66 69  in $botframe -fi
1520: 6c 6c 20 78 20 2d 70 61 64 79 20 32 0a 20 20 20  ll x -pady 2.   
1530: 20 70 61 63 6b 20 24 62 6f 74 66 72 61 6d 65 20   pack $botframe 
1540: 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d 66   -side bottom -f
1550: 69 6c 6c 20 78 0a 20 20 20 20 70 61 63 6b 20 24  ill x.    pack $
1560: 75 73 65 72 66 72 61 6d 65 20 2d 66 69 6c 6c 20  userframe -fill 
1570: 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 65 73  both -expand yes
1580: 0a 0a 20 20 20 20 73 65 74 20 5f 77 69 64 67 65  ..    set _widge
1590: 74 28 24 70 61 74 68 2c 74 6f 70 29 20 20 20 20  t($path,top)    
15a0: 20 20 24 74 6f 70 0a 20 20 20 20 73 65 74 20 5f    $top.    set _
15b0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 74 6f  widget($path,nto
15c0: 6f 6c 62 61 72 29 20 30 0a 20 20 20 20 73 65 74  olbar) 0.    set
15d0: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e   _widget($path,n
15e0: 69 6e 64 69 63 29 20 20 20 30 0a 0a 20 20 20 20  indic)   0..    
15f0: 73 65 74 20 6d 65 6e 75 20 5b 57 69 64 67 65 74  set menu [Widget
1600: 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74  ::getoption $pat
1610: 68 20 2d 6d 65 6e 75 5d 0a 20 20 20 20 69 66 20  h -menu].    if 
1620: 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 6d 65 6e 75  { [llength $menu
1630: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 5f 63  ] } {.        _c
1640: 72 65 61 74 65 5f 6d 65 6e 75 62 61 72 20 24 70  reate_menubar $p
1650: 61 74 68 20 24 6d 65 6e 75 0a 20 20 20 20 7d 0a  ath $menu.    }.
1660: 0a 20 20 20 20 62 69 6e 64 20 24 70 61 74 68 20  .    bind $path 
1670: 3c 44 65 73 74 72 6f 79 3e 20 5b 6c 69 73 74 20  <Destroy> [list 
1680: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73 74  MainFrame::_dest
1690: 72 6f 79 20 25 57 5d 0a 0a 20 20 20 20 72 65 74  roy %W]..    ret
16a0: 75 72 6e 20 5b 57 69 64 67 65 74 3a 3a 63 72 65  urn [Widget::cre
16b0: 61 74 65 20 4d 61 69 6e 46 72 61 6d 65 20 24 70  ate MainFrame $p
16c0: 61 74 68 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  ath].}...# -----
16d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1710: 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
1720: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 6f  nd MainFrame::co
1730: 6e 66 69 67 75 72 65 0a 23 20 2d 2d 2d 2d 2d 2d  nfigure.# ------
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: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1780: 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e  ------.proc Main
1790: 46 72 61 6d 65 3a 3a 63 6f 6e 66 69 67 75 72 65  Frame::configure
17a0: 20 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b   { path args } {
17b0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77  .    variable _w
17c0: 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20 72  idget..    set r
17d0: 65 73 20 5b 57 69 64 67 65 74 3a 3a 63 6f 6e 66  es [Widget::conf
17e0: 69 67 75 72 65 20 24 70 61 74 68 20 24 61 72 67  igure $path $arg
17f0: 73 5d 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57 69  s]..    if { [Wi
1800: 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64  dget::hasChanged
1810: 20 24 70 61 74 68 20 2d 74 65 78 74 76 61 72 69   $path -textvari
1820: 61 62 6c 65 20 6e 65 77 76 5d 20 7d 20 7b 0a 20  able newv] } {. 
1830: 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 5c         uplevel \
1840: 23 30 20 24 70 61 74 68 2e 73 74 61 74 75 73 2e  #0 $path.status.
1850: 6c 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65 20  label configure 
1860: 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 5b 6c  -textvariable [l
1870: 69 73 74 20 24 6e 65 77 76 5d 0a 20 20 20 20 7d  ist $newv].    }
1880: 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57 69 64 67  ..    if { [Widg
1890: 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64 20 24  et::hasChanged $
18a0: 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75 6e 64  path -background
18b0: 20 62 67 5d 20 7d 20 7b 0a 09 69 66 20 7b 24 3a   bg] } {..if {$:
18c0: 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c  :tcl_platform(pl
18d0: 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78  atform) == "unix
18e0: 22 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6c 69  "} {..    set li
18f0: 73 74 6d 65 6e 75 20 5b 24 5f 77 69 64 67 65 74  stmenu [$_widget
1900: 28 24 70 61 74 68 2c 74 6f 70 29 20 63 67 65 74  ($path,top) cget
1910: 20 2d 6d 65 6e 75 5d 0a 09 20 20 20 20 77 68 69   -menu]..    whi
1920: 6c 65 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 6c  le { [llength $l
1930: 69 73 74 6d 65 6e 75 5d 20 7d 20 7b 0a 09 09 73  istmenu] } {...s
1940: 65 74 20 6e 65 77 6c 69 73 74 20 7b 7d 0a 09 09  et newlist {}...
1950: 66 6f 72 65 61 63 68 20 6d 65 6e 75 20 24 6c 69  foreach menu $li
1960: 73 74 6d 65 6e 75 20 7b 0a 09 09 20 20 20 20 24  stmenu {...    $
1970: 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 65 20 2d  menu configure -
1980: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 09  background $bg..
1990: 09 20 20 20 20 73 65 74 20 6e 65 77 6c 69 73 74  .    set newlist
19a0: 20 5b 63 6f 6e 63 61 74 20 24 6e 65 77 6c 69 73   [concat $newlis
19b0: 74 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65  t [winfo childre
19c0: 6e 20 24 6d 65 6e 75 5d 5d 0a 09 09 7d 0a 09 09  n $menu]]...}...
19d0: 73 65 74 20 6c 69 73 74 6d 65 6e 75 20 24 6e 65  set listmenu $ne
19e0: 77 6c 69 73 74 0a 09 20 20 20 20 7d 0a 09 7d 0a  wlist..    }..}.
19f0: 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20          foreach 
1a00: 73 65 70 20 7b 2e 73 65 70 20 2e 62 6f 74 66 2e  sep {.sep .botf.
1a10: 73 65 70 7d 20 7b 0a 20 20 20 20 20 20 20 20 20  sep} {.         
1a20: 20 20 20 69 66 20 7b 20 5b 77 69 6e 66 6f 20 65     if { [winfo e
1a30: 78 69 73 74 73 20 24 70 61 74 68 2e 24 73 65 70  xists $path.$sep
1a40: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
1a50: 20 20 20 20 20 20 53 65 70 61 72 61 74 6f 72 3a        Separator:
1a60: 3a 63 6f 6e 66 69 67 75 72 65 20 24 70 61 74 68  :configure $path
1a70: 2e 24 73 65 70 20 2d 62 61 63 6b 67 72 6f 75 6e  .$sep -backgroun
1a80: 64 20 24 62 67 0a 20 20 20 20 20 20 20 20 20 20  d $bg.          
1a90: 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20    }.        }.  
1aa0: 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 77 20        foreach w 
1ab0: 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e 20  [winfo children 
1ac0: 24 70 61 74 68 2e 74 6f 70 66 5d 20 7b 0a 20 20  $path.topf] {.  
1ad0: 20 20 20 20 20 20 20 20 20 20 24 77 20 63 6f 6e            $w con
1ae0: 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75  figure -backgrou
1af0: 6e 64 20 24 62 67 0a 20 20 20 20 20 20 20 20 7d  nd $bg.        }
1b00: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b  .    }..    if {
1b10: 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61   [Widget::hasCha
1b20: 6e 67 65 64 20 24 70 61 74 68 20 2d 6d 65 6e 75  nged $path -menu
1b30: 62 61 72 66 6f 6e 74 20 6e 65 77 6d 62 66 6e 74  barfont newmbfnt
1b40: 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72 69  ] } {..if {[stri
1b50: 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 6d 62  ng length $newmb
1b60: 66 6e 74 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74  fnt]} {..    set
1b70: 20 6d 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f   mbfnt [list -fo
1b80: 6e 74 20 24 6e 65 77 6d 62 66 6e 74 5d 0a 09 7d  nt $newmbfnt]..}
1b90: 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74   else {..    set
1ba0: 20 6d 62 66 6e 74 20 22 22 0a 09 7d 0a 09 73 65   mbfnt ""..}..se
1bb0: 74 20 74 6f 70 20 20 20 20 20 24 5f 77 69 64 67  t top     $_widg
1bc0: 65 74 28 24 70 61 74 68 2c 74 6f 70 29 0a 09 69  et($path,top)..i
1bd0: 66 20 7b 5b 73 74 72 69 6e 67 20 65 71 75 61 6c  f {[string equal
1be0: 20 24 74 6f 70 20 2e 5d 7d 20 7b 0a 09 20 20 20   $top .]} {..   
1bf0: 20 65 76 61 6c 20 5b 6c 69 73 74 20 2e 6d 65 6e   eval [list .men
1c00: 75 62 61 72 20 63 6f 6e 66 69 67 75 72 65 5d 20  ubar configure] 
1c10: 24 6d 62 66 6e 74 0a 09 7d 20 65 6c 73 65 20 7b  $mbfnt..} else {
1c20: 0a 09 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74  ..    eval [list
1c30: 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72 20 63 6f   $top.menubar co
1c40: 6e 66 69 67 75 72 65 5d 20 24 6d 62 66 6e 74 0a  nfigure] $mbfnt.
1c50: 09 7d 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20  .}.    }.    if 
1c60: 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68  { [Widget::hasCh
1c70: 61 6e 67 65 64 20 24 70 61 74 68 20 2d 6d 65 6e  anged $path -men
1c80: 75 65 6e 74 72 79 66 6f 6e 74 20 6e 65 77 6d 65  uentryfont newme
1c90: 66 6e 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73  fnt] } {..if {[s
1ca0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65  tring length $ne
1cb0: 77 6d 65 66 6e 74 5d 7d 20 7b 0a 09 20 20 20 20  wmefnt]} {..    
1cc0: 73 65 74 20 6d 65 66 6e 74 20 5b 6c 69 73 74 20  set mefnt [list 
1cd0: 2d 66 6f 6e 74 20 24 6e 65 77 6d 65 66 6e 74 5d  -font $newmefnt]
1ce0: 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20  ..} else {..    
1cf0: 73 65 74 20 6d 65 66 6e 74 20 22 22 0a 09 7d 0a  set mefnt ""..}.
1d00: 09 73 65 74 20 74 6f 70 20 20 20 20 20 24 5f 77  .set top     $_w
1d10: 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29  idget($path,top)
1d20: 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 65 71  ..if {[string eq
1d30: 75 61 6c 20 24 74 6f 70 20 2e 5d 7d 20 7b 0a 09  ual $top .]} {..
1d40: 20 20 20 20 73 65 74 20 6d 62 20 2e 6d 65 6e 75      set mb .menu
1d50: 62 61 72 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20  bar..} else {.. 
1d60: 20 20 20 73 65 74 20 6d 62 20 24 74 6f 70 2e 6d     set mb $top.m
1d70: 65 6e 75 62 61 72 0a 09 7d 0a 09 73 65 74 20 6c  enubar..}..set l
1d80: 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e   [winfo children
1d90: 20 24 6d 62 5d 0a 09 77 68 69 6c 65 20 7b 5b 6c   $mb]..while {[l
1da0: 6c 65 6e 67 74 68 20 24 6c 5d 7d 20 7b 0a 09 20  length $l]} {.. 
1db0: 20 20 20 73 65 74 20 65 20 5b 6c 69 6e 64 65 78     set e [lindex
1dc0: 20 24 6c 20 30 5d 0a 09 20 20 20 20 73 65 74 20   $l 0]..    set 
1dd0: 6c 20 5b 6c 72 61 6e 67 65 20 24 6c 20 31 20 65  l [lrange $l 1 e
1de0: 6e 64 5d 0a 09 20 20 20 20 69 66 20 7b 5b 73 74  nd]..    if {[st
1df0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 5d 20  ring length $e] 
1e00: 3d 3d 20 30 7d 20 7b 63 6f 6e 74 69 6e 75 65 7d  == 0} {continue}
1e10: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6c 20  ..    lappend l 
1e20: 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e 20  [winfo children 
1e30: 24 65 5d 0a 09 20 20 20 20 65 76 61 6c 20 5b 6c  $e]..    eval [l
1e40: 69 73 74 20 24 65 20 63 6f 6e 66 69 67 75 72 65  ist $e configure
1e50: 5d 20 24 6d 65 66 6e 74 0a 09 7d 0a 20 20 20 20  ] $mefnt..}.    
1e60: 7d 0a 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57 69  }...    if { [Wi
1e70: 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64  dget::hasChanged
1e80: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
1e90: 72 66 6f 6e 74 20 6e 65 77 73 62 66 6e 74 5d 20  rfont newsbfnt] 
1ea0: 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67  } {..if {[string
1eb0: 20 6c 65 6e 67 74 68 20 24 6e 65 77 73 62 66 6e   length $newsbfn
1ec0: 74 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 73  t]} {..    set s
1ed0: 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f 6e 74  bfnt [list -font
1ee0: 20 24 6e 65 77 73 62 66 6e 74 5d 0a 09 7d 20 65   $newsbfnt]..} e
1ef0: 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 73  lse {..    set s
1f00: 62 66 6e 74 20 22 22 0a 09 7d 0a 09 66 6f 72 20  bfnt ""..}..for 
1f10: 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24  {set index 0} {$
1f20: 69 6e 64 65 78 3c 24 5f 77 69 64 67 65 74 28 24  index<$_widget($
1f30: 70 61 74 68 2c 6e 69 6e 64 69 63 29 7d 20 7b 69  path,nindic)} {i
1f40: 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0a 09 20 20  ncr index} {..  
1f50: 20 20 73 65 74 20 69 6e 64 69 63 20 24 70 61 74    set indic $pat
1f60: 68 2e 73 74 61 74 75 73 2e 69 6e 64 66 2e 66 24  h.status.indf.f$
1f70: 69 6e 64 65 78 0a 09 20 20 20 20 65 76 61 6c 20  index..    eval 
1f80: 5b 6c 69 73 74 20 24 69 6e 64 69 63 20 63 6f 6e  [list $indic con
1f90: 66 69 67 75 72 65 5d 20 24 73 62 66 6e 74 0a 09  figure] $sbfnt..
1fa0: 7d 0a 09 65 76 61 6c 20 5b 6c 69 73 74 20 24 70  }..eval [list $p
1fb0: 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65 6c  ath.status.label
1fc0: 20 63 6f 6e 66 69 67 75 72 65 5d 20 24 73 62 66   configure] $sbf
1fd0: 6e 74 0a 09 24 70 61 74 68 2e 73 74 61 74 75 73  nt..$path.status
1fe0: 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 69 67   configure -heig
1ff0: 68 74 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 69  ht [winfo reqhei
2000: 67 68 74 20 24 70 61 74 68 2e 73 74 61 74 75 73  ght $path.status
2010: 2e 6c 61 62 65 6c 5d 0a 0a 09 24 70 61 74 68 2e  .label]...$path.
2020: 73 74 61 74 75 73 2e 70 72 67 20 63 6f 6e 66 69  status.prg confi
2030: 67 75 72 65 20 5c 0a 09 09 2d 68 65 69 67 68 74  gure \...-height
2040: 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 6f 20 72   [expr {[winfo r
2050: 65 71 68 65 69 67 68 74 20 24 70 61 74 68 2e 73  eqheight $path.s
2060: 74 61 74 75 73 2e 6c 61 62 65 6c 5d 2d 32 7d 5d  tatus.label]-2}]
2070: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75  .    }..    retu
2080: 72 6e 20 24 72 65 73 0a 7d 0a 0a 0a 23 20 2d 2d  rn $res.}...# --
2090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
20e0: 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a  mmand MainFrame:
20f0: 3a 63 67 65 74 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  :cget.# --------
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 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
2150: 61 6d 65 3a 3a 63 67 65 74 20 7b 20 70 61 74 68  ame::cget { path
2160: 20 6f 70 74 69 6f 6e 20 7d 20 7b 0a 20 20 20 20   option } {.    
2170: 72 65 74 75 72 6e 20 5b 57 69 64 67 65 74 3a 3a  return [Widget::
2180: 63 67 65 74 20 24 70 61 74 68 20 24 6f 70 74 69  cget $path $opti
2190: 6f 6e 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d  on].}...# ------
21a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21e0: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
21f0: 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74  d MainFrame::get
2200: 66 72 61 6d 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  frame.# --------
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 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
2260: 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 20 7b 20  ame::getframe { 
2270: 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 72 65 74  path } {.    ret
2280: 75 72 6e 20 24 70 61 74 68 2e 66 72 61 6d 65 0a  urn $path.frame.
2290: 7d 0a 0a 0a 23 20 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22e0: 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61  --.#  Command Ma
22f0: 69 6e 46 72 61 6d 65 3a 3a 61 64 64 74 6f 6f 6c  inFrame::addtool
2300: 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  bar.# ----------
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 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2360: 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 20 7b 20  e::addtoolbar { 
2370: 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 67 6c 6f  path } {.    glo
2380: 62 61 6c 20 20 20 74 63 6c 5f 70 6c 61 74 66 6f  bal   tcl_platfo
2390: 72 6d 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20  rm.    variable 
23a0: 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74  _widget..    set
23b0: 20 69 6e 64 65 78 20 20 20 20 20 24 5f 77 69 64   index     $_wid
23c0: 67 65 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c 62  get($path,ntoolb
23d0: 61 72 29 0a 20 20 20 20 73 65 74 20 74 6f 6f 6c  ar).    set tool
23e0: 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f 70 66  frame $path.topf
23f0: 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 73 65 74  .f$index.    set
2400: 20 74 6f 6f 6c 62 61 72 20 20 20 24 70 61 74 68   toolbar   $path
2410: 2e 74 6f 70 66 2e 74 62 24 69 6e 64 65 78 0a 20  .topf.tb$index. 
2420: 20 20 20 73 65 74 20 62 67 20 20 20 20 20 20 20     set bg       
2430: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
2440: 69 6f 6e 20 24 70 61 74 68 20 2d 62 61 63 6b 67  ion $path -backg
2450: 72 6f 75 6e 64 5d 0a 20 20 20 20 69 66 20 7b 20  round].    if { 
2460: 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c  $tcl_platform(pl
2470: 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78  atform) == "unix
2480: 22 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 66 72  " } {.        fr
2490: 61 6d 65 20 24 74 6f 6f 6c 66 72 61 6d 65 20 2d  ame $toolframe -
24a0: 72 65 6c 69 65 66 20 72 61 69 73 65 64 20 2d 62  relief raised -b
24b0: 6f 72 64 65 72 77 69 64 74 68 20 31 20 5c 0a 20  orderwidth 1 \. 
24c0: 20 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65             -take
24d0: 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67  focus 0 -highlig
24e0: 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62  htthickness 0 -b
24f0: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 20 20  ackground $bg.  
2500: 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20    } else {.     
2510: 20 20 20 66 72 61 6d 65 20 24 74 6f 6f 6c 66 72     frame $toolfr
2520: 61 6d 65 20 2d 72 65 6c 69 65 66 20 66 6c 61 74  ame -relief flat
2530: 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30 20   -borderwidth 0 
2540: 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 5c 0a 20  -takefocus 0 \. 
2550: 20 20 20 20 20 20 20 20 20 20 20 2d 68 69 67 68             -high
2560: 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30  lightthickness 0
2570: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
2580: 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 65 70  .        set sep
2590: 20 5b 53 65 70 61 72 61 74 6f 72 3a 3a 63 72 65   [Separator::cre
25a0: 61 74 65 20 24 74 6f 6f 6c 66 72 61 6d 65 2e 73  ate $toolframe.s
25b0: 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a  ep -orient horiz
25c0: 6f 6e 74 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e  ontal -backgroun
25d0: 64 20 24 62 67 5d 0a 20 20 20 20 20 20 20 20 70  d $bg].        p
25e0: 61 63 6b 20 24 73 65 70 20 2d 66 69 6c 6c 20 78  ack $sep -fill x
25f0: 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74 20 74  .    }.    set t
2600: 6f 6f 6c 62 61 72 20 5b 66 72 61 6d 65 20 24 74  oolbar [frame $t
2610: 6f 6f 6c 62 61 72 20 2d 72 65 6c 69 65 66 20 66  oolbar -relief f
2620: 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74 68  lat -borderwidth
2630: 20 32 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20   2 \.           
2640: 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65 66            -takef
2650: 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67 68  ocus 0 -highligh
2660: 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 61  tthickness 0 -ba
2670: 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20  ckground $bg].  
2680: 20 20 70 61 63 6b 20 24 74 6f 6f 6c 62 61 72 20    pack $toolbar 
2690: 2d 69 6e 20 24 74 6f 6f 6c 66 72 61 6d 65 20 2d  -in $toolframe -
26a0: 61 6e 63 68 6f 72 20 77 20 2d 65 78 70 61 6e 64  anchor w -expand
26b0: 20 79 65 73 20 2d 66 69 6c 6c 20 78 0a 20 20 20   yes -fill x.   
26c0: 20 69 6e 63 72 20 5f 77 69 64 67 65 74 28 24 70   incr _widget($p
26d0: 61 74 68 2c 6e 74 6f 6f 6c 62 61 72 29 0a 20 20  ath,ntoolbar).  
26e0: 20 20 67 72 69 64 20 24 74 6f 6f 6c 66 72 61 6d    grid $toolfram
26f0: 65 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 72 6f 77  e -column 0 -row
2700: 20 24 69 6e 64 65 78 20 2d 73 74 69 63 6b 79 20   $index -sticky 
2710: 65 77 0a 20 20 20 20 72 65 74 75 72 6e 20 24 74  ew.    return $t
2720: 6f 6f 6c 62 61 72 0a 7d 0a 0a 0a 23 20 2d 2d 2d  oolbar.}...# ---
2730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
2780: 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  mand MainFrame::
2790: 67 65 74 74 6f 6f 6c 62 61 72 0a 23 20 2d 2d 2d  gettoolbar.# ---
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 0a 70 72 6f 63 20 4d  ---------.proc M
27f0: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 74 6f 6f  ainFrame::gettoo
2800: 6c 62 61 72 20 7b 20 70 61 74 68 20 69 6e 64 65  lbar { path inde
2810: 78 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e  x } {.    return
2820: 20 24 70 61 74 68 2e 74 6f 70 66 2e 74 62 24 69   $path.topf.tb$i
2830: 6e 64 65 78 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  ndex.}...# -----
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 2d 2d  ----------------
2860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2880: 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
2890: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61 64  nd MainFrame::ad
28a0: 64 69 6e 64 69 63 61 74 6f 72 0a 23 20 2d 2d 2d  dindicator.# ---
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 0a 70 72 6f 63 20 4d  ---------.proc M
2900: 61 69 6e 46 72 61 6d 65 3a 3a 61 64 64 69 6e 64  ainFrame::addind
2910: 69 63 61 74 6f 72 20 7b 20 70 61 74 68 20 61 72  icator { path ar
2920: 67 73 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61  gs } {.    varia
2930: 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20  ble _widget..   
2940: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e   if {[string len
2950: 67 74 68 20 5b 57 69 64 67 65 74 3a 3a 67 65 74  gth [Widget::get
2960: 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74  option $path -st
2970: 61 74 75 73 62 61 72 66 6f 6e 74 5d 5d 7d 20 7b  atusbarfont]]} {
2980: 0a 09 73 65 74 20 73 62 66 6e 74 20 5b 6c 69 73  ..set sbfnt [lis
2990: 74 20 2d 66 6f 6e 74 20 5b 57 69 64 67 65 74 3a  t -font [Widget:
29a0: 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68  :getoption $path
29b0: 20 2d 73 74 61 74 75 73 62 61 72 66 6f 6e 74 5d   -statusbarfont]
29c0: 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  ].    } else {..
29d0: 73 65 74 20 73 62 66 6e 74 20 22 22 0a 20 20 20  set sbfnt "".   
29e0: 20 7d 0a 0a 20 20 20 20 73 65 74 20 69 6e 64 65   }..    set inde
29f0: 78 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68  x $_widget($path
2a00: 2c 6e 69 6e 64 69 63 29 0a 20 20 20 20 73 65 74  ,nindic).    set
2a10: 20 69 6e 64 69 63 20 24 70 61 74 68 2e 73 74 61   indic $path.sta
2a20: 74 75 73 2e 69 6e 64 66 2e 66 24 69 6e 64 65 78  tus.indf.f$index
2a30: 0a 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74 20  .    eval [list 
2a40: 6c 61 62 65 6c 20 24 69 6e 64 69 63 5d 20 24 61  label $indic] $a
2a50: 72 67 73 20 2d 72 65 6c 69 65 66 20 73 75 6e 6b  rgs -relief sunk
2a60: 65 6e 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20  en -borderwidth 
2a70: 31 20 5c 0a 20 20 20 20 20 20 20 20 2d 74 61 6b  1 \.        -tak
2a80: 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69  efocus 0 -highli
2a90: 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 24  ghtthickness 0 $
2aa0: 73 62 66 6e 74 0a 0a 20 20 20 20 70 61 63 6b 20  sbfnt..    pack 
2ab0: 24 69 6e 64 69 63 20 2d 73 69 64 65 20 6c 65 66  $indic -side lef
2ac0: 74 20 2d 61 6e 63 68 6f 72 20 77 20 2d 70 61 64  t -anchor w -pad
2ad0: 78 20 32 20 2d 66 69 6c 6c 20 79 20 2d 65 78 70  x 2 -fill y -exp
2ae0: 61 6e 64 20 31 0a 0a 20 20 20 20 69 6e 63 72 20  and 1..    incr 
2af0: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 69  _widget($path,ni
2b00: 6e 64 69 63 29 0a 0a 20 20 20 20 72 65 74 75 72  ndic)..    retur
2b10: 6e 20 24 69 6e 64 69 63 0a 7d 0a 0a 0a 23 20 2d  n $indic.}...# -
2b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
2b70: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
2b80: 3a 3a 67 65 74 69 6e 64 69 63 61 74 6f 72 0a 23  ::getindicator.#
2b90: 20 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 0a 70 72  -------------.pr
2be0: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65  oc MainFrame::ge
2bf0: 74 69 6e 64 69 63 61 74 6f 72 20 7b 20 70 61 74  tindicator { pat
2c00: 68 20 69 6e 64 65 78 20 7d 20 7b 0a 20 20 20 20  h index } {.    
2c10: 72 65 74 75 72 6e 20 24 70 61 74 68 2e 73 74 61  return $path.sta
2c20: 74 75 73 2e 69 6e 64 66 2e 66 24 69 6e 64 65 78  tus.indf.f$index
2c30: 0a 7d 0a 0a 0a 23 20 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c80: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
2c90: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65 6e  ainFrame::getmen
2ca0: 75 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  u.# ------------
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: 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a  .proc MainFrame:
2d00: 3a 67 65 74 6d 65 6e 75 20 7b 20 70 61 74 68 20  :getmenu { path 
2d10: 6d 65 6e 75 69 64 20 7d 20 7b 0a 20 20 20 20 76  menuid } {.    v
2d20: 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a  ariable _widget.
2d30: 0a 20 20 20 20 69 66 20 7b 20 5b 69 6e 66 6f 20  .    if { [info 
2d40: 65 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24  exists _widget($
2d50: 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e  path,menuid,$men
2d60: 75 69 64 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20  uid)] } {.      
2d70: 20 20 72 65 74 75 72 6e 20 24 5f 77 69 64 67 65    return $_widge
2d80: 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24  t($path,menuid,$
2d90: 6d 65 6e 75 69 64 29 0a 20 20 20 20 7d 0a 20 20  menuid).    }.  
2da0: 20 20 72 65 74 75 72 6e 20 22 22 0a 7d 0a 0a 0a    return "".}...
2db0: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
2dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
2e00: 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46  #  Command MainF
2e10: 72 61 6d 65 3a 3a 73 65 74 6d 65 6e 75 73 74 61  rame::setmenusta
2e20: 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  te.# -----------
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 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2e80: 65 3a 3a 73 65 74 6d 65 6e 75 73 74 61 74 65 20  e::setmenustate 
2e90: 7b 20 70 61 74 68 20 74 61 67 20 73 74 61 74 65  { path tag state
2ea0: 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c   } {.    variabl
2eb0: 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 23  e _widget..    #
2ec0: 20 20 20 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65      if { [info e
2ed0: 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70  xists _widget($p
2ee0: 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29 5d 20  ath,tags,$tag)] 
2ef0: 7d 20 7b 0a 20 20 20 20 23 20 20 20 20 20 20 20  } {.    #       
2f00: 20 66 6f 72 65 61 63 68 20 7b 6d 65 6e 75 20 65   foreach {menu e
2f10: 6e 74 72 79 7d 20 24 5f 77 69 64 67 65 74 28 24  ntry} $_widget($
2f20: 70 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20  path,tags,$tag) 
2f30: 7b 0a 20 20 20 20 23 20 20 20 20 20 20 20 20 20  {.    #         
2f40: 20 20 20 24 6d 65 6e 75 20 65 6e 74 72 79 63 6f     $menu entryco
2f50: 6e 66 69 67 75 72 65 20 24 65 6e 74 72 79 20 2d  nfigure $entry -
2f60: 73 74 61 74 65 20 24 73 74 61 74 65 0a 20 20 20  state $state.   
2f70: 20 23 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20   #        }.    
2f80: 23 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 57 65  #    }..    # We
2f90: 20 6e 65 65 64 20 61 20 6d 6f 72 65 20 73 6f 70   need a more sop
2fa0: 68 69 73 74 69 63 61 74 65 64 20 73 74 61 74 65  histicated state
2fb0: 20 73 79 73 74 65 6d 2e 0a 20 20 20 20 23 20 54   system..    # T
2fc0: 68 65 20 6f 72 69 67 69 6e 61 6c 20 6d 6f 64 65  he original mode
2fd0: 6c 20 77 61 73 20 74 68 69 73 3a 20 20 65 61 63  l was this:  eac
2fe0: 68 20 6d 65 6e 75 20 69 74 65 6d 20 68 61 73 20  h menu item has 
2ff0: 61 20 6c 69 73 74 20 6f 66 20 74 61 67 73 3b 0a  a list of tags;.
3000: 20 20 20 20 23 20 77 68 65 6e 65 76 65 72 20 61      # whenever a
3010: 6e 79 20 6f 6e 65 20 6f 66 20 74 68 6f 73 65 20  ny one of those 
3020: 74 61 67 73 20 63 68 61 6e 67 65 64 20 73 74 61  tags changed sta
3030: 74 65 2c 20 74 68 65 20 6d 65 6e 75 20 69 74 65  te, the menu ite
3040: 6d 20 64 69 64 20 74 6f 6f 2e 0a 20 20 20 20 23  m did too..    #
3050: 20 54 68 69 73 20 6d 61 6b 65 73 20 69 74 20 68   This makes it h
3060: 61 72 64 20 74 6f 20 68 61 76 65 20 69 74 65 6d  ard to have item
3070: 73 20 74 68 61 74 20 61 72 65 20 65 6e 61 62 6c  s that are enabl
3080: 65 64 20 6f 6e 6c 79 20 77 68 65 6e 20 62 6f 74  ed only when bot
3090: 68 20 74 61 67 41 20 61 6e 64 0a 20 20 20 20 23  h tagA and.    #
30a0: 20 74 61 67 42 20 61 72 65 2e 20 20 54 68 65 20   tagB are.  The 
30b0: 6e 65 77 20 6d 6f 64 65 6c 20 74 68 65 72 65 66  new model theref
30c0: 6f 72 65 20 6f 6e 6c 79 20 73 65 74 73 20 74 68  ore only sets th
30d0: 65 20 6d 65 6e 75 73 74 61 74 65 20 74 6f 20 65  e menustate to e
30e0: 6e 61 62 6c 65 64 0a 20 20 20 20 23 20 77 68 65  nabled.    # whe
30f0: 6e 20 41 4c 4c 20 6f 66 20 69 74 73 20 74 61 67  n ALL of its tag
3100: 73 20 61 72 65 20 65 6e 61 62 6c 65 64 2e 0a 0a  s are enabled...
3110: 20 20 20 20 23 20 46 69 72 73 74 20 73 65 65 20      # First see 
3120: 69 66 20 74 68 69 73 20 69 73 20 61 20 72 65 61  if this is a rea
3130: 6c 20 74 61 67 0a 20 20 20 20 69 66 20 7b 20 5b  l tag.    if { [
3140: 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64  info exists _wid
3150: 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74 61  get($path,tagsta
3160: 74 65 2c 24 74 61 67 29 5d 20 7d 20 7b 0a 09 69  te,$tag)] } {..i
3170: 66 20 7b 20 21 5b 73 74 72 69 6e 67 20 65 71 75  f { ![string equ
3180: 61 6c 20 24 73 74 61 74 65 20 22 64 69 73 61 62  al $state "disab
3190: 6c 65 64 22 5d 20 7d 20 7b 0a 09 20 20 20 20 73  led"] } {..    s
31a0: 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  et _widget($path
31b0: 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67 29 20  ,tagstate,$tag) 
31c0: 31 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20  1..} else {..   
31d0: 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61   set _widget($pa
31e0: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67  th,tagstate,$tag
31f0: 29 20 30 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20  ) 0..}..foreach 
3200: 7b 6d 65 6e 75 20 65 6e 74 72 79 7d 20 24 5f 77  {menu entry} $_w
3210: 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73  idget($path,tags
3220: 2c 24 74 61 67 29 20 7b 0a 09 20 20 20 20 73 65  ,$tag) {..    se
3230: 74 20 65 78 70 72 65 73 73 69 6f 6e 20 22 31 22  t expression "1"
3240: 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 6d 65  ..    foreach me
3250: 6e 75 74 61 67 20 24 5f 77 69 64 67 65 74 28 24  nutag $_widget($
3260: 70 61 74 68 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c  path,menutags,[l
3270: 69 73 74 20 24 6d 65 6e 75 20 24 65 6e 74 72 79  ist $menu $entry
3280: 5d 29 20 7b 0a 09 09 61 70 70 65 6e 64 20 65 78  ]) {...append ex
3290: 70 72 65 73 73 69 6f 6e 20 22 20 26 26 20 24 5f  pression " && $_
32a0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
32b0: 73 74 61 74 65 2c 24 6d 65 6e 75 74 61 67 29 22  state,$menutag)"
32c0: 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 69 66 20  ..    }..    if 
32d0: 7b 20 5b 65 78 70 72 20 24 65 78 70 72 65 73 73  { [expr $express
32e0: 69 6f 6e 5d 20 7d 20 7b 0a 09 09 73 65 74 20 73  ion] } {...set s
32f0: 74 61 74 65 20 6e 6f 72 6d 61 6c 0a 09 20 20 20  tate normal..   
3300: 20 7d 20 65 6c 73 65 20 7b 0a 09 09 73 65 74 20   } else {...set 
3310: 73 74 61 74 65 20 64 69 73 61 62 6c 65 64 0a 09  state disabled..
3320: 20 20 20 20 7d 0a 09 20 20 20 20 24 6d 65 6e 75      }..    $menu
3330: 20 65 6e 74 72 79 63 6f 6e 66 69 67 75 72 65 20   entryconfigure 
3340: 24 65 6e 74 72 79 20 2d 73 74 61 74 65 20 24 73  $entry -state $s
3350: 74 61 74 65 0a 09 7d 0a 20 20 20 20 7d 0a 20 20  tate..}.    }.  
3360: 20 20 72 65 74 75 72 6e 0a 7d 0a 0a 0a 23 20 2d    return.}...# -
3370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
33c0: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
33d0: 65 3a 3a 6d 65 6e 75 6f 6e 6c 79 0a 23 20 2d 2d  e::menuonly.# --
33e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33f0: 2d 2d 2d 2d 64 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----d-----------
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 0a 70 72 6f 63  -----------.proc
3430: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75   MainFrame::menu
3440: 6f 6e 6c 79 20 7b 20 70 61 74 68 20 7d 20 7b 0a  only { path } {.
3450: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69      variable _wi
3460: 64 67 65 74 0a 0a 20 20 20 20 63 61 74 63 68 20  dget..    catch 
3470: 7b 70 61 63 6b 20 66 6f 72 67 65 74 20 24 70 61  {pack forget $pa
3480: 74 68 2e 73 65 70 7d 0a 20 20 20 20 63 61 74 63  th.sep}.    catc
3490: 68 20 7b 70 61 63 6b 20 66 6f 72 67 65 74 20 24  h {pack forget $
34a0: 70 61 74 68 2e 62 6f 74 66 2e 73 65 70 7d 0a 20  path.botf.sep}. 
34b0: 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66     catch {pack f
34c0: 6f 72 67 65 74 20 24 70 61 74 68 2e 66 72 61 6d  orget $path.fram
34d0: 65 7d 0a 7d 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  e}.}..# --------
34e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3520: 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
3530: 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 74  MainFrame::showt
3540: 6f 6f 6c 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d  oolbar.# -------
3550: 2d 2d 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 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
35a0: 72 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61  rame::showtoolba
35b0: 72 20 7b 20 70 61 74 68 20 69 6e 64 65 78 20 62  r { path index b
35c0: 6f 6f 6c 20 7d 20 7b 0a 20 20 20 20 76 61 72 69  ool } {.    vari
35d0: 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20  able _widget..  
35e0: 20 20 73 65 74 20 74 6f 6f 6c 66 72 61 6d 65 20    set toolframe 
35f0: 24 70 61 74 68 2e 74 6f 70 66 2e 66 24 69 6e 64  $path.topf.f$ind
3600: 65 78 0a 20 20 20 20 69 66 20 7b 20 5b 77 69 6e  ex.    if { [win
3610: 66 6f 20 65 78 69 73 74 73 20 24 74 6f 6f 6c 66  fo exists $toolf
3620: 72 61 6d 65 5d 20 7d 20 7b 0a 20 20 20 20 20 20  rame] } {.      
3630: 20 20 69 66 20 7b 20 21 24 62 6f 6f 6c 20 26 26    if { !$bool &&
3640: 20 5b 6c 6c 65 6e 67 74 68 20 5b 67 72 69 64 20   [llength [grid 
3650: 69 6e 66 6f 20 24 74 6f 6f 6c 66 72 61 6d 65 5d  info $toolframe]
3660: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
3670: 20 20 67 72 69 64 20 66 6f 72 67 65 74 20 24 74    grid forget $t
3680: 6f 6f 6c 66 72 61 6d 65 0a 20 20 20 20 20 20 20  oolframe.       
3690: 20 20 20 20 20 24 70 61 74 68 2e 74 6f 70 66 20       $path.topf 
36a0: 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 69 67 68  configure -heigh
36b0: 74 20 31 0a 20 20 20 20 20 20 20 20 7d 20 65 6c  t 1.        } el
36c0: 73 65 69 66 20 7b 20 24 62 6f 6f 6c 20 26 26 20  seif { $bool && 
36d0: 21 5b 6c 6c 65 6e 67 74 68 20 5b 67 72 69 64 20  ![llength [grid 
36e0: 69 6e 66 6f 20 24 74 6f 6f 6c 66 72 61 6d 65 5d  info $toolframe]
36f0: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
3700: 20 20 67 72 69 64 20 24 74 6f 6f 6c 66 72 61 6d    grid $toolfram
3710: 65 20 2d 63 6f 6c 75 6d 6e 20 30 20 2d 72 6f 77  e -column 0 -row
3720: 20 24 69 6e 64 65 78 20 2d 73 74 69 63 6b 79 20   $index -sticky 
3730: 65 77 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20  ew.        }.   
3740: 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d   }.}...# -------
3750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3790: 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
37a0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77   MainFrame::show
37b0: 73 74 61 74 75 73 62 61 72 0a 23 20 2d 2d 2d 2d  statusbar.# ----
37c0: 2d 2d 2d 2d 2d 2d 2d 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 0a 70 72 6f 63 20 4d 61  --------.proc Ma
3810: 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 73 74 61  inFrame::showsta
3820: 74 75 73 62 61 72 20 7b 20 70 61 74 68 20 6e 61  tusbar { path na
3830: 6d 65 20 7d 20 7b 0a 20 20 20 20 73 65 74 20 73  me } {.    set s
3840: 74 61 74 75 73 20 24 70 61 74 68 2e 73 74 61 74  tatus $path.stat
3850: 75 73 0a 20 20 20 20 69 66 20 7b 20 5b 73 74 72  us.    if { [str
3860: 69 6e 67 20 65 71 75 61 6c 20 24 6e 61 6d 65 20  ing equal $name 
3870: 22 6e 6f 6e 65 22 5d 20 7d 20 7b 0a 20 20 20 20  "none"] } {.    
3880: 20 20 20 20 70 61 63 6b 20 66 6f 72 67 65 74 20      pack forget 
3890: 24 73 74 61 74 75 73 0a 20 20 20 20 7d 20 65 6c  $status.    } el
38a0: 73 65 20 7b 0a 20 20 20 20 20 20 20 20 70 61 63  se {.        pac
38b0: 6b 20 24 73 74 61 74 75 73 20 2d 66 69 6c 6c 20  k $status -fill 
38c0: 78 0a 20 20 20 20 20 20 20 20 73 77 69 74 63 68  x.        switch
38d0: 20 2d 2d 20 24 6e 61 6d 65 20 7b 0a 20 20 20 20   -- $name {.    
38e0: 20 20 20 20 20 20 20 20 73 74 61 74 75 73 20 7b          status {
38f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
3900: 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66 6f 72   catch {pack for
3910: 67 65 74 20 24 73 74 61 74 75 73 2e 70 72 67 7d  get $status.prg}
3920: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20  .            }. 
3930: 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 67 72             progr
3940: 65 73 73 69 6f 6e 20 7b 0a 20 20 20 20 20 20 20  ession {.       
3950: 20 20 20 20 20 20 20 20 20 70 61 63 6b 20 24 73           pack $s
3960: 74 61 74 75 73 2e 70 72 67 20 2d 69 6e 20 24 73  tatus.prg -in $s
3970: 74 61 74 75 73 2e 70 72 67 66 0a 20 20 20 20 20  tatus.prgf.     
3980: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20         }.       
3990: 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d   }.    }.}...# -
39a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
39f0: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
3a00: 3a 3a 5f 64 65 73 74 72 6f 79 0a 23 20 2d 2d 2d  ::_destroy.# ---
3a10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a20: 2d 2d 2d 2d 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 0a 70 72 6f 63 20 4d  ---------.proc M
3a60: 61 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73 74 72  ainFrame::_destr
3a70: 6f 79 20 7b 20 70 61 74 68 20 7d 20 7b 0a 20 20  oy { path } {.  
3a80: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
3a90: 65 74 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a  et..    Widget::
3aa0: 64 65 73 74 72 6f 79 20 24 70 61 74 68 0a 20 20  destroy $path.  
3ab0: 20 20 63 61 74 63 68 20 7b 64 65 73 74 72 6f 79    catch {destroy
3ac0: 20 5b 24 5f 77 69 64 67 65 74 28 24 70 61 74 68   [$_widget($path
3ad0: 2c 74 6f 70 29 20 63 67 65 74 20 2d 6d 65 6e 75  ,top) cget -menu
3ae0: 5d 7d 0a 20 20 20 20 24 5f 77 69 64 67 65 74 28  ]}.    $_widget(
3af0: 24 70 61 74 68 2c 74 6f 70 29 20 63 6f 6e 66 69  $path,top) confi
3b00: 67 75 72 65 20 2d 6d 65 6e 75 20 7b 7d 0a 0a 20  gure -menu {}.. 
3b10: 20 20 20 23 20 55 6e 73 65 74 20 61 6c 6c 20 6f     # Unset all o
3b20: 66 20 74 68 65 20 73 74 61 74 65 20 76 61 72 73  f the state vars
3b30: 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68   associated with
3b40: 20 74 68 69 73 20 6d 61 69 6e 20 66 72 61 6d 65   this main frame
3b50: 2e 0a 20 20 20 20 66 6f 72 65 61 63 68 20 69 6e  ..    foreach in
3b60: 64 65 78 20 5b 61 72 72 61 79 20 6e 61 6d 65 73  dex [array names
3b70: 20 5f 77 69 64 67 65 74 20 24 70 61 74 68 2c 2a   _widget $path,*
3b80: 5d 20 7b 0a 09 75 6e 73 65 74 20 5f 77 69 64 67  ] {..unset _widg
3b90: 65 74 28 24 69 6e 64 65 78 29 0a 20 20 20 20 7d  et($index).    }
3ba0: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
3bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bf0: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
3c00: 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74  ainFrame::_creat
3c10: 65 5f 6d 65 6e 75 62 61 72 0a 23 20 2d 2d 2d 2d  e_menubar.# ----
3c20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c40: 2d 2d 2d 2d 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 0a 70 72 6f 63 20 4d 61  --------.proc Ma
3c70: 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65  inFrame::_create
3c80: 5f 6d 65 6e 75 62 61 72 20 7b 20 70 61 74 68 20  _menubar { path 
3c90: 64 65 73 63 6d 65 6e 75 20 7d 20 7b 0a 20 20 20  descmenu } {.   
3ca0: 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65   variable _widge
3cb0: 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 20 20 20  t.    global    
3cc0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 0a 0a 20 20  tcl_platform..  
3cd0: 20 20 73 65 74 20 74 6f 70 20 24 5f 77 69 64 67    set top $_widg
3ce0: 65 74 28 24 70 61 74 68 2c 74 6f 70 29 0a 0a 20  et($path,top).. 
3cf0: 20 20 20 66 6f 72 65 61 63 68 20 7b 76 20 78 7d     foreach {v x}
3d00: 20 7b 6d 62 66 6e 74 20 2d 6d 65 6e 75 62 61 72   {mbfnt -menubar
3d10: 66 6f 6e 74 20 6d 65 66 6e 74 20 2d 6d 65 6e 75  font mefnt -menu
3d20: 65 6e 74 72 79 66 6f 6e 74 7d 20 7b 0a 09 69 66  entryfont} {..if
3d30: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   {[string length
3d40: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
3d50: 69 6f 6e 20 24 70 61 74 68 20 24 78 5d 5d 7d 20  ion $path $x]]} 
3d60: 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20 5b 6c  {..    set $v [l
3d70: 69 73 74 20 2d 66 6f 6e 74 20 5b 57 69 64 67 65  ist -font [Widge
3d80: 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61  t::getoption $pa
3d90: 74 68 20 24 78 5d 5d 0a 09 7d 20 65 6c 73 65 20  th $x]]..} else 
3da0: 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20 22 22  {..    set $v ""
3db0: 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69  ..}.    }..    i
3dc0: 66 20 7b 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d  f {$tcl_platform
3dd0: 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75  (platform) == "u
3de0: 6e 69 78 22 7d 20 7b 0a 09 73 65 74 20 6d 65 6e  nix"} {..set men
3df0: 75 6f 70 74 73 20 5b 6c 69 73 74 20 2d 62 61 63  uopts [list -bac
3e00: 6b 67 72 6f 75 6e 64 20 5b 57 69 64 67 65 74 3a  kground [Widget:
3e10: 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68  :getoption $path
3e20: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 5d 20 5c 0a   -background] \.
3e30: 09 09 09 20 20 2d 62 6f 72 64 65 72 77 69 64 74  ...  -borderwidt
3e40: 68 20 31 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20  h 1].    } else 
3e50: 7b 0a 09 73 65 74 20 6d 65 6e 75 6f 70 74 73 20  {..set menuopts 
3e60: 5b 6c 69 73 74 5d 0a 20 20 20 20 7d 0a 20 20 20  [list].    }.   
3e70: 20 73 65 74 20 6d 65 6e 75 62 61 72 20 5b 65 76   set menubar [ev
3e80: 61 6c 20 5b 6c 69 73 74 20 6d 65 6e 75 20 24 74  al [list menu $t
3e90: 6f 70 2e 6d 65 6e 75 62 61 72 20 2d 74 65 61 72  op.menubar -tear
3ea0: 6f 66 66 20 30 5d 20 24 6d 65 6e 75 6f 70 74 73  off 0] $menuopts
3eb0: 20 24 6d 62 66 6e 74 5d 0a 20 20 20 20 24 74 6f   $mbfnt].    $to
3ec0: 70 20 63 6f 6e 66 69 67 75 72 65 20 2d 6d 65 6e  p configure -men
3ed0: 75 20 24 6d 65 6e 75 62 61 72 0a 0a 20 20 20 20  u $menubar..    
3ee0: 73 65 74 20 63 6f 75 6e 74 20 30 0a 20 20 20 20  set count 0.    
3ef0: 66 6f 72 65 61 63 68 20 7b 6e 61 6d 65 20 74 61  foreach {name ta
3f00: 67 73 20 6d 65 6e 75 69 64 20 74 65 61 72 6f 66  gs menuid tearof
3f10: 66 20 65 6e 74 72 69 65 73 7d 20 24 64 65 73 63  f entries} $desc
3f20: 6d 65 6e 75 20 7b 0a 20 20 20 20 20 20 20 20 73  menu {.        s
3f30: 65 74 20 6f 70 74 20 20 5b 5f 70 61 72 73 65 5f  et opt  [_parse_
3f40: 6e 61 6d 65 20 24 6e 61 6d 65 5d 0a 20 20 20 20  name $name].    
3f50: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20      if {[string 
3f60: 6c 65 6e 67 74 68 20 24 6d 65 6e 75 69 64 5d 0a  length $menuid].
3f70: 09 20 20 20 20 26 26 20 21 5b 69 6e 66 6f 20 65  .    && ![info e
3f80: 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70  xists _widget($p
3f90: 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75  ath,menuid,$menu
3fa0: 69 64 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  id)] } {.       
3fb0: 20 20 20 20 20 23 20 6d 65 6e 75 20 68 61 73 20       # menu has 
3fc0: 69 64 65 6e 74 69 66 69 65 72 0a 09 20 20 20 20  identifier..    
3fd0: 23 20 77 65 20 75 73 65 20 69 74 20 66 6f 72 20  # we use it for 
3fe0: 69 74 73 20 70 61 74 68 6e 61 6d 65 2c 20 74 6f  its pathname, to
3ff0: 20 65 6e 61 62 6c 65 20 73 70 65 63 69 61 6c 20   enable special 
4000: 6d 65 6e 75 20 65 6e 74 72 69 65 73 0a 09 20 20  menu entries..  
4010: 20 20 23 20 28 68 65 6c 70 2c 20 73 79 73 74 65    # (help, syste
4020: 6d 2c 20 2e 2e 2e 29 0a 09 20 20 20 20 73 65 74  m, ...)..    set
4030: 20 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 2e 24   menu $menubar.$
4040: 6d 65 6e 75 69 64 0a 20 20 20 20 20 20 20 20 7d  menuid.        }
4050: 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74   else {..    set
4060: 20 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 2e 6d   menu $menubar.m
4070: 65 6e 75 24 63 6f 75 6e 74 0a 09 7d 0a 20 20 20  enu$count..}.   
4080: 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74 20       eval [list 
4090: 24 6d 65 6e 75 62 61 72 20 61 64 64 20 63 61 73  $menubar add cas
40a0: 63 61 64 65 5d 20 24 6f 70 74 20 5b 6c 69 73 74  cade] $opt [list
40b0: 20 2d 6d 65 6e 75 20 24 6d 65 6e 75 5d 0a 20 20   -menu $menu].  
40c0: 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74        eval [list
40d0: 20 6d 65 6e 75 20 24 6d 65 6e 75 20 2d 74 65 61   menu $menu -tea
40e0: 72 6f 66 66 20 24 74 65 61 72 6f 66 66 5d 20 24  roff $tearoff] $
40f0: 6d 65 6e 75 6f 70 74 73 20 24 6d 65 66 6e 74 0a  menuopts $mefnt.
4100: 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20          foreach 
4110: 74 61 67 20 24 74 61 67 73 20 7b 0a 20 20 20 20  tag $tags {.    
4120: 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20          lappend 
4130: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61  _widget($path,ta
4140: 67 73 2c 24 74 61 67 29 20 24 6d 65 6e 75 62 61  gs,$tag) $menuba
4150: 72 20 24 63 6f 75 6e 74 0a 09 20 20 20 20 23 20  r $count..    # 
4160: 65 72 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a  [email protected]:
4170: 20 20 41 64 64 20 61 20 74 61 67 73 74 61 74 65    Add a tagstate
4180: 20 74 72 61 63 6b 65 72 0a 09 20 20 20 20 69 66   tracker..    if
4190: 20 7b 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 73   { ![info exists
41a0: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74   _widget($path,t
41b0: 61 67 73 74 61 74 65 2c 24 74 61 67 29 5d 20 7d  agstate,$tag)] }
41c0: 20 7b 0a 09 09 73 65 74 20 5f 77 69 64 67 65 74   {...set _widget
41d0: 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c  ($path,tagstate,
41e0: 24 74 61 67 29 20 31 0a 09 20 20 20 20 7d 0a 20  $tag) 1..    }. 
41f0: 20 20 20 20 20 20 20 7d 0a 09 23 20 65 72 69 63         }..# eric
4200: 6d 40 73 63 72 69 70 74 69 63 73 3a 20 20 41 64  [email protected]:  Ad
4210: 64 20 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20 6d  d mapping from m
4220: 65 6e 75 20 69 74 65 6d 73 20 74 6f 20 74 61 67  enu items to tag
4230: 73 0a 09 73 65 74 20 5f 77 69 64 67 65 74 28 24  s..set _widget($
4240: 70 61 74 68 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c  path,menutags,[l
4250: 69 73 74 20 24 6d 65 6e 75 62 61 72 20 24 63 6f  ist $menubar $co
4260: 75 6e 74 5d 29 20 24 74 61 67 73 0a 0a 20 20 20  unt]) $tags..   
4270: 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69 6e       if { [strin
4280: 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75 69 64  g length $menuid
4290: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
42a0: 20 20 23 20 6d 65 6e 75 20 68 61 73 20 69 64 65    # menu has ide
42b0: 6e 74 69 66 69 65 72 0a 20 20 20 20 20 20 20 20  ntifier.        
42c0: 20 20 20 20 73 65 74 20 5f 77 69 64 67 65 74 28      set _widget(
42d0: 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65  $path,menuid,$me
42e0: 6e 75 69 64 29 20 24 6d 65 6e 75 0a 20 20 20 20  nuid) $menu.    
42f0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 5f 63      }.        _c
4300: 72 65 61 74 65 5f 65 6e 74 72 69 65 73 20 24 70  reate_entries $p
4310: 61 74 68 20 24 6d 65 6e 75 20 24 6d 65 6e 75 6f  ath $menu $menuo
4320: 70 74 73 20 24 65 6e 74 72 69 65 73 0a 20 20 20  pts $entries.   
4330: 20 20 20 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a       incr count.
4340: 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d      }.}...# ----
4350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4390: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
43a0: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f  and MainFrame::_
43b0: 63 72 65 61 74 65 5f 65 6e 74 72 69 65 73 0a 23  create_entries.#
43c0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
43d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
4410: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63  oc MainFrame::_c
4420: 72 65 61 74 65 5f 65 6e 74 72 69 65 73 20 7b 20  reate_entries { 
4430: 70 61 74 68 20 6d 65 6e 75 20 6d 65 6e 75 6f 70  path menu menuop
4440: 74 73 20 65 6e 74 72 69 65 73 20 7d 20 7b 0a 20  ts entries } {. 
4450: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
4460: 67 65 74 0a 0a 20 20 20 20 73 65 74 20 63 6f 75  get..    set cou
4470: 6e 74 20 20 20 20 20 20 5b 24 6d 65 6e 75 20 63  nt      [$menu c
4480: 67 65 74 20 2d 74 65 61 72 6f 66 66 5d 0a 20 20  get -tearoff].  
4490: 20 20 73 65 74 20 72 65 67 69 73 74 65 72 65 64    set registered
44a0: 20 30 0a 20 20 20 20 66 6f 72 65 61 63 68 20 65   0.    foreach e
44b0: 6e 74 72 79 20 24 65 6e 74 72 69 65 73 20 7b 0a  ntry $entries {.
44c0: 20 20 20 20 20 20 20 20 73 65 74 20 6c 65 6e 20          set len 
44d0: 20 5b 6c 6c 65 6e 67 74 68 20 24 65 6e 74 72 79   [llength $entry
44e0: 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 79  ].        set ty
44f0: 70 65 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72  pe [lindex $entr
4500: 79 20 30 5d 0a 0a 20 20 20 20 20 20 20 20 69 66  y 0]..        if
4510: 20 7b 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c   { [string equal
4520: 20 24 74 79 70 65 20 22 73 65 70 61 72 61 74 6f   $type "separato
4530: 72 22 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  r"] } {.        
4540: 20 20 20 20 24 6d 65 6e 75 20 61 64 64 20 73 65      $menu add se
4550: 70 61 72 61 74 6f 72 0a 20 20 20 20 20 20 20 20  parator.        
4560: 20 20 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20      incr count. 
4570: 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 74 69             conti
4580: 6e 75 65 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20  nue.        }.. 
4590: 20 20 20 20 20 20 20 23 20 65 6e 74 72 79 20 6e         # entry n
45a0: 61 6d 65 20 61 6e 64 20 74 61 67 73 0a 20 20 20  ame and tags.   
45b0: 20 20 20 20 20 73 65 74 20 6f 70 74 20 20 5b 5f       set opt  [_
45c0: 70 61 72 73 65 5f 6e 61 6d 65 20 5b 6c 69 6e 64  parse_name [lind
45d0: 65 78 20 24 65 6e 74 72 79 20 31 5d 5d 0a 20 20  ex $entry 1]].  
45e0: 20 20 20 20 20 20 73 65 74 20 74 61 67 73 20 5b        set tags [
45f0: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 32 5d  lindex $entry 2]
4600: 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68  .        foreach
4610: 20 74 61 67 20 24 74 61 67 73 20 7b 0a 20 20 20   tag $tags {.   
4620: 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64           lappend
4630: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74   _widget($path,t
4640: 61 67 73 2c 24 74 61 67 29 20 24 6d 65 6e 75 20  ags,$tag) $menu 
4650: 24 63 6f 75 6e 74 0a 09 20 20 20 20 23 20 65 72  $count..    # er
4660: 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a 20 20  [email protected]:  
4670: 41 64 64 20 61 20 74 61 67 73 74 61 74 65 20 74  Add a tagstate t
4680: 72 61 63 6b 65 72 0a 09 20 20 20 20 69 66 20 7b  racker..    if {
4690: 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 5f   ![info exists _
46a0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
46b0: 73 74 61 74 65 2c 24 74 61 67 29 5d 20 7d 20 7b  state,$tag)] } {
46c0: 0a 09 09 73 65 74 20 5f 77 69 64 67 65 74 28 24  ...set _widget($
46d0: 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74  path,tagstate,$t
46e0: 61 67 29 20 31 0a 09 20 20 20 20 7d 0a 20 20 20  ag) 1..    }.   
46f0: 20 20 20 20 20 7d 0a 09 23 20 65 72 69 63 6d 40       }..# [email protected]
4700: 73 63 72 69 70 74 69 63 73 3a 20 20 41 64 64 20  scriptics:  Add 
4710: 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20 6d 65 6e  mapping from men
4720: 75 20 69 74 65 6d 73 20 74 6f 20 74 61 67 73 0a  u items to tags.
4730: 09 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61  .set _widget($pa
4740: 74 68 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c 69 73  th,menutags,[lis
4750: 74 20 24 6d 65 6e 75 20 24 63 6f 75 6e 74 5d 29  t $menu $count])
4760: 20 24 74 61 67 73 0a 0a 20 20 20 20 20 20 20 20   $tags..        
4770: 69 66 20 7b 5b 73 74 72 69 6e 67 20 65 71 75 61  if {[string equa
4780: 6c 20 24 74 79 70 65 20 22 63 61 73 63 61 64 65  l $type "cascade
4790: 22 5d 20 7c 7c 20 5b 73 74 72 69 6e 67 20 65 71  "] || [string eq
47a0: 75 61 6c 20 24 74 79 70 65 20 22 63 61 73 63 61  ual $type "casca
47b0: 64 22 5d 7d 20 7b 0a 20 20 20 20 20 20 20 20 20  d"]} {.         
47c0: 20 20 20 73 65 74 20 6d 65 6e 75 69 64 20 20 5b     set menuid  [
47d0: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 33 5d  lindex $entry 3]
47e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74  .            set
47f0: 20 74 65 61 72 6f 66 66 20 5b 6c 69 6e 64 65 78   tearoff [lindex
4800: 20 24 65 6e 74 72 79 20 34 5d 0a 20 20 20 20 20   $entry 4].     
4810: 20 20 20 20 20 20 20 73 65 74 20 73 75 62 6d 65         set subme
4820: 6e 75 20 24 6d 65 6e 75 2e 6d 65 6e 75 24 63 6f  nu $menu.menu$co
4830: 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20  unt.            
4840: 65 76 61 6c 20 5b 6c 69 73 74 20 24 6d 65 6e 75  eval [list $menu
4850: 20 61 64 64 20 63 61 73 63 61 64 65 5d 20 24 6f   add cascade] $o
4860: 70 74 20 5b 6c 69 73 74 20 2d 6d 65 6e 75 20 24  pt [list -menu $
4870: 73 75 62 6d 65 6e 75 5d 0a 20 20 20 20 20 20 20  submenu].       
4880: 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74 20       eval [list 
4890: 6d 65 6e 75 20 24 73 75 62 6d 65 6e 75 20 2d 74  menu $submenu -t
48a0: 65 61 72 6f 66 66 20 24 74 65 61 72 6f 66 66 5d  earoff $tearoff]
48b0: 20 24 6d 65 6e 75 6f 70 74 73 0a 20 20 20 20 20   $menuopts.     
48c0: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72         if { [str
48d0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75  ing length $menu
48e0: 69 64 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  id] } {.        
48f0: 20 20 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68          # menu h
4900: 61 73 20 69 64 65 6e 74 69 66 69 65 72 0a 20 20  as identifier.  
4910: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65                se
4920: 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c  t _widget($path,
4930: 6d 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 20  menuid,$menuid) 
4940: 24 73 75 62 6d 65 6e 75 0a 20 20 20 20 20 20 20  $submenu.       
4950: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20       }.         
4960: 20 20 20 5f 63 72 65 61 74 65 5f 65 6e 74 72 69     _create_entri
4970: 65 73 20 24 70 61 74 68 20 24 73 75 62 6d 65 6e  es $path $submen
4980: 75 20 24 6d 65 6e 75 6f 70 74 73 20 5b 6c 69 6e  u $menuopts [lin
4990: 64 65 78 20 24 65 6e 74 72 79 20 35 5d 0a 20 20  dex $entry 5].  
49a0: 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 63            incr c
49b0: 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20  ount.           
49c0: 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20   continue.      
49d0: 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 65    }..        # e
49e0: 6e 74 72 79 20 68 65 6c 70 20 64 65 73 63 72 69  ntry help descri
49f0: 70 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 73 65  ption.        se
4a00: 74 20 64 65 73 63 20 5b 6c 69 6e 64 65 78 20 24  t desc [lindex $
4a10: 65 6e 74 72 79 20 33 5d 0a 20 20 20 20 20 20 20  entry 3].       
4a20: 20 69 66 20 7b 20 5b 73 74 72 69 6e 67 20 6c 65   if { [string le
4a30: 6e 67 74 68 20 24 64 65 73 63 5d 20 7d 20 7b 0a  ngth $desc] } {.
4a40: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b              if {
4a50: 20 21 24 72 65 67 69 73 74 65 72 65 64 20 7d 20   !$registered } 
4a60: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  {.              
4a70: 20 20 44 79 6e 61 6d 69 63 48 65 6c 70 3a 3a 72    DynamicHelp::r
4a80: 65 67 69 73 74 65 72 20 24 6d 65 6e 75 20 6d 65  egister $menu me
4a90: 6e 75 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f  nu [Widget::geto
4aa0: 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 74 65 78  ption $path -tex
4ab0: 74 76 61 72 69 61 62 6c 65 5d 0a 20 20 20 20 20  tvariable].     
4ac0: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 72             set r
4ad0: 65 67 69 73 74 65 72 65 64 20 31 0a 20 20 20 20  egistered 1.    
4ae0: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20          }.      
4af0: 20 20 20 20 20 20 44 79 6e 61 6d 69 63 48 65 6c        DynamicHel
4b00: 70 3a 3a 72 65 67 69 73 74 65 72 20 24 6d 65 6e  p::register $men
4b10: 75 20 6d 65 6e 75 65 6e 74 72 79 20 24 63 6f 75  u menuentry $cou
4b20: 6e 74 20 24 64 65 73 63 0a 20 20 20 20 20 20 20  nt $desc.       
4b30: 20 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 65 6e   }..        # en
4b40: 74 72 79 20 61 63 63 65 6c 65 72 61 74 6f 72 0a  try accelerator.
4b50: 20 20 20 20 20 20 20 20 73 65 74 20 61 63 63 65          set acce
4b60: 6c 20 5b 5f 70 61 72 73 65 5f 61 63 63 65 6c 65  l [_parse_accele
4b70: 72 61 74 6f 72 20 5b 6c 69 6e 64 65 78 20 24 65  rator [lindex $e
4b80: 6e 74 72 79 20 34 5d 5d 0a 20 20 20 20 20 20 20  ntry 4]].       
4b90: 20 69 66 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24   if { [llength $
4ba0: 61 63 63 65 6c 5d 20 7d 20 7b 0a 20 20 20 20 20  accel] } {.     
4bb0: 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 6f         lappend o
4bc0: 70 74 20 2d 61 63 63 65 6c 65 72 61 74 6f 72 20  pt -accelerator 
4bd0: 5b 6c 69 6e 64 65 78 20 24 61 63 63 65 6c 20 30  [lindex $accel 0
4be0: 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 69  ].            bi
4bf0: 6e 64 20 24 5f 77 69 64 67 65 74 28 24 70 61 74  nd $_widget($pat
4c00: 68 2c 74 6f 70 29 20 5b 6c 69 6e 64 65 78 20 24  h,top) [lindex $
4c10: 61 63 63 65 6c 20 31 5d 20 5b 6c 69 73 74 20 24  accel 1] [list $
4c20: 6d 65 6e 75 20 69 6e 76 6f 6b 65 20 24 63 6f 75  menu invoke $cou
4c30: 6e 74 5d 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20  nt].        }.. 
4c40: 20 20 20 20 20 20 20 23 20 75 73 65 72 20 6f 70         # user op
4c50: 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 73 65  tions.        se
4c60: 74 20 75 73 65 72 6f 70 74 20 5b 6c 72 61 6e 67  t useropt [lrang
4c70: 65 20 24 65 6e 74 72 79 20 35 20 65 6e 64 5d 0a  e $entry 5 end].
4c80: 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74          if { [st
4c90: 72 69 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65  ring equal $type
4ca0: 20 22 63 6f 6d 6d 61 6e 64 22 5d 20 7c 7c 0a 20   "command"] ||. 
4cb0: 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72              [str
4cc0: 69 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65 20  ing equal $type 
4cd0: 22 72 61 64 69 6f 62 75 74 74 6f 6e 22 5d 20 7c  "radiobutton"] |
4ce0: 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 5b  |.             [
4cf0: 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 74 79  string equal $ty
4d00: 70 65 20 22 63 68 65 63 6b 62 75 74 74 6f 6e 22  pe "checkbutton"
4d10: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
4d20: 20 20 65 76 61 6c 20 5b 6c 69 73 74 20 24 6d 65    eval [list $me
4d30: 6e 75 20 61 64 64 20 24 74 79 70 65 5d 20 24 6f  nu add $type] $o
4d40: 70 74 20 24 75 73 65 72 6f 70 74 0a 20 20 20 20  pt $useropt.    
4d50: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20      } else {.   
4d60: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20           return 
4d70: 2d 63 6f 64 65 20 65 72 72 6f 72 20 22 69 6e 76  -code error "inv
4d80: 61 6c 69 64 20 6d 65 6e 75 20 74 79 70 65 20 5c  alid menu type \
4d90: 22 24 74 79 70 65 5c 22 22 0a 20 20 20 20 20 20  "$type\"".      
4da0: 20 20 7d 0a 20 20 20 20 20 20 20 20 69 6e 63 72    }.        incr
4db0: 20 63 6f 75 6e 74 0a 20 20 20 20 7d 0a 7d 0a 0a   count.    }.}..
4dc0: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
4dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
4e10: 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46  #  Command MainF
4e20: 72 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 6e 61 6d  rame::_parse_nam
4e30: 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  e.# ------------
4e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 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: 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a  .proc MainFrame:
4e90: 3a 5f 70 61 72 73 65 5f 6e 61 6d 65 20 7b 20 6d  :_parse_name { m
4ea0: 65 6e 75 6e 61 6d 65 20 7d 20 7b 0a 20 20 20 20  enuname } {.    
4eb0: 73 65 74 20 69 64 78 20 5b 73 74 72 69 6e 67 20  set idx [string 
4ec0: 66 69 72 73 74 20 22 26 22 20 24 6d 65 6e 75 6e  first "&" $menun
4ed0: 61 6d 65 5d 0a 20 20 20 20 69 66 20 7b 20 24 69  ame].    if { $i
4ee0: 64 78 20 3d 3d 20 2d 31 20 7d 20 7b 0a 20 20 20  dx == -1 } {.   
4ef0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73       return [lis
4f00: 74 20 2d 6c 61 62 65 6c 20 24 6d 65 6e 75 6e 61  t -label $menuna
4f10: 6d 65 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b  me].    } else {
4f20: 0a 20 20 20 20 20 20 20 20 73 65 74 20 62 65 67  .        set beg
4f30: 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24   [string range $
4f40: 6d 65 6e 75 6e 61 6d 65 20 30 20 5b 65 78 70 72  menuname 0 [expr
4f50: 20 7b 24 69 64 78 2d 31 7d 5d 5d 0a 20 20 20 20   {$idx-1}]].    
4f60: 20 20 20 20 73 65 74 20 65 6e 64 20 5b 73 74 72      set end [str
4f70: 69 6e 67 20 72 61 6e 67 65 20 24 6d 65 6e 75 6e  ing range $menun
4f80: 61 6d 65 20 5b 65 78 70 72 20 7b 24 69 64 78 2b  ame [expr {$idx+
4f90: 31 7d 5d 20 65 6e 64 5d 0a 20 20 20 20 20 20 20  1}] end].       
4fa0: 20 61 70 70 65 6e 64 20 62 65 67 20 24 65 6e 64   append beg $end
4fb0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20  .        return 
4fc0: 5b 6c 69 73 74 20 2d 6c 61 62 65 6c 20 24 62 65  [list -label $be
4fd0: 67 20 2d 75 6e 64 65 72 6c 69 6e 65 20 24 69 64  g -underline $id
4fe0: 78 5d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 4d  x].    }.}...# M
4ff0: 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65  ainFrame::_parse
5000: 5f 61 63 63 65 6c 65 72 61 74 6f 72 20 2d 2d 0a  _accelerator --.
5010: 23 0a 23 09 47 69 76 65 6e 20 61 20 6b 65 79 20  #.#.Given a key 
5020: 63 6f 6d 62 6f 20 64 65 73 63 72 69 70 74 69 6f  combo descriptio
5030: 6e 2c 20 63 6f 6e 73 74 72 75 63 74 20 61 6e 20  n, construct an 
5040: 61 70 70 72 6f 70 72 69 61 74 65 20 68 75 6d 61  appropriate huma
5050: 6e 20 72 65 61 64 61 62 6c 65 0a 23 09 73 74 72  n readable.#.str
5060: 69 6e 67 20 28 66 6f 72 20 64 69 73 70 6c 61 79  ing (for display
5070: 20 6f 6e 20 61 73 20 61 20 6d 65 6e 75 20 61 63   on as a menu ac
5080: 63 65 6c 65 72 61 74 6f 72 29 20 61 6e 64 20 74  celerator) and t
5090: 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67  he corresponding
50a0: 0a 23 09 62 69 6e 64 20 65 76 65 6e 74 2e 0a 23  .#.bind event..#
50b0: 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23 09  .# Arguments:.#.
50c0: 64 65 73 63 09 61 20 6c 69 73 74 20 77 69 74 68  desc.a list with
50d0: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66   the following f
50e0: 6f 72 6d 61 74 3a 0a 23 09 09 09 3f 73 65 71 75  ormat:.#...?sequ
50f0: 65 6e 63 65 3f 20 6b 65 79 0a 23 09 09 73 65 71  ence? key.#..seq
5100: 75 65 6e 63 65 20 6d 61 79 20 62 65 20 4e 6f 6e  uence may be Non
5110: 65 2c 20 43 74 72 6c 2c 20 41 6c 74 2c 20 6f 72  e, Ctrl, Alt, or
5120: 20 43 74 72 6c 41 6c 74 0a 23 09 09 6b 65 79 20   CtrlAlt.#..key 
5130: 6d 61 79 20 62 65 20 61 6e 79 20 6b 65 79 0a 23  may be any key.#
5140: 0a 23 20 52 65 73 75 6c 74 73 3a 0a 23 09 7b 61  .# Results:.#.{a
5150: 63 63 65 6c 20 65 76 65 6e 74 7d 09 61 20 6c 69  ccel event}.a li
5160: 73 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68  st containing th
5170: 65 20 61 63 63 65 6c 65 72 61 74 6f 72 20 73 74  e accelerator st
5180: 72 69 6e 67 20 61 6e 64 20 74 68 65 20 65 76 65  ring and the eve
5190: 6e 74 0a 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  nt..proc MainFra
51a0: 6d 65 3a 3a 5f 70 61 72 73 65 5f 61 63 63 65 6c  me::_parse_accel
51b0: 65 72 61 74 6f 72 20 7b 20 64 65 73 63 20 7d 20  erator { desc } 
51c0: 7b 0a 20 20 20 20 69 66 20 7b 20 5b 6c 6c 65 6e  {.    if { [llen
51d0: 67 74 68 20 24 64 65 73 63 5d 20 3d 3d 20 31 20  gth $desc] == 1 
51e0: 7d 20 7b 0a 09 73 65 74 20 73 65 71 20 4e 6f 6e  } {..set seq Non
51f0: 65 0a 09 73 65 74 20 6b 65 79 20 5b 73 74 72 69  e..set key [stri
5200: 6e 67 20 74 6f 6c 6f 77 65 72 20 5b 6c 69 6e 64  ng tolower [lind
5210: 65 78 20 24 64 65 73 63 20 30 5d 5d 0a 09 23 20  ex $desc 0]]..# 
5220: 49 66 20 74 68 65 20 6b 65 79 20 69 73 20 61 6e  If the key is an
5230: 20 46 20 6b 65 79 20 28 69 65 2c 20 46 31 2c 20   F key (ie, F1, 
5240: 46 32 2c 20 65 74 63 29 2c 20 69 74 20 68 61 73  F2, etc), it has
5250: 20 74 6f 20 62 65 20 63 61 70 69 74 61 6c 69 7a   to be capitaliz
5260: 65 64 0a 09 69 66 20 7b 5b 72 65 67 65 78 70 20  ed..if {[regexp 
5270: 7b 66 31 3f 5b 30 2d 39 5d 7d 20 24 6b 65 79 5d  {f1?[0-9]} $key]
5280: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6b 65 79  } {..    set key
5290: 20 5b 73 74 72 69 6e 67 20 74 6f 75 70 70 65 72   [string toupper
52a0: 20 24 6b 65 79 5d 0a 09 7d 0a 20 20 20 20 7d 20   $key]..}.    } 
52b0: 65 6c 73 65 69 66 20 7b 20 5b 6c 6c 65 6e 67 74  elseif { [llengt
52c0: 68 20 24 64 65 73 63 5d 20 3d 3d 20 32 20 7d 20  h $desc] == 2 } 
52d0: 7b 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 65  {.        set se
52e0: 71 20 5b 6c 69 6e 64 65 78 20 24 64 65 73 63 20  q [lindex $desc 
52f0: 30 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6b  0].        set k
5300: 65 79 20 5b 73 74 72 69 6e 67 20 74 6f 6c 6f 77  ey [string tolow
5310: 65 72 20 5b 6c 69 6e 64 65 78 20 24 64 65 73 63  er [lindex $desc
5320: 20 31 5d 5d 0a 09 23 20 49 66 20 74 68 65 20 6b   1]]..# If the k
5330: 65 79 20 69 73 20 61 6e 20 46 20 6b 65 79 20 28  ey is an F key (
5340: 69 65 2c 20 46 31 2c 20 46 32 2c 20 65 74 63 29  ie, F1, F2, etc)
5350: 2c 20 69 74 20 68 61 73 20 74 6f 20 62 65 20 63  , it has to be c
5360: 61 70 69 74 61 6c 69 7a 65 64 0a 09 69 66 20 7b  apitalized..if {
5370: 5b 72 65 67 65 78 70 20 7b 66 31 3f 5b 30 2d 39  [regexp {f1?[0-9
5380: 5d 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20 20  ]} $key]} {..   
5390: 20 73 65 74 20 6b 65 79 20 5b 73 74 72 69 6e 67   set key [string
53a0: 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a 09   toupper $key]..
53b0: 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  }.    } else {..
53c0: 72 65 74 75 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a  return {}.    }.
53d0: 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 24 73      switch -- $s
53e0: 65 71 20 7b 0a 09 4e 6f 6e 65 20 7b 0a 09 20 20  eq {..None {..  
53f0: 20 20 73 65 74 20 61 63 63 65 6c 20 22 5b 73 74    set accel "[st
5400: 72 69 6e 67 20 74 6f 75 70 70 65 72 20 24 6b 65  ring toupper $ke
5410: 79 5d 22 0a 09 20 20 20 20 73 65 74 20 65 76 65  y]"..    set eve
5420: 6e 74 20 22 3c 4b 65 79 2d 24 6b 65 79 3e 22 0a  nt "<Key-$key>".
5430: 09 7d 0a 09 43 74 72 6c 20 7b 0a 09 20 20 20 20  .}..Ctrl {..    
5440: 73 65 74 20 61 63 63 65 6c 20 22 43 74 72 6c 2b  set accel "Ctrl+
5450: 5b 73 74 72 69 6e 67 20 74 6f 75 70 70 65 72 20  [string toupper 
5460: 24 6b 65 79 5d 22 0a 09 20 20 20 20 73 65 74 20  $key]"..    set 
5470: 65 76 65 6e 74 20 22 3c 43 6f 6e 74 72 6f 6c 2d  event "<Control-
5480: 4b 65 79 2d 24 6b 65 79 3e 22 0a 09 7d 0a 09 41  Key-$key>"..}..A
5490: 6c 74 20 7b 0a 09 20 20 20 20 73 65 74 20 61 63  lt {..    set ac
54a0: 63 65 6c 20 22 41 6c 74 2b 5b 73 74 72 69 6e 67  cel "Alt+[string
54b0: 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a   toupper $key]".
54c0: 09 20 20 20 20 73 65 74 20 65 76 65 6e 74 20 22  .    set event "
54d0: 3c 41 6c 74 2d 4b 65 79 2d 24 6b 65 79 3e 22 0a  <Alt-Key-$key>".
54e0: 09 7d 0a 09 43 74 72 6c 41 6c 74 20 7b 0a 09 20  .}..CtrlAlt {.. 
54f0: 20 20 20 73 65 74 20 61 63 63 65 6c 20 22 43 74     set accel "Ct
5500: 72 6c 2b 41 6c 74 2b 5b 73 74 72 69 6e 67 20 74  rl+Alt+[string t
5510: 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a 09 20  oupper $key]".. 
5520: 20 20 20 73 65 74 20 65 76 65 6e 74 20 22 3c 43     set event "<C
5530: 6f 6e 74 72 6f 6c 2d 41 6c 74 2d 4b 65 79 2d 24  ontrol-Alt-Key-$
5540: 6b 65 79 3e 22 0a 09 7d 0a 09 64 65 66 61 75 6c  key>"..}..defaul
5550: 74 20 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20  t {..    return 
5560: 2d 63 6f 64 65 20 65 72 72 6f 72 20 22 69 6e 76  -code error "inv
5570: 61 6c 69 64 20 61 63 63 65 6c 65 72 61 74 6f 72  alid accelerator
5580: 20 63 6f 64 65 20 24 73 65 71 22 0a 09 7d 0a 20   code $seq"..}. 
5590: 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20     }.    return 
55a0: 5b 6c 69 73 74 20 24 61 63 63 65 6c 20 24 65 76  [list $accel $ev
55b0: 65 6e 74 5d 0a 7d 0a                             ent].}.