[#26664] refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

22 messages 2005/08/01
[#26665] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26668] Re: refactoring tcltklib.c (deleted ip check) — Hidetoshi NAGAI <nagai@...> 2005/08/01

永井@知能.九工大です.

[#26678] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26684] Re: refactoring tcltklib.c (deleted ip check) — Hidetoshi NAGAI <nagai@...> 2005/08/01

永井@知能.九工大です.

[#26686] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26817] test/socket/test_tcp.rb freeze on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

12 messages 2005/08/18

[#26829] cannot check EOF of pipe on windows — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

19 messages 2005/08/19
[#26830] Re: cannot check EOF of pipe on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/19

山本です。

[#26831] Re: cannot check EOF of pipe on windows — "U.Nakamura" <usa@...> 2005/08/19

こんにちは、なかむら(う)です。

[#26832] Re: cannot check EOF of pipe on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/19

山本です。

[#26836] Re: cannot check EOF of pipe on windows — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/19

なかだです。

[#26872] irb -I/ruby -Iと$LOAD_PATH — akira yamada / やまだあきら <akira@...>

Debianユーザからruby -Iとirb -Iで

17 messages 2005/08/24
[#26873] Re: irb -I/ruby -Iと$LOAD_PATH — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/24

なかだです。

[#26875] Re: irb -I/ruby -Iと$LOAD_PATH — akira yamada / やまだあきら <akira@...> 2005/08/24

nobuyoshi nakada wrote:

[#26885] Re: irb -I/ruby -Iと$LOAD_PATH — keiju@... (石塚圭樹) 2005/08/26

けいじゅ@いしつかです.

[#26897] fail on make install — KIMURA Koichi <kimura.koichi@...>

木村です。

28 messages 2005/08/29
[#26898] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/29

こんにちは、なかむら(う)です。

[#26903] Re: fail on make install — KIMURA Koichi <kbk@...> 2005/08/29

木村です。

[#26922] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/30

木村です。

[#26926] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/31

木村です。

[#26927] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/31

こんにちは、なかむら(う)です。

[#26928] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/31

木村です。

[#26929] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/31

こんにちは、なかむら(う)です。

[#26930] Re: fail on make install — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/31

なかだです。

[#26931] Re: fail on make install — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/31

山本です。

[#26933] Re: fail on make install — nobu@... 2005/08/31

なかだです。

[#26938] Re: fail on make install — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/09/01

なかだです。

[#26939] Re: fail on make install — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/01

山本です。

[#26900] multiplying empty string — nobuyoshi nakada <nobuyoshi.nakada@...>

19 messages 2005/08/29
[#26904] Re: multiplying empty string — Yukihiro Matsumoto <matz@...> 2005/08/29

まつもと ゆきひろです

[#26907] Re: multiplying empty string — Tanaka Akira <akr@...17n.org> 2005/08/29

In article <1125327516.070646.12845.nullmailer@x31.priv.netlab.jp>,

[#26909] Re: multiplying empty string — Yukihiro Matsumoto <matz@...> 2005/08/29

まつもと ゆきひろです

[ruby-dev:26716] Re: refactoring tcltklib.c (deleted ip check)

From: Hidetoshi NAGAI <nagai@...>
Date: 2005-08-02 17:42:36 UTC
List: ruby-dev #26716
永井@知能.九工大です.

From: H.Yamamoto <ocean@m2.ccsnet.ne.jp>
Subject: [ruby-dev:26706] Re: refactoring tcltklib.c (deleted ip check)
Date: Tue, 2 Aug 2005 19:19:51 +0900
Message-ID: <20050802191948.CD55CC78.ocean@m2.ccsnet.ne.jp>
> >canvas widget などの itemconfigure と同じように使うことを
> >想定していました.
> >つまり,treeview.headingconfigure('#0', :text=>'Widget') などと
> >いうようにです.
> >tk_call を使っている部分は,これに置き換えて動きませんか?
> これは試しました。その上でこういうエラーが出たのであきらめました。

From: H.Yamamoto <ocean@m2.ccsnet.ne.jp>
Subject: [ruby-dev:26709] Re: refactoring tcltklib.c (deleted ip check)
Date: Tue, 2 Aug 2005 20:45:37 +0900
Message-ID: <20050802204535.C63049F8.ocean@m2.ccsnet.ne.jp>
> >array2tk_list でも動くことを確認したので、こちらにしたほうがいいでしょうか?
> と思ったらエラーが出て動きませんでした。そのままにしておきます。

見直してたんですが,どうやら treeview.rb を書いていた時は,
凄まじく呆けていたようです.(;_;)

# きちんと見てみると滅茶苦茶...

下記ではどうでしょう?
OK なら,commit しておいていただけると助かります.

Index: ext/tk/lib/tkextlib/tile/treeview.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/tile/treeview.rb,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 treeview.rb
--- ext/tk/lib/tkextlib/tile/treeview.rb	1 Aug 2005 10:25:51 -0000	1.1.2.3
+++ ext/tk/lib/tkextlib/tile/treeview.rb	2 Aug 2005 17:36:06 -0000
@@ -10,93 +10,124 @@
     class Treeview < TkWindow
     end
 
-    module TreeviewItemConfig
+    module TreeviewConfig
       include TkItemConfigMethod
 
       def __item_cget_cmd(id)
-        [self.path, 'item', id]
+        [self.path, id[0], id[1]]
       end
       private :__item_cget_cmd
 
       def __item_config_cmd(id)
-        [self.path, 'item', id]
+        [self.path, id[0], id[1]]
       end
       private :__item_config_cmd
 
       def __item_numstrval_optkeys(id)
-        ['width']
+        case id[0]
+        when :item, 'item'
+          ['width']
+        when :column, 'column'
+          super(id[1])
+        when :heading, 'heading'
+          super(id[1])
+        end
       end
       private :__item_numstrval_optkeys
 
       def __item_strval_optkeys(id)
-        # maybe need to override
-        super(id) + ['id']
+        case id[0]
+        when :item, 'item'
+          super(id) + ['id']
+        when :column, 'column'
+          super(id[1])
+        when :heading, 'heading'
+          super(id[1])
+        end
       end
       private :__item_strval_optkeys
 
       def __item_boolval_optkeys(id)
-        ['open']
+        case id[0]
+        when :item, 'item'
+          ['open']
+        when :column, 'column'
+          super(id[1])
+        when :heading, 'heading'
+          super(id[1])
+        end
       end
       private :__item_boolval_optkeys
 
       def __item_listval_optkeys(id)
-        ['values']
+        case id[0]
+        when :item, 'item'
+          ['values']
+        when :column, 'column'
+          []
+        when :heading, 'heading'
+          []
+        end
       end
       private :__item_listval_optkeys
-    end
 
-    module TreeviewColumnConfig
-      include TkItemConfigMethod
+      alias __itemcget itemcget
+      alias __itemconfigure itemconfigure
+      alias __itemconfiginfo itemconfiginfo
+      alias __current_itemconfiginfo current_itemconfiginfo
 
-      def __item_cget_cmd(id)
-        [self.path, 'column', id]
-      end
-      private :__item_cget_cmd
+      private :__itemcget, :__itemconfigure
+      private :__itemconfiginfo, :__current_itemconfiginfo
 
-      def __item_config_cmd(id)
-        [self.path, 'column', id]
+      # Treeview Item
+      def itemcget(tagOrId, option)
+        __itemcget([:item, tagOrId], option)
       end
-      private :__item_config_cmd
-
-      def __item_listval_optkeys(id)
-        []
+      def itemconfigure(tagOrId, slot, value=None)
+        __itemconfigure([:item, tagOrId], slot, value)
       end
-      private :__item_listval_optkeys
-
-      alias columncget itemcget
-      alias columnconfigure itemconfigure
-      alias columnconfiginfo itemconfiginfo
-      alias current_columnconfiginfo current_itemconfiginfo
-
-      private :itemcget, :itemconfigure
-      private :itemconfiginfo, :current_itemconfiginfo
-    end
-
-    module TreeviewHeadingConfig
-      include TkItemConfigMethod
-
-      def __item_cget_cmd(id)
-        [self.path, 'heading', id]
+      def itemconfiginfo(tagOrId, slot=nil)
+        __itemconfiginfo([:item, tagOrId], slot)
       end
-      private :__item_cget_cmd
-
-      def __item_config_cmd(id)
-        [self.path, 'heading', id]
+      def current_itemconfiginfo(tagOrId, slot=nil)
+        __current_itemconfiginfo([:item, tagOrId], slot)
       end
-      private :__item_config_cmd
 
-      def __item_listval_optkeys(id)
-        []
+      # Treeview Column
+      def columncget(tagOrId, option)
+        __itemcget([:column, tagOrId], option)
       end
-      private :__item_listval_optkeys
-
-      alias headingcget itemcget
-      alias headingconfigure itemconfigure
-      alias headingconfiginfo itemconfiginfo
-      alias current_headingconfiginfo current_itemconfiginfo
+      def columnconfigure(tagOrId, slot, value=None)
+        __itemconfigure([:column, tagOrId], slot, value)
+      end
+      def columnconfiginfo(tagOrId, slot=nil)
+        __itemconfiginfo([:column, tagOrId], slot)
+      end
+      def current_columnconfiginfo(tagOrId, slot=nil)
+        __current_itemconfiginfo([:column, tagOrId], slot)
+      end
+      alias column_cget columncget
+      alias column_configure columnconfigure
+      alias column_configinfo columnconfiginfo
+      alias current_column_configinfo current_columnconfiginfo
 
-      private :itemcget, :itemconfigure
-      private :itemconfiginfo, :current_itemconfiginfo
+      # Treeview Heading
+      def headingcget(tagOrId, option)
+        __itemcget([:heading, tagOrId], option)
+      end
+      def headingconfigure(tagOrId, slot, value=None)
+        __itemconfigure([:heading, tagOrId], slot, value)
+      end
+      def headingconfiginfo(tagOrId, slot=nil)
+        __itemconfiginfo([:heading, tagOrId], slot)
+      end
+      def current_headingconfiginfo(tagOrId, slot=nil)
+        __current_itemconfiginfo([:heading, tagOrId], slot)
+      end
+      alias heading_cget headingcget
+      alias heading_configure headingconfigure
+      alias heading_configinfo headingconfiginfo
+      alias current_heading_configinfo current_headingconfiginfo
     end
   end
 end
@@ -105,9 +136,7 @@
   include Tk::Tile::TileWidget
   include Scrollable
 
-  include Tk::Tile::TreeviewColumnConfig
-  include Tk::Tile::TreeviewHeadingConfig
-  include Tk::Tile::TreeviewItemConfig
+  include Tk::Tile::TreeviewConfig
 
   if Tk::Tile::USE_TTK_NAMESPACE
     TkCommandNames = ['::ttk::treeview'.freeze].freeze
@@ -122,98 +151,119 @@
   end
 
   def tagid(id)
-    _get_eval_string(id)
+    if id.kind_of?(Array)
+      [id[0], _get_eval_string(id[1])]
+    else
+      _get_eval_string(id)
+    end
   end
 
   def children(item)
-    list(tk_send_without_enc('children', item))
+    simplelist(tk_send_without_enc('children', item))
   end
-  def children=(item, *items)
-    tk_send_without_enc('children', item, *items)
-    items
+  def set_children(item, *items)
+    tk_send_without_enc('children', item, 
+                        array2tk_list(items.flatten, true))
+    self
   end
 
   def delete(*items)
-    tk_send_without_enc('delete', *items)
+    tk_send_without_enc('delete', array2tk_list(items.flatten, true))
     self
   end
 
   def detach(*items)
-    tk_send_without_enc('detach', *items)
+    tk_send_without_enc('detach', array2tk_list(items.flatten, true))
     self
   end
 
   def exist?(item)
-    bool(tk_send_without_enc('exists', item))
+    bool(tk_send_without_enc('exists', _get_eval_enc_str(item)))
   end
 
   def focus_item(item = None)
-    tk_send_without_enc('focus', item)
+    tk_send('focus', item)
   end
 
   def identify(x, y)
-    tk_send_without_enc('identify', x, y)
+    ret = simplelist(tk_send('identify', x, y))
+    case ret[0]
+    when 'heading', 'separator', 'cell'
+      ret[-1] = num_or_str(ret[-1])
+    end
   end
 
   def index(item)
-    number(tk_send_without_enc('index', item))
+    number(tk_send('index', item))
   end
 
   def insert(parent, idx, keys={})
     keys = _symbolkey2str(keys)
     id = keys.delete('id')
     if id
-      tk_send_without_enc('insert', parent, idx, '-id', id, *hash_kv(keys))
+      tk_send('insert', parent, idx, '-id', id, *hash_kv(keys))
     else
-      tk_send_without_enc('insert', parent, idx, *hash_kv(keys))
+      tk_send('insert', parent, idx, *hash_kv(keys))
     end
     self
   end
 
+  def instate(spec, cmd=Proc.new)
+    tk_send('instate', spec, cmd)
+  end
+  def state(spec=None)
+    tk_send('state', spec)
+  end
+
   def move(item, parent, idx)
-    tk_send_without_enc('move', item, parent, idx)
+    tk_send('move', item, parent, idx)
     self
   end
 
   def next(item)
-    tk_send_without_enc('next', item)
+    tk_send('next', item)
   end
 
   def parent(item)
-    tk_send_without_enc('parent', item)
+    tk_send('parent', item)
   end
 
   def prev(item)
-    tk_send_without_enc('prev', item)
+    tk_send('prev', item)
   end
 
   def see(item)
-    tk_send_without_enc('see', item)
+    tk_send('see', item)
     self
   end
 
+  def selection
+    simplelist(tk_send('selection'))
+  end
+  alias selection_get selection
+
   def selection_add(*items)
-    tk_send_without_enc('selection', 'add', *items)
+    tk_send('selection', 'add', array2tk_list(items.flatten, true))
     self
   end
   def selection_remove(*items)
-    tk_send_without_enc('selection', 'remove', *items)
+    tk_send('selection', 'remove', array2tk_list(items.flatten, true))
     self
   end
   def selection_set(*items)
-    tk_send_without_enc('selection', 'set', *items)
+    tk_send('selection', 'set', array2tk_list(items.flatten, true))
     self
   end
   def selection_toggle(*items)
-    tk_send_without_enc('selection', 'toggle', *items)
+    tk_send('selection', 'toggle', array2tk_list(items.flatten, true))
     self
   end
 
   def get(item, col)
-    tk_send_without_enc('set', item, col)
+    tk_send('set', item, col)
   end
   def set(item, col, value)
-    tk_send_without_enc('set', item, col, value)
+    tk_send('set', item, col, value)
     self
   end
 end
Index: ext/tk/sample/tkextlib/tile/demo.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/sample/tkextlib/tile/demo.rb,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 demo.rb
--- ext/tk/sample/tkextlib/tile/demo.rb	2 Aug 2005 11:48:30 -0000	1.1.2.7
+++ ext/tk/sample/tkextlib/tile/demo.rb	2 Aug 2005 17:36:06 -0000
@@ -14,7 +14,10 @@
 
 # This forces an update of the available packages list. It's required
 # for package names to find the themes in demos/themes/*.tcl
-Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl'))
+## Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl'))
+##  --> This doesn't work. 
+##      Because, unknown_proc may be "command + some arguments".
+Tk.ip_eval("#{TkPackage.unknown_proc}  Tcl #{TkPackage.provide('Tcl')}")
 
 TkRoot.new{
   title 'Tile demo'
@@ -574,8 +577,8 @@
   # Later nodes will be added in <<TreeviewOpen>> binding.
   treeview.insert('', 0, :id=>'.', :text=>'Main Window', :open=>false,
       :values=>[TkWinfo.classname('.')])
-  Tk.tk_call(treeview, 'heading', '#0', :text=>'Widget')
-  Tk.tk_call(treeview, 'heading', 'Class', :text=>'Class')
+  treeview.headingconfigure('#0', :text=>'Widget')
+  treeview.headingconfigure('Class', :text=>'Class')
   treeview.bind('<TreeviewOpen>', proc{fillTree(treeview)})
 
   def fillTree(treeview)

-- 
                                       永井 秀利 (九工大 知能情報)
                                           nagai@ai.kyutech.ac.jp

In This Thread