arcadia 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. data/README +126 -123
  2. data/arcadia.rb +770 -756
  3. data/base/a-contracts.rb +130 -93
  4. data/base/a-ext.rb +280 -280
  5. data/base/a-libs.rb +5 -11
  6. data/base/a-utils.rb +235 -44
  7. data/conf/arcadia.conf +20 -16
  8. data/conf/arcadia.init.rb +0 -0
  9. data/conf/arcadia.res.rb +74 -0
  10. data/ext/ae-complete-code/ae-complete-code.conf +0 -0
  11. data/ext/ae-complete-code/ae-complete-code.rb +80 -79
  12. data/ext/ae-debug/ae-debug.conf +0 -0
  13. data/ext/ae-debug/ae-debug.rb +2 -6
  14. data/ext/ae-debug/debug1.57.rb +0 -0
  15. data/ext/ae-doc-code/ae-doc-code.conf +15 -0
  16. data/ext/ae-doc-code/ae-doc-code.rb +289 -0
  17. data/ext/ae-editor/ae-editor.conf +17 -8
  18. data/ext/ae-editor/ae-editor.rb +738 -396
  19. data/ext/ae-event-log/ae-event-log.conf +0 -0
  20. data/ext/ae-event-log/ae-event-log.rb +0 -0
  21. data/ext/ae-file-history/ae-file-history.conf +2 -2
  22. data/ext/ae-file-history/ae-file-history.rb +286 -290
  23. data/ext/ae-inspector/ae-inspector.conf +0 -0
  24. data/ext/ae-inspector/ae-inspector.rb +0 -0
  25. data/ext/ae-output-event/ae-output-event.conf +2 -2
  26. data/ext/ae-output/ae-output.conf +2 -2
  27. data/ext/ae-output/ae-output.rb +173 -178
  28. data/ext/ae-palette/ae-palette.conf +0 -0
  29. data/ext/ae-palette/ae-palette.rb +0 -0
  30. data/ext/ae-shell/ae-shell.conf +0 -0
  31. data/ext/ae-shell/ae-shell.rb +54 -54
  32. data/lib/tk/al-tk.rb +3076 -3082
  33. data/lib/tk/al-tk.res.rb +0 -0
  34. data/lib/tk/al-tkarcadia.rb +0 -0
  35. data/lib/tk/al-tkcustom.rb +0 -0
  36. data/lib/tkext/al-bwidget.rb +0 -0
  37. data/lib/tkext/al-iwidgets.rb +0 -0
  38. data/lib/tkext/al-tile.rb +0 -0
  39. data/lib/tkext/al-tktable.rb +0 -0
  40. data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
  41. data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
  42. data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
  43. data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
  44. data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
  45. data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
  46. data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
  47. data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
  48. data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
  49. data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
  50. data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
  51. data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
  52. data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
  53. data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
  54. data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
  55. data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
  56. data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
  57. data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
  58. data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
  59. data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
  60. data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
  61. data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
  62. data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
  63. data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
  64. data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
  65. data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
  66. data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
  67. data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
  68. data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
  69. data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
  70. data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
  71. data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
  72. data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
  73. data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
  74. data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
  75. data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
  76. data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
  77. data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
  78. data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
  79. data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
  80. data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
  81. data/tcl/BWidget-1.8.0/README.txt +127 -0
  82. data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
  83. data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
  84. data/tcl/BWidget-1.8.0/button.tcl +324 -0
  85. data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
  86. data/tcl/BWidget-1.8.0/color.tcl +493 -0
  87. data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
  88. data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
  89. data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
  90. data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
  91. data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
  92. data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
  93. data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
  94. data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
  95. data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
  96. data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
  97. data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
  98. data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
  99. data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
  100. data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
  101. data/tcl/BWidget-1.8.0/entry.tcl +469 -0
  102. data/tcl/BWidget-1.8.0/font.tcl +566 -0
  103. data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
  104. data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
  105. data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
  106. data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
  107. data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
  108. data/tcl/BWidget-1.8.0/images/error.gif +0 -0
  109. data/tcl/BWidget-1.8.0/images/file.gif +0 -0
  110. data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
  111. data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
  112. data/tcl/BWidget-1.8.0/images/info.gif +0 -0
  113. data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
  114. data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
  115. data/tcl/BWidget-1.8.0/images/new.gif +0 -0
  116. data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
  117. data/tcl/BWidget-1.8.0/images/open.gif +0 -0
  118. data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
  119. data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
  120. data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
  121. data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
  122. data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
  123. data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
  124. data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
  125. data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
  126. data/tcl/BWidget-1.8.0/images/print.gif +0 -0
  127. data/tcl/BWidget-1.8.0/images/question.gif +0 -0
  128. data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
  129. data/tcl/BWidget-1.8.0/images/save.gif +0 -0
  130. data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
  131. data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
  132. data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
  133. data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
  134. data/tcl/BWidget-1.8.0/init.tcl +40 -0
  135. data/tcl/BWidget-1.8.0/label.tcl +271 -0
  136. data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
  137. data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
  138. data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
  139. data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
  140. data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
  141. data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
  142. data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
  143. data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
  144. data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
  145. data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
  146. data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
  147. data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
  148. data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
  149. data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
  150. data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
  151. data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
  152. data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
  153. data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
  154. data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
  155. data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
  156. data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
  157. data/tcl/BWidget-1.8.0/separator.tcl +75 -0
  158. data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
  159. data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
  160. data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
  161. data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
  162. data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
  163. data/tcl/BWidget-1.8.0/utils.tcl +645 -0
  164. data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
  165. data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
  166. data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
  167. metadata +141 -5
