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

/*
Copyright (C) 2012 2014 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 <glib.h>
#include <float.h>
#include <math.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.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_MAIN_WINDOW_0_PROPERTY,
	BIRD_FONT_MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* bird_font_main_window_properties[BIRD_FONT_MAIN_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _bird_font_char_database_unref0(var) ((var == NULL) ? NULL : (var = (bird_font_char_database_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_source_unref0(var) ((var == NULL) ? NULL : (var = (g_source_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

static gpointer bird_font_main_window_parent_class = NULL;
BirdFontToolbox* bird_font_main_window_tools = NULL;
BirdFontGlyphCanvas* bird_font_main_window_glyph_canvas = NULL;
BirdFontMainWindow* bird_font_main_window_singleton = NULL;
BirdFontMenuTab* bird_font_main_window_menu_tab = NULL;
BirdFontRecentFiles* bird_font_main_window_file_tab = NULL;
BirdFontOverview* bird_font_main_window_overview = NULL;
BirdFontTabBar* bird_font_main_window_tabs = NULL;
BirdFontNativeWindow* bird_font_main_window_native_window = NULL;
BirdFontKerningDisplay* bird_font_main_window_kerning_display = NULL;
BirdFontCharDatabase* bird_font_main_window_character_database = NULL;
BirdFontLigatureList* bird_font_main_window_ligature_display = NULL;
BirdFontSpacingClassTab* bird_font_main_window_spacing_class_tab = NULL;
BirdFontAbstractMenu* bird_font_main_window_menu = NULL;
BirdFontDialog* bird_font_main_window_dialog = NULL;
BirdFontSpacingTab* bird_font_main_window_spacing_tab = NULL;
BirdFontTask* bird_font_main_window_blocking_background_task = NULL;
BirdFontScrollbar* bird_font_main_window_scrollbar = NULL;
gdouble bird_font_main_window_units = (gdouble) 1;
static gdouble bird_font_main_window_scrollbar_size;
static gdouble bird_font_main_window_scrollbar_size = (gdouble) -1;

static gboolean __lambda520_ (void);
static gboolean ___lambda520__gsource_func (gpointer self);
static gboolean __lambda532_ (void);
static gboolean ___lambda532__gsource_func (gpointer self);
static void __lambda540_ (const gchar* text);
static void ___lambda540__bird_font_text_listener_signal_text_input (BirdFontTextListener* _sender,
                                                              const gchar* text,
                                                              gpointer self);
static void __lambda541_ (void);
static void ___lambda541__bird_font_text_listener_signal_submit (BirdFontTextListener* _sender,
                                                          const gchar* text,
                                                          gpointer self);
static void bird_font_main_window_finalize (GObject * obj);
static GType bird_font_main_window_get_type_once (void);

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

BirdFontMainWindow*
bird_font_main_window_construct (GType object_type)
{
	BirdFontMainWindow * self = NULL;
	BirdFontMainWindow* _tmp0_;
	BirdFontGlyphCanvas* _tmp1_;
	BirdFontTabBar* _tmp2_;
	BirdFontGlyphCanvas* _tmp3_;
	BirdFontTabBar* _tmp4_;
	BirdFontToolbox* _tmp5_;
	BirdFontMenuTab* _tmp6_;
	BirdFontRecentFiles* _tmp7_;
	BirdFontOverview* _tmp8_;
	BirdFontKerningDisplay* _tmp9_;
	BirdFontCharDatabase* _tmp10_;
	BirdFontLigatureList* _tmp11_;
	BirdFontSpacingClassTab* _tmp12_;
	BirdFontMenu* _tmp13_;
	BirdFontDialog* _tmp14_;
	BirdFontSpacingTab* _tmp15_;
	BirdFontTask* _tmp16_;
	BirdFontScrollbar* _tmp17_;
	BirdFontToolbox* _tmp18_;
	BirdFontBezierTool* _tmp19_;
	self = (BirdFontMainWindow*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (self);
	_g_object_unref0 (bird_font_main_window_singleton);
	bird_font_main_window_singleton = _tmp0_;
	_tmp1_ = bird_font_glyph_canvas_new ();
	_g_object_unref0 (bird_font_main_window_glyph_canvas);
	bird_font_main_window_glyph_canvas = _tmp1_;
	_tmp2_ = bird_font_tab_bar_new ();
	_g_object_unref0 (bird_font_main_window_tabs);
	bird_font_main_window_tabs = _tmp2_;
	_tmp3_ = bird_font_main_window_glyph_canvas;
	_tmp4_ = bird_font_main_window_tabs;
	_tmp5_ = bird_font_toolbox_new (_tmp3_, _tmp4_);
	_g_object_unref0 (bird_font_main_window_tools);
	bird_font_main_window_tools = _tmp5_;
	_tmp6_ = bird_font_menu_tab_new ();
	_g_object_unref0 (bird_font_main_window_menu_tab);
	bird_font_main_window_menu_tab = _tmp6_;
	_tmp7_ = bird_font_recent_files_new ();
	_g_object_unref0 (bird_font_main_window_file_tab);
	bird_font_main_window_file_tab = _tmp7_;
	_tmp8_ = bird_font_overview_new (NULL, TRUE, TRUE);
	_g_object_unref0 (bird_font_main_window_overview);
	bird_font_main_window_overview = _tmp8_;
	_tmp9_ = bird_font_kerning_display_new ();
	_g_object_unref0 (bird_font_main_window_kerning_display);
	bird_font_main_window_kerning_display = _tmp9_;
	_tmp10_ = bird_font_char_database_new ();
	_bird_font_char_database_unref0 (bird_font_main_window_character_database);
	bird_font_main_window_character_database = _tmp10_;
	_tmp11_ = bird_font_ligature_list_new ();
	_g_object_unref0 (bird_font_main_window_ligature_display);
	bird_font_main_window_ligature_display = _tmp11_;
	_tmp12_ = bird_font_spacing_class_tab_new ();
	_g_object_unref0 (bird_font_main_window_spacing_class_tab);
	bird_font_main_window_spacing_class_tab = _tmp12_;
	_tmp13_ = bird_font_menu_new ();
	_g_object_unref0 (bird_font_main_window_menu);
	bird_font_main_window_menu = (BirdFontAbstractMenu*) _tmp13_;
	_tmp14_ = bird_font_dialog_new ();
	_g_object_unref0 (bird_font_main_window_dialog);
	bird_font_main_window_dialog = _tmp14_;
	_tmp15_ = bird_font_spacing_tab_new ();
	_g_object_unref0 (bird_font_main_window_spacing_tab);
	bird_font_main_window_spacing_tab = _tmp15_;
	_tmp16_ = bird_font_task_new (NULL, NULL, NULL, FALSE);
	_g_object_unref0 (bird_font_main_window_blocking_background_task);
	bird_font_main_window_blocking_background_task = _tmp16_;
	_tmp17_ = bird_font_scrollbar_new ();
	_g_object_unref0 (bird_font_main_window_scrollbar);
	bird_font_main_window_scrollbar = _tmp17_;
	_tmp18_ = bird_font_main_window_tools;
	_tmp19_ = bird_font_drawing_tools_bezier_tool;
	bird_font_toolbox_select_tool (_tmp18_, (BirdFontTool*) _tmp19_);
	return self;
}

BirdFontMainWindow*
bird_font_main_window_new (void)
{
	return bird_font_main_window_construct (BIRD_FONT_TYPE_MAIN_WINDOW);
}

gboolean
bird_font_main_window_has_scrollbar (void)
{
	BirdFontScrollbar* _tmp0_;
	gboolean result;
	_tmp0_ = bird_font_main_window_scrollbar;
	result = bird_font_scrollbar_is_visible (_tmp0_);
	return result;
}

void
bird_font_main_window_abort_task (void)
{
	BirdFontTask* _tmp0_;
	_tmp0_ = bird_font_main_window_blocking_background_task;
	bird_font_task_cancel (_tmp0_);
}

void
bird_font_main_window_run_blocking_task (BirdFontTask* task)
{
	BirdFontTask* _tmp0_;
	BirdFontNativeWindow* _tmp1_;
	g_return_if_fail (task != NULL);
	_tmp0_ = _g_object_ref0 (task);
	_g_object_unref0 (bird_font_main_window_blocking_background_task);
	bird_font_main_window_blocking_background_task = _tmp0_;
	_tmp1_ = bird_font_main_window_native_window;
	bird_font_native_window_run_background_thread (_tmp1_, task);
}

BirdFontSpacingTab*
bird_font_main_window_get_spacing_tab (void)
{
	BirdFontSpacingTab* _tmp0_;
	BirdFontSpacingTab* _tmp1_;
	BirdFontSpacingTab* result;
	_tmp0_ = bird_font_main_window_spacing_tab;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

BirdFontDialog*
bird_font_main_window_get_dialog (void)
{
	BirdFontDialog* _tmp0_;
	BirdFontDialog* _tmp1_;
	BirdFontDialog* result;
	_tmp0_ = bird_font_main_window_dialog;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
bird_font_main_window_show_dialog (BirdFontDialog* d)
{
	BirdFontTabBar* _tmp0_;
	BirdFontTab* t = NULL;
	BirdFontTabBar* _tmp1_;
	BirdFontTabBar* _tmp2_;
	BirdFontTab* _tmp3_;
	BirdFontTab* _tmp4_;
	gchar* tab_name = NULL;
	BirdFontTab* _tmp5_;
	BirdFontFontDisplay* _tmp6_;
	BirdFontFontDisplay* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	BirdFontDialog* _tmp11_;
	BirdFontDialog* _tmp12_;
	g_return_if_fail (d != NULL);
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	_vala_return_if_fail (!bird_font_is_null (_tmp0_), "!is_null(MainWindow.get_tab_bar ())");
	_tmp1_ = bird_font_main_window_get_tab_bar ();
	_tmp2_ = _tmp1_;
	_tmp3_ = bird_font_tab_bar_get_selected_tab (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp2_);
	t = _tmp4_;
	_tmp5_ = t;
	_tmp6_ = bird_font_tab_get_display (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = bird_font_font_display_get_name (_tmp7_);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp7_);
	tab_name = _tmp9_;
	_tmp10_ = tab_name;
	if (g_strcmp0 (_tmp10_, "Preview") == 0) {
		bird_font_menu_tab_select_overview ();
	}
	_tmp11_ = _g_object_ref0 (d);
	_g_object_unref0 (bird_font_main_window_dialog);
	bird_font_main_window_dialog = _tmp11_;
	_tmp12_ = bird_font_main_window_dialog;
	bird_font_dialog_set_visible (_tmp12_, TRUE);
	bird_font_glyph_canvas_redraw ();
	bird_font_main_window_set_cursor (BIRD_FONT_NATIVE_WINDOW_VISIBLE);
	_g_free0 (tab_name);
	_g_object_unref0 (t);
}

void
bird_font_main_window_show_license_dialog (void)
{
	BirdFontLicenseDialog* _tmp0_;
	BirdFontLicenseDialog* _tmp1_;
	_tmp0_ = bird_font_license_dialog_new ();
	_tmp1_ = _tmp0_;
	bird_font_main_window_show_dialog ((BirdFontDialog*) _tmp1_);
	_g_object_unref0 (_tmp1_);
}

void
bird_font_main_window_set_cursor (gint flags)
{
	if (bird_font_bird_font_has_argument ("--test")) {
		BirdFontDialog* _tmp0_;
		gboolean _tmp1_;
		gboolean _tmp2_;
		_tmp0_ = bird_font_main_window_dialog;
		_tmp1_ = bird_font_dialog_get_visible (_tmp0_);
		_tmp2_ = _tmp1_;
		if (_tmp2_) {
			BirdFontNativeWindow* _tmp3_;
			_tmp3_ = bird_font_main_window_native_window;
			bird_font_native_window_set_cursor (_tmp3_, BIRD_FONT_NATIVE_WINDOW_VISIBLE);
		} else {
			BirdFontNativeWindow* _tmp4_;
			_tmp4_ = bird_font_main_window_native_window;
			bird_font_native_window_set_cursor (_tmp4_, flags);
		}
	}
}

BirdFontMessageDialog*
bird_font_main_window_show_message (const gchar* text)
{
	BirdFontTab* t = NULL;
	BirdFontTabBar* _tmp0_;
	BirdFontTabBar* _tmp1_;
	BirdFontTab* _tmp2_;
	BirdFontTab* _tmp3_;
	gchar* tab_name = NULL;
	BirdFontTab* _tmp4_;
	BirdFontFontDisplay* _tmp5_;
	BirdFontFontDisplay* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	BirdFontMessageDialog* md = NULL;
	BirdFontMessageDialog* _tmp10_;
	BirdFontMessageDialog* result;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	_tmp1_ = _tmp0_;
	_tmp2_ = bird_font_tab_bar_get_selected_tab (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	t = _tmp3_;
	_tmp4_ = t;
	_tmp5_ = bird_font_tab_get_display (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = bird_font_font_display_get_name (_tmp6_);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	tab_name = _tmp8_;
	_tmp9_ = tab_name;
	if (g_strcmp0 (_tmp9_, "Preview") == 0) {
		bird_font_menu_tab_select_overview ();
	}
	_tmp10_ = bird_font_message_dialog_new (text);
	md = _tmp10_;
	bird_font_main_window_show_dialog ((BirdFontDialog*) md);
	result = md;
	_g_free0 (tab_name);
	_g_object_unref0 (t);
	return result;
}

void
bird_font_main_window_hide_dialog (void)
{
	BirdFontDialog* _tmp0_;
	BirdFontDialog* _tmp1_;
	_tmp0_ = bird_font_dialog_new ();
	_g_object_unref0 (bird_font_main_window_dialog);
	bird_font_main_window_dialog = _tmp0_;
	_tmp1_ = bird_font_main_window_dialog;
	bird_font_dialog_set_visible (_tmp1_, FALSE);
	bird_font_glyph_canvas_redraw ();
}

void
bird_font_main_window_set_menu (BirdFontAbstractMenu* m)
{
	BirdFontAbstractMenu* _tmp0_;
	g_return_if_fail (m != NULL);
	_tmp0_ = _g_object_ref0 (m);
	_g_object_unref0 (bird_font_main_window_menu);
	bird_font_main_window_menu = _tmp0_;
}

BirdFontAbstractMenu*
bird_font_main_window_get_menu (void)
{
	BirdFontAbstractMenu* _tmp0_;
	BirdFontAbstractMenu* _tmp1_;
	BirdFontAbstractMenu* result;
	_tmp0_ = bird_font_main_window_menu;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

/** Set the number of pixels per millimeter for the current screen. */
void
bird_font_main_window_set_units_per_pixel (gdouble u)
{
	bird_font_main_window_units = u;
}

