arcadia 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- 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
|
+
}
|