From c5fb8b5fc94fc9bc9b6034333f26c212868e4208 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 6 Oct 2016 21:02:00 -0700 Subject: [PATCH] visualizer-row: add private access to graph_width Having this makes a few things easier now that we are relying on pixel cache for scrolling. --- lib/Makefile.am | 1 + lib/sp-visualizer-row-private.h | 30 ++++++++++++++++++++++++++++++ lib/sp-visualizer-row.c | 9 +++++---- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 lib/sp-visualizer-row-private.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 23b64a4d..af2081e4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -180,6 +180,7 @@ libsysprof_ui_@API_VERSION@_la_SOURCES = \ sp-visualizer-row.c \ sp-visualizer-ticks.c \ sp-visualizer-ticks.h \ + sp-visualizer-ticks-private.h \ sp-visualizer-view.c \ sp-zoom-manager.c \ $(NULL) diff --git a/lib/sp-visualizer-row-private.h b/lib/sp-visualizer-row-private.h new file mode 100644 index 00000000..a2bed7bb --- /dev/null +++ b/lib/sp-visualizer-row-private.h @@ -0,0 +1,30 @@ +/* sp-visualizer-row-private.h + * + * Copyright (C) 2016 Christian Hergert + * + * 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 3 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SP_VISUALIZER_ROW_PRIVATE_H +#define SP_VISUALIZER_ROW_PRIVATE_H + +#include "sp-visualizer-row.h" + +G_BEGIN_DECLS + +gint _sp_visualizer_row_get_graph_width (SpVisualizerRow *self); + +G_END_DECLS + +#endif /* SP_VISUALIZER_ROW_PRIVATE_H */ diff --git a/lib/sp-visualizer-row.c b/lib/sp-visualizer-row.c index 35f59f12..0bf420b9 100644 --- a/lib/sp-visualizer-row.c +++ b/lib/sp-visualizer-row.c @@ -19,6 +19,7 @@ #define G_LOG_DOMAIN "sp-visualizer-row" #include "sp-visualizer-row.h" +#include "sp-visualizer-row-private.h" #define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000) #define DEFAULT_PIXELS_PER_SECOND 20 @@ -39,8 +40,8 @@ static GParamSpec *properties [N_PROPS]; G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SpVisualizerRow, sp_visualizer_row, GTK_TYPE_LIST_BOX_ROW) -static gint -sp_visualizer_row_get_graph_width (SpVisualizerRow *self) +gint +_sp_visualizer_row_get_graph_width (SpVisualizerRow *self) { SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self); gdouble zoom_level = 1.0; @@ -78,7 +79,7 @@ sp_visualizer_row_get_preferred_width (GtkWidget *widget, GTK_WIDGET_CLASS (sp_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width, &real_nat_width); - graph_width = sp_visualizer_row_get_graph_width (self); + graph_width = _sp_visualizer_row_get_graph_width (self); *min_width = *nat_width = real_min_width + graph_width; } @@ -292,7 +293,7 @@ sp_visualizer_row_translate_points (SpVisualizerRow *self, gtk_widget_get_allocation (GTK_WIDGET (self), &alloc); adjust_alloc_for_borders (self, &alloc); - graph_width = sp_visualizer_row_get_graph_width (self); + graph_width = _sp_visualizer_row_get_graph_width (self); for (guint i = 0; i < n_in_points; i++) {