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.
- 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,625 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------
|
|
2
|
+
# dynhelp.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: dynhelp.tcl,v 1.15 2006/03/23 23:32:12 dev_null42a Exp $
|
|
5
|
+
# ----------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - DynamicHelp::configure
|
|
8
|
+
# - DynamicHelp::include
|
|
9
|
+
# - DynamicHelp::sethelp
|
|
10
|
+
# - DynamicHelp::register
|
|
11
|
+
# - DynamicHelp::_motion_balloon
|
|
12
|
+
# - DynamicHelp::_motion_info
|
|
13
|
+
# - DynamicHelp::_leave_info
|
|
14
|
+
# - DynamicHelp::_menu_info
|
|
15
|
+
# - DynamicHelp::_show_help
|
|
16
|
+
# - DynamicHelp::_init
|
|
17
|
+
# ----------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
# JDC: allow variable and ballon help at the same timees
|
|
20
|
+
|
|
21
|
+
namespace eval DynamicHelp {
|
|
22
|
+
Widget::define DynamicHelp dynhelp -classonly
|
|
23
|
+
|
|
24
|
+
Widget::declare DynamicHelp {
|
|
25
|
+
{-foreground TkResource black 0 label}
|
|
26
|
+
{-topbackground TkResource black 0 {label -foreground}}
|
|
27
|
+
{-background TkResource "#FFFFC0" 0 label}
|
|
28
|
+
{-borderwidth TkResource 1 0 label}
|
|
29
|
+
{-justify TkResource left 0 label}
|
|
30
|
+
{-font TkResource "helvetica 8" 0 label}
|
|
31
|
+
{-delay Int 600 0 "%d >= 100 & %d <= 2000"}
|
|
32
|
+
{-state Enum "normal" 0 {normal disabled}}
|
|
33
|
+
{-padx TkResource 1 0 label}
|
|
34
|
+
{-pady TkResource 1 0 label}
|
|
35
|
+
{-bd Synonym -borderwidth}
|
|
36
|
+
{-bg Synonym -background}
|
|
37
|
+
{-fg Synonym -foreground}
|
|
38
|
+
{-topbg Synonym -topbackground}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
proc use {} {}
|
|
42
|
+
|
|
43
|
+
variable _registered
|
|
44
|
+
variable _canvases
|
|
45
|
+
|
|
46
|
+
variable _top ".help_shell"
|
|
47
|
+
variable _id ""
|
|
48
|
+
variable _delay 600
|
|
49
|
+
variable _current_balloon ""
|
|
50
|
+
variable _current_variable ""
|
|
51
|
+
variable _saved
|
|
52
|
+
|
|
53
|
+
Widget::init DynamicHelp $_top {}
|
|
54
|
+
|
|
55
|
+
bind BwHelpBalloon <Enter> {DynamicHelp::_motion_balloon enter %W %X %Y}
|
|
56
|
+
bind BwHelpBalloon <Motion> {DynamicHelp::_motion_balloon motion %W %X %Y}
|
|
57
|
+
bind BwHelpBalloon <Leave> {DynamicHelp::_motion_balloon leave %W %X %Y}
|
|
58
|
+
bind BwHelpBalloon <Button> {DynamicHelp::_motion_balloon button %W %X %Y}
|
|
59
|
+
bind BwHelpBalloon <Destroy> {DynamicHelp::_unset_help %W}
|
|
60
|
+
|
|
61
|
+
bind BwHelpVariable <Enter> {DynamicHelp::_motion_info %W}
|
|
62
|
+
bind BwHelpVariable <Motion> {DynamicHelp::_motion_info %W}
|
|
63
|
+
bind BwHelpVariable <Leave> {DynamicHelp::_leave_info %W}
|
|
64
|
+
bind BwHelpVariable <Destroy> {DynamicHelp::_unset_help %W}
|
|
65
|
+
|
|
66
|
+
bind BwHelpMenu <<MenuSelect>> {DynamicHelp::_menu_info select %W}
|
|
67
|
+
bind BwHelpMenu <Unmap> {DynamicHelp::_menu_info unmap %W}
|
|
68
|
+
bind BwHelpMenu <Destroy> {DynamicHelp::_unset_help %W}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# ----------------------------------------------------------------------------
|
|
73
|
+
# Command DynamicHelp::configure
|
|
74
|
+
# ----------------------------------------------------------------------------
|
|
75
|
+
proc DynamicHelp::configure { args } {
|
|
76
|
+
variable _top
|
|
77
|
+
variable _delay
|
|
78
|
+
|
|
79
|
+
set res [Widget::configure $_top $args]
|
|
80
|
+
if { [Widget::hasChanged $_top -delay val] } {
|
|
81
|
+
set _delay $val
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return $res
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# ----------------------------------------------------------------------------
|
|
89
|
+
# Command DynamicHelp::include
|
|
90
|
+
# ----------------------------------------------------------------------------
|
|
91
|
+
proc DynamicHelp::include { class type } {
|
|
92
|
+
set helpoptions [list \
|
|
93
|
+
[list -helptext String "" 0] \
|
|
94
|
+
[list -helpvar String "" 0] \
|
|
95
|
+
[list -helptype Enum $type 0 [list balloon variable]] \
|
|
96
|
+
]
|
|
97
|
+
Widget::declare $class $helpoptions
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# ----------------------------------------------------------------------------
|
|
102
|
+
# Command DynamicHelp::sethelp
|
|
103
|
+
# ----------------------------------------------------------------------------
|
|
104
|
+
proc DynamicHelp::sethelp { path subpath {force 0}} {
|
|
105
|
+
foreach {ctype ctext cvar} [Widget::hasChangedX $path \
|
|
106
|
+
-helptype -helptext -helpvar] break
|
|
107
|
+
if { $force || $ctype || $ctext || $cvar } {
|
|
108
|
+
set htype [Widget::cget $path -helptype]
|
|
109
|
+
switch $htype {
|
|
110
|
+
balloon {
|
|
111
|
+
return [register $subpath balloon \
|
|
112
|
+
[Widget::cget $path -helptext]]
|
|
113
|
+
}
|
|
114
|
+
variable {
|
|
115
|
+
return [register $subpath variable \
|
|
116
|
+
[Widget::cget $path -helpvar] \
|
|
117
|
+
[Widget::cget $path -helptext]]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return [register $subpath $htype]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# ----------------------------------------------------------------------------
|
|
125
|
+
# Command DynamicHelp::register
|
|
126
|
+
#
|
|
127
|
+
# DynamicHelp::register path balloon ?itemOrTag? text
|
|
128
|
+
# DynamicHelp::register path variable ?itemOrTag? text varName
|
|
129
|
+
# DynamicHelp::register path menu varName
|
|
130
|
+
# DynamicHelp::register path menuentry index text
|
|
131
|
+
# ----------------------------------------------------------------------------
|
|
132
|
+
proc DynamicHelp::register { path type args } {
|
|
133
|
+
variable _registered
|
|
134
|
+
|
|
135
|
+
set len [llength $args]
|
|
136
|
+
if {$type == "balloon" && $len > 1} { set type canvasBalloon }
|
|
137
|
+
if {$type == "variable" && $len > 2} { set type canvasVariable }
|
|
138
|
+
|
|
139
|
+
if { ![winfo exists $path] } {
|
|
140
|
+
_unset_help $path
|
|
141
|
+
return 0
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
switch $type {
|
|
145
|
+
balloon {
|
|
146
|
+
set text [lindex $args 0]
|
|
147
|
+
if {$text == ""} {
|
|
148
|
+
if {[info exists _registered($path,balloon)]} {
|
|
149
|
+
unset _registered($path,balloon)
|
|
150
|
+
}
|
|
151
|
+
return 0
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
_add_balloon $path $text
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
canvasBalloon {
|
|
158
|
+
set tagOrItem [lindex $args 0]
|
|
159
|
+
set text [lindex $args 1]
|
|
160
|
+
if {$text == ""} {
|
|
161
|
+
if {[info exists _registered($path,$tagOrItem,balloon)]} {
|
|
162
|
+
unset _registered($path,$tagOrItem,balloon)
|
|
163
|
+
}
|
|
164
|
+
return 0
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
_add_canvas_balloon $path $text $tagOrItem
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
variable {
|
|
171
|
+
set var [lindex $args 0]
|
|
172
|
+
set text [lindex $args 1]
|
|
173
|
+
if {$text == "" || $var == ""} {
|
|
174
|
+
if {[info exists _registered($path,variable)]} {
|
|
175
|
+
unset _registered($path,variable)
|
|
176
|
+
}
|
|
177
|
+
return 0
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
_add_variable $path $text $var
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
canvasVariable {
|
|
184
|
+
set tagOrItem [lindex $args 0]
|
|
185
|
+
set var [lindex $args 1]
|
|
186
|
+
set text [lindex $args 2]
|
|
187
|
+
if {$text == "" || $var == ""} {
|
|
188
|
+
if {[info exists _registered($path,$tagOrItem,variable)]} {
|
|
189
|
+
unset _registered($path,$tagOrItem,variable)
|
|
190
|
+
}
|
|
191
|
+
return 0
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
_add_canvas_variable $path $text $var $tagOrItem
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
menu {
|
|
198
|
+
set var [lindex $args 0]
|
|
199
|
+
if {$var == ""} {
|
|
200
|
+
set cpath [BWidget::clonename $path]
|
|
201
|
+
if {[winfo exists $cpath]} { set path $cpath }
|
|
202
|
+
if {[info exists _registered($path)]} {
|
|
203
|
+
unset _registered($path)
|
|
204
|
+
}
|
|
205
|
+
return 0
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
_add_menu $path $var
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
menuentry {
|
|
212
|
+
set cpath [BWidget::clonename $path]
|
|
213
|
+
if { [winfo exists $cpath] } { set path $cpath }
|
|
214
|
+
if {![info exists _registered($path)]} { return 0 }
|
|
215
|
+
|
|
216
|
+
set text [lindex $args 1]
|
|
217
|
+
set index [lindex $args 0]
|
|
218
|
+
if {$text == "" || $index == ""} {
|
|
219
|
+
set idx [lsearch $_registed($path) [list $index *]]
|
|
220
|
+
set _registered($path) [lreplace $_registered($path) $idx $idx]
|
|
221
|
+
return 0
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_add_menuentry $path $text $index
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
default {
|
|
228
|
+
_unset_help $path
|
|
229
|
+
return 0
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return 1
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
proc DynamicHelp::add { path args } {
|
|
238
|
+
variable _registered
|
|
239
|
+
|
|
240
|
+
array set data {
|
|
241
|
+
-type balloon
|
|
242
|
+
-text ""
|
|
243
|
+
-item ""
|
|
244
|
+
-index -1
|
|
245
|
+
-command ""
|
|
246
|
+
-variable ""
|
|
247
|
+
}
|
|
248
|
+
if {[winfo exists $path] && [winfo class $path] == "Menu"} {
|
|
249
|
+
set data(-type) menu
|
|
250
|
+
}
|
|
251
|
+
array set data $args
|
|
252
|
+
|
|
253
|
+
set item $path
|
|
254
|
+
|
|
255
|
+
switch -- $data(-type) {
|
|
256
|
+
"balloon" {
|
|
257
|
+
if {$data(-item) != ""} {
|
|
258
|
+
_add_canvas_balloon $path $data(-text) $data(-item)
|
|
259
|
+
set item $path,$data(-item)
|
|
260
|
+
} else {
|
|
261
|
+
_add_balloon $path $data(-text)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if {$data(-variable) != ""} {
|
|
265
|
+
set _registered($item,balloonVar) $data(-variable)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
"variable" {
|
|
270
|
+
set var $data(-variable)
|
|
271
|
+
if {$data(-item) != ""} {
|
|
272
|
+
_add_canvas_variable $path $data(-text) $var $data(-item)
|
|
273
|
+
set item $path,$data(-item)
|
|
274
|
+
} else {
|
|
275
|
+
_add_variable $path $data(-text) $var
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
"menu" {
|
|
280
|
+
if {$data(-index) != -1} {
|
|
281
|
+
set cpath [BWidget::clonename $path]
|
|
282
|
+
if { [winfo exists $cpath] } { set path $cpath }
|
|
283
|
+
if {![info exists _registered($path)]} { return 0 }
|
|
284
|
+
_add_menuentry $path $data(-text) $data(-index)
|
|
285
|
+
set item $path,$data(-index)
|
|
286
|
+
} else {
|
|
287
|
+
_add_menu $path $data(-variable)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
default {
|
|
292
|
+
return 0
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if {$data(-command) != ""} {set _registered($item,command) $data(-command)}
|
|
297
|
+
|
|
298
|
+
return 1
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
proc DynamicHelp::delete { path } {
|
|
303
|
+
_unset_help $path
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
proc DynamicHelp::_add_bind_tag { path tag } {
|
|
308
|
+
set evt [bindtags $path]
|
|
309
|
+
set idx [lsearch $evt $tag]
|
|
310
|
+
set evt [lreplace $evt $idx $idx]
|
|
311
|
+
lappend evt $tag
|
|
312
|
+
bindtags $path $evt
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
proc DynamicHelp::_add_balloon { path text } {
|
|
317
|
+
variable _registered
|
|
318
|
+
set _registered($path,balloon) $text
|
|
319
|
+
_add_bind_tag $path BwHelpBalloon
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
proc DynamicHelp::_add_canvas_balloon { path text tagOrItem } {
|
|
324
|
+
variable _canvases
|
|
325
|
+
variable _registered
|
|
326
|
+
|
|
327
|
+
set _registered($path,$tagOrItem,balloon) $text
|
|
328
|
+
|
|
329
|
+
if {![info exists _canvases($path,balloon)]} {
|
|
330
|
+
## This canvas doesn't have the bindings yet.
|
|
331
|
+
|
|
332
|
+
_add_bind_tag $path BwHelpBalloon
|
|
333
|
+
|
|
334
|
+
$path bind BwHelpBalloon <Enter> \
|
|
335
|
+
{DynamicHelp::_motion_balloon enter %W %X %Y 1}
|
|
336
|
+
$path bind BwHelpBalloon <Motion> \
|
|
337
|
+
{DynamicHelp::_motion_balloon motion %W %X %Y 1}
|
|
338
|
+
$path bind BwHelpBalloon <Leave> \
|
|
339
|
+
{DynamicHelp::_motion_balloon leave %W %X %Y 1}
|
|
340
|
+
$path bind BwHelpBalloon <Button> \
|
|
341
|
+
{DynamicHelp::_motion_balloon button %W %X %Y 1}
|
|
342
|
+
|
|
343
|
+
set _canvases($path,balloon) 1
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
$path addtag BwHelpBalloon withtag $tagOrItem
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
proc DynamicHelp::_add_variable { path text varName } {
|
|
350
|
+
variable _registered
|
|
351
|
+
set _registered($path,variable) [list $varName $text]
|
|
352
|
+
_add_bind_tag $path BwHelpVariable
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
proc DynamicHelp::_add_canvas_variable { path text varName tagOrItem } {
|
|
357
|
+
variable _canvases
|
|
358
|
+
variable _registered
|
|
359
|
+
|
|
360
|
+
set _registered($path,$tagOrItem,variable) [list $varName $text]
|
|
361
|
+
|
|
362
|
+
if {![info exists _canvases($path,variable)]} {
|
|
363
|
+
## This canvas doesn't have the bindings yet.
|
|
364
|
+
|
|
365
|
+
_add_bind_tag $path BwHelpVariable
|
|
366
|
+
|
|
367
|
+
$path bind BwHelpVariable <Enter> \
|
|
368
|
+
{DynamicHelp::_motion_info %W 1}
|
|
369
|
+
$path bind BwHelpVariable <Motion> \
|
|
370
|
+
{DynamicHelp::_motion_info %W 1}
|
|
371
|
+
$path bind BwHelpVariable <Leave> \
|
|
372
|
+
{DynamicHelp::_leave_info %W 1}
|
|
373
|
+
|
|
374
|
+
set _canvases($path,variable) 1
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
$path addtag BwHelpVariable withtag $tagOrItem
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
proc DynamicHelp::_add_menu { path varName } {
|
|
382
|
+
variable _registered
|
|
383
|
+
|
|
384
|
+
set cpath [BWidget::clonename $path]
|
|
385
|
+
if { [winfo exists $cpath] } { set path $cpath }
|
|
386
|
+
|
|
387
|
+
set _registered($path) [list $varName]
|
|
388
|
+
_add_bind_tag $path BwHelpMenu
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
proc DynamicHelp::_add_menuentry { path text index } {
|
|
393
|
+
variable _registered
|
|
394
|
+
|
|
395
|
+
set idx [lsearch $_registered($path) [list $index *]]
|
|
396
|
+
set list [list $index $text]
|
|
397
|
+
if { $idx == -1 } {
|
|
398
|
+
lappend _registered($path) $list
|
|
399
|
+
} else {
|
|
400
|
+
set _registered($path) \
|
|
401
|
+
[lreplace $_registered($path) $idx $idx $list]
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
# ----------------------------------------------------------------------------
|
|
407
|
+
# Command DynamicHelp::_motion_balloon
|
|
408
|
+
# ----------------------------------------------------------------------------
|
|
409
|
+
proc DynamicHelp::_motion_balloon { type path x y {isCanvasItem 0} } {
|
|
410
|
+
variable _top
|
|
411
|
+
variable _id
|
|
412
|
+
variable _delay
|
|
413
|
+
variable _current_balloon
|
|
414
|
+
|
|
415
|
+
set w $path
|
|
416
|
+
if {$isCanvasItem} { set path [_get_canvas_path $path balloon] }
|
|
417
|
+
|
|
418
|
+
if { $_current_balloon != $path && $type == "enter" } {
|
|
419
|
+
set _current_balloon $path
|
|
420
|
+
set type "motion"
|
|
421
|
+
destroy $_top
|
|
422
|
+
}
|
|
423
|
+
if { $_current_balloon == $path } {
|
|
424
|
+
if { $_id != "" } {
|
|
425
|
+
after cancel $_id
|
|
426
|
+
set _id ""
|
|
427
|
+
}
|
|
428
|
+
if { $type == "motion" } {
|
|
429
|
+
if { ![winfo exists $_top] } {
|
|
430
|
+
set cmd [list DynamicHelp::_show_help $path $w $x $y]
|
|
431
|
+
set _id [after $_delay $cmd]
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
destroy $_top
|
|
435
|
+
set _current_balloon ""
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
# ----------------------------------------------------------------------------
|
|
442
|
+
# Command DynamicHelp::_motion_info
|
|
443
|
+
# ----------------------------------------------------------------------------
|
|
444
|
+
proc DynamicHelp::_motion_info { path {isCanvasItem 0} } {
|
|
445
|
+
variable _saved
|
|
446
|
+
variable _registered
|
|
447
|
+
variable _current_variable
|
|
448
|
+
|
|
449
|
+
if {$isCanvasItem} { set path [_get_canvas_path $path variable] }
|
|
450
|
+
|
|
451
|
+
if { $_current_variable != $path
|
|
452
|
+
&& [info exists _registered($path,variable)] } {
|
|
453
|
+
|
|
454
|
+
set varName [lindex $_registered($path,variable) 0]
|
|
455
|
+
if {![info exists _saved]} { set _saved [GlobalVar::getvar $varName] }
|
|
456
|
+
set string [lindex $_registered($path,variable) 1]
|
|
457
|
+
if {[info exists _registered($path,command)]} {
|
|
458
|
+
set string [eval $_registered($path,command)]
|
|
459
|
+
}
|
|
460
|
+
GlobalVar::setvar $varName $string
|
|
461
|
+
set _current_variable $path
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
# ----------------------------------------------------------------------------
|
|
467
|
+
# Command DynamicHelp::_leave_info
|
|
468
|
+
# ----------------------------------------------------------------------------
|
|
469
|
+
proc DynamicHelp::_leave_info { path {isCanvasItem 0} } {
|
|
470
|
+
variable _saved
|
|
471
|
+
variable _registered
|
|
472
|
+
variable _current_variable
|
|
473
|
+
|
|
474
|
+
if {$isCanvasItem} { set path [_get_canvas_path $path variable] }
|
|
475
|
+
|
|
476
|
+
if { [info exists _registered($path,variable)] } {
|
|
477
|
+
set varName [lindex $_registered($path,variable) 0]
|
|
478
|
+
GlobalVar::setvar $varName $_saved
|
|
479
|
+
}
|
|
480
|
+
unset _saved
|
|
481
|
+
set _current_variable ""
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
# ----------------------------------------------------------------------------
|
|
486
|
+
# Command DynamicHelp::_menu_info
|
|
487
|
+
# Version of R1v1 restored, due to lack of [winfo ismapped] and <Unmap>
|
|
488
|
+
# under windows for menu.
|
|
489
|
+
# ----------------------------------------------------------------------------
|
|
490
|
+
proc DynamicHelp::_menu_info { event path } {
|
|
491
|
+
variable _registered
|
|
492
|
+
|
|
493
|
+
if { [info exists _registered($path)] } {
|
|
494
|
+
set index [$path index active]
|
|
495
|
+
set varName [lindex $_registered($path) 0]
|
|
496
|
+
if { ![string equal $index "none"] &&
|
|
497
|
+
[set idx [lsearch $_registered($path) [list $index *]]] != -1 } {
|
|
498
|
+
set string [lindex [lindex $_registered($path) $idx] 1]
|
|
499
|
+
if {[info exists _registered($path,$index,command)]} {
|
|
500
|
+
set string [eval $_registered($path,$index,command)]
|
|
501
|
+
}
|
|
502
|
+
GlobalVar::setvar $varName $string
|
|
503
|
+
} else {
|
|
504
|
+
GlobalVar::setvar $varName ""
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
# ----------------------------------------------------------------------------
|
|
511
|
+
# Command DynamicHelp::_show_help
|
|
512
|
+
# ----------------------------------------------------------------------------
|
|
513
|
+
proc DynamicHelp::_show_help { path w x y } {
|
|
514
|
+
variable _top
|
|
515
|
+
variable _registered
|
|
516
|
+
variable _id
|
|
517
|
+
variable _delay
|
|
518
|
+
|
|
519
|
+
if { [Widget::getoption $_top -state] == "disabled" } { return }
|
|
520
|
+
|
|
521
|
+
if { [info exists _registered($path,balloon)] } {
|
|
522
|
+
destroy $_top
|
|
523
|
+
|
|
524
|
+
set string $_registered($path,balloon)
|
|
525
|
+
|
|
526
|
+
if {[info exists _registered($path,balloonVar)]} {
|
|
527
|
+
upvar #0 $_registered($path,balloonVar) var
|
|
528
|
+
if {[info exists var]} { set string $var }
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if {[info exists _registered($path,command)]} {
|
|
532
|
+
set string [eval $_registered($path,command)]
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if {$string == ""} { return }
|
|
536
|
+
|
|
537
|
+
toplevel $_top -relief flat \
|
|
538
|
+
-bg [Widget::getoption $_top -topbackground] \
|
|
539
|
+
-bd [Widget::getoption $_top -borderwidth] \
|
|
540
|
+
-screen [winfo screen $w]
|
|
541
|
+
|
|
542
|
+
wm withdraw $_top
|
|
543
|
+
if {$::tk_version >= 8.4
|
|
544
|
+
&& [string equal [tk windowingsystem] "aqua"]} {
|
|
545
|
+
::tk::unsupported::MacWindowStyle style $_top help none
|
|
546
|
+
} else {
|
|
547
|
+
wm overrideredirect $_top 1
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
catch { wm attributes $_top -topmost 1 }
|
|
551
|
+
|
|
552
|
+
label $_top.label -text $string \
|
|
553
|
+
-relief flat -bd 0 -highlightthickness 0 \
|
|
554
|
+
-padx [Widget::getoption $_top -padx] \
|
|
555
|
+
-pady [Widget::getoption $_top -pady] \
|
|
556
|
+
-foreground [Widget::getoption $_top -foreground] \
|
|
557
|
+
-background [Widget::getoption $_top -background] \
|
|
558
|
+
-font [Widget::getoption $_top -font] \
|
|
559
|
+
-justify [Widget::getoption $_top -justify]
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
pack $_top.label -side left
|
|
563
|
+
update idletasks
|
|
564
|
+
|
|
565
|
+
if {![winfo exists $_top]} {return}
|
|
566
|
+
|
|
567
|
+
set scrwidth [winfo vrootwidth .]
|
|
568
|
+
set scrheight [winfo vrootheight .]
|
|
569
|
+
set width [winfo reqwidth $_top]
|
|
570
|
+
set height [winfo reqheight $_top]
|
|
571
|
+
incr y 12
|
|
572
|
+
incr x 8
|
|
573
|
+
|
|
574
|
+
if { $x+$width > $scrwidth } {
|
|
575
|
+
set x [expr {$scrwidth - $width}]
|
|
576
|
+
}
|
|
577
|
+
if { $y+$height > $scrheight } {
|
|
578
|
+
set y [expr {$y - 12 - $height}]
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
wm geometry $_top "+$x+$y"
|
|
582
|
+
update idletasks
|
|
583
|
+
|
|
584
|
+
if {![winfo exists $_top]} { return }
|
|
585
|
+
wm deiconify $_top
|
|
586
|
+
raise $_top
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
# ----------------------------------------------------------------------------
|
|
591
|
+
# Command DynamicHelp::_unset_help
|
|
592
|
+
# ----------------------------------------------------------------------------
|
|
593
|
+
proc DynamicHelp::_unset_help { path } {
|
|
594
|
+
variable _canvases
|
|
595
|
+
variable _registered
|
|
596
|
+
variable _top
|
|
597
|
+
|
|
598
|
+
if {[info exists _registered($path)]} { unset _registered($path) }
|
|
599
|
+
if {[winfo exists $path]} {
|
|
600
|
+
set cpath [BWidget::clonename $path]
|
|
601
|
+
if {[info exists _registered($cpath)]} { unset _registered($cpath) }
|
|
602
|
+
}
|
|
603
|
+
array unset _canvases $path,*
|
|
604
|
+
array unset _registered $path,*
|
|
605
|
+
destroy $_top
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
# ----------------------------------------------------------------------------
|
|
609
|
+
# Command DynamicHelp::_get_canvas_path
|
|
610
|
+
# ----------------------------------------------------------------------------
|
|
611
|
+
proc DynamicHelp::_get_canvas_path { path type {item ""} } {
|
|
612
|
+
variable _registered
|
|
613
|
+
|
|
614
|
+
if {$item == ""} { set item [$path find withtag current] }
|
|
615
|
+
|
|
616
|
+
## Check the tags related to this item for the one that
|
|
617
|
+
## represents our text. If we have text specific to this
|
|
618
|
+
## item or for 'all' items, they override any other tags.
|
|
619
|
+
eval [list lappend tags $item all] [$path itemcget $item -tags]
|
|
620
|
+
foreach tag $tags {
|
|
621
|
+
set check $path,$tag
|
|
622
|
+
if {![info exists _registered($check,$type)]} { continue }
|
|
623
|
+
return $check
|
|
624
|
+
}
|
|
625
|
+
}
|