mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb: tk::treectrl uses 'afterId'
not 'afterID'. * ext/tk/sample/tkextlib/treectrl/random.rb: ditto. * ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb: item_firstchild can return empty string. (drag onto leaf node) * ext/tk/sample/tkextlib/treectrl/random.rb: ditto. * ext/tk/sample/tkextlib/treectrl/random.rb: comparation failed at Enumerable#find because of type mismatch. (ex: "10" != 10) * ext/tk/sample/tkextlib/treectrl/random.rb: and some fixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
10b0ee1865
commit
514abcc101
3 changed files with 41 additions and 21 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
2005-04-08 ocean <ocean@ruby-lang.org>
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/outlook-newgroup.rb: tk::treectrl uses 'afterId'
|
||||||
|
not 'afterID'.
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/random.rb: ditto.
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/outlook-newgroup.rb: item_firstchild can
|
||||||
|
return empty string. (drag onto leaf node)
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/random.rb: ditto.
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/random.rb: comparation failed at Enumerable#find
|
||||||
|
because of type mismatch. (ex: "10" != 10)
|
||||||
|
|
||||||
|
* sample/tkextlib/treectrl/random.rb: and some fixes.
|
||||||
|
|
||||||
2005-04-08 ocean <ocean@ruby-lang.org>
|
2005-04-08 ocean <ocean@ruby-lang.org>
|
||||||
|
|
||||||
* lib/tkextlib/treectrl/tktreectrl.rb (selection_clear): fixed typo.
|
* lib/tkextlib/treectrl/tktreectrl.rb (selection_clear): fixed typo.
|
||||||
|
|
|
@ -172,11 +172,11 @@ def demoOutlookNewsgroup(t)
|
||||||
proc{|w|
|
proc{|w|
|
||||||
if w.selection_count == 1
|
if w.selection_count == 1
|
||||||
# One item is selected
|
# One item is selected
|
||||||
if @Message[:afterID][:id]
|
if @Message[:afterId][:id]
|
||||||
Tk.after_cancel(@Message[:afterID][:id])
|
Tk.after_cancel(@Message[:afterId][:id])
|
||||||
end
|
end
|
||||||
@Message[:afterID][:item] = w.selection_get[0]
|
@Message[:afterId][:item] = w.selection_get[0]
|
||||||
@Message[:afterID][:id] = Tk.after(500, proc{
|
@Message[:afterId][:id] = Tk.after(500, proc{
|
||||||
messageReadDelayed(w)
|
messageReadDelayed(w)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -184,8 +184,8 @@ def demoOutlookNewsgroup(t)
|
||||||
end
|
end
|
||||||
|
|
||||||
def messageReadDelayed(t)
|
def messageReadDelayed(t)
|
||||||
@Message[:afterID].delete(:id)
|
@Message[:afterId].delete(:id)
|
||||||
i = @Message[:afterID][:item]
|
i = @Message[:afterId][:item]
|
||||||
return unless t.selection_includes(i)
|
return unless t.selection_includes(i)
|
||||||
|
|
||||||
# This message is not read
|
# This message is not read
|
||||||
|
@ -432,10 +432,11 @@ def demoOutlookNewsgroup2(t)
|
||||||
end
|
end
|
||||||
|
|
||||||
def anyUnreadDescendants(t, i)
|
def anyUnreadDescendants(t, i)
|
||||||
itemList = [ t.item_firstchild(i) ]
|
itemList = []
|
||||||
while(itemList.length > 0)
|
item = t.item_firstchild(i)
|
||||||
item = itemList.pop
|
itemList.push(item) if item != ''
|
||||||
|
|
||||||
|
while item = itemList.pop
|
||||||
return true unless @Message[:read][item]
|
return true unless @Message[:read][item]
|
||||||
|
|
||||||
item2 = t.item_nextsibling(item)
|
item2 = t.item_nextsibling(item)
|
||||||
|
|
|
@ -293,7 +293,7 @@ def randomMotion(t, x, y)
|
||||||
c, s, *eList = TkComm.simplelist(lst)
|
c, s, *eList = TkComm.simplelist(lst)
|
||||||
next if column != t.column_index(c)
|
next if column != t.column_index(c)
|
||||||
next if t.item_style_set(item, c) != s
|
next if t.item_style_set(item, c) != s
|
||||||
next unless eList.find{|val| val == e}
|
next unless eList.find{|val| val.to_s == e.to_s}
|
||||||
ok = true
|
ok = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ def randomMotion(t, x, y)
|
||||||
if ok
|
if ok
|
||||||
# If the item is not in the pre-drag selection
|
# If the item is not in the pre-drag selection
|
||||||
# (i.e. not being dragged) see if we can drop on it
|
# (i.e. not being dragged) see if we can drop on it
|
||||||
unless @Priv.list_element(:selection).find{|val| val == item}
|
unless @Priv.list_element(:selection).find{|val| val.to_s == item.to_s}
|
||||||
drop = item
|
drop = item
|
||||||
# We can drop if dragged item isn't an ancestor
|
# We can drop if dragged item isn't an ancestor
|
||||||
@Priv.list_element(:selection).each{|item2|
|
@Priv.list_element(:selection).each{|item2|
|
||||||
|
@ -384,7 +384,7 @@ def randomDrop(t, target, src, pos)
|
||||||
# Ignore any item whose ancestor is also selected
|
# Ignore any item whose ancestor is also selected
|
||||||
ignore = false
|
ignore = false
|
||||||
t.item_ancestors(item).each{|ancestor|
|
t.item_ancestors(item).each{|ancestor|
|
||||||
if src.find{|val| val == ancestor}
|
if src.find{|val| val.to_s == ancestor.to_s}
|
||||||
ignore = true
|
ignore = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -392,7 +392,7 @@ def randomDrop(t, target, src, pos)
|
||||||
next if ignore
|
next if ignore
|
||||||
|
|
||||||
# Update the old parent of this moved item later
|
# Update the old parent of this moved item later
|
||||||
unless parentList.find{|val| val == item}
|
unless parentList.find{|val| val.to_s == item.to_s}
|
||||||
parentList << t.item_parent(item)
|
parentList << t.item_parent(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -406,10 +406,11 @@ def randomDrop(t, target, src, pos)
|
||||||
t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
|
t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
|
||||||
|
|
||||||
# Recursively update text: depth
|
# Recursively update text: depth
|
||||||
itemList = [ t.item_firstchild(item) ]
|
itemList = []
|
||||||
while itemList.length > 0
|
item = t.item_firstchild(item)
|
||||||
item = itemList.pop
|
itemList << item if item != ''
|
||||||
|
|
||||||
|
while item = itemList.pop
|
||||||
t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
|
t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
|
||||||
|
|
||||||
item2 = t.item_nextsibling(item)
|
item2 = t.item_nextsibling(item)
|
||||||
|
@ -454,7 +455,7 @@ def randomAutoScanCheck(t, x, y)
|
||||||
x1, y1, x2, y2 = t.contentbox
|
x1, y1, x2, y2 = t.contentbox
|
||||||
margin = t.winfo_pixels(t.scrollmargin)
|
margin = t.winfo_pixels(t.scrollmargin)
|
||||||
if x < x1 + margin || x >= x2 - margin || y < y1 + margin || y >= y2 - margin
|
if x < x1 + margin || x >= x2 - margin || y < y1 + margin || y >= y2 - margin
|
||||||
if ! @Priv.exist?(:auroscan, :afterID, t)
|
if ! @Priv.exist?(:auroscan, :afterId, t)
|
||||||
if y >= y2 - margin
|
if y >= y2 - margin
|
||||||
t.yview(:scroll, 1, :units)
|
t.yview(:scroll, 1, :units)
|
||||||
delay = t.yscrolldelay
|
delay = t.yscrolldelay
|
||||||
|
@ -469,15 +470,16 @@ def randomAutoScanCheck(t, x, y)
|
||||||
delay = t.xscrolldelay
|
delay = t.xscrolldelay
|
||||||
end
|
end
|
||||||
if @Priv.exist?(:autoscan, :scanning, t)
|
if @Priv.exist?(:autoscan, :scanning, t)
|
||||||
delay = delay[2] if delay.kind_of?(Array)
|
|
||||||
else
|
|
||||||
delay = delay[1] if delay.kind_of?(Array)
|
delay = delay[1] if delay.kind_of?(Array)
|
||||||
|
else
|
||||||
|
delay = delay[0] if delay.kind_of?(Array)
|
||||||
|
@Priv[:autoscan, :scanning, t] = true
|
||||||
end
|
end
|
||||||
case @Priv['buttonMode']
|
case @Priv['buttonMode']
|
||||||
when 'drag', 'marquee'
|
when 'drag', 'marquee'
|
||||||
randomMotion(t, x, y)
|
randomMotion(t, x, y)
|
||||||
end
|
end
|
||||||
@Priv[:autoscan, :scanning, t] =
|
@Priv[:autoscan, :afterId, t] =
|
||||||
Tk.after(delay, proc{ randomAutoScanCheckAux(t) })
|
Tk.after(delay, proc{ randomAutoScanCheckAux(t) })
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
@ -486,7 +488,7 @@ def randomAutoScanCheck(t, x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
def randomAutoScanCheckAux(t)
|
def randomAutoScanCheckAux(t)
|
||||||
@Priv.unset(:autoscan, :afterID, t)
|
@Priv.unset(:autoscan, :afterId, t)
|
||||||
x = t.winfo_pointerx - t.winfo_rootx
|
x = t.winfo_pointerx - t.winfo_rootx
|
||||||
y = t.winfo_pointery - t.winfo_rooty
|
y = t.winfo_pointery - t.winfo_rooty
|
||||||
randomAutoScanCheck(t, x, y)
|
randomAutoScanCheck(t, x, y)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue