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.
This commit is contained in:
Christian Hergert
2016-10-06 21:02:00 -07:00
parent 51ed367b74
commit c5fb8b5fc9
3 changed files with 36 additions and 4 deletions

View File

@ -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)

View File

@ -0,0 +1,30 @@
/* sp-visualizer-row-private.h
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#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 */

View File

@ -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++)
{