From 0140a898a68a98273608f65e388ec7ec3adafa85 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 27 Feb 2019 10:08:34 +0100 Subject: [PATCH] Remove the GTK viewer. --- README.md | 3 +- reanimate.cabal | 23 --------------- src/SvgViewer.hs | 74 ------------------------------------------------ 3 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 src/SvgViewer.hs diff --git a/README.md b/README.md index b2b97ef..fd6326a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # reanimate Reanimate is a reactive framework for creating non-interactive animations from SVG images. -This package consists of a set of arrow combinators, a renderer (using ffmpeg), and a Gtk-based +This package consists of a set of arrow combinators, a renderer (using ffmpeg), and a web-based previewer. Inline latex code is supported when 'latex' and 'dvisvgm' are installed. Nothing about the API is stable at this point. @@ -12,7 +12,6 @@ The example gifs are displayed at 25 fps. * bounding boxes * alignment and positioning combinators -* automatic code reloading in the Gtk viewer * website for live coding # Examples diff --git a/reanimate.cabal b/reanimate.cabal index 9ce59df..7a257e0 100644 --- a/reanimate.cabal +++ b/reanimate.cabal @@ -48,26 +48,3 @@ executable reanimate-server other-modules: Reanimate.Misc build-depends: base >=4.10 && <4.13, text, websockets, process, filepath, directory, cache, clock, stm, containers - -executable reanimate-viewer - if flag(gtk-viewer) - buildable: True - else - buildable: False - main-is: SvgViewer.hs - -- other-extensions: - other-modules: Reanimate.Arrow - Reanimate.Render - Reanimate.Examples - Reanimate.Combinators - Reanimate.LaTeX - Reanimate.Svg - Reanimate.Misc - Reanimate.Transform - Reanimate.Svg.NamedColors - build-depends: base >=4.10 && <4.13, cairo >=0.13 && <0.14, gtk, - svgcairo, lucid-svg, time, text, unix, lucid, reanimate, - filepath, process, directory, containers, svg-tree >= 0.6.2.3, xml, - bytestring, lens, linear, mtl, matrix,JuicyPixels, attoparsec - hs-source-dirs: src - default-language: Haskell2010 diff --git a/src/SvgViewer.hs b/src/SvgViewer.hs deleted file mode 100644 index 35ba639..0000000 --- a/src/SvgViewer.hs +++ /dev/null @@ -1,74 +0,0 @@ -import System.Environment (getArgs) - -import Graphics.UI.Gtk -import Graphics.UI.Gtk.Gdk.EventM -import Graphics.Rendering.Cairo -import Graphics.Rendering.Cairo.SVG - -import Control.Concurrent -import Control.Monad -import System.IO -import System.Posix.IO -import Data.IORef -import Data.Time - -import Reanimate.Arrow -import Reanimate.Examples - -animation = progressMeters - -main :: IO () -main = do - - frames <- newIORef (0::Int) - ref <- newIORef True - forkIO $ forever $ do - fps <- readIORef frames - writeIORef frames 0 - -- putStrLn $ "FPS: " ++ show fps - threadDelay (10^6) - modifyIORef ref not - - -- (file1:file2:_) <- getArgs - (width, height) <- svgGetSize <$> svgNewFromString (show $ frameAt 0 animation) - -- - -- svg2 <- svgNewFromFile file2 - - t1 <- getCurrentTime - - initGUI - dia <- dialogNew - dialogAddButton dia stockOk ResponseOk - contain <- dialogGetUpper dia - canvas <- drawingAreaNew - onSizeRequest canvas $ return (Requisition width height) - -- (readFd, writeFd) <- createPipe - -- readHandle <- fdToHandle readFd - -- writeHandle <- fdToHandle writeFd - canvas `on` exposeEvent $ do - liftIO $ modifyIORef frames succ - flag <- liftIO $ readIORef ref - svg <- liftIO $ do - t2 <- getCurrentTime - let time = realToFrac (diffUTCTime t2 t1) - svgNewFromString (show $ frameAt time animation) - updateCanvas canvas svg - flip idleAdd priorityDefaultIdle $ do - widgetQueueDraw canvas - return True - boxPackStartDefaults contain canvas - widgetShow canvas - dialogRun dia - return () - -updateCanvas :: DrawingArea -> SVG -> EventM EExpose Bool -updateCanvas canvas svg = do - win <- eventWindow - liftIO $ do - let (width, height) = svgGetSize svg - (width', height') <- widgetGetSize canvas - renderWithDrawable win $ do - scale (realToFrac width' / realToFrac width) - (realToFrac height' / realToFrac height) - svgRender svg - return True