require 'tk' class TkdConfigure def initialize( canvas ) @c = canvas @outline = 'black' @width = 1 @fill = '' @outlinestipple = '' @stipple = '' @dash = '' end def apply( target ) @c.itemconfigure( target, 'outline'=>@outline ) @c.itemconfigure( target, 'width'=>@width ) @c.itemconfigure( target, 'fill'=>@fill ) # @c.itemconfigure( target, 'outlinestipple'=>@outlinestipple ) @c.itemconfigure( target, 'stipple'=>@stipple ) # @c.itemconfigure( target, 'dash'=>@dash ) end def dialog( target ) @outline = @c.itemconfiginfo( target, 'outline' ).pop @width = @c.itemconfiginfo( target, 'width' ).pop @fill = @c.itemconfiginfo( target, 'fill' ).pop # @outlinestipple = @c.itemconfiginfo( target, 'outlinestipple' ).pop @stipple = @c.itemconfiginfo( target, 'stipple' ).pop # @dash = @c.itemconfiginfo( target, 'dash' ).pop w = TkToplevel.new f_outline = TkFrame.new(w).pack l_outline = TkLabel.new(f_outline, 'text'=>'outline', 'width'=>15) l_outline.pack('side'=>'left') e_outline = TkEntry.new(f_outline) e_outline.insert(0, @outline) e_outline.pack('side'=>'left') f_width = TkFrame.new(w).pack l_width = TkLabel.new(f_width, 'text'=>'width', 'width'=>15) l_width.pack('side'=>'left') e_width = TkEntry.new(f_width) e_width.insert(0, @width) e_width.pack('side'=>'left') f_fill = TkFrame.new(w).pack l_fill = TkLabel.new(f_fill, 'text'=>'fill', 'width'=>15) l_fill.pack('side'=>'left') e_fill = TkEntry.new(f_fill) e_fill.insert(0, @fill) e_fill.pack('side'=>'left') # f_outlinestipple = TkFrame.new(w).pack # l_outlinestipple = TkLabel.new(f_outlinestipple, 'text'=>'outlinestipple', 'width'=>15) # l_outlinestipple.pack('side'=>'left') # e_outlinestipple = TkEntry.new(f_outlinestipple) # e_outlinestipple.insert(0, @outlinestipple) # e_outlinestipple.pack('side'=>'left') f_stipple = TkFrame.new(w).pack l_stipple = TkLabel.new(f_stipple, 'text'=>'stipple', 'width'=>15) l_stipple.pack('side'=>'left') e_stipple = TkEntry.new(f_stipple) e_stipple.insert(0, @stipple) e_stipple.pack('side'=>'left') # f_dash = TkFrame.new(w).pack # l_dash = TkLabel.new(f_outline, 'text'=>'outline', 'width'=>15) # l_dash.pack('side'=>'left') # e_dash = TkEntry.new(f_outline) # e_dash.insert(0, @outline) # e_dash.pack('side'=>'left') infomessage = TkMessage.new(w).pack fb = TkFrame.new(w).pack TkButton.new(fb, 'text'=>'info', 'command'=>proc{ infomessage.text( @c.itemconfiginfo( target ).inspect)}).pack('side'=>'left') TkButton.new(fb, 'text'=>'apply', 'command'=>proc{ @outline = e_outline.value @width = e_width.value @fill = e_fill.value # @outlinestipple = e_outlinestipple.value @stipple = e_stipple.value # @dash = e_dash.value apply( target ) }).pack('side'=>'left') TkButton.new(fb, 'text'=>'dismiss', 'command'=>proc{ w.destroy }).pack('side'=>'left') end end