Remove the GTK viewer.

This commit is contained in:
David 2019-02-27 10:08:34 +01:00
commit 0140a898a6
3 changed files with 1 additions and 99 deletions

View file

@ -1,7 +1,7 @@
# reanimate # reanimate
Reanimate is a reactive framework for creating non-interactive animations from SVG images. 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. previewer. Inline latex code is supported when 'latex' and 'dvisvgm' are installed.
Nothing about the API is stable at this point. Nothing about the API is stable at this point.
@ -12,7 +12,6 @@ The example gifs are displayed at 25 fps.
* bounding boxes * bounding boxes
* alignment and positioning combinators * alignment and positioning combinators
* automatic code reloading in the Gtk viewer
* website for live coding * website for live coding
# Examples # Examples

View file

@ -48,26 +48,3 @@ executable reanimate-server
other-modules: Reanimate.Misc other-modules: Reanimate.Misc
build-depends: base >=4.10 && <4.13, text, websockets, process, filepath, directory, build-depends: base >=4.10 && <4.13, text, websockets, process, filepath, directory,
cache, clock, stm, containers 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

View file

@ -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