xdot 0.3.0.1 → 0.3.0.2
raw patch · 3 files changed
+27/−18 lines, 3 filesdep +deepseqdep ~basedep ~cairodep ~graphviz
Dependencies added: deepseq
Dependency ranges changed: base, cairo, graphviz, gtk3, mtl, polyparse, text
Files
- src/Graphics/XDot/Types.hs +7/−3
- src/Graphics/XDot/Viewer.hs +6/−4
- xdot.cabal +14/−11
src/Graphics/XDot/Types.hs view
@@ -6,6 +6,7 @@ This module contains various types used to represent xdot parameters. -}+{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} module Graphics.XDot.Types ( Point, Rectangle,@@ -15,6 +16,9 @@ ) where +import GHC.Generics (Generic)+import Control.DeepSeq+ -- | A simple point, consisting of an x and y position. type Point = (Double, Double) @@ -25,13 +29,13 @@ data Alignment = LeftAlign | CenterAlign | RightAlign- deriving Show+ deriving (Show, Generic, NFData) -- | An object an operation can belong to. data Object n = None | Node n | Edge n n- deriving (Show, Eq)+ deriving (Show, Eq, Generic, NFData) -- | Drawing operations supported by xdot. See -- <http://www.graphviz.org/doc/info/output.html#d:xdot> for more information@@ -46,4 +50,4 @@ | Font { size :: Double, name :: String } | Style { style :: String } -- TODO: Add type | Image { xy :: Point, w :: Double, h :: Double, name :: String }- deriving Show+ deriving (Show, Generic, NFData)
src/Graphics/XDot/Viewer.hs view
@@ -20,9 +20,11 @@ cairoContextGetFontOptions, layoutGetContext, createLayout) import Graphics.Rendering.Cairo hiding (x, y) -import Control.Monad.State hiding (State)-import qualified Control.Monad.State as MS+import Control.Monad.State.Strict hiding (State)+import qualified Control.Monad.State.Strict as MS +import Control.DeepSeq+ type RGBA = (Double, Double, Double, Double) data DState = DState@@ -36,7 +38,7 @@ type DrawState a = MS.StateT DState Render a -- | Draw an xdot graph, possibly highlighting a node.-drawAll :: Eq t => +drawAll :: (Eq t, NFData t) => Object t -- ^ id of the node to highlight -> Rectangle -- ^ dimensions of the graph, as returned by 'Graphics.XDot.Parser.getSize' -> [(Object t, Operation)] -- ^ operations, as returned by 'Graphics.XDot.Parser.getOperations'@@ -50,7 +52,7 @@ translate offsetx offsety scale scalex scaley - boundingBoxes <- evalStateT (mapM (draw hover) ops) $ DState "" 1 1 [] (1,1,1,1) (0,0,0,1)+ boundingBoxes <- evalStateT (mapM (draw hover) $!! ops) $ DState "" 1 1 [] (1,1,1,1) (0,0,0,1) restore return
xdot.cabal view
@@ -1,13 +1,13 @@ name: xdot-version: 0.3.0.1+version: 0.3.0.2 license: BSD3 license-file: LICENSE category: Graphs, Graphics-cabal-version: >= 1.10+cabal-version: >= 1.18 build-type: Simple author: Dennis Felsing <dennis@felsin9.de> maintainer: Dennis Felsing <dennis@felsin9.de>-copyright: Dennis Felsing 2012-2016+copyright: Dennis Felsing 2012-2019 synopsis: Parse Graphviz xdot files and interactively view them using GTK and Cairo description: Parse Graphviz xdot files and interactively view them using GTK and Cairo.@@ -22,23 +22,25 @@ is now a separate project, in case anyone else may have a use for it. -tested-with: GHC == 7.4.1, GHC == 7.4.2, GHC == 7.6.1, GHC == 7.6.2, GHC == 7.6.3, GHC == 7.8.3, GHC == 7.10.1, GHC == 7.10.2, GHC == 7.10.3+tested-with: GHC == 8.0.2 || == 8.2.2 || == 8.4.4 || == 8.6.5 Extra-source-files: dot-examples/*.dot Library Exposed-modules: Graphics.XDot.Parser Graphics.XDot.Viewer Graphics.XDot.Types Default-Language: Haskell2010- Build-depends: base == 4.*,- mtl >= 2.0 && < 2.3,- cairo >= 0.12 && < 0.14,- gtk3 >= 0.12 && < 0.15,- graphviz >= 2999.16 && < 2999.19,- text >= 0.11 && < 1.3,- polyparse >= 1.8 && < 1.13+ Build-depends: base >= 4.9.1 && < 4.14,+ mtl >= 2.0,+ cairo >= 0.12,+ gtk3 >= 0.12,+ graphviz >= 2999.16,+ text >= 0.11,+ polyparse >= 1.8,+ deepseq >= 1.2 Hs-source-dirs: src/ Ghc-options: -Wall -fno-warn-unused-do-bind Executable xdot-demo Default-Language: Haskell2010+ Ghc-options: -Wall -fno-warn-unused-do-bind Main-Is: Demo.hs Build-depends: base, cairo,@@ -46,6 +48,7 @@ gtk3, text, transformers,+ deepseq, -- ourselves xdot