sourceView

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SourceViewStruct

type SourceViewStruct struct {
	Window    gtk.IWindow
	View      *source.SourceView
	Buffer    *source.SourceBuffer
	Map       *source.SourceMap
	SearchSet *source.SourceSearchSettings
	SearchCtx *source.SourceSearchContext

	Language           *source.SourceLanguage
	LanguageManager    *source.SourceLanguageManager
	StyleScheme        *source.SourceStyleScheme
	StyleSchemeManager *source.SourceStyleSchemeManager

	// User style and language paths
	UserStylePath,
	UserLanguagePath string

	StyleShemeIds,
	LanguageIds []string

	DefaultStyleShemeId,
	DefaultLanguageId string

	FontSize int
	FontFamily,

	ColorBgRangeSet,

	TxtFgCol,
	TxtBgCol,
	SelFgCol,
	SelBgCol string

	/*
	 * Search settings
	 */
	TextSearch,

	TextReplace string

	// Search options
	UseRegexp,
	WrapAround,
	CaseSensitive,
	WordBoundaries,
	HighlightFound bool

	// Search results
	IterStart,
	IterEnd *gtk.TextIter
	HasWrappedAround,
	HasFound,
	SearchOk bool

	OccurencesCount int

	SearchError error
	// contains filtered or unexported fields
}

func SourceViewStructNew

func SourceViewStructNew(sourceView *source.SourceView, sourceMap *source.SourceMap, parentWindow ...gtk.IWindow) (svs *SourceViewStruct, err error)

SourceViewStructNew:

func (*SourceViewStruct) BringToFront

func (svs *SourceViewStruct) BringToFront()

BringToFront: Set window position to be over all others windows without staying on top whether another window come to be selected.

func (*SourceViewStruct) ColorBgRange

func (svs *SourceViewStruct) ColorBgRange(startLine, endLine int)

ColorBgRange: apply colored background to lines range.

func (*SourceViewStruct) ComboboxHandling

func (svs *SourceViewStruct) ComboboxHandling(cbxtStyle, cbxtLang *gtk.ComboBoxText, defaultLang, defaultStyle *string)

ComboboxHandling: 'defaultValues' if present must be: Language followed by Style they're the main options (stored values) that will be updated each time one of them are changed.

func (*SourceViewStruct) GetCurrentLineNb

func (svs *SourceViewStruct) GetCurrentLineNb() int

GetLineNumber: Get current line number at the cursor position

func (*SourceViewStruct) GetOccurences

func (svs *SourceViewStruct) GetOccurences(callback func(occurences int))

GetOccurences: Using TimeoutAdd function, callback will be executed when occurences count is available.

func (*SourceViewStruct) GetText

func (svs *SourceViewStruct) GetText() (text string)

GetText: retrieve text from buffer.

func (*SourceViewStruct) LoadSource

func (svs *SourceViewStruct) LoadSource(filename string, doSearch ...bool) (err error)

LoadSource: Load file and search if requested.

func (*SourceViewStruct) RunAfterEvents

func (svs *SourceViewStruct) RunAfterEvents(f func())

RunAfterEvents: Execute event pending before f() usually used when Gtk does not refresh in time and command miss to be executed (ScrollTo ...)

func (*SourceViewStruct) ScrollToIter

func (svs *SourceViewStruct) ScrollToIter(iter *gtk.TextIter) int

ScrollToIter: Scroll to iter and return the corresponding line

func (*SourceViewStruct) ScrollToLine

func (svs *SourceViewStruct) ScrollToLine(line int) (iter *gtk.TextIter)

ScrollToLine: Scroll to line and return the corresponding iter

func (*SourceViewStruct) Search

func (svs *SourceViewStruct) Search(iter *gtk.TextIter, backward bool) (err error)

Search: Simple search method.

func (*SourceViewStruct) SearchAsync

func (svs *SourceViewStruct) SearchAsync(callback func(), iter *gtk.TextIter, backward bool) (err error)

Search: perform asynchronous search, callback can be nil. Cancel callback not used here, but is implemented and you can use it with your own function. Same with UserData, as uintPtr.

func (*SourceViewStruct) SelectRange

func (svs *SourceViewStruct) SelectRange(startLine, endLine int)

SelectRange: select Lines

func (*SourceViewStruct) SetCursorAtLine

func (svs *SourceViewStruct) SetCursorAtLine(line int) (iter *gtk.TextIter)

SetCursorAtLine: Set current line number & place cursor on it.

func (*SourceViewStruct) SetLanguage

func (svs *SourceViewStruct) SetLanguage(id string) *source.SourceLanguage

SetLanguage:

func (*SourceViewStruct) SetStyleScheme

func (svs *SourceViewStruct) SetStyleScheme(id string) *source.SourceStyleScheme

SetStyleScheme:

func (*SourceViewStruct) SetText

func (svs *SourceViewStruct) SetText(text string)

GetText: update css and set text to buffer.

func (*SourceViewStruct) StyleChooserDialog

func (svs *SourceViewStruct) StyleChooserDialog() string

StyleChooserDialog: I don't know how to get result from a SourceStyleSchemeChooserButton object, so i made my own dialog who can give me a result that permit to set new styleScheme.

func (*SourceViewStruct) UpdateCss

func (svs *SourceViewStruct) UpdateCss()

doColored: Add desired font and some colors to the numbers column and selected text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL