/* NodeAlign.c generated by valac 0.56.19, the Vala compiler
 * generated from NodeAlign.vala, do not modify */

/*
* Copyright (c) 2018-2026 (https://github.com/phase1geo/Minder)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Trevor Williams <phase1geo@gmail.com>
*/

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef enum  {
	NODE_ALIGN_TYPE_TOP = 0,
	NODE_ALIGN_TYPE_BOTTOM,
	NODE_ALIGN_TYPE_LEFT,
	NODE_ALIGN_TYPE_RIGHT,
	NODE_ALIGN_TYPE_HCENTER,
	NODE_ALIGN_TYPE_VCENTER
} NodeAlignType;

#define TYPE_NODE_ALIGN_TYPE (node_align_type_get_type ())

#define TYPE_NODE_ALIGN (node_align_get_type ())
#define NODE_ALIGN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_ALIGN, NodeAlign))
#define NODE_ALIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_ALIGN, NodeAlignClass))
#define IS_NODE_ALIGN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_ALIGN))
#define IS_NODE_ALIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_ALIGN))
#define NODE_ALIGN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_ALIGN, NodeAlignClass))

typedef struct _NodeAlign NodeAlign;
typedef struct _NodeAlignClass NodeAlignClass;
typedef struct _NodeAlignPrivate NodeAlignPrivate;

#define TYPE_MIND_MAP (mind_map_get_type ())
#define MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MIND_MAP, MindMap))
#define MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MIND_MAP, MindMapClass))
#define IS_MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MIND_MAP))
#define IS_MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MIND_MAP))
#define MIND_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MIND_MAP, MindMapClass))

typedef struct _MindMap MindMap;
typedef struct _MindMapClass MindMapClass;

#define TYPE_NODE (node_get_type ())
#define NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE, Node))
#define NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE, NodeClass))
#define IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE))
#define IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE))
#define NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE, NodeClass))

typedef struct _Node Node;
typedef struct _NodeClass NodeClass;
typedef void (*NodeAlignNodeAlignFunc) (Node* first, Node* node, gpointer user_data);

#define TYPE_UNDO_BUFFER (undo_buffer_get_type ())
#define UNDO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_BUFFER, UndoBuffer))
#define UNDO_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_BUFFER, UndoBufferClass))
#define IS_UNDO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_BUFFER))
#define IS_UNDO_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_BUFFER))
#define UNDO_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_BUFFER, UndoBufferClass))

typedef struct _UndoBuffer UndoBuffer;
typedef struct _UndoBufferClass UndoBufferClass;

#define TYPE_UNDO_ITEM (undo_item_get_type ())
#define UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_ITEM, UndoItem))
#define UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_ITEM, UndoItemClass))
#define IS_UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_ITEM))
#define IS_UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_ITEM))
#define UNDO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_ITEM, UndoItemClass))

typedef struct _UndoItem UndoItem;
typedef struct _UndoItemClass UndoItemClass;

#define TYPE_UNDO_NODES_ALIGN (undo_nodes_align_get_type ())
#define UNDO_NODES_ALIGN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_ALIGN, UndoNodesAlign))
#define UNDO_NODES_ALIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_ALIGN, UndoNodesAlignClass))
#define IS_UNDO_NODES_ALIGN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_ALIGN))
#define IS_UNDO_NODES_ALIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_ALIGN))
#define UNDO_NODES_ALIGN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_ALIGN, UndoNodesAlignClass))

typedef struct _UndoNodesAlign UndoNodesAlign;
typedef struct _UndoNodesAlignClass UndoNodesAlignClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_ANIMATOR (animator_get_type ())
#define ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ANIMATOR, Animator))
#define ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ANIMATOR, AnimatorClass))
#define IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ANIMATOR))
#define IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ANIMATOR))
#define ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ANIMATOR, AnimatorClass))

typedef struct _Animator Animator;
typedef struct _AnimatorClass AnimatorClass;
typedef enum  {
	NODE_SIDE_LEFT = 1,
	NODE_SIDE_TOP = 2,
	NODE_SIDE_RIGHT = 4,
	NODE_SIDE_BOTTOM = 8
} NodeSide;

#define TYPE_NODE_SIDE (node_side_get_type ())

#define TYPE_LAYOUT (layout_get_type ())
#define LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LAYOUT, Layout))
#define LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LAYOUT, LayoutClass))
#define IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LAYOUT))
#define IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LAYOUT))
#define LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LAYOUT, LayoutClass))

typedef struct _Layout Layout;
typedef struct _LayoutClass LayoutClass;
typedef struct _ParamSpecNodeAlign ParamSpecNodeAlign;

struct _NodeAlign {
	GTypeInstance parent_instance;
	volatile int ref_count;
	NodeAlignPrivate * priv;
};

struct _NodeAlignClass {
	GTypeClass parent_class;
	void (*finalize) (NodeAlign *self);
};

struct _ParamSpecNodeAlign {
	GParamSpec parent_instance;
};

static gpointer node_align_parent_class = NULL;

VALA_EXTERN GType node_align_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gpointer node_align_ref (gpointer instance);
VALA_EXTERN void node_align_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_align (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_node_align (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_node_align (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_node_align (const GValue* value);
VALA_EXTERN GType node_align_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeAlign, node_align_unref)
VALA_EXTERN gpointer mind_map_ref (gpointer instance);
VALA_EXTERN void mind_map_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_mind_map (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_mind_map (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_mind_map (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_mind_map (const GValue* value);
VALA_EXTERN GType mind_map_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MindMap, mind_map_unref)
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
static void node_align_align_to (MindMap* map,
                          GArray* nodes,
                          NodeAlignNodeAlignFunc align_func,
                          gpointer align_func_target);
VALA_EXTERN GType undo_buffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoBuffer, g_object_unref)
VALA_EXTERN UndoBuffer* mind_map_get_undo_buffer (MindMap* self);
VALA_EXTERN GType undo_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoItem, g_object_unref)
VALA_EXTERN void undo_buffer_add_item (UndoBuffer* self,
                           UndoItem* item);
VALA_EXTERN UndoNodesAlign* undo_nodes_align_new (GArray* nodes);
VALA_EXTERN UndoNodesAlign* undo_nodes_align_construct (GType object_type,
                                            GArray* nodes);
VALA_EXTERN GType undo_nodes_align_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesAlign, g_object_unref)
VALA_EXTERN GType animator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Animator, g_object_unref)
VALA_EXTERN Animator* mind_map_get_animator (MindMap* self);
VALA_EXTERN void animator_add_nodes (Animator* self,
                         GArray* n,
                         gboolean exclude_selected,
                         const gchar* name);
VALA_EXTERN GType node_side_get_type (void) G_GNUC_CONST ;
VALA_EXTERN NodeSide node_get_side (Node* self);
VALA_EXTERN void node_set_side (Node* self,
                    NodeSide value);
VALA_EXTERN GType layout_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Layout, g_object_unref)
VALA_EXTERN Layout* node_get_layout (Node* self);
VALA_EXTERN void layout_propagate_side (Layout* self,
                            Node* parent,
                            NodeSide side);
VALA_EXTERN void animator_animate (Animator* self);
VALA_EXTERN void mind_map_auto_save (MindMap* self);
VALA_EXTERN void node_align_align_top (MindMap* map,
                           GArray* nodes);
static void __lambda113_ (Node* first,
                   Node* node);
VALA_EXTERN gdouble node_get_posy (Node* self);
VALA_EXTERN void node_set_posy (Node* self,
                    gdouble value);
static void ___lambda113__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN void node_align_align_bottom (MindMap* map,
                              GArray* nodes);
static void __lambda114_ (Node* first,
                   Node* node);
