[gtksourceview] Special case the bracket matching tag when printing
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtksourceview] Special case the bracket matching tag when printing
- Date: Mon, 28 Dec 2009 16:22:28 +0000 (UTC)
commit 1766e2ec0b1fc5dc7b6230a9f0407fce07f850f3
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 cd273e8..835beca 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -597,6 +597,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 cdcc2f4..d6e305b 100644
--- a/gtksourceview/gtksourceprintcompositor.c
+++ b/gtksourceview/gtksourceprintcompositor.c
@@ -2261,11 +2261,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]