[#8824] [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro)

ごとけんです

38 messages 2000/01/05
[#8839] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8842] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8843] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8844] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8846] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — matz@... (Yukihiro Matsumoto) 2000/01/06

まつもと ゆきひろです

[#8847] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro) 2000/01/06

ごとけんです

[#8893] Re: [ruby-list:20142] Re: Range expansion? — Akinori MUSHA aka knu <knu@...>

 knuです。ruby-listから舞台を移しました。

13 messages 2000/01/09

[#8980] 1.4.3 patch for near-future *BSD IPv6 support — Jun-ichiro itojun Hagino <itojun@...>

近い将来の{Net,Free,Open}BSDにはKAME IPv6 stackが統合されています。

17 messages 2000/01/20
[#8981] Re: 1.4.3 patch for near-future *BSD IPv6 support — Jun-ichiro itojun Hagino <itojun@...> 2000/01/20

> それから、

[ruby-dev:8927] [PATCH] Ruby/Tk (tktext.rb and tkcanvas.rb)

From: nagai@...
Date: 2000-01-14 09:45:24 UTC
List: ruby-dev #8927
永井@知能.九工大です.

Ruby/Tk の tktext.rb と tkcanvas.rb へのパッチです.
両者にグローバル変数を用いている部分があったので,修正しています.
また,TkText クラスを TkComposite で用いる際に
インスタンス変数の初期化が行えずに支障がありましたので,
これに対する対策を加えています.

# class TextFrame < TkText
# include TkComposite
# というようにした場合,TextFrame クラスのインスタンスで
# テキストタグ (TkTextTag) を用いようとすると,
# インスタンス変数 @tags の未初期化でエラーとなっていました.

以下にパッチを付けます.
性格上,1.4 系にも当てるべきパッチと考えます.
-- 
                                         永井 秀利 (九工大 知能情報)
                                             nagai@ai.kyutech.ac.jp
================================================
--- /usr/local/src/ruby-1.4.3/ext/tk/lib/tkcanvas.rb	Mon Dec  6 18:03:38 1999
+++ tkcanvas.rb	Fri Jan 14 11:46:20 2000
@@ -493,15 +493,15 @@
     CTagID_TBL[id]? CTagID_TBL[id]: id
   end
 
-  $tk_canvas_tag = 'ctag0000'
+  Tk_CanvasTag_ID = ['ctag0000']
   def initialize(parent, mode=nil, *args)
     if not parent.kind_of?(TkCanvas)
       fail format("%s need to be TkCanvas", parent.inspect)
     end
     @c = parent
-    @path = @id = $tk_canvas_tag
+    @path = @id = Tk_CanvasTag_ID[0]
     CTagID_TBL[@id] = self
-    $tk_canvas_tag = $tk_canvas_tag.succ
+    Tk_CanvasTag_ID[0] = Tk_CanvasTag_ID[0].succ
     if mode
       tk_call @c.path, "addtag", @id, mode, *args
     end
@@ -576,15 +576,15 @@
 end
 
 class TkcGroup<TkcTag
-  $tk_group_id = 'tkg00000'
+  Tk_cGroup_ID = ['tkcg00000']
   def create_self(parent, *args)
     if not parent.kind_of?(TkCanvas)
       fail format("%s need to be TkCanvas", parent.inspect)
     end
     @c = parent
-    @path = @id = $tk_group_id
+    @path = @id = Tk_cGroup_ID[0]
     CTagID_TBL[@id] = self
-    $tk_group_id = $tk_group_id.succ
+    Tk_cGroup_ID[0] = Tk_cGroup_ID[0].succ
     add(*args) if args != []
   end
   
@@ -706,10 +706,10 @@
 
   Tk_IMGTBL = {}
 
-  $tk_image_id = 'i00000'
+  Tk_Image_ID = ['i00000']
   def initialize(keys=nil)
-    @path = $tk_image_id
-    $tk_image_id = $tk_image_id.succ
+    @path = Tk_Image_ID[0]
+    Tk_Image_ID[0] = Tk_Image_ID[0].succ
     tk_call 'image', 'create', @type, @path, *hash_kv(keys)
     Tk_IMGTBL[@path] = self
   end
================================================
================================================
--- /usr/local/src/ruby-1.4.3/ext/tk/lib/tktext.rb	Tue Oct 12 18:11:29 1999
+++ tktext.rb	Fri Jan 14 16:19:54 2000
@@ -127,30 +127,46 @@
 
 class TkText<TkTextWin
   include TkTreatTextTagFont
+  include Scrollable
 
   WidgetClassName = 'Text'.freeze
   WidgetClassNames[WidgetClassName] = self
+
   def self.to_eval
     WidgetClassName
   end
-  include Scrollable
+
+  def self.new(*args)
+    super(*args).init_instance_variable
+  end
+
+  def init_instance_variable
+    @tags = {}
+    self
+  end
+
   def create_self
     tk_call 'text', @path
-    @tags = {}
+    init_instance_variable
   end
+
   def index(index)
     tk_send 'index', index
   end
+
   def value
     tk_send 'get', "1.0", "end - 1 char"
   end
+
   def value= (val)
     tk_send 'delete', "1.0", 'end'
     tk_send 'insert', "1.0", val
   end
+
   def _addcmd(cmd)
     @cmdtbl.push cmd
   end
+
   def _addtag(name, obj)
     @tags[name] = obj
   end
@@ -168,11 +184,19 @@
       tagid2obj(elt)
     }
   end
+
+  def mark_names
+    tk_split_list(tk_send('mark', 'names')).collect{|elt|
+      tagid2obj(elt)
+    }
+  end
+
   def window_names
     tk_send('window', 'names').collect{|elt|
       tagid2obj(elt)
     }
   end
+
   def image_names
     tk_send('image', 'names').collect{|elt|
       tagid2obj(elt)
@@ -182,6 +206,7 @@
   def set_insert(index)
     tk_send 'mark', 'set', 'insert', index
   end
+
   def set_current(index)
     tk_send 'mark', 'set', 'current', index
   end
@@ -191,6 +216,7 @@
   end
 
   def destroy
+    @tags = {} unless @tags
     @tags.each_value do |t|
       t.destroy
     end
@@ -408,14 +434,15 @@
 class TkTextTag<TkObject
   include TkTreatTagFont
 
-  $tk_text_tag = 'tag0000'
+  Tk_TextTag_ID = ['tag0000']
+
   def initialize(parent, *args)
     if not parent.kind_of?(TkText)
       fail format("%s need to be TkText", parent.inspect)
     end
     @parent = @t = parent
-    @path = @id = $tk_text_tag
-    $tk_text_tag = $tk_text_tag.succ
+    @path = @id = Tk_TextTag_ID[0]
+    Tk_TextTag_ID[0] = Tk_TextTag_ID[0].succ
     #tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
     if args != [] then
       keys = args.pop
@@ -541,14 +568,14 @@
 end
 
 class TkTextMark<TkObject
-  $tk_text_mark = 'mark0000'
+  Tk_TextMark_ID = ['mark0000']
   def initialize(parent, index)
     if not parent.kind_of?(TkText)
       fail format("%s need to be TkText", parent.inspect)
     end
     @t = parent
-    @path = @id = $tk_text_mark
-    $tk_text_mark = $tk_text_mark.succ
+    @path = @id = Tk_TextMark_ID[0]
+    Tk_TextMark_ID[0] = Tk_TextMark_ID[0].succ
     tk_call @t.path, 'mark', 'set', @id, index
     @t._addtag id, self
   end
@@ -571,6 +598,14 @@
 
   def gravity=(direction)
     tk_call @t.path, 'mark', 'gravity', @id, direction
+  end
+
+  def next(index)
+    @t.tagid2obj(tk_call(@t.path, 'mark', 'next', index))
+  end
+
+  def previous(index)
+    @t.tagid2obj(tk_call(@t.path, 'mark', 'previous', index))
   end
 end
================================================

In This Thread

Prev Next