Skip to content

Commit

Permalink
remove all warnings for default (without hub and dyre flags)
Browse files Browse the repository at this point in the history
  • Loading branch information
wavewave committed Feb 26, 2015
1 parent 652deed commit 490b15f
Show file tree
Hide file tree
Showing 48 changed files with 170 additions and 233 deletions.
2 changes: 1 addition & 1 deletion coroutine-object/coroutine-object.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Cabal-Version: >= 1.8
data-files:
Library
hs-source-dirs: src
ghc-options: -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-options: -Werror -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-prof-options: -caf-all -auto-all
Build-Depends: base >4 && <5,
mtl>2,
Expand Down
2 changes: 1 addition & 1 deletion hoodle-builder/hoodle-builder.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Source-repository head

Library
hs-source-dirs: src
ghc-options: -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-options: -Werror -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-prof-options: -caf-all -auto-all
Build-Depends:
double-conversion >= 0.2.0.6,
Expand Down
2 changes: 1 addition & 1 deletion hoodle-core/hoodle-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Flag Hub

Library
hs-source-dirs: src
ghc-options: -Wall -dynamic-too -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-options: -Werror -Wall -dynamic-too -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans
ghc-prof-options: -caf-all -auto-all

Build-Depends: aeson>=0.7,
Expand Down
3 changes: 1 addition & 2 deletions hoodle-core/src/Hoodle/Coroutine/Commit.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Hoodle.Coroutine.Commit
-- Copyright : (c) 2011-2014 Ian-Woo Kim
-- Copyright : (c) 2011-2015 Ian-Woo Kim
--
-- License : BSD3
-- Maintainer : Ian-Woo Kim <ianwookim@gmail.com>
Expand All @@ -21,7 +21,6 @@ import Hoodle.Coroutine.Draw
import Hoodle.GUI.Reflect
import Hoodle.ModelAction.Page
import Hoodle.Type.Coroutine
import Hoodle.Type.Event
import Hoodle.Type.HoodleState
import Hoodle.Type.Undo
import Hoodle.Util
Expand Down
2 changes: 1 addition & 1 deletion hoodle-core/src/Hoodle/Coroutine/ContextMenu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ processContextMenu (CMenuMakeLinkToAnchor anc) = do
mloc = case view (hoodleFileControl.hoodleFileName) uhdl of
LocalDir Nothing -> Nothing
LocalDir (Just fp) -> Just fp
TempDir fp -> Nothing
TempDir _ -> Nothing
loc = maybe "" B.pack mloc
lnk = LinkAnchor uuidbstr docidbstr loc (anchor_id anc) "" (0,0) (Dim 50 50)
callRenderer $ cnstrctRItem (ItemLink lnk) >>= return . GotRItem
Expand Down
22 changes: 12 additions & 10 deletions hoodle-core/src/Hoodle/Coroutine/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module Hoodle.Coroutine.Default where

