summaryrefslogtreecommitdiff
path: root/ext/tk/sample/demos-en/arrow.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
commit3514110b89bee5c37e308b4ca887e66dfe841456 (patch)
treed280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/sample/demos-en/arrow.rb
parent05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff)
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-en/arrow.rb')
-rw-r--r--ext/tk/sample/demos-en/arrow.rb74
1 files changed, 37 insertions, 37 deletions
diff --git a/ext/tk/sample/demos-en/arrow.rb b/ext/tk/sample/demos-en/arrow.rb
index 3f07b8e660..b62e1966eb 100644
--- a/ext/tk/sample/demos-en/arrow.rb
+++ b/ext/tk/sample/demos-en/arrow.rb
@@ -13,7 +13,7 @@
# interactively.
#
# Arguments:
-# c - Name of the canvas widget.
+# c - Name of the canvas widget.
def arrowSetup(c)
v = $demo_arrowInfo
@@ -29,59 +29,59 @@ def arrowSetup(c)
# Create the arrow and outline.
c.delete('all')
TkcLine.new(c, v.x1, v.y, v.x2, v.y,
- { 'width'=>10 * v.width,
- 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c],
- 'arrow'=>'last'
- }.update(v.bigLineStyle) )
+ { 'width'=>10 * v.width,
+ 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c],
+ 'arrow'=>'last'
+ }.update(v.bigLineStyle) )
xtip = v.x2 - 10*v.b
deltaY = 10*v.c + 5*v.width
TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY,
- v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y,
- 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round')
+ v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y,
+ 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round')
# Create the boxes for reshaping the line and arrowhead.
TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5,
- {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) )
+ {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) )
TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5,
- {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) )
+ {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) )
TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5,
- {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) )
+ {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) )
c.itemconfigure cur, v.activeStyle if cur
# Create three arrows in actual size with the same parameters
TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2)
tmp = v.x2+100
TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width,
- 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
+ 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width,
- 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
+ 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width,
- 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
+ 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c])
# Create a bunch of other arrows and text items showing the
# current dimensions.
tmp = v.x2+10
TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY,
- 'arrow'=>'both', 'arrowshape'=>v.smallTips)
+ 'arrow'=>'both', 'arrowshape'=>v.smallTips)
TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w')
tmp = v.x1-10
TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width,
- 'arrow'=>'both', 'arrowshape'=>v.smallTips)
+ 'arrow'=>'both', 'arrowshape'=>v.smallTips)
TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e')
tmp = v.y+5*v.width+10*v.c+10
TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp,
- 'arrow'=>'both', 'arrowshape'=>v.smallTips)
+ 'arrow'=>'both', 'arrowshape'=>v.smallTips)
TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n')
tmp = tmp+25
TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp,
- 'arrow'=>'both', 'arrowshape'=>v.smallTips)
+ 'arrow'=>'both', 'arrowshape'=>v.smallTips)
TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n')
TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w',
- 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*')
+ 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*')
TkcText.new(c, v.x1, 330,
- 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w',
- 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*')
+ 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w',
+ 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*')
v.count += 1
end
@@ -101,7 +101,7 @@ $arrow_demo = TkToplevel.new {|w|
# label
TkLabel.new($arrow_demo, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
- 'text'=>"This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."){
+ 'text'=>"This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."){
pack('side'=>'top')
}
@@ -125,14 +125,14 @@ $arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# canvas
$arrow_canvas = TkCanvas.new($arrow_demo, 'width'=>500, 'height'=>350,
- 'relief'=>'sunken', 'borderwidth'=>2)
+ 'relief'=>'sunken', 'borderwidth'=>2)
$arrow_canvas.pack('expand'=>'yes', 'fill'=>'both')
#
unless Struct.const_defined?("ArrowInfo")
$demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc,
- :x1, :x2, :y, :smallTips, :count,
- :bigLineStyle, :boxStyle, :activeStyle).new
+ :x1, :x2, :y, :smallTips, :count,
+ :bigLineStyle, :boxStyle, :activeStyle).new
end
$demo_arrowInfo.a = 8
$demo_arrowInfo.b = 10
@@ -161,16 +161,16 @@ $arrowTag_box.bind('Leave', proc{$arrow_canvas.itemconfigure('current', $demo_ar
$arrowTag_box.bind('B1-Enter', proc{})
$arrowTag_box.bind('B1-Leave', proc{})
$arrow_canvas.itembind('box1', '1',
- proc{$demo_arrowInfo.motionProc \
- = proc{|x,y| arrowMove1 $arrow_canvas, x, y}})
+ proc{$demo_arrowInfo.motionProc \
+ = proc{|x,y| arrowMove1 $arrow_canvas, x, y}})
$arrow_canvas.itembind('box2', '1',
- proc{$demo_arrowInfo.motionProc \
- = proc{|x,y| arrowMove2 $arrow_canvas, x, y}})
+ proc{$demo_arrowInfo.motionProc \
+ = proc{|x,y| arrowMove2 $arrow_canvas, x, y}})
$arrow_canvas.itembind('box3', '1',
- proc{$demo_arrowInfo.motionProc \
- = proc{|x,y| arrowMove3 $arrow_canvas, x, y}})
+ proc{$demo_arrowInfo.motionProc \
+ = proc{|x,y| arrowMove3 $arrow_canvas, x, y}})
$arrowTag_box.bind('B1-Motion',
- proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y")
+ proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y")
$arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas})
# arrowMove1 --
@@ -179,8 +179,8 @@ $arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas})
# for the line and arrowhead.
#
# Arguments:
-# c - The name of the canvas window.
-# x, y - The coordinates of the mouse.
+# c - The name of the canvas window.
+# x, y - The coordinates of the mouse.
def arrowMove1(c,x,y)
v = $demo_arrowInfo
@@ -199,8 +199,8 @@ end
# parameters for the line and arrowhead.
#
# Arguments:
-# c - The name of the canvas window.
-# x, y - The coordinates of the mouse.
+# c - The name of the canvas window.
+# x, y - The coordinates of the mouse.
def arrowMove2(c,x,y)
v = $demo_arrowInfo
@@ -223,8 +223,8 @@ end
# controlling parameters for the line and arrowhead.
#
# Arguments:
-# c - The name of the canvas window.
-# x, y - The coordinates of the mouse.
+# c - The name of the canvas window.
+# x, y - The coordinates of the mouse.
def arrowMove3(c,x,y)
v = $demo_arrowInfo