Class to handle the context of the source notebook. More...
Public Member Functions | |
SrcNotebook () | |
Constructor to prepare the syntax highlighting. More... | |
~SrcNotebook () | |
Destructor to free used memory. More... | |
PROPERTY | ScrollPos (BYVAL_AS_gdouble) |
Property to set the scroll position for the current line. More... | |
PROPERTY | SchemeID (BYVAL_AS_CONST_gchar_PTR) |
Property to set the style scheme. More... | |
PROPERTY | FontID (BYVAL_AS_CONST_gchar_PTR) |
Property to set the font. More... | |
FUNCTION_AS_GtkWidget_PTR | addBas (BYVAL_AS_gchar_PTR, BYVAL_AS_gchar_PTR) |
Add a page for FB source. More... | |
FUNCTION_AS_GtkSourceMarkAttributes_PTR | getAttr (byval_AS_gchar_ptr) |
Prepare an icon as gutter mark. More... | |
FUNCTION_AS_string | getBuffLine (byval_as_GtkTextBuffer_ptr, byval_as_GtkTextIter_ptr) |
Get the context of a line from a buffer. More... | |
SUB | addBookmark (BYVAL_AS_gint, BYVAL_AS_GtkWidget_PTR) |
Set a book mark in the combo box. More... | |
SUB | delBookmark (BYVAL_AS_gint, BYVAL_AS_GtkWidget_PTR) |
Delete a book mark. More... | |
SUB | initCombo (BYVAL_as_gchar_ptr Txt) |
Initialize the bookmark combo box. More... | |
SUB | changeMark (BYVAL_AS_gint, BYVAL_AS_GtkWidget_PTR, BYREF_AS_STRING) |
Change a mark programmatically. More... | |
SUB | scroll (BYVAL_AS_gint, BYVAL_AS_GtkWidget_PTR, BYVAL_AS_guint32) |
Scroll the context to line, switch page if necessary. More... | |
SUB | settingsChanged () |
Update all pages from notebook. More... | |
SUB | remove (BYVAL_AS_GtkWidget_PTR) |
Remove a notebook page. More... | |
SUB | removeAll (BYVAL_AS_guint) |
Remove all pages from notebook. More... | |
Public Attributes | |
gdouble | ScrPos |
The position to scroll the current line in the source views. | |
guint | Pages |
The number of pages in the notebook. | |
guint | BkMarks |
The number of book marks currently set. | |
guint | ScrLine |
The line number of the source current line. | |
guint | LenCur |
The number of characters in the source current line. | |
GObject_PTR | MenuSrc |
The popup menu for the source views. | |
GObject_PTR | BuffCur |
The source buffer for current source line. | |
GtkWidget_PTR | ViewCur |
The source view for current source line. | |
GtkWidget_PTR | ScrWidg |
The widget of the current source line. | |
GtkComboBoxText_PTR | CBMarks |
The combo box for book marks. | |
GtkNotebook_PTR | NoteBok |
The notebook for source views. | |
GtkSourceMarkAttributes_PTR | Attr0 |
The attributes for inactive breakpoint marks. | |
GtkSourceMarkAttributes_PTR | Attr1 |
The attributes for temporary breakpoint marks. | |
GtkSourceMarkAttributes_PTR | Attr2 |
The attributes for permanent breakpoint marks. | |
GtkSourceMarkAttributes_PTR | Attr3 |
The attributes for book mark. | |
GtkSourceStyleScheme_PTR | Schema |
The style scheme for syntax highlighting. | |
GtkSourceStyleSchemeManager_PTR | Manager |
The manager for style schemes. | |
GtkSourceLanguage_PTR | Lang |
The language definition for syntax highlighting. | |
PangoFontDescription_PTR | Font |
The Pango font description for source views. | |
STRING | LmPaths |
The list of paths (gchar PTRs) | |
Class to handle the context of the source notebook.
This class prepares a GtkSourceView for highlighting the FreeBASIC syntax and handles the pages of the source notebook. A single GtkSourceView is used for all pages, and the files are loaded in to several GtkSourceBuffers. Each page contains a GtkScrolledWindow that is used as the parent for the GtkSourceView.
When switching a page, the GtkSourceView gets reparent to the related scrolled window and the related text buffer gets connected.
SrcNotebook::SrcNotebook | ( | ) |
Constructor to prepare the syntax highlighting.
The constructor loads the language definitions for syntax highlighting in to the default language manager.
Definition at line 32 of file source.bas.
SrcNotebook::~SrcNotebook | ( | ) |
Destructor to free used memory.
The destructor frees the pango font description. (The language structure Lang and the scheme Schema are owned by the language or scheme managers.)
Definition at line 81 of file source.bas.
FUNCTION_AS_GtkWidget_PTR SrcNotebook::addBas | ( | BYVAL_AS_gchar_PTR | Label, |
BYVAL_AS_gchar_PTR | Cont | ||
) |
Add a page for FB source.
Label | The label in the notebook tab |
Cont | The context of the source view |
Add a page to the notebook for FreeBASIC source code. The new page is named as parameter Label and its source view shows the text passed as parameter Cont with FreeBASIC syntax highlighting.
Definition at line 100 of file source.bas.
SUB SrcNotebook::addBookmark | ( | BYVAL_AS_gint | Lnr, |
BYVAL_AS_GtkWidget_PTR | Widg | ||
) |
Set a book mark in the combo box.
Lnr | The line number |
Widg | The note book widget to operate at (scrolled window) |
Member function to add a book mark to the combo box in main window. It sorts the new book mark text to the GtkComboBoxText list store by widget and line number.
Definition at line 182 of file source.bas.
SUB SrcNotebook::changeMark | ( | BYVAL_AS_gint | Lnr, |
BYVAL_AS_GtkWidget_PTR | Widg, | ||
BYREF_AS_STRING | Mo = "" |
||
) |
Change a mark programmatically.
Lnr | The line number to scroll to (starting at 1) |
Widg | The widget to show (reference returned by SrcNotebook::addBas() ) |
Mo | The modus how to change |
Procedure to change marks in a source view widget at the specified line number Lnr. It either creates or removes marks in the source view widget contained in scrolled window Widg, by calling SUB view_mark_clicked().
To set a mark, specify its type in parameter Mo. Existend break point marks get overriden by the new type, existend bookmarks stay unchanged.
To remove marks,
When the specified line number is too big (or negative), the procedure operates at the last line.
Definition at line 454 of file source.bas.
SUB SrcNotebook::delBookmark | ( | BYVAL_AS_gint | Lnr, |
BYVAL_AS_GtkWidget_PTR | Widg | ||
) |
Delete a book mark.
Lnr | The line number |
Widg | The note book widget to operate at (scrolled window) |
Member function to delete a bookmark in the combo box in main window. It searches the entries for the specified book mark and deletes it from the GtkComboBoxText list store, if any.
Definition at line 225 of file source.bas.
PROPERTY SrcNotebook::FontID | ( | BYVAL_AS_CONST_gchar_PTR | Fnam | ) |
Property to set the font.
Fnam | The font name to use |
Creates a PangoFontDescription for the specified font and applies it to the source view widget for the current line. All other notebook pages need separate adaption (if any).
Definition at line 392 of file source.bas.
FUNCTION_AS_GtkSourceMarkAttributes_PTR SrcNotebook::getAttr | ( | byval_AS_gchar_ptr | ) |
Prepare an icon as gutter mark.
Nam | The name of the icon file |
Member function to load an icon in to a GdkPixbuf and renders it for use as mark in the source view widgets.
Definition at line 253 of file source.bas.
FUNCTION_AS_STRING SrcNotebook::getBuffLine | ( | byval_as_GtkTextBuffer_ptr | , |
byval_as_GtkTextIter_ptr | |||
) |
Get the context of a line from a buffer.
Buff | The buffer to read from |
Iter | The start of the line to get |
Read the context of a line from a buffer. When the line is longer than SrcNotebook::LenCur, the context gets cutted, setting three dots at the end.
Definition at line 277 of file source.bas.
SUB SrcNotebook::initCombo | ( | BYVAL_as_gchar_ptr | Txt | ) |
Initialize the bookmark combo box.
Txt | The context for the first entry |
Clear all entries in the combo box for book marks, then set first entry to Txt. Also reset the counter BkMarks.
Definition at line 350 of file source.bas.
SUB SrcNotebook::remove | ( | BYVAL_AS_GtkWidget_PTR | Widg | ) |
Remove a notebook page.
Widg | The child widget in the page to remove |
Method to remove a single page from the notebook. The child widget is used to identify the page, since the page index may change in case of reordering, adding or removing pages.
Definition at line 309 of file source.bas.
SUB SrcNotebook::removeAll | ( | BYVAL_AS_guint | Mo = 0 | ) |
Remove all pages from notebook.
Mo | Modus, when zero delete all bookmarks. |
Method to remove all pages from the notebook.
Definition at line 327 of file source.bas.
PROPERTY SrcNotebook::SchemeID | ( | BYVAL_AS_CONST_gchar_PTR | Snam | ) |
Property to set the style scheme.
Snam | The name of the style (scheme_id) |
Loads the specified style scheme and applies it to the buffer for the current line. All other buffers need separate adaption (if any).
Definition at line 376 of file source.bas.
SUB SrcNotebook::scroll | ( | BYVAL_AS_gint | Lnr, |
BYVAL_AS_GtkWidget_PTR | Widg, | ||
BYVAL_AS_guint32 | Mo = 1 |
||
) |
Scroll the context to line, switch page if necessary.
Lnr | The line number to scroll to (starting at 1) |
Widg | The widget to show (reference returned by SrcNotebook::addBas() ) |
Mo | The modus (0 = scroll only, otherwise copy current line) |
Member function to switch to a certain page (if necessary) and scroll to a certain line, select the context of that line and place a copy to the current line source view.
Definition at line 150 of file source.bas.
PROPERTY SrcNotebook::ScrollPos | ( | BYVAL_AS_gdouble | Posi | ) |
Property to set the scroll position for the current line.
Posi | The position [0.0,1.0] |
Gets the new position to scroll the current line in the source view widgets.
Definition at line 364 of file source.bas.
SUB SrcNotebook::settingsChanged | ( | ) |
Update all pages from notebook.
Method to update the style for all pages in the notebook, when the user changed settings.
Definition at line 408 of file source.bas.