|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
New XFC versionHi ...
This is a tar ball containing the new code I have made in XFC (libXFCsourceview) to make it contain the GtkSourceView api. I hope that all you have to do is configure and make. The changes are a little too big for a patch, so here is a link to the a dist tar ball. Url : http://lue.dk/~bl/xfc-4.3.2.tar.bz2 This is also my application to become maintainer :-) /BL Ps.: Please note that this link will only be valid for a short period. _______________________________________________ Xfc-dev mailing list Xfc-dev@... http://foo-projects.org/mailman/listinfo/xfc-dev |
|
|
Re: New XFC versionBo Lorentsen wrote:
> Hi ... > > This is a tar ball containing the new code I have made in XFC > (libXFCsourceview) to make it contain the GtkSourceView api. I hope that > all you have to do is configure and make. The changes are a little too > big for a patch, so here is a link to the a dist tar ball. > > Url : http://lue.dk/~bl/xfc-4.3.2.tar.bz2 > > This is also my application to become maintainer :-) > > /BL > > Ps.: Please note that this link will only be valid for a short period. some minor nitpicks, that I don't understand: how did the tarball end up being 700.000 bytes larger than 4.3.1? I see many updates to html content, are those supposed to be updated? Also there seems to be a lot of added whitespace (empty lines, trailing whitespace) that doesn't look good. This obscures me to see what really changed in the new release :) Can you post a diff to the -svn trunk? this would help us a lot more, since you won't have to post any of the dist-generated files. Thanks, Auke _______________________________________________ Xfc-dev mailing list Xfc-dev@... http://foo-projects.org/mailman/listinfo/xfc-dev |
|
|
Re: New XFC versionAuke Kok wrote:
> Bo Lorentsen wrote: >> Hi ... >> >> This is a tar ball containing the new code I have made in XFC >> (libXFCsourceview) to make it contain the GtkSourceView api. I hope that >> all you have to do is configure and make. The changes are a little too >> big for a patch, so here is a link to the a dist tar ball. >> >> Url : http://lue.dk/~bl/xfc-4.3.2.tar.bz2 >> >> This is also my application to become maintainer :-) >> >> /BL >> >> Ps.: Please note that this link will only be valid for a short period. > > some minor nitpicks, that I don't understand: > > how did the tarball end up being 700.000 bytes larger than 4.3.1? I see many updates to > html content, are those supposed to be updated? Also there seems to be a lot of added > whitespace (empty lines, trailing whitespace) that doesn't look good. > > This obscures me to see what really changed in the new release :) > > Can you post a diff to the -svn trunk? this would help us a lot more, since you won't > have to post any of the dist-generated files. > adding (but nothing committed) stuff to my local copy. Attached is the full diff with regard to the current SVN trunk. Please test this and Bo: let me know if it's correct and gives you the proper output. most of the code I looked at looks just fine. Let me know if everyone is OK with Bo comitting this to the Xfc trunk himself. Cheers, Auke Index: libXFCsourceview/xfc/Makefile.am =================================================================== --- libXFCsourceview/xfc/Makefile.am (revision 0) +++ libXFCsourceview/xfc/Makefile.am (revision 0) @@ -0,0 +1,8 @@ +## libXFCsourceview source directory + +SUBDIRS = sourceview + +lib_LTLIBRARIES = libXFCsourceview-4.3.la +libXFCsourceview_4_3_la_SOURCES= +libXFCsourceview_4_3_la_LIBADD= sourceview/libsourceview.la $(XFC_SOURCEVIEW_LIBS) +libXFCsourceview_4_3_la_LDFLAGS= -version-info $(XFC_LIBRARY_VERSION) Index: libXFCsourceview/xfc/sourceview/sourceview.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourceview.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceview.cc (revision 0) @@ -0,0 +1,223 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourceview.cc - GtkSourceView C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourceview.hh" +#include "private/sourceviewclass.hh" +#include <xfc/gdk-pixbuf/pixbuf.hh> + +using namespace Xfc; + +Gtk::SourceView::SourceView(GtkSourceView *view, bool reference) +: TextView((GtkTextView*)view, reference) +{ +} + +Gtk::SourceView::SourceView() +: TextView((GtkTextView*)SourceViewClass::create()) +{ + set_buffer(new Gtk::SourceBuffer); +} + +Gtk::SourceView::SourceView(SourceBuffer& buffer) +: TextView((GtkTextView*)SourceViewClass::create()) +{ + set_buffer(&buffer); +} + +Gtk::SourceView::~SourceView() +{ +} + +Gtk::SourceView::operator GtkSourceView* () const +{ + return this ? gtk_source_view() : 0; +} + +bool +Gtk::SourceView::is_gtk_source_view() const +{ + return is_a(GTK_TYPE_SOURCE_VIEW); +} + +Gtk::SourceBuffer* +Gtk::SourceView::get_source_buffer() const +{ + return static_cast<SourceBuffer*>(get_buffer()); +} + +bool +Gtk::SourceView::get_show_line_numbers() const +{ + return gtk_source_view_get_show_line_numbers(gtk_source_view()); +} + +bool +Gtk::SourceView::get_show_line_markers() const +{ + return gtk_source_view_get_show_line_markers(gtk_source_view()); +} + +unsigned int +Gtk::SourceView::get_tabs_width() const +{ + return gtk_source_view_get_tabs_width(gtk_source_view()); +} + +bool +Gtk::SourceView::get_auto_indent() const +{ + return gtk_source_view_get_auto_indent(gtk_source_view()); +} + +bool +Gtk::SourceView::get_insert_spaces_instead_of_tabs() const +{ + return gtk_source_view_get_insert_spaces_instead_of_tabs(gtk_source_view()); +} + +bool +Gtk::SourceView::get_show_margin() const +{ + return gtk_source_view_get_show_margin(gtk_source_view()); +} + +unsigned int +Gtk::SourceView::get_margin() const +{ + return gtk_source_view_get_margin(gtk_source_view()); +} + +Pointer<Gdk::Pixbuf> +Gtk::SourceView::get_marker_pixbuf(const String& marker_type) const +{ + return G::Object::wrap<Gdk::Pixbuf>(gtk_source_view_get_marker_pixbuf(gtk_source_view(), marker_type.c_str())); +} + +bool +Gtk::SourceView::get_smart_home_end() const +{ + return gtk_source_view_get_smart_home_end(gtk_source_view()); +} + +void +Gtk::SourceView::set_show_line_numbers(bool show) +{ + gtk_source_view_set_show_line_numbers(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_show_line_markers(bool show) +{ + gtk_source_view_set_show_line_markers(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_tabs_width(unsigned int width) +{ + gtk_source_view_set_tabs_width(gtk_source_view(), width); +} + +void +Gtk::SourceView::set_auto_indent(bool enable) +{ + gtk_source_view_set_auto_indent(gtk_source_view(), enable); +} + +void +Gtk::SourceView::set_insert_spaces_instead_of_tabs(bool enable) +{ + gtk_source_view_set_insert_spaces_instead_of_tabs(gtk_source_view(), enable); +} + +void +Gtk::SourceView::set_show_margin(bool show) +{ + gtk_source_view_set_show_margin(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_margin(unsigned int margin) +{ + gtk_source_view_set_margin(gtk_source_view(), margin); +} + +void +Gtk::SourceView::set_marker_pixbuf(const String& marker_type, Gdk::Pixbuf *pixbuf) +{ + gtk_source_view_set_marker_pixbuf(gtk_source_view(), marker_type.c_str(), *pixbuf); +} + +void +Gtk::SourceView::set_smart_home_end(bool enable) +{ + gtk_source_view_set_smart_home_end(gtk_source_view(), enable); +} + +/* Gtk::SourceViewClass + */ + +void +Gtk::SourceViewClass::init(GtkSourceViewClass *g_class) +{ + TextViewClass::init((GtkTextViewClass*)g_class); +} + +GType +Gtk::SourceViewClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_VIEW, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceViewClass::create() +{ + return g_object_new(get_type(), 0); +} + +GtkSourceViewClass* +Gtk::SourceViewClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceViewClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +/* Properties + */ + +const Gtk::SourceView::ShowLineNumbersPropertyType Gtk::SourceView::show_line_numbers_property("show_line_numbers"); + +const Gtk::SourceView::ShowLineMarkersPropertyType Gtk::SourceView::show_line_markers_property("show_line_markers"); + +const Gtk::SourceView::TabsWidthPropertyType Gtk::SourceView::tabs_width_property("tabs_width"); + +const Gtk::SourceView::AutoIndentPropertyType Gtk::SourceView::auto_indent_property("auto_indent"); + +const Gtk::SourceView::InsertSpacesPropertyType Gtk::SourceView::insert_spaces_property("insert_spaces_instead_of_tabs"); + +const Gtk::SourceView::ShowMarginPropertyType Gtk::SourceView::show_margin_property("show_margin"); + +const Gtk::SourceView::MarginPropertyType Gtk::SourceView::margin_property("margin"); + +const Gtk::SourceView::SmartHomeEndPropertyType Gtk::SourceView::smart_home_end_property("smart_home_end"); + Index: libXFCsourceview/xfc/sourceview/sourcetag.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourcetag.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcetag.cc (revision 0) @@ -0,0 +1,291 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourcetag.cc - GtkSourceTag, GtkSyntaxTag and GtkPatternTag C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourcetag.hh" +#include "sourcetagsignals.hh" +#include "private/sourcetagclass.hh" +#include "sourcetagstyle.hh" + +#include <xfc/gtk/private/marshal.hh> + +using namespace Xfc; + +/* Gtk::SourceTag + */ + +Gtk::SourceTag::SourceTag(GtkSourceTag *tag, bool reference) +: Gtk::TextTag((GtkTextTag*)tag, reference) +{ +} + +Gtk::SourceTag::~SourceTag() +{ +} + +Gtk::SourceTag::operator GtkSourceTag* () const +{ + return this ? gtk_source_tag() : 0; +} + +bool +Gtk::SourceTag::is_gtk_source_tag() const +{ + return is_a(GTK_TYPE_SOURCE_TAG); +} + +String +Gtk::SourceTag::get_id() const +{ + return gtk_source_tag_get_id(gtk_source_tag()); +} + +Gtk::SourceTagStyle* +Gtk::SourceTag::get_style() const +{ + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, gtk_source_tag_get_style(gtk_source_tag()), false); +} + +void +Gtk::SourceTag::set_style(const SourceTagStyle& style) +{ + gtk_source_tag_set_style(gtk_source_tag(), style.gtk_source_tag_style()); +} + +/* Gtk::SourceTag properties + */ + +const Gtk::SourceTag::IdPropertyType Gtk::SourceTag::id_property("id"); + +const Gtk::SourceTag::TagStylePropertyType Gtk::SourceTag::tag_style_property("tag_style"); + +/* Gtk::SyntaxTag + */ + +Gtk::SyntaxTag::SyntaxTag(GtkSyntaxTag *tag, bool reference) +: Gtk::SourceTag((GtkSourceTag*)tag, reference) +{ +} + +Gtk::SyntaxTag::SyntaxTag(const String& id, const String& name, const char *pattern_start, const char *pattern_end) +: Gtk::SourceTag((GtkSourceTag*)gtk_syntax_tag_new(id.c_str(), name.c_str(), pattern_start, pattern_end)) +{ +} + +Gtk::SyntaxTag::~SyntaxTag() +{ +} + +Gtk::SyntaxTag::operator GtkSyntaxTag* () const +{ + return this ? gtk_syntax_tag() : 0; +} + +bool +Gtk::SyntaxTag::is_gtk_syntax_tag() const +{ + return is_a(GTK_TYPE_SYNTAX_TAG); +} + +/* Gtk::LineCommentTag + */ + +Gtk::LineCommentTag::LineCommentTag(const String& id, const String& name, const char *pattern_start) +: Gtk::SyntaxTag((GtkSyntaxTag*)gtk_line_comment_tag_new(id.c_str(), name.c_str(), pattern_start)) +{ +} + +/* Gtk::StringTag + */ + +Gtk::StringTag::StringTag(const String& id, const String& name, const char *pattern_start, const char *pattern_end, bool end_at_line_end) +: Gtk::SyntaxTag((GtkSyntaxTag*)gtk_string_tag_new(id.c_str(), name.c_str(), pattern_start, pattern_end, end_at_line_end)) +{ +} + +/* Gtk::PatternTag + */ + +Gtk::PatternTag::PatternTag(GtkPatternTag *tag, bool reference) +: Gtk::SourceTag((GtkSourceTag*)tag, reference) +{ +} + +Gtk::PatternTag::PatternTag(const String& id, const String& name, const char *pattern) +: Gtk::SourceTag((GtkSourceTag*)gtk_pattern_tag_new(id.c_str(), name.c_str(), pattern)) +{ +} + +Gtk::PatternTag::~PatternTag() +{ +} + +Gtk::PatternTag::operator GtkPatternTag* () const +{ + return this ? gtk_pattern_tag() : 0; +} + +bool +Gtk::PatternTag::is_gtk_pattern_tag() const +{ + return is_a(GTK_TYPE_PATTERN_TAG); +} + +/* Gtk::KeywordListTag + */ + +namespace { // create_keyword_list_tag + +GtkTextTag* +create_keyword_list_tag(const String& id, const String& name, std::vector<String>& keywords, bool case_sensitive, + bool match_empty_string_at_beginning, bool match_empty_string_at_end, + const char *beginning_regex, const char *end_regex) +{ + GSList *tmp_keywords = 0; + int count = keywords.size(); + + int i = 0; + while (i < count) + { + tmp_keywords = g_slist_append(tmp_keywords, (void*)keywords[i].c_str()); + ++i; + } + + GtkTextTag *tag = gtk_keyword_list_tag_new(id.c_str(), name.c_str(), tmp_keywords, case_sensitive, + match_empty_string_at_beginning, + match_empty_string_at_end, + beginning_regex, end_regex); + g_slist_free(tmp_keywords); + return tag; +} + +} // namespace + +Gtk::KeywordListTag::KeywordListTag(const String& id, const String& name, std::vector<String>& keywords, bool case_sensitive, + bool match_empty_string_at_beginning, bool match_empty_string_at_end, + const char *beginning_regex, const char *end_regex) +: Gtk::PatternTag((GtkPatternTag*)create_keyword_list_tag(id, name, keywords, case_sensitive, + match_empty_string_at_beginning, match_empty_string_at_end, beginning_regex, end_regex)) +{ +} + +/* Gtk::SourceTagTable + */ + +Gtk::SourceTagTable::SourceTagTable(GtkSourceTagTable *table, bool reference) +: Gtk::TextTagTable((GtkTextTagTable*)table, reference) +{ +} + +Gtk::SourceTagTable::SourceTagTable() +: Gtk::TextTagTable((GtkTextTagTable*)SourceTagTableClass::create()) +{ +} + +Gtk::SourceTagTable::~SourceTagTable() +{ +} + +Gtk::SourceTagTable::operator GtkSourceTagTable* () const +{ + return this ? gtk_source_tag_table() : 0; +} + +bool +Gtk::SourceTagTable::is_gtk_source_tag_table() const +{ + return is_a(GTK_TYPE_SOURCE_TAG_TABLE); +} + +void +Gtk::SourceTagTable::add_tags(const std::vector<TextTag*>& tags) +{ + g_return_if_fail(!tags.empty()); + GSList *tmp_tags = 0; + int count = tags.size(); + + int i = 0; + while (i < count) + { + tmp_tags = g_slist_append(tmp_tags, (void*)tags[i]->gtk_text_tag()); + ++i; + } + + gtk_source_tag_table_add_tags(gtk_source_tag_table(), tmp_tags); + g_slist_free(tmp_tags); +} + +void +Gtk::SourceTagTable::remove_source_tags() +{ + gtk_source_tag_table_remove_source_tags(gtk_source_tag_table()); +} + +/* Gtk::SourceTagTableClass + */ + +void +Gtk::SourceTagTableClass::init(GtkSourceTagTableClass *g_class) +{ + TextTagTableClass::init((GtkTextTagTableClass*)g_class); + g_class->changed = &changed_proxy; +} + +GType +Gtk::SourceTagTableClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_TAG_TABLE, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceTagTableClass::create() +{ + return g_object_new(get_type(), 0); +} + +GtkSourceTagTableClass* +Gtk::SourceTagTableClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceTagTableClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +void +Gtk::SourceTagTableClass::changed_proxy(GtkSourceTagTable *table) +{ + void *ptr = g_object_get_qdata((GObject*)table, G::ObjectSignals::quark()); + if (ptr) + static_cast<SourceTagTableSignals*>(ptr)->on_changed(); + else + { + GtkSourceTagTableClass *g_class = get_parent_class(table); + if (g_class->changed) + g_class->changed(table); + } +} + +/* Gtk::SourceTagTable signals + */ + +const Gtk::SourceTagTable::ChangedSignalType Gtk::SourceTagTable::changed_signal("changed", (GCallback)&G::Marshal::void_callback); + Index: libXFCsourceview/xfc/sourceview/sourceiter.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourceiter.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceiter.hh (revision 0) @@ -0,0 +1,215 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//! @file inti/gtk-sourceview/sourceiter.h +//! @brief A Gtk::TextIter extension class. +//! +//! Provides SourceIter, a Gtk::TextIter object that supports case-insensitive searching. + +#ifndef XFC_GTK_SOURCE_ITER_HH +#define XFC_GTK_SOURCE_ITER_HH + +#ifndef XFC_GTK_TEXT_ITER_HH +#include <xfc/gtk/textiter.hh> +#endif + +#ifndef __GTK_SOURCE_ITER_H__ +#include <gtksourceview/gtksourceiter.h> +#endif + +namespace Xfc { + +namespace G { +class Object; +} + +namespace Gtk { + +//! @enum SourceSearchFlags +//! Specifies how a source iterator should search through a source buffer for a text string. + +enum SourceSearchFlags +{ + SOURCE_SEARCH_VISIBLE_ONLY = GTK_SOURCE_SEARCH_VISIBLE_ONLY, + //!< The matching text may have invisible text interspersed in it, that is, the text + //!< may possibly be a noncontiguous subsequence of the matched range. + + SOURCE_SEARCH_TEXT_ONLY = GTK_SOURCE_SEARCH_TEXT_ONLY, + //!< The matching text may have pixbufs or child widgets mixed inside the matched range. + + SOURCE_SEARCH_CASE_INSENSITIVE = GTK_SOURCE_SEARCH_CASE_INSENSITIVE + //!< The text will be matched regardless of what case it is in. +}; + +//! SourceSearchFlagsField holds one or more values from the SourceSearchFlags enumeration. + +typedef unsigned int SourceSearchFlagsField; + +//! @class SourceIter sourceiter.h inti/gtk-sourceview/sourceiter.h +//! @brief A GtkTextIter object that supports case-insensitive searching. +//! +//! SourceIter is a Gtk::TextIter extension that supports case-insensitive forward and backward searching. + +class SourceIter : public TextIter +{ +public: +//! @name Constructors +//! @{ + + SourceIter(); + //!< Construct an properly initialized source iterator. + + explicit SourceIter(GtkTextIter *iter); + //!< Construct a new source iterator from an existing GtkTextIter. + //!< @param iter A pointer to a GtkTextIter. + //!< + //!< <BR>The <EM>iter</EM> can be a newly created GtkTextIter or an existing + //!< GtkTextIter. The SourceIter object created is a temporary object. It doesn't + //!< take over the ownership of GtkTextIter and GtkTextIter is not freed by the + //!< destructor. + + SourceIter(GtkTextIter *iter, bool copy); + //!< Construct a new source iterator from an existing GtkTextIter. + //!< @param iter A pointer to a GtkTextIter. + //!< @param copy Whether the SourceIter object should make a copy of GtkTextIter or not. + //!< + //!< <BR>The <EM>iter</EM> can be a newly created GtkTextIter or an existing GtkTextIter. + //!< If <EM>copy</EM> is true SourceIter will make a copy of GtkTextIter. If <EM>copy</EM> + //!< is false SourceIter wont make a copy but instead takes over the ownership of GtkTextIter. + //!< Either way, the destructor will free GtkTextIter when the SourceIter object is destroyed. + //!< This constructor is used by G::Boxed::wrap() to wrap GtkTextIter objects in a C++ wrapper. + + SourceIter(const SourceIter& src); + //!< Copy constructor. + //!< @param src The source iterator. + + ~SourceIter(); + //!< Destructor. + + SourceIter& operator=(const SourceIter& src); + //!< Assignment operator. + //!< @param src The source iterator. + +//! @} +//! @name Methods +//! @{ + + bool forward_search(const char *str, const SourceIter *limit = 0); + bool forward_search(const String& str, const SourceIter *limit = 0); + //!< Do a case-sensitive search forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>The search will not continue past <EM>limit</EM>. Note that a search is a linear + //!< or O(n) operation, so you may wish to use limit to avoid locking up your UI on large + //!< buffers. The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + + bool forward_search(const char *str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool forward_search(const String& str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Do a case-sensitive search forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>Any match is returned by setting <EM>match_start</EM> to the first character of the + //!< match and <EM>match_end</EM> to the first character after the match. The search will + //!< not continue past <EM>limit</EM>. Note that a search is a linear or O(n) operation, + //!< so you may wish to use limit to avoid locking up your UI on large buffers. The + //!< Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text interspersed + //!< in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence of the matched range). + + bool forward_search(const char *str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool forward_search(const String& str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Searches forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param flags The bitmask of flags specifying how the search is done. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>Any match is returned by setting <EM>match_start</EM> to the first character of the + //!< match and <EM>match_end</EM> to the first character after the match. The search will + //!< not continue past <EM>limit</EM>. Note that a search is a linear or O(n) operation, + //!< so you may wish to use limit to avoid locking up your UI on large buffers. If the + //!< Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is present, the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). Similarly, if you specify Gtk::SOURCE_SEARCH_TEXT_ONLY, the match + //!< may have pixbufs or child widgets mixed inside the matched range. If these flags are not + //!< given, the match must be exact; the special 0xFFFC character in str will match embedded + //!< pixbufs or child widgets. If you specify the Gtk::SOURCE_SEARCH_CASE_INSENSITIVE flag, + //!< the text will be matched regardless of what case it is in. + + bool backward_search(const char *str, const SourceIter *limit = 0); + bool backward_search(const String& str, const SourceIter *limit = 0); + //!< Do a case-sensitive search backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + //!< + //!< <BR>The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + bool backward_search(const char * str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool backward_search(const String& str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Do a case-sensitive search backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + //!< + //!< <BR>The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + bool backward_search(const char *str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool backward_search(const String& str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Searches backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param flags The bitmask of flags specifying how the search is done. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + + bool find_matching_bracket(); + //!< Tries to match the bracket character currently at the iter with its opening/closing + //!< counterpart, and if found moves iter to the position where it was found. + //!< @return <EM>true</EM> if a matching bracket is found and the iter moved. + //!< + //!< <BR>If the current bracket is an opening bracket the buffer is searched in a + //!< forward direction. If the current bracket is a closing bracket the buffer is + //!< searched in a backward direction. + +//! @} +}; + +} // namespace Gtk + +} // namespace Xfc + +#endif // XFC_GTK_SOURCE_ITER_H + Index: libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh (revision 0) @@ -0,0 +1,45 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_LANGUAGE_SIGNALS_HH +#define XFC_GTK_SOURCE_LANGUAGE_SIGNALS_HH + +#ifndef XFC_G_OBJECT_SIGNALS_HH +#include <xfc/gtk/objectsignals.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceLanguageSignals : public ObjectSignals +{ +protected: +/// @name Constructors +/// @{ + + SourceLanguageSignals(SourceLanguage *buffer); + ///< Constructs a new TextBufferSignals object. + ///< @param buffer A TextBuffer object inheriting the TextLanguage Signals implementation. + + virtual ~SourceLanguageSignals() = 0; + ///< Destructor. + +public: +//! @} +//! @name Signal Handlers +//! @{ + + virtual void on_tag_style_changed(const String& name); + //!< Called when a tag style is changed. + //!< @param name The name of the new tag style. +}; + +} // Gtk + +} // Xfc + +#endif Index: libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh (revision 0) @@ -0,0 +1,53 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_STYLE_SCHEME_SIGNALS_HH +#define XFC_GTK_SOURCE_STYLE_SCHEME_SIGNALS_HH + +#ifndef XFC_G_TYPE_HH +#include <xfc/glib/type.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceStyleSchemeSignals : public virtual G::TypeInterface +{ +protected: +/// @name Constructors +/// @{ + + virtual ~SourceStyleSchemeSignals() = 0; + ///< Destructor. + +/// }@ +public: +//! @} +// Override these do_ methods when you want to change the default behaviour of the GtkSourceStyleScheme. + + virtual const char* do_get_name(); + + virtual GtkSourceTagStyle* do_get_tag_style(const char *style_name); + + virtual GSList* do_get_style_names(); + +//! @name Signal Handlers +//! @{ + + virtual void on_style_changed(const String& tag_id); + //!< Called whenever the tag style changes. + //!< @param tag_id The tag identifier for the new style. + +//! @} +// Signals +}; + +} + +} + +#endif Index: libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh (revision 0) @@ -0,0 +1,54 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_PRINT_JOB_SIGNALS_HH +#define XFC_GTK_SOURCE_PRINT_JOB_SIGNALS_HH + +#ifndef XFC_GTK_TEXT_BUFFER_SIGNALS_HH +#include <xfc/gtk/objectsignals.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourcePrintJobSignals : public ObjectSignals +{ +protected: +/// @name Constructors +/// @{ + + SourcePrintJobSignals(SourcePrintJob *job); + ///< Constructs a new TextPrintJobSignals object. + ///< @param job A SourcePrintJob object inheriting the Signals implementation. + + virtual ~SourcePrintJobSignals() = 0; + ///< Destructor. + +public: +//! @} +//! @name Signal Handlers +//! @{ + + virtual void on_begin_page(); + //!< Called whenever the print job is about to print a new text page. + //!< You can connect to this signal to provide the user with feedback + //!< about the progress of printing, or to customize the printed page + //!< by for example, printing your own headers and footers. + + virtual void on_finished(); + //!< Called whenever an asynchronous print job has finished. You can + //!< connect to this signal to get notification when a job has finished + //!< printing. When it's emitted, the GnomePrintJob the print job was + //!< producing has been closed and it can be either previewed or printed + //!< to the physical device. +}; + +} + +} + +#endif Index: libXFCsourceview/xfc/sourceview/sourcelanguage.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourcelanguage.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcelanguage.cc (revision 0) @@ -0,0 +1,345 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourceview.cc - GtkSourceLanguage C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourcelanguage.hh" +#include "sourcelanguagesignals.hh" +#include "private/sourcelanguageclass.hh" +#include "sourcestylescheme.hh" + +#include <xfc/glib/unicode.hh> +#include <xfc/gtk/texttag.hh> + +#include <xfc/gtk/private/marshal.hh> + +using namespace Xfc; + +/* Gtk::SourceLanguage + */ + +Gtk::SourceLanguage::SourceLanguage(GtkSourceLanguage *language, bool reference) +: G::Object((GObject*)language, reference) +{ +} + +Gtk::SourceLanguage::~SourceLanguage() +{ +} + +Gtk::SourceLanguage::operator GtkSourceLanguage* () const +{ + return this ? gtk_source_language() : 0; +} + +bool +Gtk::SourceLanguage::is_gtk_source_language() const +{ + return is_a(GTK_TYPE_SOURCE_LANGUAGE); +} + +String +Gtk::SourceLanguage::get_id() const +{ + return gtk_source_language_get_id(gtk_source_language()); +} + +String +Gtk::SourceLanguage::get_name() const +{ + char *name = gtk_source_language_get_name(gtk_source_language()); + String s(name); + g_free(name); + return s; +} + +String +Gtk::SourceLanguage::get_section() const +{ + char *section = gtk_source_language_get_section(gtk_source_language()); + String s(section); + g_free(section); + return s; +} + +bool +Gtk::SourceLanguage::get_tags(std::vector<Pointer<TextTag> >& tags) const +{ + g_return_val_if_fail(tags.empty(), false); + GSList *first = gtk_source_language_get_tags(gtk_source_language()); + GSList *next = first; + + while (next != 0) + { + Pointer<TextTag> tmp_tag(G::Object::wrap<TextTag>((GtkTextTag*)next->data)); + tags.push_back(tmp_tag); + next = g_slist_next(next); + } + + g_slist_free(first); + return !tags.empty(); +} + +G::Unichar +Gtk::SourceLanguage::get_escape_char() const +{ + return gtk_source_language_get_escape_char(gtk_source_language()); +} + +bool +Gtk::SourceLanguage::get_mime_types(std::vector<String>& mime_types) const +{ + g_return_val_if_fail(mime_types.empty(), false); + GSList *first = gtk_source_language_get_mime_types(gtk_source_language()); + GSList *next = first; + + while (next != 0) + { + char *mime_type = reinterpret_cast<char*>(next->data); + mime_types.push_back(mime_type); + g_free(mime_type); + next = g_slist_next(next); + } + + g_slist_free(first); + return !mime_types.empty(); +} + +Gtk::SourceStyleScheme* +Gtk::SourceLanguage::get_style_scheme() const +{ + GtkSourceStyleScheme *scheme = gtk_source_language_get_style_scheme(gtk_source_language()); + SourceStyleScheme *tmp_scheme = 0; + if (scheme) + { + G::Object *object = G::Object::pointer(G_OBJECT(scheme)); + tmp_scheme = dynamic_cast<SourceStyleScheme*>(object); + } + return tmp_scheme; +} + +Gtk::SourceTagStyle* +Gtk::SourceLanguage::get_tag_style(const String& tag_name) const +{ + GtkSourceTagStyle *tmp_style = gtk_source_language_get_tag_style(gtk_source_language(), tag_name.c_str()); + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, tmp_style, false); +} + +Gtk::SourceTagStyle* +Gtk::SourceLanguage::get_tag_default_style(const String& tag_name) const +{ + GtkSourceTagStyle *style = gtk_source_language_get_tag_default_style(gtk_source_language(), tag_name.c_str()); + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, style, false); +} + +void +Gtk::SourceLanguage::set_mime_types(const std::vector<String>& mime_types) +{ + g_return_if_fail(!mime_types.empty()); + GSList *tmp_mime_types = 0; + int count = mime_types.size(); + + int i = 0; + while (i < count) + { + tmp_mime_types = g_slist_append(tmp_mime_types, (void*)mime_types[i].c_str()); + ++i; + } + + gtk_source_language_set_mime_types(gtk_source_language(), tmp_mime_types); + g_slist_free(tmp_mime_types); +} + +void +Gtk::SourceLanguage::set_style_scheme(SourceStyleScheme& scheme) +{ + gtk_source_language_set_style_scheme(gtk_source_language(), scheme.gtk_source_style_scheme()); +} + +void +Gtk::SourceLanguage::set_tag_style(const String& tag_name, const SourceTagStyle& style) +{ + gtk_source_language_set_tag_style(gtk_source_language(), tag_name.c_str(), style.gtk_source_tag_style()); +} + +/* Gtk::SourceLanguageClass + */ + +void +Gtk::SourceLanguageClass::init(GtkSourceLanguageClass *g_class) +{ + G::ObjectClass::init((GObjectClass*)g_class); + g_class->tag_style_changed = &tag_style_changed_proxy; +} + +GType +Gtk::SourceLanguageClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_LANGUAGE, (GClassInitFunc)init); + } + return type; +} + +GtkSourceLanguageClass* +Gtk::SourceLanguageClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceLanguageClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +void* +Gtk::SourceLanguageClass::create() +{ + return g_object_new(get_type(), 0); +} + +void +Gtk::SourceLanguageClass::tag_style_changed_proxy(GtkSourceLanguage *language, const gchar *name) +{ + void *ptr = g_object_get_qdata((GObject*)language, G::ObjectSignals::quark()); + if (ptr) + { + String tmp_name(name); + static_cast<SourceLanguageSignals*>(ptr)->on_tag_style_changed(name); + } + else + { + GtkSourceLanguageClass *g_class = get_parent_class(language); + if (g_class->tag_style_changed) + g_class->tag_style_changed(language, name); + } +} + +/* Gtk::SourceLanguage signals + */ + +const Gtk::SourceLanguage::TagStyleChangedSignalType Gtk::SourceLanguage::tag_style_changed_signal("tag_style_changed", (GCallback)&G::Marshal::void_callback ); + +/* Gtk::SourceLanguagesManager + */ + +Gtk::SourceLanguagesManager::SourceLanguagesManager(GtkSourceLanguagesManager *lm, bool reference) +: G::Object((GObject*)lm, reference) +{ +} + +Gtk::SourceLanguagesManager::SourceLanguagesManager() +: G::Object((GObject*)SourceLanguagesManagerClass::create()) +{ +} + +Gtk::SourceLanguagesManager::~SourceLanguagesManager() +{ +} + +Gtk::SourceLanguagesManager::operator GtkSourceLanguagesManager* () const +{ + return this ? gtk_source_languages_manager() : 0; +} + +bool +Gtk::SourceLanguagesManager::is_gtk_source_languages_manager() const +{ + return is_a(GTK_TYPE_SOURCE_LANGUAGES_MANAGER); +} + +bool +Gtk::SourceLanguagesManager::get_available_languages(std::vector<SourceLanguage*>& languages) const +{ + g_return_val_if_fail(languages.empty(), false); + const GSList *list = gtk_source_languages_manager_get_available_languages(gtk_source_languages_manager()); + + while (list != 0) + { + languages.push_back(G::Object::wrap<SourceLanguage>((GtkSourceLanguage*)list->data)); + list = g_slist_next(list); + } + + return !languages.empty(); +} + +Gtk::SourceLanguage* +Gtk::SourceLanguagesManager::get_language_from_mime_type(const String& mime_type) const +{ + GtkSourceLanguage *language = gtk_source_languages_manager_get_language_from_mime_type(gtk_source_languages_manager(), mime_type.c_str()); + return G::Object::wrap<SourceLanguage>(language); +} + +Gtk::SourceLanguage* +Gtk::SourceLanguagesManager::get_language_from_name(const String& language) const +{ + std::vector<Gtk::SourceLanguage*> languages; + get_available_languages(languages); + int count = languages.size(); + for (int i = 0; i < count; i++) + { + String name = languages[i]->get_name(); + if (name.compare(language) == 0) + return languages[i]; + } + return 0; +} + +bool +Gtk::SourceLanguagesManager::get_lang_files_dirs(std::vector<String>& dirs) const +{ + g_return_val_if_fail(dirs.empty(), false); + const GSList *list = gtk_source_languages_manager_get_lang_files_dirs(gtk_source_languages_manager()); + + while (list != 0) + { + dirs.push_back((char*)list->data); + list = g_slist_next(list); + } + + return !dirs.empty(); +} + +/* Gtk::SourceLanguagesManagerClass + */ + +void +Gtk::SourceLanguagesManagerClass::init(GtkSourceLanguagesManagerClass *g_class) +{ + G::ObjectClass::init((GObjectClass*)g_class); +} + +GType +Gtk::SourceLanguagesManagerClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_LANGUAGES_MANAGER, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceLanguagesManagerClass::create() +{ + return g_object_new(get_type(), 0); +} + +/* Gtk::SourceLanguagesManager properties + */ + +const Gtk::SourceLanguagesManager::LangSpecsDirsPropertyType Gtk::SourceLanguagesManager::lang_specs_dirs_property("lang_files_dirs"); + Index: libXFCsourceview/xfc/sourceview/sourcebuffer.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcebuffer.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcebuffer.hh (revision 0) @@ -0,0 +1,501 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//! @file inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceBuffer C++ wrapper interface. +//! +//! Provides SourceBuffer, a Gtk::TextBuffer object that implements syntax highlighting, +//! bracket matching, markers and support for undo/redo operations. + +#ifndef XFC_GTK_SOURCE_BUFFER_H +#define XFC_GTK_SOURCE_BUFFER_H + +#ifndef XFC_GTK_TEXT_BUFFER_HH +#include <xfc/gtk/textbuffer.hh> +#endif + +#ifndef XFC_GTK_SOURCE_LANGUAGE_HH +#include <xfc/sourceview/sourcelanguage.hh> +#endif + +#ifndef XFC_GTK_SOURCE_TAG_HH +#include <xfc/sourceview/sourcetag.hh> +#endif + +#ifndef __GTK_SOURCE_BUFFER_H__ +#include <gtksourceview/gtksourcebuffer.h> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceBuffer; +class SourceLanguage; +class SourceMarker; + +//! @class SourceMarker sourcebuffer.h inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceMarker C++ wrapper class. +//! +//! SourceMarker is like a bookmark in a source buffer; it preserves a position +//! in the text across source buffer modifications (see Gtk::TextMark). Typical +//! uses for markers are bookmarks, breakpoints, current executing instruction +//! indication in a source file, etc.. + +class SourceMarker : public TextMark +{ + friend class G::Object; + + SourceMarker(const SourceMarker&); + SourceMarker& operator=(const SourceMarker&); + +protected: +//! @name Constructors +//! @{ + + explicit SourceMarker(GtkSourceMarker *marker, bool reference = false); + //!< Construct a new SourceMarker from an existing GtkSourceMarker. + //!< @param marker A pointer to a GtkSourceMarker. + //!< @param reference Set false if the initial reference count is floating, set true if it's not. + //!< + //!< <BR>The <EM>marker</EM> can be a newly created GtkSourceMarker or an existing + //!< GtkSourceMarker (see G::Object::Object). + +//! @} + +public: +//! @name Constructors +//! @{ + + virtual ~SourceMarker(); + //!< Destructor. + +//! @} +//! @name Accessors +//! @{ + + GtkSourceMarker* gtk_source_marker() const { return reinterpret_cast<GtkSourceMarker*>( instance_ ); } + //!< Get a pointer to the GtkSourceMarker structure. + + operator GtkSourceMarker* () const; + //!< Conversion operator; safely converts a SourceMarker to a GtkSourceMarker pointer. + + bool is_gtk_source_marker() const; + //!< Returns true if the object instance is of type GTK_TYPE_SOURCE_MARKER. + + String get_marker_type() const; + //!< Returns a String identifying marker type. + + int get_line() const; + //!< Returns the line number containing the marker. + + String get_name() const; + //!< Returns the name of the marker. + + SourceBuffer* get_buffer() const; + //!< Returns the SourceBuffer this marker is associated with. + + SourceMarker* next() const; + //!< Move to the next marker in the source buffer. + //!< @return The next marker. + + SourceMarker* prev() const; + //!< Move to the previous marker in the source buffer. + //!< @return The previous marker. + +//! @} +//! @name Methods +//! @{ + + void set_marker_type(const String& type); + //!< Set the marker type. + //!< @param type The marker type. + +//! @} +}; + +//! @class SourceBuffer sourcebuffer.h inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceBuffer C++ wrapper class. +//! +//! The SourceBuffer object is the text model for SourceView widgets. It extends +//! the Gtk::TextBuffer object by adding features necessary to display and edit +//! source code: syntax highlighting, bracket matching and markers. It also +//! implements support for undo/redo operations. By default syntax highlighting +//! is enabled, but you can disable it with set_highlight(). This can be useful +//! if you're not using SourceLanguage objects to set the highlighting patterns +//! but instead you're manually adding SourceTag objects to the buffer's tag table. + +class SourceBuffer : public TextBuffer +{ + friend class G::Object; + + SourceBuffer(const SourceBuffer&); + SourceBuffer& operator=(const SourceBuffer&); + +protected: +//! @name Constructors +//! @{ + + explicit SourceBuffer(GtkSourceBuffer *buffer, bool owns_reference = true); + //!< Construct a new SourceBuffer from an existing GtkSourceBuffer. + //!< @param buffer A pointer to a GtkSourceBuffer. + //!< @param reference Set <EM>false</EM> if the initial reference count is floating, + //!< set <EM>true</EM> if it's not. + //!< + //!< <BR>The <EM>buffer</EM> can be a newly created GtkSourceBuffer or an existing + //!< GtkSourceBuffer (see G::Object::Object). + +//! @} +// Properties + + typedef G::Property<G::Unichar> EscapeCharPropertyType; + typedef G::PropertyProxy<G::Object, EscapeCharPropertyType> EscapeCharPropertyProxy; + static const EscapeCharPropertyType escape_char_property; + + typedef G::Property<bool> CheckBracketsPropertyType; + typedef G::PropertyProxy<G::Object, CheckBracketsPropertyType> CheckBracketsPropertyProxy; + static const CheckBracketsPropertyType check_brackets_property; + + typedef G::Property<bool> HighlightPropertyType; + typedef G::PropertyProxy<G::Object, HighlightPropertyType> HighlightPropertyProxy; + static const HighlightPropertyType highlight_property; + + typedef G::Property<int> MaxUndoLevelsPropertyType; + typedef G::PropertyProxy<G::Object, MaxUndoLevelsPropertyType> MaxUndoLevelsPropertyProxy; + static const MaxUndoLevelsPropertyType max_undo_levels_property; + + typedef G::Property<SourceLanguage*, G::Object*> LanguagePropertyType; + typedef G::PropertyProxy<G::Object, LanguagePropertyType> LanguagePropertyProxy; + static const LanguagePropertyType language_property; + +// Signals + + typedef G::Signal1<void, bool> CanUndoSignalType; + typedef G::SignalProxy<TypeInstance, CanUndoSignalType> CanUndoSignalProxy; + static const CanUndoSignalType can_undo_signal; + + typedef G::Signal1<void, bool> CanRedoSignalType; + typedef G::SignalProxy<TypeInstance, CanRedoSignalType> CanRedoSignalProxy; + static const CanRedoSignalType can_redo_signal; + + typedef G::Signal2<void, GtkTextIter*, GtkTextIter*> HighlightUpdatedSignalType; + typedef G::SignalProxy<TypeInstance, HighlightUpdatedSignalType> HighlightUpdatedSignalProxy; + static const HighlightUpdatedSignalType highlight_updated_signal; + + typedef G::Signal1<void, GtkTextIter*> MarkerUpdatedSignalType; + typedef G::SignalProxy<TypeInstance, MarkerUpdatedSignalType> MarkerUpdatedSignalProxy; + static const MarkerUpdatedSignalType marker_updated_signal; + +public: +//! @name Constructors +//! @{ + + SourceBuffer(SourceTagTable *table = 0); + //!< Constructs a new source buffer with a empty default buffer. + //!< @param table A source tag table, or null to have the text buffer create one for you. + + SourceBuffer(const SourceLanguage& language); + //!< Constructs a new source buffer which will highlight text according to the specified language. + //!< @param language The source language. + + virtual ~SourceBuffer(); + //!< Destructor. + +//! @} +//! @name Accessors +//! @{ + + GtkSourceBuffer* gtk_source_buffer() const { return reinterpret_cast<GtkSourceBuffer*>(instance_); } + //!< Get a pointer to the GtkSourceBuffer structure. + + operator GtkSourceBuffer* () const; + //!< Conversion operator; safely converts a SourceBuffer to a GtkSourceBuffer pointer. + + bool is_gtk_source_buffer() const; + //!< Returns true if the object instance is of type GTK_TYPE_SOURCE_BUFFER. + + SourceTagTable* get_source_tag_table() const; + //!< Get the SourceTagTable associated with the buffer. + //!< @return The buffer's tag table. + + bool get_check_brackets() const; + //!< Determines whether bracket match highlighting is activated for the source buffer. + //!< @return <EM>true</EM> if the source buffer will highlight matching brackets. + + bool get_highlight() const; + //!< Determines whether text highlighting is activated in the source buffer. + //!< @return <EM>true</EM> if highlighting is enabled. + + int get_max_undo_levels() const; + //!< Determines the number of undo levels the buffer will track for buffer edits. + //!< @return The maximum number of possible undo levels. + + SourceLanguage* get_language() const; + //!< Determines the SourceLanguage used by the buffer. + //!< @return The SourceLangauge (should not be unreferenced by the user). + + G::Unichar get_escape_char() const; + //!< Determines the escape character used by the source buffer highlighting engine. + //!< @return A G::Unichar that holds the UTF-8 escape character the buffer is using. + + bool can_undo() const; + //!< Determines whether a source buffer can undo the last action. + //!< @return <EM>true</EM> if it's possible to undo the last action. + + bool can_redo() const; + //!< Determines whether a source buffer can redo the last undo action. + //!< @return <EM>true</EM> if buffer changes that were undone can be redone. + + SourceMarker* get_marker(const String& name) const; + //!< Looks up the SourceMarker named <EM>name</EM> in the buffer, returning + //!< null if it doesn't exists. + //!< @param name The name of the marker to retrieve. + //!< @return The SourceMarker identified by <EM>name</EM>, or null. + + std::vector<SourceMarker*> get_markers(const TextIter& start, const TextIter& end) const; + //!< Gets a list of the source markers inside the range delimited by <EM>start</EM> and <EM>end</EM>. + //!< @param start The beginning of the range. + //!< @param end The end of the range. + //!< @return A vector of SourceMarker pointers inside the range. + + SourceMarker* get_first_marker() const; + //!< Gets the first marker (nearest to the top) in the buffer. + //!< @return A pointer to the first SourceMarker, or null if there are no markers in the buffer. + + SourceMarker* get_last_marker() const; + //!< Gets the last marker (nearest to the end) in the buffer. + //!< @return A pointer to the last SourceMarker, or null if there are no markers in the buffer. + + TextIter get_iter_at_marker(const SourceMarker& marker) const; + //!< Obtains an initialized iterator to the location of <EM>marker</EM>. + //!< @return The initialized iterator. + + SourceMarker* get_next_marker(TextIter& iter) const; + //!< Gets the nearest marker to the right of iter. + //!< @param iter The location to start searching from. + //!< @return The SourceMarker nearest to the right of iter, or null if there are no more markers after iter. + //!< + //!< <BR>If there are multiple markers at the same position, this function will always return + //!< the first one (from the internal linked list), even if starting the search exactly at + //!< its location. You can get the others using Gtk::SourceMarker::next(). + + SourceMarker* get_prev_marker(TextIter& iter) const; + //!< Gets the nearest marker to the left of iter. + //!< @param iter The location to start searching from. + //!< @return The SourceMarker nearest to the left of iter, or null if there are no more markers before iter. + //!< + //!< <BR>If there are multiple markers at the same position, this function will always return + //!< the last one (from the internal linked list), even if starting the search exactly at + //!< its location. You can get the others using Gtk::SourceMarker::prev(). + +//! @} +//! @name Methods +//! @{ + + void set_check_brackets(bool check_brackets); + //!< Controls the bracket match highlighting function in the buffer. + //!< @param check_brackets Set <EM>true</EM> if you want matching brackets highlighted. + //!< + //!< <BR>If activated, when you position your cursor over a bracket character + //!< (a parenthesis, a square bracket, etc.) the matching opening or closing + //!< bracket character will be highlighted. You can specify the style with the + //!< set_bracket_match_style() method. + + void set_bracket_match_style(const SourceTagStyle& style); + //!< Sets the style used for highlighting matching brackets. + //!< @param style The SourceTagStyle that specifies the color and text attributes to use. + + void set_highlight(bool highlight); + //!< Controls whether text is highlighted in the buffer. + //!< @param highlight Set <EM>true</EM> if you want to activate highlighting. + //!< + //!< <BR>If <EM>highlight</EM> is <EM>true</EM> the text will be highlighted according + //!< to the patterns installed in the buffer (either set with set_language() or by + //!< adding individual SourceTags to the buffer's tag table). Otherwise, any current + //!< highlighted text will be restored to the default buffer style. + //!< + //!< Tags not of the SourceTag type will not be removed by this option, and normal + //!< Gtk::TextTag priority settings apply when highlighting is enabled. + //!< + //!< If you're not using a SourceLanguage to set the highlighting patterns + //!< in the buffer, it is recommended for performance reasons that you add + //!< all the SourceTags with highlighting disabled and enable highlighting + //!< when finished. + + void set_max_undo_levels(int max_undo_levels); + //!< Sets the number of undo levels for user actions the buffer will track. + //!< @param max_undo_levels The desired maximum number of undo levels. + //!< + //!< <BR>If the number of user actions exceeds the limit set by this function, + //!< older actions will be discarded. A new action is started whenever the + //!< function Gtk::TextBuffer::begin_user_action() is called. In general, + //!< this happens whenever the user presses any key which modifies the buffer, + //!< but the undo manager will try to merge similar consecutive actions, such + //!< as multiple character insertions into one action. But, inserting a newline + //!< does start a new action. + + void set_language(const SourceLanguage *language); + //!< Sets the SourceLanguage the source buffer will use, adding SourceTags with the + //!< language's patterns and setting the escape character with set_escape_char(). + //!< @param language The SourceLanguage to set, or null. + //!< + //!< <BR>Note that this will remove any SourceTags currently in the buffer's tag table. + //!< The buffer holds a reference to the language set. + + void set_escape_char(G::Unichar escape_char); + //!< Sets the escape character to be used by the highlighting engine. + //!< @param escape_char A G::Unichar holding the escape character the buffer should use. + //!< + //!< <BR>When performing the initial analysis, the engine will discard a matching + //!< syntax pattern if it's prefixed with an odd number of escape characters. This + //!< allows for example to correctly highlight strings with escaped quotes embedded. + //!< This setting affects only syntax patterns (i.e. those defined in SyntaxTags). + + void undo(); + //!< Undoes the last user action which modified the buffer. Use can_undo() to check + //!< whether a call to this method will have any effect. Actions are defined as groups + //!< of operations between a call to Gtk::TextBuffer's begin_user_action() and + //!< end_user_action() methods, or sequences of similar edits (inserts or deletes) on + //!< the same line. + + void redo(); + //!< Redoes the last undo operation. Use can_redo() to check whether a call to this + //!< method will have any effect. + + void begin_not_undoable_action(); + //!< Marks the beginning of a not undoable action on the buffer, disabling the undo manager. + //!< Typically you would call this method before initially setting the contents of the buffer + //!< (e.g. when loading a file in a text editor). You may nest begin_not_undoable_action() + //!< / end_not_undoable_action() blocks. + + void end_not_undoable_action(); + //!< Marks the end of a not undoable action on the buffer. When the last not undoable block + //!< is closed through the call to this method, the list of undo actions is cleared and the + //!< undo manager is re-enabled. + + SourceMarker* create_marker(const String& name, const String& type, const TextIter& where); + //!< Creates a marker in the buffer of type <EM>type</EM>. + //!< @param name The name of the marker, or null for an anonymous marker. + //!< @param type A String defining the marker type, or null. + //!< @param where The location to place the new marker. + //!< @return The new SourceMarker object, owned by the buffer. + //!< + //!< <BR>A marker is semantically very similar to a Gtk::TextMark, except it has a type + //!< which is used by the SourceView displaying the buffer to show a pixmap on the left + //!< margin, at the line the marker is in. Because of this, a marker is generally + //!< associated to a line and not a character position. Markers are also accessible + //!< through a position or range in the buffer. + //!< + //!< Markers are implemented using Gtk::TextMark, so all characteristics and restrictions + //!< to marks apply to markers too. These includes life cycle issues and "mark-set" and + //!< "mark-deleted" signal emissions. Like a Gtk::TextMark, a SourceMarker can be anonymous + //!< if the passed name is null. Also, the buffer owns the markers so you shouldn't + //!< unreference it. + //!< + //!< Markers always have left gravity and are moved to the beginning of the line when the + //!< user deletes the line they were in. Also, if the user deletes a region of text which + //!< contained lines with markers, those are deleted. Typical uses for a marker are bookmarks, + //!< breakpoints, current executing instruction indication in a source file, etc.. + + void move_marker(SourceMarker& marker, const TextIter& where); + //!< Moves <EM>marker</EM> to the new location <EM>where</EM>. + //!< @param marker A SourceMarker. + //!< @param where The new location for <EM>marker</EM> in the buffer. + + void delete_marker(SourceMarker& marker); + //!< Deletes <EM>marker</EM> from the source buffer. + //!< @param marker A SourceMarker in the buffer. + //!< + //!< <BR>The same conditions as for Gtk::TextMark apply here. The marker is no longer |
|
|
Re: New XFC versionAuke Kok wrote:
> how did the tarball end up being 700.000 bytes larger than 4.3.1? I see many updates to > html content, are those supposed to be updated? Also there seems to be a lot of added > whitespace (empty lines, trailing whitespace) that doesn't look good. I made it as a dist-bzip2 and that include all the doxygen generated reference, that will NOT be part of the subversion upcomming commit, of cause. > This obscures me to see what really changed in the new release :) Hmm, how about the "libXFCsourceview" dir ? This is the major addition to the code. > Can you post a diff to the -svn trunk? this would help us a lot more, since you won't > have to post any of the dist-generated files. Ok, attached the diff to this mail, hope that it helps. /BL Index: libXFCsourceview/xfc/Makefile.am =================================================================== --- libXFCsourceview/xfc/Makefile.am (revision 0) +++ libXFCsourceview/xfc/Makefile.am (revision 0) @@ -0,0 +1,8 @@ +## libXFCsourceview source directory + +SUBDIRS = sourceview + +lib_LTLIBRARIES = libXFCsourceview-4.3.la +libXFCsourceview_4_3_la_SOURCES= +libXFCsourceview_4_3_la_LIBADD= sourceview/libsourceview.la $(XFC_SOURCEVIEW_LIBS) +libXFCsourceview_4_3_la_LDFLAGS= -version-info $(XFC_LIBRARY_VERSION) Index: libXFCsourceview/xfc/sourceview/sourceview.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourceview.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceview.cc (revision 0) @@ -0,0 +1,223 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourceview.cc - GtkSourceView C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourceview.hh" +#include "private/sourceviewclass.hh" +#include <xfc/gdk-pixbuf/pixbuf.hh> + +using namespace Xfc; + +Gtk::SourceView::SourceView(GtkSourceView *view, bool reference) +: TextView((GtkTextView*)view, reference) +{ +} + +Gtk::SourceView::SourceView() +: TextView((GtkTextView*)SourceViewClass::create()) +{ + set_buffer(new Gtk::SourceBuffer); +} + +Gtk::SourceView::SourceView(SourceBuffer& buffer) +: TextView((GtkTextView*)SourceViewClass::create()) +{ + set_buffer(&buffer); +} + +Gtk::SourceView::~SourceView() +{ +} + +Gtk::SourceView::operator GtkSourceView* () const +{ + return this ? gtk_source_view() : 0; +} + +bool +Gtk::SourceView::is_gtk_source_view() const +{ + return is_a(GTK_TYPE_SOURCE_VIEW); +} + +Gtk::SourceBuffer* +Gtk::SourceView::get_source_buffer() const +{ + return static_cast<SourceBuffer*>(get_buffer()); +} + +bool +Gtk::SourceView::get_show_line_numbers() const +{ + return gtk_source_view_get_show_line_numbers(gtk_source_view()); +} + +bool +Gtk::SourceView::get_show_line_markers() const +{ + return gtk_source_view_get_show_line_markers(gtk_source_view()); +} + +unsigned int +Gtk::SourceView::get_tabs_width() const +{ + return gtk_source_view_get_tabs_width(gtk_source_view()); +} + +bool +Gtk::SourceView::get_auto_indent() const +{ + return gtk_source_view_get_auto_indent(gtk_source_view()); +} + +bool +Gtk::SourceView::get_insert_spaces_instead_of_tabs() const +{ + return gtk_source_view_get_insert_spaces_instead_of_tabs(gtk_source_view()); +} + +bool +Gtk::SourceView::get_show_margin() const +{ + return gtk_source_view_get_show_margin(gtk_source_view()); +} + +unsigned int +Gtk::SourceView::get_margin() const +{ + return gtk_source_view_get_margin(gtk_source_view()); +} + +Pointer<Gdk::Pixbuf> +Gtk::SourceView::get_marker_pixbuf(const String& marker_type) const +{ + return G::Object::wrap<Gdk::Pixbuf>(gtk_source_view_get_marker_pixbuf(gtk_source_view(), marker_type.c_str())); +} + +bool +Gtk::SourceView::get_smart_home_end() const +{ + return gtk_source_view_get_smart_home_end(gtk_source_view()); +} + +void +Gtk::SourceView::set_show_line_numbers(bool show) +{ + gtk_source_view_set_show_line_numbers(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_show_line_markers(bool show) +{ + gtk_source_view_set_show_line_markers(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_tabs_width(unsigned int width) +{ + gtk_source_view_set_tabs_width(gtk_source_view(), width); +} + +void +Gtk::SourceView::set_auto_indent(bool enable) +{ + gtk_source_view_set_auto_indent(gtk_source_view(), enable); +} + +void +Gtk::SourceView::set_insert_spaces_instead_of_tabs(bool enable) +{ + gtk_source_view_set_insert_spaces_instead_of_tabs(gtk_source_view(), enable); +} + +void +Gtk::SourceView::set_show_margin(bool show) +{ + gtk_source_view_set_show_margin(gtk_source_view(), show); +} + +void +Gtk::SourceView::set_margin(unsigned int margin) +{ + gtk_source_view_set_margin(gtk_source_view(), margin); +} + +void +Gtk::SourceView::set_marker_pixbuf(const String& marker_type, Gdk::Pixbuf *pixbuf) +{ + gtk_source_view_set_marker_pixbuf(gtk_source_view(), marker_type.c_str(), *pixbuf); +} + +void +Gtk::SourceView::set_smart_home_end(bool enable) +{ + gtk_source_view_set_smart_home_end(gtk_source_view(), enable); +} + +/* Gtk::SourceViewClass + */ + +void +Gtk::SourceViewClass::init(GtkSourceViewClass *g_class) +{ + TextViewClass::init((GtkTextViewClass*)g_class); +} + +GType +Gtk::SourceViewClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_VIEW, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceViewClass::create() +{ + return g_object_new(get_type(), 0); +} + +GtkSourceViewClass* +Gtk::SourceViewClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceViewClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +/* Properties + */ + +const Gtk::SourceView::ShowLineNumbersPropertyType Gtk::SourceView::show_line_numbers_property("show_line_numbers"); + +const Gtk::SourceView::ShowLineMarkersPropertyType Gtk::SourceView::show_line_markers_property("show_line_markers"); + +const Gtk::SourceView::TabsWidthPropertyType Gtk::SourceView::tabs_width_property("tabs_width"); + +const Gtk::SourceView::AutoIndentPropertyType Gtk::SourceView::auto_indent_property("auto_indent"); + +const Gtk::SourceView::InsertSpacesPropertyType Gtk::SourceView::insert_spaces_property("insert_spaces_instead_of_tabs"); + +const Gtk::SourceView::ShowMarginPropertyType Gtk::SourceView::show_margin_property("show_margin"); + +const Gtk::SourceView::MarginPropertyType Gtk::SourceView::margin_property("margin"); + +const Gtk::SourceView::SmartHomeEndPropertyType Gtk::SourceView::smart_home_end_property("smart_home_end"); + Index: libXFCsourceview/xfc/sourceview/sourcetag.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourcetag.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcetag.cc (revision 0) @@ -0,0 +1,291 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourcetag.cc - GtkSourceTag, GtkSyntaxTag and GtkPatternTag C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourcetag.hh" +#include "sourcetagsignals.hh" +#include "private/sourcetagclass.hh" +#include "sourcetagstyle.hh" + +#include <xfc/gtk/private/marshal.hh> + +using namespace Xfc; + +/* Gtk::SourceTag + */ + +Gtk::SourceTag::SourceTag(GtkSourceTag *tag, bool reference) +: Gtk::TextTag((GtkTextTag*)tag, reference) +{ +} + +Gtk::SourceTag::~SourceTag() +{ +} + +Gtk::SourceTag::operator GtkSourceTag* () const +{ + return this ? gtk_source_tag() : 0; +} + +bool +Gtk::SourceTag::is_gtk_source_tag() const +{ + return is_a(GTK_TYPE_SOURCE_TAG); +} + +String +Gtk::SourceTag::get_id() const +{ + return gtk_source_tag_get_id(gtk_source_tag()); +} + +Gtk::SourceTagStyle* +Gtk::SourceTag::get_style() const +{ + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, gtk_source_tag_get_style(gtk_source_tag()), false); +} + +void +Gtk::SourceTag::set_style(const SourceTagStyle& style) +{ + gtk_source_tag_set_style(gtk_source_tag(), style.gtk_source_tag_style()); +} + +/* Gtk::SourceTag properties + */ + +const Gtk::SourceTag::IdPropertyType Gtk::SourceTag::id_property("id"); + +const Gtk::SourceTag::TagStylePropertyType Gtk::SourceTag::tag_style_property("tag_style"); + +/* Gtk::SyntaxTag + */ + +Gtk::SyntaxTag::SyntaxTag(GtkSyntaxTag *tag, bool reference) +: Gtk::SourceTag((GtkSourceTag*)tag, reference) +{ +} + +Gtk::SyntaxTag::SyntaxTag(const String& id, const String& name, const char *pattern_start, const char *pattern_end) +: Gtk::SourceTag((GtkSourceTag*)gtk_syntax_tag_new(id.c_str(), name.c_str(), pattern_start, pattern_end)) +{ +} + +Gtk::SyntaxTag::~SyntaxTag() +{ +} + +Gtk::SyntaxTag::operator GtkSyntaxTag* () const +{ + return this ? gtk_syntax_tag() : 0; +} + +bool +Gtk::SyntaxTag::is_gtk_syntax_tag() const +{ + return is_a(GTK_TYPE_SYNTAX_TAG); +} + +/* Gtk::LineCommentTag + */ + +Gtk::LineCommentTag::LineCommentTag(const String& id, const String& name, const char *pattern_start) +: Gtk::SyntaxTag((GtkSyntaxTag*)gtk_line_comment_tag_new(id.c_str(), name.c_str(), pattern_start)) +{ +} + +/* Gtk::StringTag + */ + +Gtk::StringTag::StringTag(const String& id, const String& name, const char *pattern_start, const char *pattern_end, bool end_at_line_end) +: Gtk::SyntaxTag((GtkSyntaxTag*)gtk_string_tag_new(id.c_str(), name.c_str(), pattern_start, pattern_end, end_at_line_end)) +{ +} + +/* Gtk::PatternTag + */ + +Gtk::PatternTag::PatternTag(GtkPatternTag *tag, bool reference) +: Gtk::SourceTag((GtkSourceTag*)tag, reference) +{ +} + +Gtk::PatternTag::PatternTag(const String& id, const String& name, const char *pattern) +: Gtk::SourceTag((GtkSourceTag*)gtk_pattern_tag_new(id.c_str(), name.c_str(), pattern)) +{ +} + +Gtk::PatternTag::~PatternTag() +{ +} + +Gtk::PatternTag::operator GtkPatternTag* () const +{ + return this ? gtk_pattern_tag() : 0; +} + +bool +Gtk::PatternTag::is_gtk_pattern_tag() const +{ + return is_a(GTK_TYPE_PATTERN_TAG); +} + +/* Gtk::KeywordListTag + */ + +namespace { // create_keyword_list_tag + +GtkTextTag* +create_keyword_list_tag(const String& id, const String& name, std::vector<String>& keywords, bool case_sensitive, + bool match_empty_string_at_beginning, bool match_empty_string_at_end, + const char *beginning_regex, const char *end_regex) +{ + GSList *tmp_keywords = 0; + int count = keywords.size(); + + int i = 0; + while (i < count) + { + tmp_keywords = g_slist_append(tmp_keywords, (void*)keywords[i].c_str()); + ++i; + } + + GtkTextTag *tag = gtk_keyword_list_tag_new(id.c_str(), name.c_str(), tmp_keywords, case_sensitive, + match_empty_string_at_beginning, + match_empty_string_at_end, + beginning_regex, end_regex); + g_slist_free(tmp_keywords); + return tag; +} + +} // namespace + +Gtk::KeywordListTag::KeywordListTag(const String& id, const String& name, std::vector<String>& keywords, bool case_sensitive, + bool match_empty_string_at_beginning, bool match_empty_string_at_end, + const char *beginning_regex, const char *end_regex) +: Gtk::PatternTag((GtkPatternTag*)create_keyword_list_tag(id, name, keywords, case_sensitive, + match_empty_string_at_beginning, match_empty_string_at_end, beginning_regex, end_regex)) +{ +} + +/* Gtk::SourceTagTable + */ + +Gtk::SourceTagTable::SourceTagTable(GtkSourceTagTable *table, bool reference) +: Gtk::TextTagTable((GtkTextTagTable*)table, reference) +{ +} + +Gtk::SourceTagTable::SourceTagTable() +: Gtk::TextTagTable((GtkTextTagTable*)SourceTagTableClass::create()) +{ +} + +Gtk::SourceTagTable::~SourceTagTable() +{ +} + +Gtk::SourceTagTable::operator GtkSourceTagTable* () const +{ + return this ? gtk_source_tag_table() : 0; +} + +bool +Gtk::SourceTagTable::is_gtk_source_tag_table() const +{ + return is_a(GTK_TYPE_SOURCE_TAG_TABLE); +} + +void +Gtk::SourceTagTable::add_tags(const std::vector<TextTag*>& tags) +{ + g_return_if_fail(!tags.empty()); + GSList *tmp_tags = 0; + int count = tags.size(); + + int i = 0; + while (i < count) + { + tmp_tags = g_slist_append(tmp_tags, (void*)tags[i]->gtk_text_tag()); + ++i; + } + + gtk_source_tag_table_add_tags(gtk_source_tag_table(), tmp_tags); + g_slist_free(tmp_tags); +} + +void +Gtk::SourceTagTable::remove_source_tags() +{ + gtk_source_tag_table_remove_source_tags(gtk_source_tag_table()); +} + +/* Gtk::SourceTagTableClass + */ + +void +Gtk::SourceTagTableClass::init(GtkSourceTagTableClass *g_class) +{ + TextTagTableClass::init((GtkTextTagTableClass*)g_class); + g_class->changed = &changed_proxy; +} + +GType +Gtk::SourceTagTableClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_TAG_TABLE, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceTagTableClass::create() +{ + return g_object_new(get_type(), 0); +} + +GtkSourceTagTableClass* +Gtk::SourceTagTableClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceTagTableClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +void +Gtk::SourceTagTableClass::changed_proxy(GtkSourceTagTable *table) +{ + void *ptr = g_object_get_qdata((GObject*)table, G::ObjectSignals::quark()); + if (ptr) + static_cast<SourceTagTableSignals*>(ptr)->on_changed(); + else + { + GtkSourceTagTableClass *g_class = get_parent_class(table); + if (g_class->changed) + g_class->changed(table); + } +} + +/* Gtk::SourceTagTable signals + */ + +const Gtk::SourceTagTable::ChangedSignalType Gtk::SourceTagTable::changed_signal("changed", (GCallback)&G::Marshal::void_callback); + Index: libXFCsourceview/xfc/sourceview/sourceiter.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourceiter.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceiter.hh (revision 0) @@ -0,0 +1,215 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//! @file inti/gtk-sourceview/sourceiter.h +//! @brief A Gtk::TextIter extension class. +//! +//! Provides SourceIter, a Gtk::TextIter object that supports case-insensitive searching. + +#ifndef XFC_GTK_SOURCE_ITER_HH +#define XFC_GTK_SOURCE_ITER_HH + +#ifndef XFC_GTK_TEXT_ITER_HH +#include <xfc/gtk/textiter.hh> +#endif + +#ifndef __GTK_SOURCE_ITER_H__ +#include <gtksourceview/gtksourceiter.h> +#endif + +namespace Xfc { + +namespace G { +class Object; +} + +namespace Gtk { + +//! @enum SourceSearchFlags +//! Specifies how a source iterator should search through a source buffer for a text string. + +enum SourceSearchFlags +{ + SOURCE_SEARCH_VISIBLE_ONLY = GTK_SOURCE_SEARCH_VISIBLE_ONLY, + //!< The matching text may have invisible text interspersed in it, that is, the text + //!< may possibly be a noncontiguous subsequence of the matched range. + + SOURCE_SEARCH_TEXT_ONLY = GTK_SOURCE_SEARCH_TEXT_ONLY, + //!< The matching text may have pixbufs or child widgets mixed inside the matched range. + + SOURCE_SEARCH_CASE_INSENSITIVE = GTK_SOURCE_SEARCH_CASE_INSENSITIVE + //!< The text will be matched regardless of what case it is in. +}; + +//! SourceSearchFlagsField holds one or more values from the SourceSearchFlags enumeration. + +typedef unsigned int SourceSearchFlagsField; + +//! @class SourceIter sourceiter.h inti/gtk-sourceview/sourceiter.h +//! @brief A GtkTextIter object that supports case-insensitive searching. +//! +//! SourceIter is a Gtk::TextIter extension that supports case-insensitive forward and backward searching. + +class SourceIter : public TextIter +{ +public: +//! @name Constructors +//! @{ + + SourceIter(); + //!< Construct an properly initialized source iterator. + + explicit SourceIter(GtkTextIter *iter); + //!< Construct a new source iterator from an existing GtkTextIter. + //!< @param iter A pointer to a GtkTextIter. + //!< + //!< <BR>The <EM>iter</EM> can be a newly created GtkTextIter or an existing + //!< GtkTextIter. The SourceIter object created is a temporary object. It doesn't + //!< take over the ownership of GtkTextIter and GtkTextIter is not freed by the + //!< destructor. + + SourceIter(GtkTextIter *iter, bool copy); + //!< Construct a new source iterator from an existing GtkTextIter. + //!< @param iter A pointer to a GtkTextIter. + //!< @param copy Whether the SourceIter object should make a copy of GtkTextIter or not. + //!< + //!< <BR>The <EM>iter</EM> can be a newly created GtkTextIter or an existing GtkTextIter. + //!< If <EM>copy</EM> is true SourceIter will make a copy of GtkTextIter. If <EM>copy</EM> + //!< is false SourceIter wont make a copy but instead takes over the ownership of GtkTextIter. + //!< Either way, the destructor will free GtkTextIter when the SourceIter object is destroyed. + //!< This constructor is used by G::Boxed::wrap() to wrap GtkTextIter objects in a C++ wrapper. + + SourceIter(const SourceIter& src); + //!< Copy constructor. + //!< @param src The source iterator. + + ~SourceIter(); + //!< Destructor. + + SourceIter& operator=(const SourceIter& src); + //!< Assignment operator. + //!< @param src The source iterator. + +//! @} +//! @name Methods +//! @{ + + bool forward_search(const char *str, const SourceIter *limit = 0); + bool forward_search(const String& str, const SourceIter *limit = 0); + //!< Do a case-sensitive search forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>The search will not continue past <EM>limit</EM>. Note that a search is a linear + //!< or O(n) operation, so you may wish to use limit to avoid locking up your UI on large + //!< buffers. The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + + bool forward_search(const char *str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool forward_search(const String& str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Do a case-sensitive search forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>Any match is returned by setting <EM>match_start</EM> to the first character of the + //!< match and <EM>match_end</EM> to the first character after the match. The search will + //!< not continue past <EM>limit</EM>. Note that a search is a linear or O(n) operation, + //!< so you may wish to use limit to avoid locking up your UI on large buffers. The + //!< Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text interspersed + //!< in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence of the matched range). + + bool forward_search(const char *str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool forward_search(const String& str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Searches forward for <EM>str</EM>. + //!< @param str The search string. + //!< @param flags The bitmask of flags specifying how the search is done. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The bound for the search, or null for the end of the buffer. + //!< @return Whether a match was found + //!< + //!< <BR>Any match is returned by setting <EM>match_start</EM> to the first character of the + //!< match and <EM>match_end</EM> to the first character after the match. The search will + //!< not continue past <EM>limit</EM>. Note that a search is a linear or O(n) operation, + //!< so you may wish to use limit to avoid locking up your UI on large buffers. If the + //!< Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is present, the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). Similarly, if you specify Gtk::SOURCE_SEARCH_TEXT_ONLY, the match + //!< may have pixbufs or child widgets mixed inside the matched range. If these flags are not + //!< given, the match must be exact; the special 0xFFFC character in str will match embedded + //!< pixbufs or child widgets. If you specify the Gtk::SOURCE_SEARCH_CASE_INSENSITIVE flag, + //!< the text will be matched regardless of what case it is in. + + bool backward_search(const char *str, const SourceIter *limit = 0); + bool backward_search(const String& str, const SourceIter *limit = 0); + //!< Do a case-sensitive search backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + //!< + //!< <BR>The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + bool backward_search(const char * str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool backward_search(const String& str, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Do a case-sensitive search backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + //!< + //!< <BR>The Gtk::SOURCE_SEARCH_VISIBLE_ONLY flag is used so the match may have invisible text + //!< interspersed in <EM>str</EM> (i.e. str will be a possibly-noncontiguous subsequence + //!< of the matched range). + + bool backward_search(const char *str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + bool backward_search(const String& str, SourceSearchFlagsField flags, SourceIter *match_start, SourceIter *match_end, const SourceIter *limit = 0); + //!< Searches backward for <EM>str</EM>. + //!< @param str The search string. + //!< @param flags The bitmask of flags specifying how the search is done. + //!< @param match_start The return location for start of match, or null. + //!< @param match_end The return location for end of match, or null. + //!< @param limit The location of last possible match_start, or null for start of buffer. + //!< @return Whether a match was found. + + bool find_matching_bracket(); + //!< Tries to match the bracket character currently at the iter with its opening/closing + //!< counterpart, and if found moves iter to the position where it was found. + //!< @return <EM>true</EM> if a matching bracket is found and the iter moved. + //!< + //!< <BR>If the current bracket is an opening bracket the buffer is searched in a + //!< forward direction. If the current bracket is a closing bracket the buffer is + //!< searched in a backward direction. + +//! @} +}; + +} // namespace Gtk + +} // namespace Xfc + +#endif // XFC_GTK_SOURCE_ITER_H + Index: libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcelanguagesignals.hh (revision 0) @@ -0,0 +1,45 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_LANGUAGE_SIGNALS_HH +#define XFC_GTK_SOURCE_LANGUAGE_SIGNALS_HH + +#ifndef XFC_G_OBJECT_SIGNALS_HH +#include <xfc/gtk/objectsignals.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceLanguageSignals : public ObjectSignals +{ +protected: +/// @name Constructors +/// @{ + + SourceLanguageSignals(SourceLanguage *buffer); + ///< Constructs a new TextBufferSignals object. + ///< @param buffer A TextBuffer object inheriting the TextLanguage Signals implementation. + + virtual ~SourceLanguageSignals() = 0; + ///< Destructor. + +public: +//! @} +//! @name Signal Handlers +//! @{ + + virtual void on_tag_style_changed(const String& name); + //!< Called when a tag style is changed. + //!< @param name The name of the new tag style. +}; + +} // Gtk + +} // Xfc + +#endif Index: libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcestyleschemesignals.hh (revision 0) @@ -0,0 +1,53 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_STYLE_SCHEME_SIGNALS_HH +#define XFC_GTK_SOURCE_STYLE_SCHEME_SIGNALS_HH + +#ifndef XFC_G_TYPE_HH +#include <xfc/glib/type.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceStyleSchemeSignals : public virtual G::TypeInterface +{ +protected: +/// @name Constructors +/// @{ + + virtual ~SourceStyleSchemeSignals() = 0; + ///< Destructor. + +/// }@ +public: +//! @} +// Override these do_ methods when you want to change the default behaviour of the GtkSourceStyleScheme. + + virtual const char* do_get_name(); + + virtual GtkSourceTagStyle* do_get_tag_style(const char *style_name); + + virtual GSList* do_get_style_names(); + +//! @name Signal Handlers +//! @{ + + virtual void on_style_changed(const String& tag_id); + //!< Called whenever the tag style changes. + //!< @param tag_id The tag identifier for the new style. + +//! @} +// Signals +}; + +} + +} + +#endif Index: libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourceprintjobsignals.hh (revision 0) @@ -0,0 +1,54 @@ +/* + XFC: Xfce Foundation Classes (User Interface Library) + Copyright (C) 2004 The XFC Development Team. + + LGPLv2 +*/ +#ifndef XFC_GTK_SOURCE_PRINT_JOB_SIGNALS_HH +#define XFC_GTK_SOURCE_PRINT_JOB_SIGNALS_HH + +#ifndef XFC_GTK_TEXT_BUFFER_SIGNALS_HH +#include <xfc/gtk/objectsignals.hh> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourcePrintJobSignals : public ObjectSignals +{ +protected: +/// @name Constructors +/// @{ + + SourcePrintJobSignals(SourcePrintJob *job); + ///< Constructs a new TextPrintJobSignals object. + ///< @param job A SourcePrintJob object inheriting the Signals implementation. + + virtual ~SourcePrintJobSignals() = 0; + ///< Destructor. + +public: +//! @} +//! @name Signal Handlers +//! @{ + + virtual void on_begin_page(); + //!< Called whenever the print job is about to print a new text page. + //!< You can connect to this signal to provide the user with feedback + //!< about the progress of printing, or to customize the printed page + //!< by for example, printing your own headers and footers. + + virtual void on_finished(); + //!< Called whenever an asynchronous print job has finished. You can + //!< connect to this signal to get notification when a job has finished + //!< printing. When it's emitted, the GnomePrintJob the print job was + //!< producing has been closed and it can be either previewed or printed + //!< to the physical device. +}; + +} + +} + +#endif Index: libXFCsourceview/xfc/sourceview/sourcelanguage.cc =================================================================== --- libXFCsourceview/xfc/sourceview/sourcelanguage.cc (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcelanguage.cc (revision 0) @@ -0,0 +1,345 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * sourceview.cc - GtkSourceLanguage C++ wrapper implementation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "sourcelanguage.hh" +#include "sourcelanguagesignals.hh" +#include "private/sourcelanguageclass.hh" +#include "sourcestylescheme.hh" + +#include <xfc/glib/unicode.hh> +#include <xfc/gtk/texttag.hh> + +#include <xfc/gtk/private/marshal.hh> + +using namespace Xfc; + +/* Gtk::SourceLanguage + */ + +Gtk::SourceLanguage::SourceLanguage(GtkSourceLanguage *language, bool reference) +: G::Object((GObject*)language, reference) +{ +} + +Gtk::SourceLanguage::~SourceLanguage() +{ +} + +Gtk::SourceLanguage::operator GtkSourceLanguage* () const +{ + return this ? gtk_source_language() : 0; +} + +bool +Gtk::SourceLanguage::is_gtk_source_language() const +{ + return is_a(GTK_TYPE_SOURCE_LANGUAGE); +} + +String +Gtk::SourceLanguage::get_id() const +{ + return gtk_source_language_get_id(gtk_source_language()); +} + +String +Gtk::SourceLanguage::get_name() const +{ + char *name = gtk_source_language_get_name(gtk_source_language()); + String s(name); + g_free(name); + return s; +} + +String +Gtk::SourceLanguage::get_section() const +{ + char *section = gtk_source_language_get_section(gtk_source_language()); + String s(section); + g_free(section); + return s; +} + +bool +Gtk::SourceLanguage::get_tags(std::vector<Pointer<TextTag> >& tags) const +{ + g_return_val_if_fail(tags.empty(), false); + GSList *first = gtk_source_language_get_tags(gtk_source_language()); + GSList *next = first; + + while (next != 0) + { + Pointer<TextTag> tmp_tag(G::Object::wrap<TextTag>((GtkTextTag*)next->data)); + tags.push_back(tmp_tag); + next = g_slist_next(next); + } + + g_slist_free(first); + return !tags.empty(); +} + +G::Unichar +Gtk::SourceLanguage::get_escape_char() const +{ + return gtk_source_language_get_escape_char(gtk_source_language()); +} + +bool +Gtk::SourceLanguage::get_mime_types(std::vector<String>& mime_types) const +{ + g_return_val_if_fail(mime_types.empty(), false); + GSList *first = gtk_source_language_get_mime_types(gtk_source_language()); + GSList *next = first; + + while (next != 0) + { + char *mime_type = reinterpret_cast<char*>(next->data); + mime_types.push_back(mime_type); + g_free(mime_type); + next = g_slist_next(next); + } + + g_slist_free(first); + return !mime_types.empty(); +} + +Gtk::SourceStyleScheme* +Gtk::SourceLanguage::get_style_scheme() const +{ + GtkSourceStyleScheme *scheme = gtk_source_language_get_style_scheme(gtk_source_language()); + SourceStyleScheme *tmp_scheme = 0; + if (scheme) + { + G::Object *object = G::Object::pointer(G_OBJECT(scheme)); + tmp_scheme = dynamic_cast<SourceStyleScheme*>(object); + } + return tmp_scheme; +} + +Gtk::SourceTagStyle* +Gtk::SourceLanguage::get_tag_style(const String& tag_name) const +{ + GtkSourceTagStyle *tmp_style = gtk_source_language_get_tag_style(gtk_source_language(), tag_name.c_str()); + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, tmp_style, false); +} + +Gtk::SourceTagStyle* +Gtk::SourceLanguage::get_tag_default_style(const String& tag_name) const +{ + GtkSourceTagStyle *style = gtk_source_language_get_tag_default_style(gtk_source_language(), tag_name.c_str()); + return G::Boxed::wrap<SourceTagStyle>(GTK_TYPE_SOURCE_TAG_STYLE, style, false); +} + +void +Gtk::SourceLanguage::set_mime_types(const std::vector<String>& mime_types) +{ + g_return_if_fail(!mime_types.empty()); + GSList *tmp_mime_types = 0; + int count = mime_types.size(); + + int i = 0; + while (i < count) + { + tmp_mime_types = g_slist_append(tmp_mime_types, (void*)mime_types[i].c_str()); + ++i; + } + + gtk_source_language_set_mime_types(gtk_source_language(), tmp_mime_types); + g_slist_free(tmp_mime_types); +} + +void +Gtk::SourceLanguage::set_style_scheme(SourceStyleScheme& scheme) +{ + gtk_source_language_set_style_scheme(gtk_source_language(), scheme.gtk_source_style_scheme()); +} + +void +Gtk::SourceLanguage::set_tag_style(const String& tag_name, const SourceTagStyle& style) +{ + gtk_source_language_set_tag_style(gtk_source_language(), tag_name.c_str(), style.gtk_source_tag_style()); +} + +/* Gtk::SourceLanguageClass + */ + +void +Gtk::SourceLanguageClass::init(GtkSourceLanguageClass *g_class) +{ + G::ObjectClass::init((GObjectClass*)g_class); + g_class->tag_style_changed = &tag_style_changed_proxy; +} + +GType +Gtk::SourceLanguageClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_LANGUAGE, (GClassInitFunc)init); + } + return type; +} + +GtkSourceLanguageClass* +Gtk::SourceLanguageClass::get_parent_class(void *instance) +{ + return static_cast<GtkSourceLanguageClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance))); +} + +void* +Gtk::SourceLanguageClass::create() +{ + return g_object_new(get_type(), 0); +} + +void +Gtk::SourceLanguageClass::tag_style_changed_proxy(GtkSourceLanguage *language, const gchar *name) +{ + void *ptr = g_object_get_qdata((GObject*)language, G::ObjectSignals::quark()); + if (ptr) + { + String tmp_name(name); + static_cast<SourceLanguageSignals*>(ptr)->on_tag_style_changed(name); + } + else + { + GtkSourceLanguageClass *g_class = get_parent_class(language); + if (g_class->tag_style_changed) + g_class->tag_style_changed(language, name); + } +} + +/* Gtk::SourceLanguage signals + */ + +const Gtk::SourceLanguage::TagStyleChangedSignalType Gtk::SourceLanguage::tag_style_changed_signal("tag_style_changed", (GCallback)&G::Marshal::void_callback ); + +/* Gtk::SourceLanguagesManager + */ + +Gtk::SourceLanguagesManager::SourceLanguagesManager(GtkSourceLanguagesManager *lm, bool reference) +: G::Object((GObject*)lm, reference) +{ +} + +Gtk::SourceLanguagesManager::SourceLanguagesManager() +: G::Object((GObject*)SourceLanguagesManagerClass::create()) +{ +} + +Gtk::SourceLanguagesManager::~SourceLanguagesManager() +{ +} + +Gtk::SourceLanguagesManager::operator GtkSourceLanguagesManager* () const +{ + return this ? gtk_source_languages_manager() : 0; +} + +bool +Gtk::SourceLanguagesManager::is_gtk_source_languages_manager() const +{ + return is_a(GTK_TYPE_SOURCE_LANGUAGES_MANAGER); +} + +bool +Gtk::SourceLanguagesManager::get_available_languages(std::vector<SourceLanguage*>& languages) const +{ + g_return_val_if_fail(languages.empty(), false); + const GSList *list = gtk_source_languages_manager_get_available_languages(gtk_source_languages_manager()); + + while (list != 0) + { + languages.push_back(G::Object::wrap<SourceLanguage>((GtkSourceLanguage*)list->data)); + list = g_slist_next(list); + } + + return !languages.empty(); +} + +Gtk::SourceLanguage* +Gtk::SourceLanguagesManager::get_language_from_mime_type(const String& mime_type) const +{ + GtkSourceLanguage *language = gtk_source_languages_manager_get_language_from_mime_type(gtk_source_languages_manager(), mime_type.c_str()); + return G::Object::wrap<SourceLanguage>(language); +} + +Gtk::SourceLanguage* +Gtk::SourceLanguagesManager::get_language_from_name(const String& language) const +{ + std::vector<Gtk::SourceLanguage*> languages; + get_available_languages(languages); + int count = languages.size(); + for (int i = 0; i < count; i++) + { + String name = languages[i]->get_name(); + if (name.compare(language) == 0) + return languages[i]; + } + return 0; +} + +bool +Gtk::SourceLanguagesManager::get_lang_files_dirs(std::vector<String>& dirs) const +{ + g_return_val_if_fail(dirs.empty(), false); + const GSList *list = gtk_source_languages_manager_get_lang_files_dirs(gtk_source_languages_manager()); + + while (list != 0) + { + dirs.push_back((char*)list->data); + list = g_slist_next(list); + } + + return !dirs.empty(); +} + +/* Gtk::SourceLanguagesManagerClass + */ + +void +Gtk::SourceLanguagesManagerClass::init(GtkSourceLanguagesManagerClass *g_class) +{ + G::ObjectClass::init((GObjectClass*)g_class); +} + +GType +Gtk::SourceLanguagesManagerClass::get_type() +{ + static GType type = 0; + if (!type) + { + type = G::TypeInstance::register_type(GTK_TYPE_SOURCE_LANGUAGES_MANAGER, (GClassInitFunc)init); + } + return type; +} + +void* +Gtk::SourceLanguagesManagerClass::create() +{ + return g_object_new(get_type(), 0); +} + +/* Gtk::SourceLanguagesManager properties + */ + +const Gtk::SourceLanguagesManager::LangSpecsDirsPropertyType Gtk::SourceLanguagesManager::lang_specs_dirs_property("lang_files_dirs"); + Index: libXFCsourceview/xfc/sourceview/sourcebuffer.hh =================================================================== --- libXFCsourceview/xfc/sourceview/sourcebuffer.hh (revision 0) +++ libXFCsourceview/xfc/sourceview/sourcebuffer.hh (revision 0) @@ -0,0 +1,501 @@ +/* XFC: Xfce Foundation Classes (User Interface Library) + * Copyright (C) 2004-2005 The XFC Development Team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//! @file inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceBuffer C++ wrapper interface. +//! +//! Provides SourceBuffer, a Gtk::TextBuffer object that implements syntax highlighting, +//! bracket matching, markers and support for undo/redo operations. + +#ifndef XFC_GTK_SOURCE_BUFFER_H +#define XFC_GTK_SOURCE_BUFFER_H + +#ifndef XFC_GTK_TEXT_BUFFER_HH +#include <xfc/gtk/textbuffer.hh> +#endif + +#ifndef XFC_GTK_SOURCE_LANGUAGE_HH +#include <xfc/sourceview/sourcelanguage.hh> +#endif + +#ifndef XFC_GTK_SOURCE_TAG_HH +#include <xfc/sourceview/sourcetag.hh> +#endif + +#ifndef __GTK_SOURCE_BUFFER_H__ +#include <gtksourceview/gtksourcebuffer.h> +#endif + +namespace Xfc { + +namespace Gtk { + +class SourceBuffer; +class SourceLanguage; +class SourceMarker; + +//! @class SourceMarker sourcebuffer.h inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceMarker C++ wrapper class. +//! +//! SourceMarker is like a bookmark in a source buffer; it preserves a position +//! in the text across source buffer modifications (see Gtk::TextMark). Typical +//! uses for markers are bookmarks, breakpoints, current executing instruction +//! indication in a source file, etc.. + +class SourceMarker : public TextMark +{ + friend class G::Object; + + SourceMarker(const SourceMarker&); + SourceMarker& operator=(const SourceMarker&); + +protected: +//! @name Constructors +//! @{ + + explicit SourceMarker(GtkSourceMarker *marker, bool reference = false); + //!< Construct a new SourceMarker from an existing GtkSourceMarker. + //!< @param marker A pointer to a GtkSourceMarker. + //!< @param reference Set false if the initial reference count is floating, set true if it's not. + //!< + //!< <BR>The <EM>marker</EM> can be a newly created GtkSourceMarker or an existing + //!< GtkSourceMarker (see G::Object::Object). + +//! @} + +public: +//! @name Constructors +//! @{ + + virtual ~SourceMarker(); + //!< Destructor. + +//! @} +//! @name Accessors +//! @{ + + GtkSourceMarker* gtk_source_marker() const { return reinterpret_cast<GtkSourceMarker*>( instance_ ); } + //!< Get a pointer to the GtkSourceMarker structure. + + operator GtkSourceMarker* () const; + //!< Conversion operator; safely converts a SourceMarker to a GtkSourceMarker pointer. + + bool is_gtk_source_marker() const; + //!< Returns true if the object instance is of type GTK_TYPE_SOURCE_MARKER. + + String get_marker_type() const; + //!< Returns a String identifying marker type. + + int get_line() const; + //!< Returns the line number containing the marker. + + String get_name() const; + //!< Returns the name of the marker. + + SourceBuffer* get_buffer() const; + //!< Returns the SourceBuffer this marker is associated with. + + SourceMarker* next() const; + //!< Move to the next marker in the source buffer. + //!< @return The next marker. + + SourceMarker* prev() const; + //!< Move to the previous marker in the source buffer. + //!< @return The previous marker. + +//! @} +//! @name Methods +//! @{ + + void set_marker_type(const String& type); + //!< Set the marker type. + //!< @param type The marker type. + +//! @} +}; + +//! @class SourceBuffer sourcebuffer.h inti/gtk-sourceview/sourcebuffer.h +//! @brief A GtkSourceBuffer C++ wrapper class. +//! +//! The SourceBuffer object is the text model for SourceView widgets. It extends +//! the Gtk::TextBuffer object by adding features necessary to display and edit +//! source code: syntax highlighting, bracket matching and markers. It also +//! implements support for undo/redo operations. By default syntax highlighting +//! is enabled, but you can disable it with set_highlight(). This can be useful +//! if you're not using SourceLanguage objects to set the highlighting patterns +//! but instead you're manually adding SourceTag objects to the buffer's tag table. + +class SourceBuffer : public TextBuffer +{ + friend class G::Object; + + SourceBuffer(const SourceBuffer&); + SourceBuffer& operator=(const SourceBuffer&); + +protected: +//! @name Constructors +//! @{ + + explicit SourceBuffer(GtkSourceBuffer *buffer, bool owns_reference = true); + //!< Construct a new SourceBuffer from an existing GtkSourceBuffer. + //!< @param buffer A pointer to a GtkSourceBuffer. + //!< @param reference Set <EM>false</EM> if the initial reference count is floating, + //!< set <EM>true</EM> if it's not. + //!< + //!< <BR>The <EM>buffer</EM> can be a newly created GtkSourceBuffer or an existing + //!< GtkSourceBuffer (see G::Object::Object). + +//! @} +// Properties + + typedef G::Property<G::Unichar> EscapeCharPropertyType; + typedef G::PropertyProxy<G::Object, EscapeCharPropertyType> EscapeCharPropertyProxy; + static const EscapeCharPropertyType escape_char_property; + + typedef G::Property<bool> CheckBracketsPropertyType; + typedef G::PropertyProxy<G::Object, CheckBracketsPropertyType> CheckBracketsPropertyProxy; + static const CheckBracketsPropertyType check_brackets_property; + + typedef G::Property<bool> HighlightPropertyType; + typedef G::PropertyProxy<G::Object, HighlightPropertyType> HighlightPropertyProxy; + static const HighlightPropertyType highlight_property; + + typedef G::Property<int> MaxUndoLevelsPropertyType; + typedef G::PropertyProxy<G::Object, MaxUndoLevelsPropertyType> MaxUndoLevelsPropertyProxy; + static const MaxUndoLevelsPropertyType max_undo_levels_property; + + typedef G::Property<SourceLanguage*, G::Object*> LanguagePropertyType; + typedef G::PropertyProxy<G::Object, LanguagePropertyType> LanguagePropertyProxy; + static const LanguagePropertyType language_property; + +// Signals + + typedef G::Signal1<void, bool> CanUndoSignalType; + typedef G::SignalProxy<TypeInstance, CanUndoSignalType> CanUndoSignalProxy; + static const CanUndoSignalType can_undo_signal; + + typedef G::Signal1<void, bool> CanRedoSignalType; + typedef G::SignalProxy<TypeInstance, CanRedoSignalType> CanRedoSignalProxy; + static const CanRedoSignalType can_redo_signal; + + typedef G::Signal2<void, GtkTextIter*, GtkTextIter*> HighlightUpdatedSignalType; + typedef G::SignalProxy<TypeInstance, HighlightUpdatedSignalType> HighlightUpdatedSignalProxy; + static const HighlightUpdatedSignalType highlight_updated_signal; + + typedef G::Signal1<void, GtkTextIter*> MarkerUpdatedSignalType; + typedef G::SignalProxy<TypeInstance, MarkerUpdatedSignalType> MarkerUpdatedSignalProxy; + static const MarkerUpdatedSignalType marker_updated_signal; + +public: +//! @name Constructors +//! @{ + + SourceBuffer(SourceTagTable *table = 0); + //!< Constructs a new source buffer with a empty default buffer. + //!< @param table A source tag table, or null to have the text buffer create one for you. + + SourceBuffer(const SourceLanguage& language); + //!< Constructs a new source buffer which will highlight text according to the specified language. + //!< @param language The source language. + + virtual ~SourceBuffer(); + //!< Destructor. + +//! @} +//! @name Accessors +//! @{ + + GtkSourceBuffer* gtk_source_buffer() const { return reinterpret_cast<GtkSourceBuffer*>(instance_); } + //!< Get a pointer to the GtkSourceBuffer structure. + + operator GtkSourceBuffer* () const; + //!< Conversion operator; safely converts a SourceBuffer to a GtkSourceBuffer pointer. + + bool is_gtk_source_buffer() const; + //!< Returns true if the object instance is of type GTK_TYPE_SOURCE_BUFFER. + + SourceTagTable* get_source_tag_table() const; + //!< Get the SourceTagTable associated with the buffer. + //!< @return The buffer's tag table. + + bool get_check_brackets() const; + //!< Determines whether bracket match highlighting is activated for the source buffer. + //!< @return <EM>true</EM> if the source buffer will highlight matching brackets. + + bool get_highlight() const; + //!< Determines whether text highlighting is activated in the source buffer. + //!< @return <EM>true</EM> if highlighting is enabled. + + int get_max_undo_levels() const; + //!< Determines the number of undo levels the buffer will track for buffer edits. + //!< @return The maximum number of possible undo levels. + + SourceLanguage* get_language() const; + //!< Determines the SourceLanguage used by the buffer. + //!< @return The SourceLangauge (should not be unreferenced by the user). + + G::Unichar get_escape_char() const; + //!< Determines the escape character used by the source buffer highlighting engine. + //!< @return A G::Unichar that holds the UTF-8 escape character the buffer is using. + + bool can_undo() const; + //!< Determines whether a source buffer can undo the last action. + //!< @return <EM>true</EM> if it's possible to undo the last action. + + bool can_redo() const; + //!< Determines whether a source buffer can redo the last undo action. + //!< @return <EM>true</EM> if buffer changes that were undone can be redone. + + SourceMarker* get_marker(const String& name) const; + //!< Looks up the SourceMarker named <EM>name</EM> in the buffer, returning + //!< null if it doesn't exists. + //!< @param name The name of the marker to retrieve. + //!< @return The SourceMarker identified by <EM>name</EM>, or null. + + std::vector<SourceMarker*> get_markers(const TextIter& start, const TextIter& end) const; + //!< Gets a list of the source markers inside the range delimited by <EM>start</EM> and <EM>end</EM>. + //!< @param start The beginning of the range. + //!< @param end The end of the range. + //!< @return A vector of SourceMarker pointers inside the range. + + SourceMarker* get_first_marker() const; + //!< Gets the first marker (nearest to the top) in the buffer. + //!< @return A pointer to the first SourceMarker, or null if there are no markers in the buffer. + + SourceMarker* get_last_marker() const; + //!< Gets the last marker (nearest to the end) in the buffer. + //!< @return A pointer to the last SourceMarker, or null if there are no markers in the buffer. + + TextIter get_iter_at_marker(const SourceMarker& marker) const; + //!< Obtains an initialized iterator to the location of <EM>marker</EM>. + //!< @return The initialized iterator. + + SourceMarker* get_next_marker(TextIter& iter) const; + //!< Gets the nearest marker to the right of iter. + //!< @param iter The location to start searching from. + //!< @return The SourceMarker nearest to the right of iter, or null if there are no more markers after iter. + //!< + //!< <BR>If there are multiple markers at the same position, this function will always return + //!< the first one (from the internal linked list), even if starting the search exactly at + //!< its location. You can get the others using Gtk::SourceMarker::next(). + + SourceMarker* get_prev_marker(TextIter& iter) const; + //!< Gets the nearest marker to the left of iter. + //!< @param iter The location to start searching from. + //!< @return The SourceMarker nearest to the left of iter, or null if there are no more markers before iter. + //!< + //!< <BR>If there are multiple markers at the same position, this function will always return + //!< the last one (from the internal linked list), even if starting the search exactly at + //!< its location. You can get the others using Gtk::SourceMarker::prev(). + +//! @} +//! @name Methods +//! @{ + + void set_check_brackets(bool check_brackets); + //!< Controls the bracket match highlighting function in the buffer. + //!< @param check_brackets Set <EM>true</EM> if you want matching brackets highlighted. + //!< + //!< <BR>If activated, when you position your cursor over a bracket character + //!< (a parenthesis, a square bracket, etc.) the matching opening or closing + //!< bracket character will be highlighted. You can specify the style with the + //!< set_bracket_match_style() method. + + void set_bracket_match_style(const SourceTagStyle& style); + //!< Sets the style used for highlighting matching brackets. + //!< @param style The SourceTagStyle that specifies the color and text attributes to use. + + void set_highlight(bool highlight); + //!< Controls whether text is highlighted in the buffer. + //!< @param highlight Set <EM>true</EM> if you want to activate highlighting. + //!< + //!< <BR>If <EM>highlight</EM> is <EM>true</EM> the text will be highlighted according + //!< to the patterns installed in the buffer (either set with set_language() or by + //!< adding individual SourceTags to the buffer's tag table). Otherwise, any current + //!< highlighted text will be restored to the default buffer style. + //!< + //!< Tags not of the SourceTag type will not be removed by this option, and normal + //!< Gtk::TextTag priority settings apply when highlighting is enabled. + //!< + //!< If you're not using a SourceLanguage to set the highlighting patterns + //!< in the buffer, it is recommended for performance reasons that you add + //!< all the SourceTags with highlighting disabled and enable highlighting + //!< when finished. + + void set_max_undo_levels(int max_undo_levels); + //!< Sets the number of undo levels for user actions the buffer will track. + //!< @param max_undo_levels The desired maximum number of undo levels. + //!< + //!< <BR>If the number of user actions exceeds the limit set by this function, + //!< older actions will be discarded. A new action is started whenever the + //!< function Gtk::TextBuffer::begin_user_action() is called. In general, + //!< this happens whenever the user presses any key which modifies the buffer, + //!< but the undo manager will try to merge similar consecutive actions, such + //!< as multiple character insertions into one action. But, inserting a newline + //!< does start a new action. + + void set_language(const SourceLanguage *language); + //!< Sets the SourceLanguage the source buffer will use, adding SourceTags with the + //!< language's patterns and setting the escape character with set_escape_char(). + //!< @param language The SourceLanguage to set, or null. + //!< + //!< <BR>Note that this will remove any SourceTags currently in the buffer's tag table. + //!< The buffer holds a reference to the language set. + + void set_escape_char(G::Unichar escape_char); + //!< Sets the escape character to be used by the highlighting engine. + //!< @param escape_char A G::Unichar holding the escape character the buffer should use. + //!< + //!< <BR>When performing the initial analysis, the engine will discard a matching + //!< syntax pattern if it's prefixed with an odd number of escape characters. This + //!< allows for example to correctly highlight strings with escaped quotes embedded. + //!< This setting affects only syntax patterns (i.e. those defined in SyntaxTags). + + void undo(); + //!< Undoes the last user action which modified the buffer. Use can_undo() to check + //!< whether a call to this method will have any effect. Actions are defined as groups + //!< of operations between a call to Gtk::TextBuffer's begin_user_action() and + //!< end_user_action() methods, or sequences of similar edits (inserts or deletes) on + //!< the same line. + + void redo(); + //!< Redoes the last undo operation. Use can_redo() to check whether a call to this + //!< method will have any effect. + + void begin_not_undoable_action(); + //!< Marks the beginning of a not undoable action on the buffer, disabling the undo manager. + //!< Typically you would call this method before initially setting the contents of the buffer + //!< (e.g. when loading a file in a text editor). You may nest begin_not_undoable_action() + //!< / end_not_undoable_action() blocks. + + void end_not_undoable_action(); + //!< Marks the end of a not undoable action on the buffer. When the last not undoable block + //!< is closed through the call to this method, the list of undo actions is cleared and the + //!< undo manager is re-enabled. + + SourceMarker* create_marker(const String& name, const String& type, const TextIter& where); + //!< Creates a marker in the buffer of type <EM>type</EM>. + //!< @param name The name of the marker, or null for an anonymous marker. + //!< @param type A String defining the marker type, or null. + //!< @param where The location to place the new marker. + //!< @return The new SourceMarker object, owned by the buffer. + //!< + //!< <BR>A marker is semantically very similar to a Gtk::TextMark, except it has a type + //!< which is used by the SourceView displaying the buffer to show a pixmap on the left + //!< margin, at the line the marker is in. Because of this, a marker is generally + //!< associated to a line and not a character position. Markers are also accessible + //!< through a position or range in the buffer. + //!< + //!< Markers are implemented using Gtk::TextMark, so all characteristics and restrictions + //!< to marks apply to markers too. These includes life cycle issues and "mark-set" and + //!< "mark-deleted" signal emissions. Like a Gtk::TextMark, a SourceMarker can be anonymous + //!< if the passed name is null. Also, the buffer owns the markers so you shouldn't + //!< unreference it. + //!< + //!< Markers always have left gravity and are moved to the beginning of the line when the + //!< user deletes the line they were in. Also, if the user deletes a region of text which + //!< contained lines with markers, those are deleted. Typical uses for a marker are bookmarks, + //!< breakpoints, current executing instruction indication in a source file, etc.. + + void move_marker(SourceMarker& marker, const TextIter& where); + //!< Moves <EM>marker</EM> to the new location <EM>where</EM>. + //!< @param marker A SourceMarker. + //!< @param where The new location for <EM>marker</EM> in the buffer. + + void delete_marker(SourceMarker& marker); + //!< Deletes <EM>marker</EM> from the source buffer. + //!< @param marker A SourceMarker in the buffer. + //!< + //!< <BR>The same conditions as for Gtk::TextMark apply here. The marker is no longer + //!< accessible from the buffer, but if you held a reference to it, it will not be + //!< destroyed. + +//! @} +//! @name Property Proxies +//! @{ + + const EscapeCharPropertyProxy property_escape_char() + { + return EscapeCharPropertyProxy(this, &escape_char_property); + } + //!< The escape character for syntax delimiters (G::Unichar : Read / Write). + + const CheckBracketsPropertyProxy property_check_brackets() + { + return CheckBracketsPropertyProxy(this, &check_brackets_property); + } + //!< Whether to check and highlight matching brackets (bool : Read / Write). + + const HighlightPropertyProxy property_highlight() + { + return HighlightPropertyProxy(this, &highlight_property); + } + //!< Whether to syntax highlight the buffer (bool : Read / Write). + + const MaxUndoLevelsPropertyProxy property_max_undo_levels() + { + return MaxUndoLevelsPropertyProxy(this, &max_undo_levels_property); + } + //!< Sets the number of undo levels for the buffer (int : Read / Write). + + const LanguagePropertyProxy property_language() + { + return LanguagePropertyProxy(this, &language_property); + } |
|
|
Re: New XFC versionAuke Kok wrote:
> okay, I just overlayed the current svn with your tarball and did a svn > diff after svn adding (but nothing committed) stuff to my local copy. Good thinking ... > Attached is the full diff with regard to the current SVN trunk. Please > test this and Bo: let me know if it's correct and gives you the proper > output. This looks just like the diff I just posted :-) > most of the code I looked at looks just fine. Let me know if everyone is > OK with Bo comitting this to the Xfc trunk himself. Sounds nice ... /BL _______________________________________________ Xfc-dev mailing list Xfc-dev@... http://foo-projects.org/mailman/listinfo/xfc-dev |
|
|
Re: New XFC versionOn 12/12/06, Auke Kok <sofar@...> wrote:
> Auke Kok wrote: > > Bo Lorentsen wrote: > >> Hi ... > >> > >> This is a tar ball containing the new code I have made in XFC > >> (libXFCsourceview) to make it contain the GtkSourceView api. I hope that > >> all you have to do is configure and make. The changes are a little too > >> big for a patch, so here is a link to the a dist tar ball. > >> > >> Url : http://lue.dk/~bl/xfc-4.3.2.tar.bz2 > >> > >> This is also my application to become maintainer :-) > >> > >> /BL > >> > >> Ps.: Please note that this link will only be valid for a short period. > > > > some minor nitpicks, that I don't understand: > > > > how did the tarball end up being 700.000 bytes larger than 4.3.1? I see many updates to > > html content, are those supposed to be updated? Also there seems to be a lot of added > > whitespace (empty lines, trailing whitespace) that doesn't look good. > > > > This obscures me to see what really changed in the new release :) > > > > Can you post a diff to the -svn trunk? this would help us a lot more, since you won't > > have to post any of the dist-generated files. > > > > okay, I just overlayed the current svn with your tarball and did a svn diff after svn > adding (but nothing committed) stuff to my local copy. > > Attached is the full diff with regard to the current SVN trunk. Please test this and Bo: > let me know if it's correct and gives you the proper output. > > > most of the code I looked at looks just fine. Let me know if everyone is OK with Bo > comitting this to the Xfc trunk himself. > I'm not really a C++ hacker, but a cursory overview looks fine to me. I'm OK with Bo committing this, especially since he seems willing to wrap the Xfce libraries. > Cheers, > > Auke > > > > _______________________________________________ > Xfc-dev mailing list > Xfc-dev@... > http://foo-projects.org/mailman/listinfo/xfc-dev > > > > -- Erik <@kazin> why does php have 'echo' and 'print'? Do they do different things? <Bluefoxicy> kazin: echo prints in a big empty room _______________________________________________ Xfc-dev mailing list Xfc-dev@... http://foo-projects.org/mailman/listinfo/xfc-dev |
| Free embeddable forum powered by Nabble | Forum Help |