lib/ctioga2/graphics/styles/factory.rb in ctioga2-0.5 vs lib/ctioga2/graphics/styles/factory.rb in ctioga2-0.6

- old
+ new

@@ -15,11 +15,11 @@ require 'ctioga2/log' # This module contains all the classes used by ctioga module CTioga2 - Version::register_svn_info('$Revision: 432 $', '$Date: 2013-08-23 19:06:36 +0200 (Fri, 23 Aug 2013) $') + Version::register_svn_info('$Revision: 489 $', '$Date: 2013-09-03 01:03:12 +0200 (Tue, 03 Sep 2013) $') module Graphics module Styles @@ -103,20 +103,14 @@ # If that matches, we use the value as a link to other values. LinkRE = /(?:=|->)(\S+)/ # Creates a new parameter for the style factory. - # - # \todo add a way to add some more text to the description; - # possibly a self.describe_parameter function ? - # - # @todo Remove completely the 'type' argument def self.define_parameter(target, name, sets, description, short_option = nil, disable_cmds = false) # We define two new types: # - first, the color-or-auto type: - # base_type = Commands::CommandType.get_type(type) base_type = CurveStyle.attribute_type(target) if ! Commands::Interpreter.type("#{base_type.name}-or-auto") mb_type = base_type.type.dup mb_type.re_shortcuts = (mb_type.re_shortcuts ? @@ -249,11 +243,12 @@ def initialize # Overrides as in the first ctioga @override_parameters = { 'line_style' => LineStyles::Solid, 'marker_marker' => false, - 'marker_scale' => 0.5 + 'marker_scale' => 0.5, + 'fill_color' => '=color'.to_sym } @parameters_carrays = {} for target, param in self.class.parameters set = param.default_set if set @@ -351,11 +346,11 @@ define_parameter 'location_yaxis', 'yaxis', nil, "Y axis", nil, true # Now, fill style - define_parameter 'fill_y0', 'fill', + define_parameter 'fill_close_type', 'fill', {}, "Fill until", nil simple_parameter 'fill_color', "fill color", Sets::ColorSets simple_parameter 'fill_transparency', 'fill transparency', {} @@ -452,9 +447,12 @@ while h.size > 0 pre_size = h.size for k,v in h v.to_s =~ /^(?:=|->)(\S+)/ target = $1 + if CurveStyleFactory.name_to_target[target] + target = CurveStyleFactory.name_to_target[target] + end if tv.key? target tv[k] = tv[target] h.delete(k) end end