304 lines
11 KiB
C
304 lines
11 KiB
C
|
/* threshold_line.c generated by valac 0.56.0, the Vala compiler
|
||
|
* generated from threshold_line.vala, do not modify */
|
||
|
|
||
|
#include "livechart_static.h"
|
||
|
#include <glib.h>
|
||
|
#include <float.h>
|
||
|
#include <math.h>
|
||
|
#include <cairo-gobject.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
enum {
|
||
|
LIVE_CHART_THRESHOLD_LINE_0_PROPERTY,
|
||
|
LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY,
|
||
|
LIVE_CHART_THRESHOLD_LINE_NUM_PROPERTIES
|
||
|
};
|
||
|
static GParamSpec* live_chart_threshold_line_properties[LIVE_CHART_THRESHOLD_LINE_NUM_PROPERTIES];
|
||
|
|
||
|
struct _LiveChartThresholdLinePrivate {
|
||
|
gdouble _value;
|
||
|
};
|
||
|
|
||
|
static gint LiveChartThresholdLine_private_offset;
|
||
|
static gpointer live_chart_threshold_line_parent_class = NULL;
|
||
|
|
||
|
static void live_chart_threshold_line_real_draw (LiveChartSerieRenderer* base,
|
||
|
cairo_t* ctx,
|
||
|
LiveChartConfig* config);
|
||
|
static void live_chart_threshold_line_finalize (GObject * obj);
|
||
|
static GType live_chart_threshold_line_get_type_once (void);
|
||
|
static void _vala_live_chart_threshold_line_get_property (GObject * object,
|
||
|
guint property_id,
|
||
|
GValue * value,
|
||
|
GParamSpec * pspec);
|
||
|
static void _vala_live_chart_threshold_line_set_property (GObject * object,
|
||
|
guint property_id,
|
||
|
const GValue * value,
|
||
|
GParamSpec * pspec);
|
||
|
static inline gpointer _vala_memdup2 (gconstpointer mem,
|
||
|
gsize byte_size);
|
||
|
|
||
|
static inline gpointer
|
||
|
live_chart_threshold_line_get_instance_private (LiveChartThresholdLine* self)
|
||
|
{
|
||
|
return G_STRUCT_MEMBER_P (self, LiveChartThresholdLine_private_offset);
|
||
|
}
|
||
|
|
||
|
LiveChartThresholdLine*
|
||
|
live_chart_threshold_line_construct (GType object_type,
|
||
|
gdouble value)
|
||
|
{
|
||
|
LiveChartThresholdLine * self = NULL;
|
||
|
#line 10 "../src/threshold_line.vala"
|
||
|
self = (LiveChartThresholdLine*) live_chart_serie_renderer_construct (object_type);
|
||
|
#line 11 "../src/threshold_line.vala"
|
||
|
live_chart_threshold_line_set_value (self, value);
|
||
|
#line 9 "../src/threshold_line.vala"
|
||
|
return self;
|
||
|
#line 59 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
LiveChartThresholdLine*
|
||
|
live_chart_threshold_line_new (gdouble value)
|
||
|
{
|
||
|
#line 9 "../src/threshold_line.vala"
|
||
|
return live_chart_threshold_line_construct (LIVE_CHART_TYPE_THRESHOLD_LINE, value);
|
||
|
#line 67 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_threshold_line_real_draw (LiveChartSerieRenderer* base,
|
||
|
cairo_t* ctx,
|
||
|
LiveChartConfig* config)
|
||
|
{
|
||
|
LiveChartThresholdLine * self;
|
||
|
gboolean _tmp0_;
|
||
|
gboolean _tmp1_;
|
||
|
#line 14 "../src/threshold_line.vala"
|
||
|
self = (LiveChartThresholdLine*) base;
|
||
|
#line 14 "../src/threshold_line.vala"
|
||
|
g_return_if_fail (ctx != NULL);
|
||
|
#line 14 "../src/threshold_line.vala"
|
||
|
g_return_if_fail (config != NULL);
|
||
|
#line 15 "../src/threshold_line.vala"
|
||
|
_tmp0_ = live_chart_drawable_get_visible ((LiveChartDrawable*) self);
|
||
|
#line 15 "../src/threshold_line.vala"
|
||
|
_tmp1_ = _tmp0_;
|
||
|
#line 15 "../src/threshold_line.vala"
|
||
|
if (_tmp1_) {
|
||
|
#line 90 "threshold_line.c"
|
||
|
LiveChartBoundaries boundaries = {0};
|
||
|
LiveChartBoundaries _tmp2_ = {0};
|
||
|
LiveChartPath* _tmp3_;
|
||
|
LiveChartPath* _tmp4_;
|
||
|
gdouble y = 0.0;
|
||
|
LiveChartBoundaries _tmp5_;
|
||
|
LiveChartBoundary _tmp6_;
|
||
|
gdouble _tmp7_;
|
||
|
LiveChartYAxis* _tmp8_;
|
||
|
LiveChartBoundaries _tmp9_;
|
||
|
LiveChartBoundary _tmp10_;
|
||
|
LiveChartBoundaries _tmp11_;
|
||
|
LiveChartBoundary _tmp12_;
|
||
|
#line 16 "../src/threshold_line.vala"
|
||
|
live_chart_config_boundaries (config, &_tmp2_);
|
||
|
#line 16 "../src/threshold_line.vala"
|
||
|
boundaries = _tmp2_;
|
||
|
#line 17 "../src/threshold_line.vala"
|
||
|
_tmp3_ = live_chart_serie_renderer_get_line ((LiveChartSerieRenderer*) self);
|
||
|
#line 17 "../src/threshold_line.vala"
|
||
|
_tmp4_ = _tmp3_;
|
||
|
#line 17 "../src/threshold_line.vala"
|
||
|
live_chart_path_configure (_tmp4_, ctx);
|
||
|
#line 18 "../src/threshold_line.vala"
|
||
|
_tmp5_ = boundaries;
|
||
|
#line 18 "../src/threshold_line.vala"
|
||
|
_tmp6_ = _tmp5_.y;
|
||
|
#line 18 "../src/threshold_line.vala"
|
||
|
_tmp7_ = self->priv->_value;
|
||
|
#line 18 "../src/threshold_line.vala"
|
||
|
_tmp8_ = config->y_axis;
|
||
|
#line 18 "../src/threshold_line.vala"
|
||
|
y = _tmp6_.max - (_tmp7_ * live_chart_yaxis_get_ratio (_tmp8_));
|
||
|
#line 19 "../src/threshold_line.vala"
|
||
|
_tmp9_ = boundaries;
|
||
|
#line 19 "../src/threshold_line.vala"
|
||
|
_tmp10_ = _tmp9_.x;
|
||
|
#line 19 "../src/threshold_line.vala"
|
||
|
cairo_move_to (ctx, (gdouble) _tmp10_.min, y);
|
||
|
#line 20 "../src/threshold_line.vala"
|
||
|
_tmp11_ = boundaries;
|
||
|
#line 20 "../src/threshold_line.vala"
|
||
|
_tmp12_ = _tmp11_.x;
|
||
|
#line 20 "../src/threshold_line.vala"
|
||
|
cairo_line_to (ctx, (gdouble) _tmp12_.max, y);
|
||
|
#line 21 "../src/threshold_line.vala"
|
||
|
cairo_stroke (ctx);
|
||
|
#line 138 "threshold_line.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
gdouble
|
||
|
live_chart_threshold_line_get_value (LiveChartThresholdLine* self)
|
||
|
{
|
||
|
gdouble result;
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
g_return_val_if_fail (self != NULL, 0.0);
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
result = self->priv->_value;
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
return result;
|
||
|
#line 152 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
void
|
||
|
live_chart_threshold_line_set_value (LiveChartThresholdLine* self,
|
||
|
gdouble value)
|
||
|
{
|
||
|
gdouble old_value;
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
g_return_if_fail (self != NULL);
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
old_value = live_chart_threshold_line_get_value (self);
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
if (old_value != value) {
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
self->priv->_value = value;
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
g_object_notify_by_pspec ((GObject *) self, live_chart_threshold_line_properties[LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY]);
|
||
|
#line 170 "threshold_line.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_threshold_line_class_init (LiveChartThresholdLineClass * klass,
|
||
|
gpointer klass_data)
|
||
|
{
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
live_chart_threshold_line_parent_class = g_type_class_peek_parent (klass);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
g_type_class_adjust_private_offset (klass, &LiveChartThresholdLine_private_offset);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
((LiveChartSerieRendererClass *) klass)->draw = (void (*) (LiveChartSerieRenderer*, cairo_t*, LiveChartConfig*)) live_chart_threshold_line_real_draw;
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_threshold_line_get_property;
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_threshold_line_set_property;
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_CLASS (klass)->finalize = live_chart_threshold_line_finalize;
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY, live_chart_threshold_line_properties[LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY] = g_param_spec_double ("value", "value", "value", -G_MAXDOUBLE, G_MAXDOUBLE, (gdouble) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||
|
#line 192 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_threshold_line_instance_init (LiveChartThresholdLine * self,
|
||
|
gpointer klass)
|
||
|
{
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
self->priv = live_chart_threshold_line_get_instance_private (self);
|
||
|
#line 7 "../src/threshold_line.vala"
|
||
|
self->priv->_value = (gdouble) 0;
|
||
|
#line 203 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_threshold_line_finalize (GObject * obj)
|
||
|
{
|
||
|
LiveChartThresholdLine * self;
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_THRESHOLD_LINE, LiveChartThresholdLine);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_CLASS (live_chart_threshold_line_parent_class)->finalize (obj);
|
||
|
#line 214 "threshold_line.c"
|
||
|
}
|
||
|
|
||
|
static GType
|
||
|
live_chart_threshold_line_get_type_once (void)
|
||
|
{
|
||
|
static const GTypeInfo g_define_type_info = { sizeof (LiveChartThresholdLineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_threshold_line_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartThresholdLine), 0, (GInstanceInitFunc) live_chart_threshold_line_instance_init, NULL };
|
||
|
GType live_chart_threshold_line_type_id;
|
||
|
live_chart_threshold_line_type_id = g_type_register_static (LIVE_CHART_TYPE_SERIE_RENDERER, "LiveChartThresholdLine", &g_define_type_info, 0);
|
||
|
LiveChartThresholdLine_private_offset = g_type_add_instance_private (live_chart_threshold_line_type_id, sizeof (LiveChartThresholdLinePrivate));
|
||
|
return live_chart_threshold_line_type_id;
|
||
|
}
|
||
|
|
||
|
GType
|
||
|
live_chart_threshold_line_get_type (void)
|
||
|
{
|
||
|
static volatile gsize live_chart_threshold_line_type_id__once = 0;
|
||
|
if (g_once_init_enter (&live_chart_threshold_line_type_id__once)) {
|
||
|
GType live_chart_threshold_line_type_id;
|
||
|
live_chart_threshold_line_type_id = live_chart_threshold_line_get_type_once ();
|
||
|
g_once_init_leave (&live_chart_threshold_line_type_id__once, live_chart_threshold_line_type_id);
|
||
|
}
|
||
|
return live_chart_threshold_line_type_id__once;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
_vala_live_chart_threshold_line_get_property (GObject * object,
|
||
|
guint property_id,
|
||
|
GValue * value,
|
||
|
GParamSpec * pspec)
|
||
|
{
|
||
|
LiveChartThresholdLine * self;
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_THRESHOLD_LINE, LiveChartThresholdLine);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
switch (property_id) {
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
case LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY:
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
g_value_set_double (value, live_chart_threshold_line_get_value (self));
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
break;
|
||
|
#line 255 "threshold_line.c"
|
||
|
default:
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
break;
|
||
|
#line 261 "threshold_line.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
_vala_live_chart_threshold_line_set_property (GObject * object,
|
||
|
guint property_id,
|
||
|
const GValue * value,
|
||
|
GParamSpec * pspec)
|
||
|
{
|
||
|
LiveChartThresholdLine * self;
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_THRESHOLD_LINE, LiveChartThresholdLine);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
switch (property_id) {
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
case LIVE_CHART_THRESHOLD_LINE_VALUE_PROPERTY:
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
live_chart_threshold_line_set_value (self, g_value_get_double (value));
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
break;
|
||
|
#line 281 "threshold_line.c"
|
||
|
default:
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||
|
#line 5 "../src/threshold_line.vala"
|
||
|
break;
|
||
|
#line 287 "threshold_line.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static inline gpointer
|
||
|
_vala_memdup2 (gconstpointer mem,
|
||
|
gsize byte_size)
|
||
|
{
|
||
|
gpointer new_mem;
|
||
|
if (mem && byte_size != 0) {
|
||
|
new_mem = g_malloc (byte_size);
|
||
|
memcpy (new_mem, mem, byte_size);
|
||
|
} else {
|
||
|
new_mem = NULL;
|
||
|
}
|
||
|
return new_mem;
|
||
|
}
|
||
|
|