diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-08 08:54:32 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-08 08:54:32 +0000 |
commit | 514abcc1014f5fda80bcb5111fcb42fc99a7ee26 (patch) | |
tree | 6bbeaee638acfcd4d5c664003878fe6f36a7494f | |
parent | 10b0ee18654751f8fefad6c12e70a907e9ac5671 (diff) | |
download | ruby-514abcc1014f5fda80bcb5111fcb42fc99a7ee26.tar.gz |
* 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
-rw-r--r-- | ext/tk/ChangeLog.tkextlib | 17 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb | 19 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/random.rb | 26 |
3 files changed, 41 insertions, 21 deletions
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index 98092f84c0..9a84fcf851 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,5 +1,22 @@ 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> + * lib/tkextlib/treectrl/tktreectrl.rb (selection_clear): fixed typo. * sample/tkextlib/treectrl/random.rb: node deselection now works. diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb index b2f5f45759..6aec944ae9 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb @@ -172,11 +172,11 @@ def demoOutlookNewsgroup(t) proc{|w| if w.selection_count == 1 # One item is selected - if @Message[:afterID][:id] - Tk.after_cancel(@Message[:afterID][:id]) + if @Message[:afterId][:id] + Tk.after_cancel(@Message[:afterId][:id]) end - @Message[:afterID][:item] = w.selection_get[0] - @Message[:afterID][:id] = Tk.after(500, proc{ + @Message[:afterId][:item] = w.selection_get[0] + @Message[:afterId][:id] = Tk.after(500, proc{ messageReadDelayed(w) }) end @@ -184,8 +184,8 @@ def demoOutlookNewsgroup(t) end def messageReadDelayed(t) - @Message[:afterID].delete(:id) - i = @Message[:afterID][:item] + @Message[:afterId].delete(:id) + i = @Message[:afterId][:item] return unless t.selection_includes(i) # This message is not read @@ -432,10 +432,11 @@ def demoOutlookNewsgroup2(t) end def anyUnreadDescendants(t, i) - itemList = [ t.item_firstchild(i) ] - while(itemList.length > 0) - item = itemList.pop + itemList = [] + item = t.item_firstchild(i) + itemList.push(item) if item != '' + while item = itemList.pop return true unless @Message[:read][item] item2 = t.item_nextsibling(item) diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb index 259cb1865f..c10ec9d2af 100644 --- a/ext/tk/sample/tkextlib/treectrl/random.rb +++ b/ext/tk/sample/tkextlib/treectrl/random.rb @@ -293,7 +293,7 @@ def randomMotion(t, x, y) c, s, *eList = TkComm.simplelist(lst) next if column != t.column_index(c) 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 break } @@ -303,7 +303,7 @@ def randomMotion(t, x, y) if ok # If the item is not in the pre-drag selection # (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 # We can drop if dragged item isn't an ancestor @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 = false t.item_ancestors(item).each{|ancestor| - if src.find{|val| val == ancestor} + if src.find{|val| val.to_s == ancestor.to_s} ignore = true break end @@ -392,7 +392,7 @@ def randomDrop(t, target, src, pos) next if ignore # 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) end @@ -406,10 +406,11 @@ def randomDrop(t, target, src, pos) t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item)) # Recursively update text: depth - itemList = [ t.item_firstchild(item) ] - while itemList.length > 0 - item = itemList.pop + itemList = [] + item = t.item_firstchild(item) + itemList << item if item != '' + while item = itemList.pop t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item)) item2 = t.item_nextsibling(item) @@ -454,7 +455,7 @@ def randomAutoScanCheck(t, x, y) x1, y1, x2, y2 = t.contentbox margin = t.winfo_pixels(t.scrollmargin) 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 t.yview(:scroll, 1, :units) delay = t.yscrolldelay @@ -469,15 +470,16 @@ def randomAutoScanCheck(t, x, y) delay = t.xscrolldelay end if @Priv.exist?(:autoscan, :scanning, t) - delay = delay[2] if delay.kind_of?(Array) - else delay = delay[1] if delay.kind_of?(Array) + else + delay = delay[0] if delay.kind_of?(Array) + @Priv[:autoscan, :scanning, t] = true end case @Priv['buttonMode'] when 'drag', 'marquee' randomMotion(t, x, y) end - @Priv[:autoscan, :scanning, t] = + @Priv[:autoscan, :afterId, t] = Tk.after(delay, proc{ randomAutoScanCheckAux(t) }) end return @@ -486,7 +488,7 @@ def randomAutoScanCheck(t, x, y) end def randomAutoScanCheckAux(t) - @Priv.unset(:autoscan, :afterID, t) + @Priv.unset(:autoscan, :afterId, t) x = t.winfo_pointerx - t.winfo_rootx y = t.winfo_pointery - t.winfo_rooty randomAutoScanCheck(t, x, y) |