import Control.Applicative hiding (empty)
import Control.Concurrent
import Control.Concurrent.STM
import qualified Control.Exception as E
import Control.Lens (over,view,set,at,(.~),(^.),_2)
import Control.Monad.State hiding (mapM_)
Expand All @@ -32,32 +31,34 @@ import qualified Data.IntMap as M
import Data.IORef
import qualified Data.List as L
import Data.Maybe
import qualified Graphics.UI.Gtk as Gtk hiding (get,set)
import System.Process
#ifdef HUB
import Control.Concurrent.STM
import Data.Sequence (Seq,viewl, ViewL(..))
import Data.Time.Clock
import Data.UUID
import qualified Graphics.Rendering.Cairo as Cairo
import qualified Graphics.UI.Gtk as Gtk hiding (get,set)
-- import qualified Graphics.UI.Gtk.Poppler.Document as Poppler
-- import qualified Graphics.UI.Gtk.Poppler.Page as Poppler
import System.Directory
import System.Process
#endif
-- from hoodle-platform
import Control.Monad.Trans.Crtn.Driver
import Control.Monad.Trans.Crtn.Object
import Control.Monad.Trans.Crtn.Logger.Simple
import Control.Monad.Trans.Crtn.Queue
import Data.Hoodle.Simple (Dimension(..), Background(..))
import Data.Hoodle.Generic
import Graphics.Hoodle.Render
import Graphics.Hoodle.Render.Engine
import Graphics.Hoodle.Render.Background
import Graphics.Hoodle.Render.Type
#ifdef HUB
import Control.Monad.Trans.Crtn.Queue
import Graphics.Hoodle.Render.Background
#endif
-- from this package
import Hoodle.Accessor
import Hoodle.Coroutine.Callback
import Hoodle.Coroutine.ContextMenu
import Hoodle.Coroutine.Default.Menu
import Hoodle.Coroutine.Dialog
import Hoodle.Coroutine.Draw
import Hoodle.Coroutine.Eraser
import Hoodle.Coroutine.File
Expand All @@ -68,7 +69,6 @@ import Hoodle.Coroutine.Page
import Hoodle.Coroutine.Pen
import Hoodle.Coroutine.Scroll
import Hoodle.Coroutine.Select
import Hoodle.Coroutine.TextInput
import Hoodle.Coroutine.VerticalSpace
import Hoodle.Coroutine.Window
import Hoodle.Device
Expand All @@ -83,16 +83,18 @@ import Hoodle.Type.Enum
import Hoodle.Type.Event
import Hoodle.Type.HoodleState
import Hoodle.Type.PageArrangement
import Hoodle.Type.Predefined
import Hoodle.Type.Undo
import Hoodle.Type.Window
import Hoodle.Type.Widget
import Hoodle.Util
import Hoodle.Widget.Dispatch
import Hoodle.Widget.PanZoom
#ifdef HUB
import Hoodle.Coroutine.Dialog
import Hoodle.Coroutine.HubInternal
import Hoodle.Coroutine.Socket
import Hoodle.Coroutine.TextInput
import Hoodle.Type.Predefined
#endif
--
import Prelude hiding (mapM_)
Expand Down
6 changes: 3 additions & 3 deletions hoodle-core/src/Hoodle/Coroutine/Draw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ invalidateGeneral cid mbbox flag drawf drawfsel drawcont drawcontsel = do
let cpn = PageNum . view currentPageNum $ cvsInfo
isCurrentCvs = cid == getCurrentCanvasId uhdl
epage = getCurrentPageEitherFromHoodleModeState cvsInfo (view hoodleModeState uhdl)
cid = view canvasId cvsInfo
cvsid = view canvasId cvsInfo
cvs = view drawArea cvsInfo
msfc = view mDrawSurface cvsInfo
case epage of
Left page -> do
liftIO (unSinglePageDraw drawf cache cid isCurrentCvs (cvs,msfc) (cpn,page)
liftIO (unSinglePageDraw drawf cache cvsid isCurrentCvs (cvs,msfc) (cpn,page)
<$> view viewInfo <*> pure mbbox <*> pure flag $ cvsInfo )
return ()
Right tpage -> do
liftIO (unSinglePageDraw drawfsel cache cid isCurrentCvs (cvs,msfc) (cpn,tpage)
liftIO (unSinglePageDraw drawfsel cache cvsid isCurrentCvs (cvs,msfc) (cpn,tpage)
<$> view viewInfo <*> pure mbbox <*> pure flag $ cvsInfo )
return ()
fcont :: RenderCache -> UnitHoodle -> CanvasInfo ContinuousPage -> MainCoroutine ()
Expand Down
5 changes: 2 additions & 3 deletions hoodle-core/src/Hoodle/Coroutine/Eraser.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Hoodle.Coroutine.Eraser
-- Copyright : (c) 2011-2014 Ian-Woo Kim
-- Copyright : (c) 2011-2015 Ian-Woo Kim
--
-- License : BSD3
-- Maintainer : Ian-Woo Kim <ianwookim@gmail.com>
Expand Down Expand Up @@ -76,10 +76,9 @@ eraserProcess cid pnum geometry itms (x0,y0) = do
page <- getCurrentPageCvsId cid
let uhdl = view (unitHoodles.currentUnit) xstate
currhdl = unView . view hoodleModeState $ uhdl
dim = view gdimension page
pgnum = view currentPageNum cvsInfo
currlayer = getCurrentLayer page
let (newitms,maybebbox) = St.runState (eraseHitted hittestitem) Nothing
let (newitms,_maybebbox) = St.runState (eraseHitted hittestitem) Nothing
newlayerbbox = set gitems newitms currlayer
callRenderer_ $ updateLayerBuf cid newlayerbbox
let newpagebbox = adjustCurrentLayer newlayerbbox page
Expand Down
29 changes: 15 additions & 14 deletions hoodle-core/src/Hoodle/Coroutine/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,34 @@
module Hoodle.Coroutine.File where

-- from other packages
import Control.Applicative ((<$>),(<*>))
import Control.Concurrent
import qualified Control.Exception as E
import Control.Applicative
import Control.Lens (at,view,set,over,(.~))
import Control.Monad.State hiding (mapM,mapM_,forM_)
import Control.Monad.Trans.Either
import Control.Monad.Trans.Maybe (MaybeT(..))
import Control.Monad.Trans.Reader
import Data.Attoparsec.ByteString.Char8 (parseOnly)
import Data.ByteString.Char8 as B (pack,unpack,readFile)
import qualified Data.ByteString.Lazy as L
import Data.Digest.Pure.MD5 (md5)
import Data.Foldable (mapM_,forM_)
import qualified Data.List as List
import Data.Maybe
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import Data.Time.Clock
import Filesystem.Path.CurrentOS (decodeString, encodeString)
import qualified Graphics.Rendering.Cairo as Cairo
import qualified Graphics.UI.Gtk as Gtk
import System.Directory
import System.FilePath
import qualified System.FSNotify as FS
import System.IO (hClose, hFileSize, openFile, IOMode(..))
import System.Process
#ifdef HUB
import Control.Concurrent
import qualified Control.Exception as E
import Control.Monad.Trans.Reader
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import Filesystem.Path.CurrentOS (decodeString, encodeString)
import qualified System.FSNotify as FS
#endif
-- from hoodle-platform
import Control.Monad.Trans.Crtn
import Data.Hoodle.Generic
Expand Down Expand Up @@ -122,7 +124,6 @@ askIfOverwrite fp action = do
getFileContent :: FileStore -> MainCoroutine ()
getFileContent store@(LocalDir (Just fname)) = do
xstate <- get
let uhdluuid = view (unitHoodles.currentUnit.unitUUID) xstate
let ext = takeExtension fname
case ext of
".hdl" -> do
Expand All @@ -134,6 +135,7 @@ getFileContent store@(LocalDir (Just fname)) = do
constructNewHoodleStateFromHoodle h
ctime <- liftIO $ getCurrentTime
#ifdef HUB
-- let uhdluuid = view (unitHoodles.currentUnit.unitUUID) xstate
msqlfile <- view (settings.sqliteFileName) <$> get
let fileuuidbstr = view hoodleID h
fileuuidtxt = TE.decodeUtf8 fileuuidbstr
Expand All @@ -147,8 +149,7 @@ getFileContent store@(LocalDir (Just fname)) = do
#endif
pureUpdateUhdl ( (hoodleFileControl.hoodleFileName .~ store)
. (hoodleFileControl.lastSavedTime .~ Just ctime)
. (hoodleFileControl.syncMD5History .~ maybeToList mmd5)
)
. (hoodleFileControl.syncMD5History .~ maybeToList mmd5) )
commit_
".xoj" -> do
liftIO (XP.parseXojFile fname) >>= \x -> case x of
Expand Down Expand Up @@ -176,8 +177,8 @@ getFileContent (LocalDir Nothing) = do
constructNewHoodleStateFromHoodle =<< liftIO defaultHoodle
pureUpdateUhdl (hoodleFileControl.hoodleFileName .~ LocalDir Nothing)
commit_
getFileContent store@(TempDir fname) = do
#ifdef HUB
getFileContent store@(TempDir fname) = do
xstate <- get
let uhdluuid = view (unitHoodles.currentUnit.unitUUID) xstate
let ext = takeExtension fname
Expand All @@ -200,7 +201,7 @@ getFileContent store@(TempDir fname) = do
xstate' <- get
doIOaction_ $ Gtk.postGUIAsync (setTitleFromFileName xstate')
#else
return ()
getFileContent _ = return ()
#endif


Expand Down Expand Up @@ -437,7 +438,7 @@ fileLoadImageBackground = do
let fDoesEmbedImg = view (settings.doesEmbedImage) xst
uhdl = view (unitHoodles.currentUnit) xst
hdl = getHoodle uhdl
Dim pw ph = (view gdimension . fromJust . view (gpages.at 0)) hdl
Dim pw _ph = (view gdimension . fromJust . view (gpages.at 0)) hdl

itm <- if fDoesEmbedImg
then checkEmbedImageSize filename
Expand Down
10 changes: 5 additions & 5 deletions hoodle-core/src/Hoodle/Coroutine/Link.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
module Hoodle.Coroutine.Link where

import Control.Applicative
import Control.Concurrent (forkIO)
import Control.Lens (_2,at,view,set,(^.))
import Control.Monad (filterM,forever,void)
import Control.Monad.State (get,liftIO,guard,when)
import Control.Monad hiding (forM_)
import Control.Monad.State (get,liftIO)
import Control.Monad.Trans.Maybe
import qualified Data.ByteString.Char8 as B
import Data.Foldable (forM_)
Expand All @@ -40,6 +39,7 @@ import System.Directory
import System.FilePath
import System.Process (createProcess, proc)
#ifdef HUB
import Control.Concurrent (forkIO)
import DBus
import DBus.Client
#endif
Expand All @@ -56,7 +56,6 @@ import Graphics.Hoodle.Render.Util.HitTest
import Hoodle.Accessor
import Hoodle.Coroutine.Dialog
import Hoodle.Coroutine.Draw
import Hoodle.Coroutine.File
import Hoodle.Coroutine.Page (changePage)
import Hoodle.Coroutine.Select.Clipboard
import Hoodle.Coroutine.TextInput
Expand All @@ -74,6 +73,7 @@ import Hoodle.Type.PageArrangement
import Hoodle.Util
import Hoodle.View.Coordinate
#ifdef HUB
import Hoodle.Coroutine.File
import Hoodle.Coroutine.HubInternal
#endif
--
Expand Down Expand Up @@ -341,5 +341,5 @@ goToAnchorPos docid anchorid = do
let hdl = rHoodle2Hoodle rhdl
when (docid == (TE.decodeUtf8 . view ghoodleID) rhdl) $ do
let anchormap = getAnchorMap hdl
forM_ (M.lookup anchorid anchormap) $ \(pgnum,(x,y))-> changePage (const pgnum)
forM_ (M.lookup anchorid anchormap) $ \(pgnum,_)-> changePage (const pgnum)

14 changes: 3 additions & 11 deletions hoodle-core/src/Hoodle/Coroutine/Page.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
module Hoodle.Coroutine.Page where

import Control.Applicative
import Control.Concurrent
import Control.Concurrent.STM
import Control.Lens (view,set,(.~), (^.))
import Control.Monad
Expand All @@ -29,15 +28,11 @@ import qualified Data.Foldable as F
import Data.Function (on)
import qualified Data.IntMap as M
import Data.List (sortBy)
import Data.UUID.V4
import qualified Graphics.Rendering.Cairo as Cairo
-- from hoodle-platform
import Data.Hoodle.Generic
import Data.Hoodle.Select
import Data.Hoodle.Simple (Dimension(..))
import Data.Hoodle.Zipper
import Graphics.Hoodle.Render
-- import Graphics.Hoodle.Render.Background
import Graphics.Hoodle.Render.Type
-- from this package
import Hoodle.Accessor
Expand All @@ -48,7 +43,6 @@ import Hoodle.ModelAction.Page
import Hoodle.Type.Alias
import Hoodle.Type.Coroutine
import Hoodle.Type.Canvas
import Hoodle.Type.Event
import Hoodle.Type.PageArrangement
import Hoodle.Type.HoodleState
import Hoodle.Type.Enum
Expand Down Expand Up @@ -332,21 +326,19 @@ newPageFromOld pg = do

updatePageCache :: CanvasGeometry -> (PageNum, Page EditMode) -> Renderer ()
updatePageCache geometry (pnum,page) = do
let dim@(Dim w h) = page ^. gdimension
let Dim w h = page ^. gdimension
CvsCoord (x0,y0) =
(desktop2Canvas geometry . page2Desktop geometry) (pnum,PageCoord (0,0))
CvsCoord (x1,y1) =
(desktop2Canvas geometry . page2Desktop geometry) (pnum,PageCoord (w,h))
s = (x1-x0) / w
updateBkgCache (Dim w h) (Dim (x1-x0) (y1-y0)) (page ^. gbackground)
mapM_ (updateLayerCache (Dim w h) (Dim (x1-x0) (y1-y0))) (F.toList (page ^. glayers))


updateBkgCache :: Dimension -> Dimension -> RBackground -> Renderer ()
updateBkgCache dimo dimv rbkg = do
RendererState handler qpdf qgen _ <- ask
let bkg = rbkg2Bkg rbkg
sfcid = rbkg_surfaceid rbkg
RendererState _handler qpdf qgen _ <- ask
let sfcid = rbkg_surfaceid rbkg
case rbkg of
RBkgSmpl {..} -> do
cmdid <- issueGenCommandID
Expand Down
Loading

0 comments on commit 490b15f

Please sign in to comment.