VALA_EXTERN gdouble node_get_height (Node* self);
static void ___lambda114__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN void node_align_align_left (MindMap* map,
                            GArray* nodes);
static void __lambda115_ (Node* first,
                   Node* node);
VALA_EXTERN gdouble node_get_posx (Node* self);
VALA_EXTERN void node_set_posx (Node* self,
                    gdouble value);
static void ___lambda115__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN void node_align_align_right (MindMap* map,
                             GArray* nodes);
static void __lambda116_ (Node* first,
                   Node* node);
VALA_EXTERN gdouble node_get_width (Node* self);
static void ___lambda116__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN void node_align_align_hcenter (MindMap* map,
                               GArray* nodes);
static void __lambda117_ (Node* first,
                   Node* node);
static void ___lambda117__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN void node_align_align_vcenter (MindMap* map,
                               GArray* nodes);
static void __lambda118_ (Node* first,
                   Node* node);
static void ___lambda118__node_align_node_align_func (Node* first,
                                               Node* node,
                                               gpointer self);
VALA_EXTERN NodeAlign* node_align_new (void);
VALA_EXTERN NodeAlign* node_align_construct (GType object_type);
static void node_align_finalize (NodeAlign * obj);
static GType node_align_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
node_align_type_get_type_once (void)
{
	static const GEnumValue values[] = {{NODE_ALIGN_TYPE_TOP, "NODE_ALIGN_TYPE_TOP", "top"}, {NODE_ALIGN_TYPE_BOTTOM, "NODE_ALIGN_TYPE_BOTTOM", "bottom"}, {NODE_ALIGN_TYPE_LEFT, "NODE_ALIGN_TYPE_LEFT", "left"}, {NODE_ALIGN_TYPE_RIGHT, "NODE_ALIGN_TYPE_RIGHT", "right"}, {NODE_ALIGN_TYPE_HCENTER, "NODE_ALIGN_TYPE_HCENTER", "hcenter"}, {NODE_ALIGN_TYPE_VCENTER, "NODE_ALIGN_TYPE_VCENTER", "vcenter"}, {0, NULL, NULL}};
	GType node_align_type_type_id;
	node_align_type_type_id = g_enum_register_static ("NodeAlignType", values);
	return node_align_type_type_id;
}

GType
node_align_type_get_type (void)
{
	static volatile gsize node_align_type_type_id__once = 0;
	if (g_once_init_enter (&node_align_type_type_id__once)) {
		GType node_align_type_type_id;
		node_align_type_type_id = node_align_type_get_type_once ();
		g_once_init_leave (&node_align_type_type_id__once, node_align_type_type_id);
	}
	return node_align_type_type_id__once;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
node_align_align_to (MindMap* map,
                     GArray* nodes,
                     NodeAlignNodeAlignFunc align_func,
                     gpointer align_func_target)
{
	UndoBuffer* _tmp0_;
	UndoBuffer* _tmp1_;
	UndoNodesAlign* _tmp2_;
	UndoNodesAlign* _tmp3_;
	Animator* _tmp4_;
	Animator* _tmp5_;
	Node* first = NULL;
	Node* _tmp6_;
	Node* _tmp7_;
	Animator* _tmp31_;
	Animator* _tmp32_;
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	_tmp0_ = mind_map_get_undo_buffer (map);
	_tmp1_ = _tmp0_;
	_tmp2_ = undo_nodes_align_new (nodes);
	_tmp3_ = _tmp2_;
	undo_buffer_add_item (_tmp1_, (UndoItem*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = mind_map_get_animator (map);
	_tmp5_ = _tmp4_;
	animator_add_nodes (_tmp5_, nodes, FALSE, "align_to");
	_tmp6_ = g_array_index (nodes, Node*, (guint) 0);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	first = _tmp7_;
	{
		gint i = 0;
		i = 1;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				Node* node = NULL;
				Node* _tmp10_;
				Node* _tmp11_;
				Node* _tmp12_;
				Node* _tmp13_;
				Node* _tmp14_;
				NodeSide _tmp15_;
				NodeSide _tmp16_;
				Node* _tmp17_;
				NodeSide _tmp18_;
				NodeSide _tmp19_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp10_ = g_array_index (nodes, Node*, (guint) i);
				_tmp11_ = _g_object_ref0 (_tmp10_);
				node = _tmp11_;
				_tmp12_ = first;
				_tmp13_ = node;
				align_func (_tmp12_, _tmp13_, align_func_target);
				_tmp14_ = node;
				_tmp15_ = node_get_side (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = first;
				_tmp18_ = node_get_side (_tmp17_);
				_tmp19_ = _tmp18_;
				if (_tmp16_ != _tmp19_) {
					Node* _tmp20_;
					Node* _tmp21_;
					NodeSide _tmp22_;
					NodeSide _tmp23_;
					Node* _tmp24_;
					Layout* _tmp25_;
					Layout* _tmp26_;
					Node* _tmp27_;
					Node* _tmp28_;
					NodeSide _tmp29_;
					NodeSide _tmp30_;
					_tmp20_ = node;
					_tmp21_ = first;
					_tmp22_ = node_get_side (_tmp21_);
					_tmp23_ = _tmp22_;
					node_set_side (_tmp20_, _tmp23_);
					_tmp24_ = node;
					_tmp25_ = node_get_layout (_tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = node;
					_tmp28_ = first;
					_tmp29_ = node_get_side (_tmp28_);
					_tmp30_ = _tmp29_;
					layout_propagate_side (_tmp26_, _tmp27_, _tmp30_);
				}
				_g_object_unref0 (node);
			}
		}
	}
	_tmp31_ = mind_map_get_animator (map);
	_tmp32_ = _tmp31_;
	animator_animate (_tmp32_);
	mind_map_auto_save (map);
	_g_object_unref0 (first);
}

static void
__lambda113_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posy (first);
	_tmp1_ = _tmp0_;
	node_set_posy (node, _tmp1_);
}

static void
___lambda113__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda113_ (first, node);
}

void
node_align_align_top (MindMap* map,
                      GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda113__node_align_node_align_func, NULL);
}

static void
__lambda114_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posy (first);
	_tmp1_ = _tmp0_;
	_tmp2_ = node_get_height (first);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_get_height (node);
	_tmp5_ = _tmp4_;
	node_set_posy (node, (_tmp1_ + _tmp3_) - _tmp5_);
}

static void
___lambda114__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda114_ (first, node);
}

void
node_align_align_bottom (MindMap* map,
                         GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda114__node_align_node_align_func, NULL);
}

static void
__lambda115_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posx (first);
	_tmp1_ = _tmp0_;
	node_set_posx (node, _tmp1_);
}

static void
___lambda115__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda115_ (first, node);
}

void
node_align_align_left (MindMap* map,
                       GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda115__node_align_node_align_func, NULL);
}

static void
__lambda116_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posx (first);
	_tmp1_ = _tmp0_;
	_tmp2_ = node_get_width (first);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_get_width (node);
	_tmp5_ = _tmp4_;
	node_set_posx (node, (_tmp1_ + _tmp3_) - _tmp5_);
}

static void
___lambda116__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda116_ (first, node);
}

void
node_align_align_right (MindMap* map,
                        GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda116__node_align_node_align_func, NULL);
}

static void
__lambda117_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posx (first);
	_tmp1_ = _tmp0_;
	_tmp2_ = node_get_width (first);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_get_width (node);
	_tmp5_ = _tmp4_;
	node_set_posx (node, (_tmp1_ + (_tmp3_ / 2)) - (_tmp5_ / 2));
}

static void
___lambda117__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda117_ (first, node);
}

void
node_align_align_hcenter (MindMap* map,
                          GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda117__node_align_node_align_func, NULL);
}

