summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2012-04-23 00:18:15 +0100
committerNick White <git@njw.me.uk>2012-04-23 00:18:15 +0100
commit580650bb548b99c48b31b0343bbd82314afae367 (patch)
tree8b9e5c25139549ef50fc704a4565470cd92a4b81
parent6ba5725432648e818bfba26c99c42de64f255d0b (diff)
Make gui code clearer, and clipboard code more sensible
-rwxr-xr-xgetxbookgui.tcl17
1 files changed, 11 insertions, 6 deletions
diff --git a/getxbookgui.tcl b/getxbookgui.tcl
index 2596095..06b3286 100755
--- a/getxbookgui.tcl
+++ b/getxbookgui.tcl
@@ -42,16 +42,19 @@ proc go {} {
proc parseurl {url} {
global bins
- for {set i 0} {$i < [llength $bins]} {incr i} {
- set b [lindex $bins $i]
+ set newid ""
+ set i 0
+ foreach b $bins {
if { [string match [lindex $b 3] "$url"] } {
selbin $i
set binregex [lindex $b 4]
if {"$binregex" != "" && [regexp "$binregex" $url m sub]} {
- .input.id delete 0 end
- .input.id insert 0 "$sub"
+ set newid "$sub"
}
+ .input.id delete 0 end
+ .input.id insert 0 "$newid"
}
+ incr i
}
}
@@ -81,8 +84,8 @@ label .input.lab
entry .input.id -width 14
frame .binfr
-for {set i 0} {$i < [llength $bins]} {incr i} {
- set b [lindex $bins $i]
+set i 0
+foreach b $bins {
set binname [lindex $b 0]
if { [catch {image create photo im$i -file "$iconpath/$binname.gif"}] } {
image create photo im$i
@@ -92,6 +95,7 @@ for {set i 0} {$i < [llength $bins]} {incr i} {
pack .binfr.$i -side left
bind .binfr.$i <Key> {set manual 1}
bind .binfr.$i <Button> {set manual 1}
+ incr i
}
.binfr.$binselected invoke
@@ -105,4 +109,5 @@ pack .binfr .input .dl .st
bind . <Return> go
bind .input.id <Key> {set manual 1}
+bind .input.id <Button> {set manual 1}
watchsel