summaryrefslogtreecommitdiff
path: root/ext/tk/sample/demos-en/ctext.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/ctext.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/ctext.rb')
-rw-r--r--ext/tk/sample/demos-en/ctext.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/ext/tk/sample/demos-en/ctext.rb b/ext/tk/sample/demos-en/ctext.rb
index 13f8de7218..dbb5e32638 100644
--- a/ext/tk/sample/demos-en/ctext.rb
+++ b/ext/tk/sample/demos-en/ctext.rb
@@ -21,7 +21,7 @@ $ctext_demo = TkToplevel.new {|w|
# label
TkLabel.new($ctext_demo, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
- 'text'=>"This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
+ 'text'=>"This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
1. You can point, click, and type.
2. You can also select with button 1.
3. You can copy the selection to the mouse position with button 2.
@@ -52,7 +52,7 @@ $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# canvas
$ctext_canvas = TkCanvas.new($ctext_demo, 'relief'=>'flat',
- 'borderwidth'=>0, 'width'=>500, 'height'=>350)
+ 'borderwidth'=>0, 'width'=>500, 'height'=>350)
$ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both')
# font
@@ -60,37 +60,37 @@ textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*'
# canvas
TkcRectangle.new($ctext_canvas, 245, 195, 255, 205,
- 'outline'=>'black', 'fill'=>'red')
+ 'outline'=>'black', 'fill'=>'red')
$ctag_text = TkcTag.new($ctext_canvas)
$ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200,
- 'text'=>"This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above).",
- 'width'=>440, 'anchor'=>'n',
- 'font'=>'-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*',
- 'kanjifont'=>'-*--24-*-jisx0208.1983-0',
- 'justify'=>'left') )
+ 'text'=>"This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above).",
+ 'width'=>440, 'anchor'=>'n',
+ 'font'=>'-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*',
+ 'kanjifont'=>'-*--24-*-jisx0208.1983-0',
+ 'justify'=>'left') )
$ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('Shift-1',
- proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"},
- "%x %y")
+ proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"},
+ "%x %y")
$ctag_text.bind('Shift-B1-Motion',
- proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y")
+ proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A")
$ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"})
$ctag_text.bind('Control-h', proc{textBs $ctext_canvas})
$ctag_text.bind('BackSpace', proc{textBs $ctext_canvas})
$ctag_text.bind('Delete', proc{textDel $ctext_canvas})
$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"},
- "%x %y")
+ "%x %y")
# Next, create some items that allow the text's anchor position
# to be edited.
def mkTextConfig(w,x,y,option,value,color)
item = TkcRectangle.new(w, x, y, x+30, y+30,
- 'outline'=>'black', 'fill'=>color, 'width'=>1)
+ 'outline'=>'black', 'fill'=>color, 'width'=>1)
item.bind('1', proc{$ctag_text.configure option, value})
w.addtag_withtag('config', item)
end
@@ -108,11 +108,11 @@ mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color
mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color
mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color
item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50,
- 'outline'=>'black', 'fill'=>'red')
+ 'outline'=>'black', 'fill'=>'red')
item.bind('1', proc{$ctag_text.configure 'anchor', 'center'})
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'anchor'=>'s',
- 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
- 'fill'=>'brown')
+ 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
+ 'fill'=>'brown')
# Lastly, create some items that allow the text's justification to be
# changed.
@@ -124,14 +124,14 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color
mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color
mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'anchor'=>'s',
- 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
- 'fill'=>'brown')
+ 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
+ 'fill'=>'brown')
$ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas})
$ctext_canvas.itembind('config', 'Leave',
- proc{$ctext_canvas\
- .itemconfigure('current',
- 'fill'=>$textConfigFill)})
+ proc{$ctext_canvas\
+ .itemconfigure('current',
+ 'fill'=>$textConfigFill)})
$textConfigFill = ''