410 lines
13 KiB
C
410 lines
13 KiB
C
|
/* area.c generated by valac 0.56.0, the Vala compiler
|
||
|
* generated from area.vala, do not modify */
|
||
|
|
||
|
#include "livechart.h"
|
||
|
#include <gdk/gdk.h>
|
||
|
#include <glib.h>
|
||
|
#include <float.h>
|
||
|
#include <math.h>
|
||
|
#include <string.h>
|
||
|
#include <glib-object.h>
|
||
|
#include <cairo-gobject.h>
|
||
|
|
||
|
enum {
|
||
|
LIVE_CHART_AREA_0_PROPERTY,
|
||
|
LIVE_CHART_AREA_VISIBLE_PROPERTY,
|
||
|
LIVE_CHART_AREA_NUM_PROPERTIES
|
||
|
};
|
||
|
static GParamSpec* live_chart_area_properties[LIVE_CHART_AREA_NUM_PROPERTIES];
|
||
|
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
|
||
|
|
||
|
struct _LiveChartAreaPrivate {
|
||
|
LiveChartPoints* points;
|
||
|
GdkRGBA color;
|
||
|
LiveChartBoundingBox bounding_box;
|
||
|
gdouble alpha;
|
||
|
gboolean _visible;
|
||
|
};
|
||
|
|
||
|
static gint LiveChartArea_private_offset;
|
||
|
static gpointer live_chart_area_parent_class = NULL;
|
||
|
static LiveChartDrawableIface * live_chart_area_live_chart_drawable_parent_iface = NULL;
|
||
|
|
||
|
static void live_chart_area_real_draw (LiveChartDrawable* base,
|
||
|
cairo_t* ctx,
|
||
|
LiveChartConfig* config);
|
||
|
static void live_chart_area_real_get_bounding_box (LiveChartDrawable* base,
|
||
|
LiveChartBoundingBox* result);
|
||
|
static void live_chart_area_finalize (GObject * obj);
|
||
|
static GType live_chart_area_get_type_once (void);
|
||
|
static void _vala_live_chart_area_get_property (GObject * object,
|
||
|
guint property_id,
|
||
|
GValue * value,
|
||
|
GParamSpec * pspec);
|
||
|
static void _vala_live_chart_area_set_property (GObject * object,
|
||
|
guint property_id,
|
||
|
const GValue * value,
|
||
|
GParamSpec * pspec);
|
||
|
|
||
|
static inline gpointer
|
||
|
live_chart_area_get_instance_private (LiveChartArea* self)
|
||
|
{
|
||
|
return G_STRUCT_MEMBER_P (self, LiveChartArea_private_offset);
|
||
|
}
|
||
|
|
||
|
static gpointer
|
||
|
_g_object_ref0 (gpointer self)
|
||
|
{
|
||
|
#line 17 "../src/area.vala"
|
||
|
return self ? g_object_ref (self) : NULL;
|
||
|
#line 61 "area.c"
|
||
|
}
|
||
|
|
||
|
LiveChartArea*
|
||
|
live_chart_area_construct (GType object_type,
|
||
|
LiveChartPoints* points,
|
||
|
GdkRGBA* color,
|
||
|
gdouble alpha)
|
||
|
{
|
||
|
LiveChartArea * self = NULL;
|
||
|
LiveChartPoints* _tmp0_;
|
||
|
GdkRGBA _tmp1_;
|
||
|
#line 16 "../src/area.vala"
|
||
|
g_return_val_if_fail (points != NULL, NULL);
|
||
|
#line 16 "../src/area.vala"
|
||
|
g_return_val_if_fail (color != NULL, NULL);
|
||
|
#line 16 "../src/area.vala"
|
||
|
self = (LiveChartArea*) g_object_new (object_type, NULL);
|
||
|
#line 17 "../src/area.vala"
|
||
|
_tmp0_ = _g_object_ref0 (points);
|
||
|
#line 17 "../src/area.vala"
|
||
|
_g_object_unref0 (self->priv->points);
|
||
|
#line 17 "../src/area.vala"
|
||
|
self->priv->points = _tmp0_;
|
||
|
#line 18 "../src/area.vala"
|
||
|
_tmp1_ = *color;
|
||
|
#line 18 "../src/area.vala"
|
||
|
self->priv->color = _tmp1_;
|
||
|
#line 19 "../src/area.vala"
|
||
|
self->priv->alpha = alpha;
|
||
|
#line 16 "../src/area.vala"
|
||
|
return self;
|
||
|
#line 93 "area.c"
|
||
|
}
|
||
|
|
||
|
LiveChartArea*
|
||
|
live_chart_area_new (LiveChartPoints* points,
|
||
|
GdkRGBA* color,
|
||
|
gdouble alpha)
|
||
|
{
|
||
|
#line 16 "../src/area.vala"
|
||
|
return live_chart_area_construct (LIVE_CHART_TYPE_AREA, points, color, alpha);
|
||
|
#line 103 "area.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_real_draw (LiveChartDrawable* base,
|
||
|
cairo_t* ctx,
|
||
|
LiveChartConfig* config)
|
||
|
{
|
||
|
LiveChartArea * self;
|
||
|
LiveChartPoints* _tmp0_;
|
||
|
gint _tmp1_;
|
||
|
gint _tmp2_;
|
||
|
#line 22 "../src/area.vala"
|
||
|
self = (LiveChartArea*) base;
|
||
|
#line 22 "../src/area.vala"
|
||
|
g_return_if_fail (ctx != NULL);
|
||
|
#line 22 "../src/area.vala"
|
||
|
g_return_if_fail (config != NULL);
|
||
|
#line 23 "../src/area.vala"
|
||
|
_tmp0_ = self->priv->points;
|
||
|
#line 23 "../src/area.vala"
|
||
|
_tmp1_ = live_chart_points_get_size (_tmp0_);
|
||
|
#line 23 "../src/area.vala"
|
||
|
_tmp2_ = _tmp1_;
|
||
|
#line 23 "../src/area.vala"
|
||
|
if (_tmp2_ > 0) {
|
||
|
#line 129 "area.c"
|
||
|
LiveChartBoundaries boundaries = {0};
|
||
|
LiveChartBoundaries _tmp3_ = {0};
|
||
|
LiveChartPoint first_point = {0};
|
||
|
LiveChartPoints* _tmp4_;
|
||
|
LiveChartPoint _tmp5_ = {0};
|
||
|
LiveChartPoint last_point = {0};
|
||
|
LiveChartPoints* _tmp6_;
|
||
|
LiveChartPoint _tmp7_ = {0};
|
||
|
GdkRGBA _tmp8_;
|
||
|
GdkRGBA _tmp9_;
|
||
|
GdkRGBA _tmp10_;
|
||
|
LiveChartPoint _tmp11_;
|
||
|
LiveChartPoint _tmp12_;
|
||
|
LiveChartPoint _tmp13_;
|
||
|
LiveChartBoundaries _tmp14_;
|
||
|
LiveChartBoundary _tmp15_;
|
||
|
LiveChartPoint _tmp16_;
|
||
|
LiveChartBoundaries _tmp17_;
|
||
|
LiveChartBoundary _tmp18_;
|
||
|
LiveChartPoint _tmp19_;
|
||
|
LiveChartPoint _tmp20_;
|
||
|
#line 24 "../src/area.vala"
|
||
|
live_chart_config_boundaries (config, &_tmp3_);
|
||
|
#line 24 "../src/area.vala"
|
||
|
boundaries = _tmp3_;
|
||
|
#line 25 "../src/area.vala"
|
||
|
_tmp4_ = self->priv->points;
|
||
|
#line 25 "../src/area.vala"
|
||
|
live_chart_points_first (_tmp4_, &_tmp5_);
|
||
|
#line 25 "../src/area.vala"
|
||
|
first_point = _tmp5_;
|
||
|
#line 26 "../src/area.vala"
|
||
|
_tmp6_ = self->priv->points;
|
||
|
#line 26 "../src/area.vala"
|
||
|
live_chart_points_last (_tmp6_, &_tmp7_);
|
||
|
#line 26 "../src/area.vala"
|
||
|
last_point = _tmp7_;
|
||
|
#line 28 "../src/area.vala"
|
||
|
_tmp8_ = self->priv->color;
|
||
|
#line 28 "../src/area.vala"
|
||
|
_tmp9_ = self->priv->color;
|
||
|
#line 28 "../src/area.vala"
|
||
|
_tmp10_ = self->priv->color;
|
||
|
#line 28 "../src/area.vala"
|
||
|
cairo_set_source_rgba (ctx, _tmp8_.red, _tmp9_.green, _tmp10_.blue, self->priv->alpha);
|
||
|
#line 29 "../src/area.vala"
|
||
|
_tmp11_ = last_point;
|
||
|
#line 29 "../src/area.vala"
|
||
|
_tmp12_ = last_point;
|
||
|
#line 29 "../src/area.vala"
|
||
|
cairo_line_to (ctx, _tmp11_.x, _tmp12_.y);
|
||
|
#line 30 "../src/area.vala"
|
||
|
_tmp13_ = last_point;
|
||
|
#line 30 "../src/area.vala"
|
||
|
_tmp14_ = boundaries;
|
||
|
#line 30 "../src/area.vala"
|
||
|
_tmp15_ = _tmp14_.y;
|
||
|
#line 30 "../src/area.vala"
|
||
|
cairo_line_to (ctx, _tmp13_.x, (gdouble) _tmp15_.max);
|
||
|
#line 31 "../src/area.vala"
|
||
|
_tmp16_ = first_point;
|
||
|
#line 31 "../src/area.vala"
|
||
|
_tmp17_ = boundaries;
|
||
|
#line 31 "../src/area.vala"
|
||
|
_tmp18_ = _tmp17_.y;
|
||
|
#line 31 "../src/area.vala"
|
||
|
cairo_line_to (ctx, _tmp16_.x, (gdouble) _tmp18_.max);
|
||
|
#line 32 "../src/area.vala"
|
||
|
_tmp19_ = first_point;
|
||
|
#line 32 "../src/area.vala"
|
||
|
_tmp20_ = first_point;
|
||
|
#line 32 "../src/area.vala"
|
||
|
cairo_line_to (ctx, _tmp19_.x, _tmp20_.y);
|
||
|
#line 33 "../src/area.vala"
|
||
|
cairo_close_path (ctx);
|
||
|
#line 205 "area.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_real_get_bounding_box (LiveChartDrawable* base,
|
||
|
LiveChartBoundingBox* result)
|
||
|
{
|
||
|
LiveChartArea * self;
|
||
|
LiveChartBoundingBox _tmp0_;
|
||
|
#line 37 "../src/area.vala"
|
||
|
self = (LiveChartArea*) base;
|
||
|
#line 38 "../src/area.vala"
|
||
|
_tmp0_ = self->priv->bounding_box;
|
||
|
#line 38 "../src/area.vala"
|
||
|
*result = _tmp0_;
|
||
|
#line 38 "../src/area.vala"
|
||
|
return;
|
||
|
#line 223 "area.c"
|
||
|
}
|
||
|
|
||
|
static gboolean
|
||
|
live_chart_area_real_get_visible (LiveChartDrawable* base)
|
||
|
{
|
||
|
gboolean result;
|
||
|
LiveChartArea* self;
|
||
|
#line 14 "../src/area.vala"
|
||
|
self = (LiveChartArea*) base;
|
||
|
#line 14 "../src/area.vala"
|
||
|
result = self->priv->_visible;
|
||
|
#line 14 "../src/area.vala"
|
||
|
return result;
|
||
|
#line 237 "area.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_real_set_visible (LiveChartDrawable* base,
|
||
|
gboolean value)
|
||
|
{
|
||
|
LiveChartArea* self;
|
||
|
gboolean old_value;
|
||
|
#line 14 "../src/area.vala"
|
||
|
self = (LiveChartArea*) base;
|
||
|
#line 14 "../src/area.vala"
|
||
|
old_value = live_chart_area_real_get_visible (base);
|
||
|
#line 14 "../src/area.vala"
|
||
|
if (old_value != value) {
|
||
|
#line 14 "../src/area.vala"
|
||
|
self->priv->_visible = value;
|
||
|
#line 14 "../src/area.vala"
|
||
|
g_object_notify_by_pspec ((GObject *) self, live_chart_area_properties[LIVE_CHART_AREA_VISIBLE_PROPERTY]);
|
||
|
#line 256 "area.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_class_init (LiveChartAreaClass * klass,
|
||
|
gpointer klass_data)
|
||
|
{
|
||
|
#line 4 "../src/area.vala"
|
||
|
live_chart_area_parent_class = g_type_class_peek_parent (klass);
|
||
|
#line 4 "../src/area.vala"
|
||
|
g_type_class_adjust_private_offset (klass, &LiveChartArea_private_offset);
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_area_get_property;
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_area_set_property;
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_CLASS (klass)->finalize = live_chart_area_finalize;
|
||
|
#line 4 "../src/area.vala"
|
||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_AREA_VISIBLE_PROPERTY, live_chart_area_properties[LIVE_CHART_AREA_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||
|
#line 276 "area.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_live_chart_drawable_interface_init (LiveChartDrawableIface * iface,
|
||
|
gpointer iface_data)
|
||
|
{
|
||
|
#line 4 "../src/area.vala"
|
||
|
live_chart_area_live_chart_drawable_parent_iface = g_type_interface_peek_parent (iface);
|
||
|
#line 4 "../src/area.vala"
|
||
|
iface->draw = (void (*) (LiveChartDrawable*, cairo_t*, LiveChartConfig*)) live_chart_area_real_draw;
|
||
|
#line 4 "../src/area.vala"
|
||
|
iface->get_bounding_box = (void (*) (LiveChartDrawable*, LiveChartBoundingBox*)) live_chart_area_real_get_bounding_box;
|
||
|
#line 4 "../src/area.vala"
|
||
|
iface->get_visible = live_chart_area_real_get_visible;
|
||
|
#line 4 "../src/area.vala"
|
||
|
iface->set_visible = live_chart_area_real_set_visible;
|
||
|
#line 293 "area.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_instance_init (LiveChartArea * self,
|
||
|
gpointer klass)
|
||
|
{
|
||
|
LiveChartBoundingBox _tmp0_ = {0};
|
||
|
#line 4 "../src/area.vala"
|
||
|
self->priv = live_chart_area_get_instance_private (self);
|
||
|
#line 7 "../src/area.vala"
|
||
|
memset (&_tmp0_, 0, sizeof (LiveChartBoundingBox));
|
||
|
#line 7 "../src/area.vala"
|
||
|
_tmp0_.x = (gdouble) 0;
|
||
|
#line 7 "../src/area.vala"
|
||
|
_tmp0_.y = (gdouble) 0;
|
||
|
#line 7 "../src/area.vala"
|
||
|
_tmp0_.width = (gdouble) 0;
|
||
|
#line 7 "../src/area.vala"
|
||
|
_tmp0_.height = (gdouble) 0;
|
||
|
#line 7 "../src/area.vala"
|
||
|
self->priv->bounding_box = _tmp0_;
|
||
|
#line 13 "../src/area.vala"
|
||
|
self->priv->alpha = 0.3;
|
||
|
#line 14 "../src/area.vala"
|
||
|
self->priv->_visible = TRUE;
|
||
|
#line 319 "area.c"
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
live_chart_area_finalize (GObject * obj)
|
||
|
{
|
||
|
LiveChartArea * self;
|
||
|
#line 4 "../src/area.vala"
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_AREA, LiveChartArea);
|
||
|
#line 5 "../src/area.vala"
|
||
|
_g_object_unref0 (self->priv->points);
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_CLASS (live_chart_area_parent_class)->finalize (obj);
|
||
|
#line 332 "area.c"
|
||
|
}
|
||
|
|
||
|
static GType
|
||
|
live_chart_area_get_type_once (void)
|
||
|
{
|
||
|
static const GTypeInfo g_define_type_info = { sizeof (LiveChartAreaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_area_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartArea), 0, (GInstanceInitFunc) live_chart_area_instance_init, NULL };
|
||
|
static const GInterfaceInfo live_chart_drawable_info = { (GInterfaceInitFunc) live_chart_area_live_chart_drawable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
|
||
|
GType live_chart_area_type_id;
|
||
|
live_chart_area_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartArea", &g_define_type_info, 0);
|
||
|
g_type_add_interface_static (live_chart_area_type_id, LIVE_CHART_TYPE_DRAWABLE, &live_chart_drawable_info);
|
||
|
LiveChartArea_private_offset = g_type_add_instance_private (live_chart_area_type_id, sizeof (LiveChartAreaPrivate));
|
||
|
return live_chart_area_type_id;
|
||
|
}
|
||
|
|
||
|
GType
|
||
|
live_chart_area_get_type (void)
|
||
|
{
|
||
|
static volatile gsize live_chart_area_type_id__once = 0;
|
||
|
if (g_once_init_enter (&live_chart_area_type_id__once)) {
|
||
|
GType live_chart_area_type_id;
|
||
|
live_chart_area_type_id = live_chart_area_get_type_once ();
|
||
|
g_once_init_leave (&live_chart_area_type_id__once, live_chart_area_type_id);
|
||
|
}
|
||
|
return live_chart_area_type_id__once;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
_vala_live_chart_area_get_property (GObject * object,
|
||
|
guint property_id,
|
||
|
GValue * value,
|
||
|
GParamSpec * pspec)
|
||
|
{
|
||
|
LiveChartArea * self;
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_AREA, LiveChartArea);
|
||
|
#line 4 "../src/area.vala"
|
||
|
switch (property_id) {
|
||
|
#line 4 "../src/area.vala"
|
||
|
case LIVE_CHART_AREA_VISIBLE_PROPERTY:
|
||
|
#line 4 "../src/area.vala"
|
||
|
g_value_set_boolean (value, live_chart_drawable_get_visible ((LiveChartDrawable*) self));
|
||
|
#line 4 "../src/area.vala"
|
||
|
break;
|
||
|
#line 375 "area.c"
|
||
|
default:
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||
|
#line 4 "../src/area.vala"
|
||
|
break;
|
||
|
#line 381 "area.c"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
_vala_live_chart_area_set_property (GObject * object,
|
||
|
guint property_id,
|
||
|
const GValue * value,
|
||
|
GParamSpec * pspec)
|
||
|
{
|
||
|
LiveChartArea * self;
|
||
|
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_AREA, LiveChartArea);
|
||
|
#line 4 "../src/area.vala"
|
||
|
switch (property_id) {
|
||
|
#line 4 "../src/area.vala"
|
||
|
case LIVE_CHART_AREA_VISIBLE_PROPERTY:
|
||
|
#line 4 "../src/area.vala"
|
||
|
live_chart_drawable_set_visible ((LiveChartDrawable*) self, g_value_get_boolean (value));
|
||
|
#line 4 "../src/area.vala"
|
||
|
break;
|
||
|
#line 401 "area.c"
|
||
|
default:
|
||
|
#line 4 "../src/area.vala"
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||
|
#line 4 "../src/area.vala"
|
||
|
break;
|
||
|
#line 407 "area.c"
|
||
|
}
|
||
|
}
|
||
|
|