mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
* ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries.
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e94c36f3d
commit
41b74c6e20
535 changed files with 16499 additions and 10067 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
# toplevel widget
|
||||
if defined?($plot_demo) && $plot_demo
|
||||
$plot_demo.destroy
|
||||
$plot_demo.destroy
|
||||
$plot_demo = nil
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ $plot_demo = TkToplevel.new {|w|
|
|||
base_frame = TkFrame.new($plot_demo).pack(:fill=>:both, :expand=>true)
|
||||
|
||||
# label
|
||||
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left',
|
||||
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left',
|
||||
'text'=>"This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."){
|
||||
pack('side'=>'top')
|
||||
}
|
||||
|
@ -45,55 +45,55 @@ $plot_buttons = TkFrame.new(base_frame) {|frame|
|
|||
}
|
||||
$plot_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
||||
|
||||
# font
|
||||
# font
|
||||
plotFont = '-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*'
|
||||
|
||||
# canvas
|
||||
# canvas
|
||||
$plot_canvas = TkCanvas.new(base_frame,'relief'=>'raised','width'=>450,'height'=>300)
|
||||
$plot_canvas.pack('side'=>'top', 'fill'=>'x')
|
||||
|
||||
# plot
|
||||
# plot
|
||||
TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2)
|
||||
TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2)
|
||||
TkcText.new($plot_canvas, 225, 20,
|
||||
TkcText.new($plot_canvas, 225, 20,
|
||||
'text'=>"A Simple Plot", 'font'=>plotFont, 'fill'=>'brown')
|
||||
|
||||
(0..10).each {|i|
|
||||
x = 100 + (i * 30)
|
||||
TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2)
|
||||
TkcText.new($plot_canvas, x, 254,
|
||||
TkcText.new($plot_canvas, x, 254,
|
||||
'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n')
|
||||
}
|
||||
(0..5).each {|i|
|
||||
y = 250 - (i * 40)
|
||||
TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2)
|
||||
TkcText.new($plot_canvas, 96, y,
|
||||
TkcText.new($plot_canvas, 96, y,
|
||||
'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e')
|
||||
}
|
||||
|
||||
for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]]
|
||||
x = 100 + (3*xx)
|
||||
y = 250 - (4*yy)/5
|
||||
item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6,
|
||||
item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6,
|
||||
'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2')
|
||||
item.addtag 'point'
|
||||
end
|
||||
|
||||
$plot_canvas.itembind('point', 'Any-Enter',
|
||||
$plot_canvas.itembind('point', 'Any-Enter',
|
||||
proc{$plot_canvas.itemconfigure 'current','fill','red'})
|
||||
$plot_canvas.itembind('point', 'Any-Leave',
|
||||
$plot_canvas.itembind('point', 'Any-Leave',
|
||||
proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'})
|
||||
$plot_canvas.itembind('point', '1',
|
||||
$plot_canvas.itembind('point', '1',
|
||||
proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y")
|
||||
$plot_canvas.itembind('point', 'ButtonRelease-1',
|
||||
$plot_canvas.itembind('point', 'ButtonRelease-1',
|
||||
proc{$plot_canvas.dtag 'selected'})
|
||||
$plot_canvas.bind('B1-Motion',
|
||||
$plot_canvas.bind('B1-Motion',
|
||||
proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y")
|
||||
|
||||
$plot = {'lastX'=>0, 'lastY'=>0}
|
||||
|
||||
# plotDown --
|
||||
# This method is invoked when the mouse is pressed over one of the
|
||||
# This method is invoked when the mouse is pressed over one of the
|
||||
# data points. It sets up state to allow the point to be dragged.
|
||||
#
|
||||
# Arguments:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue