/ src /
src/StateUtil.hs
1 module StateUtil
2 ( repaintAll
3 , getNetworkName
4 ) where
5
6 import State
7 import Common
8 import qualified PersistentDocument as PD
9
10 import Data.Maybe
11 import Graphics.UI.WX
12
13 repaintAll :: State g n e -> IO ()
14 repaintAll state =
15 do{ canvas <- getCanvas state
16 ; canvasLHS <- getLHSCanvas state
17 ; canvasRHS <- getRHSCanvas state
18 ; Graphics.UI.WX.repaint canvas
19 ; Graphics.UI.WX.repaint canvasLHS
20 ; Graphics.UI.WX.repaint canvasRHS
21 }
22
23 getNetworkName :: State g n e -> IO String
24 getNetworkName state =
25 do { pDoc <- getDocument state
26 ; mFilename <- PD.getFileName pDoc
27 ; case mFilename of
28 Just filename -> return $ removeExtension filename
29 Nothing -> return "Untitled"
30 }