# Module Gtksv_utils

    module Gtksv_utils: sig .. end

Using the same sourceview preferences through all applications which use the LablGtkSourceView2 library.

Use the `source_language_manager` and `source_style_scheme_manager` below to get the languages to use in your code views.

- Author(s): Maxence Guesdon
- Version: 1.0

### Languages

    val source_language_manager : GSourceView2.source_language_manager

    val sort_languages_by_name : GSourceView2.source_language list -> GSourceView2.source_language list

Sort the given list of languages by name.

    val available_source_languages : ?manager:GSourceView2.source_language_manager ->
           unit -> GSourceView2.source_language list

`available_source_languages ()` returns the list of languages known by the language_manager.

`manager` : can be given to use an alternative language_manager

    val source_language_by_name : ?manager:GSourceView2.source_language_manager ->
           string -> GSourceView2.source_language option

`source_language_by_name ?manager name` returns the language with the given name, or `None` if no such language was found.

### Styles

    val source_style_scheme_manager : GSourceView2.source_style_scheme_manager

This source style scheme manager has an extended search path to look for styles in the user's ~/.mlgtksourceview2 directory first.

    val available_source_style_schemes : ?manager:GSourceView2.source_style_scheme_manager ->
           unit -> GSourceView2.source_style_scheme list

    val source_style_scheme_by_name : ?manager:GSourceView2.source_style_scheme_manager ->
           string -> GSourceView2.source_style_scheme option

`source_style_scheme_by_name ?manager name` returns the style scheme with the given name, or `None` if no such style scheme was found.

    val store_style_scheme_selection : GSourceView2.source_style_scheme option -> unit

Store the name of the given style scheme in the user's personal files.

    val read_style_scheme_selection : ?manager:GSourceView2.source_style_scheme_manager ->
           unit -> GSourceView2.source_style_scheme option

Read the name of the selected style scheme from the user's personal files.

`manager` : can specify the style scheme manager to use instead of `Gtksv_utils.source_style_scheme_manager`.

    val source_style_scheme : unit -> GSourceView2.source_style_scheme option

Return the currently selected style scheme, if any.

    val set_source_style_scheme : GSourceView2.source_style_scheme option -> unit

Set the currently selected style scheme, if any.

    val register_source_buffer : GSourceView2.source_buffer -> unit

Register a source buffer so that each time the scheme returned by `Gtksv_utils.source_style_scheme` changes, the new scheme is set in the buffer. It is also set when registering the buffer.

    val unregister_source_buffer : GSourceView2.source_buffer -> unit

Unregister the given source buffer.

    val apply_source_style_scheme_to_registered_buffers : GSourceView2.source_style_scheme option -> unit

Apply the given style scheme to the registered buffers.

### Sourceview props

    type source_view_props

    val store_sourceview_props : source_view_props -> unit

Store the given source view properties in the user's personal files.

    val read_sourceview_props : unit -> source_view_props

Read the source view properties from the user's personal files. If there is no properties file, default properties are returned.

    val register_source_view : GSourceView2.source_view -> unit

Register a source view so that each time the function `Gtksv_utils.read_sourceview_props` is called, the properties read are applied to every registered view. The sourceview is automatically unregistered when it is destroyed.

    val apply_sourceview_props : GSourceView2.source_view -> source_view_props -> unit

Apply the given source view properties to the given source view.

    val apply_sourceview_props_to_registered : source_view_props -> unit

Apply the given source view properties to the registered views.

### Choosing style scheme

    class source_style_scheme_box : ?manager:GSourceView2.source_style_scheme_manager -> ?current:GSourceView2.source_style_scheme option -> ?preview:GSourceView2.source_style_scheme option -> unit -> unit -> object .. end

This box can be used to make the user set the source style scheme.

    val edit_source_style_scheme : ?modal:bool ->
           ?manager:GSourceView2.source_style_scheme_manager ->
           ?current:GSourceView2.source_style_scheme option ->
           ?preview:(GSourceView2.source_style_scheme option -> unit) -> unit -> unit

Make the user set his source style scheme. Then `Gtksv_utils.store_style_scheme_selection` is used to save the changes or `Gtksv_utils.read_style_scheme_selection` is used to restore the original values.

`preview` : is the function called to apply the shcheme when the user makes a change or when he closes the window with "Ok".

### Setting sourceview props

    class sourceview_props_box : (source_view_props -> unit) -> object .. end

This box can be used to make the user set source view properties.

    val edit_sourceview_props : ?modal:bool ->
           ?preview:(source_view_props -> unit) -> unit -> unit

Make the user set his source view properties. Then `Gtksv_utils.store_sourceview_props` is used to save the changes or `Gtksv_utils.read_sourceview_props` is used to restore the original values.

`preview` : is the function called to apply the properties when the user makes a change or when he closes the window with "Ok".