From: Peter g. <pg...@co...> - 2009-01-01 18:29:13
|
Fri Dec 19 13:38:34 EST 2008 Peter Gavin <pg...@gm...> * add gtksourceview2 package hunk ./Makefile.am 22 + gtksourceview2/gtksourceview2.h \ hunk ./Makefile.am 72 +if ENABLE_GTKSOURCEVIEW2 +pkglib_LIBRARIES += libHSgtksourceview2.a +endif hunk ./Makefile.am 1323 +# +# gtksourceview2 package +# +################################################################################ + +if ENABLE_GTKSOURCEVIEW2 + +gtksourceview2_PKGNAME = libHSgtksourceview2_a + +libHSgtksourceview2_a_NAME = gtksourceview2 +libHSgtksourceview2_a_CONFIG = gtksourceview2/gtksourceview2.package.conf +libHSgtksourceview2_a_EXTERNALDEPS = base-$(PKG_BASE_VERSION) +libHSgtksourceview2_a_INTERNALDEPS = glib gtk +libHSgtksourceview2_a_HEADER = gtksourceview2.h +libHSgtksourceview2_a_PRECOMP = gtksourceview2/gtksourceview2.precomp +libHSgtksourceview2_a_LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(GTKSOURCEVIEW2_LIBS) +libHSgtksourceview2_a_HCFLAGS = $(FFI) +libHSgtksourceview2_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GTKSOURCEVIEW2_CFLAGS)) +libHSgtksourceview2_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GTKSOURCEVIEW2_CFLAGS)) -Igtksourceview2 + +libHSgtksourceview2_a_SOURCESDIRS = gtksourceview2 + +gtksourceview2/libHSgtksourceview2_a.deps : gtk/libHSgtk_a.deps + +libHSgtksourceview2_a_GENERATEDSOURCES = \ + gtksourceview2/Graphics/UI/Gtk/SourceView/Types.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/Signals.chs + +nodist_libHSgtksourceview2_a_SOURCES = $(libHSgtksourceview2_a_GENERATEDSOURCES) + +libHSgtksourceview2_a_SOURCES = \ + gtksourceview2/Graphics/UI/Gtk/SourceView.hs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceBuffer.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceIter.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguage.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle.hs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceView.chs + +htmldoc_HSFILES_HIDDEN += $(libHSgtksourceview2_a_GENERATEDSOURCES:.chs=.hs) \ + gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.hs + +gtksourceview2_Graphics_UI_Gtk_SourceView_Types_hs_HCFLAGS = -fglasgow-exts +gtksourceview2_Graphics_UI_Gtk_SourceView_SourceTagStyle_hs_HCFLAGS = -fglasgow-exts + +gtksourceview2/Graphics/UI/Gtk/SourceView/Types.chs : \ + $(srcdir)/tools/hierarchyGen/hierarchy.list \ + $(srcdir)/tools/hierarchyGen/TypeGenerator$(EXEEXT) \ + $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template + $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator$(EXEEXT) \ + $(srcdir)/tools/hierarchyGen/hierarchy.list \ + $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ + $@ --tag=gtksourceview2 --parentname=Graphics.UI.Gtk.Types \ + --modname=Graphics.UI.Gtk.SourceView.Types) + +gtksourceview2/Graphics/UI/Gtk/SourceView/Signals.chs : \ + $(srcdir)/tools/callbackGen/Signal.chs.template \ + $(srcdir)/gtksourceview2/marshal.list \ + $(srcdir)/tools/callbackGen/HookGenerator$(EXEEXT) + $(strip $(srcdir)/tools/callbackGen/HookGenerator$(EXEEXT) \ + $(srcdir)/gtksourceview2/marshal.list \ + $(srcdir)/tools/callbackGen/Signal.chs.template $@ \ + Graphics.UI.Gtk.SourceView.Signals) + +libHSgtksourceview2_a_ALLSOURCES = $(libHSgtksourceview2_a_SOURCES) $(nodist_libHSgtksourceview2_a_SOURCES) + +am_libHSgtksourceview2_a_OBJECTS = \ + $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSgtksourceview2_a_ALLSOURCES)))) + +libHSgtksourceview2_a_HSPPFILES = $(filter %.hs.pp, $(libHSgtksourceview2_a_ALLSOURCES)) +libHSgtksourceview2_a_CHSPPFILES = $(filter %.chs.pp,$(libHSgtksourceview2_a_ALLSOURCES)) +libHSgtksourceview2_a_CHSFILES = \ + $(filter %.chs,$(libHSgtksourceview2_a_ALLSOURCES:.chs.pp=.chs)) +libHSgtksourceview2_a_CHSFILES_HS = $(libHSgtksourceview2_a_CHSFILES:.chs=.hs) +libHSgtksourceview2_a_HSCFILES = $(filter %.hsc, $(libHSgtksourceview2_a_ALLSOURCES)) +libHSgtksourceview2_a_HSCFILES_HS = $(libHSgtksourceview2_a_HSCFILES:.hsc=.hs) +libHSgtksourceview2_a_BUILDSOURCES = \ + $(libHSgtksourceview2_a_HSPPFILES:.hs.pp=.hs) \ + $(libHSgtksourceview2_a_CHSPPFILES:.chs.pp=.chs) \ + $(libHSgtksourceview2_a_CHSFILES_HS) \ + $(libHSgtksourceview2_a_HSCFILES_HS) \ + $(libHSgtksourceview2_a_GENERATEDSOURCES) +libHSgtksourceview2_a_HSFILES = \ + $(filter %.hs,$(libHSgtksourceview2_a_BUILDSOURCES)) \ + $(filter %.hs,$(libHSgtksourceview2_a_ALLSOURCES)) + +nobase_hi_DATA += $(libHSgtksourceview2_a_HSFILES:.hs=.hi) + +gtksourceview2_MOSTLYCLEANFILES = $(am_libHSgtksourceview2_a_OBJECTS) +gtksourceview2_MOSTLYCLEANFILES += $(libHSgtksourceview2_a_HSFILES:.hs=.hi) +gtksourceview2_MOSTLYCLEANFILES += $(libHSgtksourceview2_a_CHSFILES:.chs=.chi) +gtksourceview2_CLEANFILES = $(libHSgtksourceview2_a_BUILDSOURCES) +gtksourceview2_CLEANFILES += $(libHSgtksourceview2_a_CHSFILES_HS:.hs=.dep) + +$(libHSgtksourceview2_a_CHSFILES:.chs=.dep) : \ + $(libHSgtk_a_GENERATEDSOURCES) \ + $(libHSgtksourceview2_a_GENERATEDSOURCES) + +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +-include $(libHSgtksourceview2_a_CHSFILES:.chs=.dep) gtksourceview2/libHSgtksourceview2_a.deps + endif + +if ENABLE_SPLITOBJS +libHSgtksourceview2_a_AR = $(srcdir)/mk/link-splitobjs.sh +gtksourceview2_CLEANFILES_SPLIT = $(libHSgtksourceview2_a_HSFILES:.hs=_split/) +else +libHSgtksourceview2_a_AR = $(AR) $(ARFLAGS) +endif + +libHSgtksourceview2_a_DEPENDENCIES = HSgtksourceview2.o +pkglib_DATA += HSgtksourceview2.o +HSgtksourceview2.o : $(libHSgtksourceview2_a_OBJECTS) + $(LD) -r $(LD_X) -o $@ $(libHSgtksourceview2_a_OBJECTS) $(libHSgtksourceview2_a_LIBADD) + +if ENABLE_PROFILING +libHSgtksourceview2_a_DEPENDENCIES += libHSgtksourceview2_p.a +pkglib_DATA += libHSgtksourceview2_p.a +libHSgtksourceview2_p.a : $(libHSgtksourceview2_a_HSFILES:.hs=.p_o) \ + $(libHSgtksourceview2_a_LIBADD:.o=.p_o) + $(AR) $(ARFLAGS) $@ $^ + +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +-include gtksourceview2/libHSgtksourceview2_a.p_deps + endif + +nobase_hi_DATA += $(libHSgtksourceview2_a_HSFILES:.hs=.p_hi) +gtksourceview2_MOSTLYCLEANFILES += $(libHSgtksourceview2_a_HSFILES:.hs=.p_hi) +gtksourceview2_MOSTLYCLEANFILES += $(libHSgtksourceview2_a_HSFILES:.hs=.p_o) +gtksourceview2_MOSTLYCLEANFILES += $(libHSgtksourceview2_a_LIBADD:.o=.p_o) +endif + +endif #ENABLE_GTKSOURCEVIEW2 + hunk ./Makefile.am 2933 + rm -f $(gtksourceview2_MOSTLYCLEANFILES) hunk ./Makefile.am 2958 + rm -f $(gtksourceview2_CLEANFILES) + rm -rf $(gtksourceview2_CLEANFILES_SPLIT) hunk ./configure.ac 313 +GTKHS_PKG_CHECK(gtksourceview2, gtksourceview2, GTKSOURCEVIEW2, [gtksourceview-2.0 >= 2.0.2], [GLIB GTK], + [build gtksourceview2 package (default=auto)], + [GtkSourceView-2.0 requirement not met. Perhaps you need to install gtksourceview-2.0 or gtksourceview-devel-2.0]) + +dnl Don't build sourceview and gtksourceview2 at the same time +dnl (prefer gtksourceview2 if both are auto) +ENABLE_PKG_DEFAULT_sourceview_save="$ENABLE_PKG_DEFAULT" +if test "$ENABLE_GTKSOURCEVIEW2" = "yes" ; then + ENABLE_PKG_DEFAULT=no +fi hunk ./configure.ac 326 +ENABLE_PKG_DEFAULT="$ENABLE_PKG_DEFAULT_sourceview_save" +if test "$ENABLE_GTKSOURCEVIEW2" = "yes" -a "$ENABLE_SOURCEVIEW" = "yes" ; then + AC_ERROR([The sourceview and gtksourceview2 packages cannot be enabled simultaneously. + If you want to build sourceview, you must use --disable-gtksourceview2.]) +fi hunk ./configure.ac 429 + GTKHS_GLIBC_PTHREAD_HACK(GTKSOURCEVIEW2_LIBS) hunk ./configure.ac 581 +GTKHS_PACKAGE_FILTER_CFLAGS([GTKSOURCEVIEW2_CFLAGS], [$GLIB_CFLAGS $GTK_CFLAGS], [$GTKSOURCEVIEW2_CFLAGS]) +GTKHS_PACKAGE_FILTER_LIBS([GTKSOURCEVIEW2_LIBS], [$GLIB_LIBS $GTK_LIBS], [$GTKSOURCEVIEW2_LIBS]) + hunk ./configure.ac 648 +GTKHS_REFORMAT_PACKAGE_CFLAGS(GTKSOURCEVIEW2_CFLAGS, GTKSOURCEVIEW2_CFLAGS_CQ) +GTKHS_REFORMAT_PACKAGE_LIBS(GTKSOURCEVIEW2_LIBS, GTKSOURCEVIEW2_LIBS_CQ, + GTKSOURCEVIEW2_LIBDIR_CQ, GTKSOURCEVIEW2_LIBEXTRA_CQ) +AC_SUBST(GTKSOURCEVIEW2_CFLAGS_CQ) +AC_SUBST(GTKSOURCEVIEW2_LIBS_CQ) +AC_SUBST(GTKSOURCEVIEW2_LIBDIR_CQ) +AC_SUBST(GTKSOURCEVIEW2_LIBEXTRA_CQ) + hunk ./configure.ac 890 - glib/glib.package.conf glib/glib.cabal - gtk/gtk.package.conf gtk/gtk.cabal - gio/gio.package.conf gio/gio.cabal - glade/glade.package.conf glade/glade.cabal - gconf/gconf.package.conf gconf/gconf.cabal - sourceview/sourceview.package.conf sourceview/sourceview.cabal - mozembed/mozembed.package.conf mozembed/mozembed.cabal - cairo/cairo.package.conf cairo/cairo.cabal - svgcairo/svgcairo.package.conf svgcairo/svgcairo.cabal - gtkglext/gtkglext.package.conf gtkglext/gtkglext.cabal - soegtk/soegtk.package.conf soegtk/soegtk.cabal - gnomevfs/gnomevfs.package.conf gnomevfs/gnomevfs.cabal - gstreamer/gstreamer.package.conf gstreamer/gstreamer.cabal + glib/glib.package.conf glib/glib.cabal + gtk/gtk.package.conf gtk/gtk.cabal + gio/gio.package.conf gio/gio.cabal + glade/glade.package.conf glade/glade.cabal + gconf/gconf.package.conf gconf/gconf.cabal + sourceview/sourceview.package.conf sourceview/sourceview.cabal + gtksourceview2/gtksourceview2.package.conf gtksourceview2/gtksourceview2.cabal + mozembed/mozembed.package.conf mozembed/mozembed.cabal + cairo/cairo.package.conf cairo/cairo.cabal + svgcairo/svgcairo.package.conf svgcairo/svgcairo.cabal + gtkglext/gtkglext.package.conf gtkglext/gtkglext.cabal + soegtk/soegtk.package.conf soegtk/soegtk.cabal + gnomevfs/gnomevfs.package.conf gnomevfs/gnomevfs.cabal + gstreamer/gstreamer.package.conf gstreamer/gstreamer.cabal hunk ./configure.ac 914 -echo "* glib : yes " -echo "* gtk : ${ENABLE_GTK} " -echo "* gio : ${ENABLE_GIO} " -echo "* glade : ${ENABLE_LIBGLADE} " -echo "* cairo : ${ENABLE_CAIRO} " -echo "* svgcairo : ${ENABLE_SVGCAIRO} " -echo "* gtkglext : ${ENABLE_GTKGLEXT} " -echo "* gconf : ${ENABLE_GCONF} " -echo "* sourceview : ${ENABLE_SOURCEVIEW} " -echo "* mozembed : ${ENABLE_MOZEMBED} " -echo "* soegtk : ${ENABLE_GTK} " -echo "* gnomevfs : ${ENABLE_GNOMEVFS} " -echo "* gstreamer : ${ENABLE_GSTREAMER} " -echo "* documentation : ${BUILDDOCS} " +echo "* glib : yes " +echo "* gtk : ${ENABLE_GTK} " +echo "* gio : ${ENABLE_GIO} " +echo "* glade : ${ENABLE_LIBGLADE} " +echo "* cairo : ${ENABLE_CAIRO} " +echo "* svgcairo : ${ENABLE_SVGCAIRO} " +echo "* gtkglext : ${ENABLE_GTKGLEXT} " +echo "* gconf : ${ENABLE_GCONF} " +echo "* sourceview : ${ENABLE_SOURCEVIEW} " +echo "* gtksourceview2 : ${ENABLE_GTKSOURCEVIEW2} " +echo "* mozembed : ${ENABLE_MOZEMBED} " +echo "* soegtk : ${ENABLE_GTK} " +echo "* gnomevfs : ${ENABLE_GNOMEVFS} " +echo "* gstreamer : ${ENABLE_GSTREAMER} " +echo "* documentation : ${BUILDDOCS} " adddir ./gtksourceview2 adddir ./gtksourceview2/Graphics adddir ./gtksourceview2/Graphics/UI adddir ./gtksourceview2/Graphics/UI/Gtk adddir ./gtksourceview2/Graphics/UI/Gtk/SourceView addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView.hs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView.hs 1 +module Graphics.UI.Gtk.SourceView ( + module Graphics.UI.Gtk.SourceView.SourceBuffer, + module Graphics.UI.Gtk.SourceView.SourceIter, + module Graphics.UI.Gtk.SourceView.SourceLanguage, + module Graphics.UI.Gtk.SourceView.SourceLanguageManager, + module Graphics.UI.Gtk.SourceView.SourceStyle, + module Graphics.UI.Gtk.SourceView.SourceStyleScheme, + module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager, + module Graphics.UI.Gtk.SourceView.SourceView + ) where + +import Graphics.UI.Gtk.SourceView.SourceBuffer +import Graphics.UI.Gtk.SourceView.SourceIter +import Graphics.UI.Gtk.SourceView.SourceLanguage +import Graphics.UI.Gtk.SourceView.SourceLanguageManager +import Graphics.UI.Gtk.SourceView.SourceStyle +import Graphics.UI.Gtk.SourceView.SourceStyleScheme +import Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager +import Graphics.UI.Gtk.SourceView.SourceView addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceBuffer.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceBuffer.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) SourceBuffer +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2003-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceBuffer ( + SourceBuffer, + SourceBufferClass, + castToSourceBuffer, + sourceBufferNew, + sourceBufferNewWithLanguage, + sourceBufferSetHighlightSyntax, + sourceBufferGetHighlightSyntax, + sourceBufferSetLanguage, + sourceBufferGetLanguage, + sourceBufferSetHighlightMatchingBrackets, + sourceBufferGetHighlightMatchingBrackets, + sourceBufferSetStyleScheme, + sourceBufferGetStyleScheme, + sourceBufferSetMaxUndoLevels, + sourceBufferGetMaxUndoLevels, + sourceBufferGetCanUndo, + sourceBufferGetCanRedo, + sourceBufferUndo, + sourceBufferRedo, + sourceBufferBeginNotUndoableAction, + sourceBufferEndNotUndoableAction, + sourceBufferEnsureHighlight, + sourceBufferCanRedo, + sourceBufferCanUndo, + sourceBufferHighlightMatchingBrackets, + sourceBufferHighlightSyntax, + sourceBufferLanguage, + sourceBufferSourceStyleScheme, + sourceBufferHighlightUpdated + ) where + +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) + +import System.Glib.FFI +import System.Glib.GObject (constructNewGObject, + makeNewGObject) +{#import System.Glib.Properties#} +import System.Glib.Attributes +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.Signals#} +{#import Graphics.UI.Gtk.Multiline.Types#} +{#import Graphics.UI.Gtk.Multiline.TextIter#} + +{# context lib="gtk" prefix="gtk" #} + +-- methods + +-- | Create a new 'SourceBuffer', possibly +-- taking a 'TextTagTable'. +-- +sourceBufferNew :: Maybe TextTagTable -> IO SourceBuffer +sourceBufferNew tt = constructNewGObject mkSourceBuffer $ + {#call unsafe source_buffer_new#} [_$_] + (fromMaybe (mkTextTagTable nullForeignPtr) tt) + +-- | Create a new 'SourceBuffer' +-- with a 'SourceLanguage'. +-- +sourceBufferNewWithLanguage :: SourceLanguage -> IO SourceBuffer +sourceBufferNewWithLanguage lang = constructNewGObject mkSourceBuffer $ + {#call unsafe source_buffer_new_with_language#} lang + +-- | [_$_] +-- +sourceBufferSetHighlightSyntax :: SourceBuffer -> Bool -> IO () +sourceBufferSetHighlightSyntax sb newVal = + {#call unsafe source_buffer_set_highlight_syntax#} sb (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceBufferGetHighlightSyntax :: SourceBuffer -> IO Bool [_$_] +sourceBufferGetHighlightSyntax sb = liftM toBool $ + {#call unsafe source_buffer_get_highlight_syntax#} sb + +-- | [_$_] +-- +sourceBufferSetLanguage :: SourceBuffer -> SourceLanguage -> IO () +sourceBufferSetLanguage sb lang = + {#call unsafe source_buffer_set_language#} sb lang + [_$_] +-- | [_$_] +-- +sourceBufferGetLanguage :: SourceBuffer -> IO SourceLanguage +sourceBufferGetLanguage sb = makeNewGObject mkSourceLanguage $ + {#call unsafe source_buffer_get_language#} sb + +-- | [_$_] +-- +sourceBufferSetHighlightMatchingBrackets :: SourceBuffer -> Bool -> IO () +sourceBufferSetHighlightMatchingBrackets sb newVal = + {#call unsafe source_buffer_set_highlight_matching_brackets#} sb (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceBufferGetHighlightMatchingBrackets :: SourceBuffer -> IO Bool [_$_] +sourceBufferGetHighlightMatchingBrackets sb = liftM toBool $ + {#call unsafe source_buffer_get_highlight_matching_brackets#} sb + +-- | +-- [_$_] +sourceBufferSetStyleScheme :: SourceBuffer -> SourceStyleScheme -> IO () +sourceBufferSetStyleScheme sb sss = + {#call unsafe source_buffer_set_style_scheme#} sb sss + +-- | +-- [_$_] +sourceBufferGetStyleScheme :: SourceBuffer -> IO SourceStyleScheme +sourceBufferGetStyleScheme sb = makeNewGObject mkSourceStyleScheme $ + {#call unsafe source_buffer_get_style_scheme#} sb + +-- | [_$_] +-- +sourceBufferSetMaxUndoLevels :: SourceBuffer -> Int -> IO () +sourceBufferSetMaxUndoLevels sb newVal = + {#call unsafe source_buffer_set_max_undo_levels#} sb (fromIntegral newVal) + [_$_] +-- | [_$_] +-- +sourceBufferGetMaxUndoLevels :: SourceBuffer -> IO Int +sourceBufferGetMaxUndoLevels sb = liftM fromIntegral $ + {#call unsafe source_buffer_get_max_undo_levels#} sb + +-- | [_$_] +-- +sourceBufferGetCanUndo :: SourceBuffer -> IO Bool +sourceBufferGetCanUndo sb = liftM toBool $ + {#call unsafe source_buffer_can_undo#} sb + [_$_] +-- | [_$_] +-- +sourceBufferGetCanRedo :: SourceBuffer -> IO Bool +sourceBufferGetCanRedo sb = liftM toBool $ + {#call unsafe source_buffer_can_redo#} sb + +-- | [_$_] +-- +sourceBufferUndo :: SourceBuffer -> IO () +sourceBufferUndo sb = + {#call source_buffer_undo#} sb + [_$_] +-- | [_$_] +-- +sourceBufferRedo :: SourceBuffer -> IO () +sourceBufferRedo sb = + {#call source_buffer_redo#} sb + +-- | [_$_] +-- +sourceBufferBeginNotUndoableAction :: SourceBuffer -> IO () +sourceBufferBeginNotUndoableAction sb = + {#call source_buffer_begin_not_undoable_action#} sb + [_$_] +-- | [_$_] +-- +sourceBufferEndNotUndoableAction :: SourceBuffer -> IO () +sourceBufferEndNotUndoableAction sb = + {#call source_buffer_end_not_undoable_action#} sb + +-- | +-- [_$_] +sourceBufferEnsureHighlight :: SourceBuffer -> TextIter -> TextIter -> IO () +sourceBufferEnsureHighlight sb start end = + {#call source_buffer_ensure_highlight#} sb start end + +-- | +-- [_$_] +sourceBufferCanRedo :: ReadAttr SourceBuffer Bool +sourceBufferCanRedo = readAttrFromBoolProperty "can-redo" + +-- | +-- [_$_] +sourceBufferCanUndo :: ReadAttr SourceBuffer Bool +sourceBufferCanUndo = readAttrFromBoolProperty "can-redo" + +-- | +-- +sourceBufferHighlightMatchingBrackets :: Attr SourceBuffer Bool +sourceBufferHighlightMatchingBrackets = newAttrFromBoolProperty "highlight-matching-brackets" + +-- | +-- +sourceBufferHighlightSyntax :: Attr SourceBuffer Bool +sourceBufferHighlightSyntax = newAttrFromBoolProperty "highlight-matching-brackets" + +-- | +-- [_$_] +sourceBufferLanguage :: Attr SourceBuffer (Maybe SourceLanguage) +sourceBufferLanguage = newAttrFromMaybeObjectProperty "language" gTypeSourceLanguage + +-- | +-- +sourceBufferMaxUndoLevels :: Attr SourceBuffer Int +sourceBufferMaxUndoLevels = newAttrFromIntProperty "max-undo-levels" + +-- | +-- [_$_] +sourceBufferSourceStyleScheme :: Attr SourceBuffer (Maybe SourceStyleScheme) +sourceBufferSourceStyleScheme = newAttrFromMaybeObjectProperty "style-scheme" gTypeSourceStyleScheme + +-- | +-- +sourceBufferHighlightUpdated :: Signal SourceBuffer (TextIter -> TextIter -> IO ()) +sourceBufferHighlightUpdated = Signal $ connect_BOXED_BOXED__NONE "highlight-updated" mkTextIterCopy mkTextIterCopy addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceIter.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceIter.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) SourceIter +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Adds extra useful methods for "TextIter" for searching forwards and +-- backwards within a region in the buffer and matching brackets. +-- +-- * There is no SourceIter object, just extra methods for "TextIter" +-- +module Graphics.UI.Gtk.SourceView.SourceIter ( + SourceSearchFlags(..), + sourceIterForwardSearch, + sourceIterBackwardSearch, +) where + +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) + +import System.Glib.FFI +import System.Glib.Flags (Flags, fromFlags) +import System.Glib.UTFString +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.Multiline.Types#} +{#import Graphics.UI.Gtk.Multiline.TextIter#} + +{# context lib="gtk" prefix="gtk" #} + +{# enum SourceSearchFlags {underscoreToCase} deriving(Eq,Bounded,Show,Read) #} + +instance Flags SourceSearchFlags + +-- methods + +-- | same as 'textIterForwardSearch' but allows +-- case insensitive search and possibly in the future regular expressions. +-- +sourceIterForwardSearch :: TextIter -> String -> [SourceSearchFlags] -> [_$_] + Maybe TextIter -> IO (Maybe (TextIter, TextIter)) +sourceIterForwardSearch ti str flags limit = do + start <- makeEmptyTextIter + end <- makeEmptyTextIter + found <- liftM toBool $ withUTFString str $ \cStr -> + {#call unsafe source_iter_forward_search#} ti cStr + ((fromIntegral.fromFlags) flags) start end + (fromMaybe (TextIter nullForeignPtr) limit) + return $ if found then Just (start,end) else Nothing + +-- | same as 'textIterForwardSearch' but allows +-- case insensitive search and possibly in the future regular expressions. +-- +sourceIterBackwardSearch :: TextIter -> String -> [SourceSearchFlags] -> [_$_] + Maybe TextIter -> IO (Maybe (TextIter, TextIter)) +sourceIterBackwardSearch ti str flags limit = do + start <- makeEmptyTextIter + end <- makeEmptyTextIter + found <- liftM toBool $ withUTFString str $ \cStr -> + {#call unsafe source_iter_backward_search#} ti cStr + ((fromIntegral.fromFlags) flags) start end + (fromMaybe (TextIter nullForeignPtr) limit) + return $ if found then Just (start,end) else Nothing addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguage.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguage.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceLanguage ( + SourceLanguage, + SourceLanguageClass, + castToSourceLanguage, + sourceLanguageGetId, + sourceLanguageGetName, + sourceLanguageGetSection, + sourceLanguageGetHidden, + sourceLanguageGetMetadata, + sourceLanguageGetMimeTypes, + sourceLanguageGetGlobs, + sourceLanguageHidden, + sourceLanguageId, + sourceLanguageName, + sourceLanguageSection + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +{#import System.Glib.Properties#} +import System.Glib.Attributes +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.Signals#} +import Graphics.UI.Gtk.SourceView.SourceStyleScheme + +{# context lib="gtk" prefix="gtk" #} + + +-- methods + +-- | [_$_] +-- +sourceLanguageGetId :: SourceLanguage -> IO String +sourceLanguageGetId sl = + {#call unsafe source_language_get_id#} sl >>= peekUTFString + +-- | [_$_] +-- +sourceLanguageGetName :: SourceLanguage -> IO String +sourceLanguageGetName sl = + {#call unsafe source_language_get_name#} sl >>= peekUTFString + +-- | [_$_] +-- +sourceLanguageGetSection :: SourceLanguage -> IO String +sourceLanguageGetSection sl = + {#call unsafe source_language_get_section#} sl >>= peekUTFString + +-- | +-- +sourceLanguageGetHidden :: SourceLanguage -> IO Bool +sourceLanguageGetHidden sl = liftM toBool $ + {#call unsafe source_language_get_hidden#} sl + +-- | +-- +sourceLanguageGetMetadata :: SourceLanguage -> String -> IO String +sourceLanguageGetMetadata sl name = do + withUTFString name ({#call unsafe source_language_get_metadata#} sl) >>= peekUTFString + +-- | +-- +sourceLanguageGetMimeTypes :: SourceLanguage -> IO [String] +sourceLanguageGetMimeTypes sl = do + mimeTypesArray <- {#call unsafe source_language_get_mime_types#} sl + mimeTypes <- peekUTFStringArray0 mimeTypesArray + {# call g_strfreev #} mimeTypesArray + return mimeTypes + +-- | +-- +sourceLanguageGetGlobs :: SourceLanguage -> IO [String] +sourceLanguageGetGlobs sl = do + globsArray <- {#call unsafe source_language_get_globs#} sl + globs <- peekUTFStringArray0 globsArray + {# call g_strfreev #} globsArray + return globs + +-- | +-- +sourceLanguageHidden :: ReadAttr SourceLanguage Bool +sourceLanguageHidden = readAttrFromBoolProperty "hidden" + +-- | +-- +sourceLanguageId :: ReadAttr SourceLanguage String +sourceLanguageId = readAttrFromStringProperty "id" + +-- | +-- +sourceLanguageName :: ReadAttr SourceLanguage String +sourceLanguageName = readAttrFromStringProperty "name" + +-- | +-- +sourceLanguageSection :: ReadAttr SourceLanguage String +sourceLanguageSection = readAttrFromStringProperty "section" addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceLanguageManager ( + SourceLanguageManager, + SourceLanguageManagerClass, + castToSourceLanguageManager, + sourceLanguageManagerNew, + sourceLanguageManagerGetDefault, + sourceLanguageManagerSetSearchPath, + sourceLanguageManagerGetSearchPath, + sourceLanguageManagerGetLanguageIds, + sourceLanguageManagerGetLanguage, + ) where + +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) + +import System.Glib.FFI +import System.Glib.GObject (constructNewGObject, makeNewGObject) +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #} + +-- | +-- +sourceLanguageManagerNew :: IO SourceLanguageManager +sourceLanguageManagerNew = constructNewGObject mkSourceLanguageManager $ liftM castPtr + {#call unsafe source_language_manager_new#} + +-- | +-- +sourceLanguageManagerGetDefault :: IO SourceLanguageManager +sourceLanguageManagerGetDefault = makeNewGObject mkSourceLanguageManager $ liftM castPtr + {#call unsafe source_language_manager_new#} + +-- | +-- +sourceLanguageManagerSetSearchPath :: SourceLanguageManager -> Maybe [String] -> IO () +sourceLanguageManagerSetSearchPath slm dirs = + maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do + {#call unsafe source_language_manager_set_search_path#} slm dirsPtr + +-- | +-- +sourceLanguageManagerGetSearchPath :: SourceLanguageManager -> IO [String] +sourceLanguageManagerGetSearchPath slm = do + dirsPtr <- {#call unsafe source_language_manager_get_search_path#} slm + peekUTFStringArray0 dirsPtr + +-- | +-- +sourceLanguageManagerGetLanguageIds :: SourceLanguageManager -> IO [String] +sourceLanguageManagerGetLanguageIds slm = do + idsPtr <- {#call unsafe source_language_manager_get_language_ids#} slm + liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr + +-- | +-- +sourceLanguageManagerGetLanguage :: SourceLanguageManager -> String -> IO SourceLanguage +sourceLanguageManagerGetLanguage slm id = makeNewGObject mkSourceLanguage $ liftM castPtr $ + withUTFString id ({#call unsafe source_language_manager_get_language#} slm) + +-- | +-- +sourceLanguageManagerLanguageIds :: ReadAttr SourceLanguageManager [String] +sourceLanguageManagerLanguageIds = + readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr) + "language-ids" {#call pure g_strv_get_type#} + +-- | +-- +sourceLanguageManagerSearchPath :: ReadWriteAttr SourceLanguageManager [String] (Maybe [String]) +sourceLanguageManagerSearchPath = + newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path") + (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path") + where gtype = {#call pure g_strv_get_type#} adddir ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle.hs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle.hs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceStyle ( + SourceStyle(..), + ) where + +data SourceStyle = + SourceStyle + { sourceStyleBackground :: Maybe String + , sourceStyleBold :: Maybe Bool + , sourceStyleForeground :: Maybe String + , sourceStyleItalic :: Maybe Bool + , sourceStyleLineBackground :: Maybe String + , sourceStyleStrikethrough :: Maybe Bool + , sourceStyleUnderline :: Maybe Bool + } addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs 1 +{-# OPTIONS_HADDOCK hide #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- #hide +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +module Graphics.UI.Gtk.SourceView.SourceStyle.Internal ( + sourceStyleFromObject, + sourceStyleToObject + ) where + +import Control.Monad (liftM, sequence) +import Data.Maybe (catMaybes) + +import System.Glib.FFI +{#import System.Glib.GObject#} (constructNewGObject) +import System.Glib.GType (GType) +import qualified System.Glib.GTypeConstants as GType +import System.Glib.GValue (GValue, valueInit, allocaGValue) +import System.Glib.GValueTypes (valueSetString, valueSetBool) +{#import System.Glib.Properties#} +{#import Graphics.UI.Gtk.SourceView.Types#} +import Graphics.UI.Gtk.SourceView.SourceStyle + +{# context lib="gtk" prefix="gtk" #} + +sourceStyleFromObject :: SourceStyleObject -> IO SourceStyle +sourceStyleFromObject obj = do + background <- objectGetPropertyMaybeString "background" obj + backgroundSet <- objectGetPropertyBool "background-set" obj + bold <- objectGetPropertyBool "bold" obj + boldSet <- objectGetPropertyBool "bold-set" obj + foreground <- objectGetPropertyMaybeString "foreground" obj + foregroundSet <- objectGetPropertyBool "foreground-set" obj + italic <- objectGetPropertyBool "italic" obj + italicSet <- objectGetPropertyBool "italic-set" obj + lineBackground <- objectGetPropertyMaybeString "line-background" obj + lineBackgroundSet <- objectGetPropertyBool "line-background-set" obj + strikethrough <- objectGetPropertyBool "strikethrough" obj + strikethroughSet <- objectGetPropertyBool "strikethrough-set" obj + underline <- objectGetPropertyBool "underline" obj + underlineSet <- objectGetPropertyBool "underline-set" obj + return $ SourceStyle + { sourceStyleBackground = if backgroundSet then background else Nothing + , sourceStyleBold = if boldSet then Just bold else Nothing + , sourceStyleForeground = if foregroundSet then foreground else Nothing + , sourceStyleItalic = if italicSet then Just italic else Nothing + , sourceStyleLineBackground = if lineBackgroundSet then lineBackground else Nothing + , sourceStyleStrikethrough = if strikethroughSet then Just strikethrough else Nothing + , sourceStyleUnderline = if underlineSet then Just underline else Nothing + } + +sourceStyleToObject :: SourceStyle -> IO SourceStyleObject +sourceStyleToObject ss = + allocaGValue $ \backgroundV -> + allocaGValue $ \backgroundSetV -> + allocaGValue $ \boldV -> + allocaGValue $ \boldSetV -> + allocaGValue $ \foregroundV -> + allocaGValue $ \foregroundSetV -> + allocaGValue $ \italicV -> + allocaGValue $ \italicSetV -> + allocaGValue $ \lineBackgroundV -> + allocaGValue $ \lineBackgroundSetV -> + allocaGValue $ \strikethroughV -> + allocaGValue $ \strikethroughSetV -> + allocaGValue $ \underlineV -> + allocaGValue $ \underlineSetV -> do + params <- liftM concat . sequence $ + [ makeParam "background" sourceStyleBackground backgroundSetV backgroundV GType.string valueSetString + , makeParam "bold" sourceStyleBold boldSetV boldV GType.bool valueSetBool + , makeParam "foreground" sourceStyleForeground foregroundSetV foregroundV GType.string valueSetString + , makeParam "italic" sourceStyleItalic italicSetV italicV GType.bool valueSetBool + , makeParam "line-background" sourceStyleLineBackground lineBackgroundSetV lineBackgroundV GType.string valueSetString + , makeParam "strikethrough" sourceStyleStrikethrough strikethroughSetV strikethroughV GType.bool valueSetBool + , makeParam "underline" sourceStyleUnderline underlineSetV underlineV GType.bool valueSetBool + ] + constructNewGObject mkSourceStyleObject (liftM castPtr $ objectNew gTypeSourceStyleObject params) + where makeParam name field setV v gtype valueSet = do + valueInit setV GType.bool + case field ss of + Just field' -> do + valueSetBool setV True + valueInit v gtype + valueSet v field' + return [(name ++ "-set", setV), (name, v)] + Nothing -> do + valueSetBool setV False + return [(name ++ "-set", setV)] addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) SourceStyleScheme +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceStyleScheme ( + SourceStyleScheme, + castToSourceStyleScheme, + sourceStyleSchemeGetId, + sourceStyleSchemeGetName, + sourceStyleSchemeGetDescription, + sourceStyleSchemeGetAuthors, + sourceStyleSchemeGetFilename, + sourceStyleSchemeGetStyle, + sourceStyleSchemeDescription, + sourceStyleSchemeFilename, + sourceStyleSchemeId, + sourceStyleSchemeName, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject) +import System.Glib.Attributes +{#import System.Glib.Properties#} +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.SourceView.Types#} +import Graphics.UI.Gtk.SourceView.SourceStyle +{#import Graphics.UI.Gtk.SourceView.SourceStyle.Internal#} + +{# context lib="gtk" prefix="gtk" #} + +-- methods + +-- | [_$_] +-- [_$_] +sourceStyleSchemeGetId :: SourceStyleScheme -> IO String +sourceStyleSchemeGetId ss = + {#call source_style_scheme_get_id#} ss >>= peekUTFString + +-- | [_$_] +-- [_$_] +sourceStyleSchemeGetName :: SourceStyleScheme -> IO String +sourceStyleSchemeGetName ss = + {#call source_style_scheme_get_name#} ss >>= peekUTFString + +-- | [_$_] +-- [_$_] +sourceStyleSchemeGetDescription :: SourceStyleScheme -> IO String +sourceStyleSchemeGetDescription ss = + {#call source_style_scheme_get_description#} ss >>= peekUTFString + +-- | +-- +sourceStyleSchemeGetAuthors :: SourceStyleScheme -> IO [String] +sourceStyleSchemeGetAuthors ss = + {#call source_style_scheme_get_authors#} ss >>= peekUTFStringArray0 + +-- | [_$_] +-- [_$_] +sourceStyleSchemeGetFilename :: SourceStyleScheme -> IO String +sourceStyleSchemeGetFilename ss = + {#call source_style_scheme_get_filename#} ss >>= peekUTFString + +-- | [_$_] +-- [_$_] +sourceStyleSchemeGetStyle :: SourceStyleScheme -> String -> IO SourceStyle +sourceStyleSchemeGetStyle ss id = do + styleObj <- makeNewGObject mkSourceStyleObject $ + withUTFString id ({#call source_style_scheme_get_style#} ss) + sourceStyleFromObject styleObj + +-- | +-- +sourceStyleSchemeDescription :: ReadAttr SourceStyleScheme String +sourceStyleSchemeDescription = readAttrFromStringProperty "description" + +-- | +-- +sourceStyleSchemeFilename :: ReadAttr SourceStyleScheme FilePath +sourceStyleSchemeFilename = readAttrFromStringProperty "filename" + +-- | +-- +sourceStyleSchemeId :: ReadAttr SourceStyleScheme String +sourceStyleSchemeId = readAttrFromStringProperty "id" + +-- | +-- +sourceStyleSchemeName :: ReadAttr SourceStyleScheme String +sourceStyleSchemeName = readAttrFromStringProperty "name" addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager ( + SourceStyleSchemeManager, + SourceStyleSchemeManagerClass, + sourceStyleSchemeManagerNew, + sourceStyleSchemeManagerGetDefault, + sourceStyleSchemeManagerSetSearchPath, + sourceStyleSchemeManagerAppendSearchPath, + sourceStyleSchemeManagerPrependSearchPath, + sourceStyleSchemeManagerGetSearchPath, + sourceStyleSchemeManagerGetSchemeIds, + sourceStyleSchemeManagerGetScheme, + sourceStyleSchemeManagerForceRescan, + sourceStyleSchemeManagerStyleIds, + sourceStyleSchemeManagerSearchPath + ) where + +{# context lib="gtk" prefix="gtk" #} + +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) + +import System.Glib.FFI +import System.Glib.GObject (constructNewGObject, makeNewGObject) +import System.Glib.UTFString +import System.Glib.Attributes +{#import System.Glib.Properties#} +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.SourceView.SourceStyleScheme#} + +-- | +-- +sourceStyleSchemeManagerNew :: IO SourceStyleSchemeManager +sourceStyleSchemeManagerNew = constructNewGObject mkSourceStyleSchemeManager $ liftM castPtr + {#call unsafe source_style_scheme_manager_new#} + +-- | +-- +sourceStyleSchemeManagerGetDefault :: IO SourceStyleSchemeManager +sourceStyleSchemeManagerGetDefault = makeNewGObject mkSourceStyleSchemeManager $ liftM castPtr + {#call unsafe source_style_scheme_manager_get_default#} + +-- | +-- +sourceStyleSchemeManagerSetSearchPath :: SourceStyleSchemeManager -> Maybe [String] -> IO () +sourceStyleSchemeManagerSetSearchPath ssm dirs = + maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do + {#call unsafe source_style_scheme_manager_set_search_path#} ssm dirsPtr + +-- | +-- +sourceStyleSchemeManagerAppendSearchPath :: SourceStyleSchemeManager -> String -> IO () +sourceStyleSchemeManagerAppendSearchPath ssm dir = + withUTFString dir $ {#call unsafe source_style_scheme_manager_append_search_path#} ssm + +-- | +-- +sourceStyleSchemeManagerPrependSearchPath :: SourceStyleSchemeManager -> String -> IO () +sourceStyleSchemeManagerPrependSearchPath ssm dir = + withUTFString dir $ {#call unsafe source_style_scheme_manager_prepend_search_path#} ssm + +-- | +-- +sourceStyleSchemeManagerGetSearchPath :: SourceStyleSchemeManager -> IO [String] +sourceStyleSchemeManagerGetSearchPath ssm = do + dirsPtr <- {#call unsafe source_style_scheme_manager_get_search_path#} ssm + peekUTFStringArray0 dirsPtr + +-- | +-- +sourceStyleSchemeManagerGetSchemeIds :: SourceStyleSchemeManager -> IO [String] +sourceStyleSchemeManagerGetSchemeIds ssm = do + idsPtr <- {#call unsafe source_style_scheme_manager_get_scheme_ids#} ssm + liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr + +-- | +-- +sourceStyleSchemeManagerGetScheme :: SourceStyleSchemeManager -> String -> IO SourceStyleScheme +sourceStyleSchemeManagerGetScheme ssm id = makeNewGObject mkSourceStyleScheme $ + withUTFString id $ {#call unsafe source_style_scheme_manager_get_scheme#} ssm + +-- | +-- +sourceStyleSchemeManagerForceRescan :: SourceStyleSchemeManager -> IO () +sourceStyleSchemeManagerForceRescan = + {#call unsafe source_style_scheme_manager_force_rescan#} + +-- | +-- +sourceStyleSchemeManagerStyleIds :: ReadAttr SourceStyleSchemeManager [String] +sourceStyleSchemeManagerStyleIds = + readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr) + "style-ids" {#call pure g_strv_get_type#} + +-- | +-- +sourceStyleSchemeManagerSearchPath :: ReadWriteAttr SourceStyleSchemeManager [String] (Maybe [String]) +sourceStyleSchemeManagerSearchPath = + newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path") + (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path") + where gtype = {#call pure g_strv_get_type#} addfile ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceView.chs hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceView.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget SourceView +-- +-- Author : Peter Gavin +-- derived from sourceview bindings by Axel Simon and Duncan Coutts +-- +-- Created: 18 December 2008 +-- +-- Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.SourceView.SourceView ( + SourceView, + SourceViewClass, + SourceSmartHomeEndType(..), + castToSourceView, + sourceViewNew, + sourceViewNewWithBuffer, + sourceViewSetAutoIndent, + sourceViewGetAutoIndent, + sourceViewSetIndentOnTab, + sourceViewGetIndentOnTab, + sourceViewSetIndentWidth, + sourceViewGetIndentWidth, + sourceViewSetInsertSpacesInsteadOfTabs, + sourceViewGetInsertSpacesInsteadOfTabs, + sourceViewSetSmartHomeEnd, + sourceViewGetSmartHomeEnd, + sourceViewSetHighlightCurrentLine, + sourceViewGetHighlightCurrentLine, + sourceViewSetShowLineNumbers, + sourceViewGetShowLineNumbers, + sourceViewSetShowRightMargin, + sourceViewGetShowRightMargin, + sourceViewSetRightMarginPosition, + sourceViewGetRightMarginPosition, + sourceViewSetTabWidth, + sourceViewGetTabWidth, + sourceViewAutoIndent, + sourceViewHighlightCurrentLine, + sourceViewIndentOnTab, + sourceViewIndentWidth, + sourceViewInsertSpacesInsteadOfTabs, + sourceViewRightMarginPosition, + sourceViewShowLineNumbers, + sourceViewShowRightMargin, + sourceViewSmartHomeEnd, + sourceViewTabWidth, + sourceViewUndo, + sourceViewRedo + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import System.Glib.Properties#} +import System.Glib.Attributes +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.SourceView.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #} + +-- | Create a new 'SourceView' widget with a default 'SourceBuffer'. +-- +sourceViewNew :: IO SourceView +sourceViewNew = makeNewObject mkSourceView $ liftM castPtr + {#call unsafe source_view_new#} + +-- | Create a new 'SourceView' +-- widget with the given 'SourceBuffer'. +-- +sourceViewNewWithBuffer :: SourceBuffer -> IO SourceView +sourceViewNewWithBuffer sb = makeNewObject mkSourceView $ liftM castPtr $ + {#call source_view_new_with_buffer#} sb + +-- | [_$_] +-- +sourceViewSetAutoIndent :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetAutoIndent sv newVal = + {#call source_view_set_auto_indent#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetAutoIndent :: SourceViewClass sv => sv -> IO Bool [_$_] +sourceViewGetAutoIndent sv = liftM toBool $ + {#call unsafe source_view_get_auto_indent#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetIndentOnTab :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetIndentOnTab sv newVal = + {#call source_view_set_indent_on_tab#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetIndentOnTab :: SourceViewClass sv => sv -> IO Bool [_$_] +sourceViewGetIndentOnTab sv = liftM toBool $ + {#call unsafe source_view_get_indent_on_tab#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetIndentWidth :: SourceViewClass sv => sv -> Int -> IO () +sourceViewSetIndentWidth sv newVal = + {#call source_view_set_indent_width#} (toSourceView sv) (fromIntegral newVal) + +-- | [_$_] +-- +sourceViewGetIndentWidth :: SourceViewClass sv => sv -> IO Int +sourceViewGetIndentWidth sv = liftM fromIntegral $ + {#call unsafe source_view_get_indent_width#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetInsertSpacesInsteadOfTabs sv newVal = + {#call source_view_set_insert_spaces_instead_of_tabs#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> IO Bool [_$_] +sourceViewGetInsertSpacesInsteadOfTabs sv = liftM toBool $ + {#call unsafe source_view_get_insert_spaces_instead_of_tabs#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetSmartHomeEnd :: SourceViewClass sv => sv -> SourceSmartHomeEndType -> IO () +sourceViewSetSmartHomeEnd sv newVal = + {#call source_view_set_smart_home_end#} (toSourceView sv) (fromIntegral $ fromEnum newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetSmartHomeEnd :: SourceViewClass sv => sv -> IO SourceSmartHomeEndType +sourceViewGetSmartHomeEnd sv = liftM (toEnum . fromIntegral) $ + {#call unsafe source_view_get_smart_home_end#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetHighlightCurrentLine :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetHighlightCurrentLine sv newVal = + {#call source_view_set_highlight_current_line#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetHighlightCurrentLine :: SourceViewClass sv => sv -> IO Bool [_$_] +sourceViewGetHighlightCurrentLine sv = liftM toBool $ + {#call unsafe source_view_get_highlight_current_line#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetShowLineNumbers :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetShowLineNumbers sv newVal = + {#call source_view_set_show_line_numbers#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetShowLineNumbers :: SourceViewClass sv => sv -> IO Bool [_$_] +sourceViewGetShowLineNumbers sv = liftM toBool $ + {#call unsafe source_view_get_show_line_numbers#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetShowRightMargin :: SourceViewClass sv => sv -> Bool -> IO () +sourceViewSetShowRightMargin sv newVal = + {#call source_view_set_show_right_margin#} (toSourceView sv) (fromBool newVal) + [_$_] +-- | [_$_] +-- +sourceViewGetShowRightMargin :: SourceViewClass sv => sv -> IO Bool +sourceViewGetShowRightMargin sv = liftM toBool $ + {#call source_view_get_show_right_margin#} (toSourceView sv) + [_$_] +-- | [_$_] +-- +sourceViewSetRightMarginPosition :: SourceViewClass sv => sv -> Word -> IO () +sourceViewSetRightMarginPosition sv margin = + {#call source_view_set_right_margin_position#} (toSourceView sv) (fromIntegral margin) + [_$_] +-- | [_$_] +-- +sourceViewGetRightMarginPosition :: SourceViewClass sv => sv -> IO Int [_$_] +sourceViewGetRightMarginPosition sv = liftM fromIntegral $ + {#call unsafe source_view_get_right_margin_position#} (toSourceView sv) + +-- | [_$_] +-- +sourceViewSetTabWidth :: SourceViewClass sv => sv -> Int -> IO () +sourceViewSetTabWidth sv width = + {#call source_view_set_tab_width#} ... [truncated message content] |