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

/*
Copyright (C) 2015 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library 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 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.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

enum  {
	BIRD_FONT_HIDDEN_TOOLS_0_PROPERTY,
	BIRD_FONT_HIDDEN_TOOLS_NUM_PROPERTIES
};
static GParamSpec* bird_font_hidden_tools_properties[BIRD_FONT_HIDDEN_TOOLS_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))

static gpointer bird_font_hidden_tools_parent_class = NULL;
BirdFontTool* bird_font_hidden_tools_bezier_line = NULL;
BirdFontTool* bird_font_hidden_tools_bezier_corner = NULL;
BirdFontTool* bird_font_hidden_tools_move_along_axis = NULL;

static void __lambda135_ (BirdFontHiddenTools* self,
                   BirdFontTool* _self_);
static void ___lambda135__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static void __lambda136_ (BirdFontHiddenTools* self,
                   BirdFontTool* _self_);
static void ___lambda136__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static void __lambda137_ (BirdFontHiddenTools* self,
                   BirdFontTool* _self_);
static void ___lambda137__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static void __lambda148_ (BirdFontHiddenTools* self,
                   BirdFontTool* _self_);
static void ___lambda148__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static void __lambda149_ (BirdFontHiddenTools* self,
                   BirdFontTool* _self_);
static void ___lambda149__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static GeeArrayList* bird_font_hidden_tools_real_get_expanders (BirdFontToolCollection* base);
static void bird_font_hidden_tools_finalize (GObject * obj);
static GType bird_font_hidden_tools_get_type_once (void);

static void
__lambda135_ (BirdFontHiddenTools* self,
              BirdFontTool* _self_)
{
	BirdFontZoomTool* _tmp0_;
	BirdFontFontDisplay* _tmp1_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_drawing_tools_zoom_tool;
	bird_font_zoom_tool_store_current_view (_tmp0_);
	_tmp1_ = bird_font_glyph_canvas_current_display;
	bird_font_font_display_zoom_in (_tmp1_);
}

static void
___lambda135__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda135_ ((BirdFontHiddenTools*) self, selected);
}

static void
__lambda136_ (BirdFontHiddenTools* self,
              BirdFontTool* _self_)
{
	BirdFontZoomTool* _tmp0_;
	BirdFontFontDisplay* _tmp1_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_drawing_tools_zoom_tool;
	bird_font_zoom_tool_store_current_view (_tmp0_);
	_tmp1_ = bird_font_glyph_canvas_current_display;
	bird_font_font_display_zoom_out (_tmp1_);
}

static void
___lambda136__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda136_ ((BirdFontHiddenTools*) self, selected);
}

static void
__lambda137_ (BirdFontHiddenTools* self,
              BirdFontTool* _self_)
{
	BirdFontBezierTool* _tmp0_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_drawing_tools_bezier_tool;
	bird_font_bezier_tool_switch_to_line_mode (_tmp0_);
}

static void
___lambda137__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda137_ ((BirdFontHiddenTools*) self, selected);
}

static void
__lambda148_ (BirdFontHiddenTools* self,
              BirdFontTool* _self_)
{
	BirdFontBezierTool* _tmp0_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_drawing_tools_bezier_tool;
	bird_font_bezier_tool_create_corner (_tmp0_);
}

static void
___lambda148__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda148_ ((BirdFontHiddenTools*) self, selected);
}

static void
__lambda149_ (BirdFontHiddenTools* self,
              BirdFontTool* _self_)
{
	BirdFontTool* t = NULL;
	BirdFontToolbox* _tmp0_;
	BirdFontToolbox* _tmp1_;
	BirdFontTool* _tmp2_;
	BirdFontTool* _tmp3_;
	BirdFontTool* _tmp4_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_main_window_get_toolbox ();
	_tmp1_ = _tmp0_;
	_tmp2_ = bird_font_toolbox_get_current_tool (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	t = _tmp3_;
	_tmp4_ = t;
	if (BIRD_FONT_IS_BEZIER_TOOL (_tmp4_)) {
		BirdFontBezierTool* _tmp5_;
		_tmp5_ = bird_font_drawing_tools_bezier_tool;
		bird_font_bezier_tool_move_handle_on_axis (_tmp5_);
	} else {
		gboolean _tmp6_ = FALSE;
		BirdFontTool* _tmp7_;
		_tmp7_ = t;
		if (BIRD_FONT_IS_PEN_TOOL (_tmp7_)) {
			_tmp6_ = TRUE;
		} else {
			BirdFontTool* _tmp8_;
			_tmp8_ = t;
			_tmp6_ = BIRD_FONT_IS_POINT_TOOL (_tmp8_);
		}
		if (_tmp6_) {
			bird_font_pen_tool_move_handle_on_axis ();
		} else {
			BirdFontTool* _tmp9_;
			_tmp9_ = t;
			if (BIRD_FONT_IS_BACKGROUND_TOOL (_tmp9_)) {
				bird_font_background_tool_move_handle_on_axis ();
			}
		}
	}
	_g_object_unref0 (t);
}

static void
___lambda149__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda149_ ((BirdFontHiddenTools*) self, selected);
}

BirdFontHiddenTools*
bird_font_hidden_tools_construct (GType object_type)
{
	BirdFontHiddenTools * self = NULL;
	BirdFontExpander* _tmp0_;
	GeeArrayList* _tmp1_;
	BirdFontTool* zoom_in = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	BirdFontTool* _tmp4_;
	BirdFontTool* _tmp5_;
	BirdFontExpander* _tmp6_;
	BirdFontTool* zoom_out = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_;
	BirdFontTool* _tmp9_;
	BirdFontTool* _tmp10_;
	BirdFontExpander* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	BirdFontTool* _tmp14_;
	BirdFontTool* _tmp15_;
	BirdFontTool* _tmp16_;
	BirdFontExpander* _tmp17_;
	BirdFontTool* _tmp18_;
	BirdFontTool* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	BirdFontTool* _tmp22_;
	BirdFontTool* _tmp23_;
	BirdFontTool* _tmp24_;
	BirdFontExpander* _tmp25_;
	BirdFontTool* _tmp26_;
	BirdFontTool* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	BirdFontTool* _tmp30_;
	BirdFontTool* _tmp31_;
	BirdFontTool* _tmp32_;
	BirdFontExpander* _tmp33_;
	BirdFontTool* _tmp34_;
	BirdFontTool* _tmp35_;
	GeeArrayList* _tmp36_;
	BirdFontExpander* _tmp37_;
	self = (BirdFontHiddenTools*) bird_font_tool_collection_construct (object_type);
	_tmp0_ = bird_font_expander_new (NULL);
	_g_object_unref0 (self->hidden_expander);
	self->hidden_expander = _tmp0_;
	_tmp1_ = gee_array_list_new (BIRD_FONT_TYPE_EXPANDER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->expanders);
	self->expanders = _tmp1_;
	_tmp2_ = bird_font_t_ ("Zoom in");
	_tmp3_ = _tmp2_;
	_tmp4_ = bird_font_tool_new ("zoom_in", _tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	zoom_in = _tmp5_;
	g_signal_connect_object (zoom_in, "select-action", (GCallback) ___lambda135__bird_font_tool_select_action, self, 0);
	_tmp6_ = self->hidden_expander;
	bird_font_expander_add_tool (_tmp6_, zoom_in, -1);
	_tmp7_ = bird_font_t_ ("Zoom out");
	_tmp8_ = _tmp7_;
	_tmp9_ = bird_font_tool_new ("zoom_out", _tmp8_);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	zoom_out = _tmp10_;
	g_signal_connect_object (zoom_out, "select-action", (GCallback) ___lambda136__bird_font_tool_select_action, self, 0);
	_tmp11_ = self->hidden_expander;
	bird_font_expander_add_tool (_tmp11_, zoom_out, -1);
	_tmp12_ = bird_font_t_ ("Convert the last segment to a straight line");
	_tmp13_ = _tmp12_;
	_tmp14_ = bird_font_tool_new ("bezier_line", _tmp13_);
	_g_object_unref0 (bird_font_hidden_tools_bezier_line);
	bird_font_hidden_tools_bezier_line = _tmp14_;
	_g_free0 (_tmp13_);
	_tmp15_ = bird_font_hidden_tools_bezier_line;
	g_signal_connect_object (_tmp15_, "select-action", (GCallback) ___lambda137__bird_font_tool_select_action, self, 0);
	_tmp16_ = bird_font_hidden_tools_bezier_line;
	_tmp16_->is_tool_modifier = TRUE;
	_tmp17_ = self->hidden_expander;
	_tmp18_ = bird_font_hidden_tools_bezier_line;
	bird_font_expander_add_tool (_tmp17_, _tmp18_, -1);
	_tmp19_ = bird_font_hidden_tools_bezier_line;
	bird_font_tool_set_tool_visibility (_tmp19_, FALSE);
	_tmp20_ = bird_font_t_ ("Convert the last control point to a corner node");
	_tmp21_ = _tmp20_;
	_tmp22_ = bird_font_tool_new ("bezier_corner", _tmp21_);
	_g_object_unref0 (bird_font_hidden_tools_bezier_corner);
	bird_font_hidden_tools_bezier_corner = _tmp22_;
	_g_free0 (_tmp21_);
	_tmp23_ = bird_font_hidden_tools_bezier_corner;
	g_signal_connect_object (_tmp23_, "select-action", (GCallback) ___lambda148__bird_font_tool_select_action, self, 0);
	_tmp24_ = bird_font_hidden_tools_bezier_corner;
	_tmp24_->is_tool_modifier = TRUE;
	_tmp25_ = self->hidden_expander;
	_tmp26_ = bird_font_hidden_tools_bezier_corner;
	bird_font_expander_add_tool (_tmp25_, _tmp26_, -1);
	_tmp27_ = bird_font_hidden_tools_bezier_corner;
	bird_font_tool_set_tool_visibility (_tmp27_, FALSE);
	_tmp28_ = bird_font_t_ ("Move handle along axis");
	_tmp29_ = _tmp28_;
	_tmp30_ = bird_font_tool_new ("bezier", _tmp29_);
	_g_object_unref0 (bird_font_hidden_tools_move_along_axis);
	bird_font_hidden_tools_move_along_axis = _tmp30_;
	_g_free0 (_tmp29_);
	_tmp31_ = bird_font_hidden_tools_move_along_axis;
	g_signal_connect_object (_tmp31_, "select-action", (GCallback) ___lambda149__bird_font_tool_select_action, self, 0);
	_tmp32_ = bird_font_hidden_tools_move_along_axis;
	_tmp32_->is_tool_modifier = TRUE;
	_tmp33_ = self->hidden_expander;
	_tmp34_ = bird_font_hidden_tools_move_along_axis;
	bird_font_expander_add_tool (_tmp33_, _tmp34_, -1);
	_tmp35_ = bird_font_hidden_tools_move_along_axis;
	bird_font_tool_set_tool_visibility (_tmp35_, FALSE);
	_tmp36_ = self->expanders;
	_tmp37_ = self->hidden_expander;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, _tmp37_);
	_g_object_unref0 (zoom_out);
	_g_object_unref0 (zoom_in);
	return self;
}

BirdFontHiddenTools*
bird_font_hidden_tools_new (void)
{
	return bird_font_hidden_tools_construct (BIRD_FONT_TYPE_HIDDEN_TOOLS);
}

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

static GeeArrayList*
bird_font_hidden_tools_real_get_expanders (BirdFontToolCollection* base)
{
	BirdFontHiddenTools * self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* result;
	self = (BirdFontHiddenTools*) base;
	_tmp0_ = self->expanders;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
bird_font_hidden_tools_class_init (BirdFontHiddenToolsClass * klass,
                                   gpointer klass_data)
{
	bird_font_hidden_tools_parent_class = g_type_class_peek_parent (klass);
	((BirdFontToolCollectionClass *) klass)->get_expanders = (GeeArrayList* (*) (BirdFontToolCollection*)) bird_font_hidden_tools_real_get_expanders;
	G_OBJECT_CLASS (klass)->finalize = bird_font_hidden_tools_finalize;
}

static void
bird_font_hidden_tools_instance_init (BirdFontHiddenTools * self,
                                      gpointer klass)
{
}

static void
bird_font_hidden_tools_finalize (GObject * obj)
{
	BirdFontHiddenTools * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_HIDDEN_TOOLS, BirdFontHiddenTools);
	_g_object_unref0 (self->expanders);
	_g_object_unref0 (self->hidden_expander);
	G_OBJECT_CLASS (bird_font_hidden_tools_parent_class)->finalize (obj);
}

static GType
bird_font_hidden_tools_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontHiddenToolsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_hidden_tools_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontHiddenTools), 0, (GInstanceInitFunc) bird_font_hidden_tools_instance_init, NULL };
	GType bird_font_hidden_tools_type_id;
	bird_font_hidden_tools_type_id = g_type_register_static (BIRD_FONT_TYPE_TOOL_COLLECTION, "BirdFontHiddenTools", &g_define_type_info, 0);
	return bird_font_hidden_tools_type_id;
}

GType
bird_font_hidden_tools_get_type (void)
{
	static volatile gsize bird_font_hidden_tools_type_id__once = 0;
	if (g_once_init_enter (&bird_font_hidden_tools_type_id__once)) {
		GType bird_font_hidden_tools_type_id;
		bird_font_hidden_tools_type_id = bird_font_hidden_tools_get_type_once ();
		g_once_init_leave (&bird_font_hidden_tools_type_id__once, bird_font_hidden_tools_type_id);
	}
	return bird_font_hidden_tools_type_id__once;
}

