packages feed

INblobs-0.1.1: src/StateUtil.hs

module StateUtil
    ( repaintAll
    , getNetworkName
    ) where

import State
import Common
import qualified PersistentDocument as PD

import Data.Maybe
import Graphics.UI.WX

repaintAll :: State g n e -> IO ()
repaintAll state =
  do{ canvas    <- getCanvas state
    ; canvasLHS <- getLHSCanvas state
    ; canvasRHS <- getRHSCanvas state
    ; Graphics.UI.WX.repaint canvas
    ; Graphics.UI.WX.repaint canvasLHS
    ; Graphics.UI.WX.repaint canvasRHS
    }

getNetworkName :: State g n e -> IO String
getNetworkName state =
 do { pDoc <- getDocument state
    ; mFilename <- PD.getFileName pDoc
    ; case mFilename of
        Just filename -> return $ removeExtension filename
        Nothing       -> return "Untitled"
    }