fbdbg  3.0
FreeBASIC Debugger
SrcNotebook Class Reference

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)
 

Detailed Description

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.

Definition at line 232 of file gui.bi.

Constructor & Destructor Documentation

SrcNotebook::SrcNotebook ( )

Constructor to prepare the syntax highlighting.

The constructor loads the language definitions for syntax highlighting in to the default language manager.

Todo:
Where to load the language file from? Folder dat or GtkSourceView configuration?
Todo:
Compute the maximal length of the current source line, based on the font and size of the view widget.
Todo:
Replace deprecated function gtk_source_mark_attributes_set_stock_id()

Definition at line 32 of file source.bas.

Here is the call graph for this function:

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.

Member Function Documentation

FUNCTION_AS_GtkWidget_PTR SrcNotebook::addBas ( BYVAL_AS_gchar_PTR  Label,
BYVAL_AS_gchar_PTR  Cont 
)

Add a page for FB source.

Parameters
LabelThe label in the notebook tab
ContThe context of the source view
Returns
A pointer to the widget in the notebook page

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.

Parameters
LnrThe line number
WidgThe 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.

Here is the call graph for this function:

SUB SrcNotebook::changeMark ( BYVAL_AS_gint  Lnr,
BYVAL_AS_GtkWidget_PTR  Widg,
BYREF_AS_STRING  Mo = "" 
)

Change a mark programmatically.

Parameters
LnrThe line number to scroll to (starting at 1)
WidgThe widget to show (reference returned by SrcNotebook::addBas() )
MoThe 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,

  • pass "brk" to remove a break point mark
  • pass "boo" to remove a bookmark
  • pass any other string (ie. "") to remove all 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.

Here is the call graph for this function:

SUB SrcNotebook::delBookmark ( BYVAL_AS_gint  Lnr,
BYVAL_AS_GtkWidget_PTR  Widg 
)

Delete a book mark.

Parameters
LnrThe line number
WidgThe 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.

Here is the call graph for this function:

PROPERTY SrcNotebook::FontID ( BYVAL_AS_CONST_gchar_PTR  Fnam)

Property to set the font.

Parameters
FnamThe 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).

Todo:
Re-compute the length of the line based on the new font (and widget size)

Definition at line 392 of file source.bas.

FUNCTION_AS_GtkSourceMarkAttributes_PTR SrcNotebook::getAttr ( byval_AS_gchar_ptr  )

Prepare an icon as gutter mark.

Parameters
NamThe name of the icon file
Returns
A new mark attribute structure

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.

Here is the caller graph for this function:

FUNCTION_AS_STRING SrcNotebook::getBuffLine ( byval_as_GtkTextBuffer_ptr  ,
byval_as_GtkTextIter_ptr   
)

Get the context of a line from a buffer.

Parameters
BuffThe buffer to read from
IterThe start of the line to get
Returns
A STRING containing the line

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.

Here is the caller graph for this function:

SUB SrcNotebook::initCombo ( BYVAL_as_gchar_ptr  Txt)

Initialize the bookmark combo box.

Parameters
TxtThe 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.

Here is the caller graph for this function:

SUB SrcNotebook::remove ( BYVAL_AS_GtkWidget_PTR  Widg)

Remove a notebook page.

Parameters
WidgThe 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.

Parameters
MoModus, when zero delete all bookmarks.

Method to remove all pages from the notebook.

Definition at line 327 of file source.bas.

Here is the call graph for this function:

PROPERTY SrcNotebook::SchemeID ( BYVAL_AS_CONST_gchar_PTR  Snam)

Property to set the style scheme.

Parameters
SnamThe 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.

Parameters
LnrThe line number to scroll to (starting at 1)
WidgThe widget to show (reference returned by SrcNotebook::addBas() )
MoThe 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.

Here is the call graph for this function:

PROPERTY SrcNotebook::ScrollPos ( BYVAL_AS_gdouble  Posi)

Property to set the scroll position for the current line.

Parameters
PosiThe 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.


The documentation for this class was generated from the following files: