diff options
-rwxr-xr-x | includes/loadgraph.h | 31 | ||||
-rwxr-xr-x | shell/loadgraph.c | 37 | ||||
-rwxr-xr-x | shell/shell.c | 4 |
3 files changed, 41 insertions, 31 deletions
diff --git a/includes/loadgraph.h b/includes/loadgraph.h index 6ea29113..8fead2fc 100755 --- a/includes/loadgraph.h +++ b/includes/loadgraph.h @@ -33,43 +33,18 @@ typedef enum { LG_COLOR_RED = 0xB04F4F } LoadGraphColor; -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; -}; - LoadGraph *load_graph_new(gint size); void load_graph_destroy(LoadGraph *lg); void load_graph_configure_expose(LoadGraph *lg); GtkWidget *load_graph_get_framed(LoadGraph *lg); -void load_graph_update(LoadGraph *lg, gint value); +void load_graph_update(LoadGraph *lg, gdouble value); void load_graph_set_color(LoadGraph *lg, LoadGraphColor color); void load_graph_clear(LoadGraph *lg); void load_graph_set_data_suffix(LoadGraph *lg, gchar *suffix); gchar *load_graph_get_data_suffix(LoadGraph *lg); +gint load_graph_get_height(LoadGraph *lg); + #endif /* __LOADGRAPH_H__ */ 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) { diff --git a/shell/shell.c b/shell/shell.c index 9c7d19a7..69312db0 100755 --- a/shell/shell.c +++ b/shell/shell.c @@ -1030,12 +1030,12 @@ static void set_view_type(ShellViewType viewtype, gboolean reload) alloc = g_new(GtkAllocation, 1); gtk_widget_get_allocation(shell->hpaned, alloc); gtk_paned_set_position(GTK_PANED(shell->vpaned), - alloc->height - shell->loadgraph->height - 16); + alloc->height - load_graph_get_height(shell->loadgraph) - 16); g_free(alloc); #else gtk_paned_set_position(GTK_PANED(shell->vpaned), shell->hpaned->allocation.height - - shell->loadgraph->height - 16); + load_graph_get_height(shell->loadgraph) - 16); #endif break; |