indexing description: "[ Global options for Viz Options will expire if changed, so it's possible for clients to react on changes only. Must, however, be manually updated. ]" author: "" date: "$Date$" revision: "$Revision$" class EM_VIZ_OPTIONS inherit EM_SHARED_STANDARD_FONTS export {NONE} all end EM3D_SHARED_FONT_FACTORY export {NONE} all end EM_ALIGNMENT_CONSTANTS export {NONE} all end EM_VIZ_UPDATEABLE create {EM_SHARED_VIZ_OPTIONS} make feature {NONE} -- Initialization make is -- Initialize default values do set_defaults update end feature -- Update mechanism needs_update: BOOLEAN -- Do we need to update renderables? deep_expire, expire is -- Renderables need to be updated do needs_update := True end update is -- To be called after renderables have been updated do needs_update := False end feature -- Access use_point_snapping: BOOLEAN -- Point snapping enabled? use_antialiasing: BOOLEAN -- Antialiasing enabled? debug_gfx: BOOLEAN -- Render debugging hints default_light_color: EM_COLOR -- Color used for lighting default_background_color: EM_COLOR -- Default background color for boxes default_font_color: EM_COLOR -- Default font color default_border_color: EM_COLOR -- Default border color for boxes default_font: EM3D_FONT -- Default 3d font text_font_format: EM3D_FONT_FORMAT -- Format to be used for simple text title_font_format: EM3D_FONT_FORMAT -- Format to be used for titles code_font_format: EM3D_FONT_FORMAT -- Format to be used for code snippets label_font_format: EM3D_FONT_FORMAT -- Format to be used for labels label_alignment: EM_ALIGNMENT_2D -- Alignment of label label_box_alignment: EM_ALIGNMENT_3D -- Alignment of labels inside box bounding_box_line_width: DOUBLE -- Line width of bounding-box edges bounding_box_color: EM_COLOR -- Color of bounding-box edges spot_size: DOUBLE -- Size of spots spot_color: EM_COLOR -- Color of spots link_line_width: DOUBLE -- Width of link lines link_source_color: EM_COLOR -- Color of source link_sink_color: EM_COLOR -- Color of sink link_arrow_size: DOUBLE -- Size of link arrow grid_line_width: DOUBLE -- Width of grid lines grid_color: EM_COLOR -- Color of grid lines or points axis_line_width: DOUBLE -- Width of axis lines axis_arrow_size: DOUBLE -- Size of arrows on axis axis_blip_size: DOUBLE -- Size of blips on axis axis_color: EM_COLOR -- Color of axis feature -- Element change set_use_point_snapping (enable: like use_point_snapping) is -- Enable/disable point snapping do use_point_snapping := enable expire ensure expired: needs_update end set_use_antialiasing (enable: like use_antialiasing) is -- Enable/disable antialiasing do use_antialiasing := enable expire ensure expired: needs_update end set_debug_gfx (enable: like debug_gfx) is -- Enable/disable graphical debugging do debug_gfx := enable expire ensure expired: needs_update end set_default_light_color (color: like default_light_color) is -- Set default light color do default_light_color := color expire ensure expired: needs_update end set_default_background_color (color: like default_background_color) is -- Set default background color do default_background_color := color expire ensure expired: needs_update end set_default_font_color (color: like default_font_color) is -- Set default font color do default_font_color := color expire ensure expired: needs_update end set_default_border_color (color: like default_border_color) is -- Set default border color do default_border_color := color expire ensure expired: needs_update end set_default_font (font: like default_font) is -- Set default format to be used for text do default_font := font expire ensure expired: needs_update end set_text_font_format (format: like text_font_format) is -- Set font format for simple text do text_font_format := format expire ensure expired: needs_update end set_title_font_format (format: like title_font_format) is -- Format to be used for titles do title_font_format := format expire ensure expired: needs_update end set_code_font_format (format: like code_font_format) is -- Format to be used for code snippets do code_font_format := format expire ensure expired: needs_update end set_label_font_format (format: like label_font_format) is -- Format to be used for labels do label_font_format := format expire ensure expired: needs_update end set_label_alignment (alignment: like label_alignment) is -- Alignment of simple labels do label_alignment := alignment expire ensure expired: needs_update end set_label_box_alignment (alignment: like label_box_alignment) is -- Alignment of labels inside box do label_box_alignment := alignment expire ensure expired: needs_update end set_bounding_box_line_width (width: like bounding_box_line_width) is -- Line width of bounding-box edges do bounding_box_line_width := width expire ensure expired: needs_update end set_bounding_box_color (color: like bounding_box_color) is -- Color of bounding-box edges do bounding_box_color := color expire ensure expired: needs_update end set_spot_size (size: like spot_size) is -- Size of spots do spot_size := size expire ensure expired: needs_update end set_spot_color (color: like spot_color) is -- Color of spots do spot_color := color expire ensure expired: needs_update end set_link_line_width (width: like link_line_width) is -- Width of link lines do link_line_width := width expire ensure expired: needs_update end set_link_source_color (color: like link_source_color) is -- Color of source do link_source_color := color expire ensure expired: needs_update end set_link_sink_color (color: like link_sink_color) is -- Color of sink do link_sink_color := color expire ensure expired: needs_update end set_link_arrow_size (size: like link_arrow_size) is -- Size of link arrow do link_arrow_size := size expire ensure expired: needs_update end set_grid_line_width (width: like grid_line_width) is -- Width of grid lines do grid_line_width := width expire ensure expired: needs_update end set_grid_color (color: like grid_color) is -- Color of grid lines or points do grid_color := color expire ensure expired: needs_update end set_axis_line_width (width: like axis_line_width) is -- Width of axis lines do axis_line_width := width expire ensure expired: needs_update end set_axis_arrow_size (size: like axis_arrow_size) is -- Size of arrows on axis do axis_arrow_size := size expire ensure expired: needs_update end set_axis_blip_size (size: like axis_blip_size) is -- Size of blips on axis do axis_blip_size := size expire ensure expired: needs_update end set_axis_color (color: like axis_color) is -- Color of axis do axis_color := color expire ensure expired: needs_update end set_defaults is -- Set meaningful defaults for all options local code_font_color: EM_COLOR do bounding_box_line_width := 1.0 spot_size := 5.0 link_line_width := 1.0 link_arrow_size := 5.0 grid_line_width := 1.0 axis_line_width := 1.0 axis_arrow_size := 5.0 axis_blip_size := 5.0 use_point_snapping := True use_antialiasing := True debug_gfx := False default_background_color := [255, 255, 255] default_font_color := [ 0, 0, 0] default_border_color := [ 0, 0, 0] code_font_color := [ 0, 0, 255] default_light_color := [255, 255, 255] bounding_box_color := [255, 0, 0, 63] spot_color := [255, 0, 0, 63] link_source_color := [ 0, 0, 0, 63] link_sink_color := [ 0, 0, 0] grid_color := [128, 128, 128] axis_color := [ 0, 0, 0] label_alignment := [Align_left, Align_bottom] label_box_alignment := [Align_right, Align_top, Align_front] -- Default font Em3d_font_factory.create_from_ttf ( Standard_ttf_fonts.bitstream_vera_sans (12) ) default_font := Em3d_font_factory.last_font -- Standard text create text_font_format.make_with_color (default_font, default_font_color) text_font_format.enable_point_snapping -- Label text label_font_format := text_font_format -- Title text Em3d_font_factory.create_from_ttf ( Standard_ttf_fonts.bitstream_vera_sans_bold (20) ) create title_font_format.make_with_color (Em3d_font_factory.last_font, default_font_color) title_font_format.enable_point_snapping -- Code text Em3d_font_factory.create_from_ttf ( Standard_ttf_fonts.bitstream_vera_sans_mono (12) ) create code_font_format.make_with_color (Em3d_font_factory.last_font, code_font_color) code_font_format.enable_point_snapping expire ensure expired: needs_update end -- invariant -- If you honestly believe I should write invariants for each option, you're crazy! end