void
bird_font_main_window_init (void)
{
	BirdFontMainWindow* _tmp0_;
	_tmp0_ = bird_font_main_window_new ();
	_g_object_unref0 (bird_font_main_window_singleton);
	bird_font_main_window_singleton = _tmp0_;
}

BirdFontRecentFiles*
bird_font_main_window_get_recent_files_tab (void)
{
	BirdFontRecentFiles* _tmp0_;
	BirdFontRecentFiles* _tmp1_;
	BirdFontRecentFiles* result;
	_tmp0_ = bird_font_main_window_file_tab;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
__lambda520_ (void)
{
	BirdFontTabBar* _tmp0_;
	gboolean result;
	_tmp0_ = bird_font_main_window_tabs;
	bird_font_tab_bar_select_tab_name (_tmp0_, "Files");
	result = FALSE;
	return result;
}

static gboolean
___lambda520__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda520_ ();
	return result;
}

void
bird_font_main_window_open_recent_files_tab (void)
{
	GSource* idle = NULL;
	GSource* _tmp0_;
	BirdFontTabBar* _tmp1_;
	BirdFontRecentFiles* _tmp2_;
	_tmp0_ = g_idle_source_new ();
	idle = _tmp0_;
	_tmp1_ = bird_font_main_window_tabs;
	_tmp2_ = bird_font_main_window_file_tab;
	bird_font_tab_bar_add_unique_tab (_tmp1_, (BirdFontFontDisplay*) _tmp2_, TRUE);
	g_source_set_callback (idle, ___lambda520__gsource_func, NULL, NULL);
	g_source_attach (idle, NULL);
	_g_source_unref0 (idle);
}

static gboolean
__lambda532_ (void)
{
	BirdFontMoveTool* _tmp0_;
	BirdFontMoveTool* _tmp1_;
	gboolean result;
	_tmp0_ = bird_font_drawing_tools_get_move_tool ();
	_tmp1_ = _tmp0_;
	bird_font_move_tool_select_all_paths (_tmp1_);
	result = FALSE;
	return result;
}

static gboolean
___lambda532__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda532_ ();
	return result;
}

void
bird_font_main_window_select_all_paths (void)
{
	BirdFontTool* t = NULL;
	BirdFontToolbox* _tmp0_;
	BirdFontTool* _tmp1_;
	gboolean _tmp2_ = FALSE;
	BirdFontTool* _tmp3_;
	GSource* idle = NULL;
	GSource* _tmp9_;
	_tmp0_ = bird_font_main_window_tools;
	_tmp1_ = bird_font_toolbox_get_current_tool (_tmp0_);
	t = _tmp1_;
	_tmp3_ = t;
	if (BIRD_FONT_IS_MOVE_TOOL (_tmp3_)) {
		_tmp2_ = TRUE;
	} else {
		BirdFontTool* _tmp4_;
		_tmp4_ = t;
		_tmp2_ = BIRD_FONT_IS_RESIZE_TOOL (_tmp4_);
	}
	if (!_tmp2_) {
		BirdFontToolbox* _tmp5_;
		BirdFontToolbox* _tmp6_;
		BirdFontMoveTool* _tmp7_;
		BirdFontMoveTool* _tmp8_;
		_tmp5_ = bird_font_main_window_get_toolbox ();
		_tmp6_ = _tmp5_;
		_tmp7_ = bird_font_drawing_tools_get_move_tool ();
		_tmp8_ = _tmp7_;
		bird_font_toolbox_select_tool (_tmp6_, (BirdFontTool*) _tmp8_);
		_g_object_unref0 (_tmp6_);
	}
	_tmp9_ = g_idle_source_new ();
	idle = _tmp9_;
	g_source_set_callback (idle, ___lambda532__gsource_func, NULL, NULL);
	g_source_attach (idle, NULL);
	_g_source_unref0 (idle);
	_g_object_unref0 (t);
}

