# types.rb: various useful types to interact with Tioga # copyright (c) 2009 by Vincent Fourmond # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details (in the COPYING file). require 'ctioga2/graphics/types/dimensions' require 'ctioga2/graphics/types/point' require 'ctioga2/graphics/types/boundaries' require 'ctioga2/graphics/types/boxes' require 'ctioga2/graphics/types/bijection' require 'ctioga2/graphics/types/location' require 'ctioga2/graphics/types/fill' require 'ctioga2/graphics/types/grid' # In addition to the former, here are some useful constants # This module contains all the classes used by ctioga module CTioga2 module Graphics # A small convenience module for line styles module LineStyles include Tioga::FigureConstants Line_Type_Dash_Dot_Dot = [[5,2,1,2,1,2],0] Line_Type_Small_Dots = [[0.5,1],0] # Shortcut for line styles: Solid = Line_Type_Solid Dots = Line_Type_Dots Dashes = Line_Type_Dashes Small_Dots = Line_Type_Small_Dots Dot_Long_Dash = Line_Type_Dot_Long_Dash Dash_Dot_Dot = Line_Type_Dash_Dot_Dot end ColorType = CmdType.new('color', { :type => :tioga_color, :namespace => Tioga::ColorConstants, }, < :tioga_color, :namespace => Tioga::ColorConstants, :shortcuts => {'none' => false } }, < :list, :list => {}, :shortcuts => { 'above' => :above, 'below' => :below, 'ignore' => false, } }, < :tioga_line_style, :namespace => LineStyles, :shortcuts => { /no(ne)?|off/i => false, } }, < :tioga_marker, :namespace => Tioga::MarkerConstants, :shortcuts => { 'None' => 'None', 'no' => 'None', 'none' => 'None', 'off' => 'None', },}, < Tioga::FigureConstants::LEFT_JUSTIFIED, /c(enter)?/i => Tioga::FigureConstants::CENTERED, /r(ight)?/i => Tioga::FigureConstants::RIGHT_JUSTIFIED } JustificationType = CmdType.new('justification', {:type => :re_list, :list => JustificationRE}, < Tioga::FigureConstants::ALIGNED_AT_TOP, /c(enter)|m(idheight)/i => Tioga::FigureConstants::ALIGNED_AT_MIDHEIGHT, /B|Baseline|baseline/ => Tioga::FigureConstants::ALIGNED_AT_BASELINE, /b(ottom)?/ => Tioga::FigureConstants::ALIGNED_AT_BOTTOM } AlignmentType = CmdType.new('alignment', {:type => :re_list, :list => AlignmentRE}, < :aligned_point, :default => :frame}, < :frame_margins, :shortcuts => { /^\s*auto\s*$/i => nil}}, < {'ticks_inside' => true, 'ticks_outside' => false}, /o(utside)?/i => {'ticks_outside' => true, 'ticks_inside' => false}, /b(oth)?/i => {'ticks_outside' => true, 'ticks_inside' => true} } TicksSideType = CmdType.new('ticks-side', {:type => :re_list, :list => TicksSideRE}, < :dimension, :default => :dy }, <