[Gridflow-cvs] [svn] commit: r3424 - /trunk/base/flow_objects.rb

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Thu Apr 3 20:21:44 EDT 2008


Author: matju
Date: Thu Apr  3 20:21:44 2008
New Revision: 3424

Log:
remove old [display]

Modified:
    trunk/base/flow_objects.rb

Modified: trunk/base/flow_objects.rb
==============================================================================
--- trunk/base/flow_objects.rb (original)
+++ trunk/base/flow_objects.rb Thu Apr  3 20:21:44 2008
@@ -439,129 +439,6 @@
   #doc:_0_float,"float to find in that list"
   #doc_out:_0_float,"position of the incoming float in the stored list"
 }
-
-if FObject.respond_to?(:gui_enable)
-class Display < FObject
-	def initialize
-		super
-		@selected=false
-		@rsym = (self.class.to_s+":"+"%08x"%(2*self.object_id)).intern # unique id for use in Tcl
-		@can = nil    # the canvas number
-		@canvas = nil # the canvas string
-		@y, at x = 0,0 # position on canvas
-		@sy, at sx = 16,16 # size on canvas
-		@font = "Courier -12"
-		@vis = nil
-		@sel = nil; @args = [] # contents of last received message
-		@text = "..."
-		@sy, at sx = 16,80 # default size of the widget
-		@gp = Pd.objectmaker(:"#print")
-		Pd.send_in @gp, 0, :maxrows, 20
-		@clock = Clock.new self
-	end
-	attr_reader :canvas
-	attr_reader :selected
-	attr_accessor :text
-	def canvas=(can)
-		@can = can if Integer===can
-		@canvas = case can
-		  when String; can
-		  when Integer; ".x%x.c"%(4*can)
-		  else raise "huh?"
-		end
-	end
-	def initialize2(*)
-		GridFlow.bind self, @rsym.to_s
-		b=bself
-		Pd.send_in @gp, 0, :dest, b
-	end
-	def pd_displace(can,x,y) self.canvas||=can; @x+=x; @y+=y; pd_show(can) end
-	def pd_activate(can,*) self.canvas||=can end
-	def quote(text)
-		text=text.gsub(/["\[\]\n\$]/m) {|x| if x=="\n" then "\\n" else "\\"+x end }
-		text= "\"" + text + "\""
-		text
-	end
-	def pd_vis(can,vis) self.canvas||=can; @vis=vis!=0; update end
-	def update; pd_show @can if @vis end
-	def pd_getrect(can)
-		self.canvas||=can
-		@x, at y = get_position(can)
-		# the extra one-pixel on each side was for #peephole only
-		# not sure what to do with this
-		[@x-1, at y-1, at x+@sx+1, at y+@sy+1]
-	end
-	def pd_click(can,x,y,shift,alt,dbl,doit) return 0 end
-	def outline; if selected then "#0000ff" else "#000000" end end
-	def pd_select(can,sel)
-		self.canvas||=can
-		@selected=sel!=0
-		GridFlow.gui %{ #{canvas} itemconfigure #{@rsym} -outline #{outline} \n }
-	end
-	def pd_delete(can) end
-	def highlight(color,ratio) # doesn't use self
-		c = /^#(..)(..)(..)/.match(color)[1..3].map {|x| x.hex }
-		c.map! {|x| [255,(x*ratio).to_i].min }
-		"#%02x%02x%02x" % c
-	end
-	def _0_set_size(sy,sx) @sy, at sx=sy,sx end
-	def atom_to_s a
-		# careful with the namespaces! apparently, Array is not ::Array in this context (i don't know why)
-		case a
-		when   Float; sprintf("%.5f",a).gsub(/\.?0+$/, "")
-		when ::Array; "(" + a.map{|x| atom_to_s x }.join(" ") + ")"
-		else a.to_s
-		end
-	end
-	def method_missing(sel,*args)
-		m = /^(_\d+_)(.*)/.match(sel.to_s) or return super
-		@sel, at args = m[2].intern,args
-		@text = case @sel
-			when nil; "..."
-			when :float; atom_to_s @args[0]
-			else @sel.to_s + ": " + @args.map{|a| atom_to_s a }.join(' ')
-			end
-		@clock.delay 0
-	end
-	def pd_show(can)
-		self.canvas||=can
-		@x, at y = get_position can if can
-		return if not canvas or not @vis # can't show for now...
-		cmd = "display_update #{@rsym} #{@x} #{@y} \#000000 \#cccccc #{outline} #{quote @font} #{canvas} #{quote @text}\n"
-		#puts "CMD=#{cmd}"
-		GridFlow.gui cmd
-	end
-	def pd_delete(can)
-		GridFlow.gui %{ #{canvas} delete #{@rsym} #{@rsym}TEXT \n} if @vis
-		super
-	end
-	def _0_grid(*foo) @text=""; Pd.send_in @gp, 0, :grid, *foo; @clock.delay 0 end
-	def call; update; end
-	def _0_very_long_name_that_nobody_uses(*list)
-		@text << "\n" if @text.length>0
-		list.each {|x| @text << x.to_i }
-	end
-	install "display", 1, 1
-	gui_enable
-
-	GridFlow.gui %{
-		proc display_update {self x y fg bg outline font canvas text} {
-			$canvas delete ${self}TEXT
-			$canvas create text [expr $x+2] [expr $y+2] -fill $fg -font $font -text $text -anchor nw -tag ${self}TEXT
-			foreach {x1 y1 x2 y2} [$canvas bbox ${self}TEXT] {}
-			incr x -1
-			incr y -1
-			set sx [expr $x2-$x1+2]
-			set sy [expr $y2-$y1+4]
-			$canvas delete ${self}
-			$canvas create rectangle $x $y [expr $x+$sx] [expr $y+$sy] -fill $bg -tags $self -outline $outline
-			$canvas create rectangle $x $y [expr $x+7]         $y      -fill red -tags $self -outline $outline
-			$canvas lower $self ${self}TEXT
-			pd \"$self set_size $sy $sx;\\n\"
-		}
-	}
-end
-end # respond to gui_enable
 
 FObject.subclass("printargs",1,0) {
   def initialize(*args)



More information about the Gridflow-cvs mailing list