hxournal 0.6.0.0 → 0.6.0.1
raw patch · 3 files changed
+49/−7 lines, 3 filesdep ~xournal-render
Dependency ranges changed: xournal-render
Files
- hxournal.cabal +34/−5
- lib/Application/HXournal/Coroutine/File.hs +8/−0
- lib/Application/HXournal/ModelAction/File.hs +7/−2
hxournal.cabal view
@@ -1,5 +1,5 @@ Name: hxournal-Version: 0.6.0.0+Version: 0.6.0.1 Synopsis: A pen notetaking program written in haskell Description: notetaking program written in haskell and gtk2hs Homepage: http://ianwookim.org/hxournal@@ -20,6 +20,11 @@ location: http://www.github.com/wavewave/hxournal +Flag Poppler+ Description: Enable poppler support + Default: True++ Executable hxournal Main-is: hxournal.hs hs-source-dirs: exe@@ -34,8 +39,9 @@ hs-source-dirs: lib ghc-options: -Wall -O2 -threaded -funbox-strict-fields -fno-warn-unused-do-bind ghc-prof-options: -caf-all -auto-all- Build-Depends: - base == 4.*, + + if flag(poppler)+ Build-Depends: base == 4.*, mtl == 2.*, directory == 1.*, filepath == 1.*, @@ -46,7 +52,7 @@ transformers == 0.2.*, xournal-types == 0.1.*, xournal-parser == 0.3.*,- xournal-render == 0.3.*,+ xournal-render == 0.3.0.*, xournal-builder == 0.1.*, containers == 0.4.*, template-haskell == 2.*,@@ -56,6 +62,27 @@ cmdargs >= 0.7 && <= 0.10, configurator == 0.1.*, poppler == 0.12.*+ else + Build-Depends: base == 4.*, + mtl == 2.*,+ directory == 1.*,+ filepath == 1.*, + strict == 0.3.*,+ gtk == 0.12.*, + cairo == 0.12.*,+ monad-coroutine == 0.7.*, + transformers == 0.2.*,+ xournal-types == 0.1.*,+ xournal-parser == 0.3.*,+ xournal-render == 0.3.0.*,+ xournal-builder == 0.1.*,+ containers == 0.4.*,+ template-haskell == 2.*,+ bytestring == 0.9.*, + double-conversion == 0.2.*,+ fclabels == 1.0.*,+ cmdargs >= 0.7 && <= 0.10,+ configurator == 0.1.* Exposed-Modules: Application.HXournal.ProgType@@ -110,4 +137,6 @@ install-includes: csrc/c_initdevice.h csrc/template-hsc-gtk2hs.h- + if flag(poppler) + cpp-options: -DPOPPLER+
lib/Application/HXournal/Coroutine/File.hs view
@@ -22,6 +22,8 @@ import Data.Xournal.Simple import Data.Xournal.Map +import System.Directory+ askIfSave :: Iteratee MyEvent XournalStateIO () -> Iteratee MyEvent XournalStateIO () askIfSave action = do @@ -66,10 +68,12 @@ fileOpen :: Iteratee MyEvent XournalStateIO () fileOpen = do liftIO $ putStrLn "file open clicked"+ cwd <- liftIO getCurrentDirectory dialog <- liftIO $ fileChooserDialogNew Nothing Nothing FileChooserActionOpen [ ("OK", ResponseOk) , ("Cancel", ResponseCancel) ]+ liftIO $ fileChooserSetCurrentFolder dialog cwd res <- liftIO $ dialogRun dialog case res of ResponseDeleteEvent -> liftIO $ widgetDestroy dialog@@ -93,10 +97,12 @@ fileSaveAs :: Iteratee MyEvent XournalStateIO () fileSaveAs = do liftIO $ putStrLn "file save as clicked"+ cwd <- liftIO getCurrentDirectory dialog <- liftIO $ fileChooserDialogNew Nothing Nothing FileChooserActionSave [ ("OK", ResponseOk) , ("Cancel", ResponseCancel) ]+ liftIO $ fileChooserSetCurrentFolder dialog cwd res <- liftIO $ dialogRun dialog case res of ResponseDeleteEvent -> liftIO $ widgetDestroy dialog@@ -131,10 +137,12 @@ fileAnnotatePDF = do xstate <- getSt liftIO $ putStrLn "file annotate PDf clicked"+ cwd <- liftIO getCurrentDirectory dialog <- liftIO $ fileChooserDialogNew Nothing Nothing FileChooserActionOpen [ ("OK", ResponseOk) , ("Cancel", ResponseCancel) ]+ liftIO $ fileChooserSetCurrentFolder dialog cwd res <- liftIO $ dialogRun dialog case res of ResponseDeleteEvent -> liftIO $ widgetDestroy dialog
lib/Application/HXournal/ModelAction/File.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE OverloadedStrings, CPP #-} module Application.HXournal.ModelAction.File where @@ -24,8 +24,10 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as C +#ifdef POPPLER import qualified Graphics.UI.Gtk.Poppler.Document as Poppler import qualified Graphics.UI.Gtk.Poppler.Page as PopplerPage+#endif -- | get file content from xournal file and update xournal state @@ -74,6 +76,7 @@ makeNewXojWithPDF :: FilePath -> IO (Maybe Xournal) makeNewXojWithPDF fp = do let fname = C.pack fp +#ifdef POPPLER mdoc <- popplerGetDocFromFile fname case mdoc of Nothing -> do @@ -90,7 +93,9 @@ putStrLn $ "total num of pages " ++ show n putStrLn $ "size = " ++ show (w,h) return (Just xoj)- +#else+ error "makeNewXojWithPDF : this cannot be done without poppler lib." +#endif createPage :: Dimension -> B.ByteString -> Int -> Page createPage dim fn n