hscurses 1.4.1.1 → 1.4.1.2
raw patch · 5 files changed
+80/−25 lines, 5 filesdep ~unixPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: unix
API changes (from Hackage documentation)
- UI.HSCurses.Curses: cKEY_UP, cKEY_RIGHT, cKEY_LEFT, cKEY_DOWN :: ChType
- UI.HSCurses.Curses: defaultBackground, defaultForeground :: Color
- UI.HSCurses.Curses: isAltCharset, isVertical, isUnderline, isTop, isStandout, isRight, isReverse, isProtect, isLow, isLeft, isInvis, isHorizontal, isDim, isBold, isBlink :: Attr -> Bool
- UI.HSCurses.Curses: setAltCharset, setVertical, setUnderline, setTop, setStandout, setRight, setReverse, setProtect, setLow, setLeft, setInvis, setHorizontal, setDim, setBold, setBlink :: Attr -> Bool -> Attr
- UI.HSCurses.Curses: ulCorner, sterling, nEqual, pi, gEqual, lEqual, s7, s3, block, lantern, board, uArrow, dArrow, rArrow, lArrow, bullet, plMinus, degree, ckBoard, diamond, s9, s1, plus, vLine, hLine, tTee, bTee, lTee, rTee, lrCorner, urCorner, llCorner :: Char
- UI.HSCurses.CursesHelper: black, white, cyan, magenta, blue, yellow, green, red :: Color
- UI.HSCurses.MonadException: blockState, unblockState :: MonadExc m => StateT s m a -> StateT s m a
+ UI.HSCurses.Curses: Border :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Border
+ UI.HSCurses.Curses: bTee :: Char
+ UI.HSCurses.Curses: bl :: Border -> Char
+ UI.HSCurses.Curses: block :: Char
+ UI.HSCurses.Curses: board :: Char
+ UI.HSCurses.Curses: br :: Border -> Char
+ UI.HSCurses.Curses: bs :: Border -> Char
+ UI.HSCurses.Curses: bullet :: Char
+ UI.HSCurses.Curses: cKEY_DOWN :: ChType
+ UI.HSCurses.Curses: cKEY_LEFT :: ChType
+ UI.HSCurses.Curses: cKEY_RIGHT :: ChType
+ UI.HSCurses.Curses: cKEY_UP :: ChType
+ UI.HSCurses.Curses: ckBoard :: Char
+ UI.HSCurses.Curses: dArrow :: Char
+ UI.HSCurses.Curses: data Border
+ UI.HSCurses.Curses: defaultBackground :: Color
+ UI.HSCurses.Curses: defaultBorder :: Border
+ UI.HSCurses.Curses: defaultForeground :: Color
+ UI.HSCurses.Curses: degree :: Char
+ UI.HSCurses.Curses: diamond :: Char
+ UI.HSCurses.Curses: gEqual :: Char
+ UI.HSCurses.Curses: hLine :: Char
+ UI.HSCurses.Curses: isAltCharset :: Attr -> Bool
+ UI.HSCurses.Curses: isBlink :: Attr -> Bool
+ UI.HSCurses.Curses: isBold :: Attr -> Bool
+ UI.HSCurses.Curses: isDim :: Attr -> Bool
+ UI.HSCurses.Curses: isHorizontal :: Attr -> Bool
+ UI.HSCurses.Curses: isInvis :: Attr -> Bool
+ UI.HSCurses.Curses: isLeft :: Attr -> Bool
+ UI.HSCurses.Curses: isLow :: Attr -> Bool
+ UI.HSCurses.Curses: isProtect :: Attr -> Bool
+ UI.HSCurses.Curses: isReverse :: Attr -> Bool
+ UI.HSCurses.Curses: isRight :: Attr -> Bool
+ UI.HSCurses.Curses: isStandout :: Attr -> Bool
+ UI.HSCurses.Curses: isTop :: Attr -> Bool
+ UI.HSCurses.Curses: isUnderline :: Attr -> Bool
+ UI.HSCurses.Curses: isVertical :: Attr -> Bool
+ UI.HSCurses.Curses: lArrow :: Char
+ UI.HSCurses.Curses: lEqual :: Char
+ UI.HSCurses.Curses: lTee :: Char
+ UI.HSCurses.Curses: lantern :: Char
+ UI.HSCurses.Curses: llCorner :: Char
+ UI.HSCurses.Curses: lrCorner :: Char
+ UI.HSCurses.Curses: ls :: Border -> Char
+ UI.HSCurses.Curses: nEqual :: Char
+ UI.HSCurses.Curses: pi :: Char
+ UI.HSCurses.Curses: plMinus :: Char
+ UI.HSCurses.Curses: plus :: Char
+ UI.HSCurses.Curses: rArrow :: Char
+ UI.HSCurses.Curses: rTee :: Char
+ UI.HSCurses.Curses: rs :: Border -> Char
+ UI.HSCurses.Curses: s1 :: Char
+ UI.HSCurses.Curses: s3 :: Char
+ UI.HSCurses.Curses: s7 :: Char
+ UI.HSCurses.Curses: s9 :: Char
+ UI.HSCurses.Curses: setAltCharset :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setBlink :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setBold :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setDim :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setHorizontal :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setInvis :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setLeft :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setLow :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setProtect :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setReverse :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setRight :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setStandout :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setTop :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setUnderline :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: setVertical :: Attr -> Bool -> Attr
+ UI.HSCurses.Curses: sterling :: Char
+ UI.HSCurses.Curses: tTee :: Char
+ UI.HSCurses.Curses: tl :: Border -> Char
+ UI.HSCurses.Curses: tr :: Border -> Char
+ UI.HSCurses.Curses: ts :: Border -> Char
+ UI.HSCurses.Curses: uArrow :: Char
+ UI.HSCurses.Curses: ulCorner :: Char
+ UI.HSCurses.Curses: urCorner :: Char
+ UI.HSCurses.Curses: vLine :: Char
+ UI.HSCurses.Curses: wBorder :: Window -> Border -> IO ()
+ UI.HSCurses.Curses: wRefresh :: Window -> IO ()
+ UI.HSCurses.CursesHelper: black :: Color
+ UI.HSCurses.CursesHelper: blue :: Color
+ UI.HSCurses.CursesHelper: cyan :: Color
+ UI.HSCurses.CursesHelper: green :: Color
+ UI.HSCurses.CursesHelper: magenta :: Color
+ UI.HSCurses.CursesHelper: red :: Color
+ UI.HSCurses.CursesHelper: wResetStyle :: Window -> IO ()
+ UI.HSCurses.CursesHelper: wSetStyle :: Window -> CursesStyle -> IO ()
+ UI.HSCurses.CursesHelper: wWithStyle :: MonadExcIO m => Window -> CursesStyle -> m a -> m a
+ UI.HSCurses.CursesHelper: white :: Color
+ UI.HSCurses.CursesHelper: yellow :: Color
+ UI.HSCurses.MonadException: blockState :: MonadExc m => StateT s m a -> StateT s m a
+ UI.HSCurses.MonadException: unblockState :: MonadExc m => StateT s m a -> StateT s m a
Files
- UI/HSCurses/Curses.hsc +49/−4
- UI/HSCurses/CursesHelper.hs +21/−14
- UI/HSCurses/IConv.hsc +3/−2
- UI/HSCurses/MonadException.hs +3/−1
- hscurses.cabal +4/−4
UI/HSCurses/Curses.hsc view
@@ -50,9 +50,11 @@ -- * Windows and Pads Window, -- data Window deriving Eq+ Border(..), -- data Border touchWin,- newPad, pRefresh, delWin, newWin,+ newPad, pRefresh, delWin, newWin, wRefresh, wBorder, defaultBorder, + -- * Refresh Routines refresh, -- :: IO () update,@@ -191,12 +193,13 @@ import Data.List import Data.Ix ( Ix ) -import Control.Monad ( when, liftM )+import System.IO.Unsafe ( unsafePerformIO )++import Control.Monad ( when, liftM, void ) import Control.Monad.Trans import Control.Concurrent-import Control.Concurrent.Chan -import Foreign+import Foreign hiding ( unsafePerformIO, void ) import Foreign.C.String import Foreign.C.Types import Foreign.C.Error@@ -470,6 +473,16 @@ refresh_c :: IO CInt --+-- | wRefresh refreshes the specified window, copying the data+-- | from the virtual screen to the physical screen.+--+wRefresh :: Window -> IO ()+wRefresh w = throwIfErr_ "wrefresh" $ wrefresh_c w++foreign import ccall unsafe "HSCurses.h wrefresh"+ wrefresh_c :: Window -> IO CInt++-- -- | Do an actual update. Used after endWin on linux to restore the terminal -- update :: IO ()@@ -1005,6 +1018,35 @@ delWin :: Window -> IO () delWin w = throwIfErr_ "delwin" $ delwin w +data Border = Border {+ ls :: Char+ , rs :: Char+ , ts :: Char+ , bs :: Char+ , tl :: Char+ , tr :: Char+ , bl :: Char+ , br :: Char+}++defaultBorder :: Border+defaultBorder = Border '\0' '\0' '\0' '\0' '\0' '\0' '\0' '\0'++--+-- | > Draw a border around the edges of a window. defaultBorder is+-- > a record representing all 0 parameters to wrecord.+--+wBorder :: Window -> Border -> IO ()+wBorder w (Border ls rs ts bs tl tr bl br) = throwIfErr_ "wborder" $+ wborder w ls' rs' ts' bs' tl' tr' bl' br'+ where ls' = castCharToCChar ls+ rs' = castCharToCChar rs+ ts' = castCharToCChar ts+ bs' = castCharToCChar bs+ tl' = castCharToCChar tl+ tr' = castCharToCChar tr+ bl' = castCharToCChar bl+ br' = castCharToCChar br foreign import ccall unsafe prefresh :: Window -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> IO CInt @@ -1013,6 +1055,9 @@ foreign import ccall unsafe delwin :: Window -> IO CInt++foreign import ccall unsafe+ wborder :: Window -> CChar -> CChar -> CChar -> CChar -> CChar -> CChar -> CChar -> CChar -> IO CInt newWin :: Int -> Int -> Int -> Int -> IO Window newWin nlines ncolumn begin_y begin_x = throwIfNull "newwin" $
UI/HSCurses/CursesHelper.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-}-{-# OPTIONS -#include HSCursesUtils.h -#include <signal.h> #-} -- -- Copyright (C) 2005-2011 Stefan Wehr@@ -52,8 +51,8 @@ -- * Style Style(..), CursesStyle, mkCursesStyle, changeCursesStyle,- setStyle, resetStyle, convertStyles,- defaultStyle, defaultCursesStyle, withStyle,+ setStyle, wSetStyle, resetStyle, wResetStyle, convertStyles,+ defaultStyle, defaultCursesStyle, withStyle, wWithStyle, -- * Keys displayKey,@@ -69,7 +68,6 @@ import Data.Char import Data.Maybe-import Data.List import Control.Monad.Trans #ifndef mingw32_HOST_OS@@ -382,25 +380,34 @@ -- | Reset the screen to normal values -- resetStyle :: IO ()-resetStyle = setStyle defaultCursesStyle+resetStyle = wResetStyle Curses.stdScr +wResetStyle :: Curses.Window -> IO ()+wResetStyle = flip wSetStyle defaultCursesStyle+ -- -- | Manipulate the current style of the standard screen -- setStyle :: CursesStyle -> IO ()-setStyle (CursesStyle a p) = Curses.wAttrSet Curses.stdScr (a, p)-setStyle (ColorlessCursesStyle a) =- do (_, p) <- Curses.wAttrGet Curses.stdScr- Curses.wAttrSet Curses.stdScr (a, p)+setStyle = wSetStyle Curses.stdScr +wSetStyle :: Curses.Window -> CursesStyle -> IO ()+wSetStyle window (CursesStyle a p) = Curses.wAttrSet window (a, p)+wSetStyle window (ColorlessCursesStyle a) =+ do (_, p) <- Curses.wAttrGet window+ Curses.wAttrSet window (a, p)+ withStyle :: MonadExcIO m => CursesStyle -> m a -> m a-withStyle style action =+withStyle = wWithStyle Curses.stdScr++wWithStyle :: MonadExcIO m => Curses.Window -> CursesStyle -> m a -> m a+wWithStyle window style action = bracketM- (liftIO $ do old <- Curses.wAttrGet Curses.stdScr -- before- setStyle style+ (liftIO $ do old <- Curses.wAttrGet window -- before+ wSetStyle window style return old)- (\old -> liftIO $ Curses.wAttrSet Curses.stdScr old) -- after- (\_ -> action) -- do this+ (\old -> liftIO $ Curses.wAttrSet window old) -- after+ (\_ -> action) -- do this -- -- | Converts a list of human-readable styles into the corresponding
UI/HSCurses/IConv.hsc view
@@ -39,9 +39,10 @@ import UI.HSCurses.CWString ( peekUTF8StringLen, withUTF8StringLen ) -import Foreign+import System.IO.Unsafe ( unsafePerformIO )++import Foreign hiding ( unsafePerformIO ) import Foreign.C-import Foreign.C.String import Control.Exception ( Exception, try, bracket ) type IConv = Ptr () --(#type iconv_t)
UI/HSCurses/MonadException.hs view
@@ -17,10 +17,12 @@ module UI.HSCurses.MonadException where +#if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch)+#endif+ import Control.Exception import Control.Monad.State-import Data.Dynamic class Monad m => MonadExc m where catchM :: Exception e => m a -> (e -> m a) -> m a
hscurses.cabal view
@@ -1,5 +1,5 @@ Name: hscurses-Version: 1.4.1.1+Version: 1.4.1.2 License: LGPL License-file: LICENSE Author: John Meacham <john at repetae dot net>@@ -22,7 +22,7 @@ Homepage: https://github.com/skogsbaer/hscurses Cabal-version: >= 1.6 Build-Type: Configure-Tested-with: GHC==6.12.1, GHC==7.0.1, GHC==7.2.1+Tested-with: GHC==7.0.4, GHC==7.2.1, GHC==7.4.2, GHC==7.6.1 Data-files: README, TODO, ChangeLog, example/contacts2, example/Setup.hs, example/ContactManager.hs,@@ -38,7 +38,7 @@ Build-depends: base == 4.*, mtl, old-time < 1.2, old-locale == 1.0.* if !os(windows)- Build-depends: unix >= 2.4 && < 2.6+ Build-depends: unix >= 2.4 && < 2.7 Exposed-modules: UI.HSCurses.Curses, UI.HSCurses.CursesHelper, UI.HSCurses.Widgets, UI.HSCurses.MonadException, UI.HSCurses.Logging@@ -52,4 +52,4 @@ CPP, ForeignFunctionInterface, GeneralizedNewtypeDeriving, ScopedTypeVariables, ExistentialQuantification Include-dirs: cbits .- Ghc-options: -funbox-strict-fields -Wall+ Ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing