iPDC-suite/iPDC/lib/liblivechart.so.p/serie_renderer.c

550 lines
20 KiB
C

/* serie_renderer.c generated by valac 0.56.0, the Vala compiler
* generated from serie_renderer.vala, do not modify */
#include "livechart.h"
#include <glib.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <string.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#define LIVE_CHART_SERIE_RENDERER_VIRTUAL_LEFT_PADDING -200
enum {
LIVE_CHART_SERIE_RENDERER_0_PROPERTY,
LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY,
LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY,
LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY,
LIVE_CHART_SERIE_RENDERER_NUM_PROPERTIES
};
static GParamSpec* live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
struct _LiveChartSerieRendererPrivate {
gboolean _visible;
LiveChartPath* _line;
};
static gint LiveChartSerieRenderer_private_offset;
static gpointer live_chart_serie_renderer_parent_class = NULL;
static LiveChartDrawableIface * live_chart_serie_renderer_live_chart_drawable_parent_iface = NULL;
static void live_chart_serie_renderer_real_draw (LiveChartSerieRenderer* self,
cairo_t* ctx,
LiveChartConfig* config);
static void live_chart_serie_renderer_real_get_bounding_box (LiveChartDrawable* base,
LiveChartBoundingBox* result);
static void live_chart_serie_renderer_finalize (GObject * obj);
static GType live_chart_serie_renderer_get_type_once (void);
static void _vala_live_chart_serie_renderer_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec);
static void _vala_live_chart_serie_renderer_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_serie_renderer_get_instance_private (LiveChartSerieRenderer* self)
{
return G_STRUCT_MEMBER_P (self, LiveChartSerieRenderer_private_offset);
}
LiveChartSerieRenderer*
live_chart_serie_renderer_construct (GType object_type)
{
LiveChartSerieRenderer * self = NULL;
GdkRGBA _tmp0_ = {0};
LiveChartPath* _tmp1_;
LiveChartPath* _tmp2_;
#line 23 "../src/serie_renderer.vala"
self = (LiveChartSerieRenderer*) g_object_new (object_type, NULL);
#line 24 "../src/serie_renderer.vala"
_tmp0_.red = 1.0;
#line 24 "../src/serie_renderer.vala"
_tmp0_.green = 1.0;
#line 24 "../src/serie_renderer.vala"
_tmp0_.blue = 1.0;
#line 24 "../src/serie_renderer.vala"
_tmp0_.alpha = 1.0;
#line 24 "../src/serie_renderer.vala"
_tmp1_ = live_chart_path_new ((gdouble) 1, &_tmp0_, TRUE, NULL);
#line 24 "../src/serie_renderer.vala"
_tmp2_ = _tmp1_;
#line 24 "../src/serie_renderer.vala"
live_chart_serie_renderer_set_line (self, _tmp2_);
#line 24 "../src/serie_renderer.vala"
_g_object_unref0 (_tmp2_);
#line 23 "../src/serie_renderer.vala"
return self;
#line 88 "serie_renderer.c"
}
static gpointer
_g_object_ref0 (gpointer self)
{
#line 36 "../src/serie_renderer.vala"
return self ? g_object_ref (self) : NULL;
#line 96 "serie_renderer.c"
}
LiveChartValues*
live_chart_serie_renderer_get_values (LiveChartSerieRenderer* self)
{
LiveChartValues* _tmp0_;
LiveChartValues* _tmp1_;
LiveChartValues* result;
#line 35 "../src/serie_renderer.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 36 "../src/serie_renderer.vala"
_tmp0_ = self->values;
#line 36 "../src/serie_renderer.vala"
_tmp1_ = _g_object_ref0 (_tmp0_);
#line 36 "../src/serie_renderer.vala"
result = _tmp1_;
#line 36 "../src/serie_renderer.vala"
return result;
#line 115 "serie_renderer.c"
}
static void
live_chart_serie_renderer_real_draw (LiveChartSerieRenderer* self,
cairo_t* ctx,
LiveChartConfig* config)
{
#line 39 "../src/serie_renderer.vala"
g_critical ("Type `%s' does not implement abstract method `live_chart_serie_renderer_draw'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
#line 39 "../src/serie_renderer.vala"
return;
#line 127 "serie_renderer.c"
}
void
live_chart_serie_renderer_draw (LiveChartSerieRenderer* self,
cairo_t* ctx,
LiveChartConfig* config)
{
LiveChartSerieRendererClass* _klass_;
#line 39 "../src/serie_renderer.vala"
g_return_if_fail (self != NULL);
#line 39 "../src/serie_renderer.vala"
_klass_ = LIVE_CHART_SERIE_RENDERER_GET_CLASS (self);
#line 39 "../src/serie_renderer.vala"
if (_klass_->draw) {
#line 39 "../src/serie_renderer.vala"
_klass_->draw (self, ctx, config);
#line 144 "serie_renderer.c"
}
}
static void
live_chart_serie_renderer_real_get_bounding_box (LiveChartDrawable* base,
LiveChartBoundingBox* result)
{
LiveChartSerieRenderer * self;
LiveChartBoundingBox _tmp0_;
#line 41 "../src/serie_renderer.vala"
self = (LiveChartSerieRenderer*) base;
#line 42 "../src/serie_renderer.vala"
_tmp0_ = self->bounding_box;
#line 42 "../src/serie_renderer.vala"
*result = _tmp0_;
#line 42 "../src/serie_renderer.vala"
return;
#line 162 "serie_renderer.c"
}
void
live_chart_serie_renderer_debug (LiveChartSerieRenderer* self,
cairo_t* ctx)
{
gchar* debug = NULL;
const gchar* _tmp0_;
gchar* _tmp1_;
const gchar* _tmp2_;
#line 45 "../src/serie_renderer.vala"
g_return_if_fail (self != NULL);
#line 45 "../src/serie_renderer.vala"
g_return_if_fail (ctx != NULL);
#line 46 "../src/serie_renderer.vala"
_tmp0_ = g_getenv ("LIVE_CHART_DEBUG");
#line 46 "../src/serie_renderer.vala"
_tmp1_ = g_strdup (_tmp0_);
#line 46 "../src/serie_renderer.vala"
debug = _tmp1_;
#line 47 "../src/serie_renderer.vala"
_tmp2_ = debug;
#line 47 "../src/serie_renderer.vala"
if (_tmp2_ != NULL) {
#line 187 "serie_renderer.c"
LiveChartBoundingBox _tmp3_;
LiveChartBoundingBox _tmp4_;
LiveChartBoundingBox _tmp5_;
LiveChartBoundingBox _tmp6_;
#line 48 "../src/serie_renderer.vala"
_tmp3_ = self->bounding_box;
#line 48 "../src/serie_renderer.vala"
_tmp4_ = self->bounding_box;
#line 48 "../src/serie_renderer.vala"
_tmp5_ = self->bounding_box;
#line 48 "../src/serie_renderer.vala"
_tmp6_ = self->bounding_box;
#line 48 "../src/serie_renderer.vala"
cairo_rectangle (ctx, _tmp3_.x, _tmp4_.y, _tmp5_.width, _tmp6_.height);
#line 49 "../src/serie_renderer.vala"
cairo_stroke (ctx);
#line 204 "serie_renderer.c"
}
#line 45 "../src/serie_renderer.vala"
_g_free0 (debug);
#line 208 "serie_renderer.c"
}
gboolean
live_chart_serie_renderer_is_out_of_area (LiveChartSerieRenderer* self,
LiveChartPoint* point)
{
LiveChartPoint _tmp0_;
gboolean result;
#line 53 "../src/serie_renderer.vala"
g_return_val_if_fail (self != NULL, FALSE);
#line 53 "../src/serie_renderer.vala"
g_return_val_if_fail (point != NULL, FALSE);
#line 54 "../src/serie_renderer.vala"
_tmp0_ = *point;
#line 54 "../src/serie_renderer.vala"
result = _tmp0_.x < ((gdouble) LIVE_CHART_SERIE_RENDERER_VIRTUAL_LEFT_PADDING);
#line 54 "../src/serie_renderer.vala"
return result;
#line 227 "serie_renderer.c"
}
static gboolean
live_chart_serie_renderer_real_get_visible (LiveChartDrawable* base)
{
gboolean result;
LiveChartSerieRenderer* self;
#line 9 "../src/serie_renderer.vala"
self = (LiveChartSerieRenderer*) base;
#line 9 "../src/serie_renderer.vala"
result = self->priv->_visible;
#line 9 "../src/serie_renderer.vala"
return result;
#line 241 "serie_renderer.c"
}
static void
live_chart_serie_renderer_real_set_visible (LiveChartDrawable* base,
gboolean value)
{
LiveChartSerieRenderer* self;
gboolean old_value;
#line 9 "../src/serie_renderer.vala"
self = (LiveChartSerieRenderer*) base;
#line 9 "../src/serie_renderer.vala"
old_value = live_chart_serie_renderer_real_get_visible (base);
#line 9 "../src/serie_renderer.vala"
if (old_value != value) {
#line 9 "../src/serie_renderer.vala"
self->priv->_visible = value;
#line 9 "../src/serie_renderer.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY]);
#line 260 "serie_renderer.c"
}
}
void
live_chart_serie_renderer_get_main_color (LiveChartSerieRenderer* self,
GdkRGBA * result)
{
LiveChartPath* _tmp0_;
GdkRGBA _tmp1_ = {0};
GdkRGBA _tmp2_;
#line 13 "../src/serie_renderer.vala"
g_return_if_fail (self != NULL);
#line 14 "../src/serie_renderer.vala"
_tmp0_ = self->priv->_line;
#line 14 "../src/serie_renderer.vala"
live_chart_path_get_color (_tmp0_, &_tmp1_);
#line 14 "../src/serie_renderer.vala"
_tmp2_ = _tmp1_;
#line 14 "../src/serie_renderer.vala"
*result = _tmp2_;
#line 14 "../src/serie_renderer.vala"
return;
#line 283 "serie_renderer.c"
}
void
live_chart_serie_renderer_set_main_color (LiveChartSerieRenderer* self,
GdkRGBA * value)
{
LiveChartPath* _tmp0_;
GdkRGBA _tmp1_;
#line 17 "../src/serie_renderer.vala"
g_return_if_fail (self != NULL);
#line 18 "../src/serie_renderer.vala"
_tmp0_ = self->priv->_line;
#line 18 "../src/serie_renderer.vala"
_tmp1_ = *value;
#line 18 "../src/serie_renderer.vala"
live_chart_path_set_color (_tmp0_, &_tmp1_);
#line 17 "../src/serie_renderer.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY]);
#line 302 "serie_renderer.c"
}
LiveChartPath*
live_chart_serie_renderer_get_line (LiveChartSerieRenderer* self)
{
LiveChartPath* result;
LiveChartPath* _tmp0_;
#line 21 "../src/serie_renderer.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 21 "../src/serie_renderer.vala"
_tmp0_ = self->priv->_line;
#line 21 "../src/serie_renderer.vala"
result = _tmp0_;
#line 21 "../src/serie_renderer.vala"
return result;
#line 318 "serie_renderer.c"
}
void
live_chart_serie_renderer_set_line (LiveChartSerieRenderer* self,
LiveChartPath* value)
{
LiveChartPath* old_value;
#line 21 "../src/serie_renderer.vala"
g_return_if_fail (self != NULL);
#line 21 "../src/serie_renderer.vala"
old_value = live_chart_serie_renderer_get_line (self);
#line 21 "../src/serie_renderer.vala"
if (old_value != value) {
#line 332 "serie_renderer.c"
LiveChartPath* _tmp0_;
#line 21 "../src/serie_renderer.vala"
_tmp0_ = _g_object_ref0 (value);
#line 21 "../src/serie_renderer.vala"
_g_object_unref0 (self->priv->_line);
#line 21 "../src/serie_renderer.vala"
self->priv->_line = _tmp0_;
#line 21 "../src/serie_renderer.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY]);
#line 342 "serie_renderer.c"
}
}
static void
live_chart_serie_renderer_class_init (LiveChartSerieRendererClass * klass,
gpointer klass_data)
{
#line 5 "../src/serie_renderer.vala"
live_chart_serie_renderer_parent_class = g_type_class_peek_parent (klass);
#line 5 "../src/serie_renderer.vala"
g_type_class_adjust_private_offset (klass, &LiveChartSerieRenderer_private_offset);
#line 5 "../src/serie_renderer.vala"
((LiveChartSerieRendererClass *) klass)->draw = (void (*) (LiveChartSerieRenderer*, cairo_t*, LiveChartConfig*)) live_chart_serie_renderer_real_draw;
#line 5 "../src/serie_renderer.vala"
G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_serie_renderer_get_property;
#line 5 "../src/serie_renderer.vala"
G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_serie_renderer_set_property;
#line 5 "../src/serie_renderer.vala"
G_OBJECT_CLASS (klass)->finalize = live_chart_serie_renderer_finalize;
#line 5 "../src/serie_renderer.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 5 "../src/serie_renderer.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY] = g_param_spec_boxed ("main-color", "main-color", "main-color", gdk_rgba_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_DEPRECATED));
#line 5 "../src/serie_renderer.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY, live_chart_serie_renderer_properties[LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY] = g_param_spec_object ("line", "line", "line", LIVE_CHART_TYPE_PATH, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 368 "serie_renderer.c"
}
static void
live_chart_serie_renderer_live_chart_drawable_interface_init (LiveChartDrawableIface * iface,
gpointer iface_data)
{
#line 5 "../src/serie_renderer.vala"
live_chart_serie_renderer_live_chart_drawable_parent_iface = g_type_interface_peek_parent (iface);
#line 5 "../src/serie_renderer.vala"
iface->draw = (void (*) (LiveChartDrawable*, cairo_t*, LiveChartConfig*)) live_chart_serie_renderer_draw;
#line 5 "../src/serie_renderer.vala"
iface->get_bounding_box = (void (*) (LiveChartDrawable*, LiveChartBoundingBox*)) live_chart_serie_renderer_real_get_bounding_box;
#line 5 "../src/serie_renderer.vala"
iface->get_visible = live_chart_serie_renderer_real_get_visible;
#line 5 "../src/serie_renderer.vala"
iface->set_visible = live_chart_serie_renderer_real_set_visible;
#line 385 "serie_renderer.c"
}
static void
live_chart_serie_renderer_instance_init (LiveChartSerieRenderer * self,
gpointer klass)
{
LiveChartBoundingBox _tmp0_ = {0};
#line 5 "../src/serie_renderer.vala"
self->priv = live_chart_serie_renderer_get_instance_private (self);
#line 9 "../src/serie_renderer.vala"
self->priv->_visible = TRUE;
#line 27 "../src/serie_renderer.vala"
memset (&_tmp0_, 0, sizeof (LiveChartBoundingBox));
#line 27 "../src/serie_renderer.vala"
_tmp0_.x = (gdouble) 0;
#line 27 "../src/serie_renderer.vala"
_tmp0_.y = (gdouble) 0;
#line 27 "../src/serie_renderer.vala"
_tmp0_.width = (gdouble) 0;
#line 27 "../src/serie_renderer.vala"
_tmp0_.height = (gdouble) 0;
#line 27 "../src/serie_renderer.vala"
self->bounding_box = _tmp0_;
#line 409 "serie_renderer.c"
}
static void
live_chart_serie_renderer_finalize (GObject * obj)
{
LiveChartSerieRenderer * self;
#line 5 "../src/serie_renderer.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_SERIE_RENDERER, LiveChartSerieRenderer);
#line 21 "../src/serie_renderer.vala"
_g_object_unref0 (self->priv->_line);
#line 34 "../src/serie_renderer.vala"
_g_object_unref0 (self->values);
#line 5 "../src/serie_renderer.vala"
G_OBJECT_CLASS (live_chart_serie_renderer_parent_class)->finalize (obj);
#line 424 "serie_renderer.c"
}
static GType
live_chart_serie_renderer_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartSerieRendererClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_serie_renderer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartSerieRenderer), 0, (GInstanceInitFunc) live_chart_serie_renderer_instance_init, NULL };
static const GInterfaceInfo live_chart_drawable_info = { (GInterfaceInitFunc) live_chart_serie_renderer_live_chart_drawable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
GType live_chart_serie_renderer_type_id;
live_chart_serie_renderer_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartSerieRenderer", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
g_type_add_interface_static (live_chart_serie_renderer_type_id, LIVE_CHART_TYPE_DRAWABLE, &live_chart_drawable_info);
LiveChartSerieRenderer_private_offset = g_type_add_instance_private (live_chart_serie_renderer_type_id, sizeof (LiveChartSerieRendererPrivate));
return live_chart_serie_renderer_type_id;
}
GType
live_chart_serie_renderer_get_type (void)
{
static volatile gsize live_chart_serie_renderer_type_id__once = 0;
if (g_once_init_enter (&live_chart_serie_renderer_type_id__once)) {
GType live_chart_serie_renderer_type_id;
live_chart_serie_renderer_type_id = live_chart_serie_renderer_get_type_once ();
g_once_init_leave (&live_chart_serie_renderer_type_id__once, live_chart_serie_renderer_type_id);
}
return live_chart_serie_renderer_type_id__once;
}
static void
_vala_live_chart_serie_renderer_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec)
{
LiveChartSerieRenderer * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_SERIE_RENDERER, LiveChartSerieRenderer);
#line 5 "../src/serie_renderer.vala"
switch (property_id) {
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY:
#line 5 "../src/serie_renderer.vala"
g_value_set_boolean (value, live_chart_drawable_get_visible ((LiveChartDrawable*) self));
#line 5 "../src/serie_renderer.vala"
break;
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY:
#line 469 "serie_renderer.c"
{
GdkRGBA boxed;
#line 5 "../src/serie_renderer.vala"
live_chart_serie_renderer_get_main_color (self, &boxed);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#line 475 "serie_renderer.c"
g_value_set_boxed (value, &boxed);
G_GNUC_END_IGNORE_DEPRECATIONS
}
#line 5 "../src/serie_renderer.vala"
break;
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY:
#line 5 "../src/serie_renderer.vala"
g_value_set_object (value, live_chart_serie_renderer_get_line (self));
#line 5 "../src/serie_renderer.vala"
break;
#line 487 "serie_renderer.c"
default:
#line 5 "../src/serie_renderer.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "../src/serie_renderer.vala"
break;
#line 493 "serie_renderer.c"
}
}
static void
_vala_live_chart_serie_renderer_set_property (GObject * object,
guint property_id,
const GValue * value,
GParamSpec * pspec)
{
LiveChartSerieRenderer * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_SERIE_RENDERER, LiveChartSerieRenderer);
#line 5 "../src/serie_renderer.vala"
switch (property_id) {
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_VISIBLE_PROPERTY:
#line 5 "../src/serie_renderer.vala"
live_chart_drawable_set_visible ((LiveChartDrawable*) self, g_value_get_boolean (value));
#line 5 "../src/serie_renderer.vala"
break;
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_MAIN_COLOR_PROPERTY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#line 516 "serie_renderer.c"
live_chart_serie_renderer_set_main_color (self, g_value_get_boxed (value));
G_GNUC_END_IGNORE_DEPRECATIONS
#line 5 "../src/serie_renderer.vala"
break;
#line 5 "../src/serie_renderer.vala"
case LIVE_CHART_SERIE_RENDERER_LINE_PROPERTY:
#line 5 "../src/serie_renderer.vala"
live_chart_serie_renderer_set_line (self, g_value_get_object (value));
#line 5 "../src/serie_renderer.vala"
break;
#line 527 "serie_renderer.c"
default:
#line 5 "../src/serie_renderer.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "../src/serie_renderer.vala"
break;
#line 533 "serie_renderer.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;
}