package lablgtk3-extras

  1. Overview
  2. Docs

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

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

Languages

val source_language_manager : GSourceView3.source_language_manager
val sort_languages_by_name : GSourceView3.source_language list -> GSourceView3.source_language list

Sort the given list of languages by name.

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

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

  • parameter manager

    can be given to use an alternative language_manager

val source_language_by_name : ?manager:GSourceView3.source_language_manager -> string -> GSourceView3.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 : GSourceView3.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:GSourceView3.source_style_scheme_manager -> unit -> GSourceView3.source_style_scheme list
val source_style_scheme_by_name : ?manager:GSourceView3.source_style_scheme_manager -> string -> GSourceView3.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 : GSourceView3.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:GSourceView3.source_style_scheme_manager -> unit -> GSourceView3.source_style_scheme option

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

val source_style_scheme : unit -> GSourceView3.source_style_scheme option

Return the currently selected style scheme, if any.

val set_source_style_scheme : GSourceView3.source_style_scheme option -> unit

Set the currently selected style scheme, if any.

val register_source_buffer : GSourceView3.source_buffer -> unit

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

val unregister_source_buffer : GSourceView3.source_buffer -> unit

Unregister the given source buffer.

val apply_source_style_scheme_to_registered_buffers : GSourceView3.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 : GSourceView3.source_view -> unit

Register a source view so that each time the function 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 : GSourceView3.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:GSourceView3.source_style_scheme_manager -> ?current:GSourceView3.source_style_scheme option -> ?preview:( GSourceView3.source_style_scheme option -> unit) -> unit -> object ... end

This box can be used to make the user set the source style scheme. Use the read_style_scheme_selection and store_style_scheme_selection functions to restore or save the selection. The function in parameter is used to apply the scheme when a change occurs. For example, you can given the apply_source_style_scheme_to_registered_buffers function to update your registered source buffers when the user chooses a scheme.

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

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

  • parameter 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. Use the read_sourceview_props and store_sourceview_props functions to restore or save the properties. The function in parameter is used to apply the properties when a change occurs. For example, you can give the apply_sourceview_props_to_registered function to update your registered source views when the user changes a property.

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

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

  • parameter preview

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