You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <as...@us...> - 2003-11-02 23:58:01
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv30318 Modified Files: ChangeLog Log Message: Make the sourceview modules more complete after GList.chs has been augmented. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- ChangeLog 26 Oct 2003 22:29:51 -0000 1.94 +++ ChangeLog 2 Nov 2003 23:57:58 -0000 1.95 @@ -1,3 +1,16 @@ +2003-10-02 Axel Simon <A....@ke...> + + * mk/common.mk: Change comments for "targets" help output. + + * sourceview/Makefile: Corrected header file declaration (unused + at the moment). + + * gtk/glib/GList.chs: Added methods to marshal from GLists and + GSLists. + + * sourceview/SourceLanguagesManager.chs, sourceview/SourceTag.chs, + sourceview/SourceTagTable.chs: Added + 2003-10-26 Axel Simon <A....@ke...> * Makefile, mk/recurse.mk, mk/common.mk: Turn the top-level |
From: <as...@us...> - 2003-11-02 23:57:10
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/glib In directory sc8-pr-cvs1:/tmp/cvs-serv30179 Modified Files: GList.chs Log Message: Added marshalling functions to create GLists and GSLists. Index: GList.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/glib/GList.chs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- GList.chs 9 Jul 2003 22:42:44 -0000 1.7 +++ GList.chs 2 Nov 2003 23:57:07 -0000 1.8 @@ -19,27 +19,27 @@ -- -- @description@ -------------------------------------------------------------- -- --- * Define functions to extract data from a GList and to produce a GList from +-- * Defines functions to extract data from a GList and to produce a GList from -- a list of pointers. -- --- * Define functions to extract data from a GSList. +-- * The same for GSList. -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- --- * Figure out if we ever need to generate a GList. -- module GList( ptrToInt, GList, fromGList, - -- toGList, + toGList, GSList, readGSList, fromGSList, - fromGSListRev + fromGSListRev, + toGSList ) where import Monad (liftM) @@ -117,11 +117,23 @@ -- Turn a list of something into a GList. -- -toGList :: [a] -> (a -> Ptr b) -> IO GList -toGList xs conv = makeList nullPtr xs +toGList :: [Ptr a] -> IO GList +toGList xs = makeList nullPtr xs where - -- makeList :: GList -> [a] -> IO GList + -- makeList :: GList -> [Ptr a] -> IO GList makeList current (x:xs) = do - newHead <- {#call unsafe list_prepend#} current ((castPtr.conv) x) + newHead <- {#call unsafe list_prepend#} current (castPtr x) makeList newHead xs makeList current [] = return current + +-- Turn a list of something into a GSList. +-- +toGSList :: [Ptr a] -> IO GSList +toGSList xs = makeList nullPtr xs + where + -- makeList :: GSList -> [Ptr a] -> IO GSList + makeList current (x:xs) = do + newHead <- {#call unsafe slist_prepend#} current (castPtr x) + makeList newHead xs + makeList current [] = return current + |
From: <as...@us...> - 2003-10-26 22:31:28
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv21701 Modified Files: ChangeLog Log Message: Add new files and patches from Duncan. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- ChangeLog 26 Oct 2003 22:11:41 -0000 1.93 +++ ChangeLog 26 Oct 2003 22:29:51 -0000 1.94 @@ -6,6 +6,16 @@ which are built first and never installed, libraries which are built after the tools installed and registered with ghc and applications which are built last and installed. + + * demo/sourceview/Makefile, demo/sourceview/SourceViewTest.hs, + demo/sourceview/haskell.lang: Added the example for the SourceView + binding. + + * sourceview/Makefile, sourceview/SourceBuffer.chs, + SourceLanguagesManager.chs, sourceview/SourceView.chs, + sourceview/SourceStyleScheme.chs, sourceview/SourceTag.chs, + sourceview/SourceTagStyle.hsc, sourceview/SourceTagTable.chs: New + files and patches from Duncan. 2003-10-21 Axel Simon <A....@ke...> |
Update of /cvsroot/gtk2hs/gtk2hs/sourceview In directory sc8-pr-cvs1:/tmp/cvs-serv21701/sourceview Modified Files: Makefile SourceBuffer.chs SourceLanguagesManager.chs SourceView.chs Added Files: SourceStyleScheme.chs SourceTag.chs SourceTagStyle.hsc SourceTagTable.chs Log Message: Add new files and patches from Duncan. --- NEW FILE: SourceStyleScheme.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceStyleScheme@ -- -- Author : Duncan Coutts -- derived from the GtkTextView bindings by Axel Simon -- -- Created: 22 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceStyleScheme ( SourceStyleScheme, sourceStyleSchemeGetTagStyle, sourceStyleSchemeGetName, sourceStyleSchemeGetDefault ) where import Monad (liftM) import FFI import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} import SourceTagStyle {# context lib="gtk" prefix="gtk" #} {#pointer *SourceStyleScheme foreign newtype #} mkSourceStyleScheme = SourceStyleScheme unSourceStyleScheme (SourceStyleScheme o) = o instance GObjectClass SourceStyleScheme where toGObject = mkGObject.castForeignPtr.unSourceStyleScheme fromGObject = mkSourceStyleScheme.castForeignPtr.unGObject -- methods -- @method sourceStyleSchemeGetTagStyle@ -- sourceStyleSchemeGetTagStyle :: SourceStyleScheme -> String -> IO SourceTagStyle sourceStyleSchemeGetTagStyle ss styleName = withCString styleName $ \strPtr -> do tsPtr <- {#call source_style_scheme_get_tag_style#} ss strPtr ts <- peek (castPtr tsPtr) {#call unsafe g_free#} tsPtr return ts -- @method sourceStyleSchemeGetName@ -- sourceStyleSchemeGetName :: SourceStyleScheme -> IO String sourceStyleSchemeGetName ss = {#call source_style_scheme_get_name#} ss >>= peekCString -- @method sourceStyleSchemeGetDefault@ -- sourceStyleSchemeGetDefault :: IO SourceStyleScheme sourceStyleSchemeGetDefault = makeNewGObject mkSourceStyleScheme $ liftM castPtr $ {#call source_style_scheme_get_default#} --- NEW FILE: SourceTag.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceTag@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 22 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceTag ( SourceTag, syntaxTagNew, patternTagNew, -- keywordListTagNew, blockCommentTagNew, lineCommentTagNew, stringTagNew, sourceTagGetStyle, sourceTagSetStyle ) where import Monad (liftM) import FFI import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} import SourceTagStyle {# context lib="gtk" prefix="gtk" #} -- methods -- @constructor syntaxTagNew@ Create a new @ref type SourceTag@ -- syntaxTagNew :: String -> String -> String -> String -> IO SourceTag syntaxTagNew id name patternStart patternEnd = makeNewGObject mkSourceTag $ liftM castPtr $ withCString id $ \strPtr1 -> withCString name $ \strPtr2 -> withCString patternStart $ \strPtr3 -> withCString patternEnd $ \strPtr4 -> {#call syntax_tag_new#} strPtr1 strPtr2 strPtr3 strPtr4 -- @constructor patternTagNew@ Create a new @ref type SourceTag@ -- patternTagNew :: String -> String -> String -> IO SourceTag patternTagNew id name pattern = makeNewGObject mkSourceTag $ liftM castPtr $ withCString id $ \strPtr1 -> withCString name $ \strPtr2 -> withCString pattern $ \strPtr3 -> {#call unsafe pattern_tag_new#} strPtr1 strPtr2 strPtr3 {- -- @constructor keywordListTagNew@ Create a new @ref type SourceTag@ -- keywordListTagNew :: String -> String -> [String] -> Bool -> Bool -> Bool -> String -> String -> IO SourceTag keywordListTagNew = id name keywords caseSensitive matchEmptyStringAtBeginning matchEmptyStringAtEnd beginningRegex endRegex makeNewGObject mkSourceTag $ liftM castPtr $ withCString id $ \strPtr1 -> withCString name $ \strPtr2 -> withCString beginningRegex $ \strPtr3 -> withCString endRegex $ \strPtr4 -> {#call unsafe keyword_list_tag_new#} strPtr1 strPtr2 {- makeGSList of strings from keywords -} (fromBool caseSensitive) (fromBool matchEmptyStringAtBeginning) (fromBool matchEmptyStringAtEnd) strPtr3 strPtr4 -} -- @constructor blockCommentTagNew@ Create a new @ref type SourceTag@ -- blockCommentTagNew :: String -> String -> String -> String -> IO SourceTag blockCommentTagNew = syntaxTagNew --in the C header this is just a macro -- @constructor lineCommentTagNew@ Create a new @ref type SourceTag@ -- lineCommentTagNew :: String -> String -> String -> IO SourceTag lineCommentTagNew id name pattern = makeNewGObject mkSourceTag $ liftM castPtr $ withCString id $ \strPtr1 -> withCString name $ \strPtr2 -> withCString pattern $ \strPtr3 -> {#call unsafe line_comment_tag_new#} strPtr1 strPtr2 strPtr3 -- @constructor stringTagNew@ Create a new @ref type SourceTag@ -- stringTagNew :: String -> String -> String -> String -> Bool -> IO SourceTag stringTagNew id name patternStart patternEnd endAtLineEnd = makeNewGObject mkSourceTag $ liftM castPtr $ withCString id $ \strPtr1 -> withCString name $ \strPtr2 -> withCString patternStart $ \strPtr3 -> withCString patternEnd $ \strPtr4 -> {#call unsafe string_tag_new#} strPtr1 strPtr2 strPtr3 strPtr4 (fromBool endAtLineEnd) -- @method sourceTagGetStyle@ -- sourceTagGetStyle :: SourceTag -> IO SourceTagStyle sourceTagGetStyle tag = do tsPtr <- {#call unsafe source_tag_get_style#} tag ts <- peek (castPtr tsPtr) {#call unsafe g_free#} tsPtr return ts -- @method sourceTagGetStyle@ -- sourceTagSetStyle :: SourceTag -> SourceTagStyle -> IO () sourceTagSetStyle tag ts = alloca $ \tsPtr -> do poke tsPtr ts {#call unsafe source_tag_set_style#} tag (castPtr tsPtr) --- NEW FILE: SourceTagStyle.hsc --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceTagStyle@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 20 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceTagStyle ( SourceTagStyle(..), ) where import Foreign import Foreign.C import Data.Bits (testBit, bit, (.|.)) import Maybe (isJust, fromMaybe) import Structs (Color(..)) #include <gtksourceview/gtksourcetagstyle.h> data SourceTagStyleMask = SourceTagStyleUseBackground | SourceTagStyleUseForeground deriving (Eq) instance Enum SourceTagStyleMask where fromEnum SourceTagStyleUseBackground = 1 fromEnum SourceTagStyleUseForeground = 2 toEnum 1 = SourceTagStyleUseBackground toEnum 2 = SourceTagStyleUseForeground toEnum unmatched = error ("SourceTagStyleMask.toEnum: Cannot match " ++ show unmatched) data SourceTagStyle = SourceTagStyle { isDefault :: Bool, -- readonly foreground :: Maybe Color, background :: Maybe Color, italic :: Bool, bold :: Bool, underline :: Bool, strikethrough :: Bool } instance Storable SourceTagStyle where sizeOf _ = #{const sizeof(GtkSourceTagStyle)} alignment _ = alignment (undefined::#type gboolean) peek ptr = do (isDefault'::#type gboolean) <- #{peek GtkSourceTagStyle, is_default} ptr (mask::#type guint) <- #{peek GtkSourceTagStyle, mask} ptr foreground' <- peek (#{ptr GtkSourceTagStyle, foreground} ptr) background' <- peek (#{ptr GtkSourceTagStyle, background} ptr) (italic'::#type gboolean) <- #{peek GtkSourceTagStyle, italic} ptr (bold'::#type gboolean) <- #{peek GtkSourceTagStyle, bold} ptr (underline'::#type gboolean) <- #{peek GtkSourceTagStyle, underline} ptr (strikethrough'::#type gboolean) <- #{peek GtkSourceTagStyle, strikethrough} ptr return SourceTagStyle { isDefault = toBool isDefault', foreground = if mask `testBit` (fromEnum SourceTagStyleUseForeground) then Just foreground' else Nothing, background = if mask `testBit` (fromEnum SourceTagStyleUseBackground) then Just background' else Nothing, italic = toBool italic', bold = toBool bold', underline = toBool underline', strikethrough = toBool strikethrough' } poke ptr tag = do #{poke GtkSourceTagStyle, is_default} ptr (fromBool $ isDefault tag ::#type gboolean) #{poke GtkSourceTagStyle, mask} ptr ((if isJust (foreground tag) then bit (fromEnum SourceTagStyleUseForeground) else 0) .|.(if isJust (background tag) then bit (fromEnum SourceTagStyleUseBackground) else 0) ::#type guint) poke (#{ptr GtkSourceTagStyle, foreground} ptr) (fromMaybe (Color 0 0 0) (foreground tag)) poke (#{ptr GtkSourceTagStyle, background} ptr) (fromMaybe (Color 0 0 0) (background tag)) #{poke GtkSourceTagStyle, italic} ptr (fromBool $ italic tag ::#type gboolean) #{poke GtkSourceTagStyle, bold} ptr (fromBool $ bold tag ::#type gboolean) #{poke GtkSourceTagStyle, underline} ptr (fromBool $ underline tag ::#type gboolean) #{poke GtkSourceTagStyle, strikethrough} ptr (fromBool $ strikethrough tag ::#type gboolean) --- NEW FILE: SourceTagTable.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceTagTable@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 22 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceTagTable ( SourceTagTable, SourceTagTableClass, sourceTagTableNew, -- sourceTagTableAddTags, --requires toGSList sourceTagTableRemoveSourceTags ) where import Monad (liftM) import FFI import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} {#import SourceTag#} import GList (readGSList) {# context lib="gtk" prefix="gtk" #} -- methods -- @constructor sourceTagTableNew@ Create a new @ref type SourceTagTable@ -- sourceTagTableNew :: IO SourceTagTable sourceTagTableNew = makeNewGObject mkSourceTagTable {#call unsafe source_tag_table_new#} {- -- @method sourceTagTableAddTags@ -- sourceTagTableAddTags :: SourceTagTable -> [SourceTag] -> IO () sourceTagTableAddTags tt tags = {#call source_tag_table_add_tags#} tt {- make GSList of SourceTag from tags -} -} -- @method sourceTagTableRemoveSourceTags@ -- sourceTagTableRemoveSourceTags :: SourceTagTable -> IO () sourceTagTableRemoveSourceTags tt = {#call source_tag_table_remove_source_tags#} tt Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/sourceview/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 21 Oct 2003 23:41:03 -0000 1.1 +++ Makefile 26 Oct 2003 22:29:51 -0000 1.2 @@ -24,6 +24,9 @@ SourceBuffer-HEADER = gtksourceview/gtksourceview.h SourceLanguage-HEADER = gtksourceview/gtksourceview.h SourceLanguagesManager-HEADER = gtksourceview/gtksourceviewlanguagesmanager.h +SourceTag-HEADER = gtksourceview/gtksourcetag.h +SourceTagTable-HEADER = gtksourceview/gtktagtable.h +SourceStyleScheme-HEADER = gtksourceview/gtkstlyescheme.h endif # Further options to the C preprocessor are passed verbatim: Index: SourceBuffer.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/sourceview/SourceBuffer.chs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SourceBuffer.chs 21 Oct 2003 23:41:03 -0000 1.1 +++ SourceBuffer.chs 26 Oct 2003 22:29:51 -0000 1.2 @@ -30,10 +30,31 @@ SourceBufferClass, sourceBufferNew, sourceBufferNewWithLanguage, - sourceViewSetCheckBrackets, - sourceViewGetCheckBrackets, + sourceBufferSetCheckBrackets, + sourceBufferGetCheckBrackets, +-- sourceBufferSetBracketsMatchStyle, sourceBufferSetHighlight, sourceBufferGetHighlight +{- + sourceBufferSetEscapeChar, + sourceBufferGetEscapeChar, + sourceBufferCanUndo, + sourceBufferCanRedo, + sourceBufferUndo, + sourceBufferRedo, + sourceBufferBeginNotUndoableAction, + sourceBufferEndNotUndoableAction, + sourceBufferCreateMarker, + sourceBufferMoveMarker, + sourceBufferDeleteMarker, + sourceBufferGetMarker, + sourceBufferGetMarkersInRegion, + sourceBufferGetFirstMarker, + sourceBufferGetLastMarker, + sourceBufferGetIterAtMarker, + sourceBufferGetNextMarker, + sourceBufferGetPrevMarker +-} ) where import Monad (liftM) @@ -44,6 +65,7 @@ {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} +import SourceTagStyle import GList (fromGList) {# context lib="gtk" prefix="gtk" #} @@ -65,18 +87,26 @@ sourceBufferNewWithLanguage lang = makeNewGObject mkSourceBuffer $ {#call unsafe source_buffer_new_with_language#} lang --- @method sourceViewSetCheckBrackets@ +-- @method sourceBufferSetCheckBrackets@ -- -sourceViewSetCheckBrackets :: SourceBuffer -> Bool -> IO () -sourceViewSetCheckBrackets sb newVal = +sourceBufferSetCheckBrackets :: SourceBuffer -> Bool -> IO () +sourceBufferSetCheckBrackets sb newVal = {#call unsafe source_buffer_set_check_brackets#} sb (fromBool newVal) --- @method sourceViewGetCheckBrackets@ +-- @method sourceBufferGetCheckBrackets@ -- -sourceViewGetCheckBrackets :: SourceBuffer -> IO Bool -sourceViewGetCheckBrackets sb = liftM toBool $ +sourceBufferGetCheckBrackets :: SourceBuffer -> IO Bool +sourceBufferGetCheckBrackets sb = liftM toBool $ {#call unsafe source_buffer_get_check_brackets#} sb +{- +-- @method sourceBufferSetBracketsMatchStyle@ +-- +sourceBufferSetBracketsMatchStyle :: SourceBuffer -> SourceTagStyle -> IO () +sourceBufferSetBracketsMatchStyle sb ts = liftM toBool $ + {#call unsafe source_buffer_set_bracket_match_style#} sb ts +-} + -- @method sourceBufferSetHighlight@ -- sourceBufferSetHighlight :: SourceBuffer -> Bool -> IO () @@ -88,3 +118,27 @@ sourceBufferGetHighlight :: SourceBuffer -> IO Bool sourceBufferGetHighlight sb = liftM toBool $ {#call unsafe source_buffer_get_highlight#} sb + +-- @method sourceBufferSetMaxUndoLevels@ +-- +sourceBufferSetMaxUndoLevels :: SourceBuffer -> Int -> IO () +sourceBufferSetMaxUndoLevels sb newVal = + {#call unsafe source_buffer_set_max_undo_levels#} sb (fromIntegral newVal) + +-- @method sourceBufferGetMaxUndoLevels@ +-- +sourceBufferGetMaxUndoLevels :: SourceBuffer -> IO Int +sourceBufferGetMaxUndoLevels sb = liftM fromIntegral $ + {#call unsafe source_buffer_get_max_undo_levels#} sb + +-- @method sourceBufferSetLanguage@ +-- +sourceBufferSetLanguage :: SourceBuffer -> SourceLanguage -> IO () +sourceBufferSetLanguage sb lang = + {#call unsafe source_buffer_set_language#} sb lang + +-- @method sourceBufferGetLanguage@ +-- +sourceBufferGetLanguage :: SourceBuffer -> IO SourceLanguage +sourceBufferGetLanguage sb = makeNewGObject mkSourceLanguage $ + {#call unsafe source_buffer_get_language#} sb Index: SourceLanguagesManager.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/sourceview/SourceLanguagesManager.chs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SourceLanguagesManager.chs 21 Oct 2003 23:41:03 -0000 1.1 +++ SourceLanguagesManager.chs 26 Oct 2003 22:29:51 -0000 1.2 @@ -34,7 +34,6 @@ import Monad (liftM) import FFI -import Object (makeNewObject) import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} Index: SourceView.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/sourceview/SourceView.chs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SourceView.chs 21 Oct 2003 23:41:03 -0000 1.1 +++ SourceView.chs 26 Oct 2003 22:29:51 -0000 1.2 @@ -50,7 +50,11 @@ sourceViewGetSmartHomeEnd, module SourceBuffer, module SourceLanguage, - module SourceLanguagesManager + module SourceLanguagesManager, + module SourceTag, + module SourceTagTable, + module SourceTagStyle, + module SourceStyleScheme ) where import Monad (liftM) @@ -63,6 +67,10 @@ import SourceBuffer import SourceLanguage import SourceLanguagesManager +import SourceStyleScheme +import SourceTag +import SourceTagTable +import SourceTagStyle {# context lib="gtk" prefix="gtk" #} |
From: <as...@us...> - 2003-10-26 22:11:49
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv18041 Modified Files: ChangeLog Makefile Log Message: Automated the decent into subdirs. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- ChangeLog 21 Oct 2003 23:41:02 -0000 1.92 +++ ChangeLog 26 Oct 2003 22:11:41 -0000 1.93 @@ -1,3 +1,12 @@ +2003-10-26 Axel Simon <A....@ke...> + + * Makefile, mk/recurse.mk, mk/common.mk: Turn the top-level + Makefile into a bunch of variable declaration and put the real + work into mk/recurse.mk. There are three main directories: tools + which are built first and never installed, libraries which are + built after the tools installed and registered with ghc and + applications which are built last and installed. + 2003-10-21 Axel Simon <A....@ke...> * sourceview/Makefile, sourceview/SourceBuffer.chs, Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/Makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile 21 Oct 2003 23:42:03 -0000 1.17 +++ Makefile 26 Oct 2003 22:11:41 -0000 1.18 @@ -2,86 +2,18 @@ include $(TOP)/mk/config.mk -# Making the different subdirectories unfortunately cannot be automated. There -# are several interdependencies that cannot easily be detected: -# - all for e.g. mogul/ requires that gtk/ is locally installed (inplace) -# - install requires that the modules are not locally installed, otherwise -# gtk-pkg complains that the module is already installed (fix: omit the -# local package file in those cases) -# - uninstall should remove the packages in reverse order, so that the system -# is always in a consistent state if something goes wrong -# - sometimes we build the local c2hs, sometimes we don't - -all : inplace - -inplace : noinplace -ifeq ($(BUILT_IN_C2HS),yes) - $(MAKE) -Cc2hs $@ -endif - $(MAKE) -Cgtk $@ -ifeq ($(ENABLE_SOURCEVIEW), yes) - $(MAKE) -Csourceview $@ -endif - $(MAKE) -Cmogul $@ -ifeq ($(BUILDDOCS),yes) - $(MAKE) -Cdoc all -endif - -noinplace : - $(MAKE) -Cmogul $@ - $(MAKE) -Cgtk $@ - -demo : noinplace - $(MAKE) -Cdemo/concurrent $@ - $(MAKE) -Cdemo/treeList $@ - $(MAKE) -Cdemo/graphic $@ - $(MAKE) -Cdemo/unicode $@ - $(MAKE) -Cdemo/hello $@ -ifeq ($(ENABLE_SOURCEVIEW), yes) - $(MAKE) -Cdemo/sourceview $@ -endif - -install install-without-pkg : all - $(MAKE) -Cgtk $@ - $(MAKE) -Cmogul $@ - -uninstall : - $(MAKE) -Cmogul $@ - $(MAKE) -Cgtk $@ +MAKE_TOOLS = c2hs tools/typehier tools/signals -clean : noinplace -ifeq ($(BUILT_IN_C2HS),yes) - $(MAKE) -Cc2hs $@ -endif - $(MAKE) -Cgtk $@ - $(MAKE) -Cmogul $@ - $(MAKE) -Cdemo/hello $@ - $(MAKE) -Cdemo/unicode $@ - $(MAKE) -Cdemo/graphic $@ - $(MAKE) -Cdemo/treeList $@ - $(MAKE) -Cdemo/concurrent $@ -ifeq ($(ENABLE_SOURCEVIEW), yes) - $(MAKE) -Cdemo/sourceview $@ - $(MAKE) -Csourceview $@ -endif -ifeq ($(BUILDDOCS),yes) - $(MAKE) -Cdoc $@ +ifeq ($(strip $(BUILDDOCS)),no) +MAKE_VERB = gendoc doc +else +MAKE_TOOLS += gendoc doc endif +MAKE_LIBS = gtk sourceview mogul -distclean : clean -ifeq ($(BUILT_IN_C2HS),yes) - $(MAKE) -Cc2hs $@ -endif - $(MAKE) -Cgtk $@ - $(MAKE) -Cmogul $@ - $(MAKE) -Cdemo/hello $@ - $(MAKE) -Cdemo/unicode $@ - $(MAKE) -Cdemo/graphic $@ - $(MAKE) -Cdemo/treeList $@ - $(MAKE) -Cdemo/concurrent $@ - $(MAKE) -Cdemo/sourceview $@ - $(MAKE) -Csourceview $@ +MAKE_APPS = demo/concurrent demo/treeList demo/graphic demo/unicode \ + demo/hello EXTRA_TARFILES = $(strip AUTHORS COPYING.LIB ChangeLog INSTALL Makefile \ TODO VERSION aclocal.m4 acinclude.m4 \ @@ -96,18 +28,7 @@ $(LN) . $(TARNAME) $(strip $(TAR) cf $(addsuffix .tar,$(TARNAME)) \ $(addprefix $(TARNAME)/,$(EXTRA_TARFILES))) - $(MAKE) -Cc2hs tarsource - $(MAKE) -Cgtk tarsource - $(MAKE) -Csourceview tarsource - $(MAKE) -Cmogul tarsource - $(MAKE) -Cdemo/hello tarsource - $(MAKE) -Cdemo/unicode tarsource - $(MAKE) -Cdemo/graphic tarsource - $(MAKE) -Cdemo/treeList tarsource - $(MAKE) -Cdemo/concurrent tarsource - $(MAKE) -Cdemo/sourceview tarsource - $(MAKE) -Cgendoc tarsource - $(MAKE) -Cdoc tarsource + $(MAKE) tarsource $(GZIP) $(TARNAME).tar $(RM) $(TARNAME) @@ -119,3 +40,5 @@ gtk2hs.spec: VERSION gtk2hs.spec.in ./configure + +include $(TOP)/mk/recurse.mk \ No newline at end of file |
From: <as...@us...> - 2003-10-26 22:11:46
|
Update of /cvsroot/gtk2hs/gtk2hs/mk In directory sc8-pr-cvs1:/tmp/cvs-serv18041/mk Modified Files: common.mk Added Files: recurse.mk Log Message: Automated the decent into subdirs. --- NEW FILE: recurse.mk --- # --*Makefile*-- # The variables MAKE_TOOLS, MAKE_LIBS or MAKE_APPS determine on which # subdirectories the following standard targets work. MAKE_VERB points # to extra directories that are included when cleaning and tarring. all : MAKE_GOALS=$(MAKE_TOOLS) $(MAKE_LIBS) $(MAKE_APPS) all : make-all inplace : MAKE_GOALS=$(MAKE_TOOLS) $(MAKE_LIBS) inplace : make-inplace noinplace : MAKE_GOALS=$(MAKE_TOOLS) $(MAKE_LIBS) noinplace : make-noinplace tarsource : MAKE_GOALS=$(MAKE_TOOLS) $(MAKE_LIBS) $(MAKE_APPS) $(MAKE_VERB) tarsource : make-tarsource clean : MAKE_GOALS=$(MAKE_TOOLS) $(MAKE_LIBS) $(MAKE_APPS) $(MAKE_VERB) clean : make-clean install : MAKE_GOALS=$(MAKE_LIBS) $(MAKE_APPS) install : make-install uninstall : MAKE_GOALS=$(MAKE_LIBS) $(MAKE_APPS) uninstall : make-uninstall make-% : for dir in $(MAKE_GOALS); do $(MAKE) $* -C$$dir ; done; Index: common.mk =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/common.mk,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- common.mk 21 Oct 2003 23:32:10 -0000 1.23 +++ common.mk 26 Oct 2003 22:11:42 -0000 1.24 @@ -159,7 +159,7 @@ @if test -f .depend; then \ echo "$(C2HSFLAGGED) -o : $(HEADER)" `cat .depend` && \ ($(C2HSFLAGGED) -o : $(HEADER) `cat .depend` || \ - (echo removing `cat .depend | $(SED) s/\(.*\)\.chs/\1.hs/`; \ + (echo removing `cat .depend | "$(SED) s/\(.*\)\.chs/\1.hs/"`; \ $(RM) `cat .depend | $(SED) "s/\(.*\)\.chs/\1.hs/"` .depend; \ exit 1)) && \ echo "$(TOP)/mk/chsDepend -i$(HIDIRSOK)" `cat .depend` && \ @@ -197,7 +197,8 @@ $(HSCFILES:.hsc=.hs) : %.hs : %.hsc $(HSCFLAGGED) $< -# Set up include file for either applications or libraries. + +# Goals for applications and libraries. .PHONY: errorNoTarget noTarget @@ -205,7 +206,6 @@ @echo You need to set PACKAGENAME to build a library or @echo APPNAME to build an executable. -inplace : all inplaceinit : @if test ! -f $(LOCALPKGCONF); then \ @@ -229,11 +229,17 @@ include $(TOP)/mk/library.mk +inplace : $(TARGETOK) + +all : inplace + else ifneq ($(strip $(APPNAME)),) include $(TOP)/mk/application.mk +all : $(TARGETOK) + else TARGETOK = errorNoTarget @@ -241,8 +247,6 @@ endif endif - -all : $(TARGETOK) targets : @echo all in subdirs: builds libraries/applications |
From: <as...@us...> - 2003-10-22 08:12:34
|
Update of /cvsroot/gtk2hs/gtk2hs/sourceview In directory sc8-pr-cvs1:/tmp/cvs-serv19676/sourceview Added Files: Makefile SourceBuffer.chs SourceLanguage.chs SourceLanguagesManager.chs SourceView.chs Log Message: Added the GtkSourceView widget contributed by Duncan. Thanks, Duncan. Note that the toplevel Makefile needs updating. The way to build this is: go to the subdirs in tools/ and make. Go to gtk and make. Go to sourceview and make. --- NEW FILE: Makefile --- TOP = .. include $(TOP)/mk/config.mk PACKAGENAME = sourceview INSTALLDIR = gtk2hs/sourceview MAIN = SourceView.hs # In order for ghc and c2hs to find .chi and .hi files in ../gtk/* we # need to set these directories here. Note that this list is different # from SUBDIRS in that the directories given here are not searched for # compilable files. HIDIRS = ../gtk/glib ../gtk/abstract ../gtk/general ../gtk/multiline HEADER = sourceview.h EXTRA_HFILES = $(TOP)/sourceview/sourceview.h EXTRA_TARFILES = sourceview.h ifneq (x$(MULTIPLE_CHS),xyes) # glib modules SourceViewType-HEADER = sourceview.h SourceBuffer-HEADER = gtksourceview/gtksourceview.h SourceLanguage-HEADER = gtksourceview/gtksourceview.h SourceLanguagesManager-HEADER = gtksourceview/gtksourceviewlanguagesmanager.h endif # Further options to the C preprocessor are passed verbatim: EXTRA_CPPFLAGS = $(GTK_CFLAGS) EXTRA_LIBS = $(GTK_LIBS) ifeq ($(strip $(NEW_MODULE_SYS)),yes) NEEDPACKAGES = gtk2 else NEEDPACKAGES = gtk2 lang data endif EXTRA_CHSFILES += SourceViewType.chs TYPE_TAGS += sourceview EXTRA_CLEANFILES+= SourceViewType.chs NEEDCHI = SourceViewType SourceViewType.chs : ../tools/typehier/hierarchy.list $(strip ../tools/typehier/TypeGenerator \ ../tools/typehier/hierarchy.list \ SourceViewType.chs \ $(addprefix --tag=,$(TYPE_TAGS))) include $(TOP)/mk/common.mk --- NEW FILE: SourceBuffer.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceBuffer@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 15 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceBuffer ( SourceBuffer, SourceBufferClass, sourceBufferNew, sourceBufferNewWithLanguage, sourceViewSetCheckBrackets, sourceViewGetCheckBrackets, sourceBufferSetHighlight, sourceBufferGetHighlight ) where import Monad (liftM) import Maybe (fromMaybe) import FFI import Object (makeNewObject) import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} import GList (fromGList) {# context lib="gtk" prefix="gtk" #} -- methods -- @constructor sourceBufferNew@ Create a new @ref type SourceBuffer@, possibly -- taking a @ref type SourceTagTable@. -- sourceBufferNew :: Maybe SourceTagTable -> IO SourceBuffer sourceBufferNew tt = makeNewGObject mkSourceBuffer $ {#call unsafe source_buffer_new#} (fromMaybe (mkSourceTagTable nullForeignPtr) tt) -- @constructor sourceBufferNewWithLanguage@ Create a new @ref type SourceBuffer@ -- with a @ref type SourceLanguage@. -- sourceBufferNewWithLanguage :: SourceLanguage -> IO SourceBuffer sourceBufferNewWithLanguage lang = makeNewGObject mkSourceBuffer $ {#call unsafe source_buffer_new_with_language#} lang -- @method sourceViewSetCheckBrackets@ -- sourceViewSetCheckBrackets :: SourceBuffer -> Bool -> IO () sourceViewSetCheckBrackets sb newVal = {#call unsafe source_buffer_set_check_brackets#} sb (fromBool newVal) -- @method sourceViewGetCheckBrackets@ -- sourceViewGetCheckBrackets :: SourceBuffer -> IO Bool sourceViewGetCheckBrackets sb = liftM toBool $ {#call unsafe source_buffer_get_check_brackets#} sb -- @method sourceBufferSetHighlight@ -- sourceBufferSetHighlight :: SourceBuffer -> Bool -> IO () sourceBufferSetHighlight sb newVal = {#call unsafe source_buffer_set_highlight#} sb (fromBool newVal) -- @method sourceBufferGetHighlight@ -- sourceBufferGetHighlight :: SourceBuffer -> IO Bool sourceBufferGetHighlight sb = liftM toBool $ {#call unsafe source_buffer_get_highlight#} sb --- NEW FILE: SourceLanguage.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry Widget SourceView@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 14 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceLanguage ( SourceLanguage, sourceLanguageGetName, sourceLanguageGetSection, sourceLanguageGetTags, sourceLanguageGetEscapeChar, -- sourceLanguageGetMimeTypes, -- sourceLanguageSetMimeTypes, -- sourceLanguageGetStyleScheme, -- sourceLanguageSetStyleScheme, -- sourceLanguageGetTagStyle, -- sourceLanguageSetTagStyle, -- sourceLanguageGetTagDefaultStyle ) where import Monad (liftM) import FFI import Object (makeNewObject) import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} import GList (readGSList) {# context lib="gtk" prefix="gtk" #} -- methods -- @method sourceLanguageGetName@ -- sourceLanguageGetName :: SourceLanguage -> IO String sourceLanguageGetName sl = {#call unsafe source_language_get_name#} sl >>= peekCString -- @method sourceLanguageGetSection@ -- sourceLanguageGetSection :: SourceLanguage -> IO String sourceLanguageGetSection sl = {#call unsafe source_language_get_section#} sl >>= peekCString -- @method sourceLanguageGetTags@ -- sourceLanguageGetTags :: SourceLanguage -> IO [SourceTag] sourceLanguageGetTags sl = do gList <- {#call unsafe source_language_get_tags#} sl wList <- readGSList gList mapM (makeNewGObject mkSourceTag) (map return wList) -- @method sourceLanguageGetEscapeChar@ -- sourceLanguageGetEscapeChar :: SourceLanguage -> IO Char sourceLanguageGetEscapeChar sl = liftM (toEnum . fromEnum) $ {#call unsafe source_language_get_escape_char#} sl {- -- @method sourceLanguageGetStyleScheme@ -- sourceLanguageGetStyleScheme :: SourceLanguage -> IO SourceStyleScheme sourceLanguageGetStyleScheme sl = makeNewGObject mkSourceStyleScheme $ {#call unsafe source_language_get_style_scheme#} sl -- @method sourceLanguageSetStyleScheme@ -- sourceLanguageSetStyleScheme :: SourceLanguage -> SourceStyleScheme -> IO () sourceLanguageSetStyleScheme sl ss = {#call unsafe source_language_get_style_scheme#} sl ss -- @method sourceLanguageGetTagStyle@ -- sourceLanguageGetTagStyle :: SourceLanguage -> String -> IO SourceTagStyle sourceLanguageGetTagStyle sl tag = makeNewGObject mkSourceTagStyle $ {#call unsafe source_language_get_tag_style#} sl tag -- @method sourceLanguageSetTagStyle@ -- sourceLanguageSetTagStyle :: SourceLanguage -> String -> SourceTagStyle -> IO () sourceLanguageSetTagStyle sl tag sts = {#call unsafe source_language_set_tag_style#} sl tag sts -- @method sourceLanguageGetTagDefaultStyle@ -- sourceLanguageGetTagDefaultStyle :: SourceLanguage -> String -> IO SourceTagStyle sourceLanguageGetTagDefaultStyle sl tag = makeNewGObject mkSourceTagStyle $ {#call unsafe source_language_get_tag_default_style#} sl tag -} --- NEW FILE: SourceLanguagesManager.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry SourceLanguagesManager@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 14 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceLanguagesManager ( SourceLanguagesManager, sourceLanguagesManagerNew, sourceLanguagesManagerGetAvailableLanguages, sourceLanguagesManagerGetLanguageFromMimeType, ) where import Monad (liftM) import FFI import Object (makeNewObject) import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} import GList (readGSList) {# context lib="gtk" prefix="gtk" #} -- methods -- @constructor sourceLanguagesManagerNew@ Create a new @ref type SourceLanguagesManager@ -- sourceLanguagesManagerNew :: IO SourceLanguagesManager sourceLanguagesManagerNew = makeNewGObject mkSourceLanguagesManager {#call source_languages_manager_new#} -- @method sourceLanguagesManagerGetAvailableLanguages@ -- sourceLanguagesManagerGetAvailableLanguages :: SourceLanguagesManager -> IO [SourceLanguage] sourceLanguagesManagerGetAvailableLanguages lm = do gList <- {#call source_languages_manager_get_available_languages#} lm wList <- readGSList gList mapM (makeNewGObject mkSourceLanguage) (map return wList) -- @method sourceLanguagesManagerGetLanguageFromMimeType@ -- sourceLanguagesManagerGetLanguageFromMimeType :: SourceLanguagesManager -> String -> IO (Maybe SourceLanguage) sourceLanguagesManagerGetLanguageFromMimeType lm mimeType = do langPtr <- withCString mimeType $ \strPtr -> {#call source_languages_manager_get_language_from_mime_type#} lm strPtr if langPtr==nullPtr then return Nothing else liftM Just $ makeNewGObject mkSourceLanguage (return langPtr) {- -- @method sourceLanguagesManagerGetLangFilesDirs@ -- sourceLanguagesManagerGetLangFilesDirs :: SourceLanguagesManager -> IO [FilePath] sourceLanguagesManagerGetLangFilesDirs lm = do gList <- {#call source_languages_manager_get_lang_files_dirs#} lm wList <- readGSList gList return the wList, converted to strings -} --- NEW FILE: SourceView.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry Widget SourceView@ -- -- Author : Duncan Coutts -- derived from GtkTextView bindings by Axel Simon -- -- Created: 14 October 2003 -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- -- @description@ -------------------------------------------------------------- -- -- -- @documentation@ ------------------------------------------------------------ -- -- -- @todo@ --------------------------------------------------------------------- -- -- module SourceView ( SourceView, SourceViewClass, sourceViewNew, sourceViewNewWithBuffer, sourceViewSetShowLineNumbers, sourceViewGetShowLineNumbers, sourceViewSetShowLineMarkers, sourceViewGetShowLineMarkers, sourceViewSetTabsWidth, sourceViewGetTabsWidth, sourceViewSetAutoIndent, sourceViewGetAutoIndent, sourceViewSetInsertSpacesInsteadOfTabs, sourceViewGetInsertSpacesInsteadOfTabs, sourceViewSetShowMargin, sourceViewGetShowMargin, sourceViewSetMargin, sourceViewGetMargin, sourceViewSetMarkerPixbuf, sourceViewGetMarkerPixbuf, sourceViewSetSmartHomeEnd, sourceViewGetSmartHomeEnd, module SourceBuffer, module SourceLanguage, module SourceLanguagesManager ) where import Monad (liftM) import FFI import Object (makeNewObject) import GObject (makeNewGObject) {#import Hierarchy#} {#import SourceViewType#} {#import Signal#} import SourceBuffer import SourceLanguage import SourceLanguagesManager {# context lib="gtk" prefix="gtk" #} -- methods -- @constructor sourceViewNew@ Create a new @ref type SourceView@ widget with a -- default @ref type SourceBuffer@. -- sourceViewNew :: IO SourceView sourceViewNew = makeNewGObject mkSourceView $ liftM castPtr {#call unsafe source_view_new#} -- @constructor sourceViewNewWithBuffer@ Create a new @ref type SourceView@ -- widget with the given @ref type SourceBuffer@. -- sourceViewNewWithBuffer :: SourceBuffer -> IO SourceView sourceViewNewWithBuffer sb = makeNewGObject mkSourceView $ liftM castPtr $ {#call unsafe source_view_new_with_buffer#} sb -- @method sourceViewSetShowLineNumbers@ -- sourceViewSetShowLineNumbers :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetShowLineNumbers sv newVal = {#call unsafe source_view_set_show_line_numbers#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetShowLineNumbers@ -- sourceViewGetShowLineNumbers :: SourceViewClass sv => sv -> IO Bool sourceViewGetShowLineNumbers sv = liftM toBool $ {#call unsafe source_view_get_show_line_numbers#} (toSourceView sv) -- @method sourceViewSetShowLineMarkers@ -- sourceViewSetShowLineMarkers :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetShowLineMarkers sv newVal = {#call unsafe source_view_set_show_line_markers#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetShowLineMarkers@ -- sourceViewGetShowLineMarkers :: SourceViewClass sv => sv -> IO Bool sourceViewGetShowLineMarkers sv = liftM toBool $ {#call unsafe source_view_get_show_line_markers#} (toSourceView sv) -- @method sourceViewSetTabsWidth@ -- sourceViewSetTabsWidth :: SourceViewClass sv => sv -> Int -> IO () sourceViewSetTabsWidth sv width = {#call unsafe source_view_set_tabs_width#} (toSourceView sv) (fromIntegral width) -- @method sourceViewGetTabsWidth@ -- sourceViewGetTabsWidth :: SourceViewClass sv => sv -> IO Int sourceViewGetTabsWidth sv = liftM fromIntegral $ {#call unsafe source_view_get_tabs_width#} (toSourceView sv) -- @method sourceViewSetAutoIndent@ -- sourceViewSetAutoIndent :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetAutoIndent sv newVal = {#call unsafe source_view_set_auto_indent#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetAutoIndent@ -- sourceViewGetAutoIndent :: SourceViewClass sv => sv -> IO Bool sourceViewGetAutoIndent sv = liftM toBool $ {#call unsafe source_view_get_auto_indent#} (toSourceView sv) -- @method sourceViewSetInsertSpacesInsteadOfTabs@ -- sourceViewSetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetInsertSpacesInsteadOfTabs sv newVal = {#call unsafe source_view_set_insert_spaces_instead_of_tabs#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetInsertSpacesInsteadOfTabs@ -- sourceViewGetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> IO Bool sourceViewGetInsertSpacesInsteadOfTabs sv = liftM toBool $ {#call unsafe source_view_get_insert_spaces_instead_of_tabs#} (toSourceView sv) -- @method sourceViewSetShowMargin@ -- sourceViewSetShowMargin :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetShowMargin sv newVal = {#call unsafe source_view_set_show_margin#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetShowMargin@ -- sourceViewGetShowMargin :: SourceViewClass sv => sv -> IO Bool sourceViewGetShowMargin sv = liftM toBool $ {#call unsafe source_view_get_show_margin#} (toSourceView sv) -- @method sourceViewSetMargin@ -- sourceViewSetMargin :: SourceViewClass sv => sv -> Int -> IO () sourceViewSetMargin sv margin = {#call unsafe source_view_set_margin#} (toSourceView sv) (fromIntegral margin) -- @method sourceViewGetMargin@ -- sourceViewGetMargin :: SourceViewClass sv => sv -> IO Int sourceViewGetMargin sv = liftM fromIntegral $ {#call unsafe source_view_get_margin#} (toSourceView sv) -- @method sourceViewSetMarkerPixbuf@ -- sourceViewSetMarkerPixbuf :: SourceViewClass sv => sv -> String -> Pixbuf -> IO () sourceViewSetMarkerPixbuf sv markerType marker = withCString markerType $ \strPtr -> {#call unsafe source_view_set_marker_pixbuf#} (toSourceView sv) strPtr marker -- @method sourceViewGetMarkerPixbuf@ -- sourceViewGetMarkerPixbuf :: SourceViewClass sv => sv -> String -> IO Pixbuf sourceViewGetMarkerPixbuf sv markerType = withCString markerType $ \strPtr -> makeNewGObject mkPixbuf $ {#call unsafe source_view_get_marker_pixbuf#} (toSourceView sv) strPtr -- @method sourceViewSetSmartHomeEnd@ -- sourceViewSetSmartHomeEnd :: SourceViewClass sv => sv -> Bool -> IO () sourceViewSetSmartHomeEnd sv newVal = {#call unsafe source_view_set_smart_home_end#} (toSourceView sv) (fromBool newVal) -- @method sourceViewGetSmartHomeEnd@ -- sourceViewGetSmartHomeEnd :: SourceViewClass sv => sv -> IO Bool sourceViewGetSmartHomeEnd sv = liftM toBool $ {#call unsafe source_view_get_smart_home_end#} (toSourceView sv) |
From: <as...@us...> - 2003-10-22 08:08:01
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv19676 Modified Files: ChangeLog AUTHORS Log Message: Added the GtkSourceView widget contributed by Duncan. Thanks, Duncan. Note that the toplevel Makefile needs updating. The way to build this is: go to the subdirs in tools/ and make. Go to gtk and make. Go to sourceview and make. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- ChangeLog 21 Oct 2003 23:32:11 -0000 1.91 +++ ChangeLog 21 Oct 2003 23:41:02 -0000 1.92 @@ -1,5 +1,11 @@ 2003-10-21 Axel Simon <A....@ke...> + * sourceview/Makefile, sourceview/SourceBuffer.chs, + sourceview/SourceLanguage.chs, + sourceview/SourceLanguagesManager.chs, sourceview/SourceView.chs, + AUTHORS: Added the GtkSourceView widget contributed by Duncan + Coutts. + * mk/common.mk: Avoid message about several rules for the top-level file which are .chs files. This happend since the top-level file SourceView.chs is not removed form a list Index: AUTHORS =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/AUTHORS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AUTHORS 16 May 2003 22:25:15 -0000 1.4 +++ AUTHORS 21 Oct 2003 23:41:03 -0000 1.5 @@ -6,6 +6,10 @@ (c2hs and some sources and techniques) Jens Petersen <pet...@ha...> +(RPMs and tons of other stuff) + +Duncan Coutts <du...@co...> +(GtkSourceView) Jonas Svensson <d99...@dt...> Vincenzo Ciancia <ci...@cl...> |
From: <as...@us...> - 2003-10-22 03:24:47
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv18473 Modified Files: ChangeLog Log Message: * mk/common.mk: Avoid message about several rules for the top-level file which are .chs files. This happend since the top-level file SourceView.chs is not removed form a list containing ./SourceView.chs which is what the wild-card searching gives. Solved by stripping the ./ prefix. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- ChangeLog 21 Oct 2003 21:30:20 -0000 1.90 +++ ChangeLog 21 Oct 2003 23:32:11 -0000 1.91 @@ -1,9 +1,24 @@ 2003-10-21 Axel Simon <A....@ke...> + * mk/common.mk: Avoid message about several rules for the + top-level file which are .chs files. This happend since the + top-level file SourceView.chs is not removed form a list + containing ./SourceView.chs which is what the wild-card searching + gives. Solved by stripping the ./ prefix. + + * gtk/Makefile, tools/signals/HookGenerator.hs, + tools/signals/Makefile, tools/signals/Signal.chs-boot1, + tools/signals/Signal.chs-boot2, tools/signals/gtkmarshal.list, + tools/typehier/Makefile, tools/typehier/TypeGenerator.hs, + tools/typehier/hierarchy.list: Moved these file to a new directory + tools/. The reason for this is that parts of the type hierarchy + may only be generated if a specific widget is built, in this case + it's GtkSourceview. + * gtk/multiline/TextBuffer.chs: Use TextBufferClass tb => tb instead of TextBuffer as type for the Textbuffer. - * gtk/abstract/Container.chs gtk/multiline/TextIter.chs: Fix + * gtk/abstract/Container.chs, gtk/multiline/TextIter.chs: Fix warning about deprecated FFI construct for GHC 6.0. 2003-08-09 Jens Petersen <pet...@ha...> |
From: <as...@us...> - 2003-10-22 02:20:53
|
Update of /cvsroot/gtk2hs/gtk2hs/sourceview In directory sc8-pr-cvs1:/tmp/cvs-serv19933/sourceview Added Files: sourceview.h Log Message: --- NEW FILE: sourceview.h --- #include <gtksourceview/gtksourceview.h> #include <gtksourceview/gtksourcelanguagesmanager.h> #include <gtksourceview/gtksourcetag.h> |
From: <as...@us...> - 2003-10-22 01:36:07
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/signals In directory sc8-pr-cvs1:/tmp/cvs-serv19933/tools/signals Added Files: HookGenerator.hs Makefile Signal.chs-boot1 Signal.chs-boot2 gtkmarshal.list Log Message: --- NEW FILE: HookGenerator.hs --- {-# OPTIONS -cpp #-} -- HookGenerator.hs -*-haskell-*- -- Takes a type list of possible hooks from the GTK+ distribution and produces -- Haskell functions to connect to these callbacks. module Main(main) where import Char(showLitChar) import List(nub, partition) import Maybe(catMaybes) import System(getArgs, exitWith, ExitCode(..)) -- Define all possible data types the GTK will supply in callbacks. -- data Types = Tunit -- () | Tbool -- Bool | Tchar | Tuchar | Tint -- Int | Tuint | Tlong | Tulong | Tenum | Tflags | Tfloat | Tdouble | Tstring | Tboxed -- a struct which is passed by value | Tptr -- pointer | Tobject -- foreign with GObjectClass context deriving Eq type Signature = (Types,[Types]) type Signatures = [Signature] ------------------------------------------------------------------------------- -- Handle broken Solaris ------------------------------------------------------------------------------- -- If this type of arguement is True then we are compiling for -- Sparc Solaris for which ghc does not know how to generate dynamic callbacks -- with more than four arguments. type BrokenSolaris = Bool -- Each callback is given a pointer to the object is was emitted from. -- We need to take this into account when we talk about 4 arguments. fakeSignature :: BrokenSolaris -> Signature -> Bool fakeSignature brokenSolaris (_,args) = brokenSolaris && sum (map sizeOf args) > 3 where sizeOf Tunit = 0 sizeOf Tbool = 1 sizeOf Tchar = 1 sizeOf Tuchar = 1 sizeOf Tint = 1 sizeOf Tuint = 1 sizeOf Tlong = 2 sizeOf Tulong = 1 sizeOf Tenum = 1 sizeOf Tflags = 1 sizeOf Tfloat = 2 sizeOf Tdouble = 4 sizeOf Tstring = 1 sizeOf Tboxed = 1 sizeOf Tptr = 1 sizeOf Tobject = 1 ------------------------------------------------------------------------------- -- Parsing ------------------------------------------------------------------------------- parseSignatures :: String -> Signatures parseSignatures content = (nub.parseSig 1.scan) content data Token = TokColon | TokType Types | TokComma | TokEOL instance Show Token where showsPrec _ TokColon = shows ":" showsPrec _ (TokType _) = shows "<type>" showsPrec _ TokComma = shows "," showsPrec _ TokEOL = shows "<EOL>" parseSig :: Int -> [Token] -> Signatures parseSig l [] = [] parseSig l (TokEOL: rem) = parseSig (l+1) rem parseSig l (TokType ret: TokColon: TokType Tunit:rem) = (ret,[]):parseSig l rem parseSig l (TokType ret: TokColon: rem) = let (args,rem') = parseArg l rem in (ret,args): parseSig (l+1) rem' parseSig l rem = error ("parse error on line "++show l++ ": expected type and colon, found\n"++ concatMap show (take 5 rem)) parseArg :: Int -> [Token] -> ([Types],[Token]) parseArg l [TokType ty] = ([ty],[]) parseArg l (TokType ty: TokEOL:rem) = ([ty],rem) parseArg l (TokType ty: TokComma:rem) = let (args,rem') = parseArg l rem in (ty:args, rem') parseArg l rem = error ("parse error on line "++show l++": expected type"++ " followed by comma or EOL, found\n "++ concatMap show (take 5 rem)) scan :: String -> [Token] scan "" = [] scan ('#':xs) = (scan.dropWhile (/='\n')) xs scan ('\n':xs) = TokEOL:scan xs scan (' ':xs) = scan xs scan ('\t':xs) = scan xs scan (':':xs) = TokColon:scan xs scan (',':xs) = TokComma:scan xs scan ('V':'O':'I':'D':xs) = TokType Tunit:scan xs scan ('B':'O':'O':'L':'E':'A':'N':xs) = TokType Tbool:scan xs scan ('C':'H':'A':'R':xs) = TokType Tchar:scan xs scan ('U':'C':'H':'A':'R':xs) = TokType Tuchar:scan xs scan ('I':'N':'T':xs) = TokType Tint:scan xs scan ('U':'I':'N':'T':xs) = TokType Tuint:scan xs scan ('L':'O':'N':'G':xs) = TokType Tuint:scan xs scan ('U':'L':'O':'N':'G':xs) = TokType Tulong:scan xs scan ('E':'N':'U':'M':xs) = TokType Tenum:scan xs scan ('F':'L':'A':'G':'S':xs) = TokType Tflags:scan xs scan ('F':'L':'O':'A':'T':xs) = TokType Tfloat:scan xs scan ('D':'O':'U':'B':'L':'E':xs) = TokType Tdouble:scan xs scan ('S':'T':'R':'I':'N':'G':xs) = TokType Tstring:scan xs scan ('B':'O':'X':'E':'D':xs) = TokType Tboxed:scan xs scan ('P':'O':'I':'N':'T':'E':'R':xs) = TokType Tptr:scan xs scan ('O':'B':'J':'E':'C':'T':xs) = TokType Tobject:scan xs scan ('N':'O':'N':'E':xs) = TokType Tunit:scan xs scan ('B':'O':'O':'L':xs) = TokType Tbool:scan xs scan str = error ("Invalid character in input file:\n"++ concatMap ((flip showLitChar) "") (take 5 str)) ------------------------------------------------------------------------------- -- Helper functions ------------------------------------------------------------------------------- ss = showString sc = showChar indent :: Int -> ShowS indent c = ss ("\n"++replicate (2*c) ' ') ------------------------------------------------------------------------------- -- Tables of code fragments ------------------------------------------------------------------------------- identifier :: Types -> ShowS identifier Tunit = ss "NONE" identifier Tbool = ss "BOOL" identifier Tchar = ss "BYTE" identifier Tuchar = ss "UBYTE" identifier Tint = ss "INT" identifier Tuint = ss "WORD" identifier Tlong = ss "LONG" identifier Tulong = ss "ULONG" identifier Tenum = ss "ENUM" identifier Tflags = ss "FLAGS" identifier Tfloat = ss "FLOAT" identifier Tdouble = ss "DOUBLE" identifier Tstring = ss "STRING" identifier Tboxed = ss "BOXED" identifier Tptr = ss "PTR" identifier Tobject = ss "OBJECT" -- The monomorphic type which is used to export the function signature. rawtype :: Types -> ShowS rawtype Tunit = ss "()" rawtype Tbool = ss "{#type gboolean#}" rawtype Tchar = ss "{#type gchar#}" rawtype Tuchar = ss "{#type guchar#}" rawtype Tint = ss "{#type gint#}" rawtype Tuint = ss "{#type guint#}" rawtype Tlong = ss "{#type glong#}" rawtype Tulong = ss "{#type gulong#}" rawtype Tenum = ss "{#type gint#}" rawtype Tflags = ss "{#type guint#}" rawtype Tfloat = ss "{#type gfloat#}" rawtype Tdouble = ss "{#type gdouble#}" rawtype Tstring = ss "CString" rawtype Tboxed = ss "Ptr ()" rawtype Tptr = ss "Ptr ()" rawtype Tobject = ss "Ptr GObject" -- The possibly polymorphic type which usertype :: Types -> [Char] -> (ShowS,[Char]) usertype Tunit cs = (ss "()",cs) usertype Tbool cs = (ss "Bool",cs) usertype Tchar cs = (ss "Char",cs) usertype Tuchar cs = (ss "Int",cs) usertype Tint (c:cs) = (sc c,cs) usertype Tuint (c:cs) = (sc c,cs) usertype Tlong cs = (ss "Integer",cs) usertype Tulong cs = (ss "Integer",cs) usertype Tenum (c:cs) = (sc c,cs) usertype Tflags cs = usertype Tenum cs usertype Tfloat cs = (ss "Float",cs) usertype Tdouble cs = (ss "Double",cs) usertype Tstring cs = (ss "String",cs) usertype Tboxed (c:cs) = (sc c,cs) usertype Tptr (c:cs) = (ss "Ptr ".sc c,cs) usertype Tobject (c:cs) = (sc c.sc '\'',cs) -- type declaration: only consume variables when they are needed -- -- * Tint is used as return value as well. Therefore Integral has to be added -- to the context. Grrr. -- context :: [Types] -> [Char] -> [ShowS] context (Tint:ts) (c:cs) = ss "Num ".sc c.ss ", Integral ".sc c: context ts cs context (Tuint:ts) (c:cs) = ss "Num ".sc c: context ts cs context (Tenum:ts) (c:cs) = ss "Enum ".sc c: context ts cs context (Tflags:ts) cs = context (Tenum:ts) cs context (Tboxed:ts) (c:cs) = context ts cs context (Tptr:ts) (c:cs) = --ss "Storable ".sc c: context ts cs context (Tobject:ts) (c:cs) = ss "GObjectClass ".sc c.sc '\'': context ts cs context (_:ts) cs = context ts cs context [] _ = [] marshType :: [Types] -> [Char] -> [ShowS] marshType (Tint:ts) (c:cs) = marshType ts cs marshType (Tuint:ts) (c:cs) = marshType ts cs marshType (Tenum:ts) (c:cs) = marshType ts cs marshType (Tflags:ts) cs = marshType (Tenum:ts) cs marshType (Tboxed:ts) (c:cs) = ss "(Ptr ".sc c.ss " -> IO ". sc c.ss ") ->": marshType ts cs marshType (Tptr:ts) (c:cs) = marshType ts cs marshType (Tobject:ts) (c:cs) = marshType ts cs marshType (_:ts) cs = marshType ts cs marshType [] _ = [] tyVarMapping :: [Types] -> [Char] tyVarMapping ts = tvm ts 'a' where tvm (Tint:ts) c = c:tvm ts (succ c) tvm (Tuint:ts) c = c:tvm ts (succ c) tvm (Tenum:ts) c = c:tvm ts (succ c) tvm (Tflags:ts) c = c:tvm ts (succ c) tvm (Tboxed:ts) c = c:tvm ts (succ c) tvm (Tptr:ts) c = c:tvm ts (succ c) tvm (Tobject:ts) c = c:tvm ts (succ c) tvm (_:ts) c = c:tvm ts c tvm _ c = [] -- arguments for user defined marshalling type ArgNo = Int marshArg :: Types -> ArgNo -> ShowS marshArg Tboxed c = indent 1.ss "boxedPre".shows c.sc ' ' marshArg _ _ = id -- generate a name for every passed argument, nameArg :: Types -> ArgNo -> ShowS nameArg Tunit _ = id nameArg Tbool c = ss "bool".shows c nameArg Tchar c = ss "char".shows c nameArg Tuchar c = ss "char".shows c nameArg Tint c = ss "int".shows c nameArg Tuint c = ss "int".shows c nameArg Tlong c = ss "long".shows c nameArg Tulong c = ss "long".shows c nameArg Tenum c = ss "enum".shows c nameArg Tflags c = ss "flags".shows c nameArg Tfloat c = ss "float".shows c nameArg Tdouble c = ss "double".shows c nameArg Tstring c = ss "str".shows c nameArg Tboxed c = ss "box".shows c nameArg Tptr c = ss "ptr".shows c nameArg Tobject c = ss "obj".shows c -- describe marshalling between the data passed from the registered function -- to the user supplied Haskell function marshExec :: Types -> (Char,ArgNo) -> ShowS marshExec Tbool (c,n) = indent 4.ss "let bool".shows n. ss "' = toBool bool".shows n marshExec Tchar (c,n) = indent 4.ss "let char".shows n. ss "' = (toEnum.fromEnum) char".shows n marshExec Tuchar (c,n) = indent 4.ss "let char".shows n. ss "' = (toEnum.fromEnum) char".shows n marshExec Tint (c,n) = indent 4.ss "let int".shows n. ss "' = fromIntegral int".shows n marshExec Tuint (c,n) = indent 4.ss "let int".shows n. ss "' = fromIntegral int".shows n marshExec Tlong (c,n) = indent 4.ss "let long".shows n. ss "' = toInteger long".shows n marshExec Tulong (c,n) = indent 4.ss "let long".shows n. ss "' = toInteger long".shows n marshExec Tenum (c,n) = indent 4.ss "let enum".shows n. ss "' = (toEnum.fromEnum) enum".shows n marshExec Tflags (c,n) = indent 4.ss "let flags".shows n. ss "' = (toEnum.fromEnum) flags".shows n marshExec Tfloat (c,n) = indent 4.ss "let float".shows n. ss "' = (fromRational.toRational) float".shows n marshExec Tdouble (c,n) = indent 4.ss "let double".shows n. ss "' = (fromRational.toRational) double".shows n marshExec Tstring (c,n) = indent 4.ss "str".shows n. ss "' <- peekCString str".shows n marshExec Tboxed (c,n) = indent 4.ss "box".shows n.ss "' <- boxedPre". shows n.ss " $ castPtr box".shows n marshExec Tptr (c,n) = indent 4.ss "let ptr".shows n.ss "' = castPtr ptr". shows n marshExec Tobject (c,n) = indent 4.ss "objectRef obj".shows n. indent 4.ss "obj".shows n. ss "' <- liftM (fromGObject.mkGObject) $". indent 5.ss "newForeignPtr obj".shows n. ss " (objectUnref obj".shows n.sc ')' marshExec _ _ = id marshRet :: Types -> ShowS marshRet Tunit = ss "id" marshRet Tbool = ss "fromBool" marshRet Tint = ss "fromIntegral" marshRet Tuint = ss "fromIntegral" marshRet Tlong = ss "fromIntegral" marshRet Tulong = ss "fromIntegral" marshRet Tenum = ss "(toEnum.fromEnum)" marshRet Tflags = ss "fromFlags" marshRet Tfloat = ss "(toRational.fromRational)" marshRet Tdouble = ss "(toRational.fromRational)" marshRet _ = ss "(error \"Signal handlers cannot return structured types.\")" ------------------------------------------------------------------------------- -- generation of parameterized fragments ------------------------------------------------------------------------------- mkUserType :: Signature -> ShowS mkUserType (ret,ts) = let (str,cs) = foldl (\(str,cs) t -> let (str',cs') = usertype t cs in (str.str'.ss " -> ",cs')) (sc '(',['a'..]) ts (str',_) = usertype ret cs in str.ss "IO ".str'.sc ')' mkContext :: Signature -> ShowS mkContext (ret,ts) = let ctxts = context (ts++[ret]) ['a'..] in if null ctxts then ss "GObjectClass obj =>" else sc '('. foldl1 (\a b -> a.ss ", ".b) ctxts.ss ", GObjectClass obj) =>" mkMarshType :: Signature -> [ShowS] mkMarshType (ret,ts) = marshType (ts++[ret]) ['a'..] mkType sig = let types = mkMarshType sig in if null types then id else foldl (.) (indent 1) types mkMarshArg :: Signature -> [ShowS] mkMarshArg (ret,ts) = zipWith marshArg (ts++[ret]) [1..] mkArg sig = foldl (.) id $ mkMarshArg sig mkMarshExec :: Signature -> ShowS mkMarshExec (_,ts) = foldl (.) id $ zipWith marshExec ts (zip (tyVarMapping ts) [1..]) mkIdentifier :: Signature -> ShowS mkIdentifier (ret,[]) = identifier Tunit . ss "__".identifier ret mkIdentifier (ret,ts) = foldl1 (\a b -> a.sc '_'.b) (map identifier ts). ss "__".identifier ret mkRawtype :: Signature -> ShowS mkRawtype (ret,ts) = foldl (.) id (map (\ty -> rawtype ty.ss " -> ") ts). ss "IO (".rawtype ret.sc ')' mkLambdaArgs :: Signature -> ShowS mkLambdaArgs (_,ts) = foldl (.) id $ zipWith (\a b -> nameArg a b.sc ' ') ts [1..] mkFuncArgs :: Signature -> ShowS mkFuncArgs (_,ts) = foldl (.) id $ zipWith (\a b -> sc ' '.nameArg a b.sc '\'') ts [1..] mkMarshRet :: Signature -> ShowS mkMarshRet (ret,_) = marshRet ret ------------------------------------------------------------------------------- -- start of code generation ------------------------------------------------------------------------------- usage = do putStr $ "Program to generate callback hook for Gtk signals. Usage:\n"++ "HookGenerator <signatureFile> <bootPath> <outFile> [--broken]\n"++ "where\n"++ " <signatureFile> is gtkmarshal.list from the the source Gtk+ tree\n"++ " <bootPath> the path where Signal.chs-boot? file can be found\n"++ " <outFile> is the name and path of the output file.\n"++ " --broken do not ask for callbacks with more than 4 words\n" exitWith $ ExitFailure 1 main = do args <- getArgs if (length args<3 || length args>4) then usage else do let (br,[typesFile, bootPath, outFile]) = partition (=="--broken") args let bootPath' = case reverse bootPath of [] -> "./" ('/':_) -> bootPath ('\\':_) -> bootPath _ -> bootPath++"/" generateHooks typesFile bootPath' outFile (not (null br)) generateHooks :: String -> String -> String -> BrokenSolaris -> IO () generateHooks typesFile bootPath outFile brokenSolaris = do content <- readFile typesFile let sigs = parseSignatures content boot1 <- readFile (bootPath++"Signal.chs-boot1") boot2 <- readFile (bootPath++"Signal.chs-boot2") let result = ss boot1. genExport sigs. ss boot2. foldl (.) id (map (generate brokenSolaris) sigs) writeFile outFile (result "") ------------------------------------------------------------------------------- -- generate dynamic fragments ------------------------------------------------------------------------------- genExport :: Signatures -> ShowS genExport sigs = foldl (.) id (map mkId sigs) where mkId sig = ss "connect_".mkIdentifier sig.sc ','.indent 1 generate :: BrokenSolaris -> Signature -> ShowS generate bs sig = let ident = mkIdentifier sig in indent 0.ss "type Tag_".ident.ss " = Ptr () -> ". indent 1.mkRawtype sig. indent 0. (if fakeSignature bs sig then id else indent 0.ss "foreign". #if __GLASGOW_HASKELL__>=504 ss " import ccall \"wrapper\" ").ss "mkHandler_".ident.ss " ::". #else ss " export dynamic ").ss "mkHandler_".ident.ss " ::". #endif indent 1.ss "Tag_".ident.ss " -> ". indent 1.ss "IO (FunPtr ".ss "Tag_".ident.sc ')'. (if fakeSignature bs sig then indent 0.ss "mkHandler_".ident.ss " _ =". indent 1.ss "error \"Callbacks of signature ".ident.ss "\\n\\". indent 1.ss "\\are not supported on this architecture.\"" else id). indent 0. indent 0.ss "connect_".ident.ss " :: ". indent 1.mkContext sig.ss " SignalName ->". mkType sig. indent 1.ss "ConnectAfter -> obj ->". indent 1.mkUserType sig.ss " ->". indent 1.ss "IO (ConnectId obj)". indent 0.ss "connect_".ident.ss " signal". mkArg sig. indent 1.ss "after obj user =". indent 1.ss "do". indent 2.ss "hPtr <- mkHandler_".ident. indent 3.ss "(\\_ ".mkLambdaArgs sig.ss "-> do". mkMarshExec sig. indent 4.ss "liftM ".mkMarshRet sig.ss " $". indent 5.ss "user".mkFuncArgs sig. indent 3.sc ')'. indent 2.ss "dRef <- newIORef nullFunPtr". indent 2.ss "dPtr <- mkDestructor $ do". indent 3.ss "freeHaskellFunPtr hPtr". indent 3.ss "dPtr <- readIORef dRef". indent 3.ss "freeHaskellFunPtr dPtr". indent 2.ss "writeIORef dRef dPtr". indent 2.ss "sigId <- withCString signal $ \\nPtr ->". indent 3.ss "withForeignPtr ((unGObject.toGObject) obj) $ \\objPtr ->". indent 4.ss "{#call unsafe g_signal_connect_data#} (castPtr objPtr)". indent 5.ss "nPtr (castFunPtr hPtr) nullPtr dPtr (fromBool after)". indent 2.ss "return $ ConnectID sigId obj". indent 0 --- NEW FILE: Makefile --- TOP = ../.. include $(TOP)/mk/config.mk APPNAME = HookGenerator EXTRA_TARFILES += gtkmarshal.list Signal.chs-boot1 Signal.chs-boot2 include $(TOP)/mk/common.mk --- NEW FILE: Signal.chs-boot1 --- {-# OPTIONS -cpp #-} -- -*-haskell-*- -- ******************** automatically generated file - do not edit ************ -- Callback installers for the GIMP Toolkit (GTK) Binding for Haskell -- -- Author : Axel Simon -- -- Created: 1 July 2000 -- -- Version $Revision: 1.1 $ from $Date: 2003/10/21 23:42:03 $ -- -- Copyright (c) 2000 Axel Simon -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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 General Public License for more details. -- --- DESCRIPTION --------------------------------------------------------------- -- -- * These functions are used to connect signals to widgets. They are auto- -- matically created through HookGenerator.hs which takes a list of possible -- function signatures that are included in the GTK sources -- (gtkmarshal.list). -- --- DOCU ---------------------------------------------------------------------- -- -- * The object system in the second version of GTK is based on GObject from -- GLIB. This base class is rather primitive in that it only implements -- ref and unref methods (and others that are not interesting to us). If -- the marshall list mentions OBJECT it refers to an instance of this -- GObject which is automatically wrapped with a ref and unref call. -- Structures which are not derived from GObject have to be passed as -- BOXED which gives the signal connect function a possiblity to do the -- conversion into a proper ForeignPtr type. In special cases the signal -- connect function use a PTR type which will then be mangled in the -- user function directly. The latter is needed if a signal delivers a -- pointer to a string and its length in a separate integer. -- --- TODO ---------------------------------------------------------------------- -- -- * Check if we need all prototypes mentioned in gtkmarshal.list. -- module Signal( --- NEW FILE: Signal.chs-boot2 --- SignalName, ConnectAfter, ConnectId, disconnect ) where import Monad (liftM) import FFI import LocalData import GObject (objectRef, objectUnref) {#import Hierarchy#} {#context lib="gtk" prefix="gtk" #} -- Specify if the handler is to run before (False) or after (True) the -- default handler. type ConnectAfter = Bool type SignalName = String data GObjectClass o => ConnectId o = ConnectID {#type gulong#} o {#pointer GClosureNotify#} #if __GLASGOW_HASKELL__>=600 foreign import ccall "wrapper" mkDestructor :: IO () -> IO GClosureNotify #else foreign export dynamic mkDestructor :: IO () -> IO GClosureNotify #endif disconnect :: GObjectClass obj => ConnectId obj -> IO () disconnect (ConnectID handler obj) = withForeignPtr ((unGObject.toGObject) obj) $ \objPtr -> {#call unsafe g_signal_handler_disconnect#} (castPtr objPtr) handler -- Here are the generators that turn a Haskell function into -- a C function pointer. The fist Argument is always the widget, -- the last one is the user g_pointer. Both are ignored. --- NEW FILE: gtkmarshal.list --- # see glib-genmarshal(1) for a detailed description of the file format, # possible parameter types are: # VOID indicates no return type, or no extra # parameters. if VOID is used as the parameter # list, no additional parameters may be present. # BOOLEAN for boolean types (gboolean) # CHAR for signed char types (gchar) # UCHAR for unsigned char types (guchar) # INT for signed integer types (gint) # UINT for unsigned integer types (guint) # LONG for signed long integer types (glong) # ULONG for unsigned long integer types (gulong) # ENUM for enumeration types (gint) # FLAGS for flag enumeration types (guint) # FLOAT for single-precision float types (gfloat) # DOUBLE for double-precision float types (gdouble) # STRING for string types (gchar*) # BOXED for boxed (anonymous but reference counted) types (GBoxed*) # POINTER for anonymous pointer types (gpointer) # OBJECT for GObject or derived types (GObject*) # NONE deprecated alias for VOID # BOOL deprecated alias for BOOLEAN BOOLEAN:BOXED BOOLEAN:BOXED,BOXED BOOLEAN:OBJECT,INT,INT,UINT BOOLEAN:OBJECT,STRING,STRING,BOXED BOOLEAN:OBJECT,BOXED,BOXED BOOLEAN:VOID BOOLEAN:BOOLEAN ENUM:ENUM NONE:ENUM,ENUM INT:POINTER NONE:BOOL NONE:INT NONE:INT,INT NONE:NONE NONE:POINTER NONE:STRING,INT,POINTER VOID:BOOLEAN VOID:BOXED VOID:BOXED,BOXED VOID:BOXED,BOXED,BOXED,BOXED VOID:BOXED,BOXED,POINTER VOID:BOXED,POINTER VOID:BOXED,OBJECT VOID:BOXED,STRING,INT VOID:BOXED,UINT VOID:BOXED,UINT,FLAGS VOID:BOXED,UINT,UINT VOID:ENUM VOID:ENUM,FLOAT VOID:ENUM,FLOAT,BOOL VOID:ENUM,INT VOID:ENUM,INT,BOOLEAN VOID:INT VOID:INT,INT VOID:INT,INT,BOXED VOID:INT,INT,INT VOID:OBJECT VOID:OBJECT,BOOLEAN VOID:OBJECT,BOXED,BOXED VOID:OBJECT,BOXED,UINT,UINT VOID:OBJECT,INT,INT VOID:OBJECT,INT,INT,BOXED,UINT,UINT VOID:OBJECT,OBJECT VOID:OBJECT,STRING,STRING VOID:OBJECT,UINT VOID:POINTER VOID:POINTER,INT VOID:POINTER,POINTER,POINTER VOID:POINTER,UINT VOID:STRING VOID:STRING,INT,POINTER VOID:UINT,BOXED,UINT,FLAGS,FLAGS VOID:UINT,STRING VOID:VOID # This marshaller is necessary to marshal a string with explicit length in a # callback "text-insert" in TextBuffer. VOID:BOXED,POINTER,INT # This one is needed in TextView: VOID:INT,BOOL # This is for the "edited" signal in CellRendererText: VOID:POINTER,STRING |
From: <as...@us...> - 2003-10-22 01:15:52
|
Update of /cvsroot/gtk2hs/gtk2hs/mk In directory sc8-pr-cvs1:/tmp/cvs-serv18473/mk Modified Files: common.mk Log Message: * mk/common.mk: Avoid message about several rules for the top-level file which are .chs files. This happend since the top-level file SourceView.chs is not removed form a list containing ./SourceView.chs which is what the wild-card searching gives. Solved by stripping the ./ prefix. Index: common.mk =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/common.mk,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- common.mk 18 Jul 2003 15:44:48 -0000 1.22 +++ common.mk 21 Oct 2003 23:32:10 -0000 1.23 @@ -44,7 +44,8 @@ # is extracted from the files themselves (and generated files don't exist # in a clean tree). CHSFILES := $(filter-out $(EXTRA_CHSFILES),\ - $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.chs))) + $(patsubst ./%,%,\ + $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.chs)))) ALLCHSFILES := $(NEEDCHI:=.chs) $(filter-out $(NEEDCHI:=.chs), \ $(CHSFILES) $(EXTRA_CHSFILES)) @@ -60,13 +61,15 @@ # HSC files HSCFILES := $(filter-out $(EXTRA_HSCFILES),\ - $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.hsc)))\ + $(patsubst ./%,%,\ + $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.hsc))))\ $(EXTRA_HSCFILES) # These are all .hs files that are not generated in any way. HSFILES := $(filter-out $(ALLCHSFILES:.chs=.hs)\ $(HSCFILES:.hsc=.hs) $(EXTRA_HSFILES),\ - $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.hs))) + $(patsubst ./%,%,\ + $(foreach DIR,$(SUBDIRSOK),$(wildcard $(DIR)*.hs)))) # These are all .hs files in the project. This is not the same as *.hs in # all subdirs because in a clean tree there is e.g. no .hs for a .chs file. @@ -265,8 +268,8 @@ # @echo Application: $(APPNAME) @echo EXTRA_CPPFLAGS: $(EXTRA_CPPFLAGS_ONLY_I) # @echo all CHS files: $(CHSFILES) -# @echo Standard header: $(STANDARD_HEADER) -# @echo Explicit header: $(EXPLICIT_HEADER) + @echo Standard header: $(STANDARD_HEADER) + @echo Explicit header: $(EXPLICIT_HEADER) # @echo all HSC files: $(HSCFILES) # @echo all other HS files: $(HSFILES) # @echo all files generating stubs: $(STUBOFILES) |
From: <as...@us...> - 2003-10-22 00:58:53
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/typehier In directory sc8-pr-cvs1:/tmp/cvs-serv19933/tools/typehier Added Files: Makefile TypeGenerator.hs hierarchy.list Log Message: --- NEW FILE: Makefile --- TOP = ../.. include $(TOP)/mk/config.mk APPNAME = TypeGenerator EXTRA_TARFILES += hierarchy.list include $(TOP)/mk/common.mk --- NEW FILE: TypeGenerator.hs --- -- TypeGenerator.hs -- Takes a hierarchical list of all objects in GTK+ and produces -- Haskell class that reflect this hierarchy. module Main(main) where import Char(showLitChar, isAlpha, isAlphaNum, isSpace, toLower, isUpper) import List(nub, isPrefixOf) import Maybe(catMaybes, fromMaybe) import Monad(when) import System(getArgs, exitWith, ExitCode(..)) -- The current object and its inheritence relationship is defined by all -- ancestors and their column position. type ObjectSpec = [(Int,String)] -- This is a mapping from a type name to a) the type name in Haskell and -- b) the GTK blah_get_type function. type TypeQuery = Maybe (String, (String, String)) -- A Tag is a string restricting the generation of type entries to -- those lines that have the appropriate "if <tag>" at the end. type Tag = String data ParserState = ParserState { line :: Int, col :: Int, hierObjs :: ObjectSpec, onlyTags :: [Tag] } freshParserState :: [Tag] -> ParserState freshParserState = ParserState 1 1 [] -- The parser returns a list of ObjectSpec and possibly a special type query -- function. Each ObjectSpec describes one object with all its parents. pFreshLine :: ParserState -> String -> [(ObjectSpec, TypeQuery)] pFreshLine ps input = pFL ps input where pFL ps ('#':rem) = pFL ps (dropWhile ((/=) '\n') rem) pFL ps ('\n':rem) = pFL (ps {line = line ps+1, col=1}) rem pFL ps (' ':rem) = pFL (ps {col=col ps+1}) rem pFL ps ('\t':rem) = pFL (ps {col=col ps+8}) rem pFL ps ('G':'t':'k':rem) = pGetObject ps rem pFL ps [] = [] pFL ps all = pGetObject ps all pGetObject :: ParserState -> String -> [(ObjectSpec, TypeQuery)] pGetObject ps@ParserState { onlyTags=tags } txt = (if readTag `elem` tags then (:) (spec, specialQuery) else id) $ pFreshLine (ps { hierObjs=spec}) (dropWhile ((/=) '\n') rem'') where isBlank c = c==' ' || c=='\t' isAlphaNum_ c = isAlphaNum c || c=='_' (origName,rem) = span isAlphaNum txt (name,specialQuery,rem') = case (dropWhile isBlank rem) of ('a':'s':r) -> let (tyName,r') = span isAlphaNum_ (dropWhile isBlank r) in case (dropWhile isBlank r') of (',':r) -> let (tyQuery,r') = span isAlphaNum_ (dropWhile isBlank r) in (tyName, Just (tyName, (origName, tyQuery)), r') r -> error ("line "++show (line ps)++ ": Expected a comma, found:"++take 5 r) r -> (origName, Nothing, r) parents = dropWhile (\(c,_) -> c>=col ps) (hierObjs ps) spec = (col ps,name):parents (readTag, rem'') = case (dropWhile isBlank rem) of ('i':'f':r) -> span isAlphaNum_ (dropWhile isBlank r) r -> ("default",r) ------------------------------------------------------------------------------- -- Helper functions ------------------------------------------------------------------------------- ss = showString sc = showChar indent :: Int -> ShowS indent c = ss ("\n"++replicate (2*c) ' ') ------------------------------------------------------------------------------- -- start of code generation ------------------------------------------------------------------------------- main = do args <- getArgs when (length args<2) usage let (hierFile: goalFile: rem) = args let tags = map (drop 6) (filter ("--tag=" `isPrefixOf`) rem) content <- readFile hierFile let (objs, specialQueries) = unzip $ pFreshLine (freshParserState tags) content let bareFName = reverse . takeWhile isAlphaNum . drop 1 . dropWhile isAlpha . reverse writeFile goalFile $ generate (bareFName goalFile) (map (map snd) objs) (catMaybes specialQueries) "" usage = do putStr "\nProgram to generate Gtk's object hierarchy in Haskell. Usage:\n\ \TypeGenerator <hierFile> <outFile> {--tag=<tag>}\n\ \where\n\ \ <hierFile> a list of all possible objects, the hierarchy is\n\ \ taken from the indentation\n\ \ <outFile> is the name and path of the output file\n\ \ <tag> generate entries that have the tag <tag>\ \ specify `default' for types without tags\n" exitWith $ ExitFailure 1 ------------------------------------------------------------------------------- -- generate dynamic fragments ------------------------------------------------------------------------------- generate :: String -> [[String]] -> [(String, (String, String))] -> ShowS generate fname objs typeTable = let fillCol str = ss $ replicate (maximum (map (length.head) objs)-length str) ' ' in ss "-- -*-haskell-*-". indent 0.ss "-- ******************** automatically generated file - do not edit **********". indent 0.ss "-- Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell". indent 0.ss "--". indent 0.ss "-- Author : Axel Simon". indent 0.ss "--". indent 0.ss "-- Copyright (c) 2001-2003 Axel Simon". indent 0.ss "--". indent 0.ss "-- This file is free software; you can redistribute it and/or modify". indent 0.ss "-- it under the terms of the GNU General Public License as published by". indent 0.ss "-- the Free Software Foundation; either version 2 of the License, or". indent 0.ss "-- (at your option) any later version.". indent 0.ss "--". indent 0.ss "-- This file is distributed in the hope that it will be useful,". indent 0.ss "-- but WITHOUT ANY WARRANTY; without even the implied warranty of". indent 0.ss "-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the". indent 0.ss "-- GNU General Public License for more details.". indent 0.ss "--". indent 0.ss "--- @description@ -------------------------------------------------------------". indent 0.ss "--". indent 0.ss "-- * This file reflects the Gtk object hierarchy in terms of Haskell classes.". indent 0.ss "--". indent 0.ss "--- @documentation@ -----------------------------------------------------------". indent 0.ss "--". indent 0.ss "--". indent 0.ss "--- @todo@ --------------------------------------------------------------------". indent 0.ss "--". indent 0.ss "--". indent 0.ss "module ".ss fname.sc '('. -- indent 1.ss "ObjectTag(..)". foldl (.) id (map (\(n:_) -> ss ", ". indent 1.ss n.ss "(".ss n.ss "), ".ss n.ss "Class(..),". indent 1.ss "mk".ss n.ss ", un".ss n.sc ','. indent 1.ss "castTo".ss n) objs). indent 1.ss ") where". indent 0. indent 0.ss "import FFI (ForeignPtr, castForeignPtr, foreignPtrToPtr,". ss " CULong)". indent 0.ss "import GType (typeInstanceIsA)". -- this is a very bad hack to get the definition of the ancestors whenever -- these are not created in this file (if fname/="Hierachy" then indent 0.ss "{#import Hierarchy#}" else id). indent 0. indent 0.ss "{#context lib=\"gtk\" prefix=\"gtk\" #}". indent 0. indent 0.ss "castToGObject = id". indent 0. indent 0.ss "-- The usage of foreignPtrToPtr should be safe as the evaluation will only be". indent 0.ss "-- forced if the object is used afterwards". indent 0. foldl (.) id (map (makeUpcast typeTable) objs). indent 0. -- indent 0.ss "data ObjectTag ".makeTypeTags '=' (map head objs). -- indent 0. -- indent 0.ss "instance Ord ObjectTag where". -- foldl (.) id (map (makeOrd fillCol) objs). -- indent 1.ss "compare ".ss "_ ".fillCol "_".ss " _ ".fillCol "_". -- ss " = LT". -- indent 0. indent 0. foldl (.) id (map (makeClass typeTable) objs) makeTypeTags :: Char -> [String] -> ShowS makeTypeTags c [] = ss "deriving Eq" makeTypeTags c (obj:ects) = sc c.sc ' '.ss obj.ss "Tag".indent 8. makeTypeTags '|' ects makeUpcast table [obj] = id -- no casting for GObject makeUpcast table (obj:_:_) = indent 0.ss "castTo".ss obj.ss " :: GObjectClass obj => obj -> ".ss obj. indent 0.ss "castTo".ss obj.ss " obj =". indent 1.ss "if typeInstanceIsA ((foreignPtrToPtr.castForeignPtr.unGObject.toGObject) obj)". indent 2.ss "{#call fun unsafe ". ss (maybe ("gtk"++c2u True obj++"_get_type") snd (lookup obj table)). ss "#} then". indent 3.ss "(fromGObject.toGObject) obj else". indent 4.ss "error \"Cannot cast object to ".ss obj.ss ".\"". indent 0 where -- case to underscore translation: the boolean arg specifies whether -- the first uppercase letter X is to be replaced by _x (True) or by x. -- -- translation: HButtonBox -> hbutton_box c2u :: Bool -> String -> String c2u True (x:xs) | isUpper x = '_':toLower x:c2u False xs c2u False (x:xs) | isUpper x = toLower x:c2u True xs c2u _ (x:xs) | otherwise = x:c2u True xs c2u _ [] = [] makeOrd fill [] = id makeOrd fill (obj:preds) = indent 1.ss "compare ".ss obj.ss "Tag ". fill obj.ss obj.ss "Tag".fill obj. ss " = EQ".makeGT obj preds where makeGT obj [] = id makeGT obj (pr:eds) = indent 1.ss "compare ".ss obj.ss "Tag ". fill obj.ss pr.ss "Tag".fill pr. ss " = GT".makeGT obj eds makeClass :: [(String,(String, String))] -> [String] -> ShowS makeClass table (name:parents) = indent 0.ss "-- ".ss (replicate (75-length name) '*').sc ' '.ss name. indent 0. indent 0.ss "{#pointer *". maybe (ss name) (\s -> ss (fst s).ss " as ".ss name) (lookup name table). ss " foreign newtype #}". indent 0. indent 0.ss "mk".ss name.ss " = ".ss name. indent 0.ss "un".ss name.ss " (".ss name.ss " o) = o". indent 0. indent 0.ss "class ". (if not (null parents) then ss (head parents).ss "Class o => " else id). ss name.ss "Class o where". indent 1.ss "to".ss name.ss " :: o -> ".ss name. indent 1.ss "from".ss name.ss " :: ".ss name.ss " -> o". indent 0. indent 0.ss "instance ".ss name.ss "Class ".ss name.ss " where". indent 1.ss "to".ss name.ss " = id". indent 1.ss "from".ss name.ss " = id". indent 0. makeInstance name parents. indent 0 makeInstance :: String -> [String] -> ShowS makeInstance name [] = id makeInstance name (par:ents) = indent 0.ss "instance ".ss par.ss "Class ".ss name.ss " where". indent 1.ss "to".ss par.ss " = mk".ss par.ss ".castForeignPtr.un".ss name. indent 1.ss "from".ss par.ss " = mk".ss name.ss ".castForeignPtr.un".ss par. indent 0. makeInstance name ents --- NEW FILE: hierarchy.list --- # This list is the result of a copy-and-paste from the GtkObject hierarchy # html documentation. Deprecated widgets are uncommented. Some additional # object have been defined at the end of the copied list. # The Gtk prefix of every object is removed, the other prefixes are # kept. The indentation implies the object hierarchy. In case the # type query function cannot be derived from the name or the type name # is different, an alternative name and type query function can be # specified by appending `as typename, <query_func>'. In case this # function is not specified, the <name> is converted to # gtk_<name'>_get_type where <name'> is <name> where each upperscore # letter is converted to an underscore and lowerletter. The underscore # is omitted if an upperscore letter preceeded: GtkHButtonBox -> # gtk_hbutton_box_get_type. The generation of a type can be # conditional by appending `if <tag>'. Such types are only produces if # --only=<tag> is given on the command line of TypeGenerator. GObject GdkDrawable as Drawable, gdk_drawable_get_type GdkWindow as DrawWindow, gdk_window_object_get_type # GdkDrawableImplX11 # GdkWindowImplX11 GdkPixmap as Pixmap, gdk_pixmap_get_type GdkColormap as Colormap, gdk_colormap_get_type GtkSettings GtkTextBuffer GtkSourceBuffer if sourceview GtkTextTag GtkSourceTag if sourceview GtkTextTagTable GtkSourceTagTable if sourceview GtkStyle GdkDragContext as DragContext, gdk_drag_context_get_type GdkPixbuf as Pixbuf, gdk_pixbuf_get_type GtkTextChildAnchor GtkTextMark GtkObject GtkWidget GtkMisc GtkLabel GtkAccelLabel GtkTipsQuery GtkArrow GtkImage GtkContainer GtkBin GtkAlignment GtkFrame GtkAspectFrame GtkButton GtkToggleButton GtkCheckButton GtkRadioButton GtkOptionMenu GtkItem GtkMenuItem GtkCheckMenuItem GtkRadioMenuItem GtkTearoffMenuItem GtkImageMenuItem GtkListItem # GtkTreeItem GtkWindow GtkDialog GtkColorSelectionDialog GtkFileSelection GtkFontSelectionDialog GtkInputDialog GtkMessageDialog GtkPlug if plugNsocket GtkEventBox GtkHandleBox GtkScrolledWindow GtkViewport GtkBox GtkButtonBox GtkHButtonBox GtkVButtonBox GtkVBox GtkColorSelection GtkFontSelection GtkGammaCurve GtkHBox GtkCombo GtkStatusbar GtkCList GtkCTree GtkFixed GtkPaned GtkHPaned GtkVPaned GtkLayout GtkList GtkMenuShell GtkMenu GtkMenuBar GtkNotebook # GtkPacker GtkSocket if plugNsocket GtkTable GtkTextView GtkSourceView if sourceview GtkToolbar GtkTreeView GtkCalendar GtkDrawingArea GtkCurve GtkEntry GtkSpinButton GtkRuler GtkHRuler GtkVRuler GtkRange GtkScale GtkHScale GtkVScale GtkScrollbar GtkHScrollbar GtkVScrollbar GtkSeparator GtkHSeparator GtkVSeparator GtkInvisible # GtkOldEditable # GtkText GtkPreview # Progress is deprecated, ProgressBar contains everything necessary # GtkProgress GtkProgressBar GtkAdjustment GtkIMContext GtkIMMulticontext GtkItemFactory GtkTooltips # These object were added by hand because they do not show up in the hierarchy # chart. # These are derived from GtkObject: GtkTreeViewColumn GtkCellRenderer GtkCellRendererPixbuf GtkCellRendererText # GtkCellRendererTextPixbuf GtkCellRendererToggle # These are derived from GObject: GtkTreeSelection GtkTreeModel GtkTreeStore GtkListStore GtkTreeModelSort GtkIconFactory GtkSourceLanguage if sourceview GtkSourceLanguagesManager if sourceview # This now became a GObject in version 2: GdkGC as GC, gdk_gc_get_type # These are Pango structures PangoContext as PangoContext, pango_context_get_type PangoLayout as PangoLayout, pango_layout_get_type PangoFont as Font, pango_font_get_type PangoFontFamily as FontFamiliy, pango_font_family_get_type PangoFontFace as FontFace, pango_font_face_get_type PangoFontMap as FontMap, pango_font_face_get_type PangoFontset as FontSet, pango_fontset_get_type # This type is only available for PANGO_ENABLE_BACKEND compiled source # PangoFontsetSimple as FontSetSimple, pango_fontset_simple_get_type |
From: <as...@us...> - 2003-10-22 00:58:52
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv29165 Modified Files: ChangeLog Log Message: Use TextBufferClass tb => tb instead of TextBuffer as type for the Textbuffer. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- ChangeLog 21 Oct 2003 21:28:53 -0000 1.89 +++ ChangeLog 21 Oct 2003 21:30:20 -0000 1.90 @@ -1,5 +1,8 @@ 2003-10-21 Axel Simon <A....@ke...> + * gtk/multiline/TextBuffer.chs: Use TextBufferClass tb => tb + instead of TextBuffer as type for the Textbuffer. + * gtk/abstract/Container.chs gtk/multiline/TextIter.chs: Fix warning about deprecated FFI construct for GHC 6.0. |
From: <as...@us...> - 2003-10-22 00:37:13
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/multiline In directory sc8-pr-cvs1:/tmp/cvs-serv28798/gtk/multiline Modified Files: TextIter.chs Log Message: Fix warning about deprecated FFI construct for GHC 6.0. Index: TextIter.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/multiline/TextIter.chs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- TextIter.chs 9 Jul 2003 22:42:45 -0000 1.9 +++ TextIter.chs 21 Oct 2003 21:28:53 -0000 1.10 @@ -705,8 +705,17 @@ {#pointer TextCharPredicate#} +#if __GLASGOW_HASKELL__>=600 + +foreign import ccall "wrapper" mkTextCharPredicate :: + ({#type gunichar#} -> Ptr () -> {#type gboolean#}) -> IO TextCharPredicate + +#else + foreign export dynamic mkTextCharPredicate :: ({#type gunichar#} -> Ptr () -> {#type gboolean#}) -> IO TextCharPredicate + +#endif -- @method textIterForwardFindChar@ Move @ref type TextIter@ forward until a -- predicate function returns True. |
From: <as...@us...> - 2003-10-21 23:49:51
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv19933 Modified Files: Makefile aclocal.m4 configure.in Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/Makefile,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile 31 Jul 2003 10:30:38 -0000 1.16 +++ Makefile 21 Oct 2003 23:42:03 -0000 1.17 @@ -19,6 +19,9 @@ $(MAKE) -Cc2hs $@ endif $(MAKE) -Cgtk $@ +ifeq ($(ENABLE_SOURCEVIEW), yes) + $(MAKE) -Csourceview $@ +endif $(MAKE) -Cmogul $@ ifeq ($(BUILDDOCS),yes) $(MAKE) -Cdoc all @@ -34,6 +37,9 @@ $(MAKE) -Cdemo/graphic $@ $(MAKE) -Cdemo/unicode $@ $(MAKE) -Cdemo/hello $@ +ifeq ($(ENABLE_SOURCEVIEW), yes) + $(MAKE) -Cdemo/sourceview $@ +endif install install-without-pkg : all $(MAKE) -Cgtk $@ @@ -54,6 +60,10 @@ $(MAKE) -Cdemo/graphic $@ $(MAKE) -Cdemo/treeList $@ $(MAKE) -Cdemo/concurrent $@ +ifeq ($(ENABLE_SOURCEVIEW), yes) + $(MAKE) -Cdemo/sourceview $@ + $(MAKE) -Csourceview $@ +endif ifeq ($(BUILDDOCS),yes) $(MAKE) -Cdoc $@ endif @@ -70,6 +80,8 @@ $(MAKE) -Cdemo/graphic $@ $(MAKE) -Cdemo/treeList $@ $(MAKE) -Cdemo/concurrent $@ + $(MAKE) -Cdemo/sourceview $@ + $(MAKE) -Csourceview $@ EXTRA_TARFILES = $(strip AUTHORS COPYING.LIB ChangeLog INSTALL Makefile \ TODO VERSION aclocal.m4 acinclude.m4 \ @@ -86,12 +98,14 @@ $(addprefix $(TARNAME)/,$(EXTRA_TARFILES))) $(MAKE) -Cc2hs tarsource $(MAKE) -Cgtk tarsource + $(MAKE) -Csourceview tarsource $(MAKE) -Cmogul tarsource $(MAKE) -Cdemo/hello tarsource $(MAKE) -Cdemo/unicode tarsource $(MAKE) -Cdemo/graphic tarsource $(MAKE) -Cdemo/treeList tarsource $(MAKE) -Cdemo/concurrent tarsource + $(MAKE) -Cdemo/sourceview tarsource $(MAKE) -Cgendoc tarsource $(MAKE) -Cdoc tarsource $(GZIP) $(TARNAME).tar Index: aclocal.m4 =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/aclocal.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- aclocal.m4 21 Jan 2003 15:53:07 -0000 1.2 +++ aclocal.m4 21 Oct 2003 23:42:03 -0000 1.3 @@ -1,14 +1,15 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p5 +# aclocal.m4t generated automatically by aclocal 1.5 -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. +# Copyright 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. dnl Gtk+HS - Additional macros for `autoconf' @@ -102,203 +103,6 @@ - -# Configure paths for GTK+ -# Owen Taylor 1997-2001 - -dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, -dnl pass to pkg-config -dnl -AC_DEFUN(AM_PATH_GTK_2_0, -[dnl -dnl Get the cflags and libraries from pkg-config -dnl -AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], - , enable_gtktest=yes) - - pkg_config_args=gtk+-2.0 - for module in . $4 - do - case "$module" in - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - esac - done - - no_gtk="" - - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - - if test x$PKG_CONFIG != xno ; then - if pkg-config --atleast-pkgconfig-version 0.7 ; then - : - else - echo *** pkg-config too old; version 0.7 or better required. - no_gtk=yes - PKG_CONFIG=no - fi - else - no_gtk=yes - fi - - min_gtk_version=ifelse([$1], ,2.0.0,$1) - AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" - enable_gtktest=no - fi - - if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then - : - else - no_gtk=yes - fi - fi - - if test x"$no_gtk" = x ; then - GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` - GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` - gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_gtktest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$GTK_LIBS $LIBS" -dnl -dnl Now check if the installed GTK+ is sufficiently new. (Also sanity -dnl checks the results of pkg-config to some extent) -dnl - rm -f conf.gtktest - AC_TRY_RUN([ -#include <gtk/gtk.h> -#include <stdio.h> -#include <stdlib.h> - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.gtktest"); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_gtk_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtk_version"); - exit(1); - } - - if ((gtk_major_version != $gtk_config_major_version) || - (gtk_minor_version != $gtk_config_minor_version) || - (gtk_micro_version != $gtk_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", - $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, - gtk_major_version, gtk_minor_version, gtk_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((gtk_major_version != GTK_MAJOR_VERSION) || - (gtk_minor_version != GTK_MINOR_VERSION) || - (gtk_micro_version != GTK_MICRO_VERSION)) - { - printf("*** GTK+ header files (version %d.%d.%d) do not match\n", - GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - gtk_major_version, gtk_minor_version, gtk_micro_version); - } - else - { - if ((gtk_major_version > major) || - ((gtk_major_version == major) && (gtk_minor_version > minor)) || - ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", - gtk_major_version, gtk_minor_version, gtk_micro_version); - printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_gtk" = x ; then - AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://pkgconfig.sourceforge.net" - else - if test -f conf.gtktest ; then - : - else - echo "*** Could not run GTK+ test program, checking why..." - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" - AC_TRY_LINK([ -#include <gtk/gtk.h> -#include <stdio.h> -], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GTK+ or finding the wrong" - echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GTK+ was incorrectly installed" - echo "*** or that you have moved GTK+ since it was installed. In the latter case, you" - echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GTK_CFLAGS="" - GTK_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - rm -f conf.gtktest -]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) Index: configure.in =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/configure.in,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- configure.in 9 Jul 2003 22:42:43 -0000 1.26 +++ configure.in 21 Oct 2003 23:42:03 -0000 1.27 @@ -208,7 +208,7 @@ AC_MSG_CHECKING([if OpenGL extension can be built]) AC_ARG_ENABLE(glext, - [ --enable-glext generate binding for OpenGL rendering], + [ --enable-glext generate binding for OpenGL rendering], [FOUNDGLEXT=$enableval],[FOUNDGLEXT=yes]) dnl Reset the flag if GtkGLExt is not installed @@ -223,12 +223,29 @@ AC_MSG_RESULT($ENABLE_OPENGL) +dnl Check if user wants GtkSourceView extension. Make the default value for this +dnl flag dependant on whether it is installed or not. +ENABLE_SOURCEVIEW=yes; +AC_MSG_CHECKING([if SourceView widget bindings can be built]) + +AC_ARG_ENABLE(sourceview, + [ --enable-sourceview generate binding for GtkSourceView], + [FOUNDSOURCEVIEW=$enableval],[FOUNDSOURCEVIEW=yes]) + +dnl Reset the flag if GtkSourceView is not installed +$PKG_CONFIG --exists gtksourceview-1.0 || FOUNDSOURCEVIEW=no; +if test x$FOUNDSOURCEVIEW = xno; then ENABLE_SOURCEVIEW=no;fi; + +AC_MSG_RESULT($ENABLE_SOURCEVIEW) + dnl Check for the GTK&Co libraries. Use the special PKG_CHECK_MODULES dnl macro from the pkg-config program. -if test x$ENABLE_OPENGL = xno; then - PKG_CHECK_MODULES(GTK,[glib-2.0 >= 2.0.0 gdk-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 gdk-pixbuf-2.0 >= 0.12.0]) -else - PKG_CHECK_MODULES(GTK,[glib-2.0 >= 2.0.0 gdk-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 gdk-pixbuf-2.0 >= 0.12.0 gtkglext-1.0 >= 0.7.1]) +PKG_CHECK_MODULES(GTK,[glib-2.0 >= 2.0.0 gdk-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 gdk-pixbuf-2.0 >= 0.12.0]) +if test x$ENABLE_OPENGL = xyes; then + PKG_CHECK_MODULES(GTK,[gtkglext-1.0 >= 0.7.1]) +fi +if test x$ENABLE_SOURCEVIEW = xyes; then + PKG_CHECK_MODULES(GTK,[gtksourceview-1.0 >= 0.6.0]) fi dnl The configuration program for GTK is kind of stupid in that it @@ -261,7 +278,7 @@ [ --with-mlist=GTK-SOURCE use special marshall list from GTK+ sources], [MARSHALLDEFS=$withval; AC_MSG_RESULT($withval)], - [MARSHALLDEFS=$TOP/gtk/signals/gtkmarshal.list; + [MARSHALLDEFS=$TOP/tools/signals/gtkmarshal.list; AC_MSG_RESULT(built-in)]) @@ -455,6 +472,7 @@ dnl AC_SUBST(GTK_MINOR_VERSION) dnl AC_SUBST(GTK_MICRO_VERSION) AC_SUBST(ENABLE_OPENGL) +AC_SUBST(ENABLE_SOURCEVIEW) dnl Documentation AC_SUBST(BUILDDOCS) AC_SUBST(XSLTTRANS) |
From: <as...@us...> - 2003-10-21 23:49:31
|
Update of /cvsroot/gtk2hs/gtk2hs/mk In directory sc8-pr-cvs1:/tmp/cvs-serv19933/mk Modified Files: application.mk config.mk.in Log Message: Index: application.mk =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/application.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- application.mk 18 Jun 2002 23:14:22 -0000 1.3 +++ application.mk 21 Oct 2003 23:42:03 -0000 1.4 @@ -9,5 +9,5 @@ $(EXTRAHC_FLAGS) -i$(HIDIRSOK) $(NEEDPACKAGESOK) $(STUBOFILES) \ $(EXTRA_CFILES:.c=.o) $(addprefix -#include ,$(STUBHFILES))) -EXTRA_CLEANFILES += Main.hi +EXTRA_CLEANFILES += Main.hi $(TARGETOK) Index: config.mk.in =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/config.mk.in,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- config.mk.in 4 Jul 2003 08:27:00 -0000 1.17 +++ config.mk.in 21 Oct 2003 23:42:03 -0000 1.18 @@ -83,6 +83,8 @@ # Provide an OpenGL widget. ENABLE_OPENGL = @ENABLE_OPENGL@ +# Provide a SourceView widget. +ENABLE_SOURCEVIEW = @ENABLE_SOURCEVIEW@ # This should be libXXX.a and XXX for Unix and # XXX.lib and XXX.exe for Windows |
From: <as...@us...> - 2003-10-21 23:48:40
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/signals In directory sc8-pr-cvs1:/tmp/cvs-serv19933/gtk Added Files: Makefile Log Message: --- NEW FILE: Makefile --- TOP = .. include $(TOP)/mk/config.mk SUBDIRS = abstract buttons display entry general layout menuComboToolbar \ misc multiline ornaments scrolling \ treeList windows gdk glib pango ../compat ifeq ($(WIN32),yes) EXTRA_HFILES = $(TOP)/gtk/wingtk.h SUBSYSTEM = windows else SUBDIRS += embedding TYPE_TAGS += plugNsocket endif EXTRA_TARFILES = wingtk.h PACKAGENAME = gtk2 LIBNAME = gtk2hs INSTALLDIR = gtk2hs MAIN = general/Gtk.hs HEADER = gtk/gtk.h # Whenever a variable module-HEADER is defined, the file module.chs # is translated with a separate invokation of c2hs with the header # file $module-HEADER. The header file in this variable should be # the most specific header file so that c2hs needs to parse as little # header source as possible. All modules for which module-HEADER is # not defined will be compiled by c2hs with $HEADER as header file and # all pending modules at once. This currently only works with the local # copy of c2hs, which is why the following HEADER variables are only set # if we compile with an external c2hs. ifneq (x$(MULTIPLE_CHS),xyes) # glib modules GObject-HEADER = glib-object.h GType-HEADER = glib-object.h GValue-HEADER = glib-object.h GValueTypes-HEADER = glib-object.h GList-HEADER = glib.h # pango modules PangoLayout-HEADER = pango/pango-layout.h PangoTypes-HEADER = pango/pango.h Rendering-HEADER = pango/pango-context.h # gdk modules GdkEnums-HEADER = gdk/gdk.h GdkKeys-HEADER = gdk/gdkkeys.h Region-HEADER = gdk/gdkregion.h Drawable-HEADER = gdk/gdkdrawable.h GC-HEADER = gdk/gdkgc.h Keys-HEADER = gdk/gdkkeys.h Drawable-HEADER = gdk/gdkdrawable.h Pixbuf-HEADER = gdk/gdkpixbuf.h Gdk-HEADER = gdk/gdk.h # general Gtk modules IconFactory-HEADER = gtk/gtkiconfactory.h Signal-HEADER = gtk/gtksignal.h Style-HEADER = gtk/gtkstyle.h Enums-HEADER = gtk/gtk.h General-HEADER = gtk/gtk.h Signal-HEADER = gtk/gtk.h Hierarchy-HEADER = gtk/gtk.h # windows Window-HEADER = gtk/gtkwindow.h Dialog-HEADER = gtk/gtkdialog.h Plug-HEADER = gtk/gtkplug.h FileSel-HEADER = gtk/gtkfilesel.h # abstract Object-HEADER = gtk/gtkobject.h Widget-HEADER = gtk/gtkwidget.h Container-HEADER = gtk/gtkcontainer.h Box-HEADER = gtk/gtkbox.h Paned-HEADER = gtk/gtkpaned.h Range-HEADER = gtk/gtkrange.h Scale-HEADER = gtk/gtkscale.h # display AccelLabel-HEADER = gtk/gtkaccellabel.h Label-HEADER = gtk/gtklabel.h Image-HEADER = gtk/gtkimage.h ProgressBar-HEADER = gtk/gtkprogressbar.h Statusbar-HEADER = gtk/gtkstatusbar.h # buttons Button-HEADER = gtk/gtkbutton.h CheckButton-HEADER = gtk/gtkcheckbutton.h RadioButton-HEADER = gtk/gtkradiobutton.h ToggleButton-HEADER = gtk/gtktogglebutton.h # entry Entry-HEADER = gtk/gtkentry.h HScale-HEADER = gtk/gtkhscale.h VScale-HEADER = gtk/gtkvscale.h SpinButton-HEADER = gtk/gtkspinbutton.h # layout Alignment-HEADER = gtk/gtkalignment.h AspectFrame-HEADER = gtk/gtkaspectframe.h HBox-HEADER = gtk/gtkhbox.h VBox-HEADER = gtk/gtkvbox.h HPaned-HEADER = gtk/gtkhpaned.h VPaned-HEADER = gtk/gtkvpaned.h Table-HEADER = gtk/gtktable.h Layout-HEADER = gtk/gtklayout.h Notebook-HEADER = gtk/gtknotebook.h # menu and combo Combo-HEADER = gtk/gtk.h CheckMenuItem-HEADER = gtk/gtkcheckmenuitem.h MenuShell-HEADER = gtk/gtkmenushell.h MenuBar-HEADER = gtk/gtkmenubar.h Menu-HEADER = gtk/gtkmenu.h MenuItem-HEADER = gtk/gtkmenuitem.h ImageMenuItem-HEADER = gtk/gtkimagemenuitem.h RadioMenuItem-HEADER = gtk/gtkradiomenuitem.h OptionMenu-HEADER = gtk/gtkoptionmenu.h TearoffMenuItem-HEADER = gtk/gtktearoffmenuitem.h Toolbar-HEADER = gtk/gtktoolbar.h # multiline TextBuffer-HEADER = gtk/gtktextbuffer.h TextIter-HEADER = gtk/gtktextiter.h # gtktextmark.h does not include gobject.h but needs it TextMark-HEADER = gtk/gtk.h TextTag-HEADER = gtk/gtktexttag.h TextTagTable-HEADER = gtk/gtktexttagtable.h TextView-HEADER = gtk/gtktextview.h # ornaments Frame-HEADER = gtk/gtkframe.h HSeparator-HEADER = gtk/gtkhseparator.h VSeparator-HEADER = gtk/gtkvseparator.h # scrolling HScrollbar-HEADER = gtk/gtkhscrollbar.h ScrolledWindow-HEADER = gtk/gtkscrolledwindow.h VScrollbar-HEADER = gtk/gtkvscrollbar.h # misc Adjustment-HEADER = gtk/gtkadjustment.h Arrow-HEADER = gtk/gtkarrow.h Calendar-HEADER = gtk/gtkcalendar.h DrawingArea-HEADER = gtk/gtkdrawingarea.h Socket-HEADER = gtk/gtksocket.h Misc-HEADER = gtk/gtkmisc.h EventBox-HEADER = gtk/gtkeventbox.h Calendar-HEADER = gtk/gtkcalendar.h HandleBox-HEADER = gtk/gtkhandlebox.h # gtkwidget.h is not included but needed by gtktooltips.h, thus use gtk.h Tooltips-HEADER = gtk/gtk.h Viewport-HEADER = gtk/gtkviewport.h # trees and lists TreeSelection-HEADER = gtk/gtktreeselection.h TreeStore-HEADER = gtk/gtktreestore.h TreeView-HEADER = gtk/gtktreeview.h TreeViewColumn-HEADER = gtk/gtktreeviewcolumn.h TreeModel-HEADER = gtk/gtktreemodel.h TreeModelSort-HEADER = gtk/gtktreemodelsort.h CellRenderer-HEADER = gtk/gtkcellrenderer.h CellRendererText-HEADER = gtk/gtkcellrenderertext.h CellRendererPixbuf-HEADER = gtk/gtkcellrendererpixbuf.h CellRendererToggle-HEADER = gtk/gtkcellrenderertoggle.h ListStore-HEADER = gtk/gtkliststore.h # extensions Pixbuf-HEADER = gtk/gtk.h # replace last line with gdk-pixbuf/gdk-pixbuf.h endif # These are .chi files that need to be created before any other .chs files. # This is a very poor way of expressing dependencies. NEEDCHI = general/Hierarchy general/Signal glib/GValue glib/GList \ glib/GObject pango/PangoTypes \ treeList/TreeModel treeList/TreeViewColumn multiline/TextIter \ gdk/Region ifneq (x$(NEW_MODULE_SYS),xyes) NEEDPACKAGES = data lang else NEEDPACKAGES = data endif # options that are needed when compiling this or with this package: EXTRAHC_FLAGS = -fglasgow-exts # Further options to the C preprocessor are passed verbatim: EXTRA_CPPFLAGS = $(GTK_CFLAGS) EXTRA_LIBS = $(GTK_LIBS) # These symbols are need to break a dependency circle. #\"-u TreeSelection_dwzw\",\"-u TreeSelection_dwzx\" # EXTRA_SYMBOLS = TreeSelection_dwzw TreeSelection_dwzx # the signal marshallers are generated automatically EXTRA_CHSFILES += general/Signal.chs EXTRA_STUBFILES += general/Signal.chs EXTRA_CLEANFILES+= general/Signal.chs ifeq (x$(BROKENCB),xyes) ENABLEBROKEN = --broken else ENABLEBROKEN = endif general/Signal.chs : $(MARSHALLDEFS) $(strip ../tools/signals/HookGenerator $(MARSHALLDEFS) \ ../tools/signals \ general/Signal.chs $(ENABLEBROKEN)) EXTRA_CHSFILES += general/Hierarchy.chs TYPE_TAGS += default EXTRA_CLEANFILES+= general/Hierarchy.chs general/Hierarchy.chs : ../tools/typehier/hierarchy.list $(strip ../tools/typehier/TypeGenerator \ ../tools/typehier/hierarchy.list \ general/Hierarchy.chs \ $(addprefix --tag=,$(TYPE_TAGS))) include $(TOP)/mk/common.mk |
From: <as...@us...> - 2003-10-21 23:43:48
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/abstract In directory sc8-pr-cvs1:/tmp/cvs-serv28798/gtk/abstract Modified Files: Container.chs Log Message: Fix warning about deprecated FFI construct for GHC 6.0. Index: Container.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/abstract/Container.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Container.chs 9 Jul 2003 22:42:43 -0000 1.5 +++ Container.chs 21 Oct 2003 21:28:53 -0000 1.6 @@ -1,3 +1,4 @@ +{-# OPTIONS -cpp #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) @entry Widget Container@ -- @@ -106,8 +107,17 @@ type ContainerForeachCB = Widget -> IO () {#pointer Callback#} +#if __GLASGOW_HASKELL__>=600 + +foreign import ccall "wrapper" mkContainerForeachFunc :: + (Ptr Widget -> Ptr () -> IO ()) -> IO Callback + +#else + foreign export dynamic mkContainerForeachFunc :: (Ptr Widget -> Ptr () -> IO ()) -> IO Callback + +#endif -- @method containerFocus@ Give the focus to the container. -- * The @ref arg direction@ argument determines what kind of focus |
From: <as...@us...> - 2003-10-21 23:22:11
|
Update of /cvsroot/gtk2hs/gtk2hs/sourceview In directory sc8-pr-cvs1:/tmp/cvs-serv16331/sourceview Log Message: Directory /cvsroot/gtk2hs/gtk2hs/sourceview added to the repository |
From: <as...@us...> - 2003-10-21 23:12:11
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/multiline In directory sc8-pr-cvs1:/tmp/cvs-serv29165/gtk/multiline Modified Files: TextBuffer.chs Log Message: Use TextBufferClass tb => tb instead of TextBuffer as type for the Textbuffer. Index: TextBuffer.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/multiline/TextBuffer.chs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- TextBuffer.chs 2 Aug 2003 05:55:35 -0000 1.9 +++ TextBuffer.chs 21 Oct 2003 21:30:20 -0000 1.10 @@ -151,9 +151,9 @@ -- @method textBufferGetLineCount@ Obtain the number of lines in the buffer. -- -textBufferGetLineCount :: TextBuffer -> IO Int +textBufferGetLineCount :: TextBufferClass tb => tb -> IO Int textBufferGetLineCount tb = liftM fromIntegral $ - {#call unsafe text_buffer_get_line_count#} tb + {#call unsafe text_buffer_get_line_count#} (toTextBuffer tb) -- @method textBufferGetCharCount@ Obtain the number of characters in the -- buffer. @@ -161,29 +161,30 @@ -- * Note that the comment in the Gtk+ documentation about bytes and chars -- does not hold because Haskell uses 31-bit characters and not UTF8. -- -textBufferGetCharCount :: TextBuffer -> IO Int +textBufferGetCharCount :: TextBufferClass tb => tb -> IO Int textBufferGetCharCount tb = liftM fromIntegral $ - {#call unsafe text_buffer_get_char_count#} tb + {#call unsafe text_buffer_get_char_count#} (toTextBuffer tb) -- @method textBufferGetTagTable@ Extract the tag table that is associated -- with this text buffer. -- -textBufferGetTagTable :: TextBuffer -> IO TextTagTable +textBufferGetTagTable :: TextBufferClass tb => tb -> IO TextTagTable textBufferGetTagTable tb = makeNewGObject mkTextTagTable $ liftM castPtr $ - {#call unsafe text_buffer_get_tag_table#} tb + {#call unsafe text_buffer_get_tag_table#} (toTextBuffer tb) -- @method textBufferInsert@ Insert text at the position specified by the -- @ref type TextIter@. -- -textBufferInsert :: TextBuffer -> TextIter -> String -> IO () +textBufferInsert :: TextBufferClass tb => tb -> TextIter -> String -> IO () textBufferInsert tb iter str = withUTFStringLen str $ \(cStr, len) -> - {#call text_buffer_insert#} tb iter cStr (fromIntegral len) + {#call text_buffer_insert#} (toTextBuffer tb) iter cStr (fromIntegral len) -- @method textBufferInsertAtCursor@ Insert text at the cursor. -- -textBufferInsertAtCursor :: TextBuffer -> String -> IO () +textBufferInsertAtCursor :: TextBufferClass tb => tb -> String -> IO () textBufferInsertAtCursor tb str = withUTFStringLen str $ \(cStr, len) -> - {#call text_buffer_insert_at_cursor#} tb cStr (fromIntegral len) + {#call text_buffer_insert_at_cursor#} (toTextBuffer tb) cStr + (fromIntegral len) -- @method textBufferInsertInteractive@ Insert text at the @ref type TextIter@ -- only if a normal user would be able to do so as well. @@ -194,19 +195,21 @@ -- @ref arg def@ to decide if the text should be inserted. This value could -- be set to the result of @ref method textViewGetEditable@. -- -textBufferInsertInteractive :: TextBuffer -> TextIter -> String -> Bool -> - IO Bool +textBufferInsertInteractive :: TextBufferClass tb => tb -> TextIter -> + String -> Bool -> + IO Bool textBufferInsertInteractive tb iter str def = withUTFStringLen str $ \(cStr, len) -> liftM toBool $ {#call text_buffer_insert_interactive#} - tb iter cStr (fromIntegral len) (fromBool def) + (toTextBuffer tb) iter cStr (fromIntegral len) (fromBool def) -- @method textBufferInsertInteractiveAtCursor@ Insert text at cursor only if -- a normal user would be able to do so as well. -- -textBufferInsertInteractiveAtCursor :: TextBuffer -> String -> Bool -> IO Bool +textBufferInsertInteractiveAtCursor :: TextBufferClass tb => tb -> String -> + Bool -> IO Bool textBufferInsertInteractiveAtCursor tb str def = withUTFStringLen str $ \(cStr, len) -> liftM toBool $ - {#call text_buffer_insert_interactive_at_cursor #} tb cStr + {#call text_buffer_insert_interactive_at_cursor #} (toTextBuffer tb) cStr (fromIntegral len) (fromBool def) -- @method textBufferInsertRange@ Copy text between the two @@ -217,10 +220,10 @@ -- -- -textBufferInsertRange :: TextBuffer -> TextIter -> TextIter -> TextIter -> - IO () +textBufferInsertRange :: TextBufferClass tb => tb -> TextIter -> TextIter -> + TextIter -> IO () textBufferInsertRange tb ins start end = {#call text_buffer_insert_range#} - tb ins start end + (toTextBuffer tb) ins start end -- @method textBufferInsertRangeInteractive@ Copy text as -- @ref method textBufferInsertRange@ does, but obey editable and non-editable @@ -232,31 +235,35 @@ -- @ref arg def@ to decide if the text should be inserted. This value could -- be set to the result of @ref method textViewGetEditable@. -- -textBufferInsertRangeInteractive :: TextBuffer -> TextIter -> TextIter -> - TextIter -> Bool -> IO Bool +textBufferInsertRangeInteractive :: TextBufferClass tb => tb -> TextIter -> + TextIter -> TextIter -> Bool -> IO Bool textBufferInsertRangeInteractive tb ins start end def = liftM toBool $ - {#call text_buffer_insert_range_interactive#} tb ins start end (fromBool def) + {#call text_buffer_insert_range_interactive#} (toTextBuffer tb) ins start + end (fromBool def) -- @method textBufferDelete@ Delete some text. -- -textBufferDelete :: TextBuffer -> TextIter -> TextIter -> IO () -textBufferDelete tb start end = {#call text_buffer_delete#} tb start end +textBufferDelete :: TextBufferClass tb => tb -> TextIter -> TextIter -> IO () +textBufferDelete tb start end = {#call text_buffer_delete#} (toTextBuffer tb) + start end -- @method textBufferDeleteInteractive@ Delete some text but obey editable and -- non-editable tags. -- -textBufferDeleteInteractive :: TextBuffer -> TextIter -> TextIter -> Bool -> - IO Bool +textBufferDeleteInteractive :: TextBufferClass tb => tb -> TextIter -> + TextIter -> Bool -> + IO Bool textBufferDeleteInteractive tb start end def = liftM toBool $ - {#call text_buffer_delete_interactive#} tb start end (fromBool def) + {#call text_buffer_delete_interactive#} (toTextBuffer tb) start end + (fromBool def) -- @method textBufferSetText@ Replace the text in the current -- @ref type TextBuffer@. -- -textBufferSetText :: TextBuffer -> String -> IO () +textBufferSetText :: TextBufferClass tb => tb -> String -> IO () textBufferSetText tb str = withUTFStringLen str $ \(cStr, len) -> - {#call text_buffer_set_text#} tb cStr (fromIntegral len) + {#call text_buffer_set_text#} (toTextBuffer tb) cStr (fromIntegral len) -- @method textBufferGetText@ Extract all the text between @ref arg start@ and -- @ref arg end@ from a @ref type TextBuffer@. @@ -269,9 +276,10 @@ -- * Characters representing embedded images are not included. (So offsets -- within the returned text are different from the Buffer itself.) -- -textBufferGetText :: TextBuffer -> TextIter -> TextIter -> Bool -> IO String +textBufferGetText :: TextBufferClass tb => tb -> TextIter -> TextIter -> + Bool -> IO String textBufferGetText tb start end incl = {#call unsafe text_buffer_get_text#} - tb start end (fromBool incl) >>= peekUTFString + (toTextBuffer tb) start end (fromBool incl) >>= peekUTFString -- @method textBufferGetSlice@ Extract text and special characters between -- @ref arg start@ and @ref arg end@. @@ -281,18 +289,20 @@ -- string correspond to offsets in the @ref type TextBuffer@. Note the -- @literal (chr 0xFFFC)@ can occur in normal text without images as well. -- -textBufferGetSlice :: TextBuffer -> TextIter -> TextIter -> Bool -> IO String +textBufferGetSlice :: TextBufferClass tb => tb -> TextIter -> TextIter -> + Bool -> IO String textBufferGetSlice tb start end incl = {#call unsafe text_buffer_get_slice#} - tb start end (fromBool incl) >>= peekUTFString + (toTextBuffer tb) start end (fromBool incl) >>= peekUTFString -- @method textBufferInsertPixbuf@ Insert an image into the -- @ref type TextBuffer@. -- -- * See @ref method textBufferGetSlice@ and @ref method textBufferGetText@. -- -textBufferInsertPixbuf :: TextBuffer -> TextIter -> Pixbuf -> IO () +textBufferInsertPixbuf :: TextBufferClass tb => tb -> TextIter -> Pixbuf -> + IO () textBufferInsertPixbuf tb pos img = - {#call text_buffer_insert_pixbuf#} tb pos img + {#call text_buffer_insert_pixbuf#} (toTextBuffer tb) pos img -- @method textBufferCreateMark@ Create a @ref type TextMark@ from an -- iterator. @@ -302,50 +312,57 @@ -- -- * Set @ref arg gravity@ to True if the mark should keep left. -- -textBufferCreateMark :: TextBuffer -> Maybe MarkName -> TextIter -> Bool -> - IO TextMark +textBufferCreateMark :: TextBufferClass tb => tb -> Maybe MarkName -> + TextIter -> Bool -> + IO TextMark textBufferCreateMark tb Nothing iter gravity = makeNewGObject mkTextMark $ - {#call unsafe text_buffer_create_mark#} tb nullPtr iter (fromBool gravity) + {#call unsafe text_buffer_create_mark#} (toTextBuffer tb) nullPtr iter + (fromBool gravity) textBufferCreateMark tb (Just name) iter gravity = makeNewGObject mkTextMark $ withUTFString name $ \cStr -> - {#call unsafe text_buffer_create_mark#} tb cStr iter (fromBool gravity) + {#call unsafe text_buffer_create_mark#} (toTextBuffer tb) cStr iter + (fromBool gravity) -- @method textBufferMoveMark@ Move a mark. -- -- * Emits "mark_set". -- -textBufferMoveMark :: TextBuffer -> TextMark -> TextIter -> IO () -textBufferMoveMark tb tm iter = {#call text_buffer_move_mark#} tb tm iter +textBufferMoveMark :: TextBufferClass tb => tb -> TextMark -> TextIter -> IO () +textBufferMoveMark tb tm iter = + {#call text_buffer_move_mark#} (toTextBuffer tb) tm iter -- @method textBufferMoveMarkByName@ Move a named mark. -- -- * The mark should exist (otherwise a nasty warning is generated). -- -textBufferMoveMarkByName :: TextBuffer -> MarkName -> TextIter -> IO () +textBufferMoveMarkByName :: TextBufferClass tb => tb -> MarkName -> + TextIter -> IO () textBufferMoveMarkByName tb name iter = withUTFString name $ \cStr -> - {#call text_buffer_move_mark_by_name#} tb cStr iter + {#call text_buffer_move_mark_by_name#} (toTextBuffer tb) cStr iter -- @method textBufferDeleteMark@ Delete a mark. -- -- * This renders the @ref type TextMark@ @ref arg tm@ unusable forever. -- -textBufferDeleteMark :: TextBuffer -> TextMark -> IO () -textBufferDeleteMark tb tm = {#call text_buffer_delete_mark#} tb tm +textBufferDeleteMark :: TextBufferClass tb => tb -> TextMark -> IO () +textBufferDeleteMark tb tm = + {#call text_buffer_delete_mark#} (toTextBuffer tb) tm -- @method textBufferDeleteMarkByName@ Delete a mark by name. -- -- * The mark should exist (otherwise a nasty warning is generated). -- -textBufferDeleteMarkByName :: TextBuffer -> MarkName -> IO () +textBufferDeleteMarkByName :: TextBufferClass tb => tb -> MarkName -> IO () textBufferDeleteMarkByName tb name = withUTFString name $ \cStr -> - {#call text_buffer_delete_mark_by_name#} tb cStr + {#call text_buffer_delete_mark_by_name#} (toTextBuffer tb) cStr -- @method textBufferGetMark@ Retrieve a @ref type TextMark@ by name. -- -textBufferGetMark :: TextBuffer -> MarkName -> IO (Maybe TextMark) +textBufferGetMark :: TextBufferClass tb => tb -> MarkName -> + IO (Maybe TextMark) textBufferGetMark tb name = do tm <- withUTFString name $ \cStr -> - {#call unsafe text_buffer_get_mark#} tb cStr + {#call unsafe text_buffer_get_mark#} (toTextBuffer tb) cStr if tm==nullPtr then return Nothing else liftM Just $ makeNewGObject mkTextMark (return tm) @@ -353,50 +370,55 @@ -- -- * This is equivalent to liftM unJust $ textBufferGetMark "insert" -- -textBufferGetInsert :: TextBuffer -> IO TextMark +textBufferGetInsert :: TextBufferClass tb => tb -> IO TextMark textBufferGetInsert tb = makeNewGObject mkTextMark $ - {#call unsafe text_buffer_get_insert#} tb + {#call unsafe text_buffer_get_insert#} (toTextBuffer tb) -- @method textBufferGetSelectionBound@ Get a @ref type TextMark@ for the -- other side of a selection. -- -textBufferGetSelectionBound :: TextBuffer -> IO TextMark +textBufferGetSelectionBound :: TextBufferClass tb => tb -> IO TextMark textBufferGetSelectionBound tb = makeNewGObject mkTextMark $ - {#call unsafe text_buffer_get_selection_bound#} tb + {#call unsafe text_buffer_get_selection_bound#} (toTextBuffer tb) -- @method textBufferPlaceCursor@ Place the cursor. -- -- * This is faster than moving the "insert" and the "selection_bound" marks -- in sequence since it avoids generating a transient selection. -- -textBufferPlaceCursor :: TextBuffer -> TextIter -> IO () -textBufferPlaceCursor tb iter = {#call text_buffer_place_cursor#} tb iter +textBufferPlaceCursor :: TextBufferClass tb => tb -> TextIter -> IO () +textBufferPlaceCursor tb iter = + {#call text_buffer_place_cursor#} (toTextBuffer tb) iter -- @method textBufferApplyTag@ Tag a range of text. -- -textBufferApplyTag :: TextBuffer -> TextTag -> TextIter -> TextIter -> IO () +textBufferApplyTag :: TextBufferClass tb => tb -> TextTag -> TextIter -> + TextIter -> IO () textBufferApplyTag tb tag start end = - {#call text_buffer_apply_tag#} tb tag start end + {#call text_buffer_apply_tag#} (toTextBuffer tb) tag start end -- @method textBufferRemoveTag@ Remove a tag from a range of text. -- -textBufferRemoveTag :: TextBuffer -> TextTag -> TextIter -> TextIter -> IO () +textBufferRemoveTag :: TextBufferClass tb => tb -> TextTag -> TextIter -> + TextIter -> IO () textBufferRemoveTag tb tag start end = - {#call text_buffer_remove_tag#} tb tag start end + {#call text_buffer_remove_tag#} (toTextBuffer tb) tag start end -- @method textBufferApplyTagByName@ Apply a tag that is specified by name. -- -textBufferApplyTagByName :: TextBuffer -> TagName -> TextIter -> TextIter -> - IO () +textBufferApplyTagByName :: TextBufferClass tb => tb -> TagName -> + TextIter -> TextIter -> + IO () textBufferApplyTagByName tb tname start end = withUTFString tname $ \cStr -> - {#call text_buffer_apply_tag_by_name#} tb cStr start end + {#call text_buffer_apply_tag_by_name#} (toTextBuffer tb) cStr start end -- @method textBufferRemoveTagByName@ Remove a tag from a range of text. -- -textBufferRemoveTagByName :: TextBuffer -> TagName -> TextIter -> TextIter -> - IO () +textBufferRemoveTagByName :: TextBufferClass tb => tb -> TagName -> + TextIter -> TextIter -> + IO () textBufferRemoveTagByName tb tname start end = withUTFString tname $ \cStr -> - {#call text_buffer_remove_tag_by_name#} tb cStr start end + {#call text_buffer_remove_tag_by_name#} (toTextBuffer tb) cStr start end -- @method textBufferRemoveAllTags@ Remove all tags within a range. -- @@ -409,20 +431,22 @@ -- -- -textBufferRemoveAllTags :: TextBuffer -> TextIter -> TextIter -> IO () +textBufferRemoveAllTags :: TextBufferClass tb => tb -> TextIter -> + TextIter -> IO () textBufferRemoveAllTags tb start end = - {#call text_buffer_remove_all_tags#} tb start end + {#call text_buffer_remove_all_tags#} (toTextBuffer tb) start end -- @method textBufferGetIterAtLineOffset@ Create an iterator at a specific -- line and offset. -- -- * The @ref arg line@ and @ref arg offset@ arguments must be valid. -- -textBufferGetIterAtLineOffset :: TextBuffer -> Int -> Int -> IO TextIter +textBufferGetIterAtLineOffset :: TextBufferClass tb => tb -> Int -> Int -> + IO TextIter textBufferGetIterAtLineOffset tb line offset = do iter <- makeEmptyTextIter {#call unsafe text_buffer_get_iter_at_line_offset#} - tb iter (fromIntegral line) (fromIntegral offset) + (toTextBuffer tb) iter (fromIntegral line) (fromIntegral offset) return iter -- @method textBufferGetIterAtOffset@ Create an iterator at a specific offset. @@ -430,41 +454,41 @@ -- * The @ref arg offset@ arguments must be valid, starting from the first -- character in the buffer. -- -textBufferGetIterAtOffset :: TextBuffer -> Int -> IO TextIter +textBufferGetIterAtOffset :: TextBufferClass tb => tb -> Int -> IO TextIter textBufferGetIterAtOffset tb offset = do iter <- makeEmptyTextIter {#call unsafe text_buffer_get_iter_at_offset#} - tb iter (fromIntegral offset) + (toTextBuffer tb) iter (fromIntegral offset) return iter -- @method textBufferGetIterAtLine@ Create an iterator at a specific line. -- -- * The @ref arg line@ arguments must be valid. -- -textBufferGetIterAtLine :: Int -> TextBuffer -> IO TextIter +textBufferGetIterAtLine :: TextBufferClass tb => Int -> tb -> IO TextIter textBufferGetIterAtLine line tb = do iter <- makeEmptyTextIter {#call unsafe text_buffer_get_iter_at_line#} - tb iter (fromIntegral line) + (toTextBuffer tb) iter (fromIntegral line) return iter -- @method textBufferGetIterAtMark@ Create an iterator from a mark. -- -textBufferGetIterAtMark :: TextBuffer -> TextMark -> IO TextIter +textBufferGetIterAtMark :: TextBufferClass tb => tb -> TextMark -> IO TextIter textBufferGetIterAtMark tb tm = do iter <- makeEmptyTextIter - {#call unsafe text_buffer_get_iter_at_mark#} tb iter tm + {#call unsafe text_buffer_get_iter_at_mark#} (toTextBuffer tb) iter tm return iter -- @method textBufferGetStartIter@ Create an iterator at the beginning of the -- buffer. -- -textBufferGetStartIter :: TextBuffer -> IO TextIter +textBufferGetStartIter :: TextBufferClass tb => tb -> IO TextIter textBufferGetStartIter tb = do iter <- makeEmptyTextIter - {#call unsafe text_buffer_get_start_iter#} tb iter + {#call unsafe text_buffer_get_start_iter#} (toTextBuffer tb) iter return iter -- @method textBufferGetEndIter@ Create an iterator at the end of the buffer. @@ -472,10 +496,10 @@ -- * The iterator represents the position after the last character in the -- buffer. -- -textBufferGetEndIter :: TextBuffer -> IO TextIter +textBufferGetEndIter :: TextBufferClass tb => tb -> IO TextIter textBufferGetEndIter tb = do iter <- makeEmptyTextIter - {#call unsafe text_buffer_get_end_iter#} tb iter + {#call unsafe text_buffer_get_end_iter#} (toTextBuffer tb) iter return iter @@ -486,15 +510,15 @@ -- * It is usually more convenient to use -- @ref signal connectToModifiedChanged@. -- -textBufferGetModified :: TextBuffer -> IO Bool +textBufferGetModified :: TextBufferClass tb => tb -> IO Bool textBufferGetModified tb = liftM toBool $ - {#call unsafe text_buffer_get_modified#} tb + {#call unsafe text_buffer_get_modified#} (toTextBuffer tb) -- @method textBufferSetModified@ Set the "buffer-is-modified" flag. -- -textBufferSetModified :: TextBuffer -> Bool -> IO () +textBufferSetModified :: TextBufferClass tb => tb -> Bool -> IO () textBufferSetModified tb isModified = - {#call text_buffer_set_modified#} tb (fromBool isModified) + {#call text_buffer_set_modified#} (toTextBuffer tb) (fromBool isModified) -- @method textBufferDeleteSelection@ Delete the current selection. -- @@ -506,17 +530,18 @@ -- -- * The function returns True if a non-empty selection was deleted. -- -textBufferDeleteSelection :: TextBuffer -> Bool -> Bool -> IO Bool +textBufferDeleteSelection :: TextBufferClass tb => tb -> Bool -> Bool -> + IO Bool textBufferDeleteSelection tb interactive def = liftM toBool $ - {#call text_buffer_delete_selection#} tb (fromBool interactive) - (fromBool def) + {#call text_buffer_delete_selection#} (toTextBuffer tb) + (fromBool interactive) (fromBool def) -- @method textBufferHasSelection@ Check if a selection exists. -- -textBufferHasSelection :: TextBuffer -> IO Bool +textBufferHasSelection :: TextBufferClass tb => tb -> IO Bool textBufferHasSelection tb = liftM toBool $ {#call unsafe text_buffer_get_selection_bounds#} - tb (TextIter nullForeignPtr) (TextIter nullForeignPtr) + (toTextBuffer tb) (TextIter nullForeignPtr) (TextIter nullForeignPtr) -- @method textBufferBeginUserAction@ Start a new atomic user action. -- @@ -535,13 +560,15 @@ -- to add extra calls if you user action consists solely of a single call to -- one of those functions. -- -textBufferBeginUserAction :: TextBuffer -> IO () -textBufferBeginUserAction = {#call text_buffer_begin_user_action#} +textBufferBeginUserAction :: TextBufferClass tb => tb -> IO () +textBufferBeginUserAction = {#call text_buffer_begin_user_action#} . + toTextBuffer -- @method textBufferEndUserAction@ End an atomic user action. -- -textBufferEndUserAction :: TextBuffer -> IO () -textBufferEndUserAction = {#call text_buffer_end_user_action#} +textBufferEndUserAction :: TextBufferClass tb => tb -> IO () +textBufferEndUserAction = {#call text_buffer_end_user_action#} . + toTextBuffer -- callbacks |
From: <as...@us...> - 2003-10-21 22:53:45
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1:/tmp/cvs-serv28798 Modified Files: ChangeLog Log Message: Fix warning about deprecated FFI construct for GHC 6.0. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- ChangeLog 9 Aug 2003 04:47:11 -0000 1.88 +++ ChangeLog 21 Oct 2003 21:28:53 -0000 1.89 @@ -1,3 +1,8 @@ +2003-10-21 Axel Simon <A....@ke...> + + * gtk/abstract/Container.chs gtk/multiline/TextIter.chs: Fix + warning about deprecated FFI construct for GHC 6.0. + 2003-08-09 Jens Petersen <pet...@ha...> * gtk/multiline/TextView.chs (textViewGetVisibleRect): Fix docu typo. |
From: <as...@us...> - 2003-10-21 19:05:14
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/signals In directory sc8-pr-cvs1:/tmp/cvs-serv4685/signals Log Message: Directory /cvsroot/gtk2hs/gtk2hs/tools/signals added to the repository |
From: <as...@us...> - 2003-10-21 19:05:04
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/typehier In directory sc8-pr-cvs1:/tmp/cvs-serv4685/typehier Log Message: Directory /cvsroot/gtk2hs/gtk2hs/tools/typehier added to the repository |
From: <as...@us...> - 2003-10-21 18:17:51
|
Update of /cvsroot/gtk2hs/gtk2hs/tools In directory sc8-pr-cvs1:/tmp/cvs-serv4006/tools Log Message: Directory /cvsroot/gtk2hs/gtk2hs/tools added to the repository |