From: Axel S. <si...@co...> - 2009-09-28 19:33:48
|
Sun Sep 27 21:32:08 EDT 2009 Andy Stewart <laz...@gm...> * Adjust VTE binding and finish miss functions in GdkCursor Ignore-this: 782feb53e623e3af75564e6533e0e0e0 * Adjust configure.ac make VTE binding 0.20.5 or higher * Finish missing functions in Vte.chs.pp ** terminalGetTextIncludeTrailingSpaces ** terminalGetTextRange ** terminalMatchSetCursorType (this function need GdkCursorType that miss in current Cursor.chs) * Remove all deprecated functions in VTE 0.20.5 * Adjust export list of Vte.chs.pp * Adjust comment of Vte.chs.pp, make it more Haskell style * Finish miss functions of Cursor.chs hunk ./configure.ac 321 -GTKHS_PKG_CHECK(vte, vte, VTE, [vte >= 0.20], [GLIB GTK], +GTKHS_PKG_CHECK(vte, vte, VTE, [vte >= 0.20.5], [GLIB GTK], hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 5 +-- Andy Stewart <laz...@gm...> hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 10 +-- Copyright (C) 2009 Andy Stewart [_$_] hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 30 +-- * Types hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 32 - cursorNewFromPixmap + +-- * Enums + CursorType(..), + +-- * Constructors [_$_] + cursorNew, + [_$_] +-- * Methods [_$_] + cursorNewFromPixmap, + cursorNewFromPixbuf, + cursorNewFromName, + cursorNewForDisplay, + cursorGetDisplay, + cursorGetImage hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 48 +import Control.Monad (liftM) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 51 +import System.Glib.UTFString hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 53 -{#import Graphics.UI.Gtk.Types#} hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 55 +{#import Graphics.UI.Gtk.Types#} hiding (Arrow) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 59 +-------------------- +-- Types hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 63 +-------------------- +-- Enums +-- | Cursor types. +{#enum GdkCursorType as CursorType {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Utils hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 78 +-------------------- +-- Constructors +-- | Creates a new cursor from the set of builtin cursors for the default display. [_$_] +-- See 'cursorNewForDisplay'. +-- To make the cursor invisible, use 'BlankCursor'. +cursorNew :: [_$_] + CursorType -- ^ @cursorType@ cursor to create [_$_] + -> IO Cursor -- ^ return a new 'Cursor' +cursorNew cursorType = do + cursorPtr <- {#call cursor_new#} $fromIntegral (fromEnum cursorType) + makeNewCursor cursorPtr + +-------------------- +-- Methods hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 113 +-- | Creates a new cursor from a pixbuf. +-- Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. [_$_] +-- The functions 'displaySupportsCursorAlpha' and 'displaySupportsCursorColor' can be used to determine whether RGBA cursors are supported; [_$_] +-- 'displayGetDefaultCursorSize' and 'displayGetMaximalCursorSize' give information about cursor sizes. +-- [_$_] +-- On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension. +-- [_$_] +cursorNewFromPixbuf :: [_$_] + Display -- ^ @display@ the 'Display' for which the cursor will be created [_$_] + -> Pixbuf -- ^ @pixbuf@ the 'Pixbuf' containing the cursor image [_$_] + -> Int -- ^ @x@ the horizontal offset of the 'hotspot' of the cursor. [_$_] + -> Int -- ^ @y@ the vertical offset of the 'hotspot' of the cursor. [_$_] + -> IO Cursor -- ^ return a new 'Cursor'. [_$_] +cursorNewFromPixbuf display pixbuf x y = do + cursorPtr <- {#call cursor_new_from_pixbuf#} display pixbuf (fromIntegral x) (fromIntegral y) + makeNewCursor cursorPtr + +-- | Creates a new cursor by looking up name in the current cursor theme. +cursorNewFromName :: [_$_] + Display -- ^ @display@ the 'Display' for which the cursor will be created [_$_] + -> String -- ^ @name@ the name of the cursor [_$_] + -> IO (Maybe Cursor) -- ^ return a new 'Cursor', or @Nothing@ if there is no cursor with the given name [_$_] +cursorNewFromName display name = [_$_] + withUTFString name $ \namePtr -> do + cursorPtr <- {#call cursor_new_from_name#} display namePtr + if cursorPtr == nullPtr then return Nothing else liftM Just $ makeNewCursor cursorPtr hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 140 +-- | Creates a new cursor from the set of builtin cursors. [_$_] +cursorNewForDisplay :: [_$_] + Display -- ^ @display@ the 'Display' for which the cursor will be created [_$_] + -> CursorType -- ^ @cursorType@ cursor to create [_$_] + -> IO Cursor -- ^ return a new 'Cursor' +cursorNewForDisplay display cursorType = do [_$_] + cursorPtr <- {#call cursor_new_for_display#} display $fromIntegral (fromEnum cursorType) + makeNewCursor cursorPtr + [_$_] +-- | Returns the display on which the GdkCursor is defined. +cursorGetDisplay :: [_$_] + Cursor -- ^ @cursor@ 'Cursor' + -> IO Display -- ^ return the 'Display' associated to cursor [_$_] +cursorGetDisplay cursor = + constructNewGObject mkDisplay $ {#call cursor_get_display#} cursor + [_$_] +-- | Returns a 'Pixbuf' with the image used to display the cursor. [_$_] +-- Note that depending on the capabilities of the windowing system and on the cursor, GDK may not be able to obtain the image data. [_$_] +-- In this case, @Nothing@ is returned. +cursorGetImage :: [_$_] + Cursor -- ^ @cursor@ 'Cursor' + -> IO (Maybe Pixbuf) -- ^ a 'Pixbuf' representing cursor, or @Nothing@ +cursorGetImage cursor = [_$_] + maybeNull (constructNewGObject mkPixbuf) $ {#call cursor_get_image#} cursor hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 20 --- TODO: --- --- ** Finish functions binding: --- 'terminalGetText', 'terminalGetTextIncludeTrailingSpaces' --- 'terminalGetTextRange', 'SelectionFunc', 'terminalMatchAddGregex' --- hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 32 + VteSelect, + SelectionFunc, + VteChar(..), + +-- * Enums + TerminalEraseBinding(..), + TerminalCursorBlinkMode(..), + TerminalCursorShape(..), + RegexCompileFlags(..), + RegexMatchFlags(..), hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 47 - TerminalEraseBinding(..), - TerminalAntiAlias(..), - TerminalCursorShape(..), - TerminalCursorBlinkMode(..), hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 88 - terminalSetCursorBlinks, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 93 - terminalSetFontFromStringFull, - terminalSetFontFull, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 94 - terminalGetUsingXft, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 102 - -- terminalGetText, - -- terminalGetTextIncludeTrailingSpaces, - -- terminalGetTextRange, - -- SelectionFunc, + terminalGetText, + terminalGetTextIncludeTrailingSpaces, + terminalGetTextRange, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 107 - terminalMatchAdd, - -- terminalMatchAddGregex, + terminalMatchAddRegex, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 111 + terminalMatchSetCursorType, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 121 - terminalGetCharAscent, - terminalGetCharDescent, hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 215 -{#enum VteTerminalEraseBinding as TerminalEraseBinding {underscoreToCase}#} -{#enum VteTerminalCursorShape as TerminalCursorShape {underscoreToCase}#} -{#enum VteTerminalCursorBlinkMode as TerminalCursorBlinkMode {underscoreToCase}#} -{#enum VteTerminalAntiAlias as TerminalAntiAlias {underscoreToCase}#} +-------------------- +-- Types +-- | A predicate that states which characters are of interest. [_$_] +-- The predicate @p c r@ should return @True@ if the character at column @c@ and row @r@ should be extracted. +type VteSelect = + Int + -> Int [_$_] + -> Bool + +{#pointer SelectionFunc#} + +-- | A structure describing the individual characters in the visible part of +-- a terminal window. +-- +data VteChar = VteChar { + vcRow :: Int, + vcCol :: Int, + vcChar :: Char, + vcFore :: Color, + vcBack :: Color, + vcUnderline :: Bool, + vcStrikethrough :: Bool + } hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 240 --- Constructors +-- Utils +-- | Utils function to transform 'VteAttributes' to 'VteChar'. +attrToChar :: Char -> VteAttributes -> VteChar +attrToChar ch (VteAttributes r c f b u s) = VteChar r c ch f b u s + [_$_] +foreign import ccall "wrapper" mkVteSelectionFunc :: + (Ptr Terminal -> {#type glong#} -> {#type glong#} -> Ptr () -> IO {#type gboolean#}) + -> IO SelectionFunc + [_$_] +-------------------- +-- Enums +-- | Values for "what should happen when the user hits backspace/delete". [_$_] +-- Use 'EraseAuto' unless the user can cause them to be overridden. +{#enum VteTerminalEraseBinding as TerminalEraseBinding {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | Values for the cursor blink setting. +{#enum VteTerminalCursorBlinkMode as TerminalCursorBlinkMode {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | Values for the cursor shape setting. +{#enum VteTerminalCursorShape as TerminalCursorShape {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | Flags determining how the regular expression is to be interpreted. +{#enum GRegexCompileFlags as RegexCompileFlags {underscoreToCase} deriving (Bounded,Eq,Show) #} +instance Flags RegexCompileFlags hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 265 +-- | Flags determining how the string is matched against the regular +-- expression. +{#enum GRegexMatchFlags as RegexMatchFlags {underscoreToCase} deriving (Bounded,Eq,Show) #} +instance Flags RegexMatchFlags + +-------------------- +-- Constructors hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 279 - --- |Appends menu items for various input methods to the given menu. [_$_] +-- | Appends menu items for various input methods to the given menu. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 423 --- | Places the selected text in the terminal in the GDK_SELECTION_CLIPBOARD selection. +-- | Places the selected text in the terminal in the 'SelectionClipboard' selection. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 428 --- | Sends the contents of the GDK_SELECTION_CLIPBOARD selection to the terminal's child. [_$_] +-- | Sends the contents of the 'SelectionClipboard' selection to the terminal's child. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 435 --- | Places the selected text in the terminal in the GDK_SELECTION_PRIMARY selection. +-- | Places the selected text in the terminal in the 'SelectionPrimary' selection. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 440 --- | Sends the contents of the GDK_SELECTION_PRIMARY selection to the terminal's child. [_$_] +-- | Sends the contents of the 'SelectionPrimary' selection to the terminal's child. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 442 --- The terminal will call also paste the GDK_SELECTION_PRIMARY selection when the user clicks with the the second mouse button. +-- The terminal will call also paste the 'SelectionPrimary' selection when the user clicks with the the second mouse button. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 471 - -> IO Bool -- ^ return @True@ if audible bell is enabled, FALSE if not [_$_] + -> IO Bool -- ^ return @True@ if audible bell is enabled, @False@ if not [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 489 - -> IO Bool -- ^ return @True@ if visible bell is enabled, FALSE if not [_$_] + -> IO Bool -- ^ return @True@ if visible bell is enabled, @False@ if not [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 494 --- | Controls whether or not the terminal will attempt to draw bold text, either by using a bold font variant or by repainting text with a different offset. +-- | Controls whether or not the terminal will attempt to draw bold text, [_$_] +-- either by using a bold font variant or by repainting text with a different offset. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 506 - -> IO Bool -- ^ return @True@ if bolding is enabled, FALSE if not [_$_] + -> IO Bool -- ^ return @True@ if bolding is enabled, @False@ if not [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 649 --- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', and the saturation value is less than 1.0, the terminal will adjust the colors of the image before drawing the image. [_$_] +-- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', [_$_] +-- and the saturation value is less than 1.0, the terminal will adjust the colors of the image before drawing the image. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 659 --- | Sets the terminal's background image to the pixmap stored in the root window, adjusted so that if there are no windows below your application, the widget will appear to be transparent. +-- | Sets the terminal's background image to the pixmap stored in the root window, adjusted so that if there are no windows below your application, [_$_] +-- the widget will appear to be transparent. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 668 --- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', and the value set by 'terminalSetBackgroundSaturation' is less than one, the terminal will adjust the color of the image before drawing the image. [_$_] --- To do so, the terminal will create a copy of the background image (or snapshot of the root window) and modify its pixel values. The initial tint color is black. +-- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', [_$_] +-- and the value set by 'terminalSetBackgroundSaturation' is less than one, the terminal will adjust the color of the image before drawing the image. [_$_] +-- To do so, the terminal will create a copy of the background image (or snapshot of the root window) and modify its pixel values. [_$_] +-- The initial tint color is black. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 716 --- | Sets whether or not the cursor will blink. --- WARNING: 'terminalSetCursorBlinks' is deprecated and should not be used in newly-written code. 0.17.1 --- Use 'terminalSetCursorBlinkMode' instead. -terminalSetCursorBlinks :: [_$_] - TerminalClass self => self - -> Bool -- ^ @blink@ - @True@ if the cursor should blink [_$_] - -> IO () -terminalSetCursorBlinks terminal blink = - {#call terminal_set_cursor_blinks#} (toTerminal terminal) (fromBool blink) - [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 739 --- The size of the scrollback buffer will be set to the larger of this value and the number of visible rows the widget can display, so 0 can safely be used to disable scrollback. [_$_] +-- The size of the scrollback buffer will be set to the larger of this value and the number of visible rows the widget can display, [_$_] +-- so 0 can safely be used to disable scrollback. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 759 --- | A convenience function which converts name into a FontDescription and passes it to 'terminalSetFont'. +-- | A convenience function which converts name into a 'FontDescription' and passes it to 'terminalSetFont'. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 768 --- | A convenience function which converts name into a 'FontDescription' and passes it to 'terminalSetFontFull'. --- WARNING: 'terminalSetFontFromStringFull' is deprecated and should not be used in newly-written code. 0.19.1 --- --- * Available since Vte version 0.11.11 --- -terminalSetFontFromStringFull :: [_$_] - TerminalClass self => self - -> String -- ^ @name@ - A string describing the font. [_$_] - -> TerminalAntiAlias -- ^ @antialias@ - Whether or not to antialias the font (if possible). [_$_] - -> IO () -terminalSetFontFromStringFull terminal name antialias = - withUTFString name $ \namePtr -> - {#call terminal_set_font_from_string_full#} (toTerminal terminal) namePtr $ fromIntegral (fromEnum antialias) - --- | Sets the font used for rendering all text displayed by the terminal, overriding any fonts set using 'widgetModifyFont'. [_$_] --- The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempt to resize itself to keep the same number of rows and columns. --- WARNING: terminalSetFontFull' is deprecated and should not be used in newly-written code. 0.19.1 --- --- * Available since Vte version 0.11.11 --- -terminalSetFontFull :: [_$_] - TerminalClass self => self - -> FontDescription -- ^ @fontDesc@ - the 'FontDescription' of the desired font. [_$_] - -> TerminalAntiAlias -- ^ @antialias@ - specify if anti aliasing of the fonts is to be used or not. [_$_] - -> IO () -terminalSetFontFull terminal fontDesc antialias = - {#call terminal_set_font_full#} (toTerminal terminal) fontDesc $fromIntegral (fromEnum antialias) - hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 776 --- | A 'Terminal' can use multiple methods to draw text. [_$_] --- This function allows an application to determine whether or not the current method uses fontconfig to find fonts. [_$_] --- This setting cannot be changed by the caller, but in practice usually matches the behavior of GTK+ itself. -terminalGetUsingXft :: [_$_] - TerminalClass self => self - -> IO Bool -- ^ return @True@ is use xft font. -terminalGetUsingXft terminal = - liftM toBool $ - {#call terminal_get_using_xft#} (toTerminal terminal) - hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 777 --- Note that this is different from determining if the terminal is the owner of any GtkClipboard items. +-- Note that this is different from determining if the terminal is the owner of any 'GtkClipboard' items. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 806 --- | Modifies the terminal's backspace key binding, which controls what string or control sequence the terminal sends to its child when the user presses the backspace key. +-- | Modifies the terminal's backspace key binding, [_$_] +-- which controls what string or control sequence the terminal sends to its child when the user presses the backspace key. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 815 --- | Modifies the terminal's delete key binding, which controls what string or control sequence the terminal sends to its child when the user presses the delete key. +-- | Modifies the terminal's delete key binding, [_$_] +-- which controls what string or control sequence the terminal sends to its child when the user presses the delete key. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 842 --- | Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, resetting character attributes, cursor state, national character set state, status line, terminal modes (insert/delete), selection state, and encoding. +-- | Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, [_$_] +-- resetting character attributes, cursor state, national character set state, status line, [_$_] +-- terminal modes (insert/delete), selection state, and encoding. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 853 --- | A predicate that states which characters are of interest. -type VteSelect = - Int -- ^ the column of the character - -> Int -- ^ the row of the character - -> Bool -- ^ @True@ if the character should be inspected - --- | A structure describing the individual characters in the visible part of --- a terminal window. --- -data VteChar = VteChar { - vcRow :: Int, - vcCol :: Int, - vcChar :: Char, - vcFore :: Color, - vcBack :: Color, - vcUnderline :: Bool, - vcStrikethrough :: Bool - } - -attrToChar :: Char -> VteAttributes -> VteChar -attrToChar ch (VteAttributes r c f b u s) = VteChar r c ch f b u s - [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 863 - -> IO [VteChar] + -> IO [VteChar] -- ^ return a text string hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 879 - -{#pointer VteSelectionFunc#} - -foreign import ccall "wrapper" mkVteSelectionFunc :: - (Ptr Terminal -> {#type glong#} -> {#type glong#} -> Ptr () -> IO {#type gboolean#}) - -> IO VteSelectionFunc - [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 881 --- If is_selected is not NULL, characters will only be read if is_selected returns TRUE after being passed the column and row, respectively. [_$_] +-- If is_selected is not @Nothing@, characters will only be read if is_selected returns @True@ after being passed the column and row, respectively. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 887 --- TODO: --- terminalGetTextIncludeTrailingSpaces +terminalGetTextIncludeTrailingSpaces :: [_$_] + TerminalClass self => self + -> Maybe VteSelect -- ^ @Just p@ for a predicate @p@ that determines + -- which character should be extracted or @Nothing@ + -- to select all characters [_$_] + -> IO [VteChar] -- ^ return a text string +terminalGetTextIncludeTrailingSpaces terminal mCB = do + cbPtr <- case mCB of + Just cb -> mkVteSelectionFunc $ \_ c r _ -> + return (fromBool (cb (fromIntegral c) (fromIntegral r))) + Nothing -> return nullFunPtr + gArrPtr <- {#call unsafe g_array_new#} 0 0 + (fromIntegral (sizeOf (undefined :: VteAttributes))) + strPtr <- {#call terminal_get_text_include_trailing_spaces #} (toTerminal terminal) cbPtr nullPtr gArrPtr + str <- if strPtr==nullPtr then return "" else peekUTFString strPtr + (len,elemPtr) <- gArrayContent (castPtr gArrPtr) + attrs <- (flip mapM) [0..len-1] $ peekElemOff elemPtr + unless (cbPtr==nullFunPtr) $ freeHaskellFunPtr cbPtr + {#call unsafe g_free#} (castPtr strPtr) + {#call unsafe g_array_free#} gArrPtr 1 + return (zipWith attrToChar str attrs) hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 910 --- If is_selected is not NULL, characters will only be read if is_selected returns TRUE after being passed the column and row, respectively. [_$_] +-- If is_selected is not @Nothing@, characters will only be read if is_selected returns @True@ after being passed the column and row, respectively. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 913 --- TODO: --- terminalGetTextRange - --- | Specifies the type of a selection function used to check whether a cell has to be selected or not. --- TODO: --- SelectionFunc +-- +terminalGetTextRange :: + TerminalClass self => self + -> Int -- ^ @sRow@ first row to search for data [_$_] + -> Int -- ^ @sCol@ first column to search for data [_$_] + -> Int -- ^ @eRow@ last row to search for data [_$_] + -> Int -- ^ @eCol@ last column to search for data [_$_] + -> Maybe VteSelect -- ^ @Just p@ for a predicate @p@ that determines + -- which character should be extracted or @Nothing@ + -- to select all characters + -> IO [VteChar] -- ^ return a text string +terminalGetTextRange terminal sRow sCol eRow eCol mCB = do [_$_] + cbPtr <- case mCB of + Just cb -> mkVteSelectionFunc $ \_ c r _ -> + return (fromBool (cb (fromIntegral c) (fromIntegral r))) + Nothing -> return nullFunPtr + gArrPtr <- {#call unsafe g_array_new#} 0 0 + (fromIntegral (sizeOf (undefined :: VteAttributes))) + strPtr <- {#call terminal_get_text_range #} (toTerminal terminal) (fromIntegral sRow) (fromIntegral sCol) (fromIntegral eRow) (fromIntegral eCol) cbPtr nullPtr gArrPtr + str <- if strPtr==nullPtr then return "" else peekUTFString strPtr + (len,elemPtr) <- gArrayContent (castPtr gArrPtr) + attrs <- (flip mapM) [0..len-1] $ peekElemOff elemPtr + unless (cbPtr==nullFunPtr) $ freeHaskellFunPtr cbPtr + {#call unsafe g_free#} (castPtr strPtr) + {#call unsafe g_array_free#} gArrPtr 1 + return (zipWith attrToChar str attrs) hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 958 --- | Adds a regular expression to the list of matching expressions. [_$_] --- When the user moves the mouse cursor over a section of displayed text which matches this expression, the text will be highlighted. --- WARNING: 'terminalMatchAdd' is deprecated and should not be used in newly-written code. -terminalMatchAdd :: [_$_] - TerminalClass self => self - -> String -- ^ @match@ - a regular expression [_$_] - -> IO Int -- ^ return an integer associated with this expression -terminalMatchAdd terminal match = - liftM fromIntegral $ - withUTFString match $ \matchPtr -> - {#call terminal_match_add#} (toTerminal terminal) matchPtr - --- | Flags determining how the regular expression is to be interpreted. -{#enum GRegexCompileFlags as RegexCompileFlags {underscoreToCase} deriving (Bounded,Eq,Show) #} - -instance Flags RegexCompileFlags - --- | Flags determining how the string is matched against the regular --- expression. -{#enum GRegexMatchFlags as RegexMatchFlags {underscoreToCase} deriving (Bounded,Eq,Show) #} - -instance Flags RegexMatchFlags - [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 961 +-- NOTE: see http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html for details about GRegex. +-- hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 987 --- | Checks if the text in and around the specified position matches any of the regular expressions previously set using 'terminalMatchAdd'. [_$_] --- If a match exists, the text string is returned and if tag is not @Nothing@, the number associated with the matched regular expression will be stored in tag. --- If more than one regular expression has been set with 'terminalMatchAdd', then expressions are checked in the order in which they were added. +-- | Checks if the text in and around the specified position matches any of the regular expressions previously set using 'terminalMatchAddRegex'. [_$_] +-- If a match exists, the text string is returned and if tag is not @Nothing@, [_$_] +-- the number associated with the matched regular expression will be stored in tag. +-- If more than one regular expression has been set with 'terminalMatchAddRegex', then expressions are checked in the order in which they were added. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 995 - -> IO (String -- ^ return pointer to an integer - ,Int) -- ^ return a string which matches one of the previously set regular expressions, and which must be freed by the caller. + -> IO (String -- ^ return a string which matches one of the previously set regular expressions, and which must be freed by the caller. + ,Int) -- ^ return pointer to an integer hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1022 --- terminalMatchSetCursorType +terminalMatchSetCursorType :: [_$_] + TerminalClass self => self + -> Int -- ^ @tag@ the tag of the regex which should use the specified cursor [_$_] + -> CursorType -- ^ @cursorType@ a 'CursorType' + -> IO () +terminalMatchSetCursorType terminal tag cursorType = [_$_] + {#call terminal_match_set_cursor_type#} (toTerminal terminal) (fromIntegral tag) $fromIntegral (fromEnum cursorType) [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1088 --- | Some terminal emulations specify a status line which is separate from the main display area, and define a means for applications to move the cursor to the status line and back. +-- | Some terminal emulations specify a status line which is separate from the main display area, [_$_] +-- and define a means for applications to move the cursor to the status line and back. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1119 --- | Get terminal 's char ascent. --- WARNING: 'terminalGetCharAscent' is deprecated and should not be used in newly-written code. 0.19.1 -terminalGetCharAscent :: [_$_] - TerminalClass self => self - -> IO Int -- ^ return the contents of terminal's char_ascent field [_$_] -terminalGetCharAscent terminal = - liftM fromIntegral $ - {#call terminal_get_char_ascent#} (toTerminal terminal) - [_$_] --- | Get terminal's char descent. [_$_] --- WARNING: 'terminalGetCharDescent' is deprecated and should not be used in newly-written code. 0.19.1 -terminalGetCharDescent :: [_$_] - TerminalClass self => self - -> IO Int -- ^ return the contents of terminal's char_descent field [_$_] -terminalGetCharDescent terminal = - liftM fromIntegral $ - {#call terminal_get_char_descent#} (toTerminal terminal) - [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1226 --- | If a background image has been set using "background-image-file:" or "background-image-pixbuf:", or "background-transparent:", and the saturation value is less than 1.0, the terminal will adjust the colors of the image before drawing the image. [_$_] +-- | If a background image has been set using "background-image-file:" or "background-image-pixbuf:", or "background-transparent:", [_$_] +-- and the saturation value is less than 1.0, the terminal will adjust the colors of the image before drawing the image. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1240 --- | If a background image has been set using "background-image-file:" or "background-image-pixbuf:", or "background-transparent:", and and the value set by 'Terminal' background-saturation: is less than 1.0, the terminal will adjust the color of the image before drawing the image. [_$_] +-- | If a background image has been set using "background-image-file:" or "background-image-pixbuf:", or "background-transparent:", [_$_] +-- and the value set by 'Terminal' background-saturation: is less than 1.0, the terminal will adjust the color of the image before drawing the image. [_$_] hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1252 --- | Sets whther the terminal uses the pixmap stored in the root window as the background, adjusted so that if there are no windows below your application, the widget will appear to be transparent. +-- | Sets whther the terminal uses the pixmap stored in the root window as the background, [_$_] +-- adjusted so that if there are no windows below your application, the widget will appear to be transparent. +-- hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1267 --- Default value: VTE_ERASE_AUTO +-- Default value: 'EraseAuto' hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1277 --- Using VTE_CURSOR_BLINK_SYSTEM will use the "gtk-cursor-blink" setting. +-- Using 'CursorBlinkSystem' will use the "gtk-cursor-blink" setting. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1279 --- Default value: VTE_CURSOR_BLINK_SYSTEM +-- Default value: 'CursorBlinkSystem' hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1290 --- Default value: VTE_CURSOR_SHAPE_BLOCK +-- Default value: 'CursorShapeBlock' hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1301 --- Default value: VTE_ERASE_AUTO +-- Default value: 'EraseAuto' hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1335 --- | Specifies the font used for rendering all text displayed by the terminal, overriding any fonts set using gtk_widget_modify_font(). [_$_] --- The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempt to resize itself to keep the same number of rows and columns. +-- | Specifies the font used for rendering all text displayed by the terminal, overriding any fonts set using 'widgetModifyFont'. +-- The terminal will immediately attempt to load the desired font, retrieve its metrics, [_$_] +-- and attempt to resize itself to keep the same number of rows and columns. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1346 --- | The terminal's so-called icon title, or NULL if no icon title has been set. +-- | The terminal's so-called icon title, or empty if no icon title has been set. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1449 --- As a special case, when setting this to NULL or the empty string, the terminal will treat all graphic non-punctuation non-space characters as word +-- As a special case, when setting this to the empty string, the terminal will treat all graphic non-punctuation non-space characters as word hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1504 --- | Emitted whenever the terminal's current encoding has changed, either as a result of receiving a control sequence which toggled between the local and UTF-8 encodings, or at the parent application's request. +-- | Emitted whenever the terminal's current encoding has changed, [_$_] +-- either as a result of receiving a control sequence which toggled between the local and UTF-8 encodings, or at the parent application's request. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1510 --- This signal is frequently (but not always) emitted with a "child-exited" signal. +-- This signal is frequently (but not always) emitted with a 'childExited' signal. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1563 --- Usually scrolled containers like 'ScrolledWindow' will emit this signal to connect two instances of 'Scrollbar' to the scroll directions of the 'Terminal'. +-- Usually scrolled containers like 'ScrolledWindow' will emit this [_$_] +-- signal to connect two instances of 'Scrollbar' to the scroll directions of the 'Terminal'. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1572 --- | An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. +-- | An internal signal used for communication between the terminal and its accessibility peer. [_$_] +-- May not be emitted under certain circumstances. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1577 --- | An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. +-- | An internal signal used for communication between the terminal and its accessibility peer. [_$_] +-- May not be emitted under certain circumstances. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1582 --- | An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. +-- | An internal signal used for communication between the terminal and its accessibility peer. [_$_] +-- May not be emitted under certain circumstances. hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1587 --- | An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. +-- | An internal signal used for communication between the terminal and its accessibility peer. [_$_] +-- May not be emitted under certain circumstances. |