[gnome-builder/wip/chergert/gutter] apply properties to layout
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/gutter] apply properties to layout
- Date: Mon, 18 Sep 2017 06:53:59 +0000 (UTC)
commit a846250f757ffb3126a5c9c4453960ace31dbd4f
Author: Christian Hergert <chergert redhat com>
Date: Sun Sep 17 23:53:50 2017 -0700
apply properties to layout
libide/sourceview/ide-omni-gutter-renderer.c | 60 ++++++++++++++------------
1 files changed, 33 insertions(+), 27 deletions(-)
---
diff --git a/libide/sourceview/ide-omni-gutter-renderer.c b/libide/sourceview/ide-omni-gutter-renderer.c
index b2a61d2..416773d 100644
--- a/libide/sourceview/ide-omni-gutter-renderer.c
+++ b/libide/sourceview/ide-omni-gutter-renderer.c
@@ -504,9 +504,13 @@ ide_omni_gutter_renderer_begin (GtkSourceGutterRenderer *renderer,
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (view), "");
pango_layout_set_alignment (self->layout, PANGO_ALIGN_RIGHT);
- pango_layout_set_width (self->layout, (cell_area->width - ARROW_WIDTH - 4) * PANGO_SCALE);
pango_layout_set_font_description (self->layout,
ide_source_view_get_font_desc (view));
+
+ if (self->breakpoints != NULL)
+ pango_layout_set_width (self->layout, (cell_area->width - ARROW_WIDTH - 4) * PANGO_SCALE);
+ else
+ pango_layout_set_width (self->layout, (cell_area->width - CHANGE_WIDTH - 2) * PANGO_SCALE);
}
static gboolean
@@ -814,7 +818,7 @@ ide_omni_gutter_renderer_draw (GtkSourceGutterRenderer *renderer,
cairo_fill (cr);
}
- if (info->is_add || info->is_change)
+ if (self->show_line_changes && (info->is_add || info->is_change))
draw_add_change (self, cr, cell_area, info, state);
if (self->breakpoints != NULL)
@@ -824,36 +828,38 @@ ide_omni_gutter_renderer_draw (GtkSourceGutterRenderer *renderer,
draw_breakpoint_bg (self, cr, cell_area, info, state);
}
- if (IS_DIAGNOSTIC (info))
+ if (self->show_line_diagnostics && IS_DIAGNOSTIC (info))
draw_diagnostic (self, cr, cell_area, info, state);
- len = g_snprintf (linestr, sizeof linestr, "%u", line + 1);
- pango_layout_set_text (self->layout, linestr, len);
-
- cairo_move_to (cr, cell_area->x, cell_area->y);
-
- if (has_breakpoint || active)
- {
- gdk_cairo_set_source_rgba (cr, &self->bkpt.fg);
- bold = self->bkpt.bold;
- }
- else if (state & GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR)
+ if (self->show_line_numbers)
{
- gdk_cairo_set_source_rgba (cr, &self->current.fg);
- bold = self->current.bold;
- }
- else
- {
- gdk_cairo_set_source_rgba (cr, &self->text.fg);
- bold = self->text.bold;
- }
+ len = g_snprintf (linestr, sizeof linestr, "%u", line + 1);
+ pango_layout_set_text (self->layout, linestr, len);
- if (state & GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR)
- bold |= self->current.bold;
+ cairo_move_to (cr, cell_area->x, cell_area->y);
- pango_layout_set_attributes (self->layout, bold ? self->bold_attrs : NULL);
+ if (has_breakpoint || active)
+ {
+ gdk_cairo_set_source_rgba (cr, &self->bkpt.fg);
+ bold = self->bkpt.bold;
+ }
+ else if (state & GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR)
+ {
+ gdk_cairo_set_source_rgba (cr, &self->current.fg);
+ bold = self->current.bold;
+ }
+ else
+ {
+ gdk_cairo_set_source_rgba (cr, &self->text.fg);
+ bold = self->text.bold;
+ }
+
+ if (state & GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR)
+ bold |= self->current.bold;
- pango_cairo_show_layout (cr, self->layout);
+ pango_layout_set_attributes (self->layout, bold ? self->bold_attrs : NULL);
+ pango_cairo_show_layout (cr, self->layout);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]