Skip to content

Commit

Permalink
Separate UnitHoodle from HoodleState. starting implementing multitab …
Browse files Browse the repository at this point in the history
…hoodle
  • Loading branch information
wavewave committed Oct 16, 2014
1 parent b58933c commit afbd04b
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 136 deletions.
2 changes: 1 addition & 1 deletion hoodle-core/hoodle-core.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: hoodle-core
Version: 0.14.0
Version: 0.14.999
Synopsis: Core library for hoodle
Description: Hoodle is a pen notetaking program written in haskell.
hoodle-core is the core library written in haskell and
Expand Down
8 changes: 0 additions & 8 deletions hoodle-core/src/Hoodle/Coroutine/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ initCoroutine devlst window {- notebook -}
(st4,wconf') <- eventConnect st3 (view frameState st3)
notebook <- Gtk.notebookNew
statusbar <- Gtk.statusbarNew


let st5 = set (settings.doesUseXInput) xinputbool
. set hookSet mhook
. set undoTable (emptyUndo maxundo)
Expand All @@ -145,23 +143,17 @@ initCoroutine devlst window {- notebook -}
. set (hoodleFileControl.hoodleFileName) Nothing
. set statusBar (Just statusbar)
$ st4

vbox <- Gtk.vBoxNew False 0
Gtk.containerAdd window vbox
--
vboxcvs <- Gtk.vBoxNew False 0
Gtk.notebookAppendPage notebook vboxcvs ("untitled" :: T.Text)

Gtk.containerAdd vboxcvs (view rootWindow st5)


let startingXstate = set rootContainer (Gtk.castToBox vboxcvs) st5
let startworld = world startingXstate . ReaderT $
(\(Arg DoEvent ev) -> guiProcess ev)
putMVar evar . Just $ (driver simplelogger startworld)
return (evar,startingXstate,ui,vbox)


-- | initialization according to the setting
initialize :: AllEvent -> MainCoroutine ()
initialize ev = do
Expand Down
2 changes: 1 addition & 1 deletion hoodle-core/src/Hoodle/Coroutine/Window.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ eitherSplit stype = do
Right fstate' -> do
cinfobox <- maybeError "eitherSplit" . M.lookup currcid $ cmap
let rtwin = view rootWindow xstate
rtnbk = view rootNotebook xstate
-- rtnbk = view rootNotebook xstate
rtcntr = view rootContainer xstate
rtrwin = view rootOfRootWindow xstate
liftIO $ containerRemove rtcntr rtwin
Expand Down
20 changes: 11 additions & 9 deletions hoodle-core/src/Hoodle/GUI.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}

-----------------------------------------------------------------------------
Expand All @@ -16,14 +17,14 @@ module Hoodle.GUI where

import Control.Concurrent (threadDelay, forkIO)
import Control.Exception (SomeException(..),catch)
import Control.Lens (view)
import Control.Lens
import Control.Monad hiding (mapM_,forM_)
import Control.Monad.Trans
import Data.Foldable (mapM_,forM_)
import qualified Data.IntMap as M
import Data.IORef
import Data.Maybe
import Graphics.UI.Gtk hiding (get,set)
import Graphics.UI.Gtk hiding (get,set,Settings)
import System.Directory
import System.Environment
import System.FilePath
Expand Down Expand Up @@ -56,15 +57,16 @@ startGUI mfname mhook = do
(usepz,uselyr) <- getWidgetConfig cfg
(tref,st0,ui,vbox) <- initCoroutine devlst window
mhook maxundo (xinputbool,usepz,uselyr)


setTitleFromFileName st0
-- need for refactoring
lensSetToggleUIForFlag "UXINPUTA" (settings.doesUseXInput) st0
lensSetToggleUIForFlag "HANDA" (settings.doesUseTouch) st0
lensSetToggleUIForFlag "POPMENUA" (settings.doesUsePopUpMenu) st0
lensSetToggleUIForFlag "EBDIMGA" (settings.doesEmbedImage) st0
lensSetToggleUIForFlag "EBDPDFA" (settings.doesEmbedPDF) st0

mapM_ (\(x,y :: Simple Lens Settings Bool) -> lensSetToggleUIForFlag x (settings.y) st0 )
[ ("UXINPUTA", doesUseXInput)
, ("HANDA" , doesUseTouch)
, ("POPMENUA", doesUsePopUpMenu)
, ("EBDIMGA" , doesEmbedImage)
, ("EBDPDFA" , doesEmbedPDF)
]
setToggleUIForFlag "TOGGLENETSRCA" False st0
--
let canvases = map (getDrawAreaFromBox) . M.elems . getCanvasInfoMap $ st0
Expand Down
Loading

0 comments on commit afbd04b

Please sign in to comment.