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 85aaa24c2417ee8c9997e191c867b44714dc2a0ac098a9798b1085eeb2b59f09:


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 32 34 2e 32 2e 33 20  .tcl,v 1.24.2.3 
00b0: 32 30 31 31 2f 30 35 2f 32 35 20 31 35 3a 31 30  2011/05/25 15:10
00c0: 3a 30 37 20 6f 65 68 68 61 72 20 45 78 70 20 24  :07 oehhar Exp $
00d0: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0120: 2d 0a 23 20 20 49 6e 64 65 78 20 6f 66 20 63 6f  -.#  Index of co
0130: 6d 6d 61 6e 64 73 3a 0a 23 20 20 20 20 20 2d 20  mmands:.#     - 
0140: 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74  MainFrame::creat
0150: 65 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  e.#     - MainFr
0160: 61 6d 65 3a 3a 63 6f 6e 66 69 67 75 72 65 0a 23  ame::configure.#
0170: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
0180: 3a 3a 63 67 65 74 0a 23 20 20 20 20 20 2d 20 4d  ::cget.#     - M
0190: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 66 72 61  ainFrame::getfra
01a0: 6d 65 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46  me.#     - MainF
01b0: 72 61 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72  rame::addtoolbar
01c0: 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61  .#     - MainFra
01d0: 6d 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 0a 23  me::gettoolbar.#
01e0: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
01f0: 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f 72 0a 23  ::addindicator.#
0200: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
0210: 3a 3a 67 65 74 69 6e 64 69 63 61 74 6f 72 0a 23  ::getindicator.#
0220: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
0230: 3a 3a 67 65 74 6d 65 6e 75 0a 23 20 20 20 20 20  ::getmenu.#     
0240: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e  - MainFrame::men
0250: 75 6f 6e 6c 79 0a 23 20 20 20 20 20 2d 20 4d 61  uonly.#     - Ma
0260: 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f  inFrame::showtoo
0270: 6c 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69  lbar.#     - Mai
0280: 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 73 74 61 74  nFrame::showstat
0290: 75 73 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61  usbar.#     - Ma
02a0: 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65  inFrame::_create
02b0: 5f 6d 65 6e 75 62 61 72 0a 23 20 20 20 20 20 2d  _menubar.#     -
02c0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65   MainFrame::_cre
02d0: 61 74 65 5f 65 6e 74 72 69 65 73 0a 23 20 20 20  ate_entries.#   
02e0: 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f    - MainFrame::_
02f0: 70 61 72 73 65 5f 6e 61 6d 65 0a 23 20 20 20 20  parse_name.#    
0300: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70   - MainFrame::_p
0310: 61 72 73 65 5f 61 63 63 65 6c 65 72 61 74 6f 72  arse_accelerator
0320: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
0330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
0370: 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20  .namespace eval 
0380: 4d 61 69 6e 46 72 61 6d 65 20 7b 0a 20 20 20 20  MainFrame {.    
0390: 57 69 64 67 65 74 3a 3a 64 65 66 69 6e 65 20 4d  Widget::define M
03a0: 61 69 6e 46 72 61 6d 65 20 6d 61 69 6e 66 72 61  ainFrame mainfra
03b0: 6d 65 20 50 72 6f 67 72 65 73 73 42 61 72 0a 0a  me ProgressBar..
03c0: 20 20 20 20 57 69 64 67 65 74 3a 3a 62 77 69 6e      Widget::bwin
03d0: 63 6c 75 64 65 20 4d 61 69 6e 46 72 61 6d 65 20  clude MainFrame 
03e0: 50 72 6f 67 72 65 73 73 42 61 72 20 2e 73 74 61  ProgressBar .sta
03f0: 74 75 73 2e 70 72 67 20 5c 0a 09 20 20 20 20 72  tus.prg \..    r
0400: 65 6d 6f 76 65 20 7b 0a 09 2d 66 67 20 2d 62 67  emove {..-fg -bg
0410: 20 2d 62 64 20 2d 74 72 6f 75 67 68 63 6f 6c 6f   -bd -troughcolo
0420: 72 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 2d 62  r -background -b
0430: 6f 72 64 65 72 77 69 64 74 68 0a 09 2d 72 65 6c  orderwidth..-rel
0440: 69 65 66 20 2d 6f 72 69 65 6e 74 20 2d 77 69 64  ief -orient -wid
0450: 74 68 20 2d 68 65 69 67 68 74 0a 20 20 20 20 7d  th -height.    }
0460: 20 5c 0a 09 20 20 20 20 72 65 6e 61 6d 65 20 7b   \..    rename {
0470: 0a 09 2d 6d 61 78 69 6d 75 6d 20 20 20 20 2d 70  ..-maximum    -p
0480: 72 6f 67 72 65 73 73 6d 61 78 0a 09 2d 76 61 72  rogressmax..-var
0490: 69 61 62 6c 65 20 20 20 2d 70 72 6f 67 72 65 73  iable   -progres
04a0: 73 76 61 72 0a 09 2d 74 79 70 65 20 20 20 20 20  svar..-type     
04b0: 20 20 2d 70 72 6f 67 72 65 73 73 74 79 70 65 0a    -progresstype.
04c0: 09 2d 66 6f 72 65 67 72 6f 75 6e 64 20 2d 70 72  .-foreground -pr
04d0: 6f 67 72 65 73 73 66 67 0a 20 20 20 20 7d 0a 0a  ogressfg.    }..
04e0: 20 20 20 20 69 66 20 7b 5b 57 69 64 67 65 74 3a      if {[Widget:
04f0: 3a 74 68 65 6d 65 5d 7d 20 7b 0a 20 20 20 20 20  :theme]} {.     
0500: 20 20 20 23 20 4e 6f 20 6f 70 74 69 6f 6e 20 2d     # No option -
0510: 62 61 63 6b 67 72 6f 75 6e 64 20 66 6f 72 20 74  background for t
0520: 68 65 6d 65 64 20 4d 61 69 6e 46 72 61 6d 65 0a  hemed MainFrame.
0530: 20 20 20 20 20 20 20 20 57 69 64 67 65 74 3a 3a          Widget::
0540: 64 65 63 6c 61 72 65 20 4d 61 69 6e 46 72 61 6d  declare MainFram
0550: 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  e {.            
0560: 7b 2d 77 69 64 74 68 20 20 20 20 20 20 20 20 20  {-width         
0570: 54 6b 52 65 73 6f 75 72 63 65 20 30 20 20 20 20  TkResource 0    
0580: 20 20 30 20 66 72 61 6d 65 7d 0a 20 20 20 20 20    0 frame}.     
0590: 20 20 20 20 20 20 20 7b 2d 68 65 69 67 68 74 20         {-height 
05a0: 20 20 20 20 20 20 20 54 6b 52 65 73 6f 75 72 63         TkResourc
05b0: 65 20 30 20 20 20 20 20 20 30 20 66 72 61 6d 65  e 0      0 frame
05c0: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
05d0: 74 65 78 74 76 61 72 69 61 62 6c 65 20 20 53 74  textvariable  St
05e0: 72 69 6e 67 20 20 20 20 20 22 22 20 20 20 20 20  ring     ""     
05f0: 30 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b  0}.            {
0600: 2d 6d 65 6e 75 20 20 20 20 20 20 20 20 20 20 53  -menu          S
0610: 74 72 69 6e 67 20 20 20 20 20 7b 7d 20 20 20 20  tring     {}    
0620: 20 31 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20   1}.            
0630: 7b 2d 73 65 70 61 72 61 74 6f 72 20 20 20 20 20  {-separator     
0640: 45 6e 75 6d 20 20 20 20 20 20 20 62 6f 74 68 20  Enum       both 
0650: 20 20 31 20 7b 6e 6f 6e 65 20 74 6f 70 20 62 6f    1 {none top bo
0660: 74 74 6f 6d 20 62 6f 74 68 7d 7d 0a 0a 20 20 20  ttom both}}..   
0670: 20 20 20 20 20 20 20 20 20 7b 2d 6d 65 6e 75 62           {-menub
0680: 61 72 66 6f 6e 74 20 20 20 53 74 72 69 6e 67 20  arfont   String 
0690: 20 20 20 20 22 22 20 20 30 7d 0a 20 20 20 20 20      ""  0}.     
06a0: 20 20 20 20 20 20 20 7b 2d 6d 65 6e 75 65 6e 74         {-menuent
06b0: 72 79 66 6f 6e 74 20 53 74 72 69 6e 67 20 20 20  ryfont String   
06c0: 20 20 22 22 20 20 30 7d 0a 20 20 20 20 20 20 20    ""  0}.       
06d0: 20 20 20 20 20 7b 2d 73 74 61 74 75 73 62 61 72       {-statusbar
06e0: 66 6f 6e 74 20 53 74 72 69 6e 67 20 20 20 20 20  font String     
06f0: 22 22 20 20 30 7d 0a 20 20 20 20 20 20 20 20 20  ""  0}.         
0700: 20 20 20 7b 2d 73 69 7a 65 67 72 69 70 20 20 20     {-sizegrip   
0710: 20 20 20 42 6f 6f 6c 65 61 6e 20 20 20 20 30 20     Boolean    0 
0720: 20 20 31 7d 0a 20 20 20 20 20 20 20 20 7d 0a 0a    1}.        }..
0730: 20 20 20 20 20 20 20 20 57 69 64 67 65 74 3a 3a          Widget::
0740: 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65  addmap MainFrame
0750: 20 22 22 20 2e 66 72 61 6d 65 20 20 7b 2d 77 69   "" .frame  {-wi
0760: 64 74 68 20 7b 7d 20 2d 68 65 69 67 68 74 20 7b  dth {} -height {
0770: 7d 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  }}.    } else {.
0780: 20 20 20 20 20 20 20 20 57 69 64 67 65 74 3a 3a          Widget::
0790: 64 65 63 6c 61 72 65 20 4d 61 69 6e 46 72 61 6d  declare MainFram
07a0: 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  e {.            
07b0: 7b 2d 77 69 64 74 68 20 20 20 20 20 20 20 20 20  {-width         
07c0: 54 6b 52 65 73 6f 75 72 63 65 20 30 20 20 20 20  TkResource 0    
07d0: 20 20 30 20 66 72 61 6d 65 7d 0a 20 20 20 20 20    0 frame}.     
07e0: 20 20 20 20 20 20 20 7b 2d 68 65 69 67 68 74 20         {-height 
07f0: 20 20 20 20 20 20 20 54 6b 52 65 73 6f 75 72 63         TkResourc
0800: 65 20 30 20 20 20 20 20 20 30 20 66 72 61 6d 65  e 0      0 frame
0810: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0820: 62 61 63 6b 67 72 6f 75 6e 64 20 20 20 20 54 6b  background    Tk
0830: 52 65 73 6f 75 72 63 65 20 22 22 20 20 20 20 20  Resource ""     
0840: 30 20 66 72 61 6d 65 7d 0a 20 20 20 20 20 20 20  0 frame}.       
0850: 20 20 20 20 20 7b 2d 74 65 78 74 76 61 72 69 61       {-textvaria
0860: 62 6c 65 20 20 53 74 72 69 6e 67 20 20 20 20 20  ble  String     
0870: 22 22 20 20 20 20 20 30 7d 0a 20 20 20 20 20 20  ""     0}.      
0880: 20 20 20 20 20 20 7b 2d 6d 65 6e 75 20 20 20 20        {-menu    
0890: 20 20 20 20 20 20 53 74 72 69 6e 67 20 20 20 20        String    
08a0: 20 7b 7d 20 20 20 20 20 31 7d 0a 20 20 20 20 20   {}     1}.     
08b0: 20 20 20 20 20 20 20 7b 2d 73 65 70 61 72 61 74         {-separat
08c0: 6f 72 20 20 20 20 20 45 6e 75 6d 20 20 20 20 20  or     Enum     
08d0: 20 20 62 6f 74 68 20 20 20 31 20 7b 6e 6f 6e 65    both   1 {none
08e0: 20 74 6f 70 20 62 6f 74 74 6f 6d 20 62 6f 74 68   top bottom both
08f0: 7d 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b  }}.            {
0900: 2d 62 67 20 20 20 20 20 20 20 20 20 20 20 20 53  -bg            S
0910: 79 6e 6f 6e 79 6d 20 20 20 20 2d 62 61 63 6b 67  ynonym    -backg
0920: 72 6f 75 6e 64 7d 0a 0a 20 20 20 20 20 20 20 20  round}..        
0930: 20 20 20 20 7b 2d 6d 65 6e 75 62 61 72 66 6f 6e      {-menubarfon
0940: 74 20 20 20 53 74 72 69 6e 67 20 20 20 20 20 22  t   String     "
0950: 22 20 20 30 7d 0a 20 20 20 20 20 20 20 20 20 20  "  0}.          
0960: 20 20 7b 2d 6d 65 6e 75 65 6e 74 72 79 66 6f 6e    {-menuentryfon
0970: 74 20 53 74 72 69 6e 67 20 20 20 20 20 22 22 20  t String     "" 
0980: 20 30 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20   0}.            
0990: 7b 2d 73 74 61 74 75 73 62 61 72 66 6f 6e 74 20  {-statusbarfont 
09a0: 53 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 30  String     ""  0
09b0: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
09c0: 73 69 7a 65 67 72 69 70 20 20 20 20 20 20 42 6f  sizegrip      Bo
09d0: 6f 6c 65 61 6e 20 20 20 20 30 20 20 20 31 7d 0a  olean    0   1}.
09e0: 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20          }..     
09f0: 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61     Widget::addma
0a00: 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e  p MainFrame "" .
0a10: 66 72 61 6d 65 20 20 7b 2d 77 69 64 74 68 20 7b  frame  {-width {
0a20: 7d 20 2d 68 65 69 67 68 74 20 7b 7d 20 2d 62 61  } -height {} -ba
0a30: 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20  ckground {}}.   
0a40: 20 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64       Widget::add
0a50: 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22  map MainFrame ""
0a60: 20 2e 74 6f 70 66 20 20 20 7b 2d 62 61 63 6b 67   .topf   {-backg
0a70: 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 20 20  round {}}.      
0a80: 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70    Widget::addmap
0a90: 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 62   MainFrame "" .b
0aa0: 6f 74 66 20 20 20 7b 2d 62 61 63 6b 67 72 6f 75  otf   {-backgrou
0ab0: 6e 64 20 7b 7d 7d 0a 20 20 20 20 20 20 20 20 57  nd {}}.        W
0ac0: 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61  idget::addmap Ma
0ad0: 69 6e 46 72 61 6d 65 20 22 22 20 2e 73 74 61 74  inFrame "" .stat
0ae0: 75 73 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20  us {-background 
0af0: 7b 7d 7d 0a 20 20 20 20 20 20 20 20 57 69 64 67  {}}.        Widg
0b00: 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46  et::addmap MainF
0b10: 72 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e  rame "" .status.
0b20: 6c 61 62 65 6c 20 7b 2d 62 61 63 6b 67 72 6f 75  label {-backgrou
0b30: 6e 64 20 7b 7d 7d 0a 20 20 20 20 20 20 20 20 57  nd {}}.        W
0b40: 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61  idget::addmap Ma
0b50: 69 6e 46 72 61 6d 65 20 22 22 20 2e 73 74 61 74  inFrame "" .stat
0b60: 75 73 2e 69 6e 64 66 20 20 7b 2d 62 61 63 6b 67  us.indf  {-backg
0b70: 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 20 20  round {}}.      
0b80: 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70    Widget::addmap
0b90: 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 73   MainFrame "" .s
0ba0: 74 61 74 75 73 2e 70 72 67 66 20 20 7b 2d 62 61  tatus.prgf  {-ba
0bb0: 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20  ckground {}}.   
0bc0: 20 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64       Widget::add
0bd0: 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65 20 50 72  map MainFrame Pr
0be0: 6f 67 72 65 73 73 42 61 72 20 2e 73 74 61 74 75  ogressBar .statu
0bf0: 73 2e 70 72 67 20 7b 2d 62 61 63 6b 67 72 6f 75  s.prg {-backgrou
0c00: 6e 64 20 7b 7d 20 2d 62 61 63 6b 67 72 6f 75 6e  nd {} -backgroun
0c10: 64 20 2d 74 72 6f 75 67 68 63 6f 6c 6f 72 7d 0a  d -troughcolor}.
0c20: 20 20 20 20 7d 0a 0a 20 20 20 20 76 61 72 69 61      }..    varia
0c30: 62 6c 65 20 5f 77 69 64 67 65 74 0a 7d 0a 0a 0a  ble _widget.}...
0c40: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0c90: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
0ca0: 61 6d 65 3a 3a 63 72 65 61 74 65 0a 23 20 2d 2d  ame::create.# --
0cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
0d00: 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74  MainFrame::creat
0d10: 65 20 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20  e { path args } 
0d20: 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 20 20 74  {.    global   t
0d30: 63 6c 5f 70 6c 61 74 66 6f 72 6d 0a 20 20 20 20  cl_platform.    
0d40: 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74  variable _widget
0d50: 0a 0a 20 20 20 20 69 66 20 7b 5b 57 69 64 67 65  ..    if {[Widge
0d60: 74 3a 3a 74 68 65 6d 65 5d 7d 20 7b 0a 09 73 65  t::theme]} {..se
0d70: 74 20 70 61 74 68 20 5b 74 74 6b 3a 3a 66 72 61  t path [ttk::fra
0d80: 6d 65 20 24 70 61 74 68 5d 0a 20 20 20 20 7d 20  me $path].    } 
0d90: 65 6c 73 65 20 7b 0a 09 73 65 74 20 70 61 74 68  else {..set path
0da0: 20 5b 66 72 61 6d 65 20 24 70 61 74 68 20 2d 74   [frame $path -t
0db0: 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68  akefocus 0 -high
0dc0: 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30  lightthickness 0
0dd0: 5d 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74 20  ].    }.    set 
0de0: 74 6f 70 20 20 5b 77 69 6e 66 6f 20 70 61 72 65  top  [winfo pare
0df0: 6e 74 20 24 70 61 74 68 5d 0a 20 20 20 20 69 66  nt $path].    if
0e00: 20 7b 20 21 5b 73 74 72 69 6e 67 20 65 71 75 61   { ![string equa
0e10: 6c 20 5b 77 69 6e 66 6f 20 74 6f 70 6c 65 76 65  l [winfo topleve
0e20: 6c 20 24 70 61 74 68 5d 20 24 74 6f 70 5d 20 7d  l $path] $top] }
0e30: 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 74 72   {.        destr
0e40: 6f 79 20 24 70 61 74 68 0a 20 20 20 20 20 20 20  oy $path.       
0e50: 20 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72   return -code er
0e60: 72 6f 72 20 22 70 61 72 65 6e 74 20 6d 75 73 74  ror "parent must
0e70: 20 62 65 20 61 20 74 6f 70 6c 65 76 65 6c 22 0a   be a toplevel".
0e80: 20 20 20 20 7d 0a 20 20 20 20 57 69 64 67 65 74      }.    Widget
0e90: 3a 3a 69 6e 69 74 20 4d 61 69 6e 46 72 61 6d 65  ::init MainFrame
0ea0: 20 24 70 61 74 68 20 24 61 72 67 73 0a 0a 20 20   $path $args..  
0eb0: 20 20 69 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74    if { $tcl_plat
0ec0: 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d  form(platform) =
0ed0: 3d 20 22 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20  = "unix" } {.   
0ee0: 20 20 20 20 20 73 65 74 20 72 65 6c 69 65 66 20       set relief 
0ef0: 72 61 69 73 65 64 0a 20 20 20 20 20 20 20 20 73  raised.        s
0f00: 65 74 20 62 64 20 20 20 20 20 31 0a 20 20 20 20  et bd     1.    
0f10: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20  } else {.       
0f20: 20 73 65 74 20 72 65 6c 69 65 66 20 66 6c 61 74   set relief flat
0f30: 0a 20 20 20 20 20 20 20 20 73 65 74 20 62 64 20  .        set bd 
0f40: 20 20 20 20 30 0a 20 20 20 20 7d 0a 20 20 20 20      0.    }.    
0f50: 69 66 20 7b 5b 57 69 64 67 65 74 3a 3a 74 68 65  if {[Widget::the
0f60: 6d 65 5d 7d 20 7b 0a 09 73 65 74 20 75 73 65 72  me]} {..set user
0f70: 66 72 61 6d 65 20 5b 65 76 61 6c 20 5b 6c 69 73  frame [eval [lis
0f80: 74 20 74 74 6b 3a 3a 66 72 61 6d 65 20 24 70 61  t ttk::frame $pa
0f90: 74 68 2e 66 72 61 6d 65 5d 20 5c 0a 09 09 09 20  th.frame] \.... 
0fa0: 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67    [Widget::subcg
0fb0: 65 74 20 24 70 61 74 68 20 2e 66 72 61 6d 65 5d  et $path .frame]
0fc0: 5d 0a 09 73 65 74 20 74 6f 70 66 72 61 6d 65 20  ]..set topframe 
0fd0: 20 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 70 61   [ttk::frame $pa
0fe0: 74 68 2e 74 6f 70 66 5d 0a 09 73 65 74 20 62 6f  th.topf]..set bo
0ff0: 74 66 72 61 6d 65 20 20 5b 74 74 6b 3a 3a 66 72  tframe  [ttk::fr
1000: 61 6d 65 20 24 70 61 74 68 2e 62 6f 74 66 5d 0a  ame $path.botf].
1010: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65      } else {..se
1020: 74 20 75 73 65 72 66 72 61 6d 65 20 5b 65 76 61  t userframe [eva
1030: 6c 20 5b 6c 69 73 74 20 66 72 61 6d 65 20 24 70  l [list frame $p
1040: 61 74 68 2e 66 72 61 6d 65 5d 20 5c 0a 09 09 09  ath.frame] \....
1050: 20 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63     [Widget::subc
1060: 67 65 74 20 24 70 61 74 68 20 2e 66 72 61 6d 65  get $path .frame
1070: 5d 20 5c 0a 09 09 09 20 20 20 2d 72 65 6c 69 65  ] \....   -relie
1080: 66 20 24 72 65 6c 69 65 66 20 2d 62 6f 72 64 65  f $relief -borde
1090: 72 77 69 64 74 68 20 24 62 64 5d 0a 09 73 65 74  rwidth $bd]..set
10a0: 20 74 6f 70 66 72 61 6d 65 20 20 5b 65 76 61 6c   topframe  [eval
10b0: 20 5b 6c 69 73 74 20 66 72 61 6d 65 20 24 70 61   [list frame $pa
10c0: 74 68 2e 74 6f 70 66 5d 20 5c 0a 09 09 09 20 20  th.topf] \....  
10d0: 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65   [Widget::subcge
10e0: 74 20 24 70 61 74 68 20 2e 74 6f 70 66 5d 5d 0a  t $path .topf]].
10f0: 09 73 65 74 20 62 6f 74 66 72 61 6d 65 20 20 5b  .set botframe  [
1100: 65 76 61 6c 20 5b 6c 69 73 74 20 66 72 61 6d 65  eval [list frame
1110: 20 24 70 61 74 68 2e 62 6f 74 66 5d 20 5c 0a 09   $path.botf] \..
1120: 09 09 20 20 20 2d 72 65 6c 69 65 66 20 24 72 65  ..   -relief $re
1130: 6c 69 65 66 20 2d 62 6f 72 64 65 72 77 69 64 74  lief -borderwidt
1140: 68 20 24 62 64 20 5c 0a 09 09 09 20 20 20 5b 57  h $bd \....   [W
1150: 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24  idget::subcget $
1160: 70 61 74 68 20 2e 62 6f 74 66 5d 5d 0a 20 20 20  path .botf]].   
1170: 20 7d 0a 0a 20 20 20 20 70 61 63 6b 20 24 74 6f   }..    pack $to
1180: 70 66 72 61 6d 65 20 2d 66 69 6c 6c 20 78 0a 20  pframe -fill x. 
1190: 20 20 20 67 72 69 64 20 63 6f 6c 75 6d 6e 63 6f     grid columnco
11a0: 6e 66 69 67 75 72 65 20 24 74 6f 70 66 72 61 6d  nfigure $topfram
11b0: 65 20 30 20 2d 77 65 69 67 68 74 20 31 0a 0a 20  e 0 -weight 1.. 
11c0: 20 20 20 69 66 20 7b 21 5b 57 69 64 67 65 74 3a     if {![Widget:
11d0: 3a 74 68 65 6d 65 5d 7d 20 7b 0a 09 73 65 74 20  :theme]} {..set 
11e0: 62 67 20 5b 57 69 64 67 65 74 3a 3a 63 67 65 74  bg [Widget::cget
11f0: 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75   $path -backgrou
1200: 6e 64 5d 0a 09 24 70 61 74 68 20 63 6f 6e 66 69  nd]..$path confi
1210: 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64  gure -background
1220: 20 24 62 67 0a 20 20 20 20 7d 0a 20 20 20 20 69   $bg.    }.    i
1230: 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72  f { $tcl_platfor
1240: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 21 3d 20 22  m(platform) != "
1250: 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20  unix" } {.      
1260: 20 20 73 65 74 20 73 65 70 6f 70 74 20 5b 57 69    set sepopt [Wi
1270: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
1280: 24 70 61 74 68 20 2d 73 65 70 61 72 61 74 6f 72  $path -separator
1290: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 24  ].        if { $
12a0: 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74 68 22  sepopt == "both"
12b0: 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d 3d 20 22   || $sepopt == "
12c0: 74 6f 70 22 20 7d 20 7b 0a 09 20 20 20 20 69 66  top" } {..    if
12d0: 20 7b 5b 57 69 64 67 65 74 3a 3a 74 68 65 6d 65   {[Widget::theme
12e0: 5d 7d 20 7b 0a 09 09 73 65 74 20 73 65 70 20 5b  ]} {...set sep [
12f0: 74 74 6b 3a 3a 73 65 70 61 72 61 74 6f 72 20 24  ttk::separator $
1300: 70 61 74 68 2e 73 65 70 20 2d 6f 72 69 65 6e 74  path.sep -orient
1310: 20 68 6f 72 69 7a 6f 6e 74 61 6c 5d 0a 09 20 20   horizontal]..  
1320: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09 73 65 74    } else {...set
1330: 20 73 65 70 20 5b 53 65 70 61 72 61 74 6f 72 3a   sep [Separator:
1340: 3a 63 72 65 61 74 65 20 24 70 61 74 68 2e 73 65  :create $path.se
1350: 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f  p -orient horizo
1360: 6e 74 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e 64  ntal -background
1370: 20 24 62 67 5d 0a 09 20 20 20 20 7d 0a 20 20 20   $bg]..    }.   
1380: 20 20 20 20 20 20 20 20 20 70 61 63 6b 20 24 73           pack $s
1390: 65 70 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 20  ep -fill x.     
13a0: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 20     }.        if 
13b0: 7b 20 24 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f  { $sepopt == "bo
13c0: 74 68 22 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d  th" || $sepopt =
13d0: 3d 20 22 62 6f 74 74 6f 6d 22 20 7d 20 7b 0a 09  = "bottom" } {..
13e0: 20 20 20 20 69 66 20 7b 5b 57 69 64 67 65 74 3a      if {[Widget:
13f0: 3a 74 68 65 6d 65 5d 7d 20 7b 0a 09 09 73 65 74  :theme]} {...set
1400: 20 73 65 70 20 5b 74 74 6b 3a 3a 73 65 70 61 72   sep [ttk::separ
1410: 61 74 6f 72 20 24 62 6f 74 66 72 61 6d 65 2e 73  ator $botframe.s
1420: 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a  ep -orient horiz
1430: 6f 6e 74 61 6c 5d 0a 09 20 20 20 20 7d 20 65 6c  ontal]..    } el
1440: 73 65 20 7b 0a 09 09 73 65 74 20 73 65 70 20 5b  se {...set sep [
1450: 53 65 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74  Separator::creat
1460: 65 20 24 62 6f 74 66 72 61 6d 65 2e 73 65 70 20  e $botframe.sep 
1470: 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e 74  -orient horizont
1480: 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24  al -background $
1490: 62 67 5d 0a 09 20 20 20 20 7d 0a 20 20 20 20 20  bg]..    }.     
14a0: 20 20 20 20 20 20 20 70 61 63 6b 20 24 73 65 70         pack $sep
14b0: 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20   -fill x.       
14c0: 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20   }.    }..    # 
14d0: 2d 2d 2d 20 73 74 61 74 75 73 20 62 61 72 20 2d  --- status bar -
14e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1510: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 69 66 20  --------.    if 
1520: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20  {[string length 
1530: 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69  [Widget::getopti
1540: 6f 6e 20 24 70 61 74 68 20 2d 73 74 61 74 75 73  on $path -status
1550: 62 61 72 66 6f 6e 74 5d 5d 7d 20 7b 0a 09 73 65  barfont]]} {..se
1560: 74 20 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66  t sbfnt [list -f
1570: 6f 6e 74 20 5b 57 69 64 67 65 74 3a 3a 67 65 74  ont [Widget::get
1580: 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74  option $path -st
1590: 61 74 75 73 62 61 72 66 6f 6e 74 5d 5d 0a 20 20  atusbarfont]].  
15a0: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20    } else {..set 
15b0: 73 62 66 6e 74 20 22 22 0a 20 20 20 20 7d 0a 0a  sbfnt "".    }..
15c0: 20 20 20 20 69 66 20 7b 5b 57 69 64 67 65 74 3a      if {[Widget:
15d0: 3a 74 68 65 6d 65 5d 7d 20 7b 0a 09 73 65 74 20  :theme]} {..set 
15e0: 73 74 61 74 75 73 20 20 20 5b 74 74 6b 3a 3a 66  status   [ttk::f
15f0: 72 61 6d 65 20 24 70 61 74 68 2e 73 74 61 74 75  rame $path.statu
1600: 73 5d 0a 09 73 65 74 20 6c 61 62 65 6c 20 20 20  s]..set label   
1610: 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 74 74 6b   [eval [list ttk
1620: 3a 3a 6c 61 62 65 6c 20 24 73 74 61 74 75 73 2e  ::label $status.
1630: 6c 61 62 65 6c 20 5c 0a 09 09 09 09 2d 74 65 78  label \.....-tex
1640: 74 76 61 72 69 61 62 6c 65 20 5b 57 69 64 67 65  tvariable [Widge
1650: 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61  t::getoption $pa
1660: 74 68 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65  th -textvariable
1670: 5d 5d 20 24 73 62 66 6e 74 5d 0a 09 73 65 74 20  ]] $sbfnt]..set 
1680: 69 6e 64 66 72 61 6d 65 20 5b 74 74 6b 3a 3a 66  indframe [ttk::f
1690: 72 61 6d 65 20 24 73 74 61 74 75 73 2e 69 6e 64  rame $status.ind
16a0: 66 5d 0a 09 73 65 74 20 70 72 67 66 72 61 6d 65  f]..set prgframe
16b0: 20 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 73 74   [ttk::frame $st
16c0: 61 74 75 73 2e 70 72 67 66 5d 0a 20 20 20 20 7d  atus.prgf].    }
16d0: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 74 61   else {..set sta
16e0: 74 75 73 20 20 20 5b 66 72 61 6d 65 20 24 70 61  tus   [frame $pa
16f0: 74 68 2e 73 74 61 74 75 73 20 2d 62 61 63 6b 67  th.status -backg
1700: 72 6f 75 6e 64 20 24 62 67 5d 0a 09 73 65 74 20  round $bg]..set 
1710: 6c 61 62 65 6c 20 20 20 20 5b 65 76 61 6c 20 5b  label    [eval [
1720: 6c 69 73 74 20 6c 61 62 65 6c 20 24 73 74 61 74  list label $stat
1730: 75 73 2e 6c 61 62 65 6c 20 5c 0a 09 09 09 09 2d  us.label \.....-
1740: 74 65 78 74 76 61 72 69 61 62 6c 65 20 5b 57 69  textvariable [Wi
1750: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
1760: 24 70 61 74 68 20 2d 74 65 78 74 76 61 72 69 61  $path -textvaria
1770: 62 6c 65 5d 20 5c 0a 09 09 09 09 2d 62 61 63 6b  ble] \.....-back
1780: 67 72 6f 75 6e 64 20 24 62 67 5d 20 24 73 62 66  ground $bg] $sbf
1790: 6e 74 5d 0a 09 73 65 74 20 69 6e 64 66 72 61 6d  nt]..set indfram
17a0: 65 20 5b 66 72 61 6d 65 20 24 73 74 61 74 75 73  e [frame $status
17b0: 2e 69 6e 64 66 20 2d 62 61 63 6b 67 72 6f 75 6e  .indf -backgroun
17c0: 64 20 24 62 67 5d 0a 09 73 65 74 20 70 72 67 66  d $bg]..set prgf
17d0: 72 61 6d 65 20 5b 66 72 61 6d 65 20 24 73 74 61  rame [frame $sta
17e0: 74 75 73 2e 70 72 67 66 20 2d 62 61 63 6b 67 72  tus.prgf -backgr
17f0: 6f 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 7d 0a  ound $bg].    }.
1800: 0a 20 20 20 20 70 6c 61 63 65 20 24 6c 61 62 65  .    place $labe
1810: 6c 20 20 20 20 2d 61 6e 63 68 6f 72 20 77 20 2d  l    -anchor w -
1820: 78 20 30 20 2d 72 65 6c 79 20 30 2e 35 0a 20 20  x 0 -rely 0.5.  
1830: 20 20 70 6c 61 63 65 20 24 69 6e 64 66 72 61 6d    place $indfram
1840: 65 20 2d 61 6e 63 68 6f 72 20 6e 65 20 2d 72 65  e -anchor ne -re
1850: 6c 78 20 31 20 2d 79 20 30 20 2d 72 65 6c 68 65  lx 1 -y 0 -relhe
1860: 69 67 68 74 20 31 0a 20 20 20 20 70 61 63 6b 20  ight 1.    pack 
1870: 20 24 70 72 67 66 72 61 6d 65 20 2d 69 6e 20 24   $prgframe -in $
1880: 69 6e 64 66 72 61 6d 65 20 2d 73 69 64 65 20 6c  indframe -side l
1890: 65 66 74 20 2d 70 61 64 78 20 32 0a 20 20 20 20  eft -padx 2.    
18a0: 24 73 74 61 74 75 73 20 63 6f 6e 66 69 67 75 72  $status configur
18b0: 65 20 2d 68 65 69 67 68 74 20 5b 77 69 6e 66 6f  e -height [winfo
18c0: 20 72 65 71 68 65 69 67 68 74 20 24 6c 61 62 65   reqheight $labe
18d0: 6c 5d 0a 0a 20 20 20 20 73 65 74 20 70 72 6f 67  l]..    set prog
18e0: 72 65 73 73 20 5b 65 76 61 6c 20 5b 6c 69 73 74  ress [eval [list
18f0: 20 50 72 6f 67 72 65 73 73 42 61 72 3a 3a 63 72   ProgressBar::cr
1900: 65 61 74 65 20 24 73 74 61 74 75 73 2e 70 72 67  eate $status.prg
1910: 5d 20 5c 0a 09 09 20 20 20 20 20 20 5b 57 69 64  ] \...      [Wid
1920: 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70 61  get::subcget $pa
1930: 74 68 20 2e 73 74 61 74 75 73 2e 70 72 67 5d 20  th .status.prg] 
1940: 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  \.              
1950: 20 20 20 20 20 20 20 20 2d 77 69 64 74 68 20 20          -width  
1960: 20 20 20 20 20 35 30 20 5c 0a 20 20 20 20 20 20       50 \.      
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1980: 2d 68 65 69 67 68 74 20 20 20 20 20 20 5b 65 78  -height      [ex
1990: 70 72 20 7b 5b 77 69 6e 66 6f 20 72 65 71 68 65  pr {[winfo reqhe
19a0: 69 67 68 74 20 24 6c 61 62 65 6c 5d 2d 32 7d 5d  ight $label]-2}]
19b0: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   \.             
19c0: 20 20 20 20 20 20 20 20 20 2d 62 6f 72 64 65 72           -border
19d0: 77 69 64 74 68 20 31 20 5c 0a 20 20 20 20 20 20  width 1 \.      
19e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
19f0: 2d 72 65 6c 69 65 66 20 20 20 20 20 20 73 75 6e  -relief      sun
1a00: 6b 65 6e 5d 0a 20 20 20 20 69 66 20 7b 5b 57 69  ken].    if {[Wi
1a10: 64 67 65 74 3a 3a 74 68 65 6d 65 5d 20 26 26 20  dget::theme] && 
1a20: 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69  [Widget::getopti
1a30: 6f 6e 20 24 70 61 74 68 20 2d 73 69 7a 65 67 72  on $path -sizegr
1a40: 69 70 5d 7d 20 7b 0a 09 70 61 63 6b 20 5b 74 74  ip]} {..pack [tt
1a50: 6b 3a 3a 73 69 7a 65 67 72 69 70 20 24 62 6f 74  k::sizegrip $bot
1a60: 66 72 61 6d 65 2e 73 67 5d 20 2d 73 69 64 65 20  frame.sg] -side 
1a70: 72 69 67 68 74 20 2d 61 6e 63 68 6f 72 20 73 65  right -anchor se
1a80: 0a 20 20 20 20 7d 0a 20 20 20 20 70 61 63 6b 20  .    }.    pack 
1a90: 24 73 74 61 74 75 73 20 20 20 20 2d 69 6e 20 24  $status    -in $
1aa0: 62 6f 74 66 72 61 6d 65 20 2d 66 69 6c 6c 20 78  botframe -fill x
1ab0: 20 2d 70 61 64 79 20 32 0a 20 20 20 20 70 61 63   -pady 2.    pac
1ac0: 6b 20 24 62 6f 74 66 72 61 6d 65 20 20 2d 73 69  k $botframe  -si
1ad0: 64 65 20 62 6f 74 74 6f 6d 20 2d 66 69 6c 6c 20  de bottom -fill 
1ae0: 78 0a 20 20 20 20 70 61 63 6b 20 24 75 73 65 72  x.    pack $user
1af0: 66 72 61 6d 65 20 2d 66 69 6c 6c 20 62 6f 74 68  frame -fill both
1b00: 20 2d 65 78 70 61 6e 64 20 79 65 73 0a 0a 20 20   -expand yes..  
1b10: 20 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70    set _widget($p
1b20: 61 74 68 2c 74 6f 70 29 20 20 20 20 20 20 24 74  ath,top)      $t
1b30: 6f 70 0a 20 20 20 20 73 65 74 20 5f 77 69 64 67  op.    set _widg
1b40: 65 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c 62 61  et($path,ntoolba
1b50: 72 29 20 30 0a 20 20 20 20 73 65 74 20 5f 77 69  r) 0.    set _wi
1b60: 64 67 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69  dget($path,nindi
1b70: 63 29 20 20 20 30 0a 0a 20 20 20 20 73 65 74 20  c)   0..    set 
1b80: 6d 65 6e 75 20 5b 57 69 64 67 65 74 3a 3a 67 65  menu [Widget::ge
1b90: 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 6d  toption $path -m
1ba0: 65 6e 75 5d 0a 20 20 20 20 69 66 20 7b 20 5b 6c  enu].    if { [l
1bb0: 6c 65 6e 67 74 68 20 24 6d 65 6e 75 5d 20 7d 20  length $menu] } 
1bc0: 7b 0a 20 20 20 20 20 20 20 20 5f 63 72 65 61 74  {.        _creat
1bd0: 65 5f 6d 65 6e 75 62 61 72 20 24 70 61 74 68 20  e_menubar $path 
1be0: 24 6d 65 6e 75 0a 20 20 20 20 7d 0a 0a 20 20 20  $menu.    }..   
1bf0: 20 62 69 6e 64 20 24 70 61 74 68 20 3c 44 65 73   bind $path <Des
1c00: 74 72 6f 79 3e 20 5b 6c 69 73 74 20 4d 61 69 6e  troy> [list Main
1c10: 46 72 61 6d 65 3a 3a 5f 64 65 73 74 72 6f 79 20  Frame::_destroy 
1c20: 25 57 5d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20  %W]..    return 
1c30: 5b 57 69 64 67 65 74 3a 3a 63 72 65 61 74 65 20  [Widget::create 
1c40: 4d 61 69 6e 46 72 61 6d 65 20 24 70 61 74 68 5d  MainFrame $path]
1c50: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
1c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ca0: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
1cb0: 61 69 6e 46 72 61 6d 65 3a 3a 63 6f 6e 66 69 67  ainFrame::config
1cc0: 75 72 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ure.# ----------
1cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d10: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
1d20: 65 3a 3a 63 6f 6e 66 69 67 75 72 65 20 7b 20 70  e::configure { p
1d30: 61 74 68 20 61 72 67 73 20 7d 20 7b 0a 20 20 20  ath args } {.   
1d40: 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65   variable _widge
1d50: 74 0a 0a 20 20 20 20 73 65 74 20 72 65 73 20 5b  t..    set res [
1d60: 57 69 64 67 65 74 3a 3a 63 6f 6e 66 69 67 75 72  Widget::configur
1d70: 65 20 24 70 61 74 68 20 24 61 72 67 73 5d 0a 0a  e $path $args]..
1d80: 20 20 20 20 69 66 20 7b 20 5b 57 69 64 67 65 74      if { [Widget
1d90: 3a 3a 68 61 73 43 68 61 6e 67 65 64 20 24 70 61  ::hasChanged $pa
1da0: 74 68 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65  th -textvariable
1db0: 20 6e 65 77 76 5d 20 7d 20 7b 0a 20 20 20 20 20   newv] } {.     
1dc0: 20 20 20 75 70 6c 65 76 65 6c 20 5c 23 30 20 24     uplevel \#0 $
1dd0: 70 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65  path.status.labe
1de0: 6c 20 63 6f 6e 66 69 67 75 72 65 20 2d 74 65 78  l configure -tex
1df0: 74 76 61 72 69 61 62 6c 65 20 5b 6c 69 73 74 20  tvariable [list 
1e00: 24 6e 65 77 76 5d 0a 20 20 20 20 7d 0a 0a 20 20  $newv].    }..  
1e10: 20 20 23 20 54 68 65 20 74 74 6b 20 66 72 61 6d    # The ttk fram
1e20: 65 20 68 61 73 20 6e 6f 20 2d 62 61 63 6b 67 72  e has no -backgr
1e30: 6f 75 6e 64 0a 20 20 20 20 69 66 20 7b 21 5b 57  ound.    if {![W
1e40: 69 64 67 65 74 3a 3a 74 68 65 6d 65 5d 20 26 26  idget::theme] &&
1e50: 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61   [Widget::hasCha
1e60: 6e 67 65 64 20 24 70 61 74 68 20 2d 62 61 63 6b  nged $path -back
1e70: 67 72 6f 75 6e 64 20 62 67 5d 20 7d 20 7b 0a 09  ground bg] } {..
1e80: 69 66 20 7b 28 24 3a 3a 74 63 6c 5f 70 6c 61 74  if {($::tcl_plat
1e90: 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d  form(platform) =
1ea0: 3d 20 22 75 6e 69 78 22 29 0a 09 20 20 20 20 20  = "unix")..     
1eb0: 20 20 20 26 26 20 28 30 20 21 3d 20 5b 73 74 72     && (0 != [str
1ec0: 69 6e 67 20 63 6f 6d 70 61 72 65 20 5b 74 6b 20  ing compare [tk 
1ed0: 77 69 6e 64 6f 77 69 6e 67 73 79 73 74 65 6d 5d  windowingsystem]
1ee0: 20 22 61 71 75 61 22 5d 29 7d 20 7b 0a 09 20 20   "aqua"])} {..  
1ef0: 20 20 73 65 74 20 6c 69 73 74 6d 65 6e 75 20 5b    set listmenu [
1f00: 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74  $_widget($path,t
1f10: 6f 70 29 20 63 67 65 74 20 2d 6d 65 6e 75 5d 0a  op) cget -menu].
1f20: 09 20 20 20 20 77 68 69 6c 65 20 7b 20 5b 6c 6c  .    while { [ll
1f30: 65 6e 67 74 68 20 24 6c 69 73 74 6d 65 6e 75 5d  ength $listmenu]
1f40: 20 7d 20 7b 0a 09 09 73 65 74 20 6e 65 77 6c 69   } {...set newli
1f50: 73 74 20 7b 7d 0a 09 09 66 6f 72 65 61 63 68 20  st {}...foreach 
1f60: 6d 65 6e 75 20 24 6c 69 73 74 6d 65 6e 75 20 7b  menu $listmenu {
1f70: 0a 09 09 20 20 20 20 24 6d 65 6e 75 20 63 6f 6e  ...    $menu con
1f80: 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75  figure -backgrou
1f90: 6e 64 20 24 62 67 0a 09 09 20 20 20 20 73 65 74  nd $bg...    set
1fa0: 20 6e 65 77 6c 69 73 74 20 5b 63 6f 6e 63 61 74   newlist [concat
1fb0: 20 24 6e 65 77 6c 69 73 74 20 5b 77 69 6e 66 6f   $newlist [winfo
1fc0: 20 63 68 69 6c 64 72 65 6e 20 24 6d 65 6e 75 5d   children $menu]
1fd0: 5d 0a 09 09 7d 0a 09 09 73 65 74 20 6c 69 73 74  ]...}...set list
1fe0: 6d 65 6e 75 20 24 6e 65 77 6c 69 73 74 0a 09 20  menu $newlist.. 
1ff0: 20 20 20 7d 0a 09 7d 0a 09 66 6f 72 65 61 63 68     }..}..foreach
2000: 20 73 65 70 20 7b 2e 73 65 70 20 2e 62 6f 74 66   sep {.sep .botf
2010: 2e 73 65 70 7d 20 7b 0a 09 20 20 20 20 69 66 20  .sep} {..    if 
2020: 7b 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24  {[winfo exists $
2030: 70 61 74 68 2e 24 73 65 70 5d 7d 20 7b 0a 09 09  path.$sep]} {...
2040: 53 65 70 61 72 61 74 6f 72 3a 3a 63 6f 6e 66 69  Separator::confi
2050: 67 75 72 65 20 24 70 61 74 68 2e 24 73 65 70 20  gure $path.$sep 
2060: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a  -background $bg.
2070: 09 20 20 20 20 7d 0a 09 7d 0a 09 66 6f 72 65 61  .    }..}..forea
2080: 63 68 20 77 20 5b 77 69 6e 66 6f 20 63 68 69 6c  ch w [winfo chil
2090: 64 72 65 6e 20 24 70 61 74 68 2e 74 6f 70 66 5d  dren $path.topf]
20a0: 20 7b 0a 09 20 20 20 20 24 77 20 63 6f 6e 66 69   {..    $w confi
20b0: 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64  gure -background
20c0: 20 24 62 67 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20   $bg..}.    }.. 
20d0: 20 20 20 69 66 20 7b 20 5b 57 69 64 67 65 74 3a     if { [Widget:
20e0: 3a 68 61 73 43 68 61 6e 67 65 64 20 24 70 61 74  :hasChanged $pat
20f0: 68 20 2d 6d 65 6e 75 62 61 72 66 6f 6e 74 20 6e  h -menubarfont n
2100: 65 77 6d 62 66 6e 74 5d 20 7d 20 7b 0a 09 69 66  ewmbfnt] } {..if
2110: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   {[string length
2120: 20 24 6e 65 77 6d 62 66 6e 74 5d 7d 20 7b 0a 09   $newmbfnt]} {..
2130: 20 20 20 20 73 65 74 20 6d 62 66 6e 74 20 5b 6c      set mbfnt [l
2140: 69 73 74 20 2d 66 6f 6e 74 20 24 6e 65 77 6d 62  ist -font $newmb
2150: 66 6e 74 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09  fnt]..} else {..
2160: 20 20 20 20 73 65 74 20 6d 62 66 6e 74 20 22 22      set mbfnt ""
2170: 0a 09 7d 0a 09 73 65 74 20 74 6f 70 20 20 20 20  ..}..set top    
2180: 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c   $_widget($path,
2190: 74 6f 70 29 0a 09 69 66 20 7b 5b 73 74 72 69 6e  top)..if {[strin
21a0: 67 20 65 71 75 61 6c 20 24 74 6f 70 20 2e 5d 7d  g equal $top .]}
21b0: 20 7b 0a 09 20 20 20 20 65 76 61 6c 20 5b 6c 69   {..    eval [li
21c0: 73 74 20 2e 6d 65 6e 75 62 61 72 20 63 6f 6e 66  st .menubar conf
21d0: 69 67 75 72 65 5d 20 24 6d 62 66 6e 74 0a 09 7d  igure] $mbfnt..}
21e0: 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 65 76 61   else {..    eva
21f0: 6c 20 5b 6c 69 73 74 20 24 74 6f 70 2e 6d 65 6e  l [list $top.men
2200: 75 62 61 72 20 63 6f 6e 66 69 67 75 72 65 5d 20  ubar configure] 
2210: 24 6d 62 66 6e 74 0a 09 7d 0a 20 20 20 20 7d 0a  $mbfnt..}.    }.
2220: 20 20 20 20 69 66 20 7b 20 5b 57 69 64 67 65 74      if { [Widget
2230: 3a 3a 68 61 73 43 68 61 6e 67 65 64 20 24 70 61  ::hasChanged $pa
2240: 74 68 20 2d 6d 65 6e 75 65 6e 74 72 79 66 6f 6e  th -menuentryfon
2250: 74 20 6e 65 77 6d 65 66 6e 74 5d 20 7d 20 7b 0a  t newmefnt] } {.
2260: 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e  .if {[string len
2270: 67 74 68 20 24 6e 65 77 6d 65 66 6e 74 5d 7d 20  gth $newmefnt]} 
2280: 7b 0a 09 20 20 20 20 73 65 74 20 6d 65 66 6e 74  {..    set mefnt
2290: 20 5b 6c 69 73 74 20 2d 66 6f 6e 74 20 24 6e 65   [list -font $ne
22a0: 77 6d 65 66 6e 74 5d 0a 09 7d 20 65 6c 73 65 20  wmefnt]..} else 
22b0: 7b 0a 09 20 20 20 20 73 65 74 20 6d 65 66 6e 74  {..    set mefnt
22c0: 20 22 22 0a 09 7d 0a 09 73 65 74 20 74 6f 70 20   ""..}..set top 
22d0: 20 20 20 20 24 5f 77 69 64 67 65 74 28 24 70 61      $_widget($pa
22e0: 74 68 2c 74 6f 70 29 0a 09 69 66 20 7b 5b 73 74  th,top)..if {[st
22f0: 72 69 6e 67 20 65 71 75 61 6c 20 24 74 6f 70 20  ring equal $top 
2300: 2e 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6d  .]} {..    set m
2310: 62 20 2e 6d 65 6e 75 62 61 72 0a 09 7d 20 65 6c  b .menubar..} el
2320: 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 62  se {..    set mb
2330: 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72 0a 09 7d   $top.menubar..}
2340: 0a 09 73 65 74 20 6c 20 5b 77 69 6e 66 6f 20 63  ..set l [winfo c
2350: 68 69 6c 64 72 65 6e 20 24 6d 62 5d 0a 09 77 68  hildren $mb]..wh
2360: 69 6c 65 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c  ile {[llength $l
2370: 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 65 20  ]} {..    set e 
2380: 5b 6c 69 6e 64 65 78 20 24 6c 20 30 5d 0a 09 20  [lindex $l 0].. 
2390: 20 20 20 73 65 74 20 6c 20 5b 6c 72 61 6e 67 65     set l [lrange
23a0: 20 24 6c 20 31 20 65 6e 64 5d 0a 09 20 20 20 20   $l 1 end]..    
23b0: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67  if {[string leng
23c0: 74 68 20 24 65 5d 20 3d 3d 20 30 7d 20 7b 63 6f  th $e] == 0} {co
23d0: 6e 74 69 6e 75 65 7d 0a 09 20 20 20 20 6c 61 70  ntinue}..    lap
23e0: 70 65 6e 64 20 6c 20 5b 77 69 6e 66 6f 20 63 68  pend l [winfo ch
23f0: 69 6c 64 72 65 6e 20 24 65 5d 0a 09 20 20 20 20  ildren $e]..    
2400: 65 76 61 6c 20 5b 6c 69 73 74 20 24 65 20 63 6f  eval [list $e co
2410: 6e 66 69 67 75 72 65 5d 20 24 6d 65 66 6e 74 0a  nfigure] $mefnt.
2420: 09 7d 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 20 69  .}.    }...    i
2430: 66 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73  f { [Widget::has
2440: 43 68 61 6e 67 65 64 20 24 70 61 74 68 20 2d 73  Changed $path -s
2450: 74 61 74 75 73 62 61 72 66 6f 6e 74 20 6e 65 77  tatusbarfont new
2460: 73 62 66 6e 74 5d 20 7d 20 7b 0a 09 69 66 20 7b  sbfnt] } {..if {
2470: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24  [string length $
2480: 6e 65 77 73 62 66 6e 74 5d 7d 20 7b 0a 09 20 20  newsbfnt]} {..  
2490: 20 20 73 65 74 20 73 62 66 6e 74 20 5b 6c 69 73    set sbfnt [lis
24a0: 74 20 2d 66 6f 6e 74 20 24 6e 65 77 73 62 66 6e  t -font $newsbfn
24b0: 74 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20  t]..} else {..  
24c0: 20 20 73 65 74 20 73 62 66 6e 74 20 22 22 0a 09    set sbfnt ""..
24d0: 7d 0a 09 66 6f 72 20 7b 73 65 74 20 69 6e 64 65  }..for {set inde
24e0: 78 20 30 7d 20 7b 24 69 6e 64 65 78 3c 24 5f 77  x 0} {$index<$_w
24f0: 69 64 67 65 74 28 24 70 61 74 68 2c 6e 69 6e 64  idget($path,nind
2500: 69 63 29 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78  ic)} {incr index
2510: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 69 6e 64  } {..    set ind
2520: 69 63 20 24 70 61 74 68 2e 73 74 61 74 75 73 2e  ic $path.status.
2530: 69 6e 64 66 2e 66 24 69 6e 64 65 78 0a 09 20 20  indf.f$index..  
2540: 20 20 65 76 61 6c 20 5b 6c 69 73 74 20 24 69 6e    eval [list $in
2550: 64 69 63 20 63 6f 6e 66 69 67 75 72 65 5d 20 24  dic configure] $
2560: 73 62 66 6e 74 0a 09 7d 0a 09 65 76 61 6c 20 5b  sbfnt..}..eval [
2570: 6c 69 73 74 20 24 70 61 74 68 2e 73 74 61 74 75  list $path.statu
2580: 73 2e 6c 61 62 65 6c 20 63 6f 6e 66 69 67 75 72  s.label configur
2590: 65 5d 20 24 73 62 66 6e 74 0a 09 24 70 61 74 68  e] $sbfnt..$path
25a0: 2e 73 74 61 74 75 73 20 63 6f 6e 66 69 67 75 72  .status configur
25b0: 65 20 2d 68 65 69 67 68 74 20 5b 77 69 6e 66 6f  e -height [winfo
25c0: 20 72 65 71 68 65 69 67 68 74 20 24 70 61 74 68   reqheight $path
25d0: 2e 73 74 61 74 75 73 2e 6c 61 62 65 6c 5d 0a 0a  .status.label]..
25e0: 09 24 70 61 74 68 2e 73 74 61 74 75 73 2e 70 72  .$path.status.pr
25f0: 67 20 63 6f 6e 66 69 67 75 72 65 20 5c 0a 09 09  g configure \...
2600: 2d 68 65 69 67 68 74 20 5b 65 78 70 72 20 7b 5b  -height [expr {[
2610: 77 69 6e 66 6f 20 72 65 71 68 65 69 67 68 74 20  winfo reqheight 
2620: 24 70 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62  $path.status.lab
2630: 65 6c 5d 2d 32 7d 5d 0a 20 20 20 20 7d 0a 0a 20  el]-2}].    }.. 
2640: 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 0a 7d     return $res.}
2650: 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...# -----------
2660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2690: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
26a0: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
26b0: 6e 46 72 61 6d 65 3a 3a 63 67 65 74 0a 23 20 2d  nFrame::cget.# -
26c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
26d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
26e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
26f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
2710: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 67 65 74   MainFrame::cget
2720: 20 7b 20 70 61 74 68 20 6f 70 74 69 6f 6e 20 7d   { path option }
2730: 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 57   {.    return [W
2740: 69 64 67 65 74 3a 3a 63 67 65 74 20 24 70 61 74  idget::cget $pat
2750: 68 20 24 6f 70 74 69 6f 6e 5d 0a 7d 0a 0a 0a 23  h $option].}...#
2760: 20 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 2d 2d 2d 2d 2d 2d 2d  ----------------
2780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
27b0: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
27c0: 6d 65 3a 3a 67 65 74 66 72 61 6d 65 0a 23 20 2d  me::getframe.# -
27d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
2820: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 66   MainFrame::getf
2830: 72 61 6d 65 20 7b 20 70 61 74 68 20 7d 20 7b 0a  rame { path } {.
2840: 20 20 20 20 72 65 74 75 72 6e 20 24 70 61 74 68      return $path
2850: 2e 66 72 61 6d 65 0a 7d 0a 0a 0a 23 20 2d 2d 2d  .frame.}...# ---
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 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
28b0: 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  mand MainFrame::
28c0: 61 64 64 74 6f 6f 6c 62 61 72 0a 23 20 2d 2d 2d  addtoolbar.# ---
28d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d  ---------.proc M
2920: 61 69 6e 46 72 61 6d 65 3a 3a 61 64 64 74 6f 6f  ainFrame::addtoo
2930: 6c 62 61 72 20 7b 20 70 61 74 68 20 7d 20 7b 0a  lbar { path } {.
2940: 20 20 20 20 67 6c 6f 62 61 6c 20 20 20 74 63 6c      global   tcl
2950: 5f 70 6c 61 74 66 6f 72 6d 0a 20 20 20 20 76 61  _platform.    va
2960: 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a  riable _widget..
2970: 20 20 20 20 73 65 74 20 69 6e 64 65 78 20 20 20      set index   
2980: 20 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68    $_widget($path
2990: 2c 6e 74 6f 6f 6c 62 61 72 29 0a 20 20 20 20 73  ,ntoolbar).    s
29a0: 65 74 20 74 6f 6f 6c 66 72 61 6d 65 20 24 70 61  et toolframe $pa
29b0: 74 68 2e 74 6f 70 66 2e 66 24 69 6e 64 65 78 0a  th.topf.f$index.
29c0: 20 20 20 20 73 65 74 20 74 6f 6f 6c 62 61 72 20      set toolbar 
29d0: 20 20 24 70 61 74 68 2e 74 6f 70 66 2e 74 62 24    $path.topf.tb$
29e0: 69 6e 64 65 78 0a 20 20 20 20 69 66 20 7b 20 24  index.    if { $
29f0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61  tcl_platform(pla
2a00: 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78 22  tform) == "unix"
2a10: 20 7d 20 7b 0a 09 69 66 20 7b 5b 57 69 64 67 65   } {..if {[Widge
2a20: 74 3a 3a 74 68 65 6d 65 5d 7d 20 7b 0a 09 20 20  t::theme]} {..  
2a30: 20 20 74 74 6b 3a 3a 66 72 61 6d 65 20 24 74 6f    ttk::frame $to
2a40: 6f 6c 66 72 61 6d 65 20 2d 70 61 64 64 69 6e 67  olframe -padding
2a50: 20 31 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20   1..} else {..  
2a60: 20 20 73 65 74 20 62 67 20 5b 57 69 64 67 65 74    set bg [Widget
2a70: 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74  ::getoption $pat
2a80: 68 20 2d 62 61 63 6b 67 72 6f 75 6e 64 5d 0a 09  h -background]..
2a90: 20 20 20 20 66 72 61 6d 65 20 24 74 6f 6f 6c 66      frame $toolf
2aa0: 72 61 6d 65 20 2d 72 65 6c 69 65 66 20 72 61 69  rame -relief rai
2ab0: 73 65 64 20 2d 62 6f 72 64 65 72 77 69 64 74 68  sed -borderwidth
2ac0: 20 31 20 5c 0a 09 09 2d 74 61 6b 65 66 6f 63 75   1 \...-takefocu
2ad0: 73 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68  s 0 -highlightth
2ae0: 69 63 6b 6e 65 73 73 20 30 20 2d 62 61 63 6b 67  ickness 0 -backg
2af0: 72 6f 75 6e 64 20 24 62 67 0a 09 7d 0a 20 20 20  round $bg..}.   
2b00: 20 7d 20 65 6c 73 65 20 7b 0a 09 69 66 20 7b 5b   } else {..if {[
2b10: 57 69 64 67 65 74 3a 3a 74 68 65 6d 65 5d 7d 20  Widget::theme]} 
2b20: 7b 0a 09 20 20 20 20 74 74 6b 3a 3a 66 72 61 6d  {..    ttk::fram
2b30: 65 20 24 74 6f 6f 6c 66 72 61 6d 65 0a 09 20 20  e $toolframe..  
2b40: 20 20 73 65 74 20 73 65 70 20 5b 74 74 6b 3a 3a    set sep [ttk::
2b50: 73 65 70 61 72 61 74 6f 72 20 24 74 6f 6f 6c 66  separator $toolf
2b60: 72 61 6d 65 2e 73 65 70 20 2d 6f 72 69 65 6e 74  rame.sep -orient
2b70: 20 68 6f 72 69 7a 6f 6e 74 61 6c 5d 0a 09 7d 20   horizontal]..} 
2b80: 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20  else {..    set 
2b90: 62 67 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f  bg [Widget::geto
2ba0: 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 62 61 63  ption $path -bac
2bb0: 6b 67 72 6f 75 6e 64 5d 0a 09 20 20 20 20 66 72  kground]..    fr
2bc0: 61 6d 65 20 24 74 6f 6f 6c 66 72 61 6d 65 20 2d  ame $toolframe -
2bd0: 72 65 6c 69 65 66 20 66 6c 61 74 20 2d 62 6f 72  relief flat -bor
2be0: 64 65 72 77 69 64 74 68 20 30 20 2d 74 61 6b 65  derwidth 0 -take
2bf0: 66 6f 63 75 73 20 30 20 5c 0a 09 09 2d 68 69 67  focus 0 \...-hig
2c00: 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20  hlightthickness 
2c10: 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62  0 -background $b
2c20: 67 0a 09 20 20 20 20 73 65 74 20 73 65 70 20 5b  g..    set sep [
2c30: 53 65 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74  Separator::creat
2c40: 65 20 24 74 6f 6f 6c 66 72 61 6d 65 2e 73 65 70  e $toolframe.sep
2c50: 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e   -orient horizon
2c60: 74 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20  tal -background 
2c70: 24 62 67 5d 0a 09 7d 0a 20 20 20 20 20 20 20 20  $bg]..}.        
2c80: 70 61 63 6b 20 24 73 65 70 20 2d 66 69 6c 6c 20  pack $sep -fill 
2c90: 78 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b  x.    }.    if {
2ca0: 5b 57 69 64 67 65 74 3a 3a 74 68 65 6d 65 5d 7d  [Widget::theme]}
2cb0: 20 7b 0a 09 73 65 74 20 74 6f 6f 6c 62 61 72 20   {..set toolbar 
2cc0: 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 74 6f 6f  [ttk::frame $too
2cd0: 6c 62 61 72 20 2d 70 61 64 64 69 6e 67 20 32 5d  lbar -padding 2]
2ce0: 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73  .    } else {..s
2cf0: 65 74 20 74 6f 6f 6c 62 61 72 20 5b 66 72 61 6d  et toolbar [fram
2d00: 65 20 24 74 6f 6f 6c 62 61 72 20 2d 72 65 6c 69  e $toolbar -reli
2d10: 65 66 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77  ef flat -borderw
2d20: 69 64 74 68 20 32 20 5c 0a 09 09 09 20 2d 74 61  idth 2 \.... -ta
2d30: 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c  kefocus 0 -highl
2d40: 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20  ightthickness 0 
2d50: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d  -background $bg]
2d60: 0a 20 20 20 20 7d 0a 20 20 20 20 70 61 63 6b 20  .    }.    pack 
2d70: 24 74 6f 6f 6c 62 61 72 20 2d 69 6e 20 24 74 6f  $toolbar -in $to
2d80: 6f 6c 66 72 61 6d 65 20 2d 61 6e 63 68 6f 72 20  olframe -anchor 
2d90: 77 20 2d 65 78 70 61 6e 64 20 79 65 73 20 2d 66  w -expand yes -f
2da0: 69 6c 6c 20 78 0a 20 20 20 20 69 6e 63 72 20 5f  ill x.    incr _
2db0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 74 6f  widget($path,nto
2dc0: 6f 6c 62 61 72 29 0a 20 20 20 20 67 72 69 64 20  olbar).    grid 
2dd0: 24 74 6f 6f 6c 66 72 61 6d 65 20 2d 63 6f 6c 75  $toolframe -colu
2de0: 6d 6e 20 30 20 2d 72 6f 77 20 24 69 6e 64 65 78  mn 0 -row $index
2df0: 20 2d 73 74 69 63 6b 79 20 65 77 0a 20 20 20 20   -sticky ew.    
2e00: 72 65 74 75 72 6e 20 24 74 6f 6f 6c 62 61 72 0a  return $toolbar.
2e10: 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }...# ----------
2e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61  --.#  Command Ma
2e70: 69 6e 46 72 61 6d 65 3a 3a 67 65 74 74 6f 6f 6c  inFrame::gettool
2e80: 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  bar.# ----------
2e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ed0: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2ee0: 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 20 7b 20  e::gettoolbar { 
2ef0: 70 61 74 68 20 69 6e 64 65 78 20 7d 20 7b 0a 20  path index } {. 
2f00: 20 20 20 72 65 74 75 72 6e 20 24 70 61 74 68 2e     return $path.
2f10: 74 6f 70 66 2e 74 62 24 69 6e 64 65 78 0a 7d 0a  topf.tb$index.}.
2f20: 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..# ------------
2f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f70: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e  .#  Command Main
2f80: 46 72 61 6d 65 3a 3a 61 64 64 69 6e 64 69 63 61  Frame::addindica
2f90: 74 6f 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  tor.# ----------
2fa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2fb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2fe0: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
2ff0: 65 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f 72 20  e::addindicator 
3000: 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b 0a  { path args } {.
3010: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69      variable _wi
3020: 64 67 65 74 0a 0a 20 20 20 20 69 66 20 7b 5b 73  dget..    if {[s
3030: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57 69  tring length [Wi
3040: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
3050: 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61 72  $path -statusbar
3060: 66 6f 6e 74 5d 5d 7d 20 7b 0a 09 73 65 74 20 73  font]]} {..set s
3070: 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f 6e 74  bfnt [list -font
3080: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
3090: 69 6f 6e 20 24 70 61 74 68 20 2d 73 74 61 74 75  ion $path -statu
30a0: 73 62 61 72 66 6f 6e 74 5d 5d 0a 20 20 20 20 7d  sbarfont]].    }
30b0: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 62 66   else {..set sbf
30c0: 6e 74 20 22 22 0a 20 20 20 20 7d 0a 0a 20 20 20  nt "".    }..   
30d0: 20 73 65 74 20 69 6e 64 65 78 20 24 5f 77 69 64   set index $_wid
30e0: 67 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63  get($path,nindic
30f0: 29 0a 20 20 20 20 73 65 74 20 69 6e 64 69 63 20  ).    set indic 
3100: 24 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e 64  $path.status.ind
3110: 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 65 76  f.f$index.    ev
3120: 61 6c 20 5b 6c 69 73 74 20 6c 61 62 65 6c 20 24  al [list label $
3130: 69 6e 64 69 63 5d 20 24 61 72 67 73 20 2d 72 65  indic] $args -re
3140: 6c 69 65 66 20 73 75 6e 6b 65 6e 20 2d 62 6f 72  lief sunken -bor
3150: 64 65 72 77 69 64 74 68 20 31 20 5c 0a 20 20 20  derwidth 1 \.   
3160: 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 73 20       -takefocus 
3170: 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63  0 -highlightthic
3180: 6b 6e 65 73 73 20 30 20 24 73 62 66 6e 74 0a 0a  kness 0 $sbfnt..
3190: 20 20 20 20 70 61 63 6b 20 24 69 6e 64 69 63 20      pack $indic 
31a0: 2d 73 69 64 65 20 6c 65 66 74 20 2d 61 6e 63 68  -side left -anch
31b0: 6f 72 20 77 20 2d 70 61 64 78 20 32 20 2d 66 69  or w -padx 2 -fi
31c0: 6c 6c 20 79 20 2d 65 78 70 61 6e 64 20 31 0a 0a  ll y -expand 1..
31d0: 20 20 20 20 69 6e 63 72 20 5f 77 69 64 67 65 74      incr _widget
31e0: 28 24 70 61 74 68 2c 6e 69 6e 64 69 63 29 0a 0a  ($path,nindic)..
31f0: 20 20 20 20 72 65 74 75 72 6e 20 24 69 6e 64 69      return $indi
3200: 63 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  c.}...# --------
3210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3250: 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
3260: 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 69 6e  MainFrame::getin
3270: 64 69 63 61 74 6f 72 0a 23 20 2d 2d 2d 2d 2d 2d  dicator.# ------
3280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
32a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
32b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
32c0: 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e  ------.proc Main
32d0: 46 72 61 6d 65 3a 3a 67 65 74 69 6e 64 69 63 61  Frame::getindica
32e0: 74 6f 72 20 7b 20 70 61 74 68 20 69 6e 64 65 78  tor { path index
32f0: 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20   } {.    return 
3300: 24 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e 64  $path.status.ind
3310: 66 2e 66 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23 20  f.f$index.}...# 
3320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
3370: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
3380: 65 3a 3a 67 65 74 6d 65 6e 75 0a 23 20 2d 2d 2d  e::getmenu.# ---
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 2d 2d 2d 2d  ----------------
33c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d  ---------.proc M
33e0: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65 6e  ainFrame::getmen
33f0: 75 20 7b 20 70 61 74 68 20 6d 65 6e 75 69 64 20  u { path menuid 
3400: 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65  } {.    variable
3410: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 69 66   _widget..    if
3420: 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20   { [info exists 
3430: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65  _widget($path,me
3440: 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 5d 20 7d  nuid,$menuid)] }
3450: 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72   {.        retur
3460: 6e 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68  n $_widget($path
3470: 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29  ,menuid,$menuid)
3480: 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72  .    }.    retur
3490: 6e 20 22 22 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  n "".}...# -----
34a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34e0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
34f0: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73  and MainFrame::s
3500: 65 74 6d 65 6e 75 73 74 61 74 65 0a 23 20 2d 2d  etmenustate.# --
3510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3530: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
3560: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 65 74 6d   MainFrame::setm
3570: 65 6e 75 73 74 61 74 65 20 7b 20 70 61 74 68 20  enustate { path 
3580: 74 61 67 20 73 74 61 74 65 20 7d 20 7b 0a 20 20  tag state } {.  
3590: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
35a0: 65 74 0a 0a 20 20 20 20 23 20 53 65 74 20 6d 65  et..    # Set me
35b0: 6e 75 73 74 61 74 65 20 74 6f 20 65 6e 61 62 6c  nustate to enabl
35c0: 65 64 20 77 68 65 6e 20 41 4c 4c 20 6f 66 20 69  ed when ALL of i
35d0: 74 73 20 74 61 67 73 20 61 72 65 20 65 6e 61 62  ts tags are enab
35e0: 6c 65 64 2e 0a 0a 20 20 20 20 23 20 46 69 72 73  led...    # Firs
35f0: 74 20 73 65 65 20 69 66 20 74 68 69 73 20 69 73  t see if this is
3600: 20 61 20 72 65 61 6c 20 74 61 67 0a 20 20 20 20   a real tag.    
3610: 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74  if { [info exist
3620: 73 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c  s _widget($path,
3630: 74 61 67 73 74 61 74 65 2c 24 74 61 67 29 5d 20  tagstate,$tag)] 
3640: 7d 20 7b 0a 09 69 66 20 7b 20 21 5b 73 74 72 69  } {..if { ![stri
3650: 6e 67 20 65 71 75 61 6c 20 24 73 74 61 74 65 20  ng equal $state 
3660: 22 64 69 73 61 62 6c 65 64 22 5d 20 7d 20 7b 0a  "disabled"] } {.
3670: 09 20 20 20 20 73 65 74 20 5f 77 69 64 67 65 74  .    set _widget
3680: 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c  ($path,tagstate,
3690: 24 74 61 67 29 20 31 0a 09 7d 20 65 6c 73 65 20  $tag) 1..} else 
36a0: 7b 0a 09 20 20 20 20 73 65 74 20 5f 77 69 64 67  {..    set _widg
36b0: 65 74 28 24 70 61 74 68 2c 74 61 67 73 74 61 74  et($path,tagstat
36c0: 65 2c 24 74 61 67 29 20 30 0a 09 7d 0a 09 66 6f  e,$tag) 0..}..fo
36d0: 72 65 61 63 68 20 7b 6d 65 6e 75 20 65 6e 74 72  reach {menu entr
36e0: 79 7d 20 24 5f 77 69 64 67 65 74 28 24 70 61 74  y} $_widget($pat
36f0: 68 2c 74 61 67 73 2c 24 74 61 67 29 20 7b 0a 09  h,tags,$tag) {..
3700: 20 20 20 20 73 65 74 20 65 78 70 72 65 73 73 69      set expressi
3710: 6f 6e 20 22 31 22 0a 09 20 20 20 20 66 6f 72 65  on "1"..    fore
3720: 61 63 68 20 6d 65 6e 75 74 61 67 20 24 5f 77 69  ach menutag $_wi
3730: 64 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74  dget($path,menut
3740: 61 67 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 20  ags,[list $menu 
3750: 24 65 6e 74 72 79 5d 29 20 7b 0a 09 09 61 70 70  $entry]) {...app
3760: 65 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 22  end expression "
3770: 20 26 26 20 24 5f 77 69 64 67 65 74 28 24 70 61   && $_widget($pa
3780: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 6d 65 6e  th,tagstate,$men
3790: 75 74 61 67 29 22 0a 09 20 20 20 20 7d 0a 09 20  utag)"..    }.. 
37a0: 20 20 20 69 66 20 7b 20 5b 65 78 70 72 20 24 65     if { [expr $e
37b0: 78 70 72 65 73 73 69 6f 6e 5d 20 7d 20 7b 0a 09  xpression] } {..
37c0: 09 73 65 74 20 73 74 61 74 65 20 6e 6f 72 6d 61  .set state norma
37d0: 6c 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  l..    } else {.
37e0: 09 09 73 65 74 20 73 74 61 74 65 20 64 69 73 61  ..set state disa
37f0: 62 6c 65 64 0a 09 20 20 20 20 7d 0a 09 20 20 20  bled..    }..   
3800: 20 24 6d 65 6e 75 20 65 6e 74 72 79 63 6f 6e 66   $menu entryconf
3810: 69 67 75 72 65 20 24 65 6e 74 72 79 20 2d 73 74  igure $entry -st
3820: 61 74 65 20 24 73 74 61 74 65 0a 09 7d 0a 20 20  ate $state..}.  
3830: 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 0a 7d    }.    return.}
3840: 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..# ------------
3850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3890: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
38a0: 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65 6e 75 73  nFrame::getmenus
38b0: 74 61 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  tate.# ---------
38c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
38d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
38e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
38f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3900: 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
3910: 61 6d 65 3a 3a 67 65 74 6d 65 6e 75 73 74 61 74  ame::getmenustat
3920: 65 20 7b 20 70 61 74 68 20 74 61 67 20 7d 20 7b  e { path tag } {
3930: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77  .    variable _w
3940: 69 64 67 65 74 0a 0a 20 20 20 20 69 66 20 7b 24  idget..    if {$
3950: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61  _widget($path,ta
3960: 67 73 74 61 74 65 2c 24 74 61 67 29 7d 20 7b 0a  gstate,$tag)} {.
3970: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e          return n
3980: 6f 72 6d 61 6c 0a 20 20 20 20 7d 20 65 6c 73 65  ormal.    } else
3990: 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72   {.        retur
39a0: 6e 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20 7d  n disabled.    }
39b0: 0a 7d 0a 0a 23 20 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 2d 2d 2d 2d 2d  ----------------
39f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a00: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
3a10: 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e  ainFrame::menuon
3a20: 6c 79 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ly.# -----------
3a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 64 2d 2d 2d 2d  -----------d----
3a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a70: 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d  --.proc MainFram
3a80: 65 3a 3a 6d 65 6e 75 6f 6e 6c 79 20 7b 20 70 61  e::menuonly { pa
3a90: 74 68 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61  th } {.    varia
3aa0: 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20  ble _widget..   
3ab0: 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66 6f 72   catch {pack for
3ac0: 67 65 74 20 24 70 61 74 68 2e 73 65 70 7d 0a 20  get $path.sep}. 
3ad0: 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66     catch {pack f
3ae0: 6f 72 67 65 74 20 24 70 61 74 68 2e 62 6f 74 66  orget $path.botf
3af0: 2e 73 65 70 7d 0a 20 20 20 20 63 61 74 63 68 20  .sep}.    catch 
3b00: 7b 70 61 63 6b 20 66 6f 72 67 65 74 20 24 70 61  {pack forget $pa
3b10: 74 68 2e 66 72 61 6d 65 7d 0a 7d 0a 0a 23 20 2d  th.frame}.}..# -
3b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3b60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
3b70: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
3b80: 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61 72 0a 23 20  ::showtoolbar.# 
3b90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ba0: 2d 2d 2d 2d 2d 2d 2d 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 0a 70 72 6f  ------------.pro
3be0: 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f  c MainFrame::sho
3bf0: 77 74 6f 6f 6c 62 61 72 20 7b 20 70 61 74 68 20  wtoolbar { path 
3c00: 69 6e 64 65 78 20 62 6f 6f 6c 20 7d 20 7b 0a 20  index bool } {. 
3c10: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
3c20: 67 65 74 0a 0a 20 20 20 20 73 65 74 20 74 6f 6f  get..    set too
3c30: 6c 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f 70  lframe $path.top
3c40: 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 69 66  f.f$index.    if
3c50: 20 7b 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 73   { [winfo exists
3c60: 20 24 74 6f 6f 6c 66 72 61 6d 65 5d 20 7d 20 7b   $toolframe] } {
3c70: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 21 24  .        if { !$
3c80: 62 6f 6f 6c 20 26 26 20 5b 6c 6c 65 6e 67 74 68  bool && [llength
3c90: 20 5b 67 72 69 64 20 69 6e 66 6f 20 24 74 6f 6f   [grid info $too
3ca0: 6c 66 72 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20 20  lframe]] } {.   
3cb0: 20 20 20 20 20 20 20 20 20 67 72 69 64 20 66 6f           grid fo
3cc0: 72 67 65 74 20 24 74 6f 6f 6c 66 72 61 6d 65 0a  rget $toolframe.
3cd0: 20 20 20 20 20 20 20 20 20 20 20 20 24 70 61 74              $pat
3ce0: 68 2e 74 6f 70 66 20 63 6f 6e 66 69 67 75 72 65  h.topf configure
3cf0: 20 2d 68 65 69 67 68 74 20 31 0a 20 20 20 20 20   -height 1.     
3d00: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 20 24 62     } elseif { $b
3d10: 6f 6f 6c 20 26 26 20 21 5b 6c 6c 65 6e 67 74 68  ool && ![llength
3d20: 20 5b 67 72 69 64 20 69 6e 66 6f 20 24 74 6f 6f   [grid info $too
3d30: 6c 66 72 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20 20  lframe]] } {.   
3d40: 20 20 20 20 20 20 20 20 20 67 72 69 64 20 24 74           grid $t
3d50: 6f 6f 6c 66 72 61 6d 65 20 2d 63 6f 6c 75 6d 6e  oolframe -column
3d60: 20 30 20 2d 72 6f 77 20 24 69 6e 64 65 78 20 2d   0 -row $index -
3d70: 73 74 69 63 6b 79 20 65 77 0a 20 20 20 20 20 20  sticky ew.      
3d80: 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20    }.    }.}...# 
3d90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3da0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
3de0: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
3df0: 65 3a 3a 73 68 6f 77 73 74 61 74 75 73 62 61 72  e::showstatusbar
3e00: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
3e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
3e50: 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  proc MainFrame::
3e60: 73 68 6f 77 73 74 61 74 75 73 62 61 72 20 7b 20  showstatusbar { 
3e70: 70 61 74 68 20 6e 61 6d 65 20 7d 20 7b 0a 20 20  path name } {.  
3e80: 20 20 73 65 74 20 73 74 61 74 75 73 20 24 70 61    set status $pa
3e90: 74 68 2e 73 74 61 74 75 73 0a 20 20 20 20 73 65  th.status.    se
3ea0: 74 20 62 6f 74 66 72 61 6d 65 20 24 70 61 74 68  t botframe $path
3eb0: 2e 62 6f 74 66 0a 20 20 20 20 69 66 20 7b 20 5b  .botf.    if { [
3ec0: 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 6e 61  string equal $na
3ed0: 6d 65 20 22 6e 6f 6e 65 22 5d 20 7d 20 7b 0a 20  me "none"] } {. 
3ee0: 20 20 20 20 20 20 20 70 61 63 6b 20 66 6f 72 67         pack forg
3ef0: 65 74 20 24 73 74 61 74 75 73 0a 20 20 20 20 7d  et $status.    }
3f00: 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20   else {.        
3f10: 70 61 63 6b 20 24 73 74 61 74 75 73 20 2d 66 69  pack $status -fi
3f20: 6c 6c 20 78 20 2d 69 6e 20 24 62 6f 74 66 72 61  ll x -in $botfra
3f30: 6d 65 20 2d 66 69 6c 6c 20 78 20 2d 70 61 64 79  me -fill x -pady
3f40: 20 32 0a 20 20 20 20 20 20 20 20 73 77 69 74 63   2.        switc
3f50: 68 20 2d 2d 20 24 6e 61 6d 65 20 7b 0a 20 20 20  h -- $name {.   
3f60: 20 20 20 20 20 20 20 20 20 73 74 61 74 75 73 20           status 
3f70: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  {.              
3f80: 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66 6f    catch {pack fo
3f90: 72 67 65 74 20 24 73 74 61 74 75 73 2e 70 72 67  rget $status.prg
3fa0: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a  }.            }.
3fb0: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 67              prog
3fc0: 72 65 73 73 69 6f 6e 20 7b 0a 20 20 20 20 20 20  ression {.      
3fd0: 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 20 24            pack $
3fe0: 73 74 61 74 75 73 2e 70 72 67 20 2d 69 6e 20 24  status.prg -in $
3ff0: 73 74 61 74 75 73 2e 70 72 67 66 0a 20 20 20 20  status.prgf.    
4000: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20          }.      
4010: 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20    }.    }.}...# 
4020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
4070: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
4080: 65 3a 3a 5f 64 65 73 74 72 6f 79 0a 23 20 2d 2d  e::_destroy.# --
4090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
40e0: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73 74  MainFrame::_dest
40f0: 72 6f 79 20 7b 20 70 61 74 68 20 7d 20 7b 0a 20  roy { path } {. 
4100: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
4110: 67 65 74 0a 0a 20 20 20 20 57 69 64 67 65 74 3a  get..    Widget:
4120: 3a 64 65 73 74 72 6f 79 20 24 70 61 74 68 0a 20  :destroy $path. 
4130: 20 20 20 63 61 74 63 68 20 7b 64 65 73 74 72 6f     catch {destro
4140: 79 20 5b 24 5f 77 69 64 67 65 74 28 24 70 61 74  y [$_widget($pat
4150: 68 2c 74 6f 70 29 20 63 67 65 74 20 2d 6d 65 6e  h,top) cget -men
4160: 75 5d 7d 0a 20 20 20 20 24 5f 77 69 64 67 65 74  u]}.    $_widget
4170: 28 24 70 61 74 68 2c 74 6f 70 29 20 63 6f 6e 66  ($path,top) conf
4180: 69 67 75 72 65 20 2d 6d 65 6e 75 20 7b 7d 0a 0a  igure -menu {}..
4190: 20 20 20 20 23 20 55 6e 73 65 74 20 61 6c 6c 20      # Unset all 
41a0: 6f 66 20 74 68 65 20 73 74 61 74 65 20 76 61 72  of the state var
41b0: 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74  s associated wit
41c0: 68 20 74 68 69 73 20 6d 61 69 6e 20 66 72 61 6d  h this main fram
41d0: 65 2e 0a 20 20 20 20 66 6f 72 65 61 63 68 20 69  e..    foreach i
41e0: 6e 64 65 78 20 5b 61 72 72 61 79 20 6e 61 6d 65  ndex [array name
41f0: 73 20 5f 77 69 64 67 65 74 20 24 70 61 74 68 2c  s _widget $path,
4200: 2a 5d 20 7b 0a 09 75 6e 73 65 74 20 5f 77 69 64  *] {..unset _wid
4210: 67 65 74 28 24 69 6e 64 65 78 29 0a 20 20 20 20  get($index).    
4220: 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  }.}...# --------
4230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4270: 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
4280: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61  MainFrame::_crea
4290: 74 65 5f 6d 65 6e 75 62 61 72 0a 23 20 2d 2d 2d  te_menubar.# ---
42a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
42b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
42c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
42d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
42e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 46 6f 72 20  ---------.# For 
42f0: 41 6e 64 72 6f 69 64 2c 20 61 20 6d 65 6e 75 62  Android, a menub
4300: 75 74 74 6f 6e 20 69 73 20 6d 6f 72 65 20 61 70  utton is more ap
4310: 70 72 6f 70 72 69 61 74 65 2e 0a 23 20 54 6f 20  propriate..# To 
4320: 73 75 70 70 6f 72 74 20 74 68 69 73 2c 20 74 68  support this, th
4330: 65 20 6d 65 6e 75 62 75 74 74 6f 6e 20 77 69 64  e menubutton wid
4340: 67 65 74 20 6d 61 79 20 62 65 20 70 61 73 73 65  get may be passe
4350: 64 20 61 73 20 33 72 64 0a 23 20 70 61 72 61 6d  d as 3rd.# param
4360: 65 74 65 72 2e 0a 70 72 6f 63 20 4d 61 69 6e 46  eter..proc MainF
4370: 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 6d 65  rame::_create_me
4380: 6e 75 62 61 72 20 7b 20 70 61 74 68 20 64 65 73  nubar { path des
4390: 63 6d 65 6e 75 20 7b 74 6f 70 20 22 22 7d 20 7d  cmenu {top ""} }
43a0: 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20   {.    variable 
43b0: 5f 77 69 64 67 65 74 0a 20 20 20 20 67 6c 6f 62  _widget.    glob
43c0: 61 6c 20 20 20 20 74 63 6c 5f 70 6c 61 74 66 6f  al    tcl_platfo
43d0: 72 6d 0a 0a 20 20 20 20 69 66 20 7b 21 5b 73 74  rm..    if {![st
43e0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 74 6f 70  ring length $top
43f0: 5d 7d 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74  ]} {.        set
4400: 20 74 6f 70 20 24 5f 77 69 64 67 65 74 28 24 70   top $_widget($p
4410: 61 74 68 2c 74 6f 70 29 0a 20 20 20 20 7d 0a 0a  ath,top).    }..
4420: 20 20 20 20 66 6f 72 65 61 63 68 20 7b 76 20 78      foreach {v x
4430: 7d 20 7b 6d 62 66 6e 74 20 2d 6d 65 6e 75 62 61  } {mbfnt -menuba
4440: 72 66 6f 6e 74 20 6d 65 66 6e 74 20 2d 6d 65 6e  rfont mefnt -men
4450: 75 65 6e 74 72 79 66 6f 6e 74 7d 20 7b 0a 09 69  uentryfont} {..i
4460: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74  f {[string lengt
4470: 68 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70  h [Widget::getop
4480: 74 69 6f 6e 20 24 70 61 74 68 20 24 78 5d 5d 7d  tion $path $x]]}
4490: 20 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20 5b   {..    set $v [
44a0: 6c 69 73 74 20 2d 66 6f 6e 74 20 5b 57 69 64 67  list -font [Widg
44b0: 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70  et::getoption $p
44c0: 61 74 68 20 24 78 5d 5d 0a 09 7d 20 65 6c 73 65  ath $x]]..} else
44d0: 20 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20 22   {..    set $v "
44e0: 22 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  "..}.    }..    
44f0: 69 66 20 7b 20 21 5b 57 69 64 67 65 74 3a 3a 74  if { ![Widget::t
4500: 68 65 6d 65 5d 20 26 26 20 24 74 63 6c 5f 70 6c  heme] && $tcl_pl
4510: 61 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29  atform(platform)
4520: 20 3d 3d 20 22 75 6e 69 78 22 0a 20 20 20 20 20   == "unix".     
4530: 20 20 20 26 26 20 5b 74 6b 20 77 69 6e 64 6f 77     && [tk window
4540: 69 6e 67 73 79 73 74 65 6d 5d 20 21 3d 22 61 71  ingsystem] !="aq
4550: 75 61 22 20 7d 20 7b 0a 09 73 65 74 20 6d 65 6e  ua" } {..set men
4560: 75 6f 70 74 73 20 5b 6c 69 73 74 20 2d 62 61 63  uopts [list -bac
4570: 6b 67 72 6f 75 6e 64 20 5b 57 69 64 67 65 74 3a  kground [Widget:
4580: 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68  :getoption $path
4590: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 5d 20 5c 0a   -background] \.
45a0: 09 09 09 20 20 2d 62 6f 72 64 65 72 77 69 64 74  ...  -borderwidt
45b0: 68 20 31 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20  h 1].    } else 
45c0: 7b 0a 09 73 65 74 20 6d 65 6e 75 6f 70 74 73 20  {..set menuopts 
45d0: 5b 6c 69 73 74 5d 0a 20 20 20 20 7d 0a 20 20 20  [list].    }.   
45e0: 20 73 65 74 20 6d 65 6e 75 62 61 72 20 5b 65 76   set menubar [ev
45f0: 61 6c 20 5b 6c 69 73 74 20 6d 65 6e 75 20 24 74  al [list menu $t
4600: 6f 70 2e 6d 65 6e 75 62 61 72 20 2d 74 65 61 72  op.menubar -tear
4610: 6f 66 66 20 30 5d 20 24 6d 65 6e 75 6f 70 74 73  off 0] $menuopts
4620: 20 24 6d 62 66 6e 74 5d 0a 20 20 20 20 24 74 6f   $mbfnt].    $to
4630: 70 20 63 6f 6e 66 69 67 75 72 65 20 2d 6d 65 6e  p configure -men
4640: 75 20 24 6d 65 6e 75 62 61 72 0a 0a 20 20 20 20  u $menubar..    
4650: 73 65 74 20 63 6f 75 6e 74 20 30 0a 20 20 20 20  set count 0.    
4660: 66 6f 72 65 61 63 68 20 7b 6e 61 6d 65 20 74 61  foreach {name ta
4670: 67 73 20 6d 65 6e 75 69 64 20 74 65 61 72 6f 66  gs menuid tearof
4680: 66 20 65 6e 74 72 69 65 73 7d 20 24 64 65 73 63  f entries} $desc
4690: 6d 65 6e 75 20 7b 0a 20 20 20 20 20 20 20 20 23  menu {.        #
46a0: 20 43 68 65 63 6b 20 69 66 20 6f 6e 6c 79 20 6f   Check if only o
46b0: 6e 65 20 6d 65 6e 75 20 77 69 74 68 20 61 6e 20  ne menu with an 
46c0: 65 6d 70 74 79 20 6e 61 6d 65 20 69 73 20 67 69  empty name is gi
46d0: 76 65 6e 0a 20 20 20 20 20 20 20 20 23 20 49 6e  ven.        # In
46e0: 20 74 68 69 73 20 63 61 73 65 2c 20 72 65 6d 6f   this case, remo
46f0: 76 65 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c  ve the top level
4700: 20 6d 65 6e 75 20 69 74 65 6d 0a 20 20 20 20 20   menu item.     
4710: 20 20 20 23 20 54 68 69 73 20 61 6c 6c 6f 77 73     # This allows
4720: 20 74 6f 20 61 6c 73 6f 20 68 61 76 65 20 63 68   to also have ch
4730: 65 63 6b 62 6f 78 65 73 20 61 6e 64 20 63 6f 6d  eckboxes and com
4740: 6d 61 6e 64 73 20 61 74 20 74 68 65 20 74 6f 70  mands at the top
4750: 20 6c 65 76 65 6c 2e 0a 20 20 20 20 20 20 20 20   level..        
4760: 69 66 20 7b 21 5b 73 74 72 69 6e 67 20 6c 65 6e  if {![string len
4770: 67 74 68 20 24 6e 61 6d 65 5d 20 26 26 20 35 20  gth $name] && 5 
4780: 3d 3d 20 5b 6c 6c 65 6e 67 74 68 20 24 64 65 73  == [llength $des
4790: 63 6d 65 6e 75 5d 7d 20 7b 0a 20 20 20 20 20 20  cmenu]} {.      
47a0: 20 20 20 20 20 20 23 20 41 20 73 69 6e 67 6c 65        # A single
47b0: 20 6e 61 6d 65 73 6c 65 73 73 20 6d 65 6e 75 20   namesless menu 
47c0: 2d 20 73 6b 69 70 20 74 68 65 20 66 69 72 73 74  - skip the first
47d0: 20 6c 65 76 65 6c 20 74 6f 20 61 6c 6c 6f 77 20   level to allow 
47e0: 6f 74 68 65 72 0a 20 20 20 20 20 20 20 20 20 20  other.          
47f0: 20 20 23 20 74 68 61 6e 20 63 61 73 63 61 64 65    # than cascade
4800: 20 61 73 20 66 69 72 73 74 20 6c 65 76 65 6c 2e   as first level.
4810: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74  .            set
4820: 20 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 0a 20   menu $menubar. 
4830: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a         } else {.
4840: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20              set 
4850: 6f 70 74 20 20 5b 5f 70 61 72 73 65 5f 6e 61 6d  opt  [_parse_nam
4860: 65 20 24 6e 61 6d 65 5d 0a 20 20 20 20 20 20 20  e $name].       
4870: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67       if {[string
4880: 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75 69 64 5d   length $menuid]
4890: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
48a0: 20 20 20 20 20 26 26 20 21 5b 69 6e 66 6f 20 65       && ![info e
48b0: 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70  xists _widget($p
48c0: 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75  ath,menuid,$menu
48d0: 69 64 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  id)] } {.       
48e0: 20 20 20 20 20 20 20 20 20 23 20 6d 65 6e 75 20           # menu 
48f0: 68 61 73 20 69 64 65 6e 74 69 66 69 65 72 0a 20  has identifier. 
4900: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23                 #
4910: 20 77 65 20 75 73 65 20 69 74 20 66 6f 72 20 69   we use it for i
4920: 74 73 20 70 61 74 68 6e 61 6d 65 2c 20 74 6f 20  ts pathname, to 
4930: 65 6e 61 62 6c 65 20 73 70 65 63 69 61 6c 20 6d  enable special m
4940: 65 6e 75 20 65 6e 74 72 69 65 73 0a 20 20 20 20  enu entries.    
4950: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 28 68              # (h
4960: 65 6c 70 2c 20 73 79 73 74 65 6d 2c 20 2e 2e 2e  elp, system, ...
4970: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ).              
4980: 20 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e 75    set menu $menu
4990: 62 61 72 2e 24 6d 65 6e 75 69 64 0a 20 20 20 20  bar.$menuid.    
49a0: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b          } else {
49b0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
49c0: 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e 75 62   set menu $menub
49d0: 61 72 2e 6d 65 6e 75 24 63 6f 75 6e 74 0a 20 20  ar.menu$count.  
49e0: 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20            }.    
49f0: 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69          eval [li
4a00: 73 74 20 24 6d 65 6e 75 62 61 72 20 61 64 64 20  st $menubar add 
4a10: 63 61 73 63 61 64 65 5d 20 24 6f 70 74 20 5b 6c  cascade] $opt [l
4a20: 69 73 74 20 2d 6d 65 6e 75 20 24 6d 65 6e 75 5d  ist -menu $menu]
4a30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 65 76 61  .            eva
4a40: 6c 20 5b 6c 69 73 74 20 6d 65 6e 75 20 24 6d 65  l [list menu $me
4a50: 6e 75 20 2d 74 65 61 72 6f 66 66 20 24 74 65 61  nu -tearoff $tea
4a60: 72 6f 66 66 5d 20 24 6d 65 6e 75 6f 70 74 73 20  roff] $menuopts 
4a70: 24 6d 65 66 6e 74 0a 20 20 20 20 20 20 20 20 20  $mefnt.         
4a80: 20 20 20 66 6f 72 65 61 63 68 20 74 61 67 20 24     foreach tag $
4a90: 74 61 67 73 20 7b 0a 20 20 20 20 20 20 20 20 20  tags {.         
4aa0: 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 5f         lappend _
4ab0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
4ac0: 73 2c 24 74 61 67 29 20 24 6d 65 6e 75 62 61 72  s,$tag) $menubar
4ad0: 20 24 63 6f 75 6e 74 0a 20 20 20 20 20 20 20 20   $count.        
4ae0: 20 20 20 20 20 20 20 20 23 20 65 72 69 63 6d 40          # [email protected]
4af0: 73 63 72 69 70 74 69 63 73 3a 20 20 41 64 64 20  scriptics:  Add 
4b00: 61 20 74 61 67 73 74 61 74 65 20 74 72 61 63 6b  a tagstate track
4b10: 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  er.             
4b20: 20 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f 20 65     if { ![info e
4b30: 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70  xists _widget($p
4b40: 61 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61  ath,tagstate,$ta
4b50: 67 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  g)] } {.        
4b60: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20              set 
4b70: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61  _widget($path,ta
4b80: 67 73 74 61 74 65 2c 24 74 61 67 29 20 31 0a 20  gstate,$tag) 1. 
4b90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d                 }
4ba0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20  .            }. 
4bb0: 20 20 20 20 20 20 20 20 20 20 20 23 20 65 72 69             # eri
4bc0: 63 6d 40 73 63 72 69 70 74 69 63 73 3a 20 20 41  [email protected]:  A
4bd0: 64 64 20 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20  dd mapping from 
4be0: 6d 65 6e 75 20 69 74 65 6d 73 20 74 6f 20 74 61  menu items to ta
4bf0: 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 73  gs.            s
4c00: 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  et _widget($path
4c10: 2c 6d 65 6e 75 74 61 67 73 2c 5b 6c 69 73 74 20  ,menutags,[list 
4c20: 24 6d 65 6e 75 62 61 72 20 24 63 6f 75 6e 74 5d  $menubar $count]
4c30: 29 20 24 74 61 67 73 0a 0a 20 20 20 20 20 20 20  ) $tags..       
4c40: 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69 6e       if { [strin
4c50: 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75 69 64  g length $menuid
4c60: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
4c70: 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68 61 73        # menu has
4c80: 20 69 64 65 6e 74 69 66 69 65 72 0a 20 20 20 20   identifier.    
4c90: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20              set 
4ca0: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65  _widget($path,me
4cb0: 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 20 24 6d  nuid,$menuid) $m
4cc0: 65 6e 75 0a 20 20 20 20 20 20 20 20 20 20 20 20  enu.            
4cd0: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  }.        }.    
4ce0: 20 20 20 20 5f 63 72 65 61 74 65 5f 65 6e 74 72      _create_entr
4cf0: 69 65 73 20 24 70 61 74 68 20 24 6d 65 6e 75 20  ies $path $menu 
4d00: 24 6d 65 6e 75 6f 70 74 73 20 24 65 6e 74 72 69  $menuopts $entri
4d10: 65 73 0a 20 20 20 20 20 20 20 20 69 6e 63 72 20  es.        incr 
4d20: 63 6f 75 6e 74 0a 20 20 20 20 7d 0a 7d 0a 0a 0a  count.    }.}...
4d30: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
4d40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4d50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4d60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4d70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
4d80: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
4d90: 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74  ame::_create_ent
4da0: 72 69 65 73 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  ries.# ---------
4db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4dc0: 2d 2d 2d 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 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
4e00: 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74 72  me::_create_entr
4e10: 69 65 73 20 7b 20 70 61 74 68 20 6d 65 6e 75 20  ies { path menu 
4e20: 6d 65 6e 75 6f 70 74 73 20 65 6e 74 72 69 65 73  menuopts entries
4e30: 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c   } {.    variabl
4e40: 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73  e _widget..    s
4e50: 65 74 20 63 6f 75 6e 74 20 20 20 20 20 20 5b 24  et count      [$
4e60: 6d 65 6e 75 20 63 67 65 74 20 2d 74 65 61 72 6f  menu cget -tearo
4e70: 66 66 5d 0a 20 20 20 20 73 65 74 20 72 65 67 69  ff].    set regi
4e80: 73 74 65 72 65 64 20 30 0a 20 20 20 20 66 6f 72  stered 0.    for
4e90: 65 61 63 68 20 65 6e 74 72 79 20 24 65 6e 74 72  each entry $entr
4ea0: 69 65 73 20 7b 0a 20 20 20 20 20 20 20 20 73 65  ies {.        se
4eb0: 74 20 6c 65 6e 20 20 5b 6c 6c 65 6e 67 74 68 20  t len  [llength 
4ec0: 24 65 6e 74 72 79 5d 0a 20 20 20 20 20 20 20 20  $entry].        
4ed0: 73 65 74 20 74 79 70 65 20 5b 6c 69 6e 64 65 78  set type [lindex
4ee0: 20 24 65 6e 74 72 79 20 30 5d 0a 0a 20 20 20 20   $entry 0]..    
4ef0: 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69 6e 67      if { [string
4f00: 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 73 65   equal $type "se
4f10: 70 61 72 61 74 6f 72 22 5d 20 7d 20 7b 0a 20 20  parator"] } {.  
4f20: 20 20 20 20 20 20 20 20 20 20 24 6d 65 6e 75 20            $menu 
4f30: 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20  add separator.  
4f40: 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 63            incr c
4f50: 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20  ount.           
4f60: 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20   continue.      
4f70: 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 65    }..        # e
4f80: 6e 74 72 79 20 6e 61 6d 65 20 61 6e 64 20 74 61  ntry name and ta
4f90: 67 73 0a 20 20 20 20 20 20 20 20 73 65 74 20 6f  gs.        set o
4fa0: 70 74 20 20 5b 5f 70 61 72 73 65 5f 6e 61 6d 65  pt  [_parse_name
4fb0: 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20   [lindex $entry 
4fc0: 31 5d 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20  1]].        set 
4fd0: 74 61 67 73 20 5b 6c 69 6e 64 65 78 20 24 65 6e  tags [lindex $en
4fe0: 74 72 79 20 32 5d 0a 20 20 20 20 20 20 20 20 66  try 2].        f
4ff0: 6f 72 65 61 63 68 20 74 61 67 20 24 74 61 67 73  oreach tag $tags
5000: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c   {.            l
5010: 61 70 70 65 6e 64 20 5f 77 69 64 67 65 74 28 24  append _widget($
5020: 70 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20  path,tags,$tag) 
5030: 24 6d 65 6e 75 20 24 63 6f 75 6e 74 0a 09 20 20  $menu $count..  
5040: 20 20 23 20 65 72 69 63 6d 40 73 63 72 69 70 74    # [email protected]
5050: 69 63 73 3a 20 20 41 64 64 20 61 20 74 61 67 73  ics:  Add a tags
5060: 74 61 74 65 20 74 72 61 63 6b 65 72 0a 09 20 20  tate tracker..  
5070: 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f 20 65 78    if { ![info ex
5080: 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70 61  ists _widget($pa
5090: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67  th,tagstate,$tag
50a0: 29 5d 20 7d 20 7b 0a 09 09 73 65 74 20 5f 77 69  )] } {...set _wi
50b0: 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74  dget($path,tagst
50c0: 61 74 65 2c 24 74 61 67 29 20 31 0a 09 20 20 20  ate,$tag) 1..   
50d0: 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 09 23 20   }.        }..# 
50e0: 65 72 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a  [email protected]:
50f0: 20 20 41 64 64 20 6d 61 70 70 69 6e 67 20 66 72    Add mapping fr
5100: 6f 6d 20 6d 65 6e 75 20 69 74 65 6d 73 20 74 6f  om menu items to
5110: 20 74 61 67 73 0a 09 73 65 74 20 5f 77 69 64 67   tags..set _widg
5120: 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74 61 67  et($path,menutag
5130: 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 20 24 63  s,[list $menu $c
5140: 6f 75 6e 74 5d 29 20 24 74 61 67 73 0a 0a 20 20  ount]) $tags..  
5150: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e        if {[strin
5160: 67 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 63  g equal $type "c
5170: 61 73 63 61 64 65 22 5d 20 7c 7c 20 5b 73 74 72  ascade"] || [str
5180: 69 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65 20  ing equal $type 
5190: 22 63 61 73 63 61 64 22 5d 7d 20 7b 0a 20 20 20  "cascad"]} {.   
51a0: 20 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6e           set men
51b0: 75 69 64 20 20 5b 6c 69 6e 64 65 78 20 24 65 6e  uid  [lindex $en
51c0: 74 72 79 20 33 5d 0a 20 20 20 20 20 20 20 20 20  try 3].         
51d0: 20 20 20 73 65 74 20 74 65 61 72 6f 66 66 20 5b     set tearoff [
51e0: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 34 5d  lindex $entry 4]
51f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74  .            set
5200: 20 73 75 62 6d 65 6e 75 20 24 6d 65 6e 75 2e 6d   submenu $menu.m
5210: 65 6e 75 24 63 6f 75 6e 74 0a 20 20 20 20 20 20  enu$count.      
5220: 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74        eval [list
5230: 20 24 6d 65 6e 75 20 61 64 64 20 63 61 73 63 61   $menu add casca
5240: 64 65 5d 20 24 6f 70 74 20 5b 6c 69 73 74 20 2d  de] $opt [list -
5250: 6d 65 6e 75 20 24 73 75 62 6d 65 6e 75 5d 0a 20  menu $submenu]. 
5260: 20 20 20 20 20 20 20 20 20 20 20 65 76 61 6c 20             eval 
5270: 5b 6c 69 73 74 20 6d 65 6e 75 20 24 73 75 62 6d  [list menu $subm
5280: 65 6e 75 20 2d 74 65 61 72 6f 66 66 20 24 74 65  enu -tearoff $te
5290: 61 72 6f 66 66 5d 20 24 6d 65 6e 75 6f 70 74 73  aroff] $menuopts
52a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20  .            if 
52b0: 7b 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68  { [string length
52c0: 20 24 6d 65 6e 75 69 64 5d 20 7d 20 7b 0a 20 20   $menuid] } {.  
52d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20                # 
52e0: 6d 65 6e 75 20 68 61 73 20 69 64 65 6e 74 69 66  menu has identif
52f0: 69 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20  ier.            
5300: 20 20 20 20 73 65 74 20 5f 77 69 64 67 65 74 28      set _widget(
5310: 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65  $path,menuid,$me
5320: 6e 75 69 64 29 20 24 73 75 62 6d 65 6e 75 0a 20  nuid) $submenu. 
5330: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20             }.   
5340: 20 20 20 20 20 20 20 20 20 5f 63 72 65 61 74 65           _create
5350: 5f 65 6e 74 72 69 65 73 20 24 70 61 74 68 20 24  _entries $path $
5360: 73 75 62 6d 65 6e 75 20 24 6d 65 6e 75 6f 70 74  submenu $menuopt
5370: 73 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79  s [lindex $entry
5380: 20 35 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20   5].            
5390: 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20 20 20  incr count.     
53a0: 20 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 0a         continue.
53b0: 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20          }..     
53c0: 20 20 20 23 20 65 6e 74 72 79 20 68 65 6c 70 20     # entry help 
53d0: 64 65 73 63 72 69 70 74 69 6f 6e 0a 20 20 20 20  description.    
53e0: 20 20 20 20 73 65 74 20 64 65 73 63 20 5b 6c 69      set desc [li
53f0: 6e 64 65 78 20 24 65 6e 74 72 79 20 33 5d 0a 20  ndex $entry 3]. 
5400: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72         if { [str
5410: 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 65 73 63  ing length $desc
5420: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
5430: 20 20 69 66 20 7b 20 21 24 72 65 67 69 73 74 65    if { !$registe
5440: 72 65 64 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  red } {.        
5450: 20 20 20 20 20 20 20 20 44 79 6e 61 6d 69 63 48          DynamicH
5460: 65 6c 70 3a 3a 72 65 67 69 73 74 65 72 20 24 6d  elp::register $m
5470: 65 6e 75 20 6d 65 6e 75 20 5b 57 69 64 67 65 74  enu menu [Widget
5480: 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74  ::getoption $pat
5490: 68 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 5d  h -textvariable]
54a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
54b0: 20 73 65 74 20 72 65 67 69 73 74 65 72 65 64 20   set registered 
54c0: 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a  1.            }.
54d0: 20 20 20 20 20 20 20 20 20 20 20 20 44 79 6e 61              Dyna
54e0: 6d 69 63 48 65 6c 70 3a 3a 72 65 67 69 73 74 65  micHelp::registe
54f0: 72 20 24 6d 65 6e 75 20 6d 65 6e 75 65 6e 74 72  r $menu menuentr
5500: 79 20 24 63 6f 75 6e 74 20 24 64 65 73 63 0a 20  y $count $desc. 
5510: 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20         }..      
5520: 20 20 23 20 65 6e 74 72 79 20 61 63 63 65 6c 65    # entry accele
5530: 72 61 74 6f 72 0a 20 20 20 20 20 20 20 20 73 65  rator.        se
5540: 74 20 61 63 63 65 6c 20 5b 5f 70 61 72 73 65 5f  t accel [_parse_
5550: 61 63 63 65 6c 65 72 61 74 6f 72 20 5b 6c 69 6e  accelerator [lin
5560: 64 65 78 20 24 65 6e 74 72 79 20 34 5d 5d 0a 20  dex $entry 4]]. 
5570: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 6c 6c 65         if { [lle
5580: 6e 67 74 68 20 24 61 63 63 65 6c 5d 20 7d 20 7b  ngth $accel] } {
5590: 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70  .            lap
55a0: 70 65 6e 64 20 6f 70 74 20 2d 61 63 63 65 6c 65  pend opt -accele
55b0: 72 61 74 6f 72 20 5b 6c 69 6e 64 65 78 20 24 61  rator [lindex $a
55c0: 63 63 65 6c 20 30 5d 0a 20 20 20 20 20 20 20 20  ccel 0].        
55d0: 20 20 20 20 66 6f 72 65 61 63 68 20 65 76 65 6e      foreach even
55e0: 74 20 5b 6c 69 6e 64 65 78 20 24 61 63 63 65 6c  t [lindex $accel
55f0: 20 31 5d 20 7b 0a 20 20 20 20 20 20 20 20 20 20   1] {.          
5600: 20 20 20 20 20 20 62 69 6e 64 20 24 5f 77 69 64        bind $_wid
5610: 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 24  get($path,top) $
5620: 65 76 65 6e 74 20 5b 6c 69 73 74 20 24 6d 65 6e  event [list $men
5630: 75 20 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 5d  u invoke $count]
5640: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20  .            }. 
5650: 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61             forea
5660: 63 68 20 65 76 65 6e 74 20 5b 6c 69 6e 64 65 78  ch event [lindex
5670: 20 24 61 63 63 65 6c 20 32 5d 20 7b 0a 20 20 20   $accel 2] {.   
5680: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20               if 
5690: 7b 5b 62 69 6e 64 20 24 5f 77 69 64 67 65 74 28  {[bind $_widget(
56a0: 24 70 61 74 68 2c 74 6f 70 29 20 24 65 76 65 6e  $path,top) $even
56b0: 74 5d 20 3d 3d 20 7b 7d 7d 20 7b 0a 20 20 20 20  t] == {}} {.    
56c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
56d0: 62 69 6e 64 20 24 5f 77 69 64 67 65 74 28 24 70  bind $_widget($p
56e0: 61 74 68 2c 74 6f 70 29 20 24 65 76 65 6e 74 20  ath,top) $event 
56f0: 7b 20 23 20 64 6f 20 6e 6f 74 68 69 6e 67 20 7d  { # do nothing }
5700: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
5710: 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20   } else {.      
5720: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20                # 
5730: 54 68 65 20 65 78 69 73 74 69 6e 67 20 62 69 6e  The existing bin
5740: 64 69 6e 67 20 77 69 6c 6c 20 69 6e 74 65 72 63  ding will interc
5750: 65 70 74 20 74 68 65 73 65 20 65 76 65 6e 74 73  ept these events
5760: 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ..              
5770: 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20    }.            
5780: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20  }.        }..   
5790: 20 20 20 20 20 23 20 75 73 65 72 20 6f 70 74 69       # user opti
57a0: 6f 6e 73 0a 20 20 20 20 20 20 20 20 73 65 74 20  ons.        set 
57b0: 75 73 65 72 6f 70 74 20 5b 6c 72 61 6e 67 65 20  useropt [lrange 
57c0: 24 65 6e 74 72 79 20 35 20 65 6e 64 5d 0a 20 20  $entry 5 end].  
57d0: 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69        if { [stri
57e0: 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65 20 22  ng equal $type "
57f0: 63 6f 6d 6d 61 6e 64 22 5d 20 7c 7c 0a 20 20 20  command"] ||.   
5800: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e            [strin
5810: 67 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 72  g equal $type "r
5820: 61 64 69 6f 62 75 74 74 6f 6e 22 5d 20 7c 7c 0a  adiobutton"] ||.
5830: 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74               [st
5840: 72 69 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65  ring equal $type
5850: 20 22 63 68 65 63 6b 62 75 74 74 6f 6e 22 5d 20   "checkbutton"] 
5860: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
5870: 65 76 61 6c 20 5b 6c 69 73 74 20 24 6d 65 6e 75  eval [list $menu
5880: 20 61 64 64 20 24 74 79 70 65 5d 20 24 6f 70 74   add $type] $opt
5890: 20 24 75 73 65 72 6f 70 74 0a 20 20 20 20 20 20   $useropt.      
58a0: 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20    } else {.     
58b0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63         return -c
58c0: 6f 64 65 20 65 72 72 6f 72 20 22 69 6e 76 61 6c  ode error "inval
58d0: 69 64 20 6d 65 6e 75 20 74 79 70 65 20 5c 22 24  id menu type \"$
58e0: 74 79 70 65 5c 22 22 0a 20 20 20 20 20 20 20 20  type\"".        
58f0: 7d 0a 20 20 20 20 20 20 20 20 69 6e 63 72 20 63  }.        incr c
5900: 6f 75 6e 74 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23  ount.    }.}...#
5910: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
5920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
5960: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
5970: 6d 65 3a 3a 5f 70 61 72 73 65 5f 6e 61 6d 65 0a  me::_parse_name.
5980: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
5990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
59a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
59b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
59c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70  --------------.p
59d0: 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f  roc MainFrame::_
59e0: 70 61 72 73 65 5f 6e 61 6d 65 20 7b 20 6d 65 6e  parse_name { men
59f0: 75 6e 61 6d 65 20 7d 20 7b 0a 20 20 20 20 73 65  uname } {.    se
5a00: 74 20 69 64 78 20 5b 73 74 72 69 6e 67 20 66 69  t idx [string fi
5a10: 72 73 74 20 22 26 22 20 24 6d 65 6e 75 6e 61 6d  rst "&" $menunam
5a20: 65 5d 0a 20 20 20 20 69 66 20 7b 20 24 69 64 78  e].    if { $idx
5a30: 20 3d 3d 20 2d 31 20 7d 20 7b 0a 20 20 20 20 20   == -1 } {.     
5a40: 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20     return [list 
5a50: 2d 6c 61 62 65 6c 20 24 6d 65 6e 75 6e 61 6d 65  -label $menuname
5a60: 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20  ].    } else {. 
5a70: 20 20 20 20 20 20 20 73 65 74 20 62 65 67 20 5b         set beg [
5a80: 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24 6d 65  string range $me
5a90: 6e 75 6e 61 6d 65 20 30 20 5b 65 78 70 72 20 7b  nuname 0 [expr {
5aa0: 24 69 64 78 2d 31 7d 5d 5d 0a 20 20 20 20 20 20  $idx-1}]].      
5ab0: 20 20 73 65 74 20 65 6e 64 20 5b 73 74 72 69 6e    set end [strin
5ac0: 67 20 72 61 6e 67 65 20 24 6d 65 6e 75 6e 61 6d  g range $menunam
5ad0: 65 20 5b 65 78 70 72 20 7b 24 69 64 78 2b 31 7d  e [expr {$idx+1}
5ae0: 5d 20 65 6e 64 5d 0a 20 20 20 20 20 20 20 20 61  ] end].        a
5af0: 70 70 65 6e 64 20 62 65 67 20 24 65 6e 64 0a 20  ppend beg $end. 
5b00: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c         return [l
5b10: 69 73 74 20 2d 6c 61 62 65 6c 20 24 62 65 67 20  ist -label $beg 
5b20: 2d 75 6e 64 65 72 6c 69 6e 65 20 24 69 64 78 5d  -underline $idx]
5b30: 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 4d 61 69  .    }.}...# Mai
5b40: 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 61  nFrame::_parse_a
5b50: 63 63 65 6c 65 72 61 74 6f 72 20 2d 2d 0a 23 0a  ccelerator --.#.
5b60: 23 09 47 69 76 65 6e 20 61 20 6b 65 79 20 63 6f  #.Given a key co
5b70: 6d 62 6f 20 64 65 73 63 72 69 70 74 69 6f 6e 2c  mbo description,
5b80: 20 63 6f 6e 73 74 72 75 63 74 20 61 6e 20 61 70   construct an ap
5b90: 70 72 6f 70 72 69 61 74 65 20 68 75 6d 61 6e 20  propriate human 
5ba0: 72 65 61 64 61 62 6c 65 0a 23 09 73 74 72 69 6e  readable.#.strin
5bb0: 67 20 28 66 6f 72 20 64 69 73 70 6c 61 79 20 6f  g (for display o
5bc0: 6e 20 61 73 20 61 20 6d 65 6e 75 20 61 63 63 65  n as a menu acce
5bd0: 6c 65 72 61 74 6f 72 29 2c 20 61 20 6c 69 73 74  lerator), a list
5be0: 20 6f 66 20 74 68 65 0a 23 09 63 6f 72 72 65 73   of the.#.corres
5bf0: 70 6f 6e 64 69 6e 67 20 62 69 6e 64 20 65 76 65  ponding bind eve
5c00: 6e 74 73 2c 20 61 6e 64 20 61 20 73 65 70 61 72  nts, and a separ
5c10: 61 74 65 20 6c 69 73 74 20 6f 66 20 62 69 6e 64  ate list of bind
5c20: 20 65 76 65 6e 74 73 20 74 68 61 74 20 6e 65 65   events that nee
5c30: 64 0a 23 09 74 6f 20 62 65 20 62 6c 6f 63 6b 65  d.#.to be blocke
5c40: 64 2e 0a 23 0a 23 20 09 57 68 65 6e 20 61 72 67  d..#.# .When arg
5c50: 75 6d 65 6e 74 20 24 64 65 73 63 20 64 6f 65 73  ument $desc does
5c60: 20 6e 6f 74 20 69 6e 63 6c 75 64 65 20 22 53 68   not include "Sh
5c70: 69 66 74 22 2c 20 74 68 65 20 62 69 6e 64 69 6e  ift", the bindin
5c80: 67 73 20 74 6f 20 24 65 76 65 6e 74 73 0a 23 20  gs to $events.# 
5c90: 09 77 69 6c 6c 20 69 6e 20 73 6f 6d 65 20 63 61  .will in some ca
5ca0: 73 65 73 20 61 6c 73 6f 20 69 6e 74 65 72 63 65  ses also interce
5cb0: 70 74 20 65 76 65 6e 74 73 20 74 68 61 74 20 68  pt events that h
5cc0: 61 76 65 20 74 68 65 20 6d 6f 64 69 66 69 65 72  ave the modifier
5cd0: 20 22 53 68 69 66 74 22 2c 0a 23 20 09 75 6e 6c   "Shift",.# .unl
5ce0: 65 73 73 20 6d 6f 72 65 20 73 70 65 63 69 66 69  ess more specifi
5cf0: 63 20 62 69 6e 64 69 6e 67 73 20 24 62 6c 6f 63  c bindings $bloc
5d00: 6b 45 76 65 6e 74 73 20 65 78 69 73 74 20 74 6f  kEvents exist to
5d10: 20 74 68 65 20 6c 61 74 74 65 72 2e 20 20 54 68   the latter.  Th
5d20: 69 73 0a 23 20 09 73 69 74 75 61 74 69 6f 6e 20  is.# .situation 
5d30: 6f 63 63 75 72 73 2c 20 66 6f 72 20 65 78 61 6d  occurs, for exam
5d40: 70 6c 65 2c 20 77 68 65 6e 20 61 20 43 6d 64 20  ple, when a Cmd 
5d50: 62 69 6e 64 69 6e 67 20 65 78 69 73 74 73 20 77  binding exists w
5d60: 69 74 68 6f 75 74 20 61 0a 23 20 09 63 6f 72 72  ithout a.# .corr
5d70: 65 73 70 6f 6e 64 69 6e 67 20 53 68 69 66 74 43  esponding ShiftC
5d80: 6d 64 20 62 69 6e 64 69 6e 67 2e 20 20 54 68 65  md binding.  The
5d90: 20 6c 69 73 74 20 6f 66 20 65 76 65 6e 74 73 20   list of events 
5da0: 74 68 61 74 20 6e 65 65 64 20 74 6f 20 62 65 0a  that need to be.
5db0: 23 20 20 20 20 20 20 20 62 6c 6f 63 6b 65 64 20  #       blocked 
5dc0: 69 73 20 72 65 74 75 72 6e 65 64 20 61 73 20 74  is returned as t
5dd0: 68 65 20 74 68 69 72 64 20 65 6c 65 6d 65 6e 74  he third element
5de0: 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 2e 0a   of the result..
5df0: 23 0a 23 20 41 72 67 75 6d 65 6e 74 73 3a 0a 23  #.# Arguments:.#
5e00: 09 64 65 73 63 09 61 20 6c 69 73 74 20 77 69 74  .desc.a list wit
5e10: 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  h the following 
5e20: 66 6f 72 6d 61 74 3a 0a 23 09 09 09 3f 73 65 71  format:.#...?seq
5e30: 75 65 6e 63 65 3f 20 6b 65 79 0a 23 09 09 73 65  uence? key.#..se
5e40: 71 75 65 6e 63 65 20 6d 61 79 20 62 65 20 4e 6f  quence may be No
5e50: 6e 65 2c 20 43 74 72 6c 2c 20 41 6c 74 2c 20 43  ne, Ctrl, Alt, C
5e60: 74 72 6c 41 6c 74 2c 20 53 68 69 66 74 2c 20 43  trlAlt, Shift, C
5e70: 6d 64 20 6f 72 0a 23 09 09 09 53 68 69 66 74 43  md or.#...ShiftC
5e80: 6d 64 0a 23 09 09 6b 65 79 20 6d 61 79 20 62 65  md.#..key may be
5e90: 20 61 6e 79 20 6b 65 79 0a 23 0a 23 20 52 65 73   any key.#.# Res
5ea0: 75 6c 74 73 3a 0a 23 09 7b 61 63 63 65 6c 20 65  ults:.#.{accel e
5eb0: 76 65 6e 74 73 20 62 6c 6f 63 6b 45 76 65 6e 74  vents blockEvent
5ec0: 73 7d 20 20 61 20 6c 69 73 74 20 63 6f 6e 74 61  s}  a list conta
5ed0: 69 6e 69 6e 67 20 74 68 65 20 61 63 63 65 6c 65  ining the accele
5ee0: 72 61 74 6f 72 20 73 74 72 69 6e 67 20 61 6e 64  rator string and
5ef0: 0a 23 09 20 20 20 20 20 20 20 20 20 20 20 20 20  .#.             
5f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74                 t
5f10: 77 6f 20 6c 69 73 74 73 20 6f 66 20 65 76 65 6e  wo lists of even
5f20: 74 73 0a 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ts..proc MainFra
5f30: 6d 65 3a 3a 5f 70 61 72 73 65 5f 61 63 63 65 6c  me::_parse_accel
5f40: 65 72 61 74 6f 72 20 7b 20 64 65 73 63 20 7d 20  erator { desc } 
5f50: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
5f60: 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20  widget..    set 
5f70: 66 4b 65 79 20 30 0a 20 20 20 20 69 66 20 7b 20  fKey 0.    if { 
5f80: 5b 6c 6c 65 6e 67 74 68 20 24 64 65 73 63 5d 20  [llength $desc] 
5f90: 3d 3d 20 31 20 7d 20 7b 0a 09 73 65 74 20 73 65  == 1 } {..set se
5fa0: 71 20 4e 6f 6e 65 0a 09 73 65 74 20 6b 65 79 20  q None..set key 
5fb0: 5b 73 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72 20  [string tolower 
5fc0: 5b 6c 69 6e 64 65 78 20 24 64 65 73 63 20 30 5d  [lindex $desc 0]
5fd0: 5d 0a 09 23 20 49 66 20 74 68 65 20 6b 65 79 20  ]..# If the key 
5fe0: 69 73 20 61 6e 20 46 20 6b 65 79 20 28 69 65 2c  is an F key (ie,
5ff0: 20 46 31 2c 20 46 32 2c 20 65 74 63 29 2c 20 69   F1, F2, etc), i
6000: 74 20 68 61 73 20 74 6f 20 62 65 20 63 61 70 69  t has to be capi
6010: 74 61 6c 69 7a 65 64 0a 09 69 66 20 7b 5b 72 65  talized..if {[re
6020: 67 65 78 70 20 7b 5e 66 28 5b 31 2d 39 5d 7c 28  gexp {^f([1-9]|(
6030: 5b 31 32 5d 5b 30 2d 39 5d 7c 33 5b 30 2d 35 5d  [12][0-9]|3[0-5]
6040: 29 29 24 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20  ))$} $key]} {.. 
6050: 20 20 20 73 65 74 20 6b 65 79 20 5b 73 74 72 69     set key [stri
6060: 6e 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d  ng toupper $key]
6070: 0a 09 20 20 20 20 73 65 74 20 66 4b 65 79 20 31  ..    set fKey 1
6080: 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 69 66  ..}.    } elseif
6090: 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 64 65 73   { [llength $des
60a0: 63 5d 20 3d 3d 20 32 20 7d 20 7b 0a 20 20 20 20  c] == 2 } {.    
60b0: 20 20 20 20 73 65 74 20 73 65 71 20 5b 6c 69 6e      set seq [lin
60c0: 64 65 78 20 24 64 65 73 63 20 30 5d 0a 20 20 20  dex $desc 0].   
60d0: 20 20 20 20 20 73 65 74 20 6b 65 79 20 5b 73 74       set key [st
60e0: 72 69 6e 67 20 74 6f 6c 6f 77 65 72 20 5b 6c 69  ring tolower [li
60f0: 6e 64 65 78 20 24 64 65 73 63 20 31 5d 5d 0a 09  ndex $desc 1]]..
6100: 23 20 49 66 20 74 68 65 20 6b 65 79 20 69 73 20  # If the key is 
6110: 61 6e 20 46 20 6b 65 79 20 28 69 65 2c 20 46 31  an F key (ie, F1
6120: 2c 20 46 32 2c 20 65 74 63 29 2c 20 69 74 20 68  , F2, etc), it h
6130: 61 73 20 74 6f 20 62 65 20 63 61 70 69 74 61 6c  as to be capital
6140: 69 7a 65 64 0a 09 69 66 20 7b 5b 72 65 67 65 78  ized..if {[regex
6150: 70 20 7b 5e 66 28 5b 31 2d 39 5d 7c 28 5b 31 32  p {^f([1-9]|([12
6160: 5d 5b 30 2d 39 5d 7c 33 5b 30 2d 35 5d 29 29 24  ][0-9]|3[0-5]))$
6170: 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20 20 20  } $key]} {..    
6180: 73 65 74 20 6b 65 79 20 5b 73 74 72 69 6e 67 20  set key [string 
6190: 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a 09 20  toupper $key].. 
61a0: 20 20 20 73 65 74 20 66 4b 65 79 20 31 0a 09 7d     set fKey 1..}
61b0: 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 72  .    } else {..r
61c0: 65 74 75 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a 0a  eturn {}.    }..
61d0: 20 20 20 20 23 20 50 6c 61 69 6e 20 22 53 68 69      # Plain "Shi
61e0: 66 74 22 20 63 61 6e 20 62 65 20 75 73 65 64 20  ft" can be used 
61f0: 6f 6e 6c 79 20 77 69 74 68 20 46 20 6b 65 79 73  only with F keys
6200: 2c 20 62 75 74 20 22 53 68 69 66 74 43 6d 64 22  , but "ShiftCmd"
6210: 20 69 73 20 61 6c 6c 6f 77 65 64 2e 0a 20 20 20   is allowed..   
6220: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 65 71 75   if {[string equ
6230: 61 6c 20 24 73 65 71 20 22 53 68 69 66 74 22 5d  al $seq "Shift"]
6240: 20 26 26 20 28 21 24 66 4b 65 79 29 7d 20 7b 0a   && (!$fKey)} {.
6250: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 2d          return -
6260: 63 6f 64 65 20 65 72 72 6f 72 20 7b 53 68 69 66  code error {Shif
6270: 74 20 61 63 63 65 6c 65 72 61 74 6f 72 20 63 61  t accelerator ca
6280: 6e 20 62 65 20 75 73 65 64 20 6f 6e 6c 79 20 77  n be used only w
6290: 69 74 68 20 46 20 6b 65 79 73 7d 0a 20 20 20 20  ith F keys}.    
62a0: 7d 0a 0a 20 20 20 20 73 65 74 20 62 6c 6f 63 6b  }..    set block
62b0: 45 76 65 6e 74 73 20 7b 7d 0a 20 20 20 20 73 65  Events {}.    se
62c0: 74 20 75 70 63 20 5b 73 74 72 69 6e 67 20 74 6f  t upc [string to
62d0: 75 70 70 65 72 20 24 6b 65 79 5d 0a 0a 20 20 20  upper $key]..   
62e0: 20 73 77 69 74 63 68 20 2d 2d 20 24 73 65 71 20   switch -- $seq 
62f0: 7b 0a 09 4e 6f 6e 65 20 7b 0a 09 20 20 20 20 73  {..None {..    s
6300: 65 74 20 61 63 63 65 6c 20 22 24 75 70 63 22 0a  et accel "$upc".
6310: 09 20 20 20 20 73 65 74 20 65 76 65 6e 74 73 20  .    set events 
6320: 5b 6c 69 73 74 20 22 3c 4b 65 79 2d 24 6b 65 79  [list "<Key-$key
6330: 3e 22 5d 0a 09 20 20 20 20 69 66 20 7b 24 66 4b  >"]..    if {$fK
6340: 65 79 7d 20 7b 0a 09 09 73 65 74 20 62 6c 6f 63  ey} {...set bloc
6350: 6b 45 76 65 6e 74 73 20 5b 6c 69 73 74 20 22 3c  kEvents [list "<
6360: 53 68 69 66 74 2d 4b 65 79 2d 24 6b 65 79 3e 22  Shift-Key-$key>"
6370: 5d 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 53 68 69  ]..    }..}..Shi
6380: 66 74 20 7b 0a 09 20 20 20 20 23 20 55 73 65 64  ft {..    # Used
6390: 20 6f 6e 6c 79 20 77 69 74 68 20 46 75 6e 63 74   only with Funct
63a0: 69 6f 6e 20 6b 65 79 73 2e 0a 09 20 20 20 20 73  ion keys...    s
63b0: 65 74 20 61 63 63 65 6c 20 22 53 68 69 66 74 2b  et accel "Shift+
63c0: 24 75 70 63 22 0a 09 20 20 20 20 73 65 74 20 65  $upc"..    set e
63d0: 76 65 6e 74 73 20 5b 6c 69 73 74 20 22 3c 53 68  vents [list "<Sh
63e0: 69 66 74 2d 4b 65 79 2d 24 6b 65 79 3e 22 5d 0a  ift-Key-$key>"].
63f0: 09 7d 0a 09 43 6d 64 20 7b 0a 09 20 20 20 20 73  .}..Cmd {..    s
6400: 65 74 20 61 63 63 65 6c 20 22 43 6d 64 2b 24 75  et accel "Cmd+$u
6410: 70 63 22 0a 0a 09 20 20 20 20 69 66 20 7b 20 20  pc"...    if {  
6420: 20 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20    [string equal 
6430: 5b 74 6b 20 77 69 6e 64 6f 77 69 6e 67 73 79 73  [tk windowingsys
6440: 74 65 6d 5d 20 22 61 71 75 61 22 5d 20 26 26 0a  tem] "aqua"] &&.
6450: 09 09 20 20 20 28 5b 73 74 72 69 6e 67 20 66 69  ..   ([string fi
6460: 72 73 74 20 41 70 70 4b 69 74 20 5b 77 69 6e 66  rst AppKit [winf
6470: 6f 20 73 65 72 76 65 72 20 2e 5d 5d 20 3d 3d 20  o server .]] == 
6480: 2d 31 29 0a 09 20 20 20 20 7d 20 7b 0a 09 09 23  -1)..    } {...#
6490: 20 43 61 72 62 6f 6e 0a 09 20 20 20 20 20 20 20   Carbon..       
64a0: 20 73 65 74 20 65 76 65 6e 74 73 20 5b 6c 69 73   set events [lis
64b0: 74 20 22 3c 43 6f 6d 6d 61 6e 64 2d 4b 65 79 2d  t "<Command-Key-
64c0: 24 6b 65 79 3e 22 20 5c 0a 09 20 20 20 20 20 20  $key>" \..      
64d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3c                "<
64e0: 4c 6f 63 6b 2d 43 6f 6d 6d 61 6e 64 2d 4b 65 79  Lock-Command-Key
64f0: 2d 24 75 70 63 3e 22 20 5d 0a 09 09 73 65 74 20  -$upc>" ]...set 
6500: 62 6c 6f 63 6b 45 76 65 6e 74 73 20 5b 6c 69 73  blockEvents [lis
6510: 74 20 22 3c 4c 6f 63 6b 2d 53 68 69 66 74 2d 43  t "<Lock-Shift-C
6520: 6f 6d 6d 61 6e 64 2d 4b 65 79 2d 24 75 70 63 3e  ommand-Key-$upc>
6530: 22 5d 0a 09 09 23 20 42 6f 74 68 20 62 69 6e 64  "]...# Both bind
6540: 69 6e 67 73 20 6d 75 73 74 20 62 65 20 69 6e 63  ings must be inc
6550: 6c 75 64 65 64 20 69 6e 20 24 65 76 65 6e 74 73  luded in $events
6560: 20 2d 20 20 74 68 65 20 66 69 72 73 74 20 62 69   -  the first bi
6570: 6e 64 69 6e 67 0a 09 09 23 20 64 6f 65 73 20 6e  nding...# does n
6580: 6f 74 20 66 69 72 65 20 69 66 20 22 4c 6f 63 6b  ot fire if "Lock
6590: 22 20 69 73 20 73 65 74 2c 20 61 6e 64 20 74 68  " is set, and th
65a0: 69 73 20 69 73 20 61 73 20 62 69 6e 64 28 6e 29  is is as bind(n)
65b0: 20 73 74 61 74 65 73 0a 09 09 23 20 62 65 63 61   states...# beca
65c0: 75 73 65 20 74 68 65 20 73 65 63 6f 6e 64 20 62  use the second b
65d0: 69 6e 64 69 6e 67 20 69 73 20 4e 4f 54 20 61 20  inding is NOT a 
65e0: 6d 6f 72 65 20 73 70 65 63 69 61 6c 69 7a 65 64  more specialized
65f0: 20 66 6f 72 6d 20 6f 66 0a 09 09 23 20 74 68 65   form of...# the
6600: 20 66 69 72 73 74 2e 0a 09 20 20 20 20 7d 20 65   first...    } e
6610: 6c 73 65 20 7b 0a 09 09 23 20 43 6f 63 6f 61 20  lse {...# Cocoa 
6620: 61 6e 64 20 61 6e 79 74 68 69 6e 67 20 65 6c 73  and anything els
6630: 65 20 74 68 61 74 20 75 73 65 73 20 43 6d 64 0a  e that uses Cmd.
6640: 09 20 20 20 20 20 20 20 20 73 65 74 20 65 76 65  .        set eve
6650: 6e 74 73 20 5b 6c 69 73 74 20 22 3c 43 6f 6d 6d  nts [list "<Comm
6660: 61 6e 64 2d 4b 65 79 2d 24 6b 65 79 3e 22 5d 0a  and-Key-$key>"].
6670: 09 20 20 20 20 20 20 20 20 23 20 41 20 62 69 6e  .        # A bin
6680: 64 69 6e 67 20 74 6f 20 22 3c 4c 6f 63 6b 2d 43  ding to "<Lock-C
6690: 6f 6d 6d 61 6e 64 2d 4b 65 79 2d 24 75 70 63 3e  ommand-Key-$upc>
66a0: 22 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 69 6e  " must not be in
66b0: 63 6c 75 64 65 64 0a 09 20 20 20 20 20 20 20 20  cluded..        
66c0: 23 20 68 65 72 65 20 2d 20 62 6f 74 68 20 65 76  # here - both ev
66d0: 65 6e 74 73 20 66 69 72 65 20 69 66 20 22 4c 6f  ents fire if "Lo
66e0: 63 6b 22 20 69 73 20 73 65 74 2e 0a 09 09 73 65  ck" is set....se
66f0: 74 20 62 6c 6f 63 6b 45 76 65 6e 74 73 20 5b 6c  t blockEvents [l
6700: 69 73 74 20 22 3c 53 68 69 66 74 2d 43 6f 6d 6d  ist "<Shift-Comm
6710: 61 6e 64 2d 4b 65 79 2d 24 6b 65 79 3e 22 5d 0a  and-Key-$key>"].
6720: 09 20 20 20 20 7d 0a 09 7d 0a 09 53 68 69 66 74  .    }..}..Shift
6730: 43 6d 64 20 7b 0a 09 20 20 20 20 69 66 20 7b 20  Cmd {..    if { 
6740: 20 20 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c     [string equal
6750: 20 5b 74 6b 20 77 69 6e 64 6f 77 69 6e 67 73 79   [tk windowingsy
6760: 73 74 65 6d 5d 20 22 61 71 75 61 22 5d 20 26 26  stem] "aqua"] &&
6770: 0a 09 09 20 20 20 20 28 5b 73 74 72 69 6e 67 20  ...    ([string 
6780: 66 69 72 73 74 20 41 70 70 4b 69 74 20 5b 77 69  first AppKit [wi
6790: 6e 66 6f 20 73 65 72 76 65 72 20 2e 5d 5d 20 3d  nfo server .]] =
67a0: 3d 20 2d 31 29 0a 09 20 20 20 20 7d 20 7b 0a 09  = -1)..    } {..
67b0: 09 23 20 43 61 72 62 6f 6e 0a 09 09 73 65 74 20  .# Carbon...set 
67c0: 61 63 63 65 6c 20 22 53 68 69 66 74 2b 43 6d 64  accel "Shift+Cmd
67d0: 2b 24 75 70 63 22 0a 09 09 73 65 74 20 65 76 65  +$upc"...set eve
67e0: 6e 74 73 20 5b 6c 69 73 74 20 22 3c 53 68 69 66  nts [list "<Shif
67f0: 74 2d 43 6f 6d 6d 61 6e 64 2d 4b 65 79 2d 24 75  t-Command-Key-$u
6800: 70 63 3e 22 20 5c 0a 09 09 09 20 20 20 20 22 3c  pc>" \....    "<
6810: 4c 6f 63 6b 2d 53 68 69 66 74 2d 43 6f 6d 6d 61  Lock-Shift-Comma
6820: 6e 64 2d 4b 65 79 2d 24 75 70 63 3e 22 5d 0a 09  nd-Key-$upc>"]..
6830: 09 23 20 42 6f 74 68 20 62 69 6e 64 69 6e 67 73  .# Both bindings
6840: 20 6d 75 73 74 20 62 65 20 69 6e 63 6c 75 64 65   must be include
6850: 64 20 68 65 72 65 20 2d 20 20 74 68 65 20 66 69  d here -  the fi
6860: 72 73 74 20 62 69 6e 64 69 6e 67 20 64 6f 65 73  rst binding does
6870: 0a 09 09 23 20 6e 6f 74 20 66 69 72 65 20 69 66  ...# not fire if
6880: 20 22 4c 6f 63 6b 22 20 69 73 20 73 65 74 2c 20   "Lock" is set, 
6890: 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 65 20  even though the 
68a0: 73 65 63 6f 6e 64 20 62 69 6e 64 69 6e 67 0a 09  second binding..
68b0: 09 23 20 73 68 6f 75 6c 64 20 62 65 20 72 65 63  .# should be rec
68c0: 6f 67 6e 69 7a 65 64 20 61 73 20 61 20 6d 6f 72  ognized as a mor
68d0: 65 20 73 70 65 63 69 61 6c 69 7a 65 64 20 66 6f  e specialized fo
68e0: 72 6d 20 6f 66 20 74 68 65 20 66 69 72 73 74 2e  rm of the first.
68f0: 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  ..    } else {..
6900: 09 23 20 43 6f 63 6f 61 20 61 6e 64 20 61 6e 79  .# Cocoa and any
6910: 74 68 69 6e 67 20 65 6c 73 65 20 74 68 61 74 20  thing else that 
6920: 75 73 65 73 20 43 6d 64 0a 09 09 73 65 74 20 61  uses Cmd...set a
6930: 63 63 65 6c 20 22 53 68 69 66 74 2b 43 6d 64 2b  ccel "Shift+Cmd+
6940: 24 75 70 63 22 0a 09 09 73 65 74 20 65 76 65 6e  $upc"...set even
6950: 74 73 20 5b 6c 69 73 74 20 22 3c 53 68 69 66 74  ts [list "<Shift
6960: 2d 43 6f 6d 6d 61 6e 64 2d 4b 65 79 2d 24 6b 65  -Command-Key-$ke
6970: 79 3e 22 5d 0a 09 09 23 20 41 20 62 69 6e 64 69  y>"]...# A bindi
6980: 6e 67 20 74 6f 20 22 3c 4c 6f 63 6b 2d 53 68 69  ng to "<Lock-Shi
6990: 66 74 2d 43 6f 6d 6d 61 6e 64 2d 4b 65 79 2d 24  ft-Command-Key-$
69a0: 6b 65 79 3e 22 20 6d 75 73 74 20 6e 6f 74 20 62  key>" must not b
69b0: 65 0a 09 09 23 20 69 6e 63 6c 75 64 65 64 20 68  e...# included h
69c0: 65 72 65 20 2d 20 62 6f 74 68 20 65 76 65 6e 74  ere - both event
69d0: 73 20 66 69 72 65 20 69 66 20 22 4c 6f 63 6b 22  s fire if "Lock"
69e0: 20 69 73 20 73 65 74 2e 0a 09 09 23 20 54 6b 2f   is set....# Tk/
69f0: 43 6f 63 6f 61 20 66 61 69 6c 73 20 74 6f 20 72  Cocoa fails to r
6a00: 65 63 6f 67 6e 69 7a 65 0a 09 09 23 20 3c 4c 6f  ecognize...# <Lo
6a10: 63 6b 2d 53 68 69 66 74 2d 43 6f 6d 6d 61 6e 64  ck-Shift-Command
6a20: 2d 4b 65 79 2d 24 6b 65 79 3e 20 61 73 20 61 20  -Key-$key> as a 
6a30: 22 6d 6f 72 65 20 73 70 65 63 69 61 6c 69 7a 65  "more specialize
6a40: 64 22 20 62 69 6e 64 69 6e 67 0a 09 09 23 20 74  d" binding...# t
6a50: 68 61 6e 20 3c 53 68 69 66 74 2d 43 6f 6d 6d 61  han <Shift-Comma
6a60: 6e 64 2d 4b 65 79 2d 24 6b 65 79 3e 2e 0a 09 09  nd-Key-$key>....
6a70: 23 20 50 65 72 76 65 72 73 65 6c 79 2c 20 54 6b  # Perversely, Tk
6a80: 2f 43 61 72 62 6f 6e 20 28 61 62 6f 76 65 29 20  /Carbon (above) 
6a90: 6d 61 6b 65 73 20 74 68 65 20 6f 70 70 6f 73 69  makes the opposi
6aa0: 74 65 20 65 72 72 6f 72 2e 0a 09 20 20 20 20 7d  te error...    }
6ab0: 0a 09 7d 0a 09 43 74 72 6c 20 7b 0a 09 20 20 20  ..}..Ctrl {..   
6ac0: 20 73 65 74 20 61 63 63 65 6c 20 22 43 74 72 6c   set accel "Ctrl
6ad0: 2b 24 75 70 63 22 0a 09 20 20 20 20 73 65 74 20  +$upc"..    set 
6ae0: 65 76 65 6e 74 73 20 5b 6c 69 73 74 20 22 3c 43  events [list "<C
6af0: 6f 6e 74 72 6f 6c 2d 4b 65 79 2d 24 6b 65 79 3e  ontrol-Key-$key>
6b00: 22 5d 0a 09 7d 0a 09 41 6c 74 20 7b 0a 09 20 20  "]..}..Alt {..  
6b10: 20 20 73 65 74 20 61 63 63 65 6c 20 22 41 6c 74    set accel "Alt
6b20: 2b 24 75 70 63 22 0a 09 20 20 20 20 73 65 74 20  +$upc"..    set 
6b30: 65 76 65 6e 74 73 20 5b 6c 69 73 74 20 22 3c 41  events [list "<A
6b40: 6c 74 2d 4b 65 79 2d 24 6b 65 79 3e 22 5d 0a 09  lt-Key-$key>"]..
6b50: 7d 0a 09 43 74 72 6c 41 6c 74 20 7b 0a 09 20 20  }..CtrlAlt {..  
6b60: 20 20 73 65 74 20 61 63 63 65 6c 20 22 43 74 72    set accel "Ctr
6b70: 6c 2b 41 6c 74 2b 24 75 70 63 22 0a 09 20 20 20  l+Alt+$upc"..   
6b80: 20 73 65 74 20 65 76 65 6e 74 73 20 5b 6c 69 73   set events [lis
6b90: 74 20 22 3c 43 6f 6e 74 72 6f 6c 2d 41 6c 74 2d  t "<Control-Alt-
6ba0: 4b 65 79 2d 24 6b 65 79 3e 22 5d 0a 09 7d 0a 09  Key-$key>"]..}..
6bb0: 64 65 66 61 75 6c 74 20 7b 0a 09 20 20 20 20 72  default {..    r
6bc0: 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f  eturn -code erro
6bd0: 72 20 22 69 6e 76 61 6c 69 64 20 61 63 63 65 6c  r "invalid accel
6be0: 65 72 61 74 6f 72 20 63 6f 64 65 20 24 73 65 71  erator code $seq
6bf0: 22 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  "..}.    }..    
6c00: 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 61 63  return [list $ac
6c10: 63 65 6c 20 24 65 76 65 6e 74 73 20 24 62 6c 6f  cel $events $blo
6c20: 63 6b 45 76 65 6e 74 73 5d 0a 7d 0a              ckEvents].}.