-- | High-level dot.
module Sound.SC3.UGen.Dot.HL where

import Sound.SC3.UGen.Dot.Class
import Sound.SC3.UGen.Dot.Internal
import Sound.SC3.UGen.Dot.Type

-- | 'dot_with_opt' of 'dot_options'.
dot :: Drawable a => a -> String
dot = dot_with_opt dot_options

-- | 'dot_with_opt' of 'svg_options'.
dot_svg :: Drawable a => a -> String
dot_svg = dot_with_opt svg_options

-- | 'view_with' of 'dot_with_opt'.
draw_with_opt :: Drawable a => Dot_Options -> a -> IO ()
draw_with_opt o x = view_with o (dot_with_opt o x)

-- | 'draw_with_opt' with 'run_viewer' set to 'False'.
write_with_opt :: Drawable a => Dot_Options -> a -> IO ()
write_with_opt o = draw_with_opt (o {run_viewer = False})

-- | 'draw_with_opt' of 'dot_options'.
draw :: Drawable a => a -> IO ()
draw = draw_with_opt dot_options

-- | 'draw_with_opt' of 'svg_options'.
draw_svg :: Drawable a => a -> IO ()
draw_svg = draw_with_opt svg_options

-- | Default @dot@ format 'Dot_Options'.
--
-- > std_style dot_options
dot_options :: Dot_Options
dot_options = Dot_Options
    {use_tables = True
    ,use_attr_id = False
    ,use_splines = False
    ,output_format = DOT
    ,output_directory = "/tmp"
    ,output_file_name = "hsc3"
    ,fix_edge_location = False
    ,numeric_precision = 3
    ,indicate_precision = False
    ,inline_controls = False
    ,display_control_names = True
    ,dot_viewer = "dotty"
    ,svg_viewer = "rsvg-view-3"
    ,font_name = "Courier"
    ,font_size = 12
    ,graph_size = Nothing
    ,colour_edges = True
    ,run_viewer = True
    }

-- | Default @svg@ format 'Dot_Options'.
svg_options :: Dot_Options
svg_options = dot_options {output_format = SVG
                          ,fix_edge_location = True}