arcadia 0.12.2 → 0.13.0
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 +25 -14
- data/conf/LC/en-UK.LANG +3 -1
- data/conf/arcadia.conf +10 -0
- data/conf/arcadia.res.rb +29 -1
- data/ext/ae-editor/ae-editor.rb +239 -48
- data/ext/ae-file-history/ae-file-history.conf +11 -1
- data/ext/ae-file-history/ae-file-history.rb +120 -2
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +6 -5
- data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +7 -3
- data/ext/ae-term/ae-term.rb +1 -1
- data/lib/a-commons.rb +72 -56
- data/lib/a-contracts.rb +23 -1
- data/lib/a-core.rb +136 -41
- data/lib/a-tkcommons.rb +127 -36
- data/tcl/fsdialog/fsdialog.tcl +2 -2
- data/tcl/ptwidgets-1.1.0/COPYRIGHT +10 -0
- data/tcl/ptwidgets-1.1.0/ChangeLog +194 -0
- data/tcl/ptwidgets-1.1.0/README +50 -0
- data/tcl/ptwidgets-1.1.0/common/stacktrace.tcl +29 -0
- data/tcl/ptwidgets-1.1.0/common/tokenframe.tcl +200 -0
- data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_off.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_on.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokenentry.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example2.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/img/wmarkentry.png +0 -0
- data/tcl/ptwidgets-1.1.0/doc/toggleswitch.html +402 -0
- data/tcl/ptwidgets-1.1.0/doc/tokenentry.html +1366 -0
- data/tcl/ptwidgets-1.1.0/doc/tokensearch.html +1549 -0
- data/tcl/ptwidgets-1.1.0/doc/wmarkentry.html +634 -0
- data/tcl/ptwidgets-1.1.0/library/toggleswitch.tcl +432 -0
- data/tcl/ptwidgets-1.1.0/library/tokenentry.tcl +2208 -0
- data/tcl/ptwidgets-1.1.0/library/tokensearch.tcl +2488 -0
- data/tcl/ptwidgets-1.1.0/library/wmarkentry.tcl +630 -0
- data/tcl/ptwidgets-1.1.0/pkgIndex.tcl +10 -0
- data/tcl/ptwidgets-1.1.0/test/Makefile +3 -0
- data/tcl/ptwidgets-1.1.0/test/run.tcl +3 -0
- data/tcl/ptwidgets-1.1.0/test/test.tcl +89 -0
- data/tcl/ptwidgets-1.1.0/test/toggleswitch.test +562 -0
- data/tcl/ptwidgets-1.1.0/test/tokenentry.test +1023 -0
- data/tcl/ptwidgets-1.1.0/test/tokensearch.test +1023 -0
- data/tcl/ptwidgets-1.1.0/test/wmarkentry.test +1325 -0
- data/tcl/themes/altTheme.tcl +101 -0
- data/tcl/themes/aquaTheme.tcl +59 -0
- data/tcl/themes/clamTheme.tcl +140 -0
- data/tcl/themes/classicTheme.tcl +108 -0
- data/tcl/themes/pkgIndex.tcl +3 -0
- data/tcl/themes/ttk.tcl +176 -0
- data/tcl/themes/vistaTheme.tcl +224 -0
- data/tcl/themes/winTheme.tcl +80 -0
- data/tcl/themes/xpTheme.tcl +65 -0
- data/tcl/tkfbox/folder.gif +0 -0
- data/tcl/tkfbox/textfile.gif +0 -0
- data/tcl/tkfbox/tkfbox.tcl +1 -0
- data/tcl/tkfbox/tkfbox.tcl~ +1 -0
- data/tcl/tkfbox/updir.xbm +1 -0
- metadata +43 -2
@@ -0,0 +1 @@
|
|
1
|
+
# tkfbox.tcl --
|
2
|
return [mtkFDialog open $args]
|
1
3
|
|
2
4
|
return [mtkFDialog save $args]
|
3
5
|
global tkPriv data
|
4
6
|
|
5
7
|
if [info exists data] {unset data}
|
6
8
|
create-file-dialog
|
7
9
|
mtkFDialog_Config $type $argList
|
8
10
|
mtkFDialog_SetPath $data(selectPath)
|
9
11
|
# 6. Withdraw the window, then update all the geometry information
|
10
12
|
# so we know how big it wants to be, then center the window in the
|
11
13
|
# display and de-iconify it.
|
12
14
|
wm withdraw .tkfd
|
13
15
|
update idletasks
|
14
16
|
set x [expr [winfo screenwidth .tkfd]/2 - [winfo reqwidth .tkfd]/2 \
|
15
17
|
set y [expr [winfo screenheight .tkfd]/2 - [winfo reqheight .tkfd]/2 \
|
16
18
|
wm geom .tkfd [winfo reqwidth .tkfd]x[winfo reqheight .tkfd]+$x+$y
|
17
19
|
wm deiconify .tkfd
|
18
20
|
wm title .tkfd $data(-title)
|
19
21
|
# 7. Set a grab and claim the focus too.
|
20
22
|
set oldFocus [focus]
|
21
23
|
set oldGrab [grab current .tkfd]
|
22
24
|
if {$oldGrab != ""} {
|
23
25
|
}
|
24
26
|
#Mick: changed to grab global
|
25
27
|
grab .tkfd
|
26
28
|
wm transient .tkfd .
|
27
29
|
focus .tkfd.f2.ent
|
28
30
|
.tkfd.f2.ent delete 0 end
|
29
31
|
.tkfd.f2.ent insert 0 $data(selectFile)
|
30
32
|
.tkfd.f2.ent select from 0
|
31
33
|
.tkfd.f2.ent select to end
|
32
34
|
.tkfd.f2.ent icursor end
|
33
35
|
# Ensure the window is fronted
|
34
36
|
raise .tkfd
|
35
37
|
|
36
38
|
# 8. Wait for the user to respond, then restore the focus and
|
37
39
|
# return the index of the selected button. Restore the focus
|
38
40
|
# before deleting the window, since otherwise the window manager
|
39
41
|
# may take the focus away so we can't redirect it. Finally,
|
40
42
|
# restore any grab that was in effect.
|
41
43
|
tkwait variable tkPriv(selectFilePath)
|
42
44
|
catch {focus $oldFocus}
|
43
45
|
grab release .tkfd
|
44
46
|
wm withdraw .tkfd
|
45
47
|
if {$oldGrab != ""} {
|
46
48
|
}
|
47
49
|
update
|
48
50
|
return $tkPriv(selectFilePath)
|
49
51
|
global LIBRARY data tkPriv
|
50
52
|
if [winfo exists .tkfd] {destroy .tkfd}
|
51
53
|
toplevel .tkfd -class mtkFDialog
|
52
54
|
wm protocol .tkfd WM_DELETE_WINDOW "mtkFDialog_CancelCmd"
|
53
55
|
# f1: the frame with the directory option menu
|
54
56
|
#
|
55
57
|
set f1 [frame .tkfd.f1]
|
56
58
|
label .tkfd.f1.lab -text "Directory:" -under 0
|
57
59
|
tk_optionMenu .tkfd.f1.menu data(selectPath) ""
|
58
60
|
.tkfd.f1.menu config -takefocus 1 -highlightthickness 2
|
59
61
|
button .tkfd.f1.up -bitmap @[file join $LIBRARY updir.xbm]
|
60
62
|
|
61
63
|
pack .tkfd.f1.up -side right -padx 4 -fill both
|
62
64
|
pack .tkfd.f1.lab -side left -padx 4 -fill both
|
63
65
|
pack .tkfd.f1.menu -expand yes -fill both -padx 4
|
64
66
|
# .tkfd.icons: the IconList that list the files and directories.
|
65
67
|
#
|
66
68
|
tkIconList .tkfd.icons\
|
67
69
|
# f2: the frame with the OK button and the "file name" field
|
68
70
|
#
|
69
71
|
frame .tkfd.f2
|
70
72
|
label .tkfd.f2.lab -text "File name:" -anchor e -width 14 -under 6
|
71
73
|
entry .tkfd.f2.ent -bg white
|
72
74
|
# f3: the frame with the cancel button and the file types field
|
73
75
|
#
|
74
76
|
frame .tkfd.f3
|
75
77
|
label .tkfd.f3.lab -text "Files of type:" \
|
76
78
|
menubutton .tkfd.f3.menu -indicatoron 1 -menu .tkfd.f3.menu.m
|
77
79
|
menu .tkfd.f3.menu.m -tearoff 0
|
78
80
|
.tkfd.f3.menu config -takefocus 1 -highlightthickness 2 \
|
79
81
|
# the okBtn is created after the typeMenu so that the keyboard traversal
|
80
82
|
# is in the right order
|
81
83
|
button .tkfd.f2.ok -text OK -under 0 -width 6
|
82
84
|
button .tkfd.f3.cancel -text Cancel -under 0 -width 6
|
83
85
|
# pack the widgets in f2 and f3
|
84
86
|
#
|
85
87
|
pack .tkfd.f2.ok -side right -padx 4 -anchor e
|
86
88
|
pack .tkfd.f2.lab -side left -padx 4
|
87
89
|
pack .tkfd.f2.ent -expand yes -fill both -padx 2 -pady 2
|
88
90
|
|
89
91
|
pack .tkfd.f3.cancel -side right -padx 4 -anchor w
|
90
92
|
pack .tkfd.f3.lab -side left -padx 4
|
91
93
|
pack .tkfd.f3.menu -expand yes -fill x -side right
|
92
94
|
# Pack all the frames together. We are done with widget construction.
|
93
95
|
#
|
94
96
|
pack .tkfd.f1 -side top -fill x -pady 4
|
95
97
|
pack .tkfd.f3 -side bottom -fill x
|
96
98
|
pack .tkfd.f2 -side bottom -fill x
|
97
99
|
pack .tkfd.icons -expand yes -fill both -padx 4 -pady 2
|
98
100
|
# Set up the event handlers
|
99
101
|
#
|
100
102
|
bind .tkfd.f2.ent <Return> "mtkFDialog_ActivateEnt"
|
101
103
|
|
102
104
|
.tkfd.f1.up config -command "mtkFDialog_UpDirCmd"
|
103
105
|
.tkfd.f2.ok config -command "mtkFDialog_OkCmd"
|
104
106
|
.tkfd.f3.cancel config -command "mtkFDialog_CancelCmd"
|
105
107
|
bind .tkfd <Alt-d> "focus .tkfd.f1.menu"
|
106
108
|
bind .tkfd <Alt-t> "focus .tkfd.f3.menu"
|
107
109
|
bind .tkfd <Alt-n> "focus .tkfd.f2.ent"
|
108
110
|
bind .tkfd <KeyPress-Escape> "tkButtonInvoke .tkfd.f3.cancel"
|
109
111
|
bind .tkfd <Alt-o> "mtkFDialog_InvokeBtn Open"
|
110
112
|
bind .tkfd <Alt-s> "mtkFDialog_InvokeBtn Save"
|
111
113
|
# Build the focus group for all the entries
|
112
114
|
#
|
113
115
|
tkFocusGroup_Create .tkfd
|
114
116
|
tkFocusGroup_BindIn .tkfd .tkfd.f2.ent "mtkFDialog_EntFocusIn"
|
115
117
|
tkFocusGroup_BindOut .tkfd .tkfd.f2.ent "mtkFDialog_EntFocusOut"
|
116
118
|
# Create images for use in directory lists
|
117
119
|
if ![info exists tkPriv(folderImage)] {
|
118
120
|
}
|
119
121
|
global data
|
120
122
|
set data(type) $type
|
121
123
|
|
122
124
|
# 1: the configuration specs
|
123
125
|
#
|
124
126
|
set specs {
|
125
127
|
}
|
126
128
|
|
127
129
|
# 3: parse the arguments
|
128
130
|
#
|
129
131
|
tclParseConfigSpec data $specs "" $argList
|
130
132
|
|
131
133
|
if {$data(-title) == ""} {
|
132
134
|
}
|
133
135
|
|
134
136
|
# Mick Changes: Sets the initialdir to the path of initialfile
|
135
137
|
# if initialdir not set.
|
136
138
|
# Always wipes the dir path of initialfile
|
137
139
|
if { $data(-initialfile) != {} } {
|
138
140
|
}
|
139
141
|
|
140
142
|
# 4: set the default directory and selection according to the -initial
|
141
143
|
# settings
|
142
144
|
#
|
143
145
|
if { $data(-initialdir) == ""} {
|
144
146
|
} else {
|
145
147
|
}
|
146
148
|
# 5. Parse the -filetypes option
|
147
149
|
#
|
148
150
|
set data(-filetypes) [tkFDGetFileTypes $data(-filetypes)]
|
149
151
|
if {$data(-filetypes) == {}} {
|
150
152
|
} else {
|
151
153
|
}
|
152
154
|
wm transient .tkfd $data(-parent)
|
153
155
|
if ![winfo exists $data(-parent)] {
|
154
156
|
}
|
155
157
|
global data tcl_platform
|
156
158
|
set data(selectPath) $path
|
157
159
|
set appPWD [pwd]
|
158
160
|
if { $tcl_platform(platform) == "windows" && $data(selectPath) == "My Computer"} {
|
159
161
|
mtkFDialog_Update
|
160
162
|
my-cd "$appPWD"
|
161
163
|
return
|
162
164
|
}
|
163
165
|
mtkFDialog_Update
|
164
166
|
my-cd "$appPWD"
|
165
167
|
return
|
166
168
|
}
|
167
169
|
|
168
170
|
|
169
171
|
if [catch "my-cd \"$data(selectPath)\""] {
|
170
172
|
}
|
171
173
|
# Update the Directory: option menu
|
172
174
|
#
|
173
175
|
set list ""
|
174
176
|
# Mick: allow PCs to select other drives
|
175
177
|
global tcl_platform
|
176
178
|
switch -- $tcl_platform(platform) {
|
177
179
|
"windows" {set list [list "My Computer"]}
|
178
180
|
"macintosh" {set list [list "Desktop"]}
|
179
181
|
}
|
180
182
|
set dir ""
|
181
183
|
foreach subdir [file split $data(selectPath)] {
|
182
184
|
}
|
183
185
|
.tkfd.f1.menu.menu delete 0 end
|
184
186
|
foreach path $list {
|
185
187
|
}
|
186
188
|
# Restore the PWD to the application's PWD
|
187
189
|
#
|
188
190
|
my-cd "$appPWD"
|
189
191
|
# Change the displayed directory
|
190
192
|
mtkFDialog_Update
|
191
193
|
global data tkPriv tcl_platform
|
192
194
|
# If this is the Mac Desktop or PC "My Computer", just show the lists
|
193
195
|
tkf_show-toplevel
|
194
196
|
return
|
195
197
|
}
|
196
198
|
tkf_show-toplevel
|
197
199
|
return
|
198
200
|
}
|
199
201
|
# if the flter isnt set yet, delay the update
|
200
202
|
if {$data(-filetypes) != {}} {
|
201
203
|
}
|
202
204
|
|
203
205
|
set folder $tkPriv(folderImage)
|
204
206
|
set file $tkPriv(fileImage)
|
205
207
|
# Turn on the busy cursor. BUG?? We haven't disabled X events, though,
|
206
208
|
# so the user may still click and cause havoc ...
|
207
209
|
#
|
208
210
|
set entCursor [.tkfd.f2.ent cget -cursor]
|
209
211
|
set dlgCursor [.tkfd cget -cursor]
|
210
212
|
.tkfd.f2.ent config -cursor watch
|
211
213
|
.tkfd config -cursor watch
|
212
214
|
update idletasks
|
213
215
|
|
214
216
|
tkIconList_DeleteAll
|
215
217
|
my-cd "$data(selectPath)"
|
216
218
|
set globlist [lsort -dictionary [glob -nocomplain .* *]]
|
217
219
|
delete globlist "."
|
218
220
|
delete globlist ".."
|
219
221
|
# Make the dir list
|
220
222
|
#
|
221
223
|
foreach f $globlist {
|
222
224
|
}
|
223
225
|
# Make the file list
|
224
226
|
#
|
225
227
|
if { $data(filter)!= "*"} {
|
226
228
|
}
|
227
229
|
set top 0
|
228
230
|
foreach f $globlist {
|
229
231
|
}
|
230
232
|
tkIconList_Arrange
|
231
233
|
# turn off the busy cursor.
|
232
234
|
#
|
233
235
|
.tkfd.f2.ent config -cursor $entCursor
|
234
236
|
.tkfd config -cursor $dlgCursor
|
235
237
|
global data
|
236
238
|
set data(filter) [lindex $type 1]
|
237
239
|
.tkfd.f3.menu config -text [lindex $type 0] -indicatoron 1
|
238
240
|
.tkfd.icons.sbar set 0.0 0.0
|
239
241
|
# mick
|
240
242
|
set oldfile [eval ".tkfd.f2.ent get"]
|
241
243
|
if { $oldfile == {}} {set oldfile $data(selectFile)}
|
242
244
|
set data(selectFile) [file rootname $oldfile][file extension [lindex $type 1]]
|
243
245
|
.tkfd.f2.ent delete 0 end
|
244
246
|
.tkfd.f2.ent insert 0 $data(selectFile)
|
245
247
|
.tkfd.f2.ent select from 0
|
246
248
|
.tkfd.f2.ent select to end
|
247
249
|
.tkfd.f2.ent icursor end
|
248
250
|
mtkFDialog_Update
|
249
251
|
set appPWD [pwd]
|
250
252
|
set path [file join $context $text]
|
251
253
|
if [catch {file exists $path}] {
|
252
254
|
}
|
253
255
|
if [file exists $path] {
|
254
256
|
} else {
|
255
257
|
}
|
256
258
|
return [list $flag $directory $file]
|
257
259
|
global data
|
258
260
|
if { [.tkfd.f2.ent get] != ""} {
|
259
261
|
} else {
|
260
262
|
}
|
261
263
|
tkIconList_Unselect
|
262
264
|
if {$data(type) == "open"} {
|
263
265
|
} else {
|
264
266
|
}
|
265
267
|
.tkfd.f2.ent selection clear
|
266
268
|
global data
|
267
269
|
set text [string trim [.tkfd.f2.ent get]]
|
268
270
|
set list [mtkFDialogResolveFile $data(selectPath) $text]
|
269
271
|
set flag [lindex $list 0]
|
270
272
|
set path [lindex $list 1]
|
271
273
|
set file [lindex $list 2]
|
272
274
|
|
273
275
|
case $flag {
|
274
276
|
}
|
275
277
|
if ![string compare [.tkfd.f2.ok cget -text] $key] {
|
276
278
|
}
|
277
279
|
global data tcl_platform
|
278
280
|
switch -- $tcl_platform(platform) {
|
279
281
|
if { $data(selectPath) != "Desktop"} {
|
280
282
|
}
|
281
283
|
global data
|
282
284
|
set text [tkIconList_Get]
|
283
285
|
if { $text != ""} {
|
284
286
|
}
|
285
287
|
mtkFDialog_ActivateEnt
|
286
288
|
global tkPriv
|
287
289
|
set tkPriv(selectFilePath) ""
|
288
290
|
global data
|
289
291
|
if {$text == ""} {
|
290
292
|
}
|
291
293
|
set file [file join $data(selectPath) $text]
|
292
294
|
if ![file isdirectory $file] {
|
293
295
|
} else {
|
294
296
|
}
|
295
297
|
global data
|
296
298
|
if {$text == ""} {
|
297
299
|
}
|
298
300
|
set file [file join $data(selectPath) $text]
|
299
301
|
if [file isdirectory $file] {
|
300
302
|
} else {
|
301
303
|
}
|
302
304
|
global data tkPriv
|
303
305
|
if ![string compare $selectFilePath ""] {
|
304
306
|
}
|
305
307
|
set tkPriv(selectFilePath) $selectFilePath
|
306
308
|
global data
|
307
309
|
# Configure the widget variables of IconList, according to the command
|
308
310
|
# line arguments.
|
309
311
|
#
|
310
312
|
# 1: the configuration specs
|
311
313
|
#
|
312
314
|
set specs {
|
313
315
|
}
|
314
316
|
|
315
317
|
# 2: parse the arguments
|
316
318
|
#
|
317
319
|
tclParseConfigSpec data $specs "" $args
|
318
320
|
|
319
321
|
# Creates an IconList widget by assembling a canvas widget and a
|
320
322
|
# scrollbar widget. Sets all the bindings necessary for the IconList's
|
321
323
|
# operations.
|
322
324
|
|
323
325
|
frame $w
|
324
326
|
scrollbar $w.sbar -orient horizontal -highlightthickness 0 -takefocus 0
|
325
327
|
canvas $w.canvas -bd 2 -relief sunken -width 400 -height 120 -takefocus 1 -bg white
|
326
328
|
pack $w.sbar -side bottom -fill x -padx 2
|
327
329
|
pack $w.canvas -expand yes -fill both
|
328
330
|
|
329
331
|
$w.sbar config -command "$w.canvas xview"
|
330
332
|
$w.canvas config -xscrollcommand "$w.sbar set"
|
331
333
|
# Initializes the max icon/text width and height and other variables
|
332
334
|
#
|
333
335
|
set data(maxIW) 1
|
334
336
|
set data(maxIH) 1
|
335
337
|
set data(maxTW) 1
|
336
338
|
set data(maxTH) 1
|
337
339
|
set data(numItems) 0
|
338
340
|
set data(curItem) {}
|
339
341
|
set data(noScroll) 1
|
340
342
|
# Creates the event bindings.
|
341
343
|
#
|
342
344
|
bind $w.canvas <Configure> "tkIconList_Arrange"
|
343
345
|
bind $w.canvas <1> "tkIconList_Btn1 %x %y"
|
344
346
|
bind $w.canvas <B1-Motion> "tkIconList_Motion1 %x %y"
|
345
347
|
bind $w.canvas <Double-1> "tkIconList_Double1 %x %y"
|
346
348
|
bind $w.canvas <ButtonRelease-1> "tkCancelRepeat"
|
347
349
|
bind $w.canvas <B1-Leave> "tkIconList_Leave1 %x %y"
|
348
350
|
bind $w.canvas <B1-Enter> "tkCancelRepeat"
|
349
351
|
bind $w.canvas <Up> "tkIconList_UpDown -1"
|
350
352
|
bind $w.canvas <Down> "tkIconList_UpDown 1"
|
351
353
|
bind $w.canvas <Left> "tkIconList_LeftRight -1"
|
352
354
|
bind $w.canvas <Right> "tkIconList_LeftRight 1"
|
353
355
|
bind $w.canvas <Return> "tkIconList_ReturnKey"
|
354
356
|
bind $w.canvas <KeyPress> "tkIconList_KeyPress %A"
|
355
357
|
bind $w.canvas <Control-KeyPress> ";"
|
356
358
|
bind $w.canvas <Alt-KeyPress> ";"
|
357
359
|
bind $w.canvas <FocusIn> "tkIconList_FocusIn"
|
358
360
|
return $w
|
359
361
|
global tkPriv data
|
360
362
|
set w .tkfd.icons
|
361
363
|
if {![winfo exists $w]} return
|
362
364
|
set x $tkPriv(x)
|
363
365
|
set y $tkPriv(y)
|
364
366
|
if $data(noScroll) {
|
365
367
|
}
|
366
368
|
if {$x >= [winfo width $w.canvas]} {
|
367
369
|
} elseif {$x < 0} {
|
368
370
|
} elseif {$y >= [winfo height $w.canvas]} {
|
369
371
|
} elseif {$y < 0} {
|
370
372
|
} else {
|
371
373
|
}
|
372
374
|
tkIconList_Motion1 $x $y
|
373
375
|
set tkPriv(afterId) [after 50 tkIconList_AutoScan]
|
374
376
|
global data itemList
|
375
377
|
.tkfd.icons.canvas delete all
|
376
378
|
catch {unset data(selected)}
|
377
379
|
catch {unset data(rect)}
|
378
380
|
catch {unset data(list)}
|
379
381
|
catch {unset itemList}
|
380
382
|
set data(numItems) 0
|
381
383
|
set data(curItem) {}
|
382
384
|
global data itemList textList
|
383
385
|
set w .tkfd.icons
|
384
386
|
set iTag [$w.canvas create image 0 0 -image $image -anchor nw]
|
385
387
|
set tTag [$w.canvas create text 0 0 -text $text -anchor nw]
|
386
388
|
set rTag [$w.canvas create rect 0 0 0 0 -fill "" -outline ""]
|
387
389
|
|
388
390
|
set b [$w.canvas bbox $iTag]
|
389
391
|
set iW [expr [lindex $b 2]-[lindex $b 0]]
|
390
392
|
set iH [expr [lindex $b 3]-[lindex $b 1]]
|
391
393
|
if {$data(maxIW) < $iW} {
|
392
394
|
}
|
393
395
|
if {$data(maxIH) < $iH} {
|
394
396
|
}
|
395
397
|
|
396
398
|
set b [$w.canvas bbox $tTag]
|
397
399
|
set tW [expr [lindex $b 2]-[lindex $b 0]]
|
398
400
|
set tH [expr [lindex $b 3]-[lindex $b 1]]
|
399
401
|
if {$data(maxTW) < $tW} {
|
400
402
|
}
|
401
403
|
if {$data(maxTH) < $tH} {
|
402
404
|
}
|
403
405
|
|
404
406
|
lappend data(list) [list $iTag $tTag $rTag $iW $iH $tW $tH $data(numItems)]
|
405
407
|
set itemList($rTag) [list $iTag $tTag $text $data(numItems)]
|
406
408
|
set textList($data(numItems)) [string tolower $text]
|
407
409
|
incr data(numItems)
|
408
410
|
global data
|
409
411
|
set w .tkfd.icons
|
410
412
|
if ![info exists data(list)] {
|
411
413
|
}
|
412
414
|
set W [winfo width $w.canvas]
|
413
415
|
set H [winfo height $w.canvas]
|
414
416
|
set pad [expr [$w.canvas cget -highlightthickness] + \
|
415
417
|
incr W -[expr $pad*2]
|
416
418
|
incr H -[expr $pad*2]
|
417
419
|
set dx [expr $data(maxIW) + $data(maxTW) + 4]
|
418
420
|
if {$data(maxTH) > $data(maxIH)} {
|
419
421
|
} else {
|
420
422
|
}
|
421
423
|
set shift [expr $data(maxIW) + 4]
|
422
424
|
set x [expr $pad * 2]
|
423
425
|
set y [expr $pad * 1]
|
424
426
|
set usedColumn 0
|
425
427
|
foreach pair $data(list) {
|
426
428
|
}
|
427
429
|
if {$usedColumn} {
|
428
430
|
} else {
|
429
431
|
}
|
430
432
|
if {$sW < $W} {
|
431
433
|
} else {
|
432
434
|
}
|
433
435
|
set data(itemsPerColumn) [expr ($H-$pad)/$dy]
|
434
436
|
if {$data(itemsPerColumn) < 1} {
|
435
437
|
}
|
436
438
|
if {$data(curItem) != {}} {
|
437
439
|
}
|
438
440
|
global data
|
439
441
|
set w .tkfd.icons
|
440
442
|
if {$data(-command) != "" && [info exists data(selected)]} {
|
441
443
|
}
|
442
444
|
global data itemList
|
443
445
|
set w .tkfd.icons
|
444
446
|
if $data(noScroll) {
|
445
447
|
}
|
446
448
|
set sRegion [$w.canvas cget -scrollregion]
|
447
449
|
if ![string compare $sRegion {}] {
|
448
450
|
}
|
449
451
|
if ![info exists itemList($rTag)] {
|
450
452
|
}
|
451
453
|
set bbox [$w.canvas bbox $rTag]
|
452
454
|
set pad [expr [$w.canvas cget -highlightthickness] + \
|
453
455
|
set x1 [lindex $bbox 0]
|
454
456
|
set x2 [lindex $bbox 2]
|
455
457
|
incr x1 -[expr $pad * 2]
|
456
458
|
incr x2 -[expr $pad * 1]
|
457
459
|
set cW [expr [winfo width $w.canvas] - $pad*2]
|
458
460
|
set scrollW [expr [lindex $sRegion 2]-[lindex $sRegion 0]+1]
|
459
461
|
set dispX [expr int([lindex [$w.canvas xview] 0]*$scrollW)]
|
460
462
|
set oldDispX $dispX
|
461
463
|
# check if out of the right edge
|
462
464
|
#
|
463
465
|
if {[expr $x2 - $dispX] >= $cW} {
|
464
466
|
}
|
465
467
|
# check if out of the left edge
|
466
468
|
#
|
467
469
|
if {[expr $x1 - $dispX] < 0} {
|
468
470
|
}
|
469
471
|
if {$oldDispX != $dispX} {
|
470
472
|
}
|
471
473
|
global data
|
472
474
|
set w .tkfd.icons
|
473
475
|
tkIconList_Select [$w.canvas find closest \
|
474
476
|
global data itemList
|
475
477
|
set w .tkfd.icons
|
476
478
|
if ![info exists itemList($rTag)] {
|
477
479
|
}
|
478
480
|
set iTag [lindex $itemList($rTag) 0]
|
479
481
|
set tTag [lindex $itemList($rTag) 1]
|
480
482
|
set text [lindex $itemList($rTag) 2]
|
481
483
|
set serial [lindex $itemList($rTag) 3]
|
482
484
|
if ![info exists data(rect)] {
|
483
485
|
set data(rect) [$w.canvas create rect 0 0 0 0 \
|
484
486
|
}
|
485
487
|
$w.canvas lower $data(rect)
|
486
488
|
set bbox [$w.canvas bbox $tTag]
|
487
489
|
eval $w.canvas coords $data(rect) $bbox
|
488
490
|
set data(curItem) $serial
|
489
491
|
set data(selected) $text
|
490
492
|
|
491
493
|
if {$callBrowse} {
|
492
494
|
}
|
493
495
|
global data
|
494
496
|
set w .tkfd.icons
|
495
497
|
if [info exists data(rect)] {
|
496
498
|
}
|
497
499
|
if [info exists data(selected)] {
|
498
500
|
}
|
499
501
|
set data(curItem) {}
|
500
502
|
global data
|
501
503
|
set w .tkfd.icons
|
502
504
|
if [info exists data(selected)] {
|
503
505
|
} else {
|
504
506
|
}
|
505
507
|
global data
|
506
508
|
focus .tkfd.icons.canvas
|
507
509
|
tkIconList_SelectAtXY $x $y
|
508
510
|
global tkPriv
|
509
511
|
set tkPriv(x) $x
|
510
512
|
set tkPriv(y) $y
|
511
513
|
tkIconList_SelectAtXY $x $y
|
512
514
|
global data
|
513
515
|
if {$data(curItem) != {}} {
|
514
516
|
}
|
515
517
|
tkIconList_Invoke
|
516
518
|
global tkPriv
|
517
519
|
set tkPriv(x) $x
|
518
520
|
set tkPriv(y) $y
|
519
521
|
tkIconList_AutoScan
|
520
522
|
global data
|
521
523
|
if ![info exists data(list)] {
|
522
524
|
}
|
523
525
|
if {$data(curItem) == {}} {
|
524
526
|
}
|
525
527
|
global data
|
526
528
|
if ![info exists data(list)] {
|
527
529
|
}
|
528
530
|
if {$data(curItem) == {}} {
|
529
531
|
} else {
|
530
532
|
}
|
531
533
|
if [string compare $rTag ""] {
|
532
534
|
}
|
533
535
|
global data
|
534
536
|
if ![info exists data(list)] {
|
535
537
|
}
|
536
538
|
if {$data(curItem) == {}} {
|
537
539
|
} else {
|
538
540
|
}
|
539
541
|
if [string compare $rTag ""] {
|
540
542
|
}
|
541
543
|
global tkPriv
|
542
544
|
set w .tkfd.icons
|
543
545
|
append tkPriv(ILAccel,$w) $key
|
544
546
|
tkIconList_Goto $tkPriv(ILAccel,$w)
|
545
547
|
catch {
|
546
548
|
}
|
547
549
|
set tkPriv(ILAccel,$w,afterId) [after 500 tkIconList_Reset]
|
548
550
|
global data textList tkPriv
|
549
551
|
|
550
552
|
if ![info exists data(list)] {
|
551
553
|
}
|
552
554
|
if {[string length $text] == 0} {
|
553
555
|
}
|
554
556
|
if {$data(curItem) == {} || $data(curItem) == 0} {
|
555
557
|
} else {
|
556
558
|
}
|
557
559
|
set text [string tolower $text]
|
558
560
|
set theIndex -1
|
559
561
|
set less 0
|
560
562
|
set len [string length $text]
|
561
563
|
set len0 [expr $len-1]
|
562
564
|
set i $start
|
563
565
|
# Search forward until we find a filename whose prefix is an exact match
|
564
566
|
# with $text
|
565
567
|
while 1 {
|
566
568
|
}
|
567
569
|
if {$theIndex > -1} {
|
568
570
|
}
|
569
571
|
global tkPriv
|
570
572
|
set w .tkfd.icons
|
571
573
|
catch {unset tkPriv(ILAccel,$w)}
|
572
574
|
global data
|
573
575
|
mtkFDialog_SetPath $data(selectDrive)
|
574
576
|
global data tkPriv tcl_platform
|
575
577
|
# Turn on the busy cursor. BUG?? We haven't disabled X events, though,
|
576
578
|
# so the user may still click and cause havoc ...
|
577
579
|
#
|
578
580
|
set entCursor [.tkfd.f2.ent cget -cursor]
|
579
581
|
set dlgCursor [.tkfd cget -cursor]
|
580
582
|
.tkfd.f2.ent config -cursor watch
|
581
583
|
.tkfd config -cursor watch
|
582
584
|
update idletasks
|
583
585
|
|
584
586
|
tkIconList_DeleteAll
|
585
587
|
# Make the dir list
|
586
588
|
#
|
587
589
|
foreach drv [file volume] {
|
588
590
|
}
|
589
591
|
tkIconList_Arrange
|
590
592
|
# Update the Directory: option menu
|
591
593
|
#
|
592
594
|
.tkfd.f1.menu.menu delete 0 end
|
593
595
|
set var data(selectPath)
|
594
596
|
switch -- $tcl_platform(platform) {
|
595
597
|
windows {set label "My Computer"}
|
596
598
|
macintosh {set label "Desktop"}
|
597
599
|
}
|
598
600
|
|
599
601
|
.tkfd.f1.menu.menu add command -label $label -command [list set $var $label]
|
600
602
|
# turn off the busy cursor.
|
601
603
|
.tkfd.f2.ent config -cursor $entCursor
|
602
604
|
.tkfd config -cursor $dlgCursor
|
603
605
|
global tcl_platform
|
604
606
|
|
605
607
|
if {[lindex $path 1] != ""} {
|
606
608
|
}
|
607
609
|
if { $tcl_platform(platform) == "macintosh" && $path == "Desktop" } {return}
|
608
610
|
|
609
611
|
cd "$path"
|
610
612
|
global mtkfCURRDIR
|
611
613
|
if ![info exists mtkfCURRDIR] {set mtkfCURRDIR [pwd]}
|
612
614
|
return $mtkfCURRDIR
|
613
615
|
set oldgrab [grab current]
|
614
616
|
if { $oldgrab != {}} {grab release $oldgrab}
|
615
617
|
if {$parent != {}} {
|
616
618
|
} else {
|
617
619
|
}
|
618
620
|
if { $oldgrab != {}} {grab -global $oldgrab}
|
619
621
|
upvar $var list
|
620
622
|
set ix [lsearch -exact $list $value]
|
621
623
|
|
622
624
|
if {$ix >= 0} {
|
623
625
|
}
|
624
626
|
return $list
|