gtksourceview2 0.12.3.1 → 0.12.5.0
raw patch · 15 files changed
+276/−127 lines, 15 filesdep +arraydep +containersdep ~gtknew-uploader
Dependencies added: array, containers
Dependency ranges changed: gtk
Files
- Graphics/UI/Gtk/SourceView.hs +5/−0
- Graphics/UI/Gtk/SourceView/Enums.chs +4/−0
- Graphics/UI/Gtk/SourceView/Signals.chs +16/−16
- Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs +18/−3
- Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs +8/−0
- Graphics/UI/Gtk/SourceView/SourceGutter.chs +20/−9
- Graphics/UI/Gtk/SourceView/SourceIter.chs +4/−0
- Graphics/UI/Gtk/SourceView/SourceView.chs +10/−2
- Graphics/UI/Gtk/SourceView/Types.chs +76/−50
- Gtk2HsSetup.hs +62/−13
- SetupMain.hs +3/−2
- SetupWrapper.hs +20/−11
- gtksourceview2.cabal +20/−19
- gtksourceview2.h +8/−0
- marshal.list +2/−2
Graphics/UI/Gtk/SourceView.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Graphics.UI.Gtk.SourceView ( module Graphics.UI.Gtk.SourceView.SourceBuffer, module Graphics.UI.Gtk.SourceView.SourceCompletion,@@ -7,7 +8,9 @@ module Graphics.UI.Gtk.SourceView.SourceCompletionProposal, module Graphics.UI.Gtk.SourceView.SourceCompletionProvider, module Graphics.UI.Gtk.SourceView.SourceGutter,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.SourceView.SourceIter,+#endif module Graphics.UI.Gtk.SourceView.SourceLanguage, module Graphics.UI.Gtk.SourceView.SourceLanguageManager, module Graphics.UI.Gtk.SourceView.SourceMark,@@ -26,7 +29,9 @@ import Graphics.UI.Gtk.SourceView.SourceCompletionProposal import Graphics.UI.Gtk.SourceView.SourceCompletionProvider import Graphics.UI.Gtk.SourceView.SourceGutter+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.SourceView.SourceIter+#endif import Graphics.UI.Gtk.SourceView.SourceLanguage import Graphics.UI.Gtk.SourceView.SourceLanguageManager import Graphics.UI.Gtk.SourceView.SourceMark
Graphics/UI/Gtk/SourceView/Enums.chs view
@@ -26,7 +26,9 @@ module Graphics.UI.Gtk.SourceView.Enums ( -- * Enums SourceCompletionActivation (..),+#if GTK_MAJOR_VERSION < 3 SourceSearchFlags (..),+#endif SourceSmartHomeEndType (..), SourceDrawSpacesFlags (..), SourceViewGutterPosition (..)@@ -41,9 +43,11 @@ {# enum SourceCompletionActivation {underscoreToCase} deriving(Eq,Bounded,Show,Read) #} +#if GTK_MAJOR_VERSION < 3 {# enum SourceSearchFlags {underscoreToCase} deriving(Eq,Bounded,Show,Read) #} instance Flags SourceSearchFlags+#endif {# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}
Graphics/UI/Gtk/SourceView/Signals.chs view
@@ -44,8 +44,8 @@ connect_OBJECT__NONE, connect_BOXED_BOXED__NONE, connect_BOOL_INT__NONE,- connect_PTR_BOXED__NONE,- connect_OBJECT_PTR_BOXED__NONE,+ connect_BOXED_PTR__NONE,+ connect_OBJECT_BOXED_PTR__NONE, connect_OBJECT_BOXED_OBJECT__BOOL, connect_ENUM_INT__NONE, @@ -120,34 +120,34 @@ failOnGError $ user bool1 int2 -connect_PTR_BOXED__NONE :: +connect_BOXED_PTR__NONE :: GObjectClass obj => SignalName ->- (Ptr b' -> IO b) -> + (Ptr a' -> IO a) -> ConnectAfter -> obj ->- (Ptr a -> b -> IO ()) ->+ (a -> Ptr b -> IO ()) -> IO (ConnectId obj)-connect_PTR_BOXED__NONE signal boxedPre2 after obj user =+connect_BOXED_PTR__NONE signal boxedPre1 after obj user = connectGeneric signal after obj action where action :: Ptr GObject -> Ptr () -> Ptr () -> IO ()- action _ ptr1 box2 =+ action _ box1 ptr2 = failOnGError $- boxedPre2 (castPtr box2) >>= \box2' ->- user (castPtr ptr1) box2'+ boxedPre1 (castPtr box1) >>= \box1' ->+ user box1' (castPtr ptr2) -connect_OBJECT_PTR_BOXED__NONE :: +connect_OBJECT_BOXED_PTR__NONE :: (GObjectClass a', GObjectClass obj) => SignalName ->- (Ptr c' -> IO c) -> + (Ptr b' -> IO b) -> ConnectAfter -> obj ->- (a' -> Ptr b -> c -> IO ()) ->+ (a' -> b -> Ptr c -> IO ()) -> IO (ConnectId obj)-connect_OBJECT_PTR_BOXED__NONE signal boxedPre3 after obj user =+connect_OBJECT_BOXED_PTR__NONE signal boxedPre2 after obj user = connectGeneric signal after obj action where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr () -> IO ()- action _ obj1 ptr2 box3 =+ action _ obj1 box2 ptr3 = failOnGError $- boxedPre3 (castPtr box3) >>= \box3' ->+ boxedPre2 (castPtr box2) >>= \box2' -> makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') (castPtr ptr2) box3'+ user (unsafeCastGObject obj1') box2' (castPtr ptr3) connect_OBJECT_BOXED_OBJECT__BOOL :: (GObjectClass a', GObjectClass c', GObjectClass obj) => SignalName ->
Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs view
@@ -60,18 +60,33 @@ -- | Providers can use this function to add proposals to the completion. They can do so asynchronously by -- means of the finished argument. Providers must ensure that they always call this function with -- finished set to 'True' once each population (even if no proposals need to be added).-sourceCompletionContextAddProposals :: SourceCompletionContextClass scc => scc- -> SourceCompletionProvider+sourceCompletionContextAddProposals :: (SourceCompletionContextClass scc, SourceCompletionProviderClass scp) => scc+ -> scp -> [SourceCompletionProposal] -- ^ @proposals@ The list of proposals to add -> Bool -- ^ @finished@ Whether the provider is finished adding proposals -> IO () sourceCompletionContextAddProposals scc provider proposals finished = withForeignPtrs (map unSourceCompletionProposal proposals) $ \proposalsPtr ->- withForeignPtr (unSourceCompletionProvider provider) $ \providerPtr ->+#ifdef MIN_VERSION_gtksourceview_3_0+#if MIN_VERSION_gtksourceview_3_0(3,6,0)+#else+ withForeignPtr (unSourceCompletionProvider $ toSourceCompletionProvider provider) $ \providerPtr ->+#endif+#else+ withForeignPtr (unSourceCompletionProvider $ toSourceCompletionProvider provider) $ \providerPtr ->+#endif withGList proposalsPtr $ \glist -> {#call gtk_source_completion_context_add_proposals #} (toSourceCompletionContext scc)+#ifdef MIN_VERSION_gtksourceview_3_0+#if MIN_VERSION_gtksourceview_3_0(3,6,0)+ (toSourceCompletionProvider provider)+#else (castPtr providerPtr)+#endif+#else+ (castPtr providerPtr)+#endif glist (fromBool finished)
Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs view
@@ -34,10 +34,14 @@ -- * Methods sourceCompletionInfoNew, sourceCompletionInfoMoveToIter,+#if GTK_MAJOR_VERSION < 3 sourceCompletionInfoSetSizing,+#endif sourceCompletionInfoSetWidget, sourceCompletionInfoGetWidget,+#if GTK_MAJOR_VERSION < 3 sourceCompletionInfoProcessResize,+#endif -- * Attributes sourceCompletionInfoMaxHeight,@@ -81,6 +85,7 @@ view (fromMaybe (TextIter nullForeignPtr) iter) +#if GTK_MAJOR_VERSION < 3 -- | Set sizing information for the info window. If @shrinkWidth@ or @shrinkHeight@ is 'True', the info -- window will try to resize to fit the window contents, with a maximum size given by width and -- height. Setting width or height to -1 removes the maximum size of respectively the width and height@@ -98,6 +103,7 @@ (fromIntegral height) (fromBool shrinkWidth) (fromBool shrinkHeight)+#endif -- | Sets the content widget of the info window. If widget does not fit within the size requirements of -- the window, a 'ScrolledWindow' will automatically be created and added to the window.@@ -117,12 +123,14 @@ {#call gtk_source_completion_info_get_widget #} (toSourceCompletionInfo info) +#if GTK_MAJOR_VERSION < 3 -- | sourceCompletionInfoProcessResize :: SourceCompletionInfoClass info => info -> IO () sourceCompletionInfoProcessResize info = {#call gtk_source_completion_info_process_resize #} (toSourceCompletionInfo info)+#endif -- | The maximum allowed height. --
Graphics/UI/Gtk/SourceView/SourceGutter.chs view
@@ -49,12 +49,16 @@ -- * Methods sourceGutterGetWindow,+#if GTK_MAJOR_VERSION >= 3 sourceGutterInsert, sourceGutterReorder, sourceGutterRemove, sourceGutterQueueDraw,+#endif+#if GTK_MAJOR_VERSION < 3 sourceGutterSetCellDataFunc, sourceGutterSetCellSizeFunc,+#endif -- * Attributes sourceGutterView,@@ -82,6 +86,7 @@ {# context lib="gtk" prefix="gtk" #} +#if GTK_MAJOR_VERSION < 3 {#pointer SourceGutterDataFunc#} foreign import ccall "wrapper" mkSourceGutterDataFunc ::@@ -93,6 +98,7 @@ foreign import ccall "wrapper" mkSourceGutterSizeFunc :: (Ptr SourceGutter -> Ptr CellRenderer -> Ptr () -> IO ()) -> IO SourceGutterSizeFunc+#endif -- | Get the 'Window' of the gutter. The window will only be available when the gutter has at least one, -- non-zero width, cell renderer packed.@@ -101,43 +107,47 @@ maybeNull (makeNewGObject mkDrawWindow) $ {#call gtk_source_gutter_get_window #} (toSourceGutter sb) +#if GTK_MAJOR_VERSION >= 3 -- | Inserts renderer into gutter at position.-sourceGutterInsert :: (CellRendererClass cell, SourceGutterClass sg) => sg+sourceGutterInsert :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg -> cell -- ^ @renderer@ a 'CellRenderer' -> Int -- ^ @position@ the renderers position - -> IO ()+ -> IO Int sourceGutterInsert gutter renderer position =+ liftM fromIntegral $ {#call gtk_source_gutter_insert #} (toSourceGutter gutter)- (toCellRenderer renderer)+ (toSourceGutterRenderer renderer) (fromIntegral position) -- | Reorders renderer in gutter to new position.-sourceGutterReorder :: (CellRendererClass cell, SourceGutterClass sg) => sg+sourceGutterReorder :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg -> cell -- ^ @renderer@ a 'CellRenderer' -> Int -- ^ @position@ the new renderer position -> IO () sourceGutterReorder gutter renderer position = {#call gtk_source_gutter_reorder #} (toSourceGutter gutter)- (toCellRenderer renderer)+ (toSourceGutterRenderer renderer) (fromIntegral position) -- | Removes renderer from gutter.-sourceGutterRemove :: (CellRendererClass cell, SourceGutterClass sg) => sg+sourceGutterRemove :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg -> cell -- ^ @renderer@ a 'CellRenderer' -> IO () sourceGutterRemove gutter renderer = {#call gtk_source_gutter_remove #} (toSourceGutter gutter)- (toCellRenderer renderer)+ (toSourceGutterRenderer renderer) -- | Invalidates the drawable area of the gutter. You can use this to force a redraw of the gutter if -- something has changed and needs to be redrawn. sourceGutterQueueDraw :: SourceGutterClass sg => sg -> IO () sourceGutterQueueDraw sb = {#call gtk_source_gutter_queue_draw #} (toSourceGutter sb)+#endif +#if GTK_MAJOR_VERSION < 3 -- | Sets the 'SourceGutterDataFunc' to use for renderer. This function is used to setup the cell -- renderer properties for rendering the current cell. sourceGutterSetCellDataFunc :: (SourceGutterClass sg, CellRendererClass cell)@@ -173,6 +183,7 @@ funcPtr (castFunPtrToPtr funcPtr) destroyFunPtr+#endif -- | The 'SourceView' of the gutter sourceGutterView :: SourceGutterClass sg => Attr sg SourceView@@ -191,8 +202,8 @@ sourceGutterCellActivated :: SourceGutterClass sg => Signal sg (CellRenderer -> TextIter -> EventM EAny ()) sourceGutterCellActivated = Signal (\after obj fun -> - connect_OBJECT_PTR_BOXED__NONE "cell-activated" mkTextIterCopy after obj- (\cr eventPtr iter -> runReaderT (fun cr iter) eventPtr)+ connect_OBJECT_BOXED_PTR__NONE "cell-activated" mkTextIterCopy after obj+ (\cr iter eventPtr -> runReaderT (fun cr iter) eventPtr) ) -- | Emitted when a tooltip is requested for a specific cell. Signal handlers can return 'True' to notify
Graphics/UI/Gtk/SourceView/SourceIter.chs view
@@ -30,14 +30,17 @@ -- * There is no SourceIter object, just extra methods for "TextIter" -- module Graphics.UI.Gtk.SourceView.SourceIter (+#if GTK_MAJOR_VERSION < 3 -- * Enums SourceSearchFlags(..), -- * Methods sourceIterForwardSearch, sourceIterBackwardSearch,+#endif ) where +#if GTK_MAJOR_VERSION < 3 import Control.Monad (liftM) import Data.Maybe (fromMaybe) @@ -91,3 +94,4 @@ ((fromIntegral.fromFlags) flags) start end (fromMaybe (TextIter nullForeignPtr) limit) return $ if found then Just (start,end) else Nothing+#endif
Graphics/UI/Gtk/SourceView/SourceView.chs view
@@ -53,6 +53,7 @@ sourceViewGetInsertSpacesInsteadOfTabs, sourceViewSetSmartHomeEnd, sourceViewGetSmartHomeEnd,+#if GTK_MAJOR_VERSION < 3 sourceViewSetMarkCategoryPriority, sourceViewGetMarkCategoryPriority, sourceViewSetMarkCategoryIconFromPixbuf,@@ -60,6 +61,7 @@ sourceViewSetMarkCategoryIconFromIconName, sourceViewSetMarkCategoryBackground, sourceViewGetMarkCategoryBackground,+#endif sourceViewSetHighlightCurrentLine, sourceViewGetHighlightCurrentLine, sourceViewSetShowLineMarks,@@ -98,10 +100,12 @@ sourceViewLineMarkActivated, -- * Deprecated+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED sourceViewSetMarkCategoryPixbuf, sourceViewGetMarkCategoryPixbuf, #endif+#endif ) where import Control.Monad (liftM)@@ -339,6 +343,7 @@ (toSourceView sv) (fromIntegral $ fromEnum windowType) +#if GTK_MAJOR_VERSION < 3 -- | Set the priority for the given mark category. When there are multiple marks on the same line, marks -- of categories with higher priorities will be drawn on top. --@@ -427,6 +432,7 @@ (toSourceView sv) categoryPtr (castPtr colorPtr)+#endif -- | Whether to enable auto indentation. -- @@ -546,10 +552,11 @@ sourceViewLineMarkActivated :: SourceViewClass sv => Signal sv (TextIter -> EventM EAny ()) sourceViewLineMarkActivated = Signal (\after obj fun -> - connect_PTR_BOXED__NONE "line-mark-activated" mkTextIterCopy after obj- (\eventPtr iter -> runReaderT (fun iter) eventPtr)+ connect_BOXED_PTR__NONE "line-mark-activated" mkTextIterCopy after obj+ (\iter eventPtr -> runReaderT (fun iter) eventPtr) ) +#if GTK_MAJOR_VERSION < 3 -- * Deprecated #ifndef DISABLE_DEPRECATED -- | 'sourceViewSetMarkCategoryPixbuf' is deprecated and should not be used in newly-written@@ -565,5 +572,6 @@ sourceViewGetMarkCategoryPixbuf sv markerType = withCString markerType $ \strPtr -> wrapNewGObject mkPixbuf $ {#call unsafe source_view_get_mark_category_pixbuf#} (toSourceView sv) strPtr+#endif #endif
Graphics/UI/Gtk/SourceView/Types.chs view
@@ -1,5 +1,4 @@ {-# OPTIONS_HADDOCK hide #-}-{-# LANGUAGE CPP #-} -- -*-haskell-*- -- -------------------- automatically generated file - do not edit ---------- -- Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell@@ -60,6 +59,14 @@ toSourceCompletionItem, mkSourceCompletionItem, unSourceCompletionItem, castToSourceCompletionItem, gTypeSourceCompletionItem,+ SourceCompletion(SourceCompletion), SourceCompletionClass,+ toSourceCompletion, + mkSourceCompletion, unSourceCompletion,+ castToSourceCompletion, gTypeSourceCompletion,+ SourceGutterRenderer(SourceGutterRenderer), SourceGutterRendererClass,+ toSourceGutterRenderer, + mkSourceGutterRenderer, unSourceGutterRenderer,+ castToSourceGutterRenderer, gTypeSourceGutterRenderer, SourceBuffer(SourceBuffer), SourceBufferClass, toSourceBuffer, mkSourceBuffer, unSourceBuffer,@@ -68,10 +75,6 @@ toSourceMark, mkSourceMark, unSourceMark, castToSourceMark, gTypeSourceMark,- SourceCompletion(SourceCompletion), SourceCompletionClass,- toSourceCompletion, - mkSourceCompletion, unSourceCompletion,- castToSourceCompletion, gTypeSourceCompletion, SourceCompletionInfo(SourceCompletionInfo), SourceCompletionInfoClass, toSourceCompletionInfo, mkSourceCompletionInfo, unSourceCompletionInfo,@@ -102,13 +105,14 @@ castToSourceStyleSchemeManager, gTypeSourceStyleSchemeManager ) where -import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr)-#if __GLASGOW_HASKELL__>=704-import Foreign.C.Types (CULong(..), CUInt(..))+import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)+#if __GLASGOW_HASKELL__ >= 707+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) #else-import Foreign.C.Types (CULong, CUInt)+import Foreign.ForeignPtr (unsafeForeignPtrToPtr) #endif-import System.Glib.GType (GType, typeInstanceIsA)+import Foreign.C.Types (CULong(..), CUInt(..))+import System.Glib.GType (GType, typeInstanceIsA) {#import Graphics.UI.GtkInternals#} {# context lib="gtk" prefix="gtk" #}@@ -128,7 +132,7 @@ -- *************************************************************** SourceGutter -{#pointer *SourceGutter foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceGutter as SourceGutter foreign newtype #} deriving (Eq,Ord) mkSourceGutter = (SourceGutter, objectUnrefFromMainloop) unSourceGutter (SourceGutter o) = o@@ -151,7 +155,7 @@ -- ********************************************************** SourceUndoManager -{#pointer *SourceUndoManager foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceUndoManager as SourceUndoManager foreign newtype #} deriving (Eq,Ord) mkSourceUndoManager = (SourceUndoManager, objectUnrefFromMainloop) unSourceUndoManager (SourceUndoManager o) = o@@ -174,7 +178,7 @@ -- *************************************************** SourceCompletionProvider -{#pointer *SourceCompletionProvider foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceCompletionProvider as SourceCompletionProvider foreign newtype #} deriving (Eq,Ord) mkSourceCompletionProvider = (SourceCompletionProvider, objectUnrefFromMainloop) unSourceCompletionProvider (SourceCompletionProvider o) = o@@ -197,7 +201,7 @@ -- *************************************************** SourceCompletionProposal -{#pointer *SourceCompletionProposal foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceCompletionProposal as SourceCompletionProposal foreign newtype #} deriving (Eq,Ord) mkSourceCompletionProposal = (SourceCompletionProposal, objectUnrefFromMainloop) unSourceCompletionProposal (SourceCompletionProposal o) = o@@ -220,7 +224,7 @@ -- **************************************************** SourceCompletionContext -{#pointer *SourceCompletionContext foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceCompletionContext as SourceCompletionContext foreign newtype #} deriving (Eq,Ord) mkSourceCompletionContext = (SourceCompletionContext, objectUnrefFromMainloop) unSourceCompletionContext (SourceCompletionContext o) = o@@ -243,7 +247,7 @@ -- ******************************************************* SourceCompletionItem -{#pointer *SourceCompletionItem foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceCompletionItem as SourceCompletionItem foreign newtype #} deriving (Eq,Ord) mkSourceCompletionItem = (SourceCompletionItem, objectUnrefFromMainloop) unSourceCompletionItem (SourceCompletionItem o) = o@@ -264,9 +268,55 @@ gTypeSourceCompletionItem = {# call fun unsafe gtk_source_completion_item_get_type #} +-- *********************************************************** SourceCompletion++{#pointer *GtkSourceCompletion as SourceCompletion foreign newtype #} deriving (Eq,Ord)++mkSourceCompletion = (SourceCompletion, objectUnrefFromMainloop)+unSourceCompletion (SourceCompletion o) = o++class GObjectClass o => SourceCompletionClass o+toSourceCompletion :: SourceCompletionClass o => o -> SourceCompletion+toSourceCompletion = unsafeCastGObject . toGObject++instance SourceCompletionClass SourceCompletion+instance GObjectClass SourceCompletion where+ toGObject = GObject . castForeignPtr . unSourceCompletion+ unsafeCastGObject = SourceCompletion . castForeignPtr . unGObject++castToSourceCompletion :: GObjectClass obj => obj -> SourceCompletion+castToSourceCompletion = castTo gTypeSourceCompletion "SourceCompletion"++gTypeSourceCompletion :: GType+gTypeSourceCompletion =+ {# call fun unsafe gtk_source_completion_get_type #}++-- ******************************************************* SourceGutterRenderer++{#pointer *GtkSourceGutterRenderer as SourceGutterRenderer foreign newtype #} deriving (Eq,Ord)++mkSourceGutterRenderer = (SourceGutterRenderer, objectUnrefFromMainloop)+unSourceGutterRenderer (SourceGutterRenderer o) = o++class GObjectClass o => SourceGutterRendererClass o+toSourceGutterRenderer :: SourceGutterRendererClass o => o -> SourceGutterRenderer+toSourceGutterRenderer = unsafeCastGObject . toGObject++instance SourceGutterRendererClass SourceGutterRenderer+instance GObjectClass SourceGutterRenderer where+ toGObject = GObject . castForeignPtr . unSourceGutterRenderer+ unsafeCastGObject = SourceGutterRenderer . castForeignPtr . unGObject++castToSourceGutterRenderer :: GObjectClass obj => obj -> SourceGutterRenderer+castToSourceGutterRenderer = castTo gTypeSourceGutterRenderer "SourceGutterRenderer"++gTypeSourceGutterRenderer :: GType+gTypeSourceGutterRenderer =+ {# call fun unsafe gtk_source_gutter_renderer_get_type #}+ -- *************************************************************** SourceBuffer -{#pointer *SourceBuffer foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceBuffer as SourceBuffer foreign newtype #} deriving (Eq,Ord) mkSourceBuffer = (SourceBuffer, objectUnrefFromMainloop) unSourceBuffer (SourceBuffer o) = o@@ -290,7 +340,7 @@ -- ***************************************************************** SourceMark -{#pointer *SourceMark foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceMark as SourceMark foreign newtype #} deriving (Eq,Ord) mkSourceMark = (SourceMark, objectUnrefFromMainloop) unSourceMark (SourceMark o) = o@@ -312,33 +362,9 @@ gTypeSourceMark = {# call fun unsafe gtk_source_mark_get_type #} --- *********************************************************** SourceCompletion--{#pointer *SourceCompletion foreign newtype #} deriving (Eq,Ord)--mkSourceCompletion = (SourceCompletion, objectUnrefFromMainloop)-unSourceCompletion (SourceCompletion o) = o--class ObjectClass o => SourceCompletionClass o-toSourceCompletion :: SourceCompletionClass o => o -> SourceCompletion-toSourceCompletion = unsafeCastGObject . toGObject--instance SourceCompletionClass SourceCompletion-instance ObjectClass SourceCompletion-instance GObjectClass SourceCompletion where- toGObject = GObject . castForeignPtr . unSourceCompletion- unsafeCastGObject = SourceCompletion . castForeignPtr . unGObject--castToSourceCompletion :: GObjectClass obj => obj -> SourceCompletion-castToSourceCompletion = castTo gTypeSourceCompletion "SourceCompletion"--gTypeSourceCompletion :: GType-gTypeSourceCompletion =- {# call fun unsafe gtk_source_completion_get_type #}- -- ******************************************************* SourceCompletionInfo -{#pointer *SourceCompletionInfo foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceCompletionInfo as SourceCompletionInfo foreign newtype #} deriving (Eq,Ord) mkSourceCompletionInfo = (SourceCompletionInfo, objectUnrefFromMainloop) unSourceCompletionInfo (SourceCompletionInfo o) = o@@ -352,7 +378,7 @@ instance BinClass SourceCompletionInfo instance ContainerClass SourceCompletionInfo instance WidgetClass SourceCompletionInfo-instance ObjectClass SourceCompletionInfo+instance TextMarkClass SourceCompletionInfo instance GObjectClass SourceCompletionInfo where toGObject = GObject . castForeignPtr . unSourceCompletionInfo unsafeCastGObject = SourceCompletionInfo . castForeignPtr . unGObject@@ -366,7 +392,7 @@ -- ***************************************************************** SourceView -{#pointer *SourceView foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceView as SourceView foreign newtype #} deriving (Eq,Ord) mkSourceView = (SourceView, objectUnrefFromMainloop) unSourceView (SourceView o) = o@@ -379,7 +405,7 @@ instance TextViewClass SourceView instance ContainerClass SourceView instance WidgetClass SourceView-instance ObjectClass SourceView+instance TextMarkClass SourceView instance GObjectClass SourceView where toGObject = GObject . castForeignPtr . unSourceView unsafeCastGObject = SourceView . castForeignPtr . unGObject@@ -393,7 +419,7 @@ -- ************************************************************* SourceLanguage -{#pointer *SourceLanguage foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceLanguage as SourceLanguage foreign newtype #} deriving (Eq,Ord) mkSourceLanguage = (SourceLanguage, objectUnrefFromMainloop) unSourceLanguage (SourceLanguage o) = o@@ -416,7 +442,7 @@ -- ****************************************************** SourceLanguageManager -{#pointer *SourceLanguageManager foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceLanguageManager as SourceLanguageManager foreign newtype #} deriving (Eq,Ord) mkSourceLanguageManager = (SourceLanguageManager, objectUnrefFromMainloop) unSourceLanguageManager (SourceLanguageManager o) = o@@ -462,7 +488,7 @@ -- ********************************************************** SourceStyleScheme -{#pointer *SourceStyleScheme foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceStyleScheme as SourceStyleScheme foreign newtype #} deriving (Eq,Ord) mkSourceStyleScheme = (SourceStyleScheme, objectUnrefFromMainloop) unSourceStyleScheme (SourceStyleScheme o) = o@@ -485,7 +511,7 @@ -- *************************************************** SourceStyleSchemeManager -{#pointer *SourceStyleSchemeManager foreign newtype #} deriving (Eq,Ord)+{#pointer *GtkSourceStyleSchemeManager as SourceStyleSchemeManager foreign newtype #} deriving (Eq,Ord) mkSourceStyleSchemeManager = (SourceStyleSchemeManager, objectUnrefFromMainloop) unSourceStyleSchemeManager (SourceStyleSchemeManager o) = o
Gtk2HsSetup.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, ViewPatterns #-} #ifndef CABAL_VERSION_CHECK #error This module has to be compiled via the Setup.hs program which generates the gtk2hs-macros.h file@@ -9,7 +9,10 @@ module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages, - checkGtk2hsBuildtools+ checkGtk2hsBuildtools,+ typeGenProgram,+ signalGenProgram,+ c2hsLocal ) where import Distribution.Simple@@ -26,7 +29,7 @@ emptyBuildInfo, allBuildInfo, Library(..), libModules, hasLibs)-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(withPackageDB, buildDir, localPkgDescr, installedPkgs, withPrograms), InstallDirs(..), componentPackageDeps, absoluteInstallDirs)@@ -53,13 +56,26 @@ import Distribution.Verbosity 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)+import Data.List (isPrefixOf, isSuffixOf, stripPrefix, nub)+import Data.Char (isAlpha, isNumber) import qualified Data.Map as M import qualified Data.Set as S+import qualified Distribution.Simple.LocalBuildInfo as LBI+import Distribution.Simple.Compiler (compilerVersion) import Control.Applicative ((<$>)) +#if CABAL_VERSION_CHECK(1,17,0)+import Distribution.Simple.Program.Find ( defaultProgramSearchPath )+onDefaultSearchPath f a b = f a b defaultProgramSearchPath+libraryConfig lbi = case [clbi | (LBI.CLibName, clbi, _) <- LBI.componentsConfigs lbi] of+ [clbi] -> Just clbi+ _ -> Nothing+#else+onDefaultSearchPath = id+libraryConfig = LBI.libraryConfig+#endif+ -- the name of the c2hs pre-compiled header file precompFile = "precompchs.bin" @@ -96,10 +112,16 @@ fixLibs :: [FilePath] -> [String] -> [String] fixLibs dlls = concatMap $ \ lib ->- case filter (("lib" ++ lib) `isPrefixOf`) dlls of+ case filter (isLib lib) dlls of dll:_ -> [dropExtension dll] _ -> if lib == "z" then [] else [lib]-+ where+ isLib lib dll =+ case stripPrefix ("lib"++lib) dll of+ Just ('.':_) -> True+ Just ('-':n:_) | isNumber n -> True+ _ -> False+ -- The following code is a big copy-and-paste job from the sources of -- Cabal 1.8 just to be able to fix a field in the package file. Yuck. @@ -132,8 +154,8 @@ register :: PackageDescription -> LocalBuildInfo -> RegisterFlags -- ^Install in the user's database?; verbose -> IO ()-register pkg@PackageDescription { library = Just lib }- lbi@LocalBuildInfo { libraryConfig = Just clbi } regFlags+register pkg@(library -> Just lib )+ lbi@(libraryConfig -> Just clbi) regFlags = do installedPkgInfoRaw <- generateRegistrationInfo@@ -225,6 +247,10 @@ = nub $ ["-I" ++ dir | dir <- PD.includeDirs bi] ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"]+ ++ ["-D__GLASGOW_HASKELL__="++show (ghcDefine . versionBranch . compilerVersion $ LBI.compiler lbi)]+ where+ ghcDefine (v1:v2:_) = v1 * 100 + v2+ ghcDefine _ = __GLASGOW_HASKELL__ installCHI :: PackageDescription -- ^information from the .cabal file -> LocalBuildInfo -- ^information from the configure step@@ -307,6 +333,29 @@ info verb ("Ensuring that callback hooks in "++f++" are up-to-date.") genFile signalGenProgram signalsOpts f + writeFile "gtk2hs_macros.h" $ generateMacros cPkgs++-- Based on Cabal/Distribution/Simple/Build/Macros.hs+generateMacros :: [PackageId] -> String+generateMacros cPkgs = concat $+ "/* DO NOT EDIT: This file is automatically generated by Gtk2HsSetup.hs */\n\n" :+ [ concat+ ["/* package ",display pkgid," */\n"+ ,"#define VERSION_",pkgname," ",show (display version),"\n"+ ,"#define MIN_VERSION_",pkgname,"(major1,major2,minor) (\\\n"+ ," (major1) < ",major1," || \\\n"+ ," (major1) == ",major1," && (major2) < ",major2," || \\\n"+ ," (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")"+ ,"\n\n"+ ]+ | pkgid@(PackageIdentifier name version) <- cPkgs+ , let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)+ pkgname = map fixchar (display name)+ ]+ where fixchar '-' = '_'+ fixchar '.' = '_'+ fixchar c = c+ --FIXME: Cabal should tell us the selected pkg-config package versions in the -- LocalBuildInfo or equivalent. -- In the mean time, ask pkg-config again.@@ -411,11 +460,11 @@ (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md) -- Check user whether install gtk2hs-buildtools correctly.-checkGtk2hsBuildtools :: [String] -> IO ()+checkGtk2hsBuildtools :: [Program] -> IO () checkGtk2hsBuildtools programs = do- programInfos <- mapM (\ name -> do- location <- programFindLocation (simpleProgram name) normal- return (name, location)+ programInfos <- mapM (\ prog -> do+ location <- onDefaultSearchPath programFindLocation prog normal+ return (programName prog, location) ) programs let printError name = do putStrLn $ "Cannot find " ++ name ++ "\n"
SetupMain.hs view
@@ -3,10 +3,11 @@ -- all Gtk2Hs-specific boilerplate is kept in Gtk2HsSetup.hs -- which should be kept identical across all packages. ---import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools )+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools,+ typeGenProgram, signalGenProgram, c2hsLocal) import Distribution.Simple ( defaultMainWithHooks ) main = do- checkGtk2hsBuildtools ["gtk2hsC2hs", "gtk2hsTypeGen", "gtk2hsHookGenerator"]+ checkGtk2hsBuildtools [typeGenProgram, signalGenProgram, c2hsLocal] defaultMainWithHooks gtk2hsUserHooks
SetupWrapper.hs view
@@ -29,6 +29,24 @@ import Control.Monad +-- moreRecentFile is implemented in Distribution.Simple.Utils, but only in+-- Cabal >= 1.18. For backwards-compatibility, we implement a copy with a new+-- name here. Some desirable alternate strategies don't work:+-- * We can't use CPP to check which version of Cabal we're up against because+-- this is the file that's generating the macros for doing that.+-- * We can't use the name moreRecentFiles and use+-- import D.S.U hiding (moreRecentFiles)+-- because on old GHC's (and according to the Report) hiding a name that+-- doesn't exist is an error.+moreRecentFile' :: FilePath -> FilePath -> IO Bool+moreRecentFile' a b = do+ exists <- doesFileExist b+ if not exists+ then return True+ else do tb <- getModificationTime b+ ta <- getModificationTime a+ return (ta > tb)+ setupWrapper :: FilePath -> IO () setupWrapper setupHsFile = do args <- getArgs@@ -91,8 +109,8 @@ -- Currently this is GHC only. It should really be generalised. -- compileSetupExecutable = do- setupHsNewer <- setupHsFile `moreRecentFile` setupProgFile- cabalVersionNewer <- setupVersionFile `moreRecentFile` setupProgFile+ setupHsNewer <- setupHsFile `moreRecentFile'` setupProgFile+ cabalVersionNewer <- setupVersionFile `moreRecentFile'` setupProgFile let outOfDate = setupHsNewer || cabalVersionNewer when outOfDate $ do debug verbosity "Setup script is out of date, compiling..."@@ -144,12 +162,3 @@ Nothing Nothing Nothing exitCode <- waitForProcess process unless (exitCode == ExitSuccess) $ exitWith exitCode--moreRecentFile :: FilePath -> FilePath -> IO Bool-moreRecentFile a b = do- exists <- doesFileExist b- if not exists- then return True- else do tb <- getModificationTime b- ta <- getModificationTime a- return (ta > tb)
gtksourceview2.cabal view
@@ -1,5 +1,5 @@ Name: gtksourceview2-Version: 0.12.3.1+Version: 0.12.5.0 License: LGPL-2.1 License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team@@ -20,14 +20,14 @@ Extra-Source-Files: gtksourceview2.h SetupWrapper.hs SetupMain.hs Gtk2HsSetup.hs marshal.list- hierarchy.list+ hierarchy.list -Data-Dir: demo-Data-Files: haskell.lang+Data-Dir: demo+Data-Files: haskell.lang SourceView.hs Makefile LineNumber.hs- + x-Types-File: Graphics/UI/Gtk/SourceView/Types.chs x-Types-Tag: gtksourceview2 x-Types-ModName: Graphics.UI.Gtk.SourceView.Types@@ -36,17 +36,16 @@ x-Types-Hierarchy: hierarchy.list Source-Repository head- type: darcs- location: http://code.haskell.org/gtksourceview/- + type: git+ location: https://github.com/gtk2hs/gtksourceview+ Library- build-depends: base >= 4 && < 5, mtl,- glib >= 0.12 && < 0.13, - gtk >= 0.12 && < 0.13- - build-tools: gtk2hsC2hs >= 0.13.5,+ build-depends: base >= 4 && < 5, array, containers, mtl,+ glib >= 0.12 && < 0.13++ build-tools: gtk2hsC2hs >= 0.13.8, gtk2hsHookGenerator, gtk2hsTypeGen- + exposed-modules: Graphics.UI.Gtk.SourceView Graphics.UI.Gtk.SourceView.Enums@@ -69,15 +68,17 @@ Graphics.UI.Gtk.SourceView.SourceView other-modules: Graphics.UI.Gtk.SourceView.SourceStyle.Internal- Graphics.UI.Gtk.SourceView.Types + Graphics.UI.Gtk.SourceView.Types Graphics.UI.Gtk.SourceView.Signals- + extensions: ForeignFunctionInterface x-Signals-File: Graphics/UI/Gtk/SourceView/Signals.chs x-Signals-Modname: Graphics.UI.Gtk.SourceView.Signals x-Signals-Types: marshal.list- - include-dirs: .- x-c2hs-Header: gtksourceview2.h++ include-dirs: .+ x-c2hs-Header: gtksourceview2.h pkgconfig-depends: gtksourceview-2.0 >= 2.0.2+ x-Types-Hierarchy: hierarchy.list+ build-depends: gtk >=0.12.5.0 && <0.13
gtksourceview2.h view
@@ -1,5 +1,8 @@+#include "gtk2hs_macros.h" #include <gtksourceview/gtksourcebuffer.h>+#if GTK_MAJOR_VERSION < 3 #include <gtksourceview/gtksourceiter.h>+#endif #include <gtksourceview/gtksourcelanguage.h> #include <gtksourceview/gtksourcelanguagemanager.h> #include <gtksourceview/gtksourcestyle.h>@@ -9,3 +12,8 @@ #include <gtksourceview/gtksourceview-typebuiltins.h> #include <gtksourceview/gtksourceundomanager.h> #include <gtksourceview/gtksourcecompletionitem.h>+#include <gtksourceview/gtksourcegutter.h>+#include <gtksourceview/gtksourcecompletionprovider.h>+#include <gtksourceview/gtksourcecompletionproposal.h>+#include <gtksourceview/gtksourcemark.h>+#include <gtksourceview/gtksourcecompletioninfo.h>
marshal.list view
@@ -46,7 +46,7 @@ NONE:OBJECT NONE:BOXED,BOXED NONE:BOOL,INT-NONE:POINTER,BOXED-NONE:OBJECT,POINTER,BOXED+NONE:BOXED,POINTER+NONE:OBJECT,BOXED,POINTER BOOL:OBJECT,BOXED,OBJECT NONE:ENUM,INT