BirdFontDrawingTools*
bird_font_main_window_get_drawing_tools (void)
{
	BirdFontDrawingTools* _tmp0_;
	BirdFontDrawingTools* _tmp1_;
	BirdFontDrawingTools* result;
	_tmp0_ = bird_font_toolbox_drawing_tools;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
bird_font_main_window_set_native (BirdFontMainWindow* self,
                                  BirdFontNativeWindow* nw)
{
	BirdFontNativeWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (nw != NULL);
	_tmp0_ = _g_object_ref0 (nw);
	_g_object_unref0 (bird_font_main_window_native_window);
	bird_font_main_window_native_window = _tmp0_;
}

BirdFontFontDisplay*
bird_font_main_window_get_current_display (void)
{
	BirdFontGlyphCanvas* _tmp0_;
	BirdFontGlyphCanvas* _tmp1_;
	BirdFontFontDisplay* _tmp2_;
	BirdFontFontDisplay* _tmp3_;
	BirdFontFontDisplay* result;
	_tmp0_ = bird_font_main_window_get_glyph_canvas ();
	_tmp1_ = _tmp0_;
	_tmp2_ = bird_font_glyph_canvas_get_current_display (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

BirdFontGlyphCanvas*
bird_font_main_window_get_glyph_canvas (void)
{
	BirdFontGlyphCanvas* _tmp0_;
	BirdFontGlyphCanvas* _tmp1_;
	BirdFontGlyphCanvas* result;
	_tmp0_ = bird_font_main_window_glyph_canvas;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

BirdFontGlyphCollection*
bird_font_main_window_get_current_glyph_collection (void)
{
	BirdFontGlyphCollection* _tmp0_;
	BirdFontGlyphCollection* _tmp2_;
	BirdFontGlyphCollection* _tmp3_;
	BirdFontGlyphCollection* result;
	_tmp0_ = bird_font_bird_font_current_glyph_collection;
	if (G_UNLIKELY (bird_font_is_null (_tmp0_))) {
		BirdFontGlyphCollection* gc = NULL;
		BirdFontGlyphCollection* _tmp1_;
		g_warning ("MainWindow.vala:202: No default glyph have been set yet.\n");
		_tmp1_ = bird_font_glyph_collection_new_with_glyph ((gunichar) '\0', "");
		_g_object_unref0 (gc);
		gc = _tmp1_;
		result = gc;
		return result;
	}
	_tmp2_ = bird_font_bird_font_current_glyph_collection;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

BirdFontGlyph*
bird_font_main_window_get_current_glyph (void)
{
	BirdFontGlyphCollection* _tmp0_;
	BirdFontGlyphCollection* _tmp1_;
	BirdFontGlyph* _tmp2_;
	BirdFontGlyph* _tmp3_;
	BirdFontGlyph* result;
	_tmp0_ = bird_font_main_window_get_current_glyph_collection ();
	_tmp1_ = _tmp0_;
	_tmp2_ = bird_font_glyph_collection_get_current (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

BirdFontToolbox*
bird_font_main_window_get_toolbox (void)
{
	BirdFontToolbox* _tmp0_;
	BirdFontToolbox* _tmp1_;
	BirdFontToolbox* result;
	_tmp0_ = bird_font_main_window_tools;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

BirdFontTool*
bird_font_main_window_get_tool (const gchar* n)
{
	BirdFontToolbox* _tmp0_;
	BirdFontTool* _tmp1_;
	BirdFontTool* result;
	g_return_val_if_fail (n != NULL, NULL);
	_tmp0_ = bird_font_main_window_tools;
	_tmp1_ = bird_font_toolbox_get_tool (_tmp0_, n);
	result = _tmp1_;
	return result;
}

BirdFontTabBar*
bird_font_main_window_get_tab_bar (void)
{
	BirdFontTabBar* _tmp0_;
	BirdFontTabBar* _tmp1_;
	BirdFontTabBar* result;
	_tmp0_ = bird_font_main_window_tabs;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

BirdFontTab*
bird_font_main_window_get_current_tab (void)
{
	BirdFontTabBar* _tmp0_;
	BirdFontTab* _tmp1_;
	BirdFontTab* result;
	_tmp0_ = bird_font_main_window_tabs;
	_tmp1_ = bird_font_tab_bar_get_selected_tab (_tmp0_);
	result = _tmp1_;
	return result;
}

gboolean
bird_font_main_window_select_tab (BirdFontTab* t)
{
	BirdFontTabBar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (t != NULL, FALSE);
	_tmp0_ = bird_font_main_window_tabs;
	result = bird_font_tab_bar_selected_open_tab (_tmp0_, t);
	return result;
}

BirdFontSpacingClassTab*
bird_font_main_window_get_spacing_class_tab (void)
{
	BirdFontSpacingClassTab* _tmp0_;
	BirdFontSpacingClassTab* _tmp1_;
	BirdFontSpacingClassTab* result;
	_tmp0_ = bird_font_main_window_spacing_class_tab;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
__lambda540_ (const gchar* text)
{
	g_return_if_fail (text != NULL);
	bird_font_preferences_set ("glyph_sequence", text);
	bird_font_glyph_canvas_redraw ();
}

static void
___lambda540__bird_font_text_listener_signal_text_input (BirdFontTextListener* _sender,
                                                         const gchar* text,
                                                         gpointer self)
{
	__lambda540_ (text);
}

static void
__lambda541_ (void)
{
	bird_font_tab_content_hide_text_input ();
}

static void
___lambda541__bird_font_text_listener_signal_submit (BirdFontTextListener* _sender,
                                                     const gchar* text,
                                                     gpointer self)
{
	__lambda541_ ();
}

void
bird_font_main_window_update_glyph_sequence (void)
{
	BirdFontTextListener* listener = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	BirdFontTextListener* _tmp6_;
	BirdFontTextListener* _tmp7_;
	_tmp0_ = bird_font_t_ ("Glyph sequence");
	_tmp1_ = _tmp0_;
	_tmp2_ = bird_font_preferences_get ("glyph_sequence");
	_tmp3_ = _tmp2_;
	_tmp4_ = bird_font_t_ ("Close");
	_tmp5_ = _tmp4_;
	_tmp6_ = bird_font_text_listener_new (_tmp1_, _tmp3_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	listener = _tmp7_;
	g_signal_connect (listener, "signal-text-input", (GCallback) ___lambda540__bird_font_text_listener_signal_text_input, NULL);
	g_signal_connect (listener, "signal-submit", (GCallback) ___lambda541__bird_font_text_listener_signal_submit, NULL);
	bird_font_tab_content_show_text_input (listener);
	_g_object_unref0 (listener);
}

BirdFontMainWindow*
bird_font_main_window_get_singleton (void)
{
	BirdFontMainWindow* _tmp0_;
	BirdFontMainWindow* _tmp1_;
	BirdFontMainWindow* result;
	_tmp0_ = bird_font_main_window_singleton;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
bird_font_main_window_file_chooser (const gchar* title,
                                    BirdFontFileChooser* fc,
                                    guint flags)
{
	BirdFontNativeWindow* _tmp0_;
	g_return_if_fail (title != NULL);
	g_return_if_fail (fc != NULL);
	_tmp0_ = bird_font_main_window_native_window;
	bird_font_native_window_file_chooser (_tmp0_, title, fc, flags);
}

void
bird_font_main_window_hide_scrollbar (void)
{
	BirdFontNativeWindow* _tmp0_;
	_tmp0_ = bird_font_main_window_native_window;
	if (!bird_font_is_null (_tmp0_)) {
		BirdFontScrollbar* _tmp1_;
		_tmp1_ = bird_font_main_window_scrollbar;
		bird_font_scrollbar_set_size (_tmp1_, (gdouble) -1);
	}
}

void
bird_font_main_window_show_scrollbar (void)
{
	BirdFontNativeWindow* _tmp0_;
	_tmp0_ = bird_font_main_window_native_window;
	if (!bird_font_is_null (_tmp0_)) {
		BirdFontScrollbar* _tmp1_;
		_tmp1_ = bird_font_main_window_scrollbar;
		bird_font_scrollbar_set_size (_tmp1_, bird_font_main_window_scrollbar_size);
	}
}

void
bird_font_main_window_set_scrollbar_size (gdouble size)
{
	BirdFontNativeWindow* _tmp0_;
	_tmp0_ = bird_font_main_window_native_window;
	if (!bird_font_is_null (_tmp0_)) {
		BirdFontScrollbar* _tmp1_;
		bird_font_main_window_scrollbar_size = size;
		_tmp1_ = bird_font_main_window_scrollbar;
		bird_font_scrollbar_set_size (_tmp1_, size);
	}
}

void
bird_font_main_window_set_scrollbar_position (gdouble position)
{
	BirdFontNativeWindow* _tmp0_;
	_tmp0_ = bird_font_main_window_native_window;
	if (!bird_font_is_null (_tmp0_)) {
		BirdFontScrollbar* _tmp1_;
		_tmp1_ = bird_font_main_window_scrollbar;
		bird_font_scrollbar_set_position (_tmp1_, position);
	}
}

void
bird_font_main_window_close_all_tabs (void)
{
	BirdFontTabBar* _tmp0_;
	BirdFontTabBar* _tmp1_;
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	_tmp1_ = _tmp0_;
	bird_font_tab_bar_close_all_tabs (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

gchar*
bird_font_main_window_translate (const gchar* s)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = bird_font_t_ (s);
	result = _tmp0_;
	return result;
}

BirdFontKerningDisplay*
bird_font_main_window_get_kerning_display (void)
{
	BirdFontKerningDisplay* _tmp0_;
	BirdFontKerningDisplay* _tmp1_;
	BirdFontKerningDisplay* result;
	_tmp0_ = bird_font_main_window_kerning_display;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

BirdFontLigatureList*
bird_font_main_window_get_ligature_display (void)
{
	BirdFontLigatureList* _tmp0_;
	BirdFontLigatureList* _tmp1_;
	BirdFontLigatureList* result;
	_tmp0_ = bird_font_main_window_ligature_display;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
bird_font_main_window_next_tab (void)
{
	BirdFontTabBar* tb = NULL;
	BirdFontTabBar* _tmp0_;
	gint n = 0;
	BirdFontTabBar* _tmp1_;
	BirdFontTabBar* _tmp2_;
	gint _tmp3_;
	BirdFontTabBar* _tmp4_;
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	tb = _tmp0_;
	_tmp1_ = tb;
	n = bird_font_tab_bar_get_selected (_tmp1_) + 1;
	_tmp2_ = tb;
	_tmp3_ = n;
	if (!((0 <= _tmp3_) && (_tmp3_ < bird_font_tab_bar_get_length (_tmp2_)))) {
		_g_object_unref0 (tb);
		return;
	}
	_tmp4_ = tb;
	bird_font_tab_bar_select_tab (_tmp4_, n, TRUE);
	_g_object_unref0 (tb);
}

void
bird_font_main_window_previous_tab (void)
{
	BirdFontTabBar* tb = NULL;
	BirdFontTabBar* _tmp0_;
	gint n = 0;
	BirdFontTabBar* _tmp1_;
	BirdFontTabBar* _tmp2_;
	gint _tmp3_;
	BirdFontTabBar* _tmp4_;
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	tb = _tmp0_;
	_tmp1_ = tb;
	n = bird_font_tab_bar_get_selected (_tmp1_) - 1;
	_tmp2_ = tb;
	_tmp3_ = n;
	if (!((0 <= _tmp3_) && (_tmp3_ < bird_font_tab_bar_get_length (_tmp2_)))) {
		_g_object_unref0 (tb);
		return;
	}
	_tmp4_ = tb;
	bird_font_tab_bar_select_tab (_tmp4_, n, TRUE);
	_g_object_unref0 (tb);
}

void
bird_font_main_window_close_tab (void)
{
	BirdFontTabBar* tb = NULL;
	BirdFontTabBar* _tmp0_;
	gint n = 0;
	BirdFontTabBar* _tmp1_;
	BirdFontTabBar* _tmp2_;
	gint _tmp3_;
	BirdFontTabBar* _tmp4_;
	_tmp0_ = bird_font_main_window_get_tab_bar ();
	tb = _tmp0_;
	_tmp1_ = tb;
	n = bird_font_tab_bar_get_selected (_tmp1_);
	_tmp2_ = tb;
	_tmp3_ = n;
	if (!((0 <= _tmp3_) && (_tmp3_ < bird_font_tab_bar_get_length (_tmp2_)))) {
		_g_object_unref0 (tb);
		return;
	}
	_tmp4_ = tb;
	bird_font_tab_bar_close_tab (_tmp4_, n, FALSE, TRUE);
	_g_object_unref0 (tb);
}

void
bird_font_main_window_set_toolbox (BirdFontToolbox* tb)
{
	BirdFontToolbox* _tmp0_;
	g_return_if_fail (tb != NULL);
	_tmp0_ = _g_object_ref0 (tb);
	_g_object_unref0 (bird_font_main_window_tools);
	bird_font_main_window_tools = _tmp0_;
}

BirdFontOverview*
bird_font_main_window_get_overview (void)
{
	BirdFontOverview* _tmp15_;
	BirdFontOverview* _tmp16_;
	BirdFontOverview* result;
	{
		GeeArrayList* _t_list = NULL;
		BirdFontTabBar* _tmp0_;
		GeeArrayList* _tmp1_;
		gint _t_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _t_index = 0;
		_tmp0_ = bird_font_main_window_tabs;
		_tmp1_ = _tmp0_->tabs;
		_t_list = _tmp1_;
		_tmp2_ = _t_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_t_size = _tmp4_;
		_t_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			BirdFontTab* t = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			BirdFontTab* _tmp9_;
			BirdFontFontDisplay* _tmp10_;
			BirdFontFontDisplay* _tmp11_;
			gboolean _tmp12_;
			_t_index = _t_index + 1;
			_tmp5_ = _t_index;
			_tmp6_ = _t_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _t_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _t_index);
			t = (BirdFontTab*) _tmp8_;
			_tmp9_ = t;
			_tmp10_ = bird_font_tab_get_display (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = BIRD_FONT_IS_OVERVIEW (_tmp11_);
			_g_object_unref0 (_tmp11_);
			if (_tmp12_) {
				BirdFontTab* _tmp13_;
				BirdFontFontDisplay* _tmp14_;
				_tmp13_ = t;
				_tmp14_ = bird_font_tab_get_display (_tmp13_);
				result = G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, BIRD_FONT_TYPE_OVERVIEW, BirdFontOverview);
				_g_object_unref0 (t);
				return result;
			}
			_g_object_unref0 (t);
		}
	}
	_tmp15_ = bird_font_main_window_overview;
	_tmp16_ = _g_object_ref0 (_tmp15_);
	result = _tmp16_;
	return result;
}

static void
bird_font_main_window_class_init (BirdFontMainWindowClass * klass,
                                  gpointer klass_data)
{
	bird_font_main_window_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = bird_font_main_window_finalize;
}

static void
bird_font_main_window_instance_init (BirdFontMainWindow * self,
                                     gpointer klass)
{
}

static void
bird_font_main_window_finalize (GObject * obj)
{
	BirdFontMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_MAIN_WINDOW, BirdFontMainWindow);
	G_OBJECT_CLASS (bird_font_main_window_parent_class)->finalize (obj);
}

static GType
bird_font_main_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontMainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontMainWindow), 0, (GInstanceInitFunc) bird_font_main_window_instance_init, NULL };
	GType bird_font_main_window_type_id;
	bird_font_main_window_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontMainWindow", &g_define_type_info, 0);
	return bird_font_main_window_type_id;
}

GType
bird_font_main_window_get_type (void)
{
	static volatile gsize bird_font_main_window_type_id__once = 0;
	if (g_once_init_enter (&bird_font_main_window_type_id__once)) {
		GType bird_font_main_window_type_id;
		bird_font_main_window_type_id = bird_font_main_window_get_type_once ();
		g_once_init_leave (&bird_font_main_window_type_id__once, bird_font_main_window_type_id);
	}
	return bird_font_main_window_type_id__once;
}

