-----------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.Plot.Gtk.UI
-- Copyright   :  (c) Sumit Sahrawat
-- License     :  GPL-2
--
-- Maintainer  :  sumit.sahrawat.apm13@iitbhu.ac.in
-- Stability   :  provisional
-- Portability :  portable
--
-- Helper functions and data for the figures and sliders
--
--------------------------------------------------------------------------------
module Graphics.Rendering.Plot.Gtk.UI.Settings
    ( FigureSettings (..)
    , defaultFigureSettings
    , AdjustmentSettings (..)
    , aSetRange
    ) where

--------------------------------------------------------------------------------
-- Datatypes used by plot package for configuration

import           Graphics.Rendering.Plot (AxisPosn (..), AxisSide (..),
                                          Scale (..), SeriesType (..))

--------------------------------------------------------------------------------

data FigureSettings = FigureSettings {
      fontFamily    :: String
    , plotTitle     :: Maybe String
    , plotTitleSize :: Double
    , subTitle      :: Maybe String
    , subTitleSize  :: Double
    , xRange        :: Maybe (Double, Double)
    , yRange        :: Maybe (Double, Double)
    , samplingRate  :: Double
    , xLabel        :: Maybe String
    , xLabelSize    :: Double
    , yLabel        :: Maybe String
    , yLabelSize    :: Double
    , showXAxis     :: Bool
    , xLocation     :: (AxisPosn, AxisSide)
    , showYAxis     :: Bool
    , yLocation     :: (AxisPosn, AxisSide)
    , plotScaleX    :: Scale
    , plotScaleY    :: Scale
    , exportSize    :: (Int, Int)
    , fileName      :: String
    , plotType      :: SeriesType
    }

--------------------------------------------------------------------------------

defaultFigureSettings :: FigureSettings
defaultFigureSettings = FigureSettings {
                          fontFamily    = "Sans"
                        , plotTitle     = Nothing
                        , plotTitleSize = 10
                        , subTitle      = Nothing
                        , subTitleSize  = 10
                        , xRange        = Nothing
                        , yRange        = Nothing
                        , samplingRate  = 50
                        , xLabel        = Nothing
                        , xLabelSize    = 10
                        , yLabel        = Nothing
                        , yLabelSize    = 10
                        , showXAxis     = True
                        , xLocation     = (Side Lower, Lower)
                        , showYAxis     = True
                        , yLocation     = (Side Lower, Lower)
                        , plotScaleX    = Linear
                        , plotScaleY    = Linear
                        , exportSize    = (1000, 1000)
                        , fileName      = "plot"
                        , plotType      = Line
                        }

--------------------------------------------------------------------------------

data AdjustmentSettings = ASet {
      initVal  :: Double
    , minBound :: Double
    , maxBound :: Double
    , stepIncr :: Double
    , pageIncr :: Double
    , pageSize :: Double
    }

--------------------------------------------------------------------------------

aSetRange :: Double -> Double -> Double -> AdjustmentSettings
aSetRange x y z = ASet x y z 0.01 0.01 0.00

--------------------------------------------------------------------------------