static void
__lambda118_ (Node* first,
              Node* node)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	g_return_if_fail (first != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node_get_posy (first);
	_tmp1_ = _tmp0_;
	_tmp2_ = node_get_height (first);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_get_height (node);
	_tmp5_ = _tmp4_;
	node_set_posy (node, (_tmp1_ + (_tmp3_ / 2)) - (_tmp5_ / 2));
}

static void
___lambda118__node_align_node_align_func (Node* first,
                                          Node* node,
                                          gpointer self)
{
	__lambda118_ (first, node);
}

void
node_align_align_vcenter (MindMap* map,
                          GArray* nodes)
{
	g_return_if_fail (map != NULL);
	g_return_if_fail (nodes != NULL);
	node_align_align_to (map, nodes, ___lambda118__node_align_node_align_func, NULL);
}

NodeAlign*
node_align_construct (GType object_type)
{
	NodeAlign* self = NULL;
	self = (NodeAlign*) g_type_create_instance (object_type);
	return self;
}

NodeAlign*
node_align_new (void)
{
	return node_align_construct (TYPE_NODE_ALIGN);
}

static void
value_node_align_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_node_align_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		node_align_unref (value->data[0].v_pointer);
	}
}

static void
value_node_align_copy_value (const GValue* src_value,
                             GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = node_align_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_node_align_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_node_align_collect_value (GValue* value,
                                guint n_collect_values,
                                GTypeCValue* collect_values,
                                guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		NodeAlign * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = node_align_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_node_align_lcopy_value (const GValue* value,
                              guint n_collect_values,
                              GTypeCValue* collect_values,
                              guint collect_flags)
{
	NodeAlign ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = node_align_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_node_align (const gchar* name,
                       const gchar* nick,
                       const gchar* blurb,
                       GType object_type,
                       GParamFlags flags)
{
	ParamSpecNodeAlign* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_NODE_ALIGN), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_node_align (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_NODE_ALIGN), NULL);
	return value->data[0].v_pointer;
}

void
value_set_node_align (GValue* value,
                      gpointer v_object)
{
	NodeAlign * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_NODE_ALIGN));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_NODE_ALIGN));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		node_align_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		node_align_unref (old);
	}
}

void
value_take_node_align (GValue* value,
                       gpointer v_object)
{
	NodeAlign * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_NODE_ALIGN));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_NODE_ALIGN));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		node_align_unref (old);
	}
}

static void
node_align_class_init (NodeAlignClass * klass,
                       gpointer klass_data)
{
	node_align_parent_class = g_type_class_peek_parent (klass);
	((NodeAlignClass *) klass)->finalize = node_align_finalize;
}

static void
node_align_instance_init (NodeAlign * self,
                          gpointer klass)
{
	self->ref_count = 1;
}

static void
node_align_finalize (NodeAlign * obj)
{
	NodeAlign * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NODE_ALIGN, NodeAlign);
	g_signal_handlers_destroy (self);
}

static GType
node_align_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_node_align_init, value_node_align_free_value, value_node_align_copy_value, value_node_align_peek_pointer, "p", value_node_align_collect_value, "p", value_node_align_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (NodeAlignClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) node_align_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NodeAlign), 0, (GInstanceInitFunc) node_align_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType node_align_type_id;
	node_align_type_id = g_type_register_fundamental (g_type_fundamental_next (), "NodeAlign", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return node_align_type_id;
}

GType
node_align_get_type (void)
{
	static volatile gsize node_align_type_id__once = 0;
	if (g_once_init_enter (&node_align_type_id__once)) {
		GType node_align_type_id;
		node_align_type_id = node_align_get_type_once ();
		g_once_init_leave (&node_align_type_id__once, node_align_type_id);
	}
	return node_align_type_id__once;
}

gpointer
node_align_ref (gpointer instance)
{
	NodeAlign * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
node_align_unref (gpointer instance)
{
	NodeAlign * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		NODE_ALIGN_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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;
}