@@ -0,0 +1,469 @@
1
+ # ------------------------------------------------------------------------------
2
+ # entry.tcl
3
+ # This file is part of Unifix BWidget Toolkit
4
+ # $Id: entry.tcl,v 1.21 2004/04/21 22:26:30 hobbs Exp $
5
+ # ------------------------------------------------------------------------------
6
+ # Index of commands:
7
+ # - Entry::create
8
+ # - Entry::configure
9
+ # - Entry::cget
10
+ # - Entry::_destroy
11
+ # - Entry::_init_drag_cmd
12
+ # - Entry::_end_drag_cmd
13
+ # - Entry::_drop_cmd
14
+ # - Entry::_over_cmd
15
+ # - Entry::_auto_scroll
16
+ # - Entry::_scroll
17
+ # ------------------------------------------------------------------------------
18
+
19
+ namespace eval Entry {
20
+ Widget::define Entry entry DragSite DropSite DynamicHelp
21
+
22
+ # Note: -textvariable is pulled off of the tk entry and put onto the
23
+ # BW Entry so that we avoid the TkResource test for it, which screws up
24
+ # the existance/non-existance bits of the -textvariable.
25
+ Widget::tkinclude Entry entry :cmd \
26
+ remove { -state -background -foreground -textvariable
27
+ -disabledforeground -disabledbackground }
28
+
29
+ set declare [list \
30
+ [list -background TkResource "" 0 entry] \
31
+ [list -foreground TkResource "" 0 entry] \
32
+ [list -state Enum normal 0 [list normal disabled]] \
33
+ [list -text String "" 0] \
34
+ [list -textvariable String "" 0] \
35
+ [list -editable Boolean 1 0] \
36
+ [list -command String "" 0] \
37
+ [list -relief TkResource "" 0 entry] \
38
+ [list -borderwidth TkResource "" 0 entry] \
39
+ [list -fg Synonym -foreground] \
40
+ [list -bg Synonym -background] \
41
+ [list -bd Synonym -borderwidth] \
42
+ ]
43
+
44
+ if {![package vsatisfies [package provide Tk] 8.4]} {
45
+ ## If we're not running version 8.4 or higher, get our
46
+ ## disabled resources from the button widget.
47
+ lappend declare [list -disabledforeground TkResource "" 0 button]
48
+ lappend declare [list -disabledbackground TkResource "" 0 \
49
+ {button -background}]
50
+ } else {
51
+ lappend declare [list -disabledforeground TkResource "" 0 entry]
52
+ lappend declare [list -disabledbackground TkResource "" 0 entry]
53
+ }
54
+
55
+ Widget::declare Entry $declare
56
+ Widget::addmap Entry "" :cmd { -textvariable {} }
57
+
58
+ DynamicHelp::include Entry balloon
59
+ DragSite::include Entry "" 3
60
+ DropSite::include Entry {
61
+ TEXT {move {}}
62
+ FGCOLOR {move {}}
63
+ BGCOLOR {move {}}
64
+ COLOR {move {}}
65
+ }
66
+
67
+ foreach event [bind Entry] {
68
+ bind BwEntry $event [bind Entry $event]
69
+ }
70
+
71
+ # Copy is kind of a special event. It should be enabled when the
72
+ # widget is editable but not disabled, and not when the widget is disabled.
73
+ # To make this a bit easier to manage, we will handle it separately.
74
+
75
+ bind BwEntry <<Copy>> {}
76
+ bind BwEditableEntry <<Copy>> [bind Entry <<Copy>>]
77
+
78
+ bind BwEntry <Return> [list Entry::invoke %W]
79
+ bind BwEntry <Destroy> [list Entry::_destroy %W]
80
+ bind BwDisabledEntry <Destroy> [list Entry::_destroy %W]
81
+ }
82
+
83
+
84
+ # ------------------------------------------------------------------------------
85
+ # Command Entry::create
86
+ # ------------------------------------------------------------------------------
87
+ proc Entry::create { path args } {
88
+ variable $path
89
+ upvar 0 $path data
90
+
91
+ array set maps [list Entry {} :cmd {}]
92
+ array set maps [Widget::parseArgs Entry $args]
93
+
94
+ set data(afterid) ""
95
+ eval [list entry $path] $maps(:cmd)
96
+ Widget::initFromODB Entry $path $maps(Entry)
97
+ set state [Widget::getMegawidgetOption $path -state]
98
+ set editable [Widget::getMegawidgetOption $path -editable]
99
+ set text [Widget::getMegawidgetOption $path -text]
100
+ if { $editable && [string equal $state "normal"] } {
101
+ bindtags $path [list $path BwEntry [winfo toplevel $path] all]
102
+ $path configure -takefocus 1 -insertontime 600
103
+ } else {
104
+ bindtags $path [list $path BwDisabledEntry [winfo toplevel $path] all]
105
+ $path configure -takefocus 0 -insertontime 0
106
+ }
107
+ if { $editable == 0 } {
108
+ $path configure -cursor left_ptr
109
+ }
110
+ if { [string equal $state "disabled"] } {
111
+ $path configure \
112
+ -foreground [Widget::getMegawidgetOption $path -disabledforeground] \
113
+ -background [Widget::getMegawidgetOption $path -disabledbackground]
114
+ } else {
115
+ $path configure \
116
+ -foreground [Widget::getMegawidgetOption $path -foreground] \
117
+ -background [Widget::getMegawidgetOption $path -background]
118
+ bindtags $path [linsert [bindtags $path] 2 BwEditableEntry]
119
+ }
120
+ if { [string length $text] } {
121
+ set varName [$path cget -textvariable]
122
+ if { ![string equal $varName ""] } {
123
+ uplevel \#0 [list set $varName [Widget::cget $path -text]]
124
+ } else {
125
+ set validateState [$path cget -validate]
126
+ $path configure -validate none
127
+ $path delete 0 end
128
+ $path configure -validate $validateState
129
+ $path insert 0 [Widget::getMegawidgetOption $path -text]
130
+ }
131
+ }
132
+
133
+ DragSite::setdrag $path $path Entry::_init_drag_cmd Entry::_end_drag_cmd 1
134
+ DropSite::setdrop $path $path Entry::_over_cmd Entry::_drop_cmd 1
135
+ DynamicHelp::sethelp $path $path 1
136
+
137
+ Widget::create Entry $path
138
+ proc ::$path { cmd args } \
139
+ "return \[Entry::_path_command [list $path] \$cmd \$args\]"
140
+ return $path
141
+ }
142
+
143
+
144
+ # ------------------------------------------------------------------------------
145
+ # Command Entry::configure
146
+ # ------------------------------------------------------------------------------
147
+ proc Entry::configure { path args } {
148
+ # Cheat by setting the -text value to the current contents of the entry
149
+ # This might be better hidden behind a function in ::Widget.
150
+ set Widget::Entry::${path}:opt(-text) [$path:cmd get]
151
+
152
+ set res [Widget::configure $path $args]
153
+
154
+ # Extract the modified bits that we are interested in.
155
+ set vars [list chstate cheditable chfg chdfg chbg chdbg chtext]
156
+ set opts [list -state -editable -foreground -disabledforeground \
157
+ -background -disabledbackground -text]
158
+ foreach $vars [eval [linsert $opts 0 Widget::hasChangedX $path]] { break }
159
+
160
+ if { $chstate || $cheditable } {
161
+ set state [Widget::getMegawidgetOption $path -state]
162
+ set editable [Widget::getMegawidgetOption $path -editable]
163
+ set btags [bindtags $path]
164
+ if { $editable && [string equal $state "normal"] } {
165
+ set idx [lsearch $btags BwDisabledEntry]
166
+ if { $idx != -1 } {
167
+ bindtags $path [lreplace $btags $idx $idx BwEntry]
168
+ }
169
+ $path:cmd configure -takefocus 1 -insertontime 600
170
+ } else {
171
+ set idx [lsearch $btags BwEntry]
172
+ if { $idx != -1 } {
173
+ bindtags $path [lreplace $btags $idx $idx BwDisabledEntry]
174
+ }
175
+ $path:cmd configure -takefocus 0 -insertontime 0
176
+ if { [string equal [focus] $path] } {
177
+ focus .
178
+ }
179
+ }
180
+ }
181
+
182
+ if { $chstate || $chfg || $chdfg || $chbg || $chdbg } {
183
+ set state [Widget::getMegawidgetOption $path -state]
184
+ if { [string equal $state "disabled"] } {
185
+ $path:cmd configure \
186
+ -fg [Widget::cget $path -disabledforeground] \
187
+ -bg [Widget::cget $path -disabledbackground]
188
+ } else {
189
+ $path:cmd configure \
190
+ -fg [Widget::cget $path -foreground] \
191
+ -bg [Widget::cget $path -background]
192
+ }
193
+ }
194
+ if { $chstate } {
195
+ if { [string equal $state "disabled"] } {
196
+ set idx [lsearch -exact [bindtags $path] BwEditableEntry]
197
+ if { $idx != -1 } {
198
+ bindtags $path [lreplace [bindtags $path] $idx $idx]
199
+ }
200
+ } else {
201
+ set idx [expr {[lsearch [bindtags $path] Bw*Entry] + 1}]
202
+ bindtags $path [linsert [bindtags $path] $idx BwEditableEntry]
203
+ }
204
+ }
205
+
206
+ if { $cheditable } {
207
+ if { $editable } {
208
+ $path:cmd configure -cursor xterm
209
+ } else {
210
+ $path:cmd configure -cursor left_ptr
211
+ }
212
+ }
213
+
214
+ if { $chtext } {
215
+ # Oh my lordee-ba-goordee
216
+ # Do some magic to prevent multiple validation command firings.
217
+ # If there is a textvariable, set that to the right value; if not,
218
+ # disable validation, delete the old text, enable, then set the text.
219
+ set varName [$path:cmd cget -textvariable]
220
+ if { ![string equal $varName ""] } {
221
+ uplevel \#0 [list set $varName \
222
+ [Widget::getMegawidgetOption $path -text]]
223
+ } else {
224
+ set validateState [$path:cmd cget -validate]
225
+ $path:cmd configure -validate none
226
+ $path:cmd delete 0 end
227
+ $path:cmd configure -validate $validateState
228
+ $path:cmd insert 0 [Widget::getMegawidgetOption $path -text]
229
+ }
230
+ }
231
+
232
+ DragSite::setdrag $path $path Entry::_init_drag_cmd Entry::_end_drag_cmd
233
+ DropSite::setdrop $path $path Entry::_over_cmd Entry::_drop_cmd
234
+ DynamicHelp::sethelp $path $path
235
+
236
+ return $res
237
+ }
238
+
239
+
240
+ # ------------------------------------------------------------------------------
241
+ # Command Entry::cget
242
+ # ------------------------------------------------------------------------------
243
+ proc Entry::cget { path option } {
244
+ if { [string equal "-text" $option] } {
245
+ return [$path:cmd get]
246
+ }
247
+ Widget::cget $path $option
248
+ }
249
+
250
+
251
+ # ------------------------------------------------------------------------------
252
+ # Command Entry::invoke
253
+ # ------------------------------------------------------------------------------
254
+ proc Entry::invoke { path } {
255
+ if {[llength [set cmd [Widget::getMegawidgetOption $path -command]]]} {
256
+ uplevel \#0 $cmd
257
+ }
258
+ }
259
+
260
+
261
+ # ------------------------------------------------------------------------------
262
+ # Command Entry::_path_command
263
+ # ------------------------------------------------------------------------------
264
+ proc Entry::_path_command { path cmd larg } {
265
+ if {[string equal $cmd "configure"] || [string equal $cmd "cget"]} {
266
+ return [eval [linsert $larg 0 Entry::$cmd $path]]
267
+ } else {
268
+ return [eval [linsert $larg 0 $path:cmd $cmd]]
269
+ }
270
+ }
271
+
272
+
273
+ # ------------------------------------------------------------------------------
274
+ # Command Entry::_init_drag_cmd
275
+ # ------------------------------------------------------------------------------
276
+ proc Entry::_init_drag_cmd { path X Y top } {
277
+ variable $path
278
+ upvar 0 $path data
279
+
280
+ if {[llength [set cmd [Widget::getoption $path -draginitcmd]]]} {
281
+ return [uplevel \#0 $cmd [list $path $X $Y $top]]
282
+ }
283
+ set type [Widget::getoption $path -dragtype]
284
+ if { $type == "" } {
285
+ set type "TEXT"
286
+ }
287
+ if { [set drag [$path get]] != "" } {
288
+ if { [$path:cmd selection present] } {
289
+ set idx [$path:cmd index @[expr {$X-[winfo rootx $path]}]]
290
+ set sel0 [$path:cmd index sel.first]
291
+ set sel1 [expr {[$path:cmd index sel.last]-1}]
292
+ if { $idx >= $sel0 && $idx <= $sel1 } {
293
+ set drag [string range $drag $sel0 $sel1]
294
+ set data(dragstart) $sel0
295
+ set data(dragend) [expr {$sel1+1}]
296
+ if { ![Widget::getoption $path -editable] ||
297
+ [Widget::getoption $path -state] == "disabled" } {
298
+ return [list $type {copy} $drag]
299
+ } else {
300
+ return [list $type {copy move} $drag]
301
+ }
302
+ }
303
+ } else {
304
+ set data(dragstart) 0
305
+ set data(dragend) end
306
+ if { ![Widget::getoption $path -editable] ||
307
+ [Widget::getoption $path -state] == "disabled" } {
308
+ return [list $type {copy} $drag]
309
+ } else {
310
+ return [list $type {copy move} $drag]
311
+ }
312
+ }
313
+ }
314
+ }
315
+
316
+
317
+ # ------------------------------------------------------------------------------
318
+ # Command Entry::_end_drag_cmd
319
+ # ------------------------------------------------------------------------------
320
+ proc Entry::_end_drag_cmd { path target op type dnddata result } {
321
+ variable $path
322
+ upvar 0 $path data
323
+
324
+ if {[llength [set cmd [Widget::getoption $path -dragendcmd]]]} {
325
+ return [uplevel \#0 $cmd [list $path $target $op $type $dnddata $result]]
326
+ }
327
+ if { $result && $op == "move" && $path != $target } {
328
+ $path:cmd delete $data(dragstart) $data(dragend)
329
+ }
330
+ }
331
+
332
+
333
+ # ------------------------------------------------------------------------------
334
+ # Command Entry::_drop_cmd
335
+ # ------------------------------------------------------------------------------
336
+ proc Entry::_drop_cmd { path source X Y op type dnddata } {
337
+ variable $path
338
+ upvar 0 $path data
339
+
340
+ if { $data(afterid) != "" } {
341
+ after cancel $data(afterid)
342
+ set data(afterid) ""
343
+ }
344
+ if {[llength [set cmd [Widget::getoption $path -dropcmd]]]} {
345
+ set idx [$path:cmd index @[expr {$X-[winfo rootx $path]}]]
346
+ return [uplevel \#0 $cmd [list $path $source $idx $op $type $dnddata]]
347
+ }
348
+ if { $type == "COLOR" || $type == "FGCOLOR" } {
349
+ configure $path -foreground $dnddata
350
+ } elseif { $type == "BGCOLOR" } {
351
+ configure $path -background $dnddata
352
+ } else {
353
+ $path:cmd icursor @[expr {$X-[winfo rootx $path]}]
354
+ if { $op == "move" && $path == $source } {
355
+ $path:cmd delete $data(dragstart) $data(dragend)
356
+ }
357
+ set sel0 [$path index insert]
358
+ $path:cmd insert insert $dnddata
359
+ set sel1 [$path index insert]
360
+ $path:cmd selection range $sel0 $sel1
361
+ }
362
+ return 1
363
+ }
364
+
365
+
366
+ # ------------------------------------------------------------------------------
367
+ # Command Entry::_over_cmd
368
+ # ------------------------------------------------------------------------------
369
+ proc Entry::_over_cmd { path source event X Y op type dnddata } {
370
+ variable $path
371
+ upvar 0 $path data
372
+
373
+ set x [expr {$X-[winfo rootx $path]}]
374
+ if { [string equal $event "leave"] } {
375
+ if { [string length $data(afterid)] } {
376
+ after cancel $data(afterid)
377
+ set data(afterid) ""
378
+ }
379
+ } elseif { [_auto_scroll $path $x] } {
380
+ return 2
381
+ }
382
+
383
+ if {[llength [set cmd [Widget::getoption $path -dropovercmd]]]} {
384
+ set x [expr {$X-[winfo rootx $path]}]
385
+ set idx [$path:cmd index @$x]
386
+ set res [uplevel \#0 $cmd [list $path $source $event $idx $op $type $dnddata]]
387
+ return $res
388
+ }
389
+
390
+ if { [string equal $type "COLOR"] ||
391
+ [string equal $type "FGCOLOR"] ||
392
+ [string equal $type "BGCOLOR"] } {
393
+ DropSite::setcursor based_arrow_down
394
+ return 1
395
+ }
396
+ if { [Widget::getoption $path -editable]
397
+ && [string equal [Widget::getoption $path -state] "normal"] } {
398
+ if { ![string equal $event "leave"] } {
399
+ $path:cmd selection clear
400
+ $path:cmd icursor @$x
401
+ DropSite::setcursor based_arrow_down
402
+ return 3
403
+ }
404
+ }
405
+ DropSite::setcursor dot
406
+ return 0
407
+ }
408
+
409
+
410
+ # ------------------------------------------------------------------------------
411
+ # Command Entry::_auto_scroll
412
+ # ------------------------------------------------------------------------------
413
+ proc Entry::_auto_scroll { path x } {
414
+ variable $path
415
+ upvar 0 $path data
416
+
417
+ set xmax [winfo width $path]
418
+ if { $x <= 10 && [$path:cmd index @0] > 0 } {
419
+ if { $data(afterid) == "" } {
420
+ set data(afterid) [after 100 [list Entry::_scroll $path -1 $x $xmax]]
421
+ DropSite::setcursor sb_left_arrow
422
+ }
423
+ return 1
424
+ } else {
425
+ if { $x >= $xmax-10 && [$path:cmd index @$xmax] < [$path:cmd index end] } {
426
+ if { $data(afterid) == "" } {
427
+ set data(afterid) [after 100 [list Entry::_scroll $path 1 $x $xmax]]
428
+ DropSite::setcursor sb_right_arrow
429
+ }
430
+ return 1
431
+ } else {
432
+ if { $data(afterid) != "" } {
433
+ after cancel $data(afterid)
434
+ set data(afterid) ""
435
+ }
436
+ }
437
+ }
438
+ return 0
439
+ }
440
+
441
+
442
+ # ------------------------------------------------------------------------------
443
+ # Command Entry::_scroll
444
+ # ------------------------------------------------------------------------------
445
+ proc Entry::_scroll { path dir x xmax } {
446
+ variable $path
447
+ upvar 0 $path data
448
+
449
+ $path:cmd xview scroll $dir units
450
+ $path:cmd icursor @$x
451
+ if { ($dir == -1 && [$path:cmd index @0] > 0) ||
452
+ ($dir == 1 && [$path:cmd index @$xmax] < [$path:cmd index end]) } {
453
+ set data(afterid) [after 100 [list Entry::_scroll $path $dir $x $xmax]]
454
+ } else {
455
+ set data(afterid) ""
456
+ DropSite::setcursor dot
457
+ }
458
+ }
459
+
460
+
461
+ # ------------------------------------------------------------------------------
462
+ # Command Entry::_destroy
463
+ # ------------------------------------------------------------------------------
464
+ proc Entry::_destroy { path } {
465
+ variable $path
466
+ upvar 0 $path data
467
+ Widget::destroy $path
468
+ unset data
469
+ }