packages feed

carettah 0.0.6 → 0.0.7

raw patch · 6 files changed

+35/−5 lines, 6 filesdep +directorybinary-added

Dependencies added: directory

Files

Carettah.hs view
@@ -7,9 +7,9 @@ import Data.Time import Data.Maybe import Data.Version (showVersion)+import System.FilePath ((</>),(<.>))+import System.Directory (copyFile) import Control.Monad.Reader---import Control.Monad.State---import Control.Monad.Trans import qualified Graphics.UI.Gtk as G import qualified Graphics.Rendering.Cairo as C import qualified Text.Pandoc as P@@ -116,6 +116,9 @@   , Option "i"     ["info"]     (NoArg (\ opts -> opts { optSlideInfo = True }))     "show slide infomation"+  , Option "n"     ["new-slide"]+    (NoArg (\ opts -> opts { optNewTemp = True }))+    "create a new slide file and open it"   ]  carettahOpts :: [String] -> IO (Options, [String])@@ -203,6 +206,24 @@   updateRenderdTime   -- getopts   (opts, filen:_) <- carettahOpts =<< getArgs+  -- create file if -n option+  case opts of+    (Options {optNewTemp = True}) ->+      do tf <- wrapGetDataFileName $ "data" </> "turtle" <.> "png"+         copyFile tf ("turtle" <.> "png")+         df <- wrapGetDataFileName $ "data" </> "debian" <.> "png"+         copyFile df ("debian" <.> "png")+         writeFile filen ns+           where ns = "\+\# Presentation Title\n\+\![background](debian.png)\n\n\+\Your Name\n\n\+\# Slide Title\n\+\* item1\n\+\* item2\n\+\* item3\n\n\+\![inline](turtle.png)\n"+    _ -> return ()   -- setup slide   updateMarkdownFname $ const filen   loadMarkdown filen
Config.hs view
@@ -17,6 +17,7 @@                        , optPdfOutput :: Maybe FilePath                        , optTime      :: Maybe Double                        , optSlideInfo :: Bool+                       , optNewTemp   :: Bool                        } deriving Show  defaultOptions :: Options@@ -24,6 +25,7 @@                          , optPdfOutput = Nothing                          , optTime      = Just 5                          , optSlideInfo = False+                         , optNewTemp   = False                          }  data WiiHandle = NoWiiHandle | WiiHandle CWiidWiimote
Render.hs view
@@ -95,7 +95,13 @@   surface <- liftIO $ C.imageSurfaceCreateFromPNG file   w <- C.imageSurfaceGetWidth surface   h <- C.imageSurfaceGetHeight surface-  return (surface, w, h)+  if (w, h) == (0, 0)+    then do fn <- liftIO . wrapGetDataFileName $ "data" </> "notfound" <.> "png"+            surface' <- liftIO $ C.imageSurfaceCreateFromPNG fn+            w' <- C.imageSurfaceGetWidth surface'+            h' <- C.imageSurfaceGetHeight surface'+            return (surface', w', h')+    else return (surface, w, h)  renderPngSize :: Double -> Double -> Double -> Double -> Double -> FilePath -> C.Render Double renderPngSize = f
carettah.cabal view
@@ -1,5 +1,5 @@ Name:                   carettah-Version:                0.0.6+Version:                0.0.7 Author:                 Kiwamu Okabe <kiwamu@debian.or.jp> Maintainer:             Kiwamu Okabe <kiwamu@debian.or.jp> License:                GPL-2@@ -13,7 +13,7 @@ Homepage:               http://carettah.masterq.net/ Tested-with:            GHC == 7.0.4 -data-files:             data/turtle.png+data-files:             data/turtle.png, data/debian.png, data/notfound.png  Executable              carettah   hs-source-dirs:       .@@ -22,6 +22,7 @@                         filepath,                         time,                         mtl,+                        directory,                         pandoc,                         gtk,                         cairo,
+ data/debian.png view

binary file changed (absent → 73697 bytes)

+ data/notfound.png view

binary file changed (absent → 118608 bytes)