[gtksourceview/gnome-2-28] Special case the bracket matching tag when printing
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtksourceview/gnome-2-28] Special case the bracket matching tag when printing
- Date: Sat, 9 Jan 2010 15:38:50 +0000 (UTC)
commit e6568d1ffd3ecbd1cca97ff962c60c4c611311e7
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Dec 28 17:19:43 2009 +0100
Special case the bracket matching tag when printing
Back when we created the compositor, we didn't treat bracket match tags
in a special way, because we wanted a more generic way to mark certain
tags for printing or not. But given that we didn't add that api and that
in all this time bracket match was the only problem reported, go for the
special case solution.
gtksourceview/gtksourcebuffer.c | 11 +++++++++++
gtksourceview/gtksourcebuffer.h | 3 +++
gtksourceview/gtksourceprintcompositor.c | 10 +++++++++-
3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index dfe2923..a727c31 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -578,6 +578,17 @@ get_bracket_match_tag (GtkSourceBuffer *buffer)
return buffer->priv->bracket_match_tag;
}
+/*
+ * This is private, just used by the compositor to not print bracket
+ * matches. Note that unlike get_bracket_match_tag() it returns NULL
+ * if the tag is not set.
+ */
+GtkTextTag *
+_gtk_source_buffer_get_bracket_match_tag (GtkSourceBuffer *buffer)
+{
+ return buffer->priv->bracket_match_tag;
+}
+
static void
gtk_source_buffer_move_cursor (GtkTextBuffer *buffer,
const GtkTextIter *iter,
diff --git a/gtksourceview/gtksourcebuffer.h b/gtksourceview/gtksourcebuffer.h
index de4cdfb..f578fba 100644
--- a/gtksourceview/gtksourcebuffer.h
+++ b/gtksourceview/gtksourcebuffer.h
@@ -146,6 +146,9 @@ GtkSourceMark *_gtk_source_buffer_source_mark_next (GtkSourceBuffer *buf
GtkSourceMark *_gtk_source_buffer_source_mark_prev (GtkSourceBuffer *buffer,
GtkSourceMark *mark,
const gchar *category);
+
+GtkTextTag *_gtk_source_buffer_get_bracket_match_tag (GtkSourceBuffer *buffer);
+
G_END_DECLS
#endif /* __GTK_SOURCE_BUFFER_H__ */
diff --git a/gtksourceview/gtksourceprintcompositor.c b/gtksourceview/gtksourceprintcompositor.c
index 489a812..7d20562 100644
--- a/gtksourceview/gtksourceprintcompositor.c
+++ b/gtksourceview/gtksourceprintcompositor.c
@@ -2242,11 +2242,19 @@ calculate_page_size_and_margins (GtkSourcePrintCompositor *compositor,
});
}
+/* TODO: maybe we should have a public api to set
+ * which tags need to be printed and which should not.
+ * For now we special case bracket matches.
+ */
static gboolean
ignore_tag (GtkSourcePrintCompositor *compositor,
GtkTextTag *tag)
{
- /* TODO: ignore bracket match tags etc */
+ GtkTextTag *bm_tag;
+
+ bm_tag = _gtk_source_buffer_get_bracket_match_tag (compositor->priv->buffer);
+ if ((bm_tag != NULL) && (tag == bm_tag))
+ return TRUE;
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]