GtkTV 0.1.8 → 0.1.9
raw patch · 3 files changed
+42/−31 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- GtkTV.cabal +1/−1
- src/Interface/TV/Gtk.hs +23/−17
- src/Interface/TV/Gtk2.hs +18/−13
GtkTV.cabal view
@@ -1,5 +1,5 @@ Name: GtkTV-Version: 0.1.8+Version: 0.1.9 Cabal-Version: >= 1.2 Synopsis: Gtk-based GUIs for Tangible Values Category: User Interfaces
src/Interface/TV/Gtk.hs view
@@ -34,6 +34,7 @@ import Data.Time (getCurrentTime,utctDayTime) import Graphics.UI.Gtk hiding (Action)+import qualified Graphics.UI.Gtk as Gtk import Graphics.UI.Gtk.OpenGL import qualified Graphics.Rendering.OpenGL as G import Graphics.Rendering.OpenGL hiding (Sink,get)@@ -120,6 +121,11 @@ type MkO' a = IO (Widget, Sink a, Action) +-- For temporary use, since OpenGL added a 'set' between 2.2.3.0 and 2.4.0.1+gset :: o -> [AttrOp o] -> IO ()+gset = Gtk.set++ {-------------------------------------------------------------------- Instances --------------------------------------------------------------------}@@ -169,7 +175,7 @@ do box <- boxNew Horizontal False 10 (wa,geta,cleana) <- ia refresh (wb,getb,cleanb) <- ib refresh- set box [ containerChild := wa , containerChild := wb ]+ gset box [ containerChild := wa , containerChild := wb ] return (toWidget box, liftA2 (,) geta getb, cleana >> cleanb) instance Pair MkO where@@ -177,25 +183,25 @@ do box <- boxNew Horizontal False 10 (wa,snka,cleana) <- oa (wb,snkb,cleanb) <- ob- set box [ containerChild := wa , containerChild := wb ]+ gset box [ containerChild := wa , containerChild := wb ] return (toWidget box, snka >+> snkb, cleana >> cleanb) instance Title_f MkI where title_f str = inMkI $ \ ia -> \ refresh -> do (widget,geta,cleana) <- ia refresh frame <- frameNew- set frame [ frameLabel := str- -- , frameShadowType := ShadowEtchedOut- , containerChild := widget ]+ gset frame [ frameLabel := str+ -- , frameShadowType := ShadowEtchedOut+ , containerChild := widget ] return (toWidget frame, geta, cleana) instance Title_f MkO where title_f str = inMkO $ \ oa -> do (widget,sink,clean) <- oa frame <- frameNew- set frame [ frameLabel := str- -- , frameShadowType := ShadowEtchedOut- , containerChild := widget ]+ gset frame [ frameLabel := str+ -- , frameShadowType := ShadowEtchedOut+ , containerChild := widget ] return (toWidget frame, sink, clean) instance Lambda MkI MkO where@@ -205,7 +211,7 @@ rec let refresh = readIORef reff <*> geta >>= snkb (wa,geta,cleana) <- ia refresh (wb,snkb,cleanb) <- ob- -- set box [ containerChild := wa , containerChild := wb ]+ -- gset box [ containerChild := wa , containerChild := wb ] -- Hack: stretch output but not input. Really I want to choose -- per widget and propagate upward. boxPackStart box wa PackNatural 0@@ -230,13 +236,13 @@ forget $ initGUI (wid,sink,cleanup) <- mko' window <- windowNew- set window [ windowDefaultWidth := 200- -- , windowDefaultHeight := 200- -- , containerBorderWidth := 10- , containerChild := wid- -- , windowFocusOnMap := True -- helpful?- , windowTitle := name- ]+ gset window [ windowDefaultWidth := 200+ -- , windowDefaultHeight := 200+ -- , containerBorderWidth := 10+ , containerChild := wid+ -- , windowFocusOnMap := True -- helpful?+ , windowTitle := name+ ] forget $ onDestroy window (cleanup >> mainQuit) widgetShowAll window -- Initial sink. Must come after show-all for the GLDrawingArea.@@ -307,7 +313,7 @@ (lo,hi) a0 = primMkI $ \ refresh -> do oldRef <- newIORef a0 w <- hScaleNewWithRange (toD lo) (toD hi) (toD step)- set w [ rangeValue := toD a0, scaleDigits := digits ]+ gset w [ rangeValue := toD a0, scaleDigits := digits ] let getter = fromD <$> get w rangeValue changeTo new = do old <- readIORef oldRef
src/Interface/TV/Gtk2.hs view
@@ -34,9 +34,11 @@ import Data.Time (getCurrentTime,utctDayTime) import Graphics.UI.Gtk hiding (Action)+import qualified Graphics.UI.Gtk as Gtk import Graphics.UI.Gtk.OpenGL import qualified Graphics.Rendering.OpenGL as G import Graphics.Rendering.OpenGL hiding (Sink,get)+-- import Graphics.Rendering.OpenGL (depthFunc,($=),Less,clear,DepthBuffer,ColorBuffer,finish,GLsizei,viewport,Position,Size,GLfloat,TextureObject,deleteObjectNames) -- For textures import Data.Bitmap.OpenGL import Codec.Image.STB@@ -215,11 +217,14 @@ do w <- checkButtonNew return (toWidget w, toggleButtonSetActive w, return ()) +-- For temporary use, since OpenGL added a 'set' between 2.2.3.0 and 2.4.0.1+gset :: o -> [AttrOp o] -> IO ()+gset = Gtk.set boxed :: Orient -> Widget -> Widget -> IO Widget boxed o wa wb = do box <- boxNew o False 10- set box [ containerChild := wa , containerChild := wb ]+ gset box [ containerChild := wa , containerChild := wb ] return (toWidget box) hboxed :: Widget -> Widget -> IO Widget@@ -251,7 +256,7 @@ title_f str = inMkI $ \ ia -> do (widget,geta,cleana,installa) <- ia frame <- frameNew- set frame [ frameLabel := str+ gset frame [ frameLabel := str -- , frameShadowType := ShadowEtchedOut , containerChild := widget ] return (toWidget frame, geta, cleana, installa)@@ -260,9 +265,9 @@ title_f str = inMkO $ \ oa -> do (widget,sink,clean) <- oa frame <- frameNew- set frame [ frameLabel := str- -- , frameShadowType := ShadowEtchedOut- , containerChild := widget ]+ gset frame [ frameLabel := str+ -- , frameShadowType := ShadowEtchedOut+ , containerChild := widget ] return (toWidget frame, sink, clean) instance Lambda MkI MkO where@@ -298,13 +303,13 @@ forget initGUI (wid,sink,cleanup) <- mko' window <- windowNew- set window [ windowDefaultWidth := 200- -- , windowDefaultHeight := 200- -- , containerBorderWidth := 10- , containerChild := wid- -- , windowFocusOnMap := True -- helpful?- , windowTitle := name- ]+ gset window [ windowDefaultWidth := 200+ -- , windowDefaultHeight := 200+ -- , containerBorderWidth := 10+ , containerChild := wid+ -- , windowFocusOnMap := True -- helpful?+ , windowTitle := name+ ] forget $ onDestroy window (cleanup >> mainQuit) widgetShowAll window -- Initial sink. Must come after show-all for the GLDrawingArea.@@ -376,7 +381,7 @@ (lo,hi) a0 = primMkI $ do oldRef <- newIORef a0 w <- hScaleNewWithRange (toD lo) (toD hi) (toD step)- set w [ rangeValue := toD a0, scaleDigits := digits ]+ gset w [ rangeValue := toD a0, scaleDigits := digits ] let getter = fromD <$> get w rangeValue install refresh = forget2 afterRangeChangeValue w (\ _ x -> changeTo (fromD x) >> return False)