cairo 0.11.1 → 0.12.0
raw patch · 6 files changed
+75/−47 lines, 6 filessetup-changednew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.Rendering.Cairo: OperatorColorBurn :: Operator
+ Graphics.Rendering.Cairo: OperatorColorDodge :: Operator
+ Graphics.Rendering.Cairo: OperatorDarken :: Operator
+ Graphics.Rendering.Cairo: OperatorDifference :: Operator
+ Graphics.Rendering.Cairo: OperatorExclusion :: Operator
+ Graphics.Rendering.Cairo: OperatorHardLight :: Operator
+ Graphics.Rendering.Cairo: OperatorHslColor :: Operator
+ Graphics.Rendering.Cairo: OperatorHslHue :: Operator
+ Graphics.Rendering.Cairo: OperatorHslLuminosity :: Operator
+ Graphics.Rendering.Cairo: OperatorHslSaturation :: Operator
+ Graphics.Rendering.Cairo: OperatorLighten :: Operator
+ Graphics.Rendering.Cairo: OperatorMultiply :: Operator
+ Graphics.Rendering.Cairo: OperatorOverlay :: Operator
+ Graphics.Rendering.Cairo: OperatorScreen :: Operator
+ Graphics.Rendering.Cairo: OperatorSoftLight :: Operator
+ Graphics.Rendering.Cairo: StatusDeviceError :: Status
+ Graphics.Rendering.Cairo: StatusDeviceTypeMismatch :: Status
+ Graphics.Rendering.Cairo: StatusInvalidSize :: Status
+ Graphics.Rendering.Cairo: StatusLastStatus :: Status
+ Graphics.Rendering.Cairo: StatusUserFontNotImplemented :: Status
Files
- Gtk2HsSetup.hs +44/−19
- Setup.hs +5/−2
- cairo.cabal +1/−1
- demo/Clock.hs +22/−22
- demo/Drawing.hs +2/−2
- demo/StarAndRing.hs +1/−1
Gtk2HsSetup.hs view
@@ -23,16 +23,24 @@ CABAL_VERSION_MICRO) #else #warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)+#if (__GLASGOW_HASKELL__ >= 700)+#define CABAL_VERSION CABAL_VERSION_ENCODE(1,10,0)+#else #if (__GLASGOW_HASKELL__ >= 612) #define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0) #else #define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0) #endif #endif+#endif -- | Build a Gtk2hs package. ---module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages ) where+module Gtk2HsSetup ( + gtk2hsUserHooks, + getPkgConfigPackages, + checkGtk2hsBuildtools+ ) where import Distribution.Simple import Distribution.Simple.PreProcess@@ -65,7 +73,7 @@ import Distribution.Simple.Compiler ( Compiler(..) ) import Distribution.Simple.Program ( Program(..), ConfiguredProgram(..),- rawSystemProgramConf, rawSystemProgramStdoutConf,+ rawSystemProgramConf, rawSystemProgramStdoutConf, programName, c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram, simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg) import Distribution.ModuleName ( ModuleName, components, toFilePath )@@ -83,10 +91,11 @@ #endif import Distribution.Text ( simpleParse, display ) import System.FilePath-import System.Directory ( doesFileExist )+import System.Exit (exitFailure)+import System.Directory ( doesFileExist, getDirectoryContents, doesDirectoryExist ) import Distribution.Version (Version(..)) import Distribution.Verbosity-import Control.Monad (when, unless, filterM)+import Control.Monad (when, unless, filterM, liftM, forM, forM_) import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList ) import Data.List (isPrefixOf, isSuffixOf, nub) import Data.Char (isAlpha)@@ -94,7 +103,6 @@ import qualified Data.Set as S import Control.Applicative ((<$>))-import System.Directory (getDirectoryContents, doesDirectoryExist) -- the name of the c2hs pre-compiled header file precompFile = "precompchs.bin"@@ -103,13 +111,13 @@ hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal], hookedPreProcessors = [("chs", ourC2hs)], confHook = \pd cf ->- confHook simpleUserHooks pd cf >>= return . adjustLocalBuildInfo,+ (fmap adjustLocalBuildInfo (confHook simpleUserHooks pd cf)), postConf = \args cf pd lbi -> do genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi postConf simpleUserHooks args cf pd lbi, buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->- (buildHook simpleUserHooks) pd lbi uh bf,- copyHook = \pd lbi uh flags -> (copyHook simpleUserHooks) pd lbi uh flags >>+ buildHook simpleUserHooks pd lbi uh bf,+ copyHook = \pd lbi uh flags -> copyHook simpleUserHooks pd lbi uh flags >> installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)), instHook = \pd lbi uh flags -> #if defined(mingw32_HOST_OS) || defined(__MINGW32__)@@ -187,7 +195,11 @@ _ | modeGenerateRegFile -> die "Generate Reg File not supported" | modeGenerateRegScript -> die "Generate Reg Script not supported" | otherwise -> registerPackage verbosity+#if CABAL_VERSION_CHECK(1,10,0)+ installedPkgInfo pkg lbi inplace [packageDb]+#else installedPkgInfo pkg lbi inplace packageDb+#endif where modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))@@ -298,7 +310,7 @@ getCppOptions bi lbi = nub $ ["-I" ++ dir | dir <- PD.includeDirs bi]- ++ [opt | opt@('-':c:_) <- (PD.cppOptions bi ++ PD.ccOptions bi), c `elem` "DIU"]+ ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"] installCHI :: PackageDescription -- ^information from the .cabal file -> LocalBuildInfo -- ^information from the configure step@@ -308,14 +320,13 @@ let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest -- cannot use the recommended 'findModuleFiles' since it fails if there exists -- a modules that does not have a .chi file- mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi])- (map toFilePath+ mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath) #if CABAL_VERSION_CHECK(1,8,0) (PD.libModules lib) #else (PD.libModules pkg) #endif- )+ let files = [ f | Just f <- mFiles ] #if CABAL_VERSION_CHECK(1,8,0) installOrdinaryFiles verbosity libPref files@@ -331,13 +342,13 @@ ------------------------------------------------------------------------------ typeGenProgram :: Program-typeGenProgram = (simpleProgram "gtk2hsTypeGen")+typeGenProgram = simpleProgram "gtk2hsTypeGen" signalGenProgram :: Program-signalGenProgram = (simpleProgram "gtk2hsHookGenerator")+signalGenProgram = simpleProgram "gtk2hsHookGenerator" c2hsLocal :: Program-c2hsLocal = (simpleProgram "gtk2hsC2hs")+c2hsLocal = simpleProgram "gtk2hsC2hs" genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () genSynthezisedFiles verb pd lbi = do@@ -370,7 +381,7 @@ res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args rewriteFile outFile res - (flip mapM_) (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $+ forM_ (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $ \(fileTag, f) -> do let tag = reverse (drop 4 (reverse fileTag)) info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")@@ -391,7 +402,7 @@ sequence [ do version <- pkgconfig ["--modversion", display pkgname] case simpleParse version of- Nothing -> die $ "parsing output of pkg-config --modversion failed"+ Nothing -> die "parsing output of pkg-config --modversion failed" Just v -> return (PackageIdentifier pkgname v) | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ] where@@ -456,9 +467,9 @@ extractDeps :: ModDep -> IO ModDep extractDeps md@ModDep { mdLocation = Nothing } = return md extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do- let findImports acc (('{':'#':xs):xxs) = case (dropWhile ((==) ' ') xs) of+ let findImports acc (('{':'#':xs):xxs) = case (dropWhile (' ' ==) xs) of ('i':'m':'p':'o':'r':'t':' ':ys) ->- case simpleParse (takeWhile ((/=) '#') ys) of+ case simpleParse (takeWhile ('#' /=) ys) of Just m -> findImports (m:acc) xxs Nothing -> die ("cannot parse chs import in "++f++":\n"++ "offending line is {#"++xs)@@ -484,3 +495,17 @@ Just md -> (md:out', visited') where (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)++-- Check user whether install gtk2hs-buildtools correctly.+checkGtk2hsBuildtools :: [String] -> IO ()+checkGtk2hsBuildtools programs = do+ programInfos <- mapM (\ name -> do+ location <- programFindLocation (simpleProgram name) normal+ return (name, location)+ ) programs+ let printError name = do+ putStrLn $ "Cannot find " ++ name ++ "\n" + ++ "Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin)."+ exitFailure+ forM_ programInfos $ \ (name, location) ->+ when (isNothing location) (printError name)
Setup.hs view
@@ -1,7 +1,10 @@ -- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module, -- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept -- identical across all modules.-import Gtk2HsSetup ( gtk2hsUserHooks )+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools ) import Distribution.Simple ( defaultMainWithHooks ) -main = defaultMainWithHooks gtk2hsUserHooks+main = do+ checkGtk2hsBuildtools ["gtk2hsC2hs"]+ defaultMainWithHooks gtk2hsUserHooks+
cairo.cabal view
@@ -1,5 +1,5 @@ Name: cairo-Version: 0.11.1+Version: 0.12.0 License: BSD3 License-file: COPYRIGHT Copyright: (c) 2001-2010 The Gtk2Hs Team, (c) Paolo Martini 2005, (c) Abraham Egnor 2003, 2004, (c) Aetion Technologies LLC 2004
demo/Clock.hs view
@@ -1,7 +1,7 @@ -- original author: -- Mirco "MacSlow" Mueller <macslow@bangang.de> ----- created: +-- created: -- 10.1.2006 (or so) -- -- http://www.gnu.org/licenses/licenses.html#GPL@@ -35,9 +35,9 @@ setSourceRGB 0.16 0.18 0.19 setLineWidth (1.5/60) setLineCap LineCapRound- setLineJoin LineJoinRound - drawHourMarks - + setLineJoin LineJoinRound+ drawHourMarks+ restore drawClockHands :: Bool -> Int -> Int -> Render ()@@ -51,18 +51,18 @@ setLineWidth (1.5/60) setLineCap LineCapRound setLineJoin LineJoinRound- + time <- liftIO (getClockTime >>= toCalendarTime) let hours = fromIntegral (if ctHour time >= 12 then ctHour time - 12 else ctHour time) minutes = fromIntegral (ctMin time) seconds = fromIntegral (ctSec time)- + drawHourHand quality hours minutes seconds drawMinuteHand quality minutes seconds drawSecondHand quality seconds- + restore drawClockForeground :: Bool -> Int -> Int -> Render ()@@ -79,9 +79,9 @@ when quality drawInnerShadow when quality drawReflection- drawFrame quality + drawFrame quality restore- + drawDropShadow = withRadialPattern 0.55 0.55 0.25 0.5 0.5 0.525 $ \pattern -> do patternAddColorStopRGBA pattern 0 0 0 0 0.811@@ -127,7 +127,7 @@ rotate ( (pi/6) * hours + (pi/360) * minutes + (pi/21600) * seconds)- + -- hour hand's shadow when quality $ do setLineWidth (1.75/60)@@ -136,7 +136,7 @@ moveTo (-2/15 + 0.025) 0.025 lineTo (7/15 + 0.025) 0.025 stroke- + -- the hand itself setLineWidth (1/60) setOperator OperatorOver@@ -153,7 +153,7 @@ setLineJoin LineJoinMiter rotate ( (pi/30) * minutes + (pi/1800) * seconds)- + -- minute hand's shadow when quality $ do setLineWidth (1.75/60)@@ -162,7 +162,7 @@ moveTo (-16/75 - 0.025) (-0.025) lineTo (2/3 - 0.025) (-0.025) stroke- + -- the minute hand itself setLineWidth (1/60) setOperator OperatorOver@@ -276,7 +276,7 @@ main = do initGUI- + window <- windowNew windowSetDecorated window False windowSetResizable window True@@ -300,13 +300,13 @@ window `on` keyPressEvent $ tryEvent $ do "Escape" <- eventKeyName liftIO mainQuit- + window `on` buttonPressEvent $ tryEvent $ do LeftButton <- eventButton time <- eventTime (x,y) <- eventRootCoordinates liftIO $ windowBeginMoveDrag window LeftButton (round x) (round y) time- + window `on` buttonPressEvent $ tryEvent $ do MiddleButton <- eventButton time <- eventTime@@ -324,7 +324,7 @@ drawWin <- widgetGetDrawWindow window background <- createImageSurface FormatARGB32 width height foreground <- createImageSurface FormatARGB32 width height- let clear = do + let clear = do save setOperator OperatorClear paint@@ -337,7 +337,7 @@ drawClockForeground True width height writeIORef backgroundRef (Just background) writeIORef foregroundRef (Just foreground)- + onRealize window redrawStaticLayers sizeRef <- newIORef (initialSize, initialSize)@@ -348,7 +348,7 @@ size <- readIORef sizeRef writeIORef sizeRef (w,h) when (size /= (w,h)) $ do- + background <- readIORef backgroundRef foreground <- readIORef foregroundRef maybe (return ()) surfaceFinish background@@ -356,10 +356,10 @@ writeIORef backgroundRef Nothing writeIORef foregroundRef Nothing- + timeoutHandler <- readIORef timeoutHandlerRef maybe (return ()) timeoutRemove timeoutHandler- + handler <- timeoutAddFull (do writeIORef timeoutHandlerRef Nothing redrawStaticLayers@@ -367,7 +367,7 @@ return False ) priorityDefaultIdle 300 writeIORef timeoutHandlerRef (Just handler)- + return False window `on` exposeEvent $ do
demo/Drawing.hs view
@@ -42,14 +42,14 @@ setSourceRGB 1 1 0 setLineWidth 4- + save translate (width / 2) (height / 2) scale (width / 2) (height / 2) arc 0 0 1 (135 * pi/180) (225 * pi/180) restore stroke- + setSourceRGB 0 0 0 moveTo 30 (realToFrac height / 4) rotate (pi/4)
demo/StarAndRing.hs view
@@ -72,7 +72,7 @@ starAndRing width height = do setOperator OperatorClear paint- + setOperator OperatorAdd renderWithSimilarSurface ContentColorAlpha width height $ \ringOverStar -> do