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

587 lines
16 KiB
C

/* path.c generated by valac 0.56.0, the Vala compiler
* generated from path.vala, do not modify */
#include "livechart.h"
#include <glib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <glib-object.h>
#include <cairo-gobject.h>
enum {
LIVE_CHART_PATH_0_PROPERTY,
LIVE_CHART_PATH_WIDTH_PROPERTY,
LIVE_CHART_PATH_COLOR_PROPERTY,
LIVE_CHART_PATH_VISIBLE_PROPERTY,
LIVE_CHART_PATH_NUM_PROPERTIES
};
static GParamSpec* live_chart_path_properties[LIVE_CHART_PATH_NUM_PROPERTIES];
#define _live_chart_dash_free0(var) ((var == NULL) ? NULL : (var = (live_chart_dash_free (var), NULL)))
struct _LiveChartPathPrivate {
gdouble _width;
GdkRGBA _color;
gboolean _visible;
};
static gint LiveChartPath_private_offset;
static gpointer live_chart_path_parent_class = NULL;
static gdouble* _vala_array_dup1 (gdouble* self,
gssize length);
static gboolean _gdk_rgba_equal (const GdkRGBA * s1,
const GdkRGBA * s2);
static void live_chart_path_finalize (GObject * obj);
static GType live_chart_path_get_type_once (void);
static void _vala_live_chart_path_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec);
static void _vala_live_chart_path_set_property (GObject * object,
guint property_id,
const GValue * value,
GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
gsize byte_size);
void
live_chart_dash_init (LiveChartDash *self)
{
#line 8 "../src/path.vala"
memset (self, 0, sizeof (LiveChartDash));
#line 9 "../src/path.vala"
(*self).offset = (gdouble) 0;
#line 57 "path.c"
}
static gdouble*
_vala_array_dup1 (gdouble* self,
gssize length)
{
#line 5 "../src/path.vala"
if (length > 0) {
#line 5 "../src/path.vala"
return _vala_memdup2 (self, length * sizeof (gdouble));
#line 68 "path.c"
}
#line 5 "../src/path.vala"
return NULL;
#line 72 "path.c"
}
void
live_chart_dash_copy (const LiveChartDash* self,
LiveChartDash* dest)
{
gdouble* _tmp0_;
gint _tmp0__length1;
gdouble* _tmp1_;
gint _tmp1__length1;
#line 5 "../src/path.vala"
_tmp0_ = (*self).dashes;
#line 5 "../src/path.vala"
_tmp0__length1 = (*self).dashes_length1;
#line 5 "../src/path.vala"
_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
#line 5 "../src/path.vala"
_tmp1__length1 = _tmp0__length1;
#line 5 "../src/path.vala"
(*dest).dashes = (g_free ((*dest).dashes), NULL);
#line 5 "../src/path.vala"
(*dest).dashes = _tmp1_;
#line 5 "../src/path.vala"
(*dest).dashes_length1 = _tmp1__length1;
#line 5 "../src/path.vala"
(*dest).offset = (*self).offset;
#line 99 "path.c"
}
void
live_chart_dash_destroy (LiveChartDash* self)
{
#line 6 "../src/path.vala"
(*self).dashes = (g_free ((*self).dashes), NULL);
#line 107 "path.c"
}
LiveChartDash*
live_chart_dash_dup (const LiveChartDash* self)
{
LiveChartDash* dup;
#line 5 "../src/path.vala"
dup = g_new0 (LiveChartDash, 1);
#line 5 "../src/path.vala"
live_chart_dash_copy (self, dup);
#line 5 "../src/path.vala"
return dup;
#line 120 "path.c"
}
void
live_chart_dash_free (LiveChartDash* self)
{
#line 5 "../src/path.vala"
live_chart_dash_destroy (self);
#line 5 "../src/path.vala"
g_free (self);
#line 130 "path.c"
}
static GType
live_chart_dash_get_type_once (void)
{
GType live_chart_dash_type_id;
live_chart_dash_type_id = g_boxed_type_register_static ("LiveChartDash", (GBoxedCopyFunc) live_chart_dash_dup, (GBoxedFreeFunc) live_chart_dash_free);
return live_chart_dash_type_id;
}
GType
live_chart_dash_get_type (void)
{
static volatile gsize live_chart_dash_type_id__once = 0;
if (g_once_init_enter (&live_chart_dash_type_id__once)) {
GType live_chart_dash_type_id;
live_chart_dash_type_id = live_chart_dash_get_type_once ();
g_once_init_leave (&live_chart_dash_type_id__once, live_chart_dash_type_id);
}
return live_chart_dash_type_id__once;
}
static inline gpointer
live_chart_path_get_instance_private (LiveChartPath* self)
{
return G_STRUCT_MEMBER_P (self, LiveChartPath_private_offset);
}
static gpointer
_live_chart_dash_dup0 (gpointer self)
{
#line 23 "../src/path.vala"
return self ? live_chart_dash_dup (self) : NULL;
#line 164 "path.c"
}
LiveChartPath*
live_chart_path_construct (GType object_type,
gdouble width,
GdkRGBA* color,
gboolean visible,
LiveChartDash* dash)
{
LiveChartPath * self = NULL;
GdkRGBA _tmp0_;
LiveChartDash* _tmp1_;
#line 19 "../src/path.vala"
g_return_val_if_fail (color != NULL, NULL);
#line 19 "../src/path.vala"
self = (LiveChartPath*) g_object_new (object_type, NULL);
#line 20 "../src/path.vala"
live_chart_path_set_width (self, width);
#line 21 "../src/path.vala"
_tmp0_ = *color;
#line 21 "../src/path.vala"
live_chart_path_set_color (self, &_tmp0_);
#line 22 "../src/path.vala"
live_chart_path_set_visible (self, TRUE);
#line 23 "../src/path.vala"
_tmp1_ = _live_chart_dash_dup0 (dash);
#line 23 "../src/path.vala"
_live_chart_dash_free0 (self->dash);
#line 23 "../src/path.vala"
self->dash = _tmp1_;
#line 19 "../src/path.vala"
return self;
#line 197 "path.c"
}
LiveChartPath*
live_chart_path_new (gdouble width,
GdkRGBA* color,
gboolean visible,
LiveChartDash* dash)
{
#line 19 "../src/path.vala"
return live_chart_path_construct (LIVE_CHART_TYPE_PATH, width, color, visible, dash);
#line 208 "path.c"
}
void
live_chart_path_configure (LiveChartPath* self,
cairo_t* ctx)
{
gboolean _tmp0_;
#line 26 "../src/path.vala"
g_return_if_fail (self != NULL);
#line 26 "../src/path.vala"
g_return_if_fail (ctx != NULL);
#line 27 "../src/path.vala"
_tmp0_ = self->priv->_visible;
#line 27 "../src/path.vala"
if (_tmp0_) {
#line 224 "path.c"
LiveChartDash* _tmp1_;
GdkRGBA _tmp5_;
GdkRGBA _tmp6_;
GdkRGBA _tmp7_;
GdkRGBA _tmp8_;
gdouble _tmp9_;
#line 28 "../src/path.vala"
_tmp1_ = self->dash;
#line 28 "../src/path.vala"
if (_tmp1_ != NULL) {
#line 235 "path.c"
LiveChartDash* _tmp2_;
gdouble* _tmp3_;
gint _tmp3__length1;
LiveChartDash* _tmp4_;
#line 29 "../src/path.vala"
_tmp2_ = self->dash;
#line 29 "../src/path.vala"
_tmp3_ = (*_tmp2_).dashes;
#line 29 "../src/path.vala"
_tmp3__length1 = (*_tmp2_).dashes_length1;
#line 29 "../src/path.vala"
_tmp4_ = self->dash;
#line 29 "../src/path.vala"
cairo_set_dash (ctx, _tmp3_, (gint) _tmp3__length1, (*_tmp4_).offset);
#line 250 "path.c"
}
#line 31 "../src/path.vala"
_tmp5_ = self->priv->_color;
#line 31 "../src/path.vala"
_tmp6_ = self->priv->_color;
#line 31 "../src/path.vala"
_tmp7_ = self->priv->_color;
#line 31 "../src/path.vala"
_tmp8_ = self->priv->_color;
#line 31 "../src/path.vala"
cairo_set_source_rgba (ctx, _tmp5_.red, _tmp6_.green, _tmp7_.blue, _tmp8_.alpha);
#line 32 "../src/path.vala"
_tmp9_ = self->priv->_width;
#line 32 "../src/path.vala"
cairo_set_line_width (ctx, _tmp9_);
#line 266 "path.c"
}
}
gdouble
live_chart_path_get_width (LiveChartPath* self)
{
gdouble result;
#line 14 "../src/path.vala"
g_return_val_if_fail (self != NULL, 0.0);
#line 14 "../src/path.vala"
result = self->priv->_width;
#line 14 "../src/path.vala"
return result;
#line 280 "path.c"
}
void
live_chart_path_set_width (LiveChartPath* self,
gdouble value)
{
gdouble old_value;
#line 14 "../src/path.vala"
g_return_if_fail (self != NULL);
#line 14 "../src/path.vala"
old_value = live_chart_path_get_width (self);
#line 14 "../src/path.vala"
if (old_value != value) {
#line 14 "../src/path.vala"
self->priv->_width = value;
#line 14 "../src/path.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_path_properties[LIVE_CHART_PATH_WIDTH_PROPERTY]);
#line 298 "path.c"
}
}
void
live_chart_path_get_color (LiveChartPath* self,
GdkRGBA * result)
{
GdkRGBA _tmp0_;
#line 16 "../src/path.vala"
g_return_if_fail (self != NULL);
#line 16 "../src/path.vala"
_tmp0_ = self->priv->_color;
#line 16 "../src/path.vala"
*result = _tmp0_;
#line 16 "../src/path.vala"
return;
#line 315 "path.c"
}
static gboolean
_gdk_rgba_equal (const GdkRGBA * s1,
const GdkRGBA * s2)
{
#line 16 "../src/path.vala"
if (s1 == s2) {
#line 16 "../src/path.vala"
return TRUE;
#line 326 "path.c"
}
#line 16 "../src/path.vala"
if (s1 == NULL) {
#line 16 "../src/path.vala"
return FALSE;
#line 332 "path.c"
}
#line 16 "../src/path.vala"
if (s2 == NULL) {
#line 16 "../src/path.vala"
return FALSE;
#line 338 "path.c"
}
#line 16 "../src/path.vala"
if (s1->red != s2->red) {
#line 16 "../src/path.vala"
return FALSE;
#line 344 "path.c"
}
#line 16 "../src/path.vala"
if (s1->green != s2->green) {
#line 16 "../src/path.vala"
return FALSE;
#line 350 "path.c"
}
#line 16 "../src/path.vala"
if (s1->blue != s2->blue) {
#line 16 "../src/path.vala"
return FALSE;
#line 356 "path.c"
}
#line 16 "../src/path.vala"
if (s1->alpha != s2->alpha) {
#line 16 "../src/path.vala"
return FALSE;
#line 362 "path.c"
}
#line 16 "../src/path.vala"
return TRUE;
#line 366 "path.c"
}
void
live_chart_path_set_color (LiveChartPath* self,
GdkRGBA * value)
{
GdkRGBA old_value;
#line 16 "../src/path.vala"
g_return_if_fail (self != NULL);
#line 16 "../src/path.vala"
live_chart_path_get_color (self, &old_value);
#line 16 "../src/path.vala"
if (_gdk_rgba_equal (value, &old_value) != TRUE) {
#line 380 "path.c"
GdkRGBA _tmp0_;
#line 16 "../src/path.vala"
_tmp0_ = *value;
#line 16 "../src/path.vala"
self->priv->_color = _tmp0_;
#line 16 "../src/path.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_path_properties[LIVE_CHART_PATH_COLOR_PROPERTY]);
#line 388 "path.c"
}
}
gboolean
live_chart_path_get_visible (LiveChartPath* self)
{
gboolean result;
#line 17 "../src/path.vala"
g_return_val_if_fail (self != NULL, FALSE);
#line 17 "../src/path.vala"
result = self->priv->_visible;
#line 17 "../src/path.vala"
return result;
#line 402 "path.c"
}
void
live_chart_path_set_visible (LiveChartPath* self,
gboolean value)
{
gboolean old_value;
#line 17 "../src/path.vala"
g_return_if_fail (self != NULL);
#line 17 "../src/path.vala"
old_value = live_chart_path_get_visible (self);
#line 17 "../src/path.vala"
if (old_value != value) {
#line 17 "../src/path.vala"
self->priv->_visible = value;
#line 17 "../src/path.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_path_properties[LIVE_CHART_PATH_VISIBLE_PROPERTY]);
#line 420 "path.c"
}
}
static void
live_chart_path_class_init (LiveChartPathClass * klass,
gpointer klass_data)
{
#line 13 "../src/path.vala"
live_chart_path_parent_class = g_type_class_peek_parent (klass);
#line 13 "../src/path.vala"
g_type_class_adjust_private_offset (klass, &LiveChartPath_private_offset);
#line 13 "../src/path.vala"
G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_path_get_property;
#line 13 "../src/path.vala"
G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_path_set_property;
#line 13 "../src/path.vala"
G_OBJECT_CLASS (klass)->finalize = live_chart_path_finalize;
#line 13 "../src/path.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_PATH_WIDTH_PROPERTY, live_chart_path_properties[LIVE_CHART_PATH_WIDTH_PROPERTY] = g_param_spec_double ("width", "width", "width", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 13 "../src/path.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_PATH_COLOR_PROPERTY, live_chart_path_properties[LIVE_CHART_PATH_COLOR_PROPERTY] = g_param_spec_boxed ("color", "color", "color", gdk_rgba_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 13 "../src/path.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_PATH_VISIBLE_PROPERTY, live_chart_path_properties[LIVE_CHART_PATH_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 444 "path.c"
}
static void
live_chart_path_instance_init (LiveChartPath * self,
gpointer klass)
{
#line 13 "../src/path.vala"
self->priv = live_chart_path_get_instance_private (self);
#line 453 "path.c"
}
static void
live_chart_path_finalize (GObject * obj)
{
LiveChartPath * self;
#line 13 "../src/path.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_PATH, LiveChartPath);
#line 15 "../src/path.vala"
_live_chart_dash_free0 (self->dash);
#line 13 "../src/path.vala"
G_OBJECT_CLASS (live_chart_path_parent_class)->finalize (obj);
#line 466 "path.c"
}
static GType
live_chart_path_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartPathClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_path_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartPath), 0, (GInstanceInitFunc) live_chart_path_instance_init, NULL };
GType live_chart_path_type_id;
live_chart_path_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartPath", &g_define_type_info, 0);
LiveChartPath_private_offset = g_type_add_instance_private (live_chart_path_type_id, sizeof (LiveChartPathPrivate));
return live_chart_path_type_id;
}
GType
live_chart_path_get_type (void)
{
static volatile gsize live_chart_path_type_id__once = 0;
if (g_once_init_enter (&live_chart_path_type_id__once)) {
GType live_chart_path_type_id;
live_chart_path_type_id = live_chart_path_get_type_once ();
g_once_init_leave (&live_chart_path_type_id__once, live_chart_path_type_id);
}
return live_chart_path_type_id__once;
}
static void
_vala_live_chart_path_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec)
{
LiveChartPath * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_PATH, LiveChartPath);
#line 13 "../src/path.vala"
switch (property_id) {
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_WIDTH_PROPERTY:
#line 13 "../src/path.vala"
g_value_set_double (value, live_chart_path_get_width (self));
#line 13 "../src/path.vala"
break;
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_COLOR_PROPERTY:
#line 509 "path.c"
{
GdkRGBA boxed;
#line 13 "../src/path.vala"
live_chart_path_get_color (self, &boxed);
#line 13 "../src/path.vala"
g_value_set_boxed (value, &boxed);
#line 516 "path.c"
}
#line 13 "../src/path.vala"
break;
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_VISIBLE_PROPERTY:
#line 13 "../src/path.vala"
g_value_set_boolean (value, live_chart_path_get_visible (self));
#line 13 "../src/path.vala"
break;
#line 526 "path.c"
default:
#line 13 "../src/path.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 13 "../src/path.vala"
break;
#line 532 "path.c"
}
}
static void
_vala_live_chart_path_set_property (GObject * object,
guint property_id,
const GValue * value,
GParamSpec * pspec)
{
LiveChartPath * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_PATH, LiveChartPath);
#line 13 "../src/path.vala"
switch (property_id) {
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_WIDTH_PROPERTY:
#line 13 "../src/path.vala"
live_chart_path_set_width (self, g_value_get_double (value));
#line 13 "../src/path.vala"
break;
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_COLOR_PROPERTY:
#line 13 "../src/path.vala"
live_chart_path_set_color (self, g_value_get_boxed (value));
#line 13 "../src/path.vala"
break;
#line 13 "../src/path.vala"
case LIVE_CHART_PATH_VISIBLE_PROPERTY:
#line 13 "../src/path.vala"
live_chart_path_set_visible (self, g_value_get_boolean (value));
#line 13 "../src/path.vala"
break;
#line 564 "path.c"
default:
#line 13 "../src/path.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 13 "../src/path.vala"
break;
#line 570 "path.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;
}