From d3a8f9b361470dc928e7804f14638366367f8362 Mon Sep 17 00:00:00 2001 From: nagai Date: Fri, 14 May 2004 09:41:59 +0000 Subject: [PATCH] * ext/tk/lib/tk/canvas.rb: improve coords support for canvas items. Now, supports all of the followings. TkcLine.new(c, 0, 0, 100, 100, :fill=>'red') TkcLine.new(c, [0, 0, 100, 100], :fill=>'red') TkcLine.new(c, [0, 0], [100, 100], :fill=>'red') TkcLine.new(c, [[0, 0], [100, 100]], :fill=>'red') TkcLine.new(c, :coords=>[0, 0, 100, 100], :fill=>'red') TkcLine.new(c, :coords=>[[0, 0], [100, 100]], :fill=>'red') git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++ ext/tk/lib/tk/canvas.rb | 196 ++++++++++++++------------------ ext/tk/sample/demos-en/items.rb | 2 +- ext/tk/sample/demos-jp/items.rb | 6 +- 4 files changed, 99 insertions(+), 116 deletions(-) diff --git a/ChangeLog b/ChangeLog index c57503bf16..6050540706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri May 14 18:37:49 2004 Hidetoshi NAGAI + + * ext/tk/lib/tk/canvas.rb: improve coords support for canvas + items. Now, supports all of the followings. + TkcLine.new(c, 0, 0, 100, 100, :fill=>'red') + TkcLine.new(c, [0, 0, 100, 100], :fill=>'red') + TkcLine.new(c, [0, 0], [100, 100], :fill=>'red') + TkcLine.new(c, [[0, 0], [100, 100]], :fill=>'red') + TkcLine.new(c, :coords=>[0, 0, 100, 100], :fill=>'red') + TkcLine.new(c, :coords=>[[0, 0], [100, 100]], :fill=>'red') + Fri May 14 13:30:39 Hirokazu Yamamoto * test/ruby/test_float.rb: Add test for util.c revision 1.42. diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 7defecdfe4..b311db6e20 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -60,12 +60,9 @@ class TkCanvas ['', '', '', self.coords(tagOrId)]} when 'dash', 'activedash', 'disableddash' conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', tagid(tagOrId), @@ -410,6 +417,7 @@ class TkCanvas'n', 'font'=>font1, 'width'=>'4c', 'text'=>'A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text.', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, - 'text'=>'Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge.', 'justify'=>'center', 'tags'=>$tag_item ) + 'text'=>"Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge.", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb index d80751064b..0dc604bb6b 100644 --- a/ext/tk/sample/demos-jp/items.rb +++ b/ext/tk/sample/demos-jp/items.rb @@ -178,12 +178,10 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'テキスト', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', - 'text'=>'短いテキスト。ワードラップ、左揃え、アンカーは北 (上)。\ -□は各テキストのアンカーポイントを示す。', 'tags'=>$tag_item ) + 'text'=>'短いテキスト。ワードラップ、左揃え、アンカーは北(上)。□は各テキストのアンカーポイントを示す。', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, - 'text'=>'いくつかの行。\nそれぞれ独立に\n行揃え。\n\ -全て左端がアンカーされている。', 'justify'=>'center', 'tags'=>$tag_item ) + 'text'=>"いくつかの行。\nそれぞれ独立に\n行揃え。\n全て左端がアンカーされている。", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red,