timeplot 0.2.1 → 0.2.2
raw patch · 2 files changed
+23/−4 lines, 2 files
Files
- Tools/TimePlot.hs +15/−3
- timeplot.cabal +8/−1
Tools/TimePlot.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ScopedTypeVariables, TypeFamilies, FlexibleContexts, GADTs #-}+{-# LANGUAGE ScopedTypeVariables, TypeFamilies, FlexibleContexts, GADTs, CPP #-} module Main where import Control.Monad@@ -25,7 +25,9 @@ import Data.Accessor import Graphics.Rendering.Chart+#if HAVE_GTK import Graphics.Rendering.Chart.Gtk+#endif import Graphics.Rendering.Chart.Grid import Graphics.Rendering.Chart.Plot import Graphics.Rendering.Chart.Event@@ -56,7 +58,10 @@ | InAtom S.ByteString deriving (Show) -data OutFormat = PNG | PDF | PS | SVG | Window+data OutFormat = PNG | PDF | PS | SVG +#if HAVE_GTK+ | Window+#endif class HasDelta t where type Delta t :: *@@ -134,7 +139,11 @@ inFile = single "input file" "-if" (error "No input file (-if) specified") outFile = single "output file" "-o" (error "No output file (-of) specified") outFormat = maybe PNG id $ lookup (single "output format" "-of" (name2format outFile)) $- [("png",PNG), ("pdf",PDF), ("ps",PS), ("svg",SVG), ("x",Window)]+ [("png",PNG), ("pdf",PDF), ("ps",PS), ("svg",SVG)+#if HAVE_GTK + , ("x",Window)+#endif + ] where name2format = reverse . takeWhile (/='.') . reverse outRes = parseRes $ single "output resolution" "-or" "640x480"@@ -458,6 +467,7 @@ " [-k Pat1 Kind1 -k Pat2 Kind2 ...] [-dk KindN] [-fromTime TIME] [-toTime TIME]", " -o OFILE - output file (required if -of is not x)", " -of - output format (x means draw result in a window, default: extension of -o)",+ " x is only available if you installed timeplot with --flags=gtk", " -or - output resolution (default 640x480)", " -if IFILE - input file; '-' means 'read from stdin'", " -tf TF - time format: 'num' means that times are integer numbers less than 2^31",@@ -522,7 +532,9 @@ PDF -> renderableToPDFFile ; PS -> renderableToPSFile ; SVG -> renderableToSVGFile ;+#if HAVE_GTK Window -> \c w h f -> renderableToWindow c w h+#endif } case conf of Conf{parseTime=parseTime, inFile=inFile, chartKindF=chartKindF, outFile=outFile, outResolution=outResolution, fromTime=fromTime, toTime=toTime} -> do
timeplot.cabal view
@@ -1,5 +1,5 @@ Name: timeplot-Version: 0.2.1+Version: 0.2.2 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2009@@ -21,12 +21,19 @@ flag splitbase description: Choose the new smaller, split-up base package. +flag gtk+ description: Include the gtk-based ability to render to a window+ default: False+ executable tplot if flag(splitbase) Build-Depends: base >= 3 && < 5 else Build-Depends: base < 3 + if flag(gtk)+ cpp-options: -DHAVE_GTK=1+ Build-Depends: Chart >= 0.14, cairo, bytestring, bytestring-lexing, strptime >= 0.1.5, time, containers, colour, data-accessor == 0.2.*, data-accessor-template >= 0.2.1.1 && < 0.3, haskell98, regex-tdfa