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

1052 lines
34 KiB
C

/* legend.c generated by valac 0.56.0, the Vala compiler
* generated from legend.vala, do not modify */
#include "livechart.h"
#include <glib.h>
#include <gdk/gdk.h>
#include <cairo-gobject.h>
#include <gee.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_WIDTH 15
#define LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_HEIGHT 10
enum {
LIVE_CHART_LEGEND_0_PROPERTY,
LIVE_CHART_LEGEND_VISIBLE_PROPERTY,
LIVE_CHART_LEGEND_MAIN_COLOR_PROPERTY,
LIVE_CHART_LEGEND_NUM_PROPERTIES
};
static GParamSpec* live_chart_legend_properties[LIVE_CHART_LEGEND_NUM_PROPERTIES];
#define _live_chart_labels_unref0(var) ((var == NULL) ? NULL : (var = (live_chart_labels_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum {
LIVE_CHART_HORIZONTAL_LEGEND_0_PROPERTY,
LIVE_CHART_HORIZONTAL_LEGEND_NUM_PROPERTIES
};
static GParamSpec* live_chart_horizontal_legend_properties[LIVE_CHART_HORIZONTAL_LEGEND_NUM_PROPERTIES];
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
typedef struct _Block3Data Block3Data;
typedef struct _Block4Data Block4Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum {
LIVE_CHART_NOOP_LEGEND_0_PROPERTY,
LIVE_CHART_NOOP_LEGEND_NUM_PROPERTIES
};
static GParamSpec* live_chart_noop_legend_properties[LIVE_CHART_NOOP_LEGEND_NUM_PROPERTIES];
struct _LiveChartLegendPrivate {
gboolean _visible;
GdkRGBA _main_color;
};
struct _Block3Data {
int _ref_count_;
LiveChartHorizontalLegend* self;
cairo_t* ctx;
};
struct _Block4Data {
int _ref_count_;
Block3Data * _data3_;
gint y_padding;
LiveChartBoundaries boundaries;
gint pos;
};
static gint LiveChartLegend_private_offset;
static gpointer live_chart_legend_parent_class = NULL;
static LiveChartDrawableIface * live_chart_legend_live_chart_drawable_parent_iface = NULL;
static gpointer live_chart_horizontal_legend_parent_class = NULL;
static gpointer live_chart_noop_legend_parent_class = NULL;
static void live_chart_legend_real_draw (LiveChartLegend* self,
cairo_t* ctx,
LiveChartConfig* config);
static void live_chart_legend_real_get_bounding_box (LiveChartDrawable* base,
LiveChartBoundingBox* result);
static gboolean _gdk_rgba_equal (const GdkRGBA * s1,
const GdkRGBA * s2);
static void live_chart_legend_finalize (GObject * obj);
static GType live_chart_legend_get_type_once (void);
static void _vala_live_chart_legend_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec);
static void _vala_live_chart_legend_set_property (GObject * object,
guint property_id,
const GValue * value,
GParamSpec * pspec);
static void live_chart_horizontal_legend_real_draw (LiveChartLegend* base,
cairo_t* ctx,
LiveChartConfig* config);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static gint live_chart_horizontal_legend_get_y_padding (LiveChartHorizontalLegend* self,
LiveChartConfig* config);
static gboolean ___lambda6_ (Block4Data* _data4_,
LiveChartSerie* serie);
static void live_chart_horizontal_legend_name_extents (LiveChartHorizontalLegend* self,
const gchar* name,
cairo_t* ctx,
cairo_text_extents_t* result);
static gboolean ____lambda6__gee_forall_func (gpointer g,
gpointer self);
static void live_chart_horizontal_legend_update_bounding_box (LiveChartHorizontalLegend* self,
LiveChartConfig* config,
gint width);
static GType live_chart_horizontal_legend_get_type_once (void);
static void live_chart_noop_legend_real_draw (LiveChartLegend* base,
cairo_t* ctx,
LiveChartConfig* config);
static GType live_chart_noop_legend_get_type_once (void);
static inline gpointer
live_chart_legend_get_instance_private (LiveChartLegend* self)
{
return G_STRUCT_MEMBER_P (self, LiveChartLegend_private_offset);
}
void
live_chart_legend_add_legend (LiveChartLegend* self,
LiveChartSerie* serie)
{
GeeArrayList* _tmp0_;
#line 25 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 25 "../src/legend.vala"
g_return_if_fail (serie != NULL);
#line 26 "../src/legend.vala"
_tmp0_ = self->series;
#line 26 "../src/legend.vala"
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, serie);
#line 130 "legend.c"
}
static void
live_chart_legend_real_draw (LiveChartLegend* self,
cairo_t* ctx,
LiveChartConfig* config)
{
#line 29 "../src/legend.vala"
g_critical ("Type `%s' does not implement abstract method `live_chart_legend_draw'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
#line 29 "../src/legend.vala"
return;
#line 142 "legend.c"
}
void
live_chart_legend_draw (LiveChartLegend* self,
cairo_t* ctx,
LiveChartConfig* config)
{
LiveChartLegendClass* _klass_;
#line 29 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 29 "../src/legend.vala"
_klass_ = LIVE_CHART_LEGEND_GET_CLASS (self);
#line 29 "../src/legend.vala"
if (_klass_->draw) {
#line 29 "../src/legend.vala"
_klass_->draw (self, ctx, config);
#line 159 "legend.c"
}
}
static void
live_chart_legend_real_get_bounding_box (LiveChartDrawable* base,
LiveChartBoundingBox* result)
{
LiveChartLegend * self;
LiveChartBoundingBox _tmp0_;
#line 30 "../src/legend.vala"
self = (LiveChartLegend*) base;
#line 31 "../src/legend.vala"
_tmp0_ = self->bounding_box;
#line 31 "../src/legend.vala"
*result = _tmp0_;
#line 31 "../src/legend.vala"
return;
#line 177 "legend.c"
}
LiveChartLegend*
live_chart_legend_construct (GType object_type)
{
LiveChartLegend * self = NULL;
#line 5 "../src/legend.vala"
self = (LiveChartLegend*) g_object_new (object_type, NULL);
#line 5 "../src/legend.vala"
return self;
#line 188 "legend.c"
}
static gboolean
live_chart_legend_real_get_visible (LiveChartDrawable* base)
{
gboolean result;
LiveChartLegend* self;
#line 7 "../src/legend.vala"
self = (LiveChartLegend*) base;
#line 7 "../src/legend.vala"
result = self->priv->_visible;
#line 7 "../src/legend.vala"
return result;
#line 202 "legend.c"
}
static void
live_chart_legend_real_set_visible (LiveChartDrawable* base,
gboolean value)
{
LiveChartLegend* self;
gboolean old_value;
#line 7 "../src/legend.vala"
self = (LiveChartLegend*) base;
#line 7 "../src/legend.vala"
old_value = live_chart_legend_real_get_visible (base);
#line 7 "../src/legend.vala"
if (old_value != value) {
#line 7 "../src/legend.vala"
self->priv->_visible = value;
#line 7 "../src/legend.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_legend_properties[LIVE_CHART_LEGEND_VISIBLE_PROPERTY]);
#line 221 "legend.c"
}
}
void
live_chart_legend_get_main_color (LiveChartLegend* self,
GdkRGBA * result)
{
GdkRGBA _tmp0_;
#line 18 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 18 "../src/legend.vala"
_tmp0_ = self->priv->_main_color;
#line 18 "../src/legend.vala"
*result = _tmp0_;
#line 18 "../src/legend.vala"
return;
#line 238 "legend.c"
}
static gboolean
_gdk_rgba_equal (const GdkRGBA * s1,
const GdkRGBA * s2)
{
#line 18 "../src/legend.vala"
if (s1 == s2) {
#line 18 "../src/legend.vala"
return TRUE;
#line 249 "legend.c"
}
#line 18 "../src/legend.vala"
if (s1 == NULL) {
#line 18 "../src/legend.vala"
return FALSE;
#line 255 "legend.c"
}
#line 18 "../src/legend.vala"
if (s2 == NULL) {
#line 18 "../src/legend.vala"
return FALSE;
#line 261 "legend.c"
}
#line 18 "../src/legend.vala"
if (s1->red != s2->red) {
#line 18 "../src/legend.vala"
return FALSE;
#line 267 "legend.c"
}
#line 18 "../src/legend.vala"
if (s1->green != s2->green) {
#line 18 "../src/legend.vala"
return FALSE;
#line 273 "legend.c"
}
#line 18 "../src/legend.vala"
if (s1->blue != s2->blue) {
#line 18 "../src/legend.vala"
return FALSE;
#line 279 "legend.c"
}
#line 18 "../src/legend.vala"
if (s1->alpha != s2->alpha) {
#line 18 "../src/legend.vala"
return FALSE;
#line 285 "legend.c"
}
#line 18 "../src/legend.vala"
return TRUE;
#line 289 "legend.c"
}
void
live_chart_legend_set_main_color (LiveChartLegend* self,
GdkRGBA * value)
{
GdkRGBA old_value;
#line 18 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 18 "../src/legend.vala"
live_chart_legend_get_main_color (self, &old_value);
#line 18 "../src/legend.vala"
if (_gdk_rgba_equal (value, &old_value) != TRUE) {
#line 303 "legend.c"
GdkRGBA _tmp0_;
#line 18 "../src/legend.vala"
_tmp0_ = *value;
#line 18 "../src/legend.vala"
self->priv->_main_color = _tmp0_;
#line 18 "../src/legend.vala"
g_object_notify_by_pspec ((GObject *) self, live_chart_legend_properties[LIVE_CHART_LEGEND_MAIN_COLOR_PROPERTY]);
#line 311 "legend.c"
}
}
static void
live_chart_legend_class_init (LiveChartLegendClass * klass,
gpointer klass_data)
{
#line 5 "../src/legend.vala"
live_chart_legend_parent_class = g_type_class_peek_parent (klass);
#line 5 "../src/legend.vala"
g_type_class_adjust_private_offset (klass, &LiveChartLegend_private_offset);
#line 5 "../src/legend.vala"
((LiveChartLegendClass *) klass)->draw = (void (*) (LiveChartLegend*, cairo_t*, LiveChartConfig*)) live_chart_legend_real_draw;
#line 5 "../src/legend.vala"
G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_legend_get_property;
#line 5 "../src/legend.vala"
G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_legend_set_property;
#line 5 "../src/legend.vala"
G_OBJECT_CLASS (klass)->finalize = live_chart_legend_finalize;
#line 5 "../src/legend.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_LEGEND_VISIBLE_PROPERTY, live_chart_legend_properties[LIVE_CHART_LEGEND_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 5 "../src/legend.vala"
g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_LEGEND_MAIN_COLOR_PROPERTY, live_chart_legend_properties[LIVE_CHART_LEGEND_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));
#line 335 "legend.c"
}
static void
live_chart_legend_live_chart_drawable_interface_init (LiveChartDrawableIface * iface,
gpointer iface_data)
{
#line 5 "../src/legend.vala"
live_chart_legend_live_chart_drawable_parent_iface = g_type_interface_peek_parent (iface);
#line 5 "../src/legend.vala"
iface->draw = (void (*) (LiveChartDrawable*, cairo_t*, LiveChartConfig*)) live_chart_legend_draw;
#line 5 "../src/legend.vala"
iface->get_bounding_box = (void (*) (LiveChartDrawable*, LiveChartBoundingBox*)) live_chart_legend_real_get_bounding_box;
#line 5 "../src/legend.vala"
iface->get_visible = live_chart_legend_real_get_visible;
#line 5 "../src/legend.vala"
iface->set_visible = live_chart_legend_real_set_visible;
#line 352 "legend.c"
}
static void
live_chart_legend_instance_init (LiveChartLegend * self,
gpointer klass)
{
LiveChartLabels* _tmp0_;
GeeArrayList* _tmp1_;
LiveChartBoundingBox _tmp2_ = {0};
GdkRGBA _tmp3_ = {0};
#line 5 "../src/legend.vala"
self->priv = live_chart_legend_get_instance_private (self);
#line 7 "../src/legend.vala"
self->priv->_visible = TRUE;
#line 8 "../src/legend.vala"
_tmp0_ = live_chart_labels_new ();
#line 8 "../src/legend.vala"
self->labels = _tmp0_;
#line 10 "../src/legend.vala"
_tmp1_ = gee_array_list_new (LIVE_CHART_TYPE_SERIE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
#line 10 "../src/legend.vala"
self->series = _tmp1_;
#line 11 "../src/legend.vala"
memset (&_tmp2_, 0, sizeof (LiveChartBoundingBox));
#line 11 "../src/legend.vala"
_tmp2_.x = (gdouble) 0;
#line 11 "../src/legend.vala"
_tmp2_.y = (gdouble) 0;
#line 11 "../src/legend.vala"
_tmp2_.width = (gdouble) 0;
#line 11 "../src/legend.vala"
_tmp2_.height = (gdouble) 0;
#line 11 "../src/legend.vala"
self->bounding_box = _tmp2_;
#line 17 "../src/legend.vala"
memset (&_tmp3_, 0, sizeof (GdkRGBA));
#line 17 "../src/legend.vala"
_tmp3_.red = 1.0;
#line 17 "../src/legend.vala"
_tmp3_.green = 1.0;
#line 17 "../src/legend.vala"
_tmp3_.blue = 1.0;
#line 17 "../src/legend.vala"
_tmp3_.alpha = 1.0;
#line 17 "../src/legend.vala"
self->priv->_main_color = _tmp3_;
#line 399 "legend.c"
}
static void
live_chart_legend_finalize (GObject * obj)
{
LiveChartLegend * self;
#line 5 "../src/legend.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_LEGEND, LiveChartLegend);
#line 8 "../src/legend.vala"
_live_chart_labels_unref0 (self->labels);
#line 10 "../src/legend.vala"
_g_object_unref0 (self->series);
#line 5 "../src/legend.vala"
G_OBJECT_CLASS (live_chart_legend_parent_class)->finalize (obj);
#line 414 "legend.c"
}
static GType
live_chart_legend_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartLegendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_legend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartLegend), 0, (GInstanceInitFunc) live_chart_legend_instance_init, NULL };
static const GInterfaceInfo live_chart_drawable_info = { (GInterfaceInitFunc) live_chart_legend_live_chart_drawable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
GType live_chart_legend_type_id;
live_chart_legend_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartLegend", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
g_type_add_interface_static (live_chart_legend_type_id, LIVE_CHART_TYPE_DRAWABLE, &live_chart_drawable_info);
LiveChartLegend_private_offset = g_type_add_instance_private (live_chart_legend_type_id, sizeof (LiveChartLegendPrivate));
return live_chart_legend_type_id;
}
GType
live_chart_legend_get_type (void)
{
static volatile gsize live_chart_legend_type_id__once = 0;
if (g_once_init_enter (&live_chart_legend_type_id__once)) {
GType live_chart_legend_type_id;
live_chart_legend_type_id = live_chart_legend_get_type_once ();
g_once_init_leave (&live_chart_legend_type_id__once, live_chart_legend_type_id);
}
return live_chart_legend_type_id__once;
}
static void
_vala_live_chart_legend_get_property (GObject * object,
guint property_id,
GValue * value,
GParamSpec * pspec)
{
LiveChartLegend * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_LEGEND, LiveChartLegend);
#line 5 "../src/legend.vala"
switch (property_id) {
#line 5 "../src/legend.vala"
case LIVE_CHART_LEGEND_VISIBLE_PROPERTY:
#line 5 "../src/legend.vala"
g_value_set_boolean (value, live_chart_drawable_get_visible ((LiveChartDrawable*) self));
#line 5 "../src/legend.vala"
break;
#line 5 "../src/legend.vala"
case LIVE_CHART_LEGEND_MAIN_COLOR_PROPERTY:
#line 459 "legend.c"
{
GdkRGBA boxed;
#line 5 "../src/legend.vala"
live_chart_legend_get_main_color (self, &boxed);
#line 5 "../src/legend.vala"
g_value_set_boxed (value, &boxed);
#line 466 "legend.c"
}
#line 5 "../src/legend.vala"
break;
#line 470 "legend.c"
default:
#line 5 "../src/legend.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "../src/legend.vala"
break;
#line 476 "legend.c"
}
}
static void
_vala_live_chart_legend_set_property (GObject * object,
guint property_id,
const GValue * value,
GParamSpec * pspec)
{
LiveChartLegend * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_LEGEND, LiveChartLegend);
#line 5 "../src/legend.vala"
switch (property_id) {
#line 5 "../src/legend.vala"
case LIVE_CHART_LEGEND_VISIBLE_PROPERTY:
#line 5 "../src/legend.vala"
live_chart_drawable_set_visible ((LiveChartDrawable*) self, g_value_get_boolean (value));
#line 5 "../src/legend.vala"
break;
#line 5 "../src/legend.vala"
case LIVE_CHART_LEGEND_MAIN_COLOR_PROPERTY:
#line 5 "../src/legend.vala"
live_chart_legend_set_main_color (self, g_value_get_boxed (value));
#line 5 "../src/legend.vala"
break;
#line 502 "legend.c"
default:
#line 5 "../src/legend.vala"
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "../src/legend.vala"
break;
#line 508 "legend.c"
}
}
static gpointer
_cairo_reference0 (gpointer self)
{
#line 40 "../src/legend.vala"
return self ? cairo_reference (self) : NULL;
#line 517 "legend.c"
}
static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
#line 40 "../src/legend.vala"
g_atomic_int_inc (&_data3_->_ref_count_);
#line 40 "../src/legend.vala"
return _data3_;
#line 527 "legend.c"
}
static void
block3_data_unref (void * _userdata_)
{
Block3Data* _data3_;
_data3_ = (Block3Data*) _userdata_;
#line 40 "../src/legend.vala"
if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
#line 537 "legend.c"
LiveChartHorizontalLegend* self;
#line 40 "../src/legend.vala"
self = _data3_->self;
#line 40 "../src/legend.vala"
_cairo_destroy0 (_data3_->ctx);
#line 40 "../src/legend.vala"
_g_object_unref0 (self);
#line 40 "../src/legend.vala"
g_slice_free (Block3Data, _data3_);
#line 547 "legend.c"
}
}
static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
#line 41 "../src/legend.vala"
g_atomic_int_inc (&_data4_->_ref_count_);
#line 41 "../src/legend.vala"
return _data4_;
#line 558 "legend.c"
}
static void
block4_data_unref (void * _userdata_)
{
Block4Data* _data4_;
_data4_ = (Block4Data*) _userdata_;
#line 41 "../src/legend.vala"
if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
#line 568 "legend.c"
LiveChartHorizontalLegend* self;
#line 41 "../src/legend.vala"
self = _data4_->_data3_->self;
#line 41 "../src/legend.vala"
block3_data_unref (_data4_->_data3_);
#line 41 "../src/legend.vala"
_data4_->_data3_ = NULL;
#line 41 "../src/legend.vala"
g_slice_free (Block4Data, _data4_);
#line 578 "legend.c"
}
}
static gboolean
___lambda6_ (Block4Data* _data4_,
LiveChartSerie* serie)
{
Block3Data* _data3_;
LiveChartHorizontalLegend* self;
GdkRGBA _tmp0_ = {0};
GdkRGBA _tmp1_;
GdkRGBA _tmp2_ = {0};
GdkRGBA _tmp3_;
GdkRGBA _tmp4_ = {0};
GdkRGBA _tmp5_;
LiveChartBoundaries _tmp6_;
LiveChartBoundary _tmp7_;
LiveChartBoundaries _tmp8_;
LiveChartBoundary _tmp9_;
LiveChartLabels* _tmp10_;
LiveChartFont* _tmp11_;
LiveChartFont* _tmp12_;
cairo_text_extents_t extents = {0};
const gchar* _tmp13_;
const gchar* _tmp14_;
cairo_text_extents_t _tmp15_ = {0};
LiveChartBoundaries _tmp16_;
LiveChartBoundary _tmp17_;
LiveChartBoundaries _tmp18_;
LiveChartBoundary _tmp19_;
cairo_text_extents_t _tmp20_;
cairo_text_extents_t _tmp21_;
const gchar* _tmp22_;
const gchar* _tmp23_;
cairo_text_extents_t _tmp24_;
gboolean result;
#line 46 "../src/legend.vala"
_data3_ = _data4_->_data3_;
#line 46 "../src/legend.vala"
self = _data3_->self;
#line 46 "../src/legend.vala"
g_return_val_if_fail (serie != NULL, FALSE);
#line 47 "../src/legend.vala"
live_chart_colorable_get_main_color ((LiveChartColorable*) serie, &_tmp0_);
#line 47 "../src/legend.vala"
_tmp1_ = _tmp0_;
#line 47 "../src/legend.vala"
live_chart_colorable_get_main_color ((LiveChartColorable*) serie, &_tmp2_);
#line 47 "../src/legend.vala"
_tmp3_ = _tmp2_;
#line 47 "../src/legend.vala"
live_chart_colorable_get_main_color ((LiveChartColorable*) serie, &_tmp4_);
#line 47 "../src/legend.vala"
_tmp5_ = _tmp4_;
#line 47 "../src/legend.vala"
cairo_set_source_rgba (_data3_->ctx, _tmp1_.red, _tmp3_.green, _tmp5_.blue, (gdouble) 1);
#line 48 "../src/legend.vala"
_tmp6_ = _data4_->boundaries;
#line 48 "../src/legend.vala"
_tmp7_ = _tmp6_.x;
#line 48 "../src/legend.vala"
_tmp8_ = _data4_->boundaries;
#line 48 "../src/legend.vala"
_tmp9_ = _tmp8_.y;
#line 48 "../src/legend.vala"
cairo_rectangle (_data3_->ctx, (gdouble) (_tmp7_.min + _data4_->pos), (gdouble) (_tmp9_.max + _data4_->y_padding), (gdouble) LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_WIDTH, (gdouble) LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_HEIGHT);
#line 49 "../src/legend.vala"
cairo_fill (_data3_->ctx);
#line 51 "../src/legend.vala"
_tmp10_ = ((LiveChartLegend*) self)->labels;
#line 51 "../src/legend.vala"
_tmp11_ = live_chart_labels_get_font (_tmp10_);
#line 51 "../src/legend.vala"
_tmp12_ = _tmp11_;
#line 51 "../src/legend.vala"
live_chart_font_configure (_tmp12_, _data3_->ctx);
#line 52 "../src/legend.vala"
_tmp13_ = live_chart_serie_get_name (serie);
#line 52 "../src/legend.vala"
_tmp14_ = _tmp13_;
#line 52 "../src/legend.vala"
live_chart_horizontal_legend_name_extents (self, _tmp14_, _data3_->ctx, &_tmp15_);
#line 52 "../src/legend.vala"
extents = _tmp15_;
#line 53 "../src/legend.vala"
_tmp16_ = _data4_->boundaries;
#line 53 "../src/legend.vala"
_tmp17_ = _tmp16_.x;
#line 53 "../src/legend.vala"
_tmp18_ = _data4_->boundaries;
#line 53 "../src/legend.vala"
_tmp19_ = _tmp18_.y;
#line 53 "../src/legend.vala"
_tmp20_ = extents;
#line 53 "../src/legend.vala"
_tmp21_ = extents;
#line 53 "../src/legend.vala"
cairo_move_to (_data3_->ctx, (gdouble) (((_tmp17_.min + _data4_->pos) + LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_WIDTH) + 3), ((_tmp19_.max + _data4_->y_padding) + _tmp20_.height) + ((LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_HEIGHT - _tmp21_.height) / 2));
#line 54 "../src/legend.vala"
_tmp22_ = live_chart_serie_get_name (serie);
#line 54 "../src/legend.vala"
_tmp23_ = _tmp22_;
#line 54 "../src/legend.vala"
cairo_show_text (_data3_->ctx, _tmp23_);
#line 56 "../src/legend.vala"
_tmp24_ = extents;
#line 56 "../src/legend.vala"
_data4_->pos += (LIVE_CHART_HORIZONTAL_LEGEND_COLOR_BLOCK_WIDTH + ((gint) _tmp24_.width)) + 20;
#line 58 "../src/legend.vala"
result = TRUE;
#line 58 "../src/legend.vala"
_g_object_unref0 (serie);
#line 58 "../src/legend.vala"
return result;
#line 693 "legend.c"
}
static gboolean
____lambda6__gee_forall_func (gpointer g,
gpointer self)
{
gboolean result;
result = ___lambda6_ (self, (LiveChartSerie*) g);
#line 46 "../src/legend.vala"
return result;
#line 704 "legend.c"
}
static void
live_chart_horizontal_legend_real_draw (LiveChartLegend* base,
cairo_t* ctx,
LiveChartConfig* config)
{
LiveChartHorizontalLegend * self;
Block3Data* _data3_;
cairo_t* _tmp0_;
gboolean _tmp1_;
gboolean _tmp2_;
#line 40 "../src/legend.vala"
self = (LiveChartHorizontalLegend*) base;
#line 40 "../src/legend.vala"
g_return_if_fail (ctx != NULL);
#line 40 "../src/legend.vala"
g_return_if_fail (config != NULL);
#line 40 "../src/legend.vala"
_data3_ = g_slice_new0 (Block3Data);
#line 40 "../src/legend.vala"
_data3_->_ref_count_ = 1;
#line 40 "../src/legend.vala"
_data3_->self = g_object_ref (self);
#line 40 "../src/legend.vala"
_tmp0_ = _cairo_reference0 (ctx);
#line 40 "../src/legend.vala"
_cairo_destroy0 (_data3_->ctx);
#line 40 "../src/legend.vala"
_data3_->ctx = _tmp0_;
#line 41 "../src/legend.vala"
_tmp1_ = live_chart_drawable_get_visible ((LiveChartDrawable*) self);
#line 41 "../src/legend.vala"
_tmp2_ = _tmp1_;
#line 41 "../src/legend.vala"
if (_tmp2_) {
#line 741 "legend.c"
Block4Data* _data4_;
LiveChartBoundaries _tmp3_ = {0};
GeeArrayList* _tmp4_;
#line 41 "../src/legend.vala"
_data4_ = g_slice_new0 (Block4Data);
#line 41 "../src/legend.vala"
_data4_->_ref_count_ = 1;
#line 41 "../src/legend.vala"
_data4_->_data3_ = block3_data_ref (_data3_);
#line 43 "../src/legend.vala"
_data4_->y_padding = live_chart_horizontal_legend_get_y_padding (self, config);
#line 44 "../src/legend.vala"
live_chart_config_boundaries (config, &_tmp3_);
#line 44 "../src/legend.vala"
_data4_->boundaries = _tmp3_;
#line 45 "../src/legend.vala"
_data4_->pos = 0;
#line 46 "../src/legend.vala"
_tmp4_ = ((LiveChartLegend*) self)->series;
#line 46 "../src/legend.vala"
gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp4_, ____lambda6__gee_forall_func, _data4_);
#line 60 "../src/legend.vala"
cairo_stroke (_data3_->ctx);
#line 61 "../src/legend.vala"
live_chart_horizontal_legend_update_bounding_box (self, config, _data4_->pos);
#line 62 "../src/legend.vala"
live_chart_horizontal_legend_debug (self, _data3_->ctx);
#line 41 "../src/legend.vala"
block4_data_unref (_data4_);
#line 41 "../src/legend.vala"
_data4_ = NULL;
#line 773 "legend.c"
}
#line 40 "../src/legend.vala"
block3_data_unref (_data3_);
#line 40 "../src/legend.vala"
_data3_ = NULL;
#line 779 "legend.c"
}
static gint
live_chart_horizontal_legend_get_y_padding (LiveChartHorizontalLegend* self,
LiveChartConfig* config)
{
LiveChartXAxis* _tmp0_;
LiveChartLabels* _tmp1_;
cairo_text_extents_t _tmp2_ = {0};
cairo_text_extents_t _tmp3_;
gint result;
#line 66 "../src/legend.vala"
g_return_val_if_fail (self != NULL, 0);
#line 66 "../src/legend.vala"
g_return_val_if_fail (config != NULL, 0);
#line 67 "../src/legend.vala"
_tmp0_ = config->x_axis;
#line 67 "../src/legend.vala"
_tmp1_ = _tmp0_->labels;
#line 67 "../src/legend.vala"
live_chart_labels_get_extents (_tmp1_, &_tmp2_);
#line 67 "../src/legend.vala"
_tmp3_ = _tmp2_;
#line 67 "../src/legend.vala"
result = (gint) ((LIVE_CHART_GRID_ABSCISSA_TIME_PADDING * 2) + _tmp3_.height);
#line 67 "../src/legend.vala"
return result;
#line 807 "legend.c"
}
static void
live_chart_horizontal_legend_name_extents (LiveChartHorizontalLegend* self,
const gchar* name,
cairo_t* ctx,
cairo_text_extents_t* result)
{
cairo_text_extents_t name_extents = {0};
cairo_text_extents_t _tmp0_ = {0};
#line 70 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 70 "../src/legend.vala"
g_return_if_fail (name != NULL);
#line 70 "../src/legend.vala"
g_return_if_fail (ctx != NULL);
#line 72 "../src/legend.vala"
cairo_text_extents (ctx, name, &_tmp0_);
#line 72 "../src/legend.vala"
name_extents = _tmp0_;
#line 74 "../src/legend.vala"
*result = name_extents;
#line 74 "../src/legend.vala"
return;
#line 832 "legend.c"
}
static void
live_chart_horizontal_legend_update_bounding_box (LiveChartHorizontalLegend* self,
LiveChartConfig* config,
gint width)
{
LiveChartBoundaries boundaries = {0};
LiveChartBoundaries _tmp0_ = {0};
LiveChartBoundaries _tmp1_;
LiveChartBoundary _tmp2_;
LiveChartBoundaries _tmp3_;
LiveChartBoundary _tmp4_;
LiveChartBoundingBox _tmp5_ = {0};
#line 77 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 77 "../src/legend.vala"
g_return_if_fail (config != NULL);
#line 78 "../src/legend.vala"
live_chart_config_boundaries (config, &_tmp0_);
#line 78 "../src/legend.vala"
boundaries = _tmp0_;
#line 79 "../src/legend.vala"
_tmp1_ = boundaries;
#line 79 "../src/legend.vala"
_tmp2_ = _tmp1_.x;
#line 79 "../src/legend.vala"
_tmp3_ = boundaries;
#line 79 "../src/legend.vala"
_tmp4_ = _tmp3_.y;
#line 79 "../src/legend.vala"
memset (&_tmp5_, 0, sizeof (LiveChartBoundingBox));
#line 79 "../src/legend.vala"
_tmp5_.x = (gdouble) _tmp2_.min;
#line 79 "../src/legend.vala"
_tmp5_.y = (gdouble) (_tmp4_.max + live_chart_horizontal_legend_get_y_padding (self, config));
#line 79 "../src/legend.vala"
_tmp5_.width = (gdouble) width;
#line 79 "../src/legend.vala"
_tmp5_.height = (gdouble) 10;
#line 79 "../src/legend.vala"
((LiveChartLegend*) self)->bounding_box = _tmp5_;
#line 875 "legend.c"
}
void
live_chart_horizontal_legend_debug (LiveChartHorizontalLegend* self,
cairo_t* ctx)
{
gchar* debug = NULL;
const gchar* _tmp0_;
gchar* _tmp1_;
const gchar* _tmp2_;
#line 87 "../src/legend.vala"
g_return_if_fail (self != NULL);
#line 87 "../src/legend.vala"
g_return_if_fail (ctx != NULL);
#line 88 "../src/legend.vala"
_tmp0_ = g_getenv ("LIVE_CHART_DEBUG");
#line 88 "../src/legend.vala"
_tmp1_ = g_strdup (_tmp0_);
#line 88 "../src/legend.vala"
debug = _tmp1_;
#line 89 "../src/legend.vala"
_tmp2_ = debug;
#line 89 "../src/legend.vala"
if (_tmp2_ != NULL) {
#line 900 "legend.c"
LiveChartBoundingBox _tmp3_;
LiveChartBoundingBox _tmp4_;
LiveChartBoundingBox _tmp5_;
LiveChartBoundingBox _tmp6_;
#line 90 "../src/legend.vala"
_tmp3_ = ((LiveChartLegend*) self)->bounding_box;
#line 90 "../src/legend.vala"
_tmp4_ = ((LiveChartLegend*) self)->bounding_box;
#line 90 "../src/legend.vala"
_tmp5_ = ((LiveChartLegend*) self)->bounding_box;
#line 90 "../src/legend.vala"
_tmp6_ = ((LiveChartLegend*) self)->bounding_box;
#line 90 "../src/legend.vala"
cairo_rectangle (ctx, _tmp3_.x, _tmp4_.y, _tmp5_.width, _tmp6_.height);
#line 91 "../src/legend.vala"
cairo_stroke (ctx);
#line 917 "legend.c"
}
#line 87 "../src/legend.vala"
_g_free0 (debug);
#line 921 "legend.c"
}
LiveChartHorizontalLegend*
live_chart_horizontal_legend_construct (GType object_type)
{
LiveChartHorizontalLegend * self = NULL;
#line 35 "../src/legend.vala"
self = (LiveChartHorizontalLegend*) live_chart_legend_construct (object_type);
#line 35 "../src/legend.vala"
return self;
#line 932 "legend.c"
}
LiveChartHorizontalLegend*
live_chart_horizontal_legend_new (void)
{
#line 35 "../src/legend.vala"
return live_chart_horizontal_legend_construct (LIVE_CHART_TYPE_HORIZONTAL_LEGEND);
#line 940 "legend.c"
}
static void
live_chart_horizontal_legend_class_init (LiveChartHorizontalLegendClass * klass,
gpointer klass_data)
{
#line 35 "../src/legend.vala"
live_chart_horizontal_legend_parent_class = g_type_class_peek_parent (klass);
#line 35 "../src/legend.vala"
((LiveChartLegendClass *) klass)->draw = (void (*) (LiveChartLegend*, cairo_t*, LiveChartConfig*)) live_chart_horizontal_legend_real_draw;
#line 951 "legend.c"
}
static void
live_chart_horizontal_legend_instance_init (LiveChartHorizontalLegend * self,
gpointer klass)
{
}
static GType
live_chart_horizontal_legend_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartHorizontalLegendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_horizontal_legend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartHorizontalLegend), 0, (GInstanceInitFunc) live_chart_horizontal_legend_instance_init, NULL };
GType live_chart_horizontal_legend_type_id;
live_chart_horizontal_legend_type_id = g_type_register_static (LIVE_CHART_TYPE_LEGEND, "LiveChartHorizontalLegend", &g_define_type_info, 0);
return live_chart_horizontal_legend_type_id;
}
GType
live_chart_horizontal_legend_get_type (void)
{
static volatile gsize live_chart_horizontal_legend_type_id__once = 0;
if (g_once_init_enter (&live_chart_horizontal_legend_type_id__once)) {
GType live_chart_horizontal_legend_type_id;
live_chart_horizontal_legend_type_id = live_chart_horizontal_legend_get_type_once ();
g_once_init_leave (&live_chart_horizontal_legend_type_id__once, live_chart_horizontal_legend_type_id);
}
return live_chart_horizontal_legend_type_id__once;
}
static void
live_chart_noop_legend_real_draw (LiveChartLegend* base,
cairo_t* ctx,
LiveChartConfig* config)
{
LiveChartNoopLegend * self;
#line 97 "../src/legend.vala"
self = (LiveChartNoopLegend*) base;
#line 97 "../src/legend.vala"
g_return_if_fail (ctx != NULL);
#line 97 "../src/legend.vala"
g_return_if_fail (config != NULL);
#line 993 "legend.c"
}
LiveChartNoopLegend*
live_chart_noop_legend_construct (GType object_type)
{
LiveChartNoopLegend * self = NULL;
#line 96 "../src/legend.vala"
self = (LiveChartNoopLegend*) live_chart_legend_construct (object_type);
#line 96 "../src/legend.vala"
return self;
#line 1004 "legend.c"
}
LiveChartNoopLegend*
live_chart_noop_legend_new (void)
{
#line 96 "../src/legend.vala"
return live_chart_noop_legend_construct (LIVE_CHART_TYPE_NOOP_LEGEND);
#line 1012 "legend.c"
}
static void
live_chart_noop_legend_class_init (LiveChartNoopLegendClass * klass,
gpointer klass_data)
{
#line 96 "../src/legend.vala"
live_chart_noop_legend_parent_class = g_type_class_peek_parent (klass);
#line 96 "../src/legend.vala"
((LiveChartLegendClass *) klass)->draw = (void (*) (LiveChartLegend*, cairo_t*, LiveChartConfig*)) live_chart_noop_legend_real_draw;
#line 1023 "legend.c"
}
static void
live_chart_noop_legend_instance_init (LiveChartNoopLegend * self,
gpointer klass)
{
}
static GType
live_chart_noop_legend_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartNoopLegendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_noop_legend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartNoopLegend), 0, (GInstanceInitFunc) live_chart_noop_legend_instance_init, NULL };
GType live_chart_noop_legend_type_id;
live_chart_noop_legend_type_id = g_type_register_static (LIVE_CHART_TYPE_LEGEND, "LiveChartNoopLegend", &g_define_type_info, 0);
return live_chart_noop_legend_type_id;
}
GType
live_chart_noop_legend_get_type (void)
{
static volatile gsize live_chart_noop_legend_type_id__once = 0;
if (g_once_init_enter (&live_chart_noop_legend_type_id__once)) {
GType live_chart_noop_legend_type_id;
live_chart_noop_legend_type_id = live_chart_noop_legend_get_type_once ();
g_once_init_leave (&live_chart_noop_legend_type_id__once, live_chart_noop_legend_type_id);
}
return live_chart_noop_legend_type_id__once;
}