X-Git-Url: http://git.code-monkey.de/?p=redact.git;a=blobdiff_plain;f=lib%2Fredact%2Fprogram.rb;h=bde0c030b43fc8b4682ad559382d463e8d67842a;hp=d6038d9646b82d17c75a499fa3e361d8d87884fa;hb=b8a58959d74214164dfe0477fe36ff839728557a;hpb=c7fb73a3bb8fdef68fb471c555acdbbee4068342 diff --git a/lib/redact/program.rb b/lib/redact/program.rb index d6038d9..bde0c03 100644 --- a/lib/redact/program.rb +++ b/lib/redact/program.rb @@ -1,5 +1,5 @@ #-- -# $Id: program.rb 23 2005-04-02 23:20:32Z tilman $ +# $Id: program.rb 25 2005-04-14 19:42:06Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -35,8 +35,8 @@ module Redact include Comparable - attr_reader :collection, :id, :name, :after - attr_accessor :signal, :source, :in_from, :in_range + attr_reader :collection, :id, :name, :after, :signal, :source, + :in_from, :in_range def initialize(collection, id, name) @collection = collection @@ -56,6 +56,34 @@ module Redact @id <=> b.id end + def signal=(v) + @signal = v.to_str.dup + end + + def source=(v) + @source = v.to_str.dup + end + + def in_from=(v) + unless v.is_a?(Float) + raise(ArgumentError, + "wrong argument type #{v.class.name} " + + "(expected Float)") + end + + @in_from = v + end + + def in_range=(v) + unless v.is_a?(Float) + raise(ArgumentError, + "wrong argument type #{v.class.name} " + + "(expected Float)") + end + + @in_range = v + end + def to_eet_name "Edje_Program" end @@ -73,8 +101,8 @@ module Redact end class SetStateProgram < Program - attr_reader :targets - attr_accessor :state, :value, :mode, :time + attr_reader :targets, :state, :value, :time + attr_accessor :mode def initialize(collection, id, name) super @@ -87,6 +115,30 @@ module Redact @targets = ProgramArgs.new(collection) end + def state=(v) + @state = v.to_str.dup + end + + def value=(v) + unless v.is_a?(Float) + raise(ArgumentError, + "wrong argument type #{v.class.name} " + + "(expected Float)") + end + + @value = v + end + + def time=(v) + unless v.is_a?(Float) + raise(ArgumentError, + "wrong argument type #{v.class.name} " + + "(expected Float)") + end + + @time = v + end + def to_eet_properties mode = case @mode when :linear: 1 @@ -120,7 +172,7 @@ module Redact end class EmitSignalProgram < Program - attr_accessor :emission_signal, :emission_source + attr_reader :emission_signal, :emission_source def initialize(collection, id, name) super @@ -130,6 +182,14 @@ module Redact @emission_source = nil end + def emission_signal=(v) + @emission_signal = v.to_str.dup + end + + def emission_source=(v) + @emission_source = v.to_str.dup + end + def to_eet_properties super.merge!( {"state" => [@emission_signal], @@ -138,7 +198,7 @@ module Redact end class ExecScriptProgram < Program - attr_accessor :script + attr_reader :script def initialize(collection, id, name) super @@ -146,6 +206,10 @@ module Redact @type = TYPE_EXEC_SCRIPT @script = nil end + + def script=(v) + @script = v.to_str.dup + end end class ProgramArgs < Array