summaryrefslogtreecommitdiff
path: root/shell/loadgraph.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-07-26 11:52:43 -0500
committerLeandro Pereira <leandro@hardinfo.org>2017-07-30 10:16:42 -0700
commitd58276aa6fa507525312d9b83b7e82b0b6a479ab (patch)
tree193c47e4f0332dc528a8301e197e6cf87a91e9d0 /shell/loadgraph.c
parent56d1e1137b7e344064ca0950c5aa265764eebc02 (diff)
loadgraph: make loadgraph opaque, sample gdouble
Old load graph still uses ints internally. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'shell/loadgraph.c')
-rwxr-xr-xshell/loadgraph.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/shell/loadgraph.c b/shell/loadgraph.c
index e78524ca..581203f1 100755
--- a/shell/loadgraph.c
+++ b/shell/loadgraph.c
@@ -25,6 +25,33 @@
#include "loadgraph.h"
+struct _LoadGraph {
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_surface_t *buf;
+ cairo_t *grid;
+ cairo_t *trace;
+ cairo_t *fill;
+#else
+ GdkPixmap *buf;
+ GdkGC *grid;
+ GdkGC *trace;
+ GdkGC *fill;
+#endif
+ GtkWidget *area;
+
+ gint *data;
+ gfloat scale;
+
+ gint size;
+ gint width, height;
+ LoadGraphColor color;
+
+ gint max_value, remax_count;
+
+ PangoLayout *layout;
+ gchar *suffix;
+};
+
static void _draw(LoadGraph * lg);
LoadGraph *load_graph_new(gint size)
@@ -325,9 +352,10 @@ static void _draw(LoadGraph * lg)
gtk_widget_queue_draw(lg->area);
}
-void load_graph_update(LoadGraph * lg, gint value)
+void load_graph_update(LoadGraph * lg, gdouble v)
{
gint i;
+ gint value = (gint)v;
if (value < 0)
return;
@@ -365,6 +393,13 @@ void load_graph_update(LoadGraph * lg, gint value)
_draw(lg);
}
+gint load_graph_get_height(LoadGraph *lg) {
+ if (lg != NULL)
+ return lg->height;
+ return 0;
+}
+
+
#ifdef LOADGRAPH_UNIT_TEST
gboolean lg_update(gpointer d)
{