TextSweep

Hex Artifact Content
Login

Artifact 5753123bcb97ef7c31ec26cfd3f764de8534d916:


0000: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0050: 0a 23 20 20 64 72 6f 70 73 69 74 65 2e 74 63 6c  .#  dropsite.tcl
0060: 0a 23 20 20 54 68 69 73 20 66 69 6c 65 20 69 73  .#  This file is
0070: 20 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78 20   part of Unifix 
0080: 42 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74 0a  BWidget Toolkit.
0090: 23 20 20 24 49 64 3a 20 64 72 6f 70 73 69 74 65  #  $Id: dropsite
00a0: 2e 74 63 6c 2c 76 20 31 2e 38 20 32 30 30 39 2f  .tcl,v 1.8 2009/
00b0: 30 36 2f 33 30 20 31 36 3a 31 37 3a 33 37 20 6f  06/30 16:17:37 o
00c0: 65 68 68 61 72 20 45 78 70 20 24 0a 23 20 2d 2d  ehhar Exp $.# --
00d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
0120: 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d 61 6e 64  Index of command
0130: 73 3a 0a 23 20 20 20 20 20 2d 20 44 72 6f 70 53  s:.#     - DropS
0140: 69 74 65 3a 3a 69 6e 63 6c 75 64 65 0a 23 20 20  ite::include.#  
0150: 20 20 20 2d 20 44 72 6f 70 53 69 74 65 3a 3a 73     - DropSite::s
0160: 65 74 64 72 6f 70 0a 23 20 20 20 20 20 2d 20 44  etdrop.#     - D
0170: 72 6f 70 53 69 74 65 3a 3a 72 65 67 69 73 74 65  ropSite::registe
0180: 72 0a 23 20 20 20 20 20 2d 20 44 72 6f 70 53 69  r.#     - DropSi
0190: 74 65 3a 3a 73 65 74 63 75 72 73 6f 72 0a 23 20  te::setcursor.# 
01a0: 20 20 20 20 2d 20 44 72 6f 70 53 69 74 65 3a 3a      - DropSite::
01b0: 73 65 74 6f 70 65 72 61 74 69 6f 6e 0a 23 20 20  setoperation.#  
01c0: 20 20 20 2d 20 44 72 6f 70 53 69 74 65 3a 3a 5f     - DropSite::_
01d0: 75 70 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e  update_operation
01e0: 0a 23 20 20 20 20 20 2d 20 44 72 6f 70 53 69 74  .#     - DropSit
01f0: 65 3a 3a 5f 63 6f 6d 70 75 74 65 5f 6f 70 65 72  e::_compute_oper
0200: 61 74 69 6f 6e 0a 23 20 20 20 20 20 2d 20 44 72  ation.#     - Dr
0210: 6f 70 53 69 74 65 3a 3a 5f 64 72 61 77 5f 6f 70  opSite::_draw_op
0220: 65 72 61 74 69 6f 6e 0a 23 20 20 20 20 20 2d 20  eration.#     - 
0230: 44 72 6f 70 53 69 74 65 3a 3a 5f 69 6e 69 74 5f  DropSite::_init_
0240: 64 72 61 67 0a 23 20 20 20 20 20 2d 20 44 72 6f  drag.#     - Dro
0250: 70 53 69 74 65 3a 3a 5f 6d 6f 74 69 6f 6e 0a 23  pSite::_motion.#
0260: 20 20 20 20 20 2d 20 44 72 6f 70 53 69 74 65 3a       - DropSite:
0270: 3a 5f 72 65 6c 65 61 73 65 0a 23 20 2d 2d 2d 2d  :_release.# ----
0280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02c0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 0a 6e 61 6d 65 73  --------...names
02d0: 70 61 63 65 20 65 76 61 6c 20 44 72 6f 70 53 69  pace eval DropSi
02e0: 74 65 20 7b 0a 20 20 20 20 57 69 64 67 65 74 3a  te {.    Widget:
02f0: 3a 64 65 66 69 6e 65 20 44 72 6f 70 53 69 74 65  :define DropSite
0300: 20 64 72 6f 70 73 69 74 65 20 2d 63 6c 61 73 73   dropsite -class
0310: 6f 6e 6c 79 0a 0a 20 20 20 20 57 69 64 67 65 74  only..    Widget
0320: 3a 3a 64 65 63 6c 61 72 65 20 44 72 6f 70 53 69  ::declare DropSi
0330: 74 65 20 5b 6c 69 73 74 20 5c 0a 09 20 20 20 20  te [list \..    
0340: 5b 6c 69 73 74 20 2d 64 72 6f 70 6f 76 65 72 63  [list -dropoverc
0350: 6d 64 20 53 74 72 69 6e 67 20 22 22 20 30 5d 20  md String "" 0] 
0360: 5c 0a 09 20 20 20 20 5b 6c 69 73 74 20 2d 64 72  \..    [list -dr
0370: 6f 70 63 6d 64 20 20 20 20 20 53 74 72 69 6e 67  opcmd     String
0380: 20 22 22 20 30 5d 20 5c 0a 09 20 20 20 20 5b 6c   "" 0] \..    [l
0390: 69 73 74 20 2d 64 72 6f 70 74 79 70 65 73 20 20  ist -droptypes  
03a0: 20 53 74 72 69 6e 67 20 22 22 20 30 5d 20 5c 0a   String "" 0] \.
03b0: 09 20 20 20 20 5d 0a 0a 20 20 20 20 70 72 6f 63  .    ]..    proc
03c0: 20 75 73 65 20 7b 7d 20 7b 7d 0a 0a 20 20 20 20   use {} {}..    
03d0: 76 61 72 69 61 62 6c 65 20 5f 74 6f 70 20 20 22  variable _top  "
03e0: 2e 64 72 61 67 22 0a 20 20 20 20 76 61 72 69 61  .drag".    varia
03f0: 62 6c 65 20 5f 6f 70 77 20 20 22 2e 64 72 61 67  ble _opw  ".drag
0400: 2e 5c 23 6f 70 22 0a 20 20 20 20 76 61 72 69 61  .\#op".    varia
0410: 62 6c 65 20 5f 74 61 72 67 65 74 20 20 22 22 0a  ble _target  "".
0420: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 73 74      variable _st
0430: 61 74 75 73 20 20 30 0a 20 20 20 20 76 61 72 69  atus  0.    vari
0440: 61 62 6c 65 20 5f 74 61 62 6f 70 73 0a 20 20 20  able _tabops.   
0450: 20 76 61 72 69 61 62 6c 65 20 5f 64 65 66 6f 70   variable _defop
0460: 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  s.    variable _
0470: 73 6f 75 72 63 65 0a 20 20 20 20 76 61 72 69 61  source.    varia
0480: 62 6c 65 20 5f 74 79 70 65 0a 20 20 20 20 76 61  ble _type.    va
0490: 72 69 61 62 6c 65 20 5f 64 61 74 61 0a 20 20 20  riable _data.   
04a0: 20 76 61 72 69 61 62 6c 65 20 5f 65 76 74 0a 20   variable _evt. 
04b0: 20 20 20 23 20 6b 65 79 20 20 20 20 20 20 20 77     # key       w
04c0: 69 6e 20 20 20 20 75 6e 69 78 0a 20 20 20 20 23  in    unix.    #
04d0: 20 73 68 69 66 74 20 20 20 20 20 20 20 31 20 20   shift       1  
04e0: 20 7c 20 20 20 31 20 20 20 20 2d 3e 20 20 31 0a   |   1    ->  1.
04f0: 20 20 20 20 23 20 63 6f 6e 74 72 6f 6c 20 20 20      # control   
0500: 20 20 34 20 20 20 7c 20 20 20 34 20 20 20 20 2d    4   |   4    -
0510: 3e 20 20 34 0a 20 20 20 20 23 20 61 6c 74 20 20  >  4.    # alt  
0520: 20 20 20 20 20 20 20 38 20 20 20 7c 20 20 31 36         8   |  16
0530: 20 20 20 20 2d 3e 20 32 34 0a 20 20 20 20 23 20      -> 24.    # 
0540: 6d 65 74 61 20 20 20 20 20 20 20 20 20 20 20 20  meta            
0550: 7c 20 20 36 34 20 20 20 20 2d 3e 20 38 38 0a 0a  |  64    -> 88..
0560: 20 20 20 20 61 72 72 61 79 20 73 65 74 20 5f 74      array set _t
0570: 61 62 6f 70 73 20 7b 0a 20 20 20 20 20 20 20 20  abops {.        
0580: 6d 6f 64 2c 6e 6f 6e 65 20 20 20 20 30 0a 20 20  mod,none    0.  
0590: 20 20 20 20 20 20 6d 6f 64 2c 73 68 69 66 74 20        mod,shift 
05a0: 20 20 31 0a 20 20 20 20 20 20 20 20 6d 6f 64 2c    1.        mod,
05b0: 63 6f 6e 74 72 6f 6c 20 34 0a 20 20 20 20 20 20  control 4.      
05c0: 20 20 6d 6f 64 2c 61 6c 74 20 20 20 20 20 32 34    mod,alt     24
05d0: 0a 20 20 20 20 20 20 20 20 6f 70 73 2c 63 6f 70  .        ops,cop
05e0: 79 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 6f  y    1.        o
05f0: 70 73 2c 6d 6f 76 65 20 20 20 20 31 0a 20 20 20  ps,move    1.   
0600: 20 20 20 20 20 6f 70 73 2c 6c 69 6e 6b 20 20 20       ops,link   
0610: 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66   1.    }..    if
0620: 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d   { $tcl_platform
0630: 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75  (platform) == "u
0640: 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20 20  nix" } {.       
0650: 20 73 65 74 20 5f 74 61 62 6f 70 73 28 6d 6f 64   set _tabops(mod
0660: 2c 61 6c 74 29 20 38 0a 20 20 20 20 7d 20 65 6c  ,alt) 8.    } el
0670: 73 65 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74  se {.        set
0680: 20 5f 74 61 62 6f 70 73 28 6d 6f 64 2c 61 6c 74   _tabops(mod,alt
0690: 29 20 31 36 0a 20 20 20 20 7d 0a 20 20 20 20 61  ) 16.    }.    a
06a0: 72 72 61 79 20 73 65 74 20 5f 64 65 66 6f 70 73  rray set _defops
06b0: 20 5c 0a 20 20 20 20 20 20 20 20 5b 6c 69 73 74   \.        [list
06c0: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   \.             
06d0: 63 6f 70 79 2c 6d 6f 64 20 20 73 68 69 66 74 20  copy,mod  shift 
06e0: 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20    \.            
06f0: 20 6d 6f 76 65 2c 6d 6f 64 20 20 63 6f 6e 74 72   move,mod  contr
0700: 6f 6c 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20  ol \.           
0710: 20 20 6c 69 6e 6b 2c 6d 6f 64 20 20 61 6c 74 20    link,mod  alt 
0720: 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20      \.          
0730: 20 20 20 63 6f 70 79 2c 69 6d 67 20 20 40 5b 66     copy,img  @[f
0740: 69 6c 65 20 6a 6f 69 6e 20 24 3a 3a 42 57 49 44  ile join $::BWID
0750: 47 45 54 3a 3a 4c 49 42 52 41 52 59 20 22 69 6d  GET::LIBRARY "im
0760: 61 67 65 73 22 20 22 6f 70 63 6f 70 79 2e 78 62  ages" "opcopy.xb
0770: 6d 22 5d 20 5c 0a 20 20 20 20 20 20 20 20 20 20  m"] \.          
0780: 20 20 20 6d 6f 76 65 2c 69 6d 67 20 20 40 5b 66     move,img  @[f
0790: 69 6c 65 20 6a 6f 69 6e 20 24 3a 3a 42 57 49 44  ile join $::BWID
07a0: 47 45 54 3a 3a 4c 49 42 52 41 52 59 20 22 69 6d  GET::LIBRARY "im
07b0: 61 67 65 73 22 20 22 6f 70 6d 6f 76 65 2e 78 62  ages" "opmove.xb
07c0: 6d 22 5d 20 5c 0a 20 20 20 20 20 20 20 20 20 20  m"] \.          
07d0: 20 20 20 6c 69 6e 6b 2c 69 6d 67 20 20 40 5b 66     link,img  @[f
07e0: 69 6c 65 20 6a 6f 69 6e 20 24 3a 3a 42 57 49 44  ile join $::BWID
07f0: 47 45 54 3a 3a 4c 49 42 52 41 52 59 20 22 69 6d  GET::LIBRARY "im
0800: 61 67 65 73 22 20 22 6f 70 6c 69 6e 6b 2e 78 62  ages" "oplink.xb
0810: 6d 22 5d 5d 0a 0a 20 20 20 20 62 69 6e 64 20 44  m"]]..    bind D
0820: 72 61 67 54 6f 70 20 3c 4b 65 79 50 72 65 73 73  ragTop <KeyPress
0830: 2d 53 68 69 66 74 5f 4c 3e 20 20 20 20 20 7b 44  -Shift_L>     {D
0840: 72 6f 70 53 69 74 65 3a 3a 5f 75 70 64 61 74 65  ropSite::_update
0850: 5f 6f 70 65 72 61 74 69 6f 6e 20 5b 65 78 70 72  _operation [expr
0860: 20 25 73 20 7c 20 31 5d 7d 0a 20 20 20 20 62 69   %s | 1]}.    bi
0870: 6e 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79 50  nd DragTop <KeyP
0880: 72 65 73 73 2d 53 68 69 66 74 5f 52 3e 20 20 20  ress-Shift_R>   
0890: 20 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75 70    {DropSite::_up
08a0: 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20 5b  date_operation [
08b0: 65 78 70 72 20 25 73 20 7c 20 31 5d 7d 0a 20 20  expr %s | 1]}.  
08c0: 20 20 62 69 6e 64 20 44 72 61 67 54 6f 70 20 3c    bind DragTop <
08d0: 4b 65 79 50 72 65 73 73 2d 43 6f 6e 74 72 6f 6c  KeyPress-Control
08e0: 5f 4c 3e 20 20 20 7b 44 72 6f 70 53 69 74 65 3a  _L>   {DropSite:
08f0: 3a 5f 75 70 64 61 74 65 5f 6f 70 65 72 61 74 69  :_update_operati
0900: 6f 6e 20 5b 65 78 70 72 20 25 73 20 7c 20 34 5d  on [expr %s | 4]
0910: 7d 0a 20 20 20 20 62 69 6e 64 20 44 72 61 67 54  }.    bind DragT
0920: 6f 70 20 3c 4b 65 79 50 72 65 73 73 2d 43 6f 6e  op <KeyPress-Con
0930: 74 72 6f 6c 5f 52 3e 20 20 20 7b 44 72 6f 70 53  trol_R>   {DropS
0940: 69 74 65 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65  ite::_update_ope
0950: 72 61 74 69 6f 6e 20 5b 65 78 70 72 20 25 73 20  ration [expr %s 
0960: 7c 20 34 5d 7d 0a 20 20 20 20 69 66 20 7b 20 24  | 4]}.    if { $
0970: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61  tcl_platform(pla
0980: 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78 22  tform) == "unix"
0990: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 62 69 6e   } {.        bin
09a0: 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79 50 72  d DragTop <KeyPr
09b0: 65 73 73 2d 41 6c 74 5f 4c 3e 20 20 20 20 20 20  ess-Alt_L>      
09c0: 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75 70 64   {DropSite::_upd
09d0: 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20 5b 65  ate_operation [e
09e0: 78 70 72 20 25 73 20 7c 20 38 5d 7d 0a 20 20 20  xpr %s | 8]}.   
09f0: 20 20 20 20 20 62 69 6e 64 20 44 72 61 67 54 6f       bind DragTo
0a00: 70 20 3c 4b 65 79 50 72 65 73 73 2d 41 6c 74 5f  p <KeyPress-Alt_
0a10: 52 3e 20 20 20 20 20 20 20 7b 44 72 6f 70 53 69  R>       {DropSi
0a20: 74 65 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65 72  te::_update_oper
0a30: 61 74 69 6f 6e 20 5b 65 78 70 72 20 25 73 20 7c  ation [expr %s |
0a40: 20 38 5d 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20   8]}.    } else 
0a50: 7b 0a 20 20 20 20 20 20 20 20 62 69 6e 64 20 44  {.        bind D
0a60: 72 61 67 54 6f 70 20 3c 4b 65 79 50 72 65 73 73  ragTop <KeyPress
0a70: 2d 41 6c 74 5f 4c 3e 20 20 20 20 20 20 20 7b 44  -Alt_L>       {D
0a80: 72 6f 70 53 69 74 65 3a 3a 5f 75 70 64 61 74 65  ropSite::_update
0a90: 5f 6f 70 65 72 61 74 69 6f 6e 20 5b 65 78 70 72  _operation [expr
0aa0: 20 25 73 20 7c 20 31 36 5d 7d 0a 20 20 20 20 20   %s | 16]}.     
0ab0: 20 20 20 62 69 6e 64 20 44 72 61 67 54 6f 70 20     bind DragTop 
0ac0: 3c 4b 65 79 50 72 65 73 73 2d 41 6c 74 5f 52 3e  <KeyPress-Alt_R>
0ad0: 20 20 20 20 20 20 20 7b 44 72 6f 70 53 69 74 65         {DropSite
0ae0: 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65 72 61 74  ::_update_operat
0af0: 69 6f 6e 20 5b 65 78 70 72 20 25 73 20 7c 20 31  ion [expr %s | 1
0b00: 36 5d 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 62  6]}.    }..    b
0b10: 69 6e 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79  ind DragTop <Key
0b20: 52 65 6c 65 61 73 65 2d 53 68 69 66 74 5f 4c 3e  Release-Shift_L>
0b30: 20 20 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75     {DropSite::_u
0b40: 70 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20  pdate_operation 
0b50: 5b 65 78 70 72 20 25 73 20 26 20 7e 31 5d 7d 0a  [expr %s & ~1]}.
0b60: 20 20 20 20 62 69 6e 64 20 44 72 61 67 54 6f 70      bind DragTop
0b70: 20 3c 4b 65 79 52 65 6c 65 61 73 65 2d 53 68 69   <KeyRelease-Shi
0b80: 66 74 5f 52 3e 20 20 20 7b 44 72 6f 70 53 69 74  ft_R>   {DropSit
0b90: 65 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65 72 61  e::_update_opera
0ba0: 74 69 6f 6e 20 5b 65 78 70 72 20 25 73 20 26 20  tion [expr %s & 
0bb0: 7e 31 5d 7d 0a 20 20 20 20 62 69 6e 64 20 44 72  ~1]}.    bind Dr
0bc0: 61 67 54 6f 70 20 3c 4b 65 79 52 65 6c 65 61 73  agTop <KeyReleas
0bd0: 65 2d 43 6f 6e 74 72 6f 6c 5f 4c 3e 20 7b 44 72  e-Control_L> {Dr
0be0: 6f 70 53 69 74 65 3a 3a 5f 75 70 64 61 74 65 5f  opSite::_update_
0bf0: 6f 70 65 72 61 74 69 6f 6e 20 5b 65 78 70 72 20  operation [expr 
0c00: 25 73 20 26 20 7e 34 5d 7d 0a 20 20 20 20 62 69  %s & ~4]}.    bi
0c10: 6e 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79 52  nd DragTop <KeyR
0c20: 65 6c 65 61 73 65 2d 43 6f 6e 74 72 6f 6c 5f 52  elease-Control_R
0c30: 3e 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75 70  > {DropSite::_up
0c40: 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20 5b  date_operation [
0c50: 65 78 70 72 20 25 73 20 26 20 7e 34 5d 7d 0a 20  expr %s & ~4]}. 
0c60: 20 20 20 69 66 20 7b 20 24 74 63 6c 5f 70 6c 61     if { $tcl_pla
0c70: 74 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20  tform(platform) 
0c80: 3d 3d 20 22 75 6e 69 78 22 20 7d 20 7b 0a 20 20  == "unix" } {.  
0c90: 20 20 20 20 20 20 62 69 6e 64 20 44 72 61 67 54        bind DragT
0ca0: 6f 70 20 3c 4b 65 79 52 65 6c 65 61 73 65 2d 41  op <KeyRelease-A
0cb0: 6c 74 5f 4c 3e 20 20 20 20 20 7b 44 72 6f 70 53  lt_L>     {DropS
0cc0: 69 74 65 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65  ite::_update_ope
0cd0: 72 61 74 69 6f 6e 20 5b 65 78 70 72 20 25 73 20  ration [expr %s 
0ce0: 26 20 7e 38 5d 7d 0a 20 20 20 20 20 20 20 20 62  & ~8]}.        b
0cf0: 69 6e 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79  ind DragTop <Key
0d00: 52 65 6c 65 61 73 65 2d 41 6c 74 5f 52 3e 20 20  Release-Alt_R>  
0d10: 20 20 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75     {DropSite::_u
0d20: 70 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20  pdate_operation 
0d30: 5b 65 78 70 72 20 25 73 20 26 20 7e 38 5d 7d 0a  [expr %s & ~8]}.
0d40: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20      } else {.   
0d50: 20 20 20 20 20 62 69 6e 64 20 44 72 61 67 54 6f       bind DragTo
0d60: 70 20 3c 4b 65 79 52 65 6c 65 61 73 65 2d 41 6c  p <KeyRelease-Al
0d70: 74 5f 4c 3e 20 20 20 20 20 7b 44 72 6f 70 53 69  t_L>     {DropSi
0d80: 74 65 3a 3a 5f 75 70 64 61 74 65 5f 6f 70 65 72  te::_update_oper
0d90: 61 74 69 6f 6e 20 5b 65 78 70 72 20 25 73 20 26  ation [expr %s &
0da0: 20 7e 31 36 5d 7d 0a 20 20 20 20 20 20 20 20 62   ~16]}.        b
0db0: 69 6e 64 20 44 72 61 67 54 6f 70 20 3c 4b 65 79  ind DragTop <Key
0dc0: 52 65 6c 65 61 73 65 2d 41 6c 74 5f 52 3e 20 20  Release-Alt_R>  
0dd0: 20 20 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 75     {DropSite::_u
0de0: 70 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20  pdate_operation 
0df0: 5b 65 78 70 72 20 25 73 20 26 20 7e 31 36 5d 7d  [expr %s & ~16]}
0e00: 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d  .    }.}...# ---
0e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
0e60: 6d 61 6e 64 20 44 72 6f 70 53 69 74 65 3a 3a 69  mand DropSite::i
0e70: 6e 63 6c 75 64 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d  nclude.# -------
0e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ec0: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 72 6f 70 53  -----.proc DropS
0ed0: 69 74 65 3a 3a 69 6e 63 6c 75 64 65 20 7b 20 63  ite::include { c
0ee0: 6c 61 73 73 20 74 79 70 65 73 20 7d 20 7b 0a 20  lass types } {. 
0ef0: 20 20 20 73 65 74 20 64 72 6f 70 6f 70 74 69 6f     set dropoptio
0f00: 6e 73 20 5b 6c 69 73 74 20 5c 0a 09 20 20 20 20  ns [list \..    
0f10: 5b 6c 69 73 74 09 2d 64 72 6f 70 65 6e 61 62 6c  [list.-dropenabl
0f20: 65 64 09 42 6f 6f 6c 65 61 6e 09 30 09 30 5d 20  ed.Boolean.0.0] 
0f30: 5c 0a 09 20 20 20 20 5b 6c 69 73 74 09 2d 64 72  \..    [list.-dr
0f40: 6f 70 6f 76 65 72 63 6d 64 09 53 74 72 69 6e 67  opovercmd.String
0f50: 09 22 22 09 30 5d 20 5c 0a 09 20 20 20 20 5b 6c  ."".0] \..    [l
0f60: 69 73 74 09 2d 64 72 6f 70 63 6d 64 09 53 74 72  ist.-dropcmd.Str
0f70: 69 6e 67 09 22 22 09 30 5d 20 5c 0a 09 20 20 20  ing."".0] \..   
0f80: 20 5b 6c 69 73 74 09 2d 64 72 6f 70 74 79 70 65   [list.-droptype
0f90: 73 09 53 74 72 69 6e 67 09 24 74 79 70 65 73 09  s.String.$types.
0fa0: 30 5d 20 5c 0a 09 20 20 20 20 5d 0a 20 20 20 20  0] \..    ].    
0fb0: 57 69 64 67 65 74 3a 3a 64 65 63 6c 61 72 65 20  Widget::declare 
0fc0: 24 63 6c 61 73 73 20 24 64 72 6f 70 6f 70 74 69  $class $dropopti
0fd0: 6f 6e 73 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d  ons.}...# ------
0fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1020: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
1030: 64 20 44 72 6f 70 53 69 74 65 3a 3a 73 65 74 64  d DropSite::setd
1040: 72 6f 70 0a 23 20 20 57 69 64 67 65 74 20 69 6e  rop.#  Widget in
1050: 74 65 72 66 61 63 65 20 74 6f 20 72 65 67 69 73  terface to regis
1060: 74 65 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ter.# ----------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10b0: 2d 2d 0a 70 72 6f 63 20 44 72 6f 70 53 69 74 65  --.proc DropSite
10c0: 3a 3a 73 65 74 64 72 6f 70 20 7b 20 70 61 74 68  ::setdrop { path
10d0: 20 73 75 62 70 61 74 68 20 64 72 6f 70 6f 76 65   subpath dropove
10e0: 72 20 64 72 6f 70 20 7b 66 6f 72 63 65 20 30 7d  r drop {force 0}
10f0: 7d 20 7b 0a 20 20 20 20 73 65 74 20 63 65 6e 20  } {.    set cen 
1100: 20 20 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43     [Widget::hasC
1110: 68 61 6e 67 65 64 20 24 70 61 74 68 20 2d 64 72  hanged $path -dr
1120: 6f 70 65 6e 61 62 6c 65 64 20 65 6e 5d 0a 20 20  openabled en].  
1130: 20 20 73 65 74 20 63 74 79 70 65 73 20 5b 57 69    set ctypes [Wi
1140: 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64  dget::hasChanged
1150: 20 24 70 61 74 68 20 2d 64 72 6f 70 74 79 70 65   $path -droptype
1160: 73 20 20 20 74 79 70 65 73 5d 0a 20 20 20 20 69  s   types].    i
1170: 66 20 7b 20 24 65 6e 20 7d 20 7b 0a 20 20 20 20  f { $en } {.    
1180: 20 20 20 20 69 66 20 7b 20 24 66 6f 72 63 65 20      if { $force 
1190: 7c 7c 20 24 63 65 6e 20 7c 7c 20 24 63 74 79 70  || $cen || $ctyp
11a0: 65 73 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20  es } {.         
11b0: 20 20 20 72 65 67 69 73 74 65 72 20 24 73 75 62     register $sub
11c0: 70 61 74 68 20 5c 0a 20 20 20 20 20 20 20 20 20  path \.         
11d0: 20 20 20 20 20 20 20 2d 64 72 6f 70 74 79 70 65         -droptype
11e0: 73 20 20 20 24 74 79 70 65 73 20 5c 0a 20 20 20  s   $types \.   
11f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 64 72               -dr
1200: 6f 70 63 6d 64 20 20 20 20 20 24 64 72 6f 70 20  opcmd     $drop 
1210: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   \.             
1220: 20 20 20 2d 64 72 6f 70 6f 76 65 72 63 6d 64 20     -dropovercmd 
1230: 24 64 72 6f 70 6f 76 65 72 0a 20 20 20 20 20 20  $dropover.      
1240: 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b    }.    } else {
1250: 0a 20 20 20 20 20 20 20 20 72 65 67 69 73 74 65  .        registe
1260: 72 20 24 73 75 62 70 61 74 68 0a 20 20 20 20 7d  r $subpath.    }
1270: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
1280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12c0: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44  ---.#  Command D
12d0: 72 6f 70 53 69 74 65 3a 3a 72 65 67 69 73 74 65  ropSite::registe
12e0: 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  r.# ------------
12f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1330: 0a 70 72 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a  .proc DropSite::
1340: 72 65 67 69 73 74 65 72 20 7b 20 70 61 74 68 20  register { path 
1350: 61 72 67 73 20 7d 20 7b 0a 20 20 20 20 76 61 72  args } {.    var
1360: 69 61 62 6c 65 20 5f 74 61 62 6f 70 73 0a 20 20  iable _tabops.  
1370: 20 20 76 61 72 69 61 62 6c 65 20 5f 64 65 66 6f    variable _defo
1380: 70 73 0a 20 20 20 20 75 70 76 61 72 20 5c 23 30  ps.    upvar \#0
1390: 20 44 72 6f 70 53 69 74 65 3a 3a 24 70 61 74 68   DropSite::$path
13a0: 20 64 72 6f 70 0a 0a 20 20 20 20 57 69 64 67 65   drop..    Widge
13b0: 74 3a 3a 69 6e 69 74 20 44 72 6f 70 53 69 74 65  t::init DropSite
13c0: 20 2e 64 72 6f 70 24 70 61 74 68 20 24 61 72 67   .drop$path $arg
13d0: 73 0a 20 20 20 20 69 66 20 7b 20 5b 69 6e 66 6f  s.    if { [info
13e0: 20 65 78 69 73 74 73 20 64 72 6f 70 5d 20 7d 20   exists drop] } 
13f0: 7b 0a 20 20 20 20 20 20 20 20 75 6e 73 65 74 20  {.        unset 
1400: 64 72 6f 70 0a 20 20 20 20 7d 0a 20 20 20 20 73  drop.    }.    s
1410: 65 74 20 64 72 6f 70 63 6d 64 20 5b 57 69 64 67  et dropcmd [Widg
1420: 65 74 3a 3a 67 65 74 4d 65 67 61 77 69 64 67 65  et::getMegawidge
1430: 74 4f 70 74 69 6f 6e 20 2e 64 72 6f 70 24 70 61  tOption .drop$pa
1440: 74 68 20 2d 64 72 6f 70 63 6d 64 5d 0a 20 20 20  th -dropcmd].   
1450: 20 73 65 74 20 74 79 70 65 73 20 20 20 5b 57 69   set types   [Wi
1460: 64 67 65 74 3a 3a 67 65 74 4d 65 67 61 77 69 64  dget::getMegawid
1470: 67 65 74 4f 70 74 69 6f 6e 20 2e 64 72 6f 70 24  getOption .drop$
1480: 70 61 74 68 20 2d 64 72 6f 70 74 79 70 65 73 5d  path -droptypes]
1490: 0a 20 20 20 20 73 65 74 20 6f 76 65 72 63 6d 64  .    set overcmd
14a0: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 4d 65 67   [Widget::getMeg
14b0: 61 77 69 64 67 65 74 4f 70 74 69 6f 6e 20 2e 64  awidgetOption .d
14c0: 72 6f 70 24 70 61 74 68 20 2d 64 72 6f 70 6f 76  rop$path -dropov
14d0: 65 72 63 6d 64 5d 0a 20 20 20 20 57 69 64 67 65  ercmd].    Widge
14e0: 74 3a 3a 64 65 73 74 72 6f 79 20 2e 64 72 6f 70  t::destroy .drop
14f0: 24 70 61 74 68 0a 20 20 20 20 69 66 20 7b 20 24  $path.    if { $
1500: 64 72 6f 70 63 6d 64 20 21 3d 20 22 22 20 26 26  dropcmd != "" &&
1510: 20 24 74 79 70 65 73 20 21 3d 20 22 22 20 7d 20   $types != "" } 
1520: 7b 0a 20 20 20 20 20 20 20 20 73 65 74 20 64 72  {.        set dr
1530: 6f 70 28 64 72 6f 70 63 6d 64 29 20 24 64 72 6f  op(dropcmd) $dro
1540: 70 63 6d 64 0a 20 20 20 20 20 20 20 20 73 65 74  pcmd.        set
1550: 20 64 72 6f 70 28 6f 76 65 72 63 6d 64 29 20 24   drop(overcmd) $
1560: 6f 76 65 72 63 6d 64 0a 20 20 20 20 20 20 20 20  overcmd.        
1570: 66 6f 72 65 61 63 68 20 7b 74 79 70 65 20 6f 70  foreach {type op
1580: 73 7d 20 24 74 79 70 65 73 20 7b 0a 20 20 20 20  s} $types {.    
1590: 20 20 20 20 20 20 20 20 73 65 74 20 64 72 6f 70          set drop
15a0: 28 24 74 79 70 65 2c 6f 70 73 29 20 7b 7d 0a 20  ($type,ops) {}. 
15b0: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d             set m
15c0: 61 73 6b 6c 69 73 74 20 7b 7d 0a 20 20 20 20 20  asklist {}.     
15d0: 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 7b         foreach {
15e0: 64 65 73 63 6f 70 20 6c 6d 6f 64 7d 20 24 6f 70  descop lmod} $op
15f0: 73 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  s {.            
1600: 20 20 20 20 69 66 20 7b 20 21 5b 6c 6c 65 6e 67      if { ![lleng
1610: 74 68 20 24 64 65 73 63 6f 70 5d 20 7c 7c 20 5b  th $descop] || [
1620: 6c 6c 65 6e 67 74 68 20 24 64 65 73 63 6f 70 5d  llength $descop]
1630: 20 3e 20 33 20 7d 20 7b 0a 20 20 20 20 20 20 20   > 3 } {.       
1640: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74               ret
1650: 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f 72 20  urn -code error 
1660: 22 69 6e 76 61 6c 69 64 20 6f 70 65 72 61 74 69  "invalid operati
1670: 6f 6e 20 64 65 73 63 72 69 70 74 69 6f 6e 20 5c  on description \
1680: 22 24 64 65 73 63 6f 70 5c 22 22 0a 20 20 20 20  "$descop\"".    
1690: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20              }.  
16a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f                fo
16b0: 72 65 61 63 68 20 7b 73 75 62 6f 70 20 62 61 73  reach {subop bas
16c0: 65 6f 70 20 69 6d 67 6f 70 7d 20 24 64 65 73 63  eop imgop} $desc
16d0: 6f 70 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20  op {.           
16e0: 20 20 20 20 20 20 20 20 20 73 65 74 20 73 75 62           set sub
16f0: 6f 70 20 5b 73 74 72 69 6e 67 20 74 72 69 6d 20  op [string trim 
1700: 24 73 75 62 6f 70 5d 0a 20 20 20 20 20 20 20 20  $subop].        
1710: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b              if {
1720: 20 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   ![string length
1730: 20 24 73 75 62 6f 70 5d 20 7d 20 7b 0a 20 20 20   $subop] } {.   
1740: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1750: 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63 6f 64       return -cod
1760: 65 20 65 72 72 6f 72 20 22 73 75 62 20 6f 70 65  e error "sub ope
1770: 72 61 74 69 6f 6e 20 69 73 20 65 6d 70 74 79 22  ration is empty"
1780: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
1790: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20       }.         
17a0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 20             if { 
17b0: 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20  ![string length 
17c0: 24 62 61 73 65 6f 70 5d 20 7d 20 7b 0a 20 20 20  $baseop] } {.   
17d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
17e0: 20 20 20 20 20 73 65 74 20 62 61 73 65 6f 70 20       set baseop 
17f0: 24 73 75 62 6f 70 0a 20 20 20 20 20 20 20 20 20  $subop.         
1800: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20             }.   
1810: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1820: 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73   if { [info exis
1830: 74 73 20 64 72 6f 70 28 24 74 79 70 65 2c 6f 70  ts drop($type,op
1840: 73 2c 24 73 75 62 6f 70 29 5d 20 7d 20 7b 0a 20  s,$subop)] } {. 
1850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1860: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63         return -c
1870: 6f 64 65 20 65 72 72 6f 72 20 22 6f 70 65 72 61  ode error "opera
1880: 74 69 6f 6e 20 5c 22 24 73 75 62 6f 70 5c 22 20  tion \"$subop\" 
1890: 61 6c 72 65 61 64 79 20 64 65 66 69 6e 65 64 22  already defined"
18a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
18b0: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20       }.         
18c0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 20             if { 
18d0: 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 74  ![info exists _t
18e0: 61 62 6f 70 73 28 6f 70 73 2c 24 62 61 73 65 6f  abops(ops,$baseo
18f0: 70 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  p)] } {.        
1900: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1910: 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72  return -code err
1920: 6f 72 20 22 69 6e 76 61 6c 69 64 20 62 61 73 65  or "invalid base
1930: 20 6f 70 65 72 61 74 69 6f 6e 20 5c 22 24 62 61   operation \"$ba
1940: 73 65 6f 70 5c 22 22 0a 20 20 20 20 20 20 20 20  seop\"".        
1950: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20              }.  
1960: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1970: 20 20 69 66 20 7b 20 21 5b 73 74 72 69 6e 67 20    if { ![string 
1980: 65 71 75 61 6c 20 24 73 75 62 6f 70 20 24 62 61  equal $subop $ba
1990: 73 65 6f 70 5d 20 26 26 0a 20 20 20 20 20 20 20  seop] &&.       
19a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
19b0: 20 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 5f    [info exists _
19c0: 74 61 62 6f 70 73 28 6f 70 73 2c 24 73 75 62 6f  tabops(ops,$subo
19d0: 70 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  p)] } {.        
19e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
19f0: 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72  return -code err
1a00: 6f 72 20 22 73 75 62 20 6f 70 65 72 61 74 69 6f  or "sub operatio
1a10: 6e 20 5c 22 24 73 75 62 6f 70 5c 22 20 69 73 20  n \"$subop\" is 
1a20: 61 20 62 61 73 65 20 6f 70 65 72 61 74 69 6f 6e  a base operation
1a30: 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ".              
1a40: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20        }.        
1a50: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b              if {
1a60: 20 21 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   ![string length
1a70: 20 24 69 6d 67 6f 70 5d 20 7d 20 7b 0a 20 20 20   $imgop] } {.   
1a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1a90: 20 20 20 20 20 73 65 74 20 69 6d 67 6f 70 20 24       set imgop $
1aa0: 5f 64 65 66 6f 70 73 28 24 62 61 73 65 6f 70 2c  _defops($baseop,
1ab0: 69 6d 67 29 0a 20 20 20 20 20 20 20 20 20 20 20  img).           
1ac0: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20           }.     
1ad0: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20             }.   
1ae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20               if 
1af0: 7b 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20  { [string equal 
1b00: 24 6c 6d 6f 64 20 22 70 72 6f 67 72 61 6d 22 5d  $lmod "program"]
1b10: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20   } {.           
1b20: 20 20 20 20 20 20 20 20 20 73 65 74 20 64 72 6f           set dro
1b30: 70 28 24 74 79 70 65 2c 6f 70 73 2c 24 73 75 62  p($type,ops,$sub
1b40: 6f 70 29 20 24 62 61 73 65 6f 70 0a 20 20 20 20  op) $baseop.    
1b50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1b60: 73 65 74 20 64 72 6f 70 28 24 74 79 70 65 2c 69  set drop($type,i
1b70: 6d 67 2c 24 73 75 62 6f 70 29 20 24 69 6d 67 6f  mg,$subop) $imgo
1b80: 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  p.              
1b90: 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20    } else {.     
1ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69                 i
1bb0: 66 20 7b 20 21 5b 73 74 72 69 6e 67 20 6c 65 6e  f { ![string len
1bc0: 67 74 68 20 24 6c 6d 6f 64 5d 20 7d 20 7b 0a 20  gth $lmod] } {. 
1bd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1be0: 20 20 20 20 20 20 20 73 65 74 20 6c 6d 6f 64 20         set lmod 
1bf0: 24 5f 64 65 66 6f 70 73 28 24 62 61 73 65 6f 70  $_defops($baseop
1c00: 2c 6d 6f 64 29 0a 20 20 20 20 20 20 20 20 20 20  ,mod).          
1c10: 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20            }.    
1c20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1c30: 73 65 74 20 6d 61 73 6b 20 30 0a 20 20 20 20 20  set mask 0.     
1c40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66                 f
1c50: 6f 72 65 61 63 68 20 6d 6f 64 20 24 6c 6d 6f 64  oreach mod $lmod
1c60: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   {.             
1c70: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 20             if { 
1c80: 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 74  ![info exists _t
1c90: 61 62 6f 70 73 28 6d 6f 64 2c 24 6d 6f 64 29 5d  abops(mod,$mod)]
1ca0: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20   } {.           
1cb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1cc0: 20 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72   return -code er
1cd0: 72 6f 72 20 22 69 6e 76 61 6c 69 64 20 6d 6f 64  ror "invalid mod
1ce0: 69 66 69 65 72 20 5c 22 24 6d 6f 64 5c 22 22 0a  ifier \"$mod\"".
1cf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1d00: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20          }.      
1d10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1d20: 20 20 73 65 74 20 6d 61 73 6b 20 5b 65 78 70 72    set mask [expr
1d30: 20 7b 24 6d 61 73 6b 20 7c 20 24 5f 74 61 62 6f   {$mask | $_tabo
1d40: 70 73 28 6d 6f 64 2c 24 6d 6f 64 29 7d 5d 0a 20  ps(mod,$mod)}]. 
1d50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1d60: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20     }.           
1d70: 20 20 20 20 20 20 20 20 20 69 66 20 7b 20 28 24           if { ($
1d80: 6d 61 73 6b 20 3d 3d 20 30 29 20 21 3d 20 28 5b  mask == 0) != ([
1d90: 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 73 75  string equal $su
1da0: 62 6f 70 20 22 64 65 66 61 75 6c 74 22 5d 29 20  bop "default"]) 
1db0: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
1dc0: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75              retu
1dd0: 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f 72 20 22  rn -code error "
1de0: 73 75 62 20 6f 70 65 72 61 74 69 6f 6e 20 64 65  sub operation de
1df0: 66 61 75 6c 74 20 63 61 6e 20 6f 6e 6c 79 20 62  fault can only b
1e00: 65 20 75 73 65 64 20 77 69 74 68 20 6d 6f 64 69  e used with modi
1e10: 66 69 65 72 20 5c 22 6e 6f 6e 65 5c 22 22 0a 20  fier \"none\"". 
1e20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1e30: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20     }.           
1e40: 20 20 20 20 20 20 20 20 20 73 65 74 20 64 72 6f           set dro
1e50: 70 28 24 74 79 70 65 2c 6d 6f 64 2c 24 6d 61 73  p($type,mod,$mas
1e60: 6b 29 20 20 24 73 75 62 6f 70 0a 20 20 20 20 20  k)  $subop.     
1e70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
1e80: 65 74 20 64 72 6f 70 28 24 74 79 70 65 2c 6f 70  et drop($type,op
1e90: 73 2c 24 73 75 62 6f 70 29 20 24 62 61 73 65 6f  s,$subop) $baseo
1ea0: 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  p.              
1eb0: 20 20 20 20 20 20 73 65 74 20 64 72 6f 70 28 24        set drop($
1ec0: 74 79 70 65 2c 69 6d 67 2c 24 73 75 62 6f 70 29  type,img,$subop)
1ed0: 20 24 69 6d 67 6f 70 0a 20 20 20 20 20 20 20 20   $imgop.        
1ee0: 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70              lapp
1ef0: 65 6e 64 20 6d 61 73 6b 6c 69 73 74 20 24 6d 61  end masklist $ma
1f00: 73 6b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  sk.             
1f10: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20     }.           
1f20: 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69   }.            i
1f30: 66 20 7b 20 21 5b 69 6e 66 6f 20 65 78 69 73 74  f { ![info exist
1f40: 73 20 64 72 6f 70 28 24 74 79 70 65 2c 6d 6f 64  s drop($type,mod
1f50: 2c 30 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  ,0)] } {.       
1f60: 20 20 20 20 20 20 20 20 20 73 65 74 20 64 72 6f           set dro
1f70: 70 28 24 74 79 70 65 2c 6d 6f 64 2c 30 29 20 20  p($type,mod,0)  
1f80: 20 20 20 20 20 64 65 66 61 75 6c 74 0a 20 20 20       default.   
1f90: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74               set
1fa0: 20 64 72 6f 70 28 24 74 79 70 65 2c 6f 70 73 2c   drop($type,ops,
1fb0: 64 65 66 61 75 6c 74 29 20 63 6f 70 79 0a 20 20  default) copy.  
1fc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65                se
1fd0: 74 20 64 72 6f 70 28 24 74 79 70 65 2c 69 6d 67  t drop($type,img
1fe0: 2c 64 65 66 61 75 6c 74 29 20 24 5f 64 65 66 6f  ,default) $_defo
1ff0: 70 73 28 63 6f 70 79 2c 69 6d 67 29 0a 20 20 20  ps(copy,img).   
2000: 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70               lap
2010: 70 65 6e 64 20 6d 61 73 6b 6c 69 73 74 20 30 0a  pend masklist 0.
2020: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20              }.  
2030: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 64 72            set dr
2040: 6f 70 28 24 74 79 70 65 2c 6f 70 73 2c 66 6f 72  op($type,ops,for
2050: 63 65 29 20 63 6f 70 79 0a 20 20 20 20 20 20 20  ce) copy.       
2060: 20 20 20 20 20 73 65 74 20 64 72 6f 70 28 24 74       set drop($t
2070: 79 70 65 2c 69 6d 67 2c 66 6f 72 63 65 29 20 24  ype,img,force) $
2080: 5f 64 65 66 6f 70 73 28 63 6f 70 79 2c 69 6d 67  _defops(copy,img
2090: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 6f  ).            fo
20a0: 72 65 61 63 68 20 6d 61 73 6b 20 5b 6c 73 6f 72  reach mask [lsor
20b0: 74 20 2d 69 6e 74 65 67 65 72 20 2d 64 65 63 72  t -integer -decr
20c0: 65 61 73 69 6e 67 20 24 6d 61 73 6b 6c 69 73 74  easing $masklist
20d0: 5d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  ] {.            
20e0: 20 20 20 20 6c 61 70 70 65 6e 64 20 64 72 6f 70      lappend drop
20f0: 28 24 74 79 70 65 2c 6f 70 73 29 20 24 6d 61 73  ($type,ops) $mas
2100: 6b 20 24 64 72 6f 70 28 24 74 79 70 65 2c 6d 6f  k $drop($type,mo
2110: 64 2c 24 6d 61 73 6b 29 0a 20 20 20 20 20 20 20  d,$mask).       
2120: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 7d       }.        }
2130: 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d  .    }.}...# ---
2140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2180: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
2190: 6d 61 6e 64 20 44 72 6f 70 53 69 74 65 3a 3a 73  mand DropSite::s
21a0: 65 74 63 75 72 73 6f 72 0a 23 20 2d 2d 2d 2d 2d  etcursor.# -----
21b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21f0: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 72 6f  -------.proc Dro
2200: 70 53 69 74 65 3a 3a 73 65 74 63 75 72 73 6f 72  pSite::setcursor
2210: 20 7b 20 63 75 72 73 6f 72 20 7d 20 7b 0a 20 20   { cursor } {.  
2220: 20 20 63 61 74 63 68 20 7b 2e 64 72 61 67 20 63    catch {.drag c
2230: 6f 6e 66 69 67 75 72 65 20 2d 63 75 72 73 6f 72  onfigure -cursor
2240: 20 24 63 75 72 73 6f 72 7d 0a 7d 0a 0a 0a 23 20   $cursor}.}...# 
2250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2270: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
22a0: 43 6f 6d 6d 61 6e 64 20 44 72 6f 70 53 69 74 65  Command DropSite
22b0: 3a 3a 73 65 74 6f 70 65 72 61 74 69 6f 6e 0a 23  ::setoperation.#
22c0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
22d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
2310: 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a 73 65 74  oc DropSite::set
2320: 6f 70 65 72 61 74 69 6f 6e 20 7b 20 6f 70 20 7d  operation { op }
2330: 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20   {.    variable 
2340: 5f 63 75 72 6f 70 0a 20 20 20 20 76 61 72 69 61  _curop.    varia
2350: 62 6c 65 20 5f 64 72 61 67 6f 70 73 0a 20 20 20  ble _dragops.   
2360: 20 76 61 72 69 61 62 6c 65 20 5f 74 61 72 67 65   variable _targe
2370: 74 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  t.    variable _
2380: 74 79 70 65 0a 20 20 20 20 75 70 76 61 72 20 5c  type.    upvar \
2390: 23 30 20 44 72 6f 70 53 69 74 65 3a 3a 24 5f 74  #0 DropSite::$_t
23a0: 61 72 67 65 74 20 64 72 6f 70 0a 0a 20 20 20 20  arget drop..    
23b0: 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74  if { [info exist
23c0: 20 64 72 6f 70 28 24 5f 74 79 70 65 2c 6f 70 73   drop($_type,ops
23d0: 2c 24 6f 70 29 5d 20 26 26 0a 20 20 20 20 20 20  ,$op)] &&.      
23e0: 20 20 20 24 5f 64 72 61 67 6f 70 73 28 24 64 72     $_dragops($dr
23f0: 6f 70 28 24 5f 74 79 70 65 2c 6f 70 73 2c 24 6f  op($_type,ops,$o
2400: 70 29 29 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  p)) } {.        
2410: 73 65 74 20 5f 63 75 72 6f 70 20 24 6f 70 0a 20  set _curop $op. 
2420: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20     } else {.    
2430: 20 20 20 20 23 20 66 6f 72 63 65 20 74 6f 20 61      # force to a
2440: 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f 6e 0a   copy operation.
2450: 20 20 20 20 20 20 20 20 73 65 74 20 5f 63 75 72          set _cur
2460: 6f 70 20 66 6f 72 63 65 0a 20 20 20 20 7d 0a 7d  op force.    }.}
2470: 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...# -----------
2480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
24a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
24b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
24c0: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 72 6f  -.#  Command Dro
24d0: 70 53 69 74 65 3a 3a 5f 69 6e 69 74 5f 64 72 61  pSite::_init_dra
24e0: 67 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  g.# ------------
24f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2530: 0a 70 72 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a  .proc DropSite::
2540: 5f 69 6e 69 74 5f 64 72 61 67 20 7b 20 74 6f 70  _init_drag { top
2550: 20 65 76 74 20 73 6f 75 72 63 65 20 73 74 61 74   evt source stat
2560: 65 20 58 20 59 20 74 79 70 65 20 6f 70 73 20 64  e X Y type ops d
2570: 61 74 61 20 7d 20 7b 0a 20 20 20 20 76 61 72 69  ata } {.    vari
2580: 61 62 6c 65 20 5f 74 6f 70 0a 20 20 20 20 76 61  able _top.    va
2590: 72 69 61 62 6c 65 20 5f 73 6f 75 72 63 65 0a 20  riable _source. 
25a0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 74 79 70     variable _typ
25b0: 65 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  e.    variable _
25c0: 64 61 74 61 0a 20 20 20 20 76 61 72 69 61 62 6c  data.    variabl
25d0: 65 20 5f 74 61 72 67 65 74 0a 20 20 20 20 76 61  e _target.    va
25e0: 72 69 61 62 6c 65 20 5f 73 74 61 74 75 73 0a 20  riable _status. 
25f0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 73 74 61     variable _sta
2600: 74 65 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20  te.    variable 
2610: 5f 64 72 61 67 6f 70 73 0a 20 20 20 20 76 61 72  _dragops.    var
2620: 69 61 62 6c 65 20 5f 6f 70 77 0a 20 20 20 20 76  iable _opw.    v
2630: 61 72 69 61 62 6c 65 20 5f 65 76 74 0a 0a 20 20  ariable _evt..  
2640: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73    if {[info exis
2650: 74 73 20 5f 64 72 61 67 6f 70 73 5d 7d 20 7b 0a  ts _dragops]} {.
2660: 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 5f 64          unset _d
2670: 72 61 67 6f 70 73 0a 20 20 20 20 7d 0a 20 20 20  ragops.    }.   
2680: 20 61 72 72 61 79 20 73 65 74 20 5f 64 72 61 67   array set _drag
2690: 6f 70 73 20 7b 63 6f 70 79 20 31 20 6d 6f 76 65  ops {copy 1 move
26a0: 20 30 20 6c 69 6e 6b 20 30 7d 0a 20 20 20 20 66   0 link 0}.    f
26b0: 6f 72 65 61 63 68 20 6f 70 20 24 6f 70 73 20 7b  oreach op $ops {
26c0: 0a 20 20 20 20 20 20 20 20 73 65 74 20 5f 64 72  .        set _dr
26d0: 61 67 6f 70 73 28 24 6f 70 29 20 31 0a 20 20 20  agops($op) 1.   
26e0: 20 7d 0a 20 20 20 20 73 65 74 20 5f 74 61 72 67   }.    set _targ
26f0: 65 74 20 22 22 0a 20 20 20 20 73 65 74 20 5f 73  et "".    set _s
2700: 74 61 74 75 73 20 20 30 0a 20 20 20 20 73 65 74  tatus  0.    set
2710: 20 5f 74 6f 70 20 20 20 20 20 24 74 6f 70 0a 20   _top     $top. 
2720: 20 20 20 73 65 74 20 5f 73 6f 75 72 63 65 20 20     set _source  
2730: 24 73 6f 75 72 63 65 0a 20 20 20 20 73 65 74 20  $source.    set 
2740: 5f 74 79 70 65 20 20 20 20 24 74 79 70 65 0a 20  _type    $type. 
2750: 20 20 20 73 65 74 20 5f 64 61 74 61 20 20 20 20     set _data    
2760: 24 64 61 74 61 0a 0a 20 20 20 20 6c 61 62 65 6c  $data..    label
2770: 20 24 5f 6f 70 77 20 2d 72 65 6c 69 65 66 20 66   $_opw -relief f
2780: 6c 61 74 20 2d 62 64 20 30 20 2d 68 69 67 68 6c  lat -bd 0 -highl
2790: 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20  ightthickness 0 
27a0: 5c 0a 20 20 20 20 20 20 20 20 2d 66 6f 72 65 67  \.        -foreg
27b0: 72 6f 75 6e 64 20 62 6c 61 63 6b 20 2d 62 61 63  round black -bac
27c0: 6b 67 72 6f 75 6e 64 20 77 68 69 74 65 0a 0a 20  kground white.. 
27d0: 20 20 20 62 69 6e 64 20 24 74 6f 70 20 3c 42 75     bind $top <Bu
27e0: 74 74 6f 6e 52 65 6c 65 61 73 65 2d 24 65 76 74  ttonRelease-$evt
27f0: 3e 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 72 65  > {DropSite::_re
2800: 6c 65 61 73 65 20 25 58 20 25 59 7d 0a 20 20 20  lease %X %Y}.   
2810: 20 62 69 6e 64 20 24 74 6f 70 20 3c 42 24 65 76   bind $top <B$ev
2820: 74 2d 4d 6f 74 69 6f 6e 3e 20 20 20 20 20 20 20  t-Motion>       
2830: 7b 44 72 6f 70 53 69 74 65 3a 3a 5f 6d 6f 74 69  {DropSite::_moti
2840: 6f 6e 20 20 25 58 20 25 59 7d 0a 20 20 20 20 62  on  %X %Y}.    b
2850: 69 6e 64 20 24 74 6f 70 20 3c 4d 6f 74 69 6f 6e  ind $top <Motion
2860: 3e 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 44  >             {D
2870: 72 6f 70 53 69 74 65 3a 3a 5f 72 65 6c 65 61 73  ropSite::_releas
2880: 65 20 25 58 20 25 59 7d 0a 20 20 20 20 73 65 74  e %X %Y}.    set
2890: 20 5f 73 74 61 74 65 20 24 73 74 61 74 65 0a 20   _state $state. 
28a0: 20 20 20 73 65 74 20 5f 65 76 74 20 20 20 24 65     set _evt   $e
28b0: 76 74 0a 20 20 20 20 5f 6d 6f 74 69 6f 6e 20 24  vt.    _motion $
28c0: 58 20 24 59 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  X $Y.}...# -----
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 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
2920: 6e 64 20 44 72 6f 70 53 69 74 65 3a 3a 5f 75 70  nd DropSite::_up
2930: 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 0a 23  date_operation.#
2940: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
2950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2980: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
2990: 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a 5f 75 70  oc DropSite::_up
29a0: 64 61 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20 7b  date_operation {
29b0: 20 73 74 61 74 65 20 7d 20 7b 0a 20 20 20 20 76   state } {.    v
29c0: 61 72 69 61 62 6c 65 20 5f 74 6f 70 0a 20 20 20  ariable _top.   
29d0: 20 76 61 72 69 61 62 6c 65 20 5f 73 74 61 74 75   variable _statu
29e0: 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  s.    variable _
29f0: 73 74 61 74 65 0a 0a 20 20 20 20 69 66 20 7b 20  state..    if { 
2a00: 24 5f 73 74 61 74 75 73 20 26 20 33 20 7d 20 7b  $_status & 3 } {
2a10: 0a 20 20 20 20 20 20 20 20 73 65 74 20 5f 73 74  .        set _st
2a20: 61 74 65 20 24 73 74 61 74 65 0a 20 20 20 20 20  ate $state.     
2a30: 20 20 20 5f 6d 6f 74 69 6f 6e 20 5b 77 69 6e 66     _motion [winf
2a40: 6f 20 70 6f 69 6e 74 65 72 78 20 24 5f 74 6f 70  o pointerx $_top
2a50: 5d 20 5b 77 69 6e 66 6f 20 70 6f 69 6e 74 65 72  ] [winfo pointer
2a60: 79 20 24 5f 74 6f 70 5d 0a 20 20 20 20 7d 0a 7d  y $_top].    }.}
2a70: 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...# -----------
2a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ac0: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 72 6f  -.#  Command Dro
2ad0: 70 53 69 74 65 3a 3a 5f 63 6f 6d 70 75 74 65 5f  pSite::_compute_
2ae0: 6f 70 65 72 61 74 69 6f 6e 0a 23 20 2d 2d 2d 2d  operation.# ----
2af0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b30: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 72  --------.proc Dr
2b40: 6f 70 53 69 74 65 3a 3a 5f 63 6f 6d 70 75 74 65  opSite::_compute
2b50: 5f 6f 70 65 72 61 74 69 6f 6e 20 7b 20 74 61 72  _operation { tar
2b60: 67 65 74 20 73 74 61 74 65 20 74 79 70 65 20 7d  get state type }
2b70: 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20   {.    variable 
2b80: 20 5f 63 75 72 6f 70 0a 20 20 20 20 76 61 72 69   _curop.    vari
2b90: 61 62 6c 65 20 20 5f 64 72 61 67 6f 70 73 0a 20  able  _dragops. 
2ba0: 20 20 20 75 70 76 61 72 20 5c 23 30 20 44 72 6f     upvar \#0 Dro
2bb0: 70 53 69 74 65 3a 3a 24 74 61 72 67 65 74 20 64  pSite::$target d
2bc0: 72 6f 70 0a 0a 20 20 20 20 66 6f 72 65 61 63 68  rop..    foreach
2bd0: 20 7b 6d 61 73 6b 20 6f 70 7d 20 24 64 72 6f 70   {mask op} $drop
2be0: 28 24 74 79 70 65 2c 6f 70 73 29 20 7b 0a 20 20  ($type,ops) {.  
2bf0: 20 20 20 20 20 20 69 66 20 7b 20 28 24 73 74 61        if { ($sta
2c00: 74 65 20 26 20 24 6d 61 73 6b 29 20 3d 3d 20 24  te & $mask) == $
2c10: 6d 61 73 6b 20 7d 20 7b 0a 20 20 20 20 20 20 20  mask } {.       
2c20: 20 20 20 20 20 69 66 20 7b 20 24 5f 64 72 61 67       if { $_drag
2c30: 6f 70 73 28 24 64 72 6f 70 28 24 74 79 70 65 2c  ops($drop($type,
2c40: 6f 70 73 2c 24 6f 70 29 29 20 7d 20 7b 0a 20 20  ops,$op)) } {.  
2c50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65                se
2c60: 74 20 5f 63 75 72 6f 70 20 24 6f 70 0a 20 20 20  t _curop $op.   
2c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74               ret
2c80: 75 72 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20  urn.            
2c90: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  }.        }.    
2ca0: 7d 0a 20 20 20 20 73 65 74 20 5f 63 75 72 6f 70  }.    set _curop
2cb0: 20 66 6f 72 63 65 0a 7d 0a 0a 0a 23 20 2d 2d 2d   force.}...# ---
2cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
2d10: 6d 61 6e 64 20 44 72 6f 70 53 69 74 65 3a 3a 5f  mand DropSite::_
2d20: 64 72 61 77 5f 6f 70 65 72 61 74 69 6f 6e 0a 23  draw_operation.#
2d30: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
2d40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
2d80: 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a 5f 64 72  oc DropSite::_dr
2d90: 61 77 5f 6f 70 65 72 61 74 69 6f 6e 20 7b 20 74  aw_operation { t
2da0: 61 72 67 65 74 20 74 79 70 65 20 7d 20 7b 0a 20  arget type } {. 
2db0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 6f 70 77     variable _opw
2dc0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 63  .    variable _c
2dd0: 75 72 6f 70 0a 20 20 20 20 76 61 72 69 61 62 6c  urop.    variabl
2de0: 65 20 5f 64 72 61 67 6f 70 73 0a 20 20 20 20 76  e _dragops.    v
2df0: 61 72 69 61 62 6c 65 20 5f 74 61 62 6f 70 73 0a  ariable _tabops.
2e00: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 73 74      variable _st
2e10: 61 74 75 73 0a 0a 20 20 20 20 75 70 76 61 72 20  atus..    upvar 
2e20: 5c 23 30 20 44 72 6f 70 53 69 74 65 3a 3a 24 74  \#0 DropSite::$t
2e30: 61 72 67 65 74 20 64 72 6f 70 0a 0a 20 20 20 20  arget drop..    
2e40: 69 66 20 7b 20 21 28 24 5f 73 74 61 74 75 73 20  if { !($_status 
2e50: 26 20 31 29 20 7d 20 7b 0a 20 20 20 20 20 20 20  & 1) } {.       
2e60: 20 63 61 74 63 68 20 7b 70 6c 61 63 65 20 66 6f   catch {place fo
2e70: 72 67 65 74 20 24 5f 6f 70 77 7d 0a 20 20 20 20  rget $_opw}.    
2e80: 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d      return.    }
2e90: 0a 0a 20 20 20 20 69 66 20 7b 20 30 20 7d 20 7b  ..    if { 0 } {
2ea0: 0a 20 20 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f  .    if { ![info
2eb0: 20 65 78 69 73 74 20 64 72 6f 70 28 24 74 79 70   exist drop($typ
2ec0: 65 2c 6f 70 73 2c 24 5f 63 75 72 6f 70 29 5d 20  e,ops,$_curop)] 
2ed0: 7c 7c 0a 20 20 20 20 20 20 20 20 20 21 24 5f 64  ||.         !$_d
2ee0: 72 61 67 6f 70 73 28 24 64 72 6f 70 28 24 74 79  ragops($drop($ty
2ef0: 70 65 2c 6f 70 73 2c 24 5f 63 75 72 6f 70 29 29  pe,ops,$_curop))
2f00: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 23 20 66   } {.        # f
2f10: 6f 72 63 65 20 74 6f 20 61 20 63 6f 70 79 20 6f  orce to a copy o
2f20: 70 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 20 20  peration.       
2f30: 20 73 65 74 20 5f 63 75 72 6f 70 20 63 6f 70 79   set _curop copy
2f40: 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b  .        catch {
2f50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 5f 6f  .            $_o
2f60: 70 77 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 69  pw configure -bi
2f70: 74 6d 61 70 20 24 5f 74 61 62 6f 70 73 28 69 6d  tmap $_tabops(im
2f80: 67 2c 63 6f 70 79 29 0a 20 20 20 20 20 20 20 20  g,copy).        
2f90: 20 20 20 20 70 6c 61 63 65 20 24 5f 6f 70 77 20      place $_opw 
2fa0: 2d 72 65 6c 78 20 31 20 2d 72 65 6c 79 20 31 20  -relx 1 -rely 1 
2fb0: 2d 61 6e 63 68 6f 72 20 73 65 0a 20 20 20 20 20  -anchor se.     
2fc0: 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 7d     }.    }.    }
2fd0: 20 65 6c 73 65 69 66 20 7b 20 5b 73 74 72 69 6e   elseif { [strin
2fe0: 67 20 65 71 75 61 6c 20 24 5f 63 75 72 6f 70 20  g equal $_curop 
2ff0: 22 64 65 66 61 75 6c 74 22 5d 20 7d 20 7b 0a 20  "default"] } {. 
3000: 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 70 6c         catch {pl
3010: 61 63 65 20 66 6f 72 67 65 74 20 24 5f 6f 70 77  ace forget $_opw
3020: 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20  }.    } else {. 
3030: 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0a 20         catch {. 
3040: 20 20 20 20 20 20 20 20 20 20 20 24 5f 6f 70 77             $_opw
3050: 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 69 74 6d   configure -bitm
3060: 61 70 20 24 64 72 6f 70 28 24 74 79 70 65 2c 69  ap $drop($type,i
3070: 6d 67 2c 24 5f 63 75 72 6f 70 29 0a 20 20 20 20  mg,$_curop).    
3080: 20 20 20 20 20 20 20 20 70 6c 61 63 65 20 24 5f          place $_
3090: 6f 70 77 20 2d 72 65 6c 78 20 31 20 2d 72 65 6c  opw -relx 1 -rel
30a0: 79 20 31 20 2d 61 6e 63 68 6f 72 20 73 65 0a 20  y 1 -anchor se. 
30b0: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 7d         }.    }.}
30c0: 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...# -----------
30d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3110: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 72 6f  -.#  Command Dro
3120: 70 53 69 74 65 3a 3a 5f 6d 6f 74 69 6f 6e 0a 23  pSite::_motion.#
3130: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
3140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
3180: 6f 63 20 44 72 6f 70 53 69 74 65 3a 3a 5f 6d 6f  oc DropSite::_mo
3190: 74 69 6f 6e 20 7b 20 58 20 59 20 7d 20 7b 0a 20  tion { X Y } {. 
31a0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 74 6f 70     variable _top
31b0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 74  .    variable _t
31c0: 61 72 67 65 74 0a 20 20 20 20 76 61 72 69 61 62  arget.    variab
31d0: 6c 65 20 5f 73 74 61 74 75 73 0a 20 20 20 20 76  le _status.    v
31e0: 61 72 69 61 62 6c 65 20 5f 73 74 61 74 65 0a 20  ariable _state. 
31f0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 63 75 72     variable _cur
3200: 6f 70 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20  op.    variable 
3210: 5f 74 79 70 65 0a 20 20 20 20 76 61 72 69 61 62  _type.    variab
3220: 6c 65 20 5f 64 61 74 61 0a 20 20 20 20 76 61 72  le _data.    var
3230: 69 61 62 6c 65 20 5f 73 6f 75 72 63 65 0a 20 20  iable _source.  
3240: 20 20 76 61 72 69 61 62 6c 65 20 5f 65 76 74 0a    variable _evt.
3250: 0a 20 20 20 20 73 65 74 20 73 63 72 69 70 74 20  .    set script 
3260: 5b 62 69 6e 64 20 24 5f 74 6f 70 20 3c 42 24 5f  [bind $_top <B$_
3270: 65 76 74 2d 4d 6f 74 69 6f 6e 3e 5d 0a 20 20 20  evt-Motion>].   
3280: 20 62 69 6e 64 20 24 5f 74 6f 70 20 3c 42 24 5f   bind $_top <B$_
3290: 65 76 74 2d 4d 6f 74 69 6f 6e 3e 20 7b 7d 0a 20  evt-Motion> {}. 
32a0: 20 20 20 62 69 6e 64 20 24 5f 74 6f 70 20 3c 4d     bind $_top <M
32b0: 6f 74 69 6f 6e 3e 20 20 20 20 20 20 20 20 7b 7d  otion>        {}
32c0: 0a 20 20 20 20 77 6d 20 67 65 6f 6d 65 74 72 79  .    wm geometry
32d0: 20 24 5f 74 6f 70 20 22 2b 5b 65 78 70 72 20 7b   $_top "+[expr {
32e0: 24 58 2b 31 7d 5d 2b 5b 65 78 70 72 20 7b 24 59  $X+1}]+[expr {$Y
32f0: 2b 31 7d 5d 22 0a 20 20 20 20 75 70 64 61 74 65  +1}]".    update
3300: 0a 20 20 20 20 69 66 20 7b 20 21 5b 77 69 6e 66  .    if { ![winf
3310: 6f 20 65 78 69 73 74 73 20 24 5f 74 6f 70 5d 20  o exists $_top] 
3320: 7d 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75  } {.        retu
3330: 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74  rn.    }.    set
3340: 20 70 61 74 68 20 5b 77 69 6e 66 6f 20 63 6f 6e   path [winfo con
3350: 74 61 69 6e 69 6e 67 20 24 58 20 24 59 5d 0a 20  taining $X $Y]. 
3360: 20 20 20 69 66 20 7b 20 21 5b 73 74 72 69 6e 67     if { ![string
3370: 20 65 71 75 61 6c 20 24 70 61 74 68 20 24 5f 74   equal $path $_t
3380: 61 72 67 65 74 5d 20 7d 20 7b 0a 20 20 20 20 20  arget] } {.     
3390: 20 20 20 23 20 70 61 74 68 20 21 3d 20 63 75 72     # path != cur
33a0: 72 65 6e 74 20 74 61 72 67 65 74 0a 20 20 20 20  rent target.    
33b0: 20 20 20 20 69 66 20 7b 20 24 5f 73 74 61 74 75      if { $_statu
33c0: 73 20 26 20 32 20 7d 20 7b 0a 20 20 20 20 20 20  s & 2 } {.      
33d0: 20 20 20 20 20 20 23 20 63 75 72 72 65 6e 74 20        # current 
33e0: 74 61 72 67 65 74 20 69 73 20 76 61 6c 69 64 20  target is valid 
33f0: 61 6e 64 20 68 61 73 20 72 65 63 61 6c 6c 20 73  and has recall s
3400: 74 61 74 75 73 0a 20 20 20 20 20 20 20 20 20 20  tatus.          
3410: 20 20 23 20 67 65 6e 65 72 61 74 65 20 6c 65 61    # generate lea
3420: 76 65 20 65 76 65 6e 74 0a 20 20 20 20 20 20 20  ve event.       
3430: 20 20 20 20 20 75 70 76 61 72 20 20 20 5c 23 30       upvar   \#0
3440: 20 44 72 6f 70 53 69 74 65 3a 3a 24 5f 74 61 72   DropSite::$_tar
3450: 67 65 74 20 64 72 6f 70 0a 20 20 20 20 20 20 20  get drop.       
3460: 20 20 20 20 20 75 70 6c 65 76 65 6c 20 5c 23 30       uplevel \#0
3470: 20 24 64 72 6f 70 28 6f 76 65 72 63 6d 64 29 20   $drop(overcmd) 
3480: 5b 6c 69 73 74 20 24 5f 74 61 72 67 65 74 20 24  [list $_target $
3490: 5f 73 6f 75 72 63 65 20 6c 65 61 76 65 20 24 58  _source leave $X
34a0: 20 24 59 20 24 5f 63 75 72 6f 70 20 24 5f 74 79   $Y $_curop $_ty
34b0: 70 65 20 24 5f 64 61 74 61 5d 0a 20 20 20 20 20  pe $_data].     
34c0: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 73 65 74     }.        set
34d0: 20 5f 74 61 72 67 65 74 20 24 70 61 74 68 0a 20   _target $path. 
34e0: 20 20 20 20 20 20 20 75 70 76 61 72 20 5c 23 30         upvar \#0
34f0: 20 44 72 6f 70 53 69 74 65 3a 3a 24 5f 74 61 72   DropSite::$_tar
3500: 67 65 74 20 64 72 6f 70 0a 20 20 20 20 20 20 20  get drop.       
3510: 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73   if { [info exis
3520: 74 73 20 64 72 6f 70 28 24 5f 74 79 70 65 2c 6f  ts drop($_type,o
3530: 70 73 29 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  ps)] } {.       
3540: 20 20 20 20 20 23 20 70 61 74 68 20 69 73 20 61       # path is a
3550: 20 76 61 6c 69 64 20 74 61 72 67 65 74 0a 20 20   valid target.  
3560: 20 20 20 20 20 20 20 20 20 20 5f 63 6f 6d 70 75            _compu
3570: 74 65 5f 6f 70 65 72 61 74 69 6f 6e 20 24 5f 74  te_operation $_t
3580: 61 72 67 65 74 20 24 5f 73 74 61 74 65 20 24 5f  arget $_state $_
3590: 74 79 70 65 0a 20 20 20 20 20 20 20 20 20 20 20  type.           
35a0: 20 69 66 20 7b 20 24 64 72 6f 70 28 6f 76 65 72   if { $drop(over
35b0: 63 6d 64 29 20 21 3d 20 22 22 20 7d 20 7b 0a 20  cmd) != "" } {. 
35c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
35d0: 65 74 20 61 72 67 20 20 20 20 20 5b 6c 69 73 74  et arg     [list
35e0: 20 24 5f 74 61 72 67 65 74 20 24 5f 73 6f 75 72   $_target $_sour
35f0: 63 65 20 65 6e 74 65 72 20 24 58 20 24 59 20 24  ce enter $X $Y $
3600: 5f 63 75 72 6f 70 20 24 5f 74 79 70 65 20 24 5f  _curop $_type $_
3610: 64 61 74 61 5d 0a 20 20 20 20 20 20 20 20 20 20  data].          
3620: 20 20 20 20 20 20 73 65 74 20 5f 73 74 61 74 75        set _statu
3630: 73 20 5b 75 70 6c 65 76 65 6c 20 5c 23 30 20 24  s [uplevel \#0 $
3640: 64 72 6f 70 28 6f 76 65 72 63 6d 64 29 20 24 61  drop(overcmd) $a
3650: 72 67 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20  rg].            
3660: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20  } else {.       
3670: 20 20 20 20 20 20 20 20 20 73 65 74 20 5f 73 74           set _st
3680: 61 74 75 73 20 31 0a 20 20 20 20 20 20 20 20 20  atus 1.         
3690: 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 24 5f         catch {$_
36a0: 74 6f 70 20 63 6f 6e 66 69 67 75 72 65 20 2d 63  top configure -c
36b0: 75 72 73 6f 72 20 62 61 73 65 64 5f 61 72 72 6f  ursor based_arro
36c0: 77 5f 64 6f 77 6e 7d 0a 20 20 20 20 20 20 20 20  w_down}.        
36d0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20      }.          
36e0: 20 20 5f 64 72 61 77 5f 6f 70 65 72 61 74 69 6f    _draw_operatio
36f0: 6e 20 24 5f 74 61 72 67 65 74 20 24 5f 74 79 70  n $_target $_typ
3700: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 75 70  e.            up
3710: 64 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20  date.           
3720: 20 63 61 74 63 68 20 7b 0a 20 20 20 20 20 20 20   catch {.       
3730: 20 20 20 20 20 20 20 20 20 62 69 6e 64 20 24 5f           bind $_
3740: 74 6f 70 20 3c 42 24 5f 65 76 74 2d 4d 6f 74 69  top <B$_evt-Moti
3750: 6f 6e 3e 20 7b 44 72 6f 70 53 69 74 65 3a 3a 5f  on> {DropSite::_
3760: 6d 6f 74 69 6f 6e 20 20 25 58 20 25 59 7d 0a 20  motion  %X %Y}. 
3770: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62                 b
3780: 69 6e 64 20 24 5f 74 6f 70 20 3c 4d 6f 74 69 6f  ind $_top <Motio
3790: 6e 3e 20 20 20 20 20 20 20 20 7b 44 72 6f 70 53  n>        {DropS
37a0: 69 74 65 3a 3a 5f 72 65 6c 65 61 73 65 20 25 58  ite::_release %X
37b0: 20 25 59 7d 0a 20 20 20 20 20 20 20 20 20 20 20   %Y}.           
37c0: 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72   }.            r
37d0: 65 74 75 72 6e 0a 20 20 20 20 20 20 20 20 7d 20  eturn.        } 
37e0: 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20  else {.         
37f0: 20 20 20 73 65 74 20 5f 73 74 61 74 75 73 20 30     set _status 0
3800: 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74  .            cat
3810: 63 68 20 7b 24 5f 74 6f 70 20 63 6f 6e 66 69 67  ch {$_top config
3820: 75 72 65 20 2d 63 75 72 73 6f 72 20 64 6f 74 7d  ure -cursor dot}
3830: 0a 20 20 20 20 20 20 20 20 20 20 20 20 5f 64 72  .            _dr
3840: 61 77 5f 6f 70 65 72 61 74 69 6f 6e 20 22 22 20  aw_operation "" 
3850: 22 22 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20  "".        }.   
3860: 20 7d 20 65 6c 73 65 69 66 20 7b 20 24 5f 73 74   } elseif { $_st
3870: 61 74 75 73 20 26 20 32 20 7d 20 7b 0a 20 20 20  atus & 2 } {.   
3880: 20 20 20 20 20 75 70 76 61 72 20 5c 23 30 20 44       upvar \#0 D
3890: 72 6f 70 53 69 74 65 3a 3a 24 5f 74 61 72 67 65  ropSite::$_targe
38a0: 74 20 64 72 6f 70 0a 20 20 20 20 20 20 20 20 5f  t drop.        _
38b0: 63 6f 6d 70 75 74 65 5f 6f 70 65 72 61 74 69 6f  compute_operatio
38c0: 6e 20 24 5f 74 61 72 67 65 74 20 24 5f 73 74 61  n $_target $_sta
38d0: 74 65 20 24 5f 74 79 70 65 0a 20 20 20 20 20 20  te $_type.      
38e0: 20 20 73 65 74 20 61 72 67 20 20 20 20 20 5b 6c    set arg     [l
38f0: 69 73 74 20 24 5f 74 61 72 67 65 74 20 24 5f 73  ist $_target $_s
3900: 6f 75 72 63 65 20 6d 6f 74 69 6f 6e 20 24 58 20  ource motion $X 
3910: 24 59 20 24 5f 63 75 72 6f 70 20 24 5f 74 79 70  $Y $_curop $_typ
3920: 65 20 24 5f 64 61 74 61 5d 0a 20 20 20 20 20 20  e $_data].      
3930: 20 20 73 65 74 20 5f 73 74 61 74 75 73 20 5b 75    set _status [u
3940: 70 6c 65 76 65 6c 20 5c 23 30 20 24 64 72 6f 70  plevel \#0 $drop
3950: 28 6f 76 65 72 63 6d 64 29 20 24 61 72 67 5d 0a  (overcmd) $arg].
3960: 20 20 20 20 20 20 20 20 5f 64 72 61 77 5f 6f 70          _draw_op
3970: 65 72 61 74 69 6f 6e 20 24 5f 74 61 72 67 65 74  eration $_target
3980: 20 24 5f 74 79 70 65 0a 20 20 20 20 7d 0a 20 20   $_type.    }.  
3990: 20 20 75 70 64 61 74 65 0a 20 20 20 20 63 61 74    update.    cat
39a0: 63 68 20 7b 0a 20 20 20 20 20 20 20 20 62 69 6e  ch {.        bin
39b0: 64 20 24 5f 74 6f 70 20 3c 42 24 5f 65 76 74 2d  d $_top <B$_evt-
39c0: 4d 6f 74 69 6f 6e 3e 20 7b 44 72 6f 70 53 69 74  Motion> {DropSit
39d0: 65 3a 3a 5f 6d 6f 74 69 6f 6e 20 20 25 58 20 25  e::_motion  %X %
39e0: 59 7d 0a 20 20 20 20 20 20 20 20 62 69 6e 64 20  Y}.        bind 
39f0: 24 5f 74 6f 70 20 3c 4d 6f 74 69 6f 6e 3e 20 20  $_top <Motion>  
3a00: 20 20 20 20 20 20 7b 44 72 6f 70 53 69 74 65 3a        {DropSite:
3a10: 3a 5f 72 65 6c 65 61 73 65 20 25 58 20 25 59 7d  :_release %X %Y}
3a20: 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 0a 23 20 2d 2d  .    }.}....# --
3a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
3a80: 6d 6d 61 6e 64 20 44 72 6f 70 53 69 74 65 3a 3a  mmand DropSite::
3a90: 5f 72 65 6c 65 61 73 65 0a 23 20 2d 2d 2d 2d 2d  _release.# -----
3aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ad0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ae0: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 72 6f  -------.proc Dro
3af0: 70 53 69 74 65 3a 3a 5f 72 65 6c 65 61 73 65 20  pSite::_release 
3b00: 7b 20 58 20 59 20 7d 20 7b 0a 20 20 20 20 76 61  { X Y } {.    va
3b10: 72 69 61 62 6c 65 20 5f 74 61 72 67 65 74 0a 20  riable _target. 
3b20: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 73 74 61     variable _sta
3b30: 74 75 73 0a 20 20 20 20 76 61 72 69 61 62 6c 65  tus.    variable
3b40: 20 5f 63 75 72 6f 70 0a 20 20 20 20 76 61 72 69   _curop.    vari
3b50: 61 62 6c 65 20 5f 73 6f 75 72 63 65 0a 20 20 20  able _source.   
3b60: 20 76 61 72 69 61 62 6c 65 20 5f 74 79 70 65 0a   variable _type.
3b70: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 64 61      variable _da
3b80: 74 61 0a 0a 20 20 20 20 69 66 20 7b 20 24 5f 73  ta..    if { $_s
3b90: 74 61 74 75 73 20 26 20 31 20 7d 20 7b 0a 20 20  tatus & 1 } {.  
3ba0: 20 20 20 20 20 20 75 70 76 61 72 20 5c 23 30 20        upvar \#0 
3bb0: 44 72 6f 70 53 69 74 65 3a 3a 24 5f 74 61 72 67  DropSite::$_targ
3bc0: 65 74 20 64 72 6f 70 0a 0a 20 20 20 20 20 20 20  et drop..       
3bd0: 20 73 65 74 20 72 65 73 20 5b 75 70 6c 65 76 65   set res [upleve
3be0: 6c 20 5c 23 30 20 24 64 72 6f 70 28 64 72 6f 70  l \#0 $drop(drop
3bf0: 63 6d 64 29 20 5b 6c 69 73 74 20 24 5f 74 61 72  cmd) [list $_tar
3c00: 67 65 74 20 24 5f 73 6f 75 72 63 65 20 24 58 20  get $_source $X 
3c10: 24 59 20 24 5f 63 75 72 6f 70 20 24 5f 74 79 70  $Y $_curop $_typ
3c20: 65 20 24 5f 64 61 74 61 5d 5d 0a 20 20 20 20 20  e $_data]].     
3c30: 20 20 20 44 72 61 67 53 69 74 65 3a 3a 5f 65 6e     DragSite::_en
3c40: 64 5f 64 72 61 67 20 24 5f 73 6f 75 72 63 65 20  d_drag $_source 
3c50: 24 5f 74 61 72 67 65 74 20 24 64 72 6f 70 28 24  $_target $drop($
3c60: 5f 74 79 70 65 2c 6f 70 73 2c 24 5f 63 75 72 6f  _type,ops,$_curo
3c70: 70 29 20 24 5f 74 79 70 65 20 24 5f 64 61 74 61  p) $_type $_data
3c80: 20 24 72 65 73 0a 20 20 20 20 7d 20 65 6c 73 65   $res.    } else
3c90: 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20   {.        if { 
3ca0: 24 5f 73 74 61 74 75 73 20 26 20 32 20 7d 20 7b  $_status & 2 } {
3cb0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 6e  .            # n
3cc0: 6f 74 69 66 79 20 6c 65 61 76 65 20 65 76 65 6e  otify leave even
3cd0: 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 75 70  t.            up
3ce0: 76 61 72 20 5c 23 30 20 44 72 6f 70 53 69 74 65  var \#0 DropSite
3cf0: 3a 3a 24 5f 74 61 72 67 65 74 20 64 72 6f 70 0a  ::$_target drop.
3d00: 20 20 20 20 20 20 20 20 20 20 20 20 75 70 6c 65              uple
3d10: 76 65 6c 20 5c 23 30 20 24 64 72 6f 70 28 6f 76  vel \#0 $drop(ov
3d20: 65 72 63 6d 64 29 20 5b 6c 69 73 74 20 24 5f 74  ercmd) [list $_t
3d30: 61 72 67 65 74 20 24 5f 73 6f 75 72 63 65 20 6c  arget $_source l
3d40: 65 61 76 65 20 24 58 20 24 59 20 24 5f 63 75 72  eave $X $Y $_cur
3d50: 6f 70 20 24 5f 74 79 70 65 20 24 5f 64 61 74 61  op $_type $_data
3d60: 5d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  ].        }.    
3d70: 20 20 20 20 44 72 61 67 53 69 74 65 3a 3a 5f 65      DragSite::_e
3d80: 6e 64 5f 64 72 61 67 20 24 5f 73 6f 75 72 63 65  nd_drag $_source
3d90: 20 22 22 20 22 22 20 24 5f 74 79 70 65 20 24 5f   "" "" $_type $_
3da0: 64 61 74 61 20 30 0a 20 20 20 20 7d 0a 7d 0a     data 0.